/* ============================================================================
   EVANNE LIGHTHOUSE CHRISTIAN SCHOOL — SBA MANAGEMENT SYSTEM
   Design System · Generation 5 · "Navy & Indigo" — R1 premium refinement
   ----------------------------------------------------------------------------
   Self-contained, single-layer system. Typography runs on a self-hosted
   variable Inter with a deliberate type scale and ONLY these weights:
   400 (regular) · 500 (medium) · 600 (semibold) · 700 (bold).

   CONTRACT (do not break):
   - All class names used by the Blade views are preserved.
   - CSS variable names are preserved, including school-branding injection:
     `--brand-primary` / `--brand-sidebar` (set inline on the admin shell)
     and `--login-brand` (set inline on the login view) always win over the
     defaults declared here.
   - `--primary`, `--primary-dark`, `--primary-light`, `--sidebar-bg`
     legacy aliases remain mapped for the layout's base stylesheet.
   ============================================================================ */

/* ── Self-hosted variable font (offline-safe, no CDN) ──────── */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/inter-var-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    color-scheme: light;

    /* Brand */
    --brand-primary: #1E3A8A;                                       /* deep navy */
    --brand-primary-strong: #16275F;                                /* pressed navy */
    --brand-primary-soft: #EEF2FF;                                  /* indigo mist */
    --brand-secondary: #0F1E3D;                                     /* ink navy */
    --brand-accent: #4F46E5;                                        /* indigo 600 */
    --brand-accent-soft: #818CF8;                                   /* indigo 400 */

    /* Surfaces & text */
    --app-canvas: #F6F7FB;
    --app-surface: #FFFFFF;
    --app-text: #0F172A;
    --app-muted: #5B6B84;
    --app-border: #E4E8F0;
    --app-border-strong: #D4DAE6;

    /* Semantic */
    --app-success: #059669;
    --app-warning: #D97706;
    --app-danger:  #DC2626;
    --app-info:    #2563EB;

    /* Secondary palette (dashboards, action grids, timetable) */
    --palette-blue:   #2563EB;
    --palette-green:  #059669;
    --palette-purple: #6D28D9;
    --palette-teal:   #0D9488;
    --palette-pink:   #DB2777;
    --palette-orange: #EA580C;
    --palette-gold:   #D97706;
    --palette-navy:   #1E3A8A;
    --palette-indigo: #4F46E5;

    /* ── Type scale (deliberate, compact — readabile, not oversized) ── */
    --text-2xs:   10.5px;   /* group labels, timestamps — absolute floor   */
    --text-xs:    11.5px;   /* field labels, badges, meta rows             */
    --text-sm:    12.5px;   /* table body, sub-navigation                 */
    --text-base:  13.5px;   /* buttons, inputs, body copy                  */
    --text-md:    14px;     /* application base                            */
    --text-lg:    16px;     /* panel titles                                */
    --text-xl:    19px;     /* page titles                                 */
    --text-2xl:   24px;     /* hero / KPI display                          */

    --leading-tight:  1.2;
    --leading-snug:   1.35;
    --leading-normal: 1.55;

    /* Spacing */
    --space-1: .25rem;
    --space-2: .5rem;
    --space-3: .75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;

    /* Radii — three steps only */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    /* Elevation — soft, layered, never heavy */
    --shadow-soft: 0 1px 2px rgba(15, 23, 42, .05), 0 3px 10px rgba(15, 23, 42, .04);
    --shadow-card: 0 1px 3px rgba(15, 23, 42, .06), 0 10px 28px rgba(15, 23, 42, .07);
    --shadow-popover: 0 24px 60px rgba(8, 15, 35, .22);

    /* Motion — smooth but restrained */
    --motion-fast: 150ms cubic-bezier(.4, 0, .2, 1);
    --motion-normal: 220ms cubic-bezier(.4, 0, .2, 1);

    --font-ui: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
    --touch-min: 44px;   /* mobile interactive minimum */
}

/* =============================================================
   1 · APPLICATION SHELL
   ============================================================= */
.app-shell {
    --primary: var(--brand-primary);
    --primary-dark: var(--brand-primary-strong);
    --primary-light: var(--brand-primary-soft);
    --sidebar-bg: var(--brand-sidebar, #0E1B3A);
    background: var(--app-canvas);
    color: var(--app-text);
    font: 400 var(--text-md)/var(--leading-normal) var(--font-ui);
    -webkit-font-smoothing: antialiased;
}

.app-shell :where(button, input, select, textarea) { font: inherit; }
.app-shell :where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 2px solid color-mix(in srgb, var(--brand-accent) 45%, transparent);
    outline-offset: 2px;
}

/* ── Sidebar — flat deep navy, indigo indicator ───────────── */
.app-shell .sidebar {
    width: var(--sidebar-width, 260px);
    height: 100dvh;
    background: var(--sidebar-bg);
    border-right: 1px solid rgba(255, 255, 255, .07);
    box-shadow: 8px 0 24px rgba(10, 18, 40, .14);
    transition: transform var(--motion-normal), box-shadow var(--motion-normal);
}
.app-shell .sidebar-brand { padding: 24px 20px 18px; text-align: left; }
.app-shell .sidebar-brand img,
.app-shell .sidebar-brand .school-mark {
    width: 42px; height: 42px; margin: 0 0 12px; border-radius: var(--radius-sm);
    border: 1px solid rgba(165, 180, 252, .35);
}
.app-shell .sidebar-brand .school-name { font-size: var(--text-sm); font-weight: 600; letter-spacing: -.01em; }
.app-shell .sidebar-brand .school-motto { font-size: var(--text-xs); }
.app-shell .sidebar-nav { padding: 8px 10px 18px; }
.app-shell .sidebar-section {
    padding: 14px 12px 6px;
    font-size: var(--text-2xs); font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
    color: rgba(199, 210, 254, .45);
}
.app-shell .sidebar-nav > a,
.app-shell .nav-group-btn {
    min-height: var(--touch-min); margin: 2px 0; padding: 10px 12px; border: 0; border-radius: 10px;
    color: rgba(226, 232, 240, .78); font-size: var(--text-sm); font-weight: 500;
    transition: background var(--motion-fast), color var(--motion-fast);
}
.app-shell .sidebar-nav > a:hover,
.app-shell .nav-group-btn:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.app-shell .sidebar-nav > a.active {
    background: rgba(99, 102, 241, .18); color: #fff; font-weight: 600;
    box-shadow: inset 3px 0 var(--brand-accent-soft);
}
.app-shell .sidebar-nav > a.active .nav-icon { color: #A5B4FC; }
.app-shell .nav-group-btn[aria-expanded="true"] { background: rgba(255, 255, 255, .06); border: 0; color: #fff; }
.app-shell .nav-group-children a { margin: 1px 0; padding: 9px 12px 9px 34px; border-radius: 8px; font-size: var(--text-sm); font-weight: 400; }
.app-shell .nav-group-children a.active {
    background: rgba(99, 102, 241, .15); color: #fff; font-weight: 600;
    box-shadow: inset 3px 0 rgba(129, 140, 248, .65);
}
.app-shell .sidebar-nav :where(.nav-icon) { font-size: 15px; }
.app-shell .nav-group-divider { margin: 8px 5px; background: rgba(255, 255, 255, .08); }
.app-shell .sidebar-footer { margin: 0; padding: 12px 14px 16px; border-top: 1px solid rgba(255, 255, 255, .1); }

.app-shell .sidebar-profile { display: flex; align-items: center; gap: 10px; padding: 4px 2px 2px; text-align: left; }
.app-shell .sidebar-profile-avatar {
    display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px;
    border-radius: 10px; background: rgba(99, 102, 241, .28); color: #fff; font-weight: 600;
}
.app-shell .sidebar-profile-copy { min-width: 0; flex: 1; }
.app-shell .sidebar-profile-name { overflow: hidden; color: #fff; font-size: var(--text-sm); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.app-shell .sidebar-profile-role { color: rgba(199, 210, 254, .6); font-size: var(--text-2xs); text-transform: capitalize; }
.app-shell .sidebar-profile-logout {
    display: grid; place-items: center; width: 36px; height: 36px;
    color: rgba(226, 232, 240, .72); border: 0; border-radius: 9px; background: transparent;
    transition: background var(--motion-fast), color var(--motion-fast);
}
.app-shell .sidebar-profile-logout:hover { color: #fff; background: rgba(99, 102, 241, .3); }

/* ── Topbar — clean, quiet ────────────────────────────────── */
.app-shell .topbar {
    height: 64px; padding: 0 28px;
    border-bottom: 1px solid var(--app-border);
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 1px 3px rgba(15, 23, 42, .04);
    backdrop-filter: blur(14px);
}
.app-shell .topbar-title { color: var(--brand-primary); font-size: var(--text-base); font-weight: 600; letter-spacing: -.01em; }
.app-shell .topbar-context {
    display: flex; align-items: center; gap: 8px; padding-left: 12px;
    border-left: 1px solid var(--app-border);
    color: var(--app-muted); font-size: var(--text-sm);
}
.app-shell .topbar-context i { color: var(--brand-accent); }
.app-shell .topbar-right { gap: 10px; }

.app-shell .academic-context {
    border: 1px solid #C7D2FE; border-radius: 999px;
    background: #EEF2FF; color: #3730A3;
    font-size: var(--text-xs); font-weight: 600;
}
.app-shell .academic-context i { color: var(--brand-accent); }

.app-shell .user-badge { padding: 4px 12px 4px 5px; border: 1px solid #DDE3F2; border-radius: 999px; background: #fff; }
.app-shell .user-badge .avatar { background: #E0E7FF; color: #3730A3; }
.app-shell .user-badge .user-name { color: var(--app-text); font-size: var(--text-sm); font-weight: 500; }

/* ── Content frame — constrained plane, generous margins ──── */
.app-shell .main-wrap { padding-top: 64px; }
.app-shell .content-area { width: min(100%, 1480px); margin: 0 auto; padding: 32px 36px 28px; }
.app-shell .main-footer {
    display: flex; align-items: center; justify-content: center; gap: 7px; flex-wrap: wrap;
    margin-top: 24px; padding: 16px 24px;
    border-color: var(--app-border); background: transparent; color: #7C8AA0; font-size: var(--text-xs);
}
.app-shell .main-footer strong { color: var(--brand-primary); font-weight: 600; }
.app-shell .main-footer-year { color: #94A3B8; }

/* =============================================================
   2 · PAGE FURNITURE — headers, cards
   ============================================================= */
.app-shell .page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 0 0 24px; }
.app-shell .page-header-copy { min-width: 0; }
.app-shell .page-title {
    margin: 0; color: var(--app-text);
    font-size: clamp(1.3rem, 2vw, var(--text-xl)); font-weight: 700;
    letter-spacing: -.03em; line-height: var(--leading-tight);
}
.app-shell .page-description { margin: 7px 0 0; color: var(--app-muted); font-size: var(--text-sm); }
.app-shell .page-breadcrumb { margin: 0 0 7px; color: var(--app-muted); font-size: var(--text-xs); }
.app-shell .section-title { color: var(--app-text); font-size: var(--text-lg); font-weight: 600; letter-spacing: -.01em; }

.app-shell .card { border: 1px solid var(--app-border); border-radius: var(--radius-md); background: var(--app-surface); box-shadow: var(--shadow-soft); }
.app-shell .card-header {
    padding: 16px 20px; border-bottom: 1px solid var(--app-border);
    border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
    background: #fff; color: var(--app-text); font-size: var(--text-base); font-weight: 600;
}
.app-shell .card-body { padding: 20px; }
.app-shell .card-footer { padding: 14px 20px; border-top: 1px solid var(--app-border); background: #fff; }

/* =============================================================
   3 · CONTROLS — buttons, forms
   ============================================================= */
.app-shell .btn {
    --bs-btn-font-size: var(--text-base); --bs-btn-font-weight: 600; --bs-btn-border-radius: var(--radius-sm);
    min-height: 38px;
    transition: background-color var(--motion-fast), border-color var(--motion-fast), box-shadow var(--motion-fast), transform var(--motion-fast), color var(--motion-fast);
}
.app-shell .btn:active { transform: translateY(1px); }
.app-shell .btn:disabled, .app-shell .btn.disabled { opacity: .58; transform: none; }
.app-shell .btn-primary, .app-shell .btn-success {
    --bs-btn-bg: var(--brand-primary); --bs-btn-border-color: var(--brand-primary);
    --bs-btn-hover-bg: var(--brand-primary-strong); --bs-btn-hover-border-color: var(--brand-primary-strong);
    --bs-btn-active-bg: var(--brand-primary-strong); --bs-btn-active-border-color: var(--brand-primary-strong);
    --bs-btn-focus-shadow-rgb: 30, 58, 138;
}
.app-shell .btn-primary:hover, .app-shell .btn-success:hover { box-shadow: 0 6px 16px rgba(30, 58, 138, .22); }
.app-shell .btn-outline-primary {
    --bs-btn-color: var(--brand-primary);
    --bs-btn-border-color: color-mix(in srgb, var(--brand-primary) 38%, #fff);
    --bs-btn-hover-bg: var(--brand-primary); --bs-btn-hover-border-color: var(--brand-primary);
    --bs-btn-active-bg: var(--brand-primary); --bs-btn-active-border-color: var(--brand-primary);
}
.app-shell .btn-outline-secondary {
    --bs-btn-color: var(--app-muted); --bs-btn-border-color: var(--app-border-strong);
    --bs-btn-hover-bg: #F1F4F9; --bs-btn-hover-border-color: var(--app-border-strong); --bs-btn-hover-color: var(--app-text);
}

.app-shell .form-label { margin-bottom: 6px; color: #33415C; font-size: var(--text-xs); font-weight: 600; }
.app-shell :where(.form-control, .form-select) {
    min-height: 40px; border-color: var(--app-border-strong); border-radius: var(--radius-sm);
    color: var(--app-text); font-size: var(--text-base); box-shadow: none;
    transition: border-color var(--motion-fast), box-shadow var(--motion-fast), background var(--motion-fast);
}
.app-shell textarea.form-control { min-height: unset; }
.app-shell :where(.form-control, .form-select):focus {
    border-color: color-mix(in srgb, var(--brand-accent) 62%, white);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-accent) 13%, transparent);
}
.app-shell .form-text { color: var(--app-muted); font-size: var(--text-xs); }
.app-shell .invalid-feedback { font-size: var(--text-xs); }
.app-shell .form-check-input:checked { border-color: var(--brand-accent); background-color: var(--brand-accent); }
.app-shell .form-check-input:focus {
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-accent) 15%, transparent);
}
.app-shell .form-check-input { width: 1.05em; height: 1.05em; }
.app-shell .form-check-label { font-size: var(--text-sm); }

/* ── Dropdowns — previously unstyled Bootstrap defaults ───── */
.app-shell .dropdown-menu {
    min-width: 210px; margin-top: 6px; padding: 6px;
    border: 1px solid var(--app-border); border-radius: var(--radius-md);
    background: #fff; box-shadow: var(--shadow-popover);
    font-size: var(--text-base);
}
.app-shell .dropdown-item { border-radius: 8px; padding: 9px 11px; color: var(--app-text); font-weight: 500; }
.app-shell .dropdown-item:hover, .app-shell .dropdown-item:focus {
    background: var(--brand-primary-soft); color: var(--brand-primary-strong);
}
.app-shell .dropdown-item:active { background: var(--brand-primary); color: #fff; }
.app-shell .dropdown-divider { margin: 6px 4px; border-color: var(--app-border); }
.app-shell .dropdown-header { padding: 7px 11px 4px; color: var(--app-muted); font-size: var(--text-2xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }

/* ── Tooltips ─────────────────────────────────────────────── */
.app-shell .tooltip-inner { border-radius: var(--radius-sm); background: #101F42; color: #E2E8F0; font-size: var(--text-xs); font-weight: 500; padding: 6px 10px; }
.app-shell .tooltip.bs-tooltip-top .tooltip-arrow::before { border-top-color: #101F42; }
.app-shell .tooltip.bs-tooltip-bottom .tooltip-arrow::before { border-bottom-color: #101F42; }
.app-shell .tooltip.bs-tooltip-start .tooltip-arrow::before { border-left-color: #101F42; }
.app-shell .tooltip.bs-tooltip-end .tooltip-arrow::before { border-right-color: #101F42; }

/* =============================================================
   4 · DATA — tables, badges, alerts, modals, pagination
   ============================================================= */
.app-shell .table { --bs-table-color: var(--app-text); --bs-table-border-color: #EDF0F5; margin-bottom: 0; font-size: var(--text-sm); }
.app-shell .table thead th {
    padding: 12px 14px;
    border-bottom: 1px solid var(--app-border-strong);
    background: #F7F8FC; color: #33415C;
    font-size: var(--text-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
}
.app-shell .table td { padding: 12px 14px; }
.app-shell .table tbody tr { transition: background-color var(--motion-fast); }
.app-shell .table-hover > tbody > tr:hover > * { --bs-table-bg-state: #F4F6FD; }

.app-shell .badge { padding: .4em .7em; border-radius: 999px; font-size: var(--text-xs); font-weight: 600; }

.app-shell .alert { padding: 12px 16px; border: 1px solid transparent; border-radius: var(--radius-sm); font-size: var(--text-sm); }
.app-shell .alert-success { color: #065F46; border-color: #C8EBD9; background: #EFF9F4; }
.app-shell .alert-danger  { color: #991B1B; border-color: #F5D6D6; background: #FEF4F3; }
.app-shell .alert-warning { color: #92400E; border-color: #F1E2BB; background: #FFFAEB; }
.app-shell .alert-info    { color: #1E40AF; border-color: #D2E1FA; background: #F0F5FE; }

.app-shell .modal-content { overflow: hidden; border: 1px solid var(--app-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-popover); }
.app-shell .modal-header, .app-shell .modal-footer { padding: 16px 20px; border-color: var(--app-border); }
.app-shell .modal-title { font-size: var(--text-lg); font-weight: 600; }
.app-shell .modal-body { padding: 20px; }

.app-shell .pagination { gap: 4px; }
.app-shell .page-link { border-color: var(--app-border); border-radius: var(--radius-sm) !important; color: var(--brand-primary); font-size: var(--text-sm); }
.app-shell .page-item.active .page-link { border-color: var(--brand-primary); background: var(--brand-primary); }

/* ── Empty & loading states ───────────────────────────────── */
.app-shell .empty-state { display: grid; justify-items: center; gap: 7px; padding: 40px 20px; color: var(--app-muted); text-align: center; }
.app-shell .empty-state-icon {
    display: grid; place-items: center; width: 46px; height: 46px;
    border-radius: var(--radius-md); background: var(--brand-primary-soft); color: var(--brand-accent); font-size: 20px;
}
.app-shell .empty-state-title { margin: 3px 0 0; color: var(--app-text); font-size: var(--text-base); font-weight: 600; }
.app-shell .empty-state-copy { max-width: 380px; margin: 0; font-size: var(--text-sm); }
.app-shell .loading-spinner {
    width: 1rem; height: 1rem;
    border: .15em solid currentColor; border-right-color: transparent; border-radius: 50%;
    animation: app-spin .65s linear infinite;
}
@keyframes app-spin { to { transform: rotate(360deg); } }

/* =============================================================
   5 · RESPONSIVE SHELL — off-canvas sidebar, 44px targets
   ============================================================= */
.app-shell .sidebar-backdrop { display: none; }
.app-shell.sidebar-open { overflow: hidden; }
.app-shell .mobile-menu-toggle {
    display: none; align-items: center; justify-content: center;
    width: var(--touch-min); height: var(--touch-min); padding: 0;
    border: 1px solid var(--app-border); border-radius: 10px;
    background: #fff; color: var(--app-text);
}

@media (max-width: 992px) {
    .app-shell .content-area { padding: 26px 24px 24px; }
}
@media (max-width: 768px) {
    .app-shell .sidebar { display: flex; width: min(300px, calc(100vw - 44px)); transform: translateX(-105%); visibility: hidden; }
    .app-shell.sidebar-open .sidebar { transform: translateX(0); visibility: visible; }
    .app-shell .sidebar-backdrop {
        position: fixed; inset: 0; z-index: 1035; display: block; border: 0;
        background: rgba(10, 18, 38, .5); opacity: 0; visibility: hidden;
        transition: opacity var(--motion-normal), visibility var(--motion-normal);
    }
    .app-shell.sidebar-open .sidebar-backdrop { opacity: 1; visibility: visible; }
    .app-shell .mobile-menu-toggle { display: inline-flex; flex: 0 0 auto; }
    .app-shell .topbar { left: 0; height: 60px; padding: 0 16px; gap: 12px; }
    .app-shell .topbar-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .app-shell .topbar-context { display: none; }
    .app-shell .topbar-right { margin-left: auto; gap: 7px; }
    .app-shell .main-wrap { margin-left: 0; padding-top: 60px; }
    .app-shell .content-area { padding: 22px 18px 20px; }
    .app-shell .page-header { align-items: flex-start; flex-direction: column; gap: 12px; }
    .app-shell .page-header-actions { display: flex; width: 100%; flex-wrap: wrap; gap: 8px; }

    /* 44px touch targets on phones */
    .app-shell .btn { min-height: var(--touch-min); }
    .app-shell .btn-sm { min-height: var(--touch-min); }
    .app-shell :where(.form-control, .form-select) { min-height: var(--touch-min); }
    .app-shell .page-link { min-width: var(--touch-min); min-height: var(--touch-min); display: inline-flex; align-items: center; justify-content: center; }
    .app-shell .dropdown-item { padding: 12px 11px; }
    .app-shell .nav-link, .app-shell .dropdown-toggle { min-height: var(--touch-min); display: inline-flex; align-items: center; }
}
@media (max-width: 575.98px) {
    .app-shell .content-area { padding: 18px 14px 16px; }
    .app-shell .card-body { padding: 16px; }
    .app-shell .card-header { padding: 14px 16px; }
    .app-shell .table-responsive { border: 1px solid var(--app-border); border-radius: var(--radius-sm); }
    .app-shell .table-responsive > .table { min-width: 620px; }
    .app-shell .main-footer { margin-top: 12px; padding: 14px 10px; }
}
@media (prefers-reduced-motion: reduce) {
    .app-shell *, .app-shell *::before, .app-shell *::after {
        scroll-behavior: auto !important; animation-duration: .01ms !important;
        animation-iteration-count: 1 !important; transition-duration: .01ms !important;
    }
}

/* ── Auth shell (guest pages outside the admin app) ───────── */
.auth-shell { min-height: 100vh; background: var(--app-canvas); color: var(--app-text); font: 400 var(--text-md)/var(--leading-normal) var(--font-ui); -webkit-font-smoothing: antialiased; }
.auth-shell :where(button, input, select, textarea):focus-visible { outline: 2px solid color-mix(in srgb, var(--brand-accent) 45%, transparent); outline-offset: 2px; }

/* =============================================================
   6 · DASHBOARD PRESENTATION
   ============================================================= */
.dashboard-page { display: grid; gap: 24px; min-width: 0; }

/* ── Hero banner — flat, typographic, no ornament ─────────── */
.dashboard-hero {
    position: relative; display: flex; align-items: center; justify-content: space-between;
    gap: 24px; min-width: 0; padding: 28px 32px;
    border: 1px solid var(--app-border); border-radius: var(--radius-lg);
    background: #fff; box-shadow: var(--shadow-soft);
}
.dashboard-hero-deco { display: none; }   /* decorative layer retired */
.dashboard-hero-content, .dashboard-hero-context { position: relative; z-index: 1; }
.dashboard-hero-brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.dashboard-hero-logo {
    display: grid; place-items: center; width: 52px; height: 52px; flex: 0 0 52px; overflow: hidden;
    border: 1px solid #D8DEF5; border-radius: var(--radius-md);
    background: var(--brand-primary-soft); color: var(--brand-accent); font-size: 22px;
}
.dashboard-hero-logo img { width: 100%; height: 100%; object-fit: cover; }
.dashboard-eyebrow { margin-bottom: 6px; color: var(--brand-accent); font-size: var(--text-2xs); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.dashboard-title {
    margin: 0; color: var(--app-text);
    font-size: clamp(1.4rem, 2.2vw, var(--text-2xl)); font-weight: 700;
    letter-spacing: -.035em; line-height: var(--leading-tight);
}
.dashboard-subtitle { margin: 7px 0 0; color: var(--app-muted); font-size: var(--text-sm); }
.dashboard-hero-context {
    display: grid; gap: 6px; min-width: 172px; padding: 13px 16px;
    border: 1px solid var(--app-border); border-radius: var(--radius-md);
    background: #FAFBFE; color: var(--app-muted); font-size: var(--text-xs);
}
.dashboard-hero-context > span i { color: var(--brand-accent); }
.dashboard-hero-context strong { color: var(--brand-primary); font-size: var(--text-sm); font-weight: 600; }

/* ── KPI stat cards ───────────────────────────────────────── */
.dashboard-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.dashboard-stat-grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.dashboard-stat {
    position: relative; display: flex; align-items: flex-start; gap: 12px;
    min-width: 0; min-height: 112px; padding: 18px;
    border: 1px solid var(--app-border); border-top: 3px solid var(--stat-color, var(--brand-primary));
    border-radius: var(--radius-md); background: var(--app-surface);
    box-shadow: var(--shadow-soft); color: inherit; text-decoration: none;
    transition: transform var(--motion-fast), box-shadow var(--motion-fast), border-color var(--motion-fast);
}
.dashboard-stat-link:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--stat-color, var(--brand-primary)) 38%, #fff);
    border-top-color: var(--stat-color, var(--brand-primary));
    box-shadow: 0 10px 24px color-mix(in srgb, var(--stat-color, var(--brand-primary)) 13%, transparent);
    color: inherit;
}
.dashboard-stat-icon {
    display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px;
    border-radius: 10px; background: var(--stat-soft); color: var(--stat-color); font-size: 16px;
}
.dashboard-stat-copy { display: grid; min-width: 0; gap: 4px; }
.dashboard-stat-label { color: #475569; font-size: var(--text-xs); font-weight: 600; }
.dashboard-stat-value {
    overflow-wrap: anywhere; color: #111827;
    font-size: clamp(1.15rem, 1.6vw, 1.5rem); font-weight: 700;
    letter-spacing: -.035em; line-height: var(--leading-tight);
    font-variant-numeric: tabular-nums;
}
.dashboard-stat-detail { color: #718096; font-size: var(--text-xs); line-height: var(--leading-snug); }
.dashboard-stat-arrow { position: absolute; top: 16px; right: 15px; color: #A2AFBE; font-size: 11px; }

/* Stat tones */
.dashboard-stat-primary { --stat-color: #1E3A8A; --stat-soft: #EEF2FF; }
.dashboard-stat-blue   { --stat-color: #2563EB; --stat-soft: #EFF6FF; }
.dashboard-stat-green  { --stat-color: #059669; --stat-soft: #ECFDF5; }
.dashboard-stat-violet { --stat-color: #6D28D9; --stat-soft: #F5F3FF; }
.dashboard-stat-amber  { --stat-color: #D97706; --stat-soft: #FFFBEB; }
.dashboard-stat-rose   { --stat-color: #DB2777; --stat-soft: #FDF2F8; }
.dashboard-stat-teal   { --stat-color: #0D9488; --stat-soft: #F0FDFA; }
/* "Students present today" reads as success, not brand */
.admin-dashboard section[aria-label="Today's operations"] .dashboard-stat-primary { --stat-color: #059669; --stat-soft: #ECFDF5; }

/* ── Section headings & panels ────────────────────────────── */
.dashboard-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.dashboard-section-heading-copy { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dashboard-section-icon {
    display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px;
    border-radius: 10px; background: var(--brand-primary-soft); color: var(--brand-accent); font-size: 14px;
}
.dashboard-section-title { margin: 0; color: #172033; font-size: var(--text-base); font-weight: 600; letter-spacing: -.01em; }
.dashboard-section-description { margin: 3px 0 0; color: var(--app-muted); font-size: var(--text-xs); }
.dashboard-section-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.dashboard-panel {
    min-width: 0; overflow: hidden;
    border: 1px solid var(--app-border); border-radius: var(--radius-md);
    background: #fff; box-shadow: var(--shadow-soft);
}
.dashboard-panel-body { padding: 20px; }

/* Panel accent strips */
.panel-accent-red    { border-top: 3px solid #DC2626; }
.panel-accent-blue   { border-top: 3px solid #2563EB; }
.panel-accent-green  { border-top: 3px solid #059669; }
.panel-accent-amber  { border-top: 3px solid #D97706; }
.panel-accent-violet { border-top: 3px solid #6D28D9; }
.panel-accent-teal   { border-top: 3px solid #0D9488; }
.panel-accent-navy   { border-top: 3px solid #1E3A8A; }

/* ── Dashboard grids ──────────────────────────────────────── */
.dashboard-grid-2     { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .85fr); gap: 18px; }
.dashboard-grid-equal { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.dashboard-grid-main  { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 18px; }
.dashboard-chart-wrap { position: relative; width: 100%; min-width: 0; border-radius: 10px; overflow: hidden; }
.dashboard-more-tools { grid-template-columns: repeat(6, minmax(0, 1fr)); }

/* ── Inline metrics & progress ────────────────────────────── */
.dashboard-metric-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.dashboard-metric { padding: 12px; border: 1px solid var(--app-border); border-radius: 10px; background: #F9FAFC; }
.dashboard-metric:nth-child(1) { background: #F0FDF7; }
.dashboard-metric:nth-child(2) { background: #F0F6FF; }
.dashboard-metric:nth-child(3) { background: #F3F5FF; }
.dashboard-metric-label { display: block; color: var(--app-muted); font-size: var(--text-xs); }
.dashboard-metric { min-width: 0; }
.dashboard-metric-value {
    display: block; margin-top: 4px; color: #0F172A;
    font-size: 18px; font-weight: 700; letter-spacing: -.02em;
    line-height: 1.3; font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}
.dashboard-metric-currency {
    font-size: .78em; font-weight: 600; color: var(--app-muted);
    margin-right: 1px;
}
@media (max-width: 1400px) {
    .dashboard-metric-value { font-size: 15px; }
}

/* Finance metrics adapt to their own panel width (the analytics right
   column stays narrow between ~1100px and ~1500px viewports), so long
   currency amounts stack instead of clipping. Viewport fallback at
   430px remains below. */
.finance-snapshot-panel { container-type: inline-size; }
@container (max-width: 440px) {
    .dashboard-metric-row { grid-template-columns: minmax(0, 1fr); }
    .dashboard-metric-value { font-size: 16px; }
}

.metric-today       { border-top: 3px solid #059669; background: #F0FDF7 !important; }
.metric-month       { border-top: 3px solid #2563EB; background: #F0F6FF !important; }
.metric-outstanding { border-top: 3px solid #DC2626; background: #FEF3F2 !important; }
.metric-today .dashboard-metric-value       { color: #059669; }
.metric-month .dashboard-metric-value       { color: #1D4ED8; }
.metric-outstanding .dashboard-metric-value { color: #DC2626; }

.dashboard-progress-row { display: grid; grid-template-columns: minmax(70px, 1fr) auto; align-items: center; gap: 7px 12px; margin-top: 12px; color: var(--app-muted); font-size: var(--text-xs); }
.dashboard-progress-row .progress { grid-column: 1 / -1; height: 6px; overflow: hidden; border-radius: 999px; background: #EEF2F7; }
.dashboard-progress-row .progress-bar { border-radius: inherit; background: var(--brand-primary); }

/* Performance bars */
.perf-row { display: grid; gap: 7px; }
.perf-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.perf-item-label { font-size: var(--text-sm); font-weight: 500; color: var(--app-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perf-item-sub   { font-size: var(--text-2xs); color: var(--app-muted); }
.perf-item-pct   { font-size: var(--text-sm); font-weight: 700; color: var(--perf-color, var(--brand-primary)); text-align: right; font-variant-numeric: tabular-nums; }
.perf-item-unit  { margin-left: 3px; color: var(--app-muted); font-size: var(--text-2xs); font-weight: 600; letter-spacing: .02em; }
.perf-track { grid-column: 1 / -1; height: 7px; border-radius: 999px; background: #EEF2F7; overflow: hidden; }
.perf-fill { height: 100%; border-radius: inherit; background: var(--perf-color, #1E3A8A); transition: width .5s cubic-bezier(.4, 0, .2, 1); }

/* ── List rows ────────────────────────────────────────────── */
.dashboard-list { display: grid; }
.dashboard-list-item {
    display: flex; align-items: center; gap: 12px; min-width: 0; padding: 14px 18px;
    border-bottom: 1px solid #EDF1F5; color: inherit; text-decoration: none;
    transition: background var(--motion-fast);
}
.dashboard-list-item:last-child { border-bottom: 0; }
.dashboard-list-item:hover { background: #F4F6FD; color: inherit; }
.dashboard-list-icon {
    display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px;
    border-radius: 10px; background: var(--brand-primary-soft); color: var(--brand-accent);
}
.dashboard-list-copy { min-width: 0; flex: 1; }
.dashboard-list-title { overflow: hidden; color: var(--app-text); font-size: var(--text-sm); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-list-meta { overflow: hidden; margin-top: 3px; color: var(--app-muted); font-size: var(--text-xs); text-overflow: ellipsis; white-space: nowrap; }
.dashboard-list-end { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

/* ── Activity timeline ────────────────────────────────────── */
.dashboard-activity { position: relative; display: grid; gap: 0; padding: 4px 20px 4px 24px; }
.dashboard-activity::before { position: absolute; top: 14px; bottom: 15px; left: 34px; width: 1px; background: #E6EAF2; content: ""; }
.dashboard-activity-item { position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; }
.dashboard-activity-marker {
    z-index: 1; display: grid; place-items: center; width: 21px; height: 21px; flex: 0 0 21px;
    border: 3px solid white; border-radius: 50%;
    background: var(--brand-accent); color: #fff; font-size: 8px;
    box-shadow: 0 0 0 1px #DCE2F1;
}
.dashboard-activity-copy { min-width: 0; padding-top: 2px; }
.dashboard-activity-title { color: var(--app-text); font-size: var(--text-sm); font-weight: 500; overflow-wrap: anywhere; }
.dashboard-activity-meta { margin-top: 3px; color: var(--app-muted); font-size: var(--text-xs); }

/* ── Empty blocks ─────────────────────────────────────────── */
.dashboard-empty { display: grid; justify-items: center; gap: 6px; padding: 30px 18px; color: var(--app-muted); text-align: center; }
.dashboard-empty i {
    display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 3px;
    border-radius: var(--radius-md); background: var(--brand-primary-soft); color: var(--brand-accent); font-size: 20px;
}
.dashboard-empty strong { color: var(--app-text); font-size: var(--text-base); }
.dashboard-empty span { font-size: var(--text-xs); }

/* ── Quick actions ────────────────────────────────────────── */
.dashboard-action-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.dashboard-action {
    display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 44px; padding: 11px 12px;
    border: 1px solid var(--app-border); border-radius: 10px;
    background: #fff; color: var(--app-text); text-decoration: none; text-align: left;
    transition: border-color var(--motion-fast), background var(--motion-fast), transform var(--motion-fast), box-shadow var(--motion-fast);
}
.dashboard-action:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--action-color, var(--brand-primary)) 32%, #fff);
    background: color-mix(in srgb, var(--action-soft, #EEF2FF) 36%, #fff);
    box-shadow: 0 6px 14px color-mix(in srgb, var(--action-color, var(--brand-primary)) 10%, transparent);
    color: var(--app-text);
}
.dashboard-action-icon {
    display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 32px;
    border-radius: 9px; background: var(--action-soft, #EEF2FF); color: var(--action-color, var(--brand-accent)); font-size: 14px;
}
.dashboard-action-label { overflow: hidden; font-size: var(--text-sm); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.action-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* R4 · below 900px the host panel is too narrow for three labels without
   heavy ellipsis ("Add stud…") — two columns keep labels readable. */
@media (max-width: 900px) { .action-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Rotating action tones */
.dashboard-action-grid > .dashboard-action:nth-child(8n+1) { --action-color: #2563EB; --action-soft: #EFF6FF; }
.dashboard-action-grid > .dashboard-action:nth-child(8n+2) { --action-color: #059669; --action-soft: #ECFDF5; }
.dashboard-action-grid > .dashboard-action:nth-child(8n+3) { --action-color: #0D9488; --action-soft: #F0FDFA; }
.dashboard-action-grid > .dashboard-action:nth-child(8n+4) { --action-color: #6D28D9; --action-soft: #F5F3FF; }
.dashboard-action-grid > .dashboard-action:nth-child(8n+5) { --action-color: #1E3A8A; --action-soft: #EEF2FF; }
.dashboard-action-grid > .dashboard-action:nth-child(8n+6) { --action-color: #EA580C; --action-soft: #FFF7ED; }
.dashboard-action-grid > .dashboard-action:nth-child(8n+7) { --action-color: #D97706; --action-soft: #FFFBEB; }
.dashboard-action-grid > .dashboard-action:nth-child(8n)   { --action-color: #DB2777; --action-soft: #FDF2F8; }

/* ── Notices ──────────────────────────────────────────────── */
.dashboard-notice {
    padding: 14px 18px; border-bottom: 1px solid #EDF1F5; border-left: 3px solid var(--notice-color, #6D28D9);
    background: color-mix(in srgb, var(--notice-color, #6D28D9) 4%, #fff);
}
.dashboard-notice:last-child { border-bottom: 0; }
.dashboard-notice-title { color: var(--app-text); font-size: var(--text-base); font-weight: 600; }
.dashboard-notice-time { flex: 0 0 auto; color: var(--app-muted); font-size: var(--text-2xs); }
.dashboard-notice-body { margin-top: 4px; color: var(--app-muted); font-size: var(--text-xs); line-height: var(--leading-snug); }
.dashboard-priority-urgent    { --notice-color: #DC2626; }
.dashboard-priority-important { --notice-color: #D97706; }
.dashboard-priority-normal    { --notice-color: #6D28D9; }

/* ── Status pills ─────────────────────────────────────────── */
.dashboard-status {
    display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px;
    border-radius: 999px; font-size: var(--text-2xs); font-weight: 600; letter-spacing: .02em; white-space: nowrap;
}
.dashboard-status-open, .dashboard-status-good { background: #ECFDF5; color: #047857; }
.dashboard-status-locked { background: #EEF2FF; color: #4338CA; }

/* ── Assignment rows ──────────────────────────────────────── */
.dashboard-assignment {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 9px 14px;
    padding: 14px 18px; border-bottom: 1px solid #EDF1F5;
    transition: background var(--motion-fast);
}
.dashboard-assignment:last-child { border-bottom: 0; }
.dashboard-assignment:hover { background: #F4F6FD; }
.dashboard-assignment:nth-child(even) { background: #FCFCFE; }
.dashboard-assignment-title { color: var(--app-text); font-size: var(--text-base); font-weight: 600; }
.dashboard-assignment-meta { margin-top: 3px; color: var(--app-muted); font-size: var(--text-xs); }
.dashboard-assignment-actions { display: flex; align-items: center; gap: 6px; }

/* ── Class cards ──────────────────────────────────────────── */
.dashboard-class-card {
    height: 100%; padding: 16px; border: 1px solid var(--app-border); border-radius: var(--radius-md);
    background: #fff;
    transition: transform var(--motion-fast), box-shadow var(--motion-fast), border-color var(--motion-fast);
}
.dashboard-class-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, .07);
    border-color: color-mix(in srgb, var(--brand-accent) 25%, var(--app-border));
}
.dashboard-class-name { color: var(--app-text); font-size: var(--text-base); font-weight: 600; }
.dashboard-class-subjects { margin-top: 4px; color: var(--app-muted); font-size: var(--text-xs); line-height: var(--leading-snug); }
.dashboard-class-foot { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

/* ── Attendance snapshot ──────────────────────────────────── */
.attendance-stat { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--app-border); }
.attendance-stat-present { background: #F0FDF7; border-color: #A7F3D0; }
.attendance-stat-absent  { background: #FEF3F2; border-color: #FECACA; }
.attendance-stat-late    { background: #FFFBEB; border-color: #FDE68A; }
.attendance-stat-value   { font-size: 24px; font-weight: 700; letter-spacing: -.035em; line-height: var(--leading-tight); font-variant-numeric: tabular-nums; }
.attendance-stat-label   { font-size: var(--text-xs); color: var(--app-muted); font-weight: 600; margin-top: 2px; }
.attendance-pct-ring {
    display: flex; align-items: center; justify-content: center;
    width: 56px; height: 56px; border-radius: 50%;
    background: conic-gradient(var(--ring-color, #059669) var(--ring-pct, 0%), #E5E7EB 0%);
    box-shadow: inset 0 0 0 8px #fff;
    font-size: var(--text-sm); font-weight: 700; color: var(--ring-color, #059669);
    flex-shrink: 0;
}

/* ── Attention items ──────────────────────────────────────── */
.attention-item {
    display: flex; align-items: center; gap: 14px; padding: 15px 18px;
    border-bottom: 1px solid #EDF1F5; transition: background var(--motion-fast);
    text-decoration: none; color: inherit;
}
.attention-item:last-child { border-bottom: 0; }
.attention-item:hover { background: #F4F6FD; color: inherit; }
.attention-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.attention-dot-amber  { background: #F59E0B; box-shadow: 0 0 0 3px #FEF3C7; }
.attention-dot-violet { background: #818CF8; box-shadow: 0 0 0 3px #E0E7FF; }
.attention-dot-red    { background: #DC2626; box-shadow: 0 0 0 3px #FEE2E2; }
.attention-label { font-size: var(--text-base); font-weight: 600; color: var(--app-text); }
.attention-meta  { font-size: var(--text-xs); color: var(--app-muted); margin-top: 2px; }

/* ── Timetable slots ──────────────────────────────────────── */
.timetable-slot { display: flex; align-items: stretch; gap: 0; padding: 0; border-bottom: 1px solid #EDF1F5; }
.timetable-slot:last-child { border-bottom: 0; }
.timetable-slot-time {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 58px; min-width: 58px; padding: 12px 8px;
    background: var(--slot-bg, #F7F8FC); border-right: 1px solid #EDF1F5;
    font-size: var(--text-xs); font-weight: 600; color: var(--slot-color, var(--app-text)); line-height: var(--leading-snug); text-align: center;
}
.timetable-slot-body { flex: 1; padding: 13px 16px; min-width: 0; }
.timetable-slot-subject { font-size: var(--text-base); font-weight: 600; color: var(--app-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timetable-slot-meta { font-size: var(--text-xs); color: var(--app-muted); margin-top: 2px; }
/* Timetable is intentionally neutral — only the live Now/Next states
   carry colour (see §10). Position-based colour rotation removed. */

/* ── Labeled divider & tone helpers ───────────────────────── */
.section-divider {
    display: flex; align-items: center; gap: 10px; margin: 4px 0 16px;
    color: var(--app-muted); font-size: var(--text-2xs); font-weight: 600;
    letter-spacing: .1em; text-transform: uppercase;
}
.section-divider::before, .section-divider::after { content: ''; flex: 1; height: 1px; background: var(--app-border); }

.section-icon-blue   { background: #EFF6FF !important; color: #2563EB !important; }
.section-icon-green  { background: #ECFDF5 !important; color: #059669 !important; }
.section-icon-violet { background: #F5F3FF !important; color: #6D28D9 !important; }
.section-icon-teal   { background: #F0FDFA !important; color: #0D9488 !important; }
.section-icon-amber  { background: #FFFBEB !important; color: #D97706 !important; }
.section-icon-rose   { background: #FDF2F8 !important; color: #DB2777 !important; }
.section-icon-navy   { background: #EEF2FF !important; color: #1E3A8A !important; }

.stat-val-green { color: #059669 !important; }
.stat-val-red   { color: #DC2626 !important; }
.stat-val-teal  { color: #0D9488 !important; }
.stat-val-amber { color: #D97706 !important; }
.stat-val-navy  { color: #1E3A8A !important; }

/* ── Hero actions & role caption ──────────────────────────── */
.dashboard-hero-actions {
    position: relative; z-index: 1;
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
}
.dashboard-hero-actions .btn { min-height: 40px; }

.dashboard-hero-role {
    display: inline-flex; align-items: center; gap: 5px;
    padding-top: 6px; margin-top: 2px;
    border-top: 1px solid var(--app-border);
    color: #7C8AA0; font-size: var(--text-2xs); font-weight: 600; letter-spacing: .04em;
}
.dashboard-hero-role i { color: var(--brand-accent); }

/* ── Attendance overview — ring + status tiles ────────────── */
.attendance-overview { display: flex; align-items: center; gap: 16px; min-width: 0; }
.attendance-stats { display: grid; gap: 8px; flex: 1; min-width: 0; }
.attendance-stat i { font-size: 15px; }
.attendance-stat-present i { color: #059669; }
.attendance-stat-absent  i { color: #DC2626; }
.attendance-stat-late    i { color: #D97706; }

/* ── Dashboard responsive ─────────────────────────────────── */
@media (min-width: 768px) and (max-width: 1100px) {
    .dashboard-page { gap: 18px; }
    .dashboard-stat-grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1199.98px) {
    .dashboard-stat-grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dashboard-more-tools { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) { .dashboard-grid-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) {
    .dashboard-stat-grid:not(.dashboard-stat-grid-6) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-hero { flex-wrap: wrap; }
}
@media (max-width: 767.98px) {
    .dashboard-page { gap: 18px; }
    .dashboard-stat-grid, .dashboard-stat-grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .dashboard-grid-2, .dashboard-grid-equal, .dashboard-grid-main { grid-template-columns: minmax(0, 1fr); }
    .dashboard-stat { min-height: 104px; padding: 14px; gap: 10px; }
    .dashboard-stat-icon { width: 34px; height: 34px; flex-basis: 34px; }
    .dashboard-metric-row { gap: 8px; }
    .dashboard-metric { padding: 10px; }
    .dashboard-metric-value { font-size: 16px; }
    .dashboard-hero { flex-direction: column; align-items: stretch; gap: 16px; padding: 20px; }
    .dashboard-hero-context { min-width: 0; }
    .dashboard-hero-actions { width: 100%; }
    .dashboard-hero-actions .btn { flex: 1 1 auto; min-height: var(--touch-min); }
    .dashboard-panel-body { padding: 16px; }
}
@media (max-width: 430px) {
    .dashboard-stat-grid, .dashboard-stat-grid-6 { gap: 8px; }
    .dashboard-stat { min-height: 96px; padding: 12px 10px; gap: 8px; }
    .dashboard-stat-copy { gap: 2px; }
    .dashboard-stat-value { font-size: clamp(1.05rem, 5vw, 1.25rem); }
    .dashboard-stat-arrow { top: 10px; right: 9px; }
    .dashboard-hero-brand { gap: 12px; }
    .dashboard-hero-logo { width: 44px; height: 44px; flex-basis: 44px; }
    .dashboard-metric-row { grid-template-columns: 1fr; }
    .dashboard-action-grid { gap: 8px; }
    .dashboard-action { padding: 10px 10px; gap: 8px; }
}
@media (max-width: 360px) {
    .dashboard-stat-grid, .dashboard-stat-grid-6 { grid-template-columns: 1fr; }
    .dashboard-stat { min-height: 82px; }
}
@media (max-width: 575.98px) {
    /* Assignment rows: status + buttons wrap beneath the title on phones */
    .dashboard-assignment { grid-template-columns: minmax(0, 1fr); }
    .dashboard-assignment-actions { justify-content: flex-start; flex-wrap: wrap; }
    /* Attendance overview stacks vertically on small phones */
    .attendance-overview { flex-direction: column; align-items: stretch; }
    .attendance-pct-ring { margin: 0 auto; }
}

/* =============================================================
   7 · LOGIN EXPERIENCE — split screen
   ============================================================= */
.auth-login { --login-brand: var(--brand-primary, #1E3A8A); position: relative; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(410px, .9fr); min-height: 100vh; overflow: hidden; background: #F6F7FB; }
.auth-login-brand {
    position: relative; display: flex; align-items: center; justify-content: center;
    min-width: 0; padding: 56px clamp(30px, 6vw, 92px); overflow: hidden; color: white;
    background:
        radial-gradient(ellipse at 88% 10%, rgba(129, 140, 248, .3), transparent 34%),
        radial-gradient(ellipse at 6% 94%, rgba(30, 58, 138, .55), transparent 42%),
        linear-gradient(140deg, #0B1530 0%, #101F42 45%, #1E3A8A 84%, #312E81 120%);
}
.auth-login-brand::before, .auth-login-brand::after { position: absolute; border: 1px solid rgba(165, 180, 252, .16); border-radius: 50%; content: ""; pointer-events: none; }
.auth-login-brand::before { top: -240px; right: -130px; width: 580px; height: 580px; box-shadow: 0 0 0 42px rgba(129, 140, 248, .05), 0 0 0 88px rgba(129, 140, 248, .03); }
.auth-login-brand::after { bottom: -315px; left: -210px; width: 570px; height: 570px; }
.auth-login-brand-content { position: relative; z-index: 1; width: min(100%, 520px); }
.auth-login-school { display: flex; align-items: center; gap: 13px; margin-bottom: clamp(48px, 10vh, 100px); }
.auth-login-logo {
    display: grid; place-items: center; width: 48px; height: 48px; flex: 0 0 48px; overflow: hidden;
    border: 1px solid rgba(199, 210, 254, .4); border-radius: 14px;
    background: rgba(99, 102, 241, .32); color: #fff; font-size: 21px;
}
.auth-login-logo img { width: 100%; height: 100%; object-fit: cover; }
.auth-login-school-name { color: #fff; font-size: var(--text-sm); font-weight: 600; line-height: 1.4; }
.auth-login-school-caption { margin-top: 2px; color: rgba(199, 210, 254, .68); font-size: var(--text-2xs); letter-spacing: .11em; text-transform: uppercase; }
.auth-login-kicker { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 15px; color: #A5B4FC; font-size: var(--text-2xs); font-weight: 600; letter-spacing: .13em; text-transform: uppercase; }
.auth-login-headline { max-width: 520px; margin: 0; color: #fff; font-size: clamp(2.1rem, 4vw, 3.25rem); font-weight: 600; letter-spacing: -.05em; line-height: 1.05; }
.auth-login-headline em { color: #A5B4FC; font-style: normal; }
.auth-login-description { max-width: 420px; margin: 17px 0 0; color: rgba(224, 231, 255, .74); font-size: var(--text-sm); line-height: 1.75; }

.auth-login-panel { display: grid; place-items: center; min-width: 0; padding: 46px clamp(24px, 5vw, 76px); background: #fff; }
.auth-login-form { width: min(100%, 390px); }
.auth-login-form-eyebrow { display: inline-flex; align-items: center; gap: 7px; color: var(--login-brand); font-size: var(--text-2xs); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.auth-login-form-eyebrow i { color: var(--brand-accent); }
.auth-login-title { margin: 12px 0 6px; color: #0F172A; font-size: 28px; font-weight: 700; letter-spacing: -.045em; }
.auth-login-subtitle { margin: 0 0 28px; color: #64748B; font-size: var(--text-sm); }
.auth-login-field { margin-bottom: 17px; }
.auth-login-label { display: block; margin-bottom: 7px; color: #33415C; font-size: var(--text-xs); font-weight: 600; }
.auth-login-input-wrap { position: relative; }
.auth-login-input-icon { position: absolute; top: 50%; left: 14px; transform: translateY(-50%); color: #94A0B5; pointer-events: none; }
.auth-login-input {
    width: 100%; min-height: 47px; padding: 0 43px;
    border: 1px solid #DCE2ED; border-radius: 10px; outline: 0;
    background: #FBFCFE; color: #0F172A; font: 400 var(--text-base) var(--font-ui);
    transition: border-color var(--motion-fast), box-shadow var(--motion-fast), background var(--motion-fast);
}
.auth-login-input:focus {
    border-color: color-mix(in srgb, var(--login-brand) 65%, white); background: #fff;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--login-brand) 13%, transparent);
}
.auth-login-input::placeholder { color: #8A97A8; }
.auth-login-toggle { position: absolute; top: 50%; right: 9px; display: grid; place-items: center; width: 36px; height: 36px; transform: translateY(-50%); border: 0; border-radius: 8px; background: transparent; color: #728191; }
.auth-login-toggle:hover { background: #EEF1FB; color: var(--login-brand); }
.auth-login-options { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 1px 0 20px; }
.auth-login-remember { display: flex; align-items: center; gap: 7px; color: #586879; font-size: var(--text-xs); }
.auth-login-remember input { width: 15px; height: 15px; accent-color: var(--login-brand); }
.auth-login-forgot { color: var(--login-brand); font-size: var(--text-xs); font-weight: 600; text-decoration: none; }
.auth-login-forgot:hover { text-decoration: underline; }
.auth-login-submit {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; min-height: 48px; border: 0; border-radius: 10px;
    background: var(--login-brand); color: #fff; font: 600 var(--text-base) var(--font-ui);
    box-shadow: 0 7px 18px color-mix(in srgb, var(--login-brand) 22%, transparent);
    cursor: pointer;
    transition: background var(--motion-fast), transform var(--motion-fast), box-shadow var(--motion-fast);
}
.auth-login-submit:hover {
    transform: translateY(-1px);
    background: color-mix(in srgb, var(--login-brand) 86%, #0B1530);
    box-shadow: 0 9px 22px color-mix(in srgb, var(--login-brand) 26%, transparent);
}
.auth-login-submit:disabled { cursor: wait; opacity: .72; transform: none; }
.auth-login-spinner { width: 15px; height: 15px; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; border-radius: 50%; animation: app-spin .7s linear infinite; }
.auth-login-error { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 17px; padding: 11px 12px; border: 1px solid #F5D6D6; border-radius: 9px; background: #FEF4F3; color: #991B1B; font-size: var(--text-xs); }
/* Developer credit — the only element below the form now, so it reads as a
   quiet footer: separated by a hairline, generous space, readable contrast. */
.auth-login-credit {
    margin: 44px 0 0; padding-top: 18px;
    border-top: 1px solid #EEF1F6;
    color: #7C8AA0; font-size: var(--text-xs); text-align: center;
}
.auth-login-credit strong { color: #4A5A75; font-weight: 600; }

@keyframes login-enter { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }
.auth-login-brand-content, .auth-login-form { animation: login-enter 420ms ease both; }
.auth-login :where(input, button, a):focus-visible { outline: 2px solid rgba(129, 140, 248, .6); outline-offset: 3px; }

/* ── Login responsive ─────────────────────────────────────── */
@media (max-width: 900px) {
    .auth-login { grid-template-columns: minmax(0, 1fr) minmax(360px, .92fr); }
    .auth-login-brand { padding: 40px 34px; }
}
@media (max-width: 767.98px) {
    .auth-login { display: flex; flex-direction: column; min-height: 100vh; overflow: auto; }
    .auth-login-brand {
        min-height: 118px; justify-content: flex-start; padding: 16px 20px;
        background:
            radial-gradient(ellipse at 100% 0%, rgba(129, 140, 248, .32), transparent 40%),
            linear-gradient(120deg, #0B1530, #1E3A8A 70%, #312E81);
    }
    .auth-login-brand .auth-login-brand-content > .auth-login-kicker { display: inline-flex; margin: 12px 0 0; font-size: 9px; }
    .auth-login-brand .auth-login-brand-content > .auth-login-headline { display: block; margin: 3px 0 0; font-size: clamp(1.12rem, 4vw, 1.35rem); letter-spacing: -.035em; line-height: 1.18; }
    .auth-login-brand .auth-login-brand-content > .auth-login-description { display: none; }
    .auth-login-school { gap: 10px; margin: 0; }
    .auth-login-logo { width: 42px; height: 42px; flex-basis: 42px; }
    .auth-login-panel { flex: 1; align-items: flex-start; padding: 27px 22px 28px; }
    .auth-login-form { margin: 0 auto; }
    .auth-login-title { margin-top: 9px; font-size: 25px; }
    .auth-login-subtitle { margin-bottom: 23px; }
    .auth-login-credit { margin-top: 32px; padding-top: 16px; }
    /* Comfortable touch targets on phones */
    .auth-login-submit, .auth-login-input { min-height: var(--touch-min); }
    .auth-login-toggle { width: var(--touch-min); height: var(--touch-min); }
    .auth-login-remember input { width: 18px; height: 18px; }
}
@media (max-width: 430px) {
    .auth-login-brand { padding: 15px 16px; min-height: 112px; }
    .auth-login-panel { padding: 23px 17px 24px; }
    .auth-login-school-name { font-size: var(--text-xs); }
    .auth-login-school-caption { font-size: 9px; }
    .auth-login-options { align-items: flex-start; flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
    .auth-login *, .auth-login *::before, .auth-login *::after {
        animation-duration: .01ms !important; animation-iteration-count: 1 !important;
        scroll-behavior: auto !important; transition-duration: .01ms !important;
    }
}

/* =============================================================
   9 · R2 ADMIN DASHBOARD COMPOSITION
   New layout primitives only — existing rules are untouched.
   ============================================================= */

/* ── KPI hierarchy band ───────────────────────────────────── */
.dashboard-kpi-band { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }

/* Primary metric — same card anatomy, deliberately larger */
.dashboard-stat-feature { min-height: 132px; padding: 20px; }
.dashboard-stat-feature .dashboard-stat-icon { width: 46px; height: 46px; flex-basis: 46px; border-radius: 12px; font-size: 19px; }
.dashboard-stat-feature .dashboard-stat-value { font-size: clamp(1.6rem, 2.4vw, 2.05rem); }
.dashboard-stat-feature .dashboard-stat-detail { font-size: var(--text-xs); }

/* ── Tertiary census chips ────────────────────────────────── */
.dashboard-census-foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.dashboard-census-chip {
    display: inline-flex; align-items: center; gap: 7px;
    min-height: 36px; padding: 7px 13px;
    border: 1px solid var(--app-border); border-radius: 999px;
    background: #fff; color: var(--app-muted);
    font-size: var(--text-xs); font-weight: 500; text-decoration: none;
    transition: border-color var(--motion-fast), background var(--motion-fast), color var(--motion-fast);
}
.dashboard-census-chip:hover {
    border-color: color-mix(in srgb, var(--brand-accent) 32%, #fff);
    background: var(--brand-primary-soft); color: var(--app-text);
}
.dashboard-census-chip i { color: var(--brand-accent); }
.dashboard-census-chip strong { color: var(--app-text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── Chart context caption ────────────────────────────────── */
.dashboard-chart-caption {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px;
    margin-top: 12px; padding-top: 11px;
    border-top: 1px solid var(--app-border);
    color: var(--app-muted); font-size: var(--text-xs);
}
.dashboard-chart-caption strong { color: var(--app-text); font-weight: 600; font-variant-numeric: tabular-nums; }
.dashboard-chart-caption .ms-auto { margin-left: auto; }

/* Footnote — small explanatory note closing a panel */
.dashboard-footnote {
    margin: 14px 0 0; padding-top: 11px;
    border-top: 1px solid var(--app-border);
    color: var(--app-muted); font-size: var(--text-2xs); line-height: var(--leading-snug);
}

/* ── Notices as a card grid ───────────────────────────────── */
.dashboard-notices-grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 18px;
}
.dashboard-notices-grid .dashboard-notice {
    border: 1px solid var(--app-border);
    border-left: 3px solid var(--notice-color, #6D28D9);
    border-radius: var(--radius-sm);
}
.dashboard-notices-grid .dashboard-empty { grid-column: 1 / -1; }
.dashboard-notice-pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 999px;
    background: color-mix(in srgb, var(--notice-color, #6D28D9) 10%, #fff);
    color: var(--notice-color, #6D28D9);
    font-size: var(--text-2xs); font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
}
.dashboard-notice-audience { color: var(--app-muted); font-size: var(--text-2xs); font-weight: 600; }

/* ── R2 responsive ────────────────────────────────────────── */
@media (max-width: 1100px) {
    .dashboard-kpi-band { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-stat-feature { grid-column: span 2; }
    /* R4 · notice cards need ~250px+ for their pill/audience/time row;
       inside the halved grid-equal panels they clip between 768–1100px. */
    .dashboard-notices-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767.98px) {
    .dashboard-notices-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 620px) {
    .dashboard-kpi-band { grid-template-columns: minmax(0, 1fr); }
    .dashboard-stat-feature { grid-column: auto; }
}

/* =============================================================
   10 · R3 TEACHER DASHBOARD COMPOSITION
   New layout primitives only — existing rules are untouched.
   ============================================================= */

/* ── Hero actions stack neatly on wide screens ────────────── */
@media (min-width: 901px) {
    .dashboard-hero .dashboard-hero-actions {
        flex-direction: column; align-items: stretch; min-width: 230px;
    }
    .dashboard-hero .dashboard-hero-actions .btn { white-space: nowrap; }
}
.dashboard-hero-actions .badge { font-size: var(--text-2xs); }

/* ── Live timetable states (real times only) ──────────────── */
.timetable-slot-now  { background: #F4FCF8; }
.timetable-slot-now  .timetable-slot-time { --slot-bg: #D1FAE5; --slot-color: #047857; }
.timetable-slot-next { background: #F8F9FE; }
.timetable-slot-next .timetable-slot-time { --slot-bg: #E0E7FF; --slot-color: #4338CA; }
.dashboard-status-next { background: #EEF2FF; color: #4338CA; }

/* ── Assignment rows with subject monogram ────────────────── */
.dashboard-assignment-with-monogram { grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; }
.dashboard-assignment-monogram {
    display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px;
    border-radius: 10px; background: var(--brand-primary-soft); color: var(--brand-accent);
    font-size: 12px; font-weight: 700; letter-spacing: .02em;
}
@media (max-width: 575.98px) {
    .dashboard-assignment-with-monogram { grid-template-columns: auto minmax(0, 1fr); }
    .dashboard-assignment-with-monogram .dashboard-assignment-actions { grid-column: 1 / -1; }
    .dashboard-assignment-with-monogram .dashboard-assignment-actions .btn { min-height: var(--touch-min); }
}

/* ── Class cards grid + open/locked progress ──────────────── */
.dashboard-classes-grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 18px;
}
/* R4 · two columns only when the panel is genuinely wide — in the narrow
   analytics right column (~1366px viewport) the class name + student
   badge header overflowed its track. Container query with the 575px
   viewport rule below as fallback. */
.my-classes-panel { container-type: inline-size; }
@container (max-width: 560px) { .dashboard-classes-grid { grid-template-columns: minmax(0, 1fr); } }
.dashboard-class-progress { margin-top: 12px; }
.dashboard-class-progress-track { height: 6px; border-radius: 999px; background: #EEF2F7; overflow: hidden; }
.dashboard-class-progress-fill { height: 100%; border-radius: inherit; background: var(--brand-primary); transition: width .4s cubic-bezier(.4, 0, .2, 1); }
.dashboard-class-progress-meta {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    margin-top: 5px; color: var(--app-muted); font-size: var(--text-2xs); font-weight: 600;
}
@media (max-width: 575.98px) {
    .dashboard-classes-grid { grid-template-columns: minmax(0, 1fr); padding: 14px; }
    .dashboard-class-card .btn { min-height: var(--touch-min); }
}
