/* ============================================================
   REUSABLE UI COMPONENTS
   ============================================================ */

.btn {
    height: 40px; display: inline-flex; align-items: center; justify-content: center;
    gap: 8px; font-size: 14px; font-weight: 600; padding-inline: 16px; border-radius: var(--hage-radius);
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.btn svg { width: 17px; height: 17px; }
.btn.btn-lg { height: 44px; padding-inline: 20px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { box-shadow: 0 1px 2px rgba(18, 60, 216, 0.05); }
.btn-primary:hover, .btn-primary:focus { box-shadow: 0 4px 10px -2px rgba(18, 60, 216, 0.35); }
.btn-outline-secondary {
    color: #344054; border-color: var(--hage-input-border); background: var(--hage-surface);
}
.btn-outline-secondary:hover, .btn-outline-secondary:focus {
    background: var(--hage-bg) !important; border-color: var(--hage-input-border) !important; color: var(--hage-text) !important;
}
.btn-soft-primary {
    background: var(--hage-primary-soft); border: 1px solid transparent; color: var(--hage-primary-hover);
}
.btn-soft-primary:hover, .btn-soft-primary:focus { background: #E1EAFF; color: var(--hage-primary-hover); }

/* ---------------------------------------------------------------
   Cards
   --------------------------------------------------------------- */
.hage-card {
    background: var(--hage-surface);
    border: 1px solid var(--hage-border-card);
    border-radius: var(--hage-radius-lg);
    box-shadow: var(--hage-shadow-sm);
}
.hage-card__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px 18px 12px; }
.hage-card__body { padding: 0 18px 18px; }
.hage-card__body--flush { padding: 0; }
.hage-card__title { font-size: 14.5px; font-weight: 600; color: var(--hage-text); margin-bottom: 2px; }
.hage-card__subtitle { font-size: 12.5px; color: var(--hage-text-secondary); margin-bottom: 0; }

/* ---------------------------------------------------------------
   KPI cards — compact per the approved reference (v2): tighter
   padding/gap than a generic card, smaller icon chip.
   --------------------------------------------------------------- */
.hage-kpi-card { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.hage-kpi-card__icon { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.hage-kpi-card__icon svg { width: 18px; height: 18px; }
.hage-kpi-card__icon--blue { background: var(--hage-soft-blue); color: var(--hage-primary); }
.hage-kpi-card__icon--green { background: var(--hage-soft-green); color: var(--hage-success); }
.hage-kpi-card__icon--violet { background: var(--hage-soft-violet); color: var(--hage-purple); }
.hage-kpi-card__icon--orange { background: var(--hage-soft-orange); color: var(--hage-warning); }
.hage-kpi-card__icon--red { background: var(--hage-soft-red); color: var(--hage-danger); }
.hage-kpi-card__icon--gray { background: var(--hage-soft-gray); color: var(--hage-text-secondary); }
.hage-kpi-card__icon--emerald { background: var(--hage-soft-emerald); color: #12896A; }
.hage-kpi-card__icon--cyan { background: var(--hage-soft-cyan); color: var(--hage-info); }
.hage-kpi-card__value { font-size: 26px; font-weight: 700; color: var(--hage-text); line-height: 1.15; letter-spacing: -0.03em; }
.hage-kpi-card__label { font-size: 12.5px; color: var(--hage-text-secondary); font-weight: 500; }
.hage-kpi-card__helper { font-size: 11.5px; color: var(--hage-muted); }
.hage-kpi-card__trend { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; }
.hage-kpi-card__trend svg { width: 13px; height: 13px; }
.hage-kpi-card__trend span { font-weight: 500; color: var(--hage-muted); margin-inline-start: 2px; }
.hage-kpi-card__trend--up { color: var(--hage-success); }
.hage-kpi-card__trend--down { color: var(--hage-danger); }

/* ---------------------------------------------------------------
   Quick-action cards — a compact icon+title(+helper) link, always
   inside a `row row-cols-*` grid so its width comes from the grid
   (never a manually stretched half/full-width bar). Replaces the old
   ad-hoc `class="hage-card hage-card__body d-block"` pattern that
   rendered as a long flat empty box on Payroll/Employees/Attendance/
   Purchases overviews.
   --------------------------------------------------------------- */
.hage-action-card {
    display: flex; align-items: center; gap: 12px;
    background: var(--hage-surface); border: 1px solid var(--hage-border-card);
    border-radius: var(--hage-radius-lg); padding: 14px 16px; height: 100%;
    text-decoration: none; color: inherit;
    transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.hage-action-card:hover, .hage-action-card:focus {
    box-shadow: var(--hage-shadow-sm); border-color: var(--hage-primary);
    transform: translateY(-1px); color: inherit; text-decoration: none;
}
.hage-action-card__icon {
    width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--hage-soft-blue); color: var(--hage-primary);
}
.hage-action-card__icon svg { width: 18px; height: 18px; }
.hage-action-card__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hage-action-card__title { font-size: 13.5px; font-weight: 600; color: var(--hage-text); }
.hage-action-card__helper { font-size: 11.5px; color: var(--hage-muted); }

/* ---------------------------------------------------------------
   Dashboard chart-card frames — real chart chrome (axes, legends,
   donut rings) styled to match a premium reference composition even
   while the underlying module has no data yet. Every number in these
   frames is real (usually 0) — never fabricated. See docs note in
   dashboard/index.php.
   --------------------------------------------------------------- */
.hage-chart-card__value { font-size: 26px; font-weight: 700; color: var(--hage-text); line-height: 1.2; }
.hage-chart-card__value-label { font-size: 12.5px; color: var(--hage-text-secondary); font-weight: 500; margin-bottom: 2px; }

.hage-linechart-frame { position: relative; height: 180px; }
.hage-linechart-frame__grid {
    position: absolute; inset: 0;
    background-image: repeating-linear-gradient(to top, var(--hage-border) 0, var(--hage-border) 1px, transparent 1px, transparent 25%);
}
.hage-linechart-frame__empty {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    flex-direction: column; text-align: center; padding: 0 24px;
}

.hage-donut { position: relative; width: 128px; height: 128px; border-radius: 50%; flex-shrink: 0; }
.hage-donut__hole {
    position: absolute; inset: 14px; background: var(--hage-surface); border-radius: 50%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.hage-donut__hole-value { font-size: 21px; font-weight: 700; color: var(--hage-text); line-height: 1; }
.hage-donut__hole-label { font-size: 10.5px; color: var(--hage-text-secondary); margin-top: 3px; }

.hage-legend-row { display: flex; align-items: center; gap: 7px; font-size: 12px; padding: 4px 0; }
.hage-legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.hage-legend-row__label { color: var(--hage-text-secondary); flex: 1; }
.hage-legend-row__value { font-weight: 600; color: var(--hage-text); }

.hage-barchart-frame { display: flex; align-items: flex-end; gap: 8px; height: 140px; padding-top: 8px; border-bottom: 1px solid var(--hage-border); }
.hage-barchart-frame__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.hage-barchart-frame__bar { width: 100%; max-width: 24px; border-radius: 4px 4px 0 0; background: var(--hage-soft-blue); min-height: 3px; }
.hage-barchart-frame__tick { font-size: 10.5px; color: var(--hage-muted); margin-top: 5px; }

.hage-task-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--hage-border); }
.hage-task-row:last-child { border-bottom: none; }
.hage-task-row__check { width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid var(--hage-input-border); flex-shrink: 0; }
.hage-task-row__title { font-size: 13px; font-weight: 600; color: var(--hage-text); }
.hage-task-row__sub { font-size: 11.5px; color: var(--hage-text-secondary); }
.hage-task-row__due { font-size: 11px; color: var(--hage-muted); white-space: nowrap; }
.hage-task-row--empty .hage-task-row__title { color: var(--hage-text-secondary); font-weight: 600; }
.hage-task-row--empty .hage-activity-icon { background: var(--hage-soft-gray); color: var(--hage-muted); }

.hage-activity-icon {
    width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.hage-activity-icon svg { width: 15px; height: 15px; }
.hage-activity-icon--blue { background: var(--hage-soft-blue); color: var(--hage-primary); }
.hage-activity-icon--green { background: var(--hage-soft-green); color: var(--hage-success); }
.hage-activity-icon--violet { background: var(--hage-soft-violet); color: var(--hage-purple); }
.hage-activity-icon--orange { background: var(--hage-soft-orange); color: var(--hage-warning); }
.hage-activity-icon--cyan { background: var(--hage-soft-cyan); color: var(--hage-info); }
.hage-activity-icon--gray { background: var(--hage-soft-gray); color: var(--hage-text-secondary); }

.hage-promo-card {
    position: relative; overflow: hidden; border-radius: var(--hage-radius-lg);
    background: linear-gradient(160deg, var(--hage-navy) 0%, var(--hage-primary-hover) 120%);
    border: none;
}
.hage-promo-card__glow-a { position: absolute; inset-inline-end: -50px; inset-block-start: -60px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, rgba(46,144,250,0.35), transparent 70%); }
.hage-promo-card__glow-b { position: absolute; inset-inline-start: -40px; inset-block-end: -50px; width: 140px; height: 140px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,0.1), transparent 70%); }
.hage-promo-card__icon {
    width: 40px; height: 40px; border-radius: 10px; margin-bottom: 12px;
    background: rgba(255,255,255,0.14); display: inline-flex; align-items: center; justify-content: center;
}
.hage-promo-card__icon svg { width: 20px; height: 20px; color: #fff; }

/* ---------------------------------------------------------------
   Badges
   --------------------------------------------------------------- */
.hage-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; line-height: 1.4; }
.hage-badge--green { background: var(--hage-soft-green); color: #067647; }
.hage-badge--blue { background: var(--hage-soft-blue); color: var(--hage-primary-hover); }
.hage-badge--orange { background: var(--hage-soft-orange); color: #B54708; }
.hage-badge--purple { background: var(--hage-soft-violet); color: var(--hage-purple); }
.hage-badge--red { background: var(--hage-soft-red); color: #B42318; }
.hage-badge--gray { background: var(--hage-soft-gray); color: var(--hage-text-secondary); border: 1px solid var(--hage-border); }

/* ---------------------------------------------------------------
   Dropdowns
   --------------------------------------------------------------- */
.hage-dropdown-menu { border: 1px solid var(--hage-border-card); border-radius: var(--hage-radius-lg); box-shadow: var(--hage-shadow); padding: 8px; min-width: 230px; }
.hage-dropdown-menu .dropdown-item { display: flex; align-items: center; gap: 10px; border-radius: 6px; padding: 9px 10px; font-size: 13px; font-weight: 500; color: var(--hage-text); }
.hage-dropdown-menu .dropdown-item svg { width: 16px; height: 16px; color: var(--hage-text-secondary); flex-shrink: 0; }
.hage-dropdown-menu .dropdown-item:hover, .hage-dropdown-menu .dropdown-item:focus { background-color: var(--hage-bg); color: var(--hage-text); }
.hage-dropdown-menu .dropdown-item.is-danger { color: var(--hage-danger); }
.hage-dropdown-menu .dropdown-item.is-danger svg { color: var(--hage-danger); }
.hage-dropdown-menu .dropdown-item.is-danger:hover { background-color: var(--hage-soft-red); }
.hage-dropdown-menu .dropdown-item.disabled { opacity: 0.5; cursor: not-allowed; }
.hage-dropdown-menu .dropdown-divider { margin: 6px 3px; border-color: var(--hage-border); }

/* ---------------------------------------------------------------
   Notifications (topbar bell)
   --------------------------------------------------------------- */
.hage-notif-badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--hage-danger); color: #fff; font-size: 10px; line-height: 16px; text-align: center; font-weight: 600; }
.hage-notif-panel { width: 340px; max-width: 90vw; padding: 0; }
.hage-notif-panel .dropdown-divider { margin: 0; }
.hage-notif-item { display: block; padding: 10px 14px; border-bottom: 1px solid var(--hage-border); text-decoration: none; color: var(--hage-text); }
.hage-notif-item:last-child { border-bottom: none; }
.hage-notif-item:hover { background-color: var(--hage-bg); }
.hage-notif-item__title { font-size: 13px; font-weight: 600; }
.hage-notif-item__message { font-size: 12px; color: var(--hage-text-secondary); margin-top: 2px; }
.hage-notif-item__time { font-size: 11px; color: var(--hage-text-secondary); margin-top: 4px; }

/* ---------------------------------------------------------------
   Alerts
   --------------------------------------------------------------- */
.hage-alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--hage-radius); font-size: 13px; border: 1px solid transparent; }
.hage-alert__icon { width: 26px; height: 26px; border-radius: 999px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.hage-alert__icon svg { width: 14px; height: 14px; }
.hage-alert--success { background: var(--hage-soft-green); color: #067647; }
.hage-alert--success .hage-alert__icon { background: rgba(18,183,106,0.18); color: #067647; }
.hage-alert--danger { background: var(--hage-soft-red); color: #B42318; }
.hage-alert--danger .hage-alert__icon { background: rgba(240,68,56,0.18); color: #B42318; }
.hage-alert--warning { background: var(--hage-soft-orange); color: #B54708; }
.hage-alert--warning .hage-alert__icon { background: rgba(247,144,9,0.18); color: #B54708; }
.hage-alert--info { background: var(--hage-soft-cyan); color: #175CD3; }
.hage-alert--info .hage-alert__icon { background: rgba(46,144,250,0.18); color: #175CD3; }

/* ---------------------------------------------------------------
   Empty states
   --------------------------------------------------------------- */
.hage-empty-state { text-align: center; padding: 48px 24px; color: var(--hage-text-secondary); }
.hage-empty-state--compact { padding: 32px 20px; }
.hage-empty-state__icon { width: 52px; height: 52px; border-radius: 50%; background: var(--hage-primary-soft); color: var(--hage-primary); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.hage-empty-state__icon svg { width: 24px; height: 24px; }
.hage-empty-state__title { font-weight: 600; color: var(--hage-text); margin-bottom: 4px; font-size: 15px; }
.hage-empty-state__text { font-size: 13px; margin-bottom: 0; max-width: 340px; margin-inline: auto; }
.hage-empty-state__action { margin-top: 20px; }

/* ---------------------------------------------------------------
   Table
   --------------------------------------------------------------- */
.hage-table { width: 100%; font-size: 14px; border-collapse: separate; border-spacing: 0; }
.hage-table thead th { background: #F8FAFC; text-transform: uppercase; font-size: 11px; letter-spacing: 0.06em; color: var(--hage-muted); font-weight: 600; border-bottom: 1px solid var(--hage-border); padding: 12px 18px; white-space: nowrap; }
.hage-table tbody td { padding: 0 18px; height: 58px; border-bottom: 1px solid var(--hage-border); color: var(--hage-text); vertical-align: middle; }
.hage-table tbody tr { transition: background-color 0.12s ease; }
.hage-table tbody tr:hover td { background-color: #F8FAFC; }
.hage-table tbody tr:last-child td { border-bottom: none; }

/* ---------------------------------------------------------------
   Avatar
   --------------------------------------------------------------- */
.hage-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--hage-primary-soft); color: var(--hage-primary-hover); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.hage-avatar--sm { width: 30px; height: 30px; font-size: 11px; }
.hage-avatar--lg { width: 64px; height: 64px; font-size: 20px; }

/* ---------------------------------------------------------------
   Skeleton loaders
   --------------------------------------------------------------- */
@keyframes hage-skeleton-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.hage-skeleton { background-color: var(--hage-border-card); border-radius: 6px; animation: hage-skeleton-pulse 1.6s ease-in-out infinite; }

/* ---------------------------------------------------------------
   Modals
   --------------------------------------------------------------- */
.modal-content { border: 1px solid var(--hage-border-card); border-radius: 16px; box-shadow: var(--hage-shadow); }
.modal-header { padding: 18px 22px; border-bottom: 1px solid var(--hage-border); }
.modal-header .modal-title { font-size: 16px; font-weight: 700; color: var(--hage-text); }
.modal-header .btn-close { font-size: 12px; opacity: 0.5; }
.modal-header .btn-close:hover { opacity: 0.8; }
.modal-body { padding: 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--hage-border); gap: 8px; }

/* ---------------------------------------------------------------
   Dashboard hero banner — light/airy per the approved reference
   (v2): dark navy text on a soft blue-white gradient, not a dark
   navy panel with white text.
   --------------------------------------------------------------- */
.hage-hero {
    position: relative; overflow: hidden;
    border-radius: 16px;
    background: linear-gradient(115deg, #EAF1FF 0%, #F7FAFF 55%, #FFFFFF 100%);
    border: 1px solid var(--hage-border-card);
    color: var(--hage-text);
    padding: 24px 28px;
    display: flex; align-items: center; justify-content: space-between; gap: 24px;
    min-height: 176px;
}
.hage-hero__glow-a { position: absolute; inset-inline-end: -60px; inset-block-start: -90px; width: 300px; height: 300px; border-radius: 50%; background: radial-gradient(circle, rgba(46,144,250,0.14), transparent 70%); }
.hage-hero__glow-b { position: absolute; inset-inline-start: 20%; inset-block-end: -130px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(18,60,216,0.06), transparent 70%); }
.hage-hero__content { position: relative; z-index: 1; max-width: 480px; }
.hage-hero__greeting { font-size: 24px; font-weight: 800; margin-bottom: 5px; line-height: 1.2; color: var(--hage-navy); }
.hage-hero__subtitle { font-size: 14px; font-weight: 600; color: var(--hage-text); margin-bottom: 3px; }
.hage-hero__line { font-size: 13px; color: var(--hage-text-secondary); margin-bottom: 10px; }
.hage-hero__tagline { font-size: 12.5px; font-style: italic; font-weight: 600; color: var(--hage-primary); margin-bottom: 14px; }
.hage-hero__badges { display: flex; flex-wrap: wrap; gap: 8px; }
.hage-hero__badge {
    display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600;
    background: rgba(255,255,255,0.85); border: 1px solid rgba(18,60,216,0.14);
    padding: 5px 11px; border-radius: 999px; color: var(--hage-navy);
    box-shadow: 0 1px 2px rgba(16,24,40,0.04);
}
.hage-hero__badge svg { width: 13px; height: 13px; color: var(--hage-primary); }
/* Flat-illustration office building — deliberately not a stock photo
   (none was supplied/approved) — light daytime palette to read as
   "photographic-adjacent" rather than the earlier dark skyline. */
.hage-hero__visual {
    position: relative; z-index: 1; flex-shrink: 0;
    width: 260px; align-self: stretch; border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(180deg, #CFE4FF 0%, #EAF3FF 70%, #F7FAFF 100%);
}
.hage-hero__visual svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hage-hero__tag {
    position: absolute; z-index: 1; inset-inline-end: 18px; inset-block-start: 14px;
    font-size: 11px; font-style: italic; font-weight: 600; color: var(--hage-text-secondary);
}
@media (max-width: 1199.98px) {
    .hage-hero__visual { width: 190px; }
}
@media (max-width: 991.98px) {
    .hage-hero__visual { display: none; }
}
@media (max-width: 575.98px) {
    .hage-hero { flex-direction: column; align-items: flex-start; padding: 22px; min-height: 0; }
    .hage-hero__greeting { font-size: 20px; }
    .hage-hero__tag { display: none; }
}

.hage-shortcuts { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hage-shortcut {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--hage-surface); color: var(--hage-primary); font-weight: 600; font-size: 14px;
    padding: 10px 14px; border-radius: 999px;
    border: 1px solid #DBE6FF;
    box-shadow: var(--hage-shadow-sm);
}
.hage-shortcut:hover { background: var(--hage-primary-soft); color: var(--hage-primary-hover); border-color: #C7D7FE; }
.hage-shortcut svg { width: 16px; height: 16px; }

/* ---------------------------------------------------------------
   Standalone error pages (403/404)
   --------------------------------------------------------------- */
.hage-error-code { font-size: 72px; font-weight: 800; color: var(--hage-primary); line-height: 1; margin-bottom: 8px; }
.hage-error-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--hage-primary-soft); color: var(--hage-primary); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 24px; }
.hage-error-icon svg { width: 28px; height: 28px; }
