/* ============================================================
   SchoolERP — premium design system
   Indigo SaaS theme matching the product mockups.
   ============================================================ */

:root {
    --primary: #5b5fef;
    --primary-dark: #4a3fe0;
    --primary-light: #ececfd;
    --primary-soft: #f3f3ff;

    --sidebar-bg: #0d1437;
    --sidebar-bg-2: #0a1030;
    --sidebar-active: #5b5fef;
    --sidebar-text: #a3aed0;

    --bg: #f4f7fe;
    --card: #ffffff;
    --border: #e6edf5;
    --border-soft: #eef2f9;

    --text: #1b2559;
    --text-muted: #8f9bba;

    --green: #05cd99;
    --green-soft: #e6faf5;
    --red: #ee5d50;
    --red-soft: #fdeceb;
    --amber: #ffb547;
    --amber-soft: #fff6e6;
    --blue: #4318ff;
    --blue-soft: #ece9ff;
    --teal: #2bc4c4;

    --radius: 20px;
    --radius-sm: 12px;
    --shadow: 0 18px 40px rgba(112, 144, 176, 0.12);
    --shadow-sm: 0 6px 18px rgba(112, 144, 176, 0.10);
    --sidebar-w: 260px;
    --topbar-h: 78px;

    --surface-2: #fbfcfe;
    --track: #eef1f6;
    --teal-soft: #e3f8f8;
    --font: 'Cairo', 'Segoe UI', 'Inter', 'Tahoma', system-ui, -apple-system, sans-serif;

    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #0b1020;
    --card: #141b2e;
    --surface-2: #0f1626;
    --border: #28324c;
    --border-soft: #1e2740;

    --text: #e6e9f5;
    --text-muted: #8b94b4;

    --track: #26304a;
    --primary-light: #29234f;
    --primary-soft: #1d2442;
    --green-soft: #103226;
    --red-soft: #3a1a18;
    --amber-soft: #3a2e12;
    --blue-soft: #181d3e;
    --teal-soft: #0e3232;

    --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
    --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.35);

    color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    font-family: var(--font);
    background: var(--bg); color: var(--text);
    font-size: 14px; line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; color: var(--text); font-weight: 700; }
p { margin: 0; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
    color: var(--sidebar-text);
    position: fixed; inset-inline-start: 0; top: 0; bottom: 0;
    display: flex; flex-direction: column; z-index: 40;
    transition: transform .25s ease;
}
.sidebar__brand { display: flex; align-items: center; gap: 12px; padding: 24px 22px 18px; }
.sidebar__logo {
    width: 42px; height: 42px; border-radius: 12px;
    background: linear-gradient(135deg, #ffd86b, #f7b733);
    display: grid; place-items: center; color: #0d1437; font-weight: 800; font-size: 18px;
    box-shadow: 0 6px 16px rgba(247, 183, 51, .35);
}
.sidebar__title { color: #fff; font-weight: 700; font-size: 15px; line-height: 1.2; }
.sidebar__subtitle { color: var(--sidebar-text); font-size: 11px; }

.sidebar__nav { flex: 1; overflow-y: auto; padding: 6px 14px 20px; }
.sidebar__nav::-webkit-scrollbar { width: 6px; }
.sidebar__nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 6px; }

.nav-item {
    display: flex; align-items: center; gap: 13px;
    padding: 11px 14px; margin: 3px 0; border-radius: 12px;
    color: var(--sidebar-text); font-weight: 500; font-size: 13.5px;
    cursor: pointer; transition: all .15s ease;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; box-shadow: 0 8px 18px rgba(91,95,239,.45); }
.nav-item .nav-icon { width: 20px; height: 20px; flex: none; opacity: .9; }
.nav-item .nav-chevron { margin-inline-start: auto; opacity: .5; }

/* Sidebar group headers: a clickable row that collapses/expands its section. */
.nav-section__label {
    width: 100%; background: none; border: 0; font-family: inherit;
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 14px 14px 6px; margin-top: 2px;
    font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
    color: var(--sidebar-text); opacity: .5; white-space: nowrap;
    cursor: pointer; user-select: none; transition: opacity .15s ease;
}
.nav-section__label:hover { opacity: .92; }
.sidebar__nav > .nav-section__label:first-child { padding-top: 4px; }
/* Arabic is cursive — letter-spacing would split the joined glyphs, so drop it in RTL. */
[dir="rtl"] .nav-section__label { letter-spacing: normal; text-transform: none; }
.nav-section__chev { width: 13px; height: 13px; flex: none; opacity: .7; transition: transform .2s ease; }
.nav-section__label.is-open .nav-section__chev { transform: rotate(180deg); }

/* ---------- Menu Designer board ---------- */
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; align-items: start; }
.menu-col { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 10px; }
.menu-col__head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 4px 6px 9px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
    text-transform: uppercase; color: var(--text-muted);
}
[dir="rtl"] .menu-col__head { letter-spacing: normal; text-transform: none; }
.menu-col__tools { display: flex; gap: 2px; }
.menu-zone { min-height: 46px; display: flex; flex-direction: column; gap: 6px; border-radius: 10px; }
.menu-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px;
    background: var(--bg); border: 1px solid var(--border); cursor: grab; font-size: 13.5px;
    color: var(--text); user-select: none;
}
.menu-item:hover { border-color: var(--primary); }
.menu-item.is-hidden { opacity: .5; }
.menu-item__grip { color: var(--text-muted); display: inline-flex; }
.menu-item__icon { width: 20px; height: 20px; display: inline-flex; align-items: center; color: var(--text-muted); flex: none; }
.menu-item__label { flex: 1; min-width: 0; }
.menu-iconbtn { background: none; border: 0; color: var(--text-muted); cursor: pointer; padding: 3px; border-radius: 6px; display: inline-flex; line-height: 0; }
.menu-iconbtn:hover:not(:disabled) { background: var(--card); color: var(--text); }
.menu-iconbtn:disabled { opacity: .3; cursor: default; }

/* ---------- Print Designer: live preview ---------- */
.print-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
@media (max-width: 980px) { .print-grid { grid-template-columns: 1fr; } }
.pp-wrap { position: sticky; top: 90px; }
.pp-page {
    background: #fff; color: #1b2559; border: 1px solid var(--border); border-radius: 6px;
    box-shadow: 0 10px 30px rgba(20,30,80,.10); padding: 22px; position: relative; overflow: hidden;
    width: 100%; min-height: 440px;
}
.pp-page.landscape { min-height: 300px; }
.pp-wm { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 64px; font-weight: 800; transform: rotate(-30deg); pointer-events: none; }
.pp-bg-logo { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 55%; max-width: 220px; object-fit: contain; pointer-events: none; }
.pp-head { display: flex; align-items: center; gap: 12px; border-bottom: 2px solid; padding-bottom: 8px; margin-bottom: 14px; position: relative; z-index: 1; }
.pp-logo { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; }
.pp-logo--ph { width: 46px; height: 46px; border-radius: 8px; background: var(--primary-light); display: flex; align-items: center; justify-content: center; color: var(--primary); font-weight: 700; font-size: 13px; }
.pp-name { font-size: 16px; font-weight: 700; }
.pp-sub { font-size: 11px; color: #6b7390; }
.pp-body { position: relative; z-index: 1; }
.pp-body h4 { font-size: 13px; margin: 0 0 8px; }
.pp-table { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.pp-table th, .pp-table td { border: 1px solid #e0e4ee; padding: 4px 6px; text-align: start; }
.pp-table th { background: #f4f7fe; }
.pp-foot { border-top: 1px solid #d7dcea; margin-top: 16px; padding-top: 7px; position: relative; z-index: 1; }
.pp-sign { display: flex; gap: 18px; margin: 18px 4px 10px; }
.pp-sign__cell { flex: 1; text-align: center; }
.pp-sign__line { border-top: 1px solid #333; margin-bottom: 4px; }
.pp-sign__cell span { font-size: 10px; }
.pp-foot-row { display: flex; justify-content: space-between; gap: 8px; font-size: 9.5px; color: #6b7390; }

/* ---------- Global print (driven by the Print Designer template) ---------- */
.print-only { display: none; }

@media print {
    .sidebar, .nav-backdrop, .topbar, .help-card, .sidebar__footer, #blazor-error-ui, .no-print { display: none !important; }
    /* Hide interactive chrome (buttons, toolbars, pagination, overlays) so any screen prints clean. */
    button:not(.keep-print), .icon-btn, .mud-button-root, .mud-icon-button, .mud-fab,
    .mud-table-pagination, .mud-table-toolbar, .mud-toolbar, .mud-tabs-toolbar,
    .mud-snackbar, .mud-overlay, .mud-popover { display: none !important; }
    .app-shell { display: block !important; }
    .main { margin: 0 !important; display: block !important; }
    html, body, .app-shell, .main, .content { background: #fff !important; }
    .content { padding: 0 !important; }
    .print-only { display: block !important; }
    /* Unclip scrollable areas so every loaded row prints, not just what's on screen. */
    .content, .table-card, .mud-table-container, .mud-table, .table-responsive { max-height: none !important; overflow: visible !important; }

    .print-header {
        display: flex !important; align-items: center; gap: 14px; background: #fff;
        border-bottom: 2px solid var(--print-accent, #5b5fef); padding-bottom: 8px; margin-bottom: 16px;
    }
    /* Fixed variant: the letterhead/footer sit in the reserved page margins and repeat every page. */
    .print-header.print-fixed, .print-footer.print-fixed {
        position: fixed; left: 0; right: 0; margin: 0 !important; background: #fff; z-index: 5;
    }
    .print-header.print-fixed { top: 0; }
    .print-footer.print-fixed { bottom: 0; border-top: 1px solid #cfd4e0; margin-top: 0 !important; }
    .print-logo { max-height: 42px; max-width: 120px; object-fit: contain; }
    .print-bg-logo {
        display: block !important; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
        width: 60%; max-width: 380px; object-fit: contain; pointer-events: none; z-index: 0;
    }
    .print-h-name { font-size: 18px; font-weight: 700; color: #111; }
    .print-h-sub { font-size: 11.5px; color: #555; }

    .print-footer { display: block !important; border-top: 1px solid #cfd4e0; margin-top: 20px; padding-top: 8px; }
    .print-foot-row { display: flex; justify-content: space-between; gap: 12px; font-size: 10.5px; color: #666; }
    .print-sign { display: flex; gap: 32px; margin: 28px 6px 14px; }
    .print-sign__cell { flex: 1; text-align: center; }
    .print-sign__line { border-top: 1px solid #333; margin-bottom: 5px; }
    .print-sign__cell span { font-size: 11px; color: #333; }

    .print-watermark {
        display: flex !important; position: fixed; inset: 0; align-items: center; justify-content: center;
        font-size: 96px; font-weight: 800; letter-spacing: 4px; transform: rotate(-32deg);
        color: var(--print-accent, #5b5fef); pointer-events: none; z-index: 0;
    }

    .card, .table-card, .mud-paper, .mud-card { box-shadow: none !important; border: 1px solid #e0e4ee !important; }
    .table th, .table td, table th, table td { border: 1px solid #e0e4ee !important; }
    /* Repeat table headers on every page; keep rows, cards and images from splitting across pages. */
    thead { display: table-header-group; }
    tfoot { display: table-footer-group; }
    tr, img, .card, .report-card, .stat, .kpi-card, .mud-card { break-inside: avoid; }
    h1, h2, h3, h4 { break-after: avoid; }
    a[href]::after { content: "" !important; }
    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}

.sidebar__footer { padding: 14px 18px 22px; }
.help-card {
    background: rgba(255,255,255,.05); border-radius: 14px; padding: 12px 14px;
    display: flex; align-items: center; gap: 10px; color: #cfd6ea; font-size: 13px;
}

/* ---------- Main ---------- */
.main { flex: 1; margin-inline-start: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.topbar {
    height: var(--topbar-h); background: var(--bg);
    display: flex; align-items: center; gap: 18px; padding: 0 30px;
    position: sticky; top: 0; z-index: 30;
}
.topbar__search {
    flex: 1; max-width: 460px; display: flex; align-items: center; gap: 10px;
    background: var(--card); border-radius: 30px; padding: 12px 20px;
    box-shadow: var(--shadow-sm); color: var(--text-muted);
}
.topbar__search input { border: 0; outline: 0; flex: 1; font-size: 13.5px; background: transparent; color: var(--text); }
.topbar__spacer { flex: 1; }

.year-pill { background: var(--card); border-radius: 16px; padding: 8px 16px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; line-height: 1.1; }
.year-pill small { color: var(--text-muted); font-size: 10px; }
.year-pill b { font-size: 13px; }

.icon-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--card); display: grid; place-items: center; box-shadow: var(--shadow-sm); color: var(--text-muted); position: relative; cursor: pointer; border: 0; }
.icon-btn .dot { position: absolute; top: 9px; inset-inline-end: 10px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 10px; background: var(--red); color: #fff; font-size: 9px; font-weight: 700; display: grid; place-items: center; }

.user-chip { display: flex; align-items: center; gap: 11px; background: var(--card); border-radius: 30px; padding: 7px 16px 7px 7px; box-shadow: var(--shadow-sm); cursor: pointer; }
.user-chip .u-name { font-weight: 700; font-size: 13px; }
.user-chip .u-role { color: var(--text-muted); font-size: 11px; }

.content { padding: 8px 30px 40px; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; margin: 10px 0 22px; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 26px; font-weight: 800; }
.breadcrumb { color: var(--text-muted); font-size: 12.5px; margin-top: 4px; display: flex; gap: 8px; align-items: center; }
.breadcrumb a:hover { color: var(--primary); }

/* ---------- Cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.card-title { font-size: 17px; font-weight: 700; }
.link { color: var(--primary); font-weight: 600; font-size: 12.5px; cursor: pointer; }

/* ---------- Stat cards ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; margin-bottom: 22px; }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; display: flex; align-items: center; gap: 16px; }
.stat__icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; flex: none; }
.stat__label { color: var(--text-muted); font-size: 12.5px; font-weight: 600; }
.stat__value { font-size: 24px; font-weight: 800; margin-top: 2px; }
.stat__trend { font-size: 11.5px; font-weight: 600; margin-top: 3px; }
.trend-up { color: var(--green); }
.trend-down { color: var(--red); }

.bg-indigo { background: var(--primary-light); color: var(--primary); }
.bg-green { background: var(--green-soft); color: var(--green); }
.bg-red { background: var(--red-soft); color: var(--red); }
.bg-amber { background: var(--amber-soft); color: #f7991c; }
.bg-blue { background: var(--blue-soft); color: var(--blue); }
.bg-teal { background: var(--teal-soft); color: var(--teal); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 12px; border-radius: 30px; font-size: 11.5px; font-weight: 700; }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-amber { background: var(--amber-soft); color: #f7991c; }
.badge-indigo { background: var(--primary-light); color: var(--primary); }
.badge-grey { background: var(--track); color: var(--text-muted); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer; font-weight: 600; font-size: 13px; padding: 11px 18px; border-radius: 12px; transition: all .15s ease; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 18px rgba(91,95,239,.35); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-light { background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); }
.btn-light:hover { background: var(--surface-2); }
.btn-ghost { background: var(--primary-soft); color: var(--primary); }

/* ---------- Filters ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 20px; }
.select, .input { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; font-size: 13px; color: var(--text); outline: 0; box-shadow: var(--shadow-sm); }
.select { min-width: 150px; }

/* ---------- Table ---------- */
.table-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table thead th { text-align: start; padding: 16px 22px; font-size: 11.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--border-soft); background: var(--surface-2); }
.table tbody td { padding: 15px 22px; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }

.person { display: flex; align-items: center; gap: 12px; }
.person .p-name { font-weight: 700; }
.person .p-sub { color: var(--text-muted); font-size: 12px; }

.avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
.avatar-initials { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 14px; flex: none; }

/* ---------- Bars ---------- */
.bar { height: 8px; border-radius: 8px; background: var(--track); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 8px; background: var(--primary); }

/* ---------- Layout grid ---------- */
.grid { display: grid; gap: 22px; }
.grid-2 { grid-template-columns: 2fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 1100px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 880px) {
    .sidebar { transform: translateX(-105%); }
    .main { margin-inline-start: 0; }
}

/* ---------- Utilities ---------- */
.muted { color: var(--text-muted); }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-4 { margin-top: 4px; }
.text-end { text-align: end; }
.w-full { width: 100%; }

/* error ui (framework) */
#blazor-error-ui { background: #fff3cd; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); display: none; left: 0; padding: 0.6rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

/* ============================================================
   Student 360 profile
   ============================================================ */
.profile-grid { display: grid; grid-template-columns: 1fr 330px; gap: 22px; margin-bottom: 22px; }
@media (max-width: 1100px) { .profile-grid { grid-template-columns: 1fr; } }

.profile-header { display: flex; gap: 24px; align-items: flex-start; }
.profile-photo { width: 132px; height: 132px; border-radius: 24px; flex: none; display: grid; place-items: center; font-size: 40px; font-weight: 800; color: #fff; box-shadow: var(--shadow-sm); background-size: cover; background-position: center; }
.profile-photo-wrap { position: relative; flex: none; }
.profile-photo-actions { position: absolute; bottom: 6px; inset-inline-end: 6px; display: flex; gap: 5px; }
.pp-btn { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--card); background: var(--primary); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; box-shadow: var(--shadow); }
.pp-btn:hover { filter: brightness(1.08); }
.pp-btn:disabled { opacity: .5; pointer-events: none; }
.profile-name { font-size: 25px; font-weight: 800; display: flex; align-items: center; gap: 12px; }
.id-chip { background: var(--primary-soft); color: var(--primary); padding: 5px 12px; border-radius: 8px; font-size: 12px; font-weight: 700; display: inline-flex; gap: 6px; align-items: center; margin-top: 10px; }

.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px 22px; margin-top: 20px; }
.info-item { display: flex; gap: 10px; align-items: flex-start; }
.info-item .ic { width: 34px; height: 34px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; flex: none; }
.info-item .lbl { color: var(--text-muted); font-size: 11px; }
.info-item .val { font-weight: 700; font-size: 13px; margin-top: 2px; }

.guardians { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 22px; border-top: 1px solid var(--border-soft); padding-top: 18px; }
.guardian .g-role { color: var(--text-muted); font-size: 11px; }
.guardian .g-name { font-weight: 700; margin-top: 3px; }
.guardian .g-contact { color: var(--text-muted); font-size: 12px; margin-top: 5px; display: flex; gap: 7px; align-items: center; }

.quick-info .qi-row { display: flex; justify-content: space-between; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--border-soft); }
.quick-info .qi-row:last-child { border-bottom: 0; }
.qi-label { color: var(--text-muted); font-size: 12.5px; display: flex; gap: 9px; align-items: center; }
.qi-value { font-weight: 700; font-size: 13px; }

.tabs { display: flex; gap: 4px; background: var(--card); border-radius: 16px; padding: 8px; box-shadow: var(--shadow); margin-bottom: 22px; overflow-x: auto; }
.tab { padding: 10px 15px; border-radius: 10px; font-size: 12.5px; font-weight: 600; color: var(--text-muted); cursor: pointer; white-space: nowrap; display: flex; align-items: center; gap: 7px; }
.tab.active { background: var(--primary); color: #fff; box-shadow: 0 8px 16px rgba(91,95,239,.35); }
.tab:hover:not(.active) { background: var(--primary-soft); color: var(--primary); }

.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.mini { text-align: center; padding: 14px 8px; background: var(--surface-2); border-radius: 14px; }
.mini .m-val { font-size: 22px; font-weight: 800; }
.mini .m-lbl { color: var(--text-muted); font-size: 11.5px; margin-top: 3px; }

.subject-row { display: grid; grid-template-columns: 120px 40px 1fr 46px; align-items: center; gap: 12px; padding: 9px 0; }
.subject-row .s-name { font-weight: 600; font-size: 13px; }
.grade { font-weight: 800; font-size: 13px; }

.activity { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); align-items: center; }
.activity:last-child { border-bottom: 0; }
.activity .a-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.activity .a-title { font-weight: 600; font-size: 13px; }
.activity .a-sub { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.activity .a-time { margin-inline-start: auto; color: var(--text-muted); font-size: 11.5px; white-space: nowrap; }

.donut { width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; margin: 4px auto 0; position: relative; }
.donut::before { content: ''; position: absolute; width: 104px; height: 104px; border-radius: 50%; background: var(--card); }
.donut .d-center { position: relative; text-align: center; }
.donut .d-val { font-size: 24px; font-weight: 800; color: var(--green); }
.donut .d-lbl { font-size: 11px; color: var(--text-muted); }

.legend-row { display: flex; align-items: center; gap: 9px; padding: 7px 0; font-size: 13px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-val { margin-inline-start: auto; font-weight: 700; }

.att-head { display: flex; gap: 22px; }
.att-head .a-col small { color: var(--text-muted); font-size: 11px; }
.att-head .a-col b { font-size: 18px; }
.att-bars { display: flex; align-items: flex-end; gap: 3px; height: 64px; margin-top: 16px; }
.att-bars span { flex: 1; border-radius: 3px; background: var(--green); min-width: 4px; }
.att-bars span.absent { background: var(--red); }
.att-bars span.late { background: var(--amber); }

.attachment { display: flex; align-items: center; gap: 11px; padding: 12px; border: 1px solid var(--border-soft); border-radius: 12px; }
.attachment .f-ic { width: 38px; height: 38px; border-radius: 10px; background: var(--red-soft); color: var(--red); display: grid; place-items: center; flex: none; }
.attachment .f-name { font-weight: 600; font-size: 12.5px; }
.attachment .f-sub { color: var(--text-muted); font-size: 11px; margin-top: 2px; }

/* ============================================================
   Add Student & Family wizard
   ============================================================ */
.stepper { display: flex; align-items: flex-start; background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 24px 36px; margin-bottom: 22px; }
.step { display: flex; flex-direction: column; align-items: center; gap: 9px; position: relative; flex: 1; }
.step .s-circle { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--track); color: var(--text-muted); z-index: 2; }
.step.active .s-circle { background: var(--primary); color: #fff; box-shadow: 0 8px 16px rgba(91,95,239,.4); }
.step.done .s-circle { background: var(--green-soft); color: var(--green); }
.step .s-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-align: center; }
.step.active .s-label { color: var(--primary); }
.step .s-line { position: absolute; top: 20px; height: 2px; background: var(--border); width: calc(100% - 40px); inset-inline-start: calc(50% + 20px); z-index: 1; }
.step:last-child .s-line { display: none; }

.form-section { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 22px; }
.section-title { display: flex; align-items: center; gap: 11px; font-size: 16px; font-weight: 700; margin-bottom: 20px; }
.section-title .st-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; flex: none; }

.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.form-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .form-grid, .form-grid.cols-2 { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 7px; }
.field > label { font-size: 12px; font-weight: 600; color: var(--text); }
.field > label .req { color: var(--red); }
.field input, .field select, .field textarea { border: 1px solid var(--border); border-radius: 11px; padding: 11px 14px; font-size: 13px; color: var(--text); outline: 0; background: var(--card); font-family: inherit; transition: border-color .15s; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
.col-span-2 { grid-column: span 2; }

.upload-box { border: 2px dashed var(--border); border-radius: 16px; padding: 26px; text-align: center; color: var(--text-muted); font-size: 12px; }
.upload-box .u-photo { width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: 26px; }

.sibling-row { display: grid; grid-template-columns: 38px 1.4fr 1fr 1fr 30px; gap: 10px; align-items: center; padding: 9px 0; }

.wizard-foot { display: flex; justify-content: space-between; align-items: center; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 16px 24px; margin-top: 4px; }

.checkbox-row { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; }
.checkbox-row input { width: 18px; height: 18px; accent-color: var(--primary); }

.note-tip { background: var(--primary-soft); color: var(--primary); border-radius: 12px; padding: 12px 16px; font-size: 12.5px; display: flex; gap: 10px; align-items: center; }

/* ---------- Attendance marking pills ---------- */
.status-pills { display: inline-flex; gap: 7px; }
.pill { padding: 7px 15px; border-radius: 10px; font-size: 12px; font-weight: 700; cursor: pointer; border: 1px solid var(--border); background: var(--card); color: var(--text-muted); }
.pill.on-present { background: var(--green-soft); color: var(--green); border-color: transparent; }
.pill.on-absent { background: var(--red-soft); color: var(--red); border-color: transparent; }
.pill.on-late { background: var(--amber-soft); color: #f7991c; border-color: transparent; }
.pill.on-excused { background: var(--blue-soft); color: var(--blue); border-color: transparent; }

/* generic colored soft text */
.t-green { color: var(--green); } .t-red { color: var(--red); } .t-amber { color: #f7991c; } .t-indigo { color: var(--primary); }

/* ---------- Communication chat ---------- */
.chat { display: grid; grid-template-columns: 330px 1fr; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; height: 640px; }
.chat__list { border-inline-end: 1px solid var(--border-soft); overflow-y: auto; }
.chat__item { display: flex; gap: 12px; padding: 14px 18px; cursor: pointer; border-bottom: 1px solid var(--border-soft); align-items: center; }
.chat__item.active { background: var(--primary-soft); }
.chat__item .ci-name { font-weight: 700; font-size: 13px; }
.chat__item .ci-msg { color: var(--text-muted); font-size: 12px; }
.chat__item .ci-time { margin-inline-start: auto; font-size: 10px; color: var(--text-muted); align-self: flex-start; }
.chat__main { display: flex; flex-direction: column; }
.chat__head { padding: 16px 22px; border-bottom: 1px solid var(--border-soft); display: flex; align-items: center; gap: 12px; }
.chat__body { flex: 1; padding: 24px; overflow-y: auto; background: var(--surface-2); display: flex; flex-direction: column; gap: 14px; }
.bubble { max-width: 62%; padding: 11px 15px; border-radius: 14px; font-size: 13px; }
.bubble.in { background: var(--card); box-shadow: var(--shadow-sm); align-self: flex-start; }
.bubble.out { background: var(--primary); color: #fff; align-self: flex-end; }
.bubble .b-time { font-size: 10px; opacity: .7; margin-top: 5px; }
.chat__input { padding: 16px 22px; border-top: 1px solid var(--border-soft); display: flex; gap: 12px; }
.chat__input input { flex: 1; border: 1px solid var(--border); border-radius: 30px; padding: 12px 18px; outline: 0; }

/* ---------- Timetable grid ---------- */
.tt { width: 100%; border-collapse: separate; border-spacing: 8px; }
.tt th { font-size: 12px; color: var(--text-muted); font-weight: 700; padding-bottom: 6px; text-align: center; }
.tt td.time { font-size: 11.5px; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.tt-cell { border-radius: 12px; padding: 11px; font-size: 12px; font-weight: 600; line-height: 1.35; }
.tt-cell small { font-weight: 500; opacity: .8; }

/* ---------- Settings ---------- */
.settings-grid { display: grid; grid-template-columns: 240px 1fr; gap: 22px; align-items: start; }
@media (max-width: 900px) { .settings-grid { grid-template-columns: 1fr; } }
.settings-nav { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
.sn-item { display: flex; gap: 11px; align-items: center; padding: 11px 14px; border-radius: 11px; font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer; }
.sn-item.active { background: var(--primary); color: #fff; }
.sn-item:hover:not(.active) { background: var(--primary-soft); color: var(--primary); }

/* ---------- Settings panels (academic year / security / backup) ---------- */
.sx-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sx-table th { text-align: start; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); padding: 8px 10px; border-bottom: 1px solid var(--border-soft); }
.sx-table td { padding: 11px 10px; border-bottom: 1px solid var(--border-soft); color: var(--text); }
.sx-table tbody tr:last-child td { border-bottom: 0; }
.sx-stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.sx-stat { background: var(--bg); border: 1px solid var(--border-soft); border-radius: 12px; padding: 14px; }
.sx-stat-val { font-size: 22px; font-weight: 800; color: var(--text); }
.sx-stat-lbl { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.sx-btn-primary { background: var(--primary); color: #fff; border: 0; border-radius: 11px; padding: 11px 18px; font-weight: 700; font-size: 13px; cursor: pointer; }
.sx-btn-primary:hover { filter: brightness(1.05); }
.sx-btn-danger { background: var(--red, #ee5d50); color: #fff; border: 0; border-radius: 11px; padding: 11px 18px; font-weight: 700; font-size: 13px; cursor: pointer; }
.sx-btn-danger:hover { filter: brightness(1.05); }

/* ---------- Monthly attendance register (students × days matrix) ---------- */
.reg-table { border-collapse: separate; border-spacing: 0; font-size: 12px; width: max-content; min-width: 100%; }
.reg-table th, .reg-table td { border-bottom: 1px solid var(--border-soft); border-right: 1px solid var(--border-soft); padding: 7px 6px; text-align: center; white-space: nowrap; }
.reg-table thead th { font-weight: 700; color: var(--text-muted); background: var(--bg); position: sticky; top: 0; z-index: 1; }
.reg-day { width: 30px; }
.reg-tot { width: 38px; font-weight: 700; }
.reg-sticky { position: sticky; left: 0; z-index: 2; background: var(--card); text-align: start !important; min-width: 168px; }
.reg-table thead .reg-sticky { z-index: 3; }
.reg-cell { font-weight: 700; }
.reg-cell.p { background: var(--green-soft); color: var(--green); }
.reg-cell.a { background: var(--red-soft); color: var(--red); }
.reg-cell.l { background: var(--amber-soft); color: var(--amber); }
.reg-cell.e { background: var(--blue-soft); color: var(--blue); }
.reg-cell.none { color: var(--border); }

/* ---------- ID card designer ---------- */
.cd-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 16px; margin-bottom: 16px; }
.cd-grid { display: grid; grid-template-columns: 220px 1fr 256px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .cd-grid { grid-template-columns: 1fr; } }
.cd-panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.cd-panel-title { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 800; color: var(--text-muted); margin-bottom: 10px; }
.cd-add { display: flex; align-items: center; gap: 9px; width: 100%; text-align: start; background: var(--bg); border: 1px solid var(--border-soft); border-radius: 10px; padding: 9px 12px; margin-bottom: 8px; font-weight: 600; font-size: 13px; color: var(--text); cursor: pointer; }
.cd-add:hover { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-soft); }
.cd-stage { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; background: repeating-conic-gradient(#eef2f9 0% 25%, #f7f9fd 0% 50%) 50% / 22px 22px; border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; min-height: 320px; }
.cd-side-toggle { display: inline-flex; background: var(--card); border-radius: 10px; padding: 3px; box-shadow: var(--shadow-sm); margin-bottom: 16px; }
.cd-side-toggle button { border: 0; background: none; padding: 7px 20px; border-radius: 8px; font-weight: 700; font-size: 13px; color: var(--text-muted); cursor: pointer; }
.cd-side-toggle button.active { background: var(--primary); color: #fff; }
.cd-card-pair { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
.cd-canvas { position: relative; box-shadow: 0 10px 30px rgba(27,37,89,.18); border-radius: 14px; overflow: hidden; }
.cd-el { position: absolute; box-sizing: border-box; overflow: hidden; white-space: nowrap; cursor: move; user-select: none; line-height: 1.15; }
#cd-canvas .cd-el.sel { outline: 2px dashed var(--primary); outline-offset: 1px; }
.cd-photo { display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 22px; }
.cd-logo { width: 100%; height: 100%; display: grid; place-items: center; color: #fff; font-weight: 800; border-radius: inherit; }
.cd-barcode { display: flex; flex-direction: column; height: 100%; justify-content: center; }
.cd-bars { display: flex; align-items: stretch; height: calc(100% - 13px); }
.cd-bars span { display: block; height: 100%; }
.cd-bc-label { font-size: 9px; text-align: center; letter-spacing: 2px; margin-top: 2px; font-weight: 600; }
.cd-qr { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.cd-qr svg { width: 100%; height: 100%; display: block; }
.cd-color { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.cd-color input[type=color] { width: 46px; height: 30px; border: 1px solid var(--border-soft); border-radius: 8px; background: none; cursor: pointer; padding: 2px; }
.cd-upload-row { display: flex; align-items: center; gap: 8px; }
.cd-upload-row .cd-add { flex: 1; margin-bottom: 0; }
.cd-clear { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border-soft); background: var(--bg); color: var(--red, #ee5d50); cursor: pointer; flex: none; font-weight: 700; }
.cd-clear:hover { background: var(--red-soft); }
.cd-hint { color: var(--text-muted); font-size: 12px; margin-top: 12px; text-align: center; }
.cd-print-grid { display: flex; flex-wrap: wrap; gap: 16px; }
.cd-print-item { position: relative; cursor: pointer; border: 2px solid transparent; border-radius: 14px; display: inline-block; }
.cd-print-item.off { opacity: .35; }
.cd-print-item input[type=checkbox] { position: absolute; top: 8px; left: 8px; z-index: 5; width: 18px; height: 18px; cursor: pointer; }
.cd-print-name { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 5px; }
.cd-upload-btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--primary); color: var(--primary); background: var(--primary-soft); border-radius: 10px; padding: 8px 16px; font-weight: 600; font-size: 13px; cursor: pointer; }
.cd-upload-btn:hover { filter: brightness(.98); }
.cd-upload-btn.busy { opacity: .6; pointer-events: none; }

/* ---------- Report cards ---------- */
.report-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; cursor: pointer; transition: transform .15s; }
.report-card:hover { transform: translateY(-3px); }
.report-card .rc-ic { width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 14px; }

/* ---------- RTL ---------- */
[dir="rtl"] body, [dir="rtl"] { font-family: 'Cairo', 'Tahoma', 'Segoe UI', sans-serif; }
@media (max-width: 880px) {
    [dir="rtl"] .sidebar { transform: translateX(105%); }
}

/* ---------- Theme + language toggles (topbar) ---------- */
.theme-toggle, .lang-toggle {
    height: 44px; padding: 0 14px; border-radius: 22px; background: var(--card);
    box-shadow: var(--shadow-sm); color: var(--text-muted); border: 0; cursor: pointer;
    display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px;
}
.theme-toggle:hover, .lang-toggle:hover { color: var(--primary); }
.lang-toggle { color: var(--text); }

/* Three-way language switcher (English / العربية / کوردی). */
.lang-switch {
    display: inline-flex; align-items: center; gap: 2px; height: 44px; padding: 0 5px;
    border-radius: 22px; background: var(--card); box-shadow: var(--shadow-sm); white-space: nowrap;
}
.lang-switch a {
    padding: 4px; border-radius: 8px; display: inline-flex; line-height: 0;
    text-decoration: none; transition: all .15s ease; opacity: .5;
}
.lang-switch a .flag {
    width: 27px; height: 18px; border-radius: 3px; display: block; overflow: hidden;
    box-shadow: 0 0 0 1px rgba(0,0,0,.12);
}
.lang-switch a:hover { opacity: 1; }
.lang-switch a.on { opacity: 1; }
.lang-switch a.on .flag { box-shadow: 0 0 0 2px var(--primary), 0 2px 6px rgba(0,0,0,.2); }

/* ---------- Notifications bell dropdown ---------- */
.notif-wrap { position: relative; display: inline-flex; }
.notif-panel {
    position: absolute; top: calc(100% + 12px); inset-inline-end: 0; width: 370px; max-width: 92vw;
    background: var(--card); border: 1px solid var(--border); border-radius: 20px;
    box-shadow: var(--shadow); z-index: 70; padding: 6px; animation: notif-pop .14s ease;
}
@keyframes notif-pop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 12px 8px; }
.notif-title { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 16px; color: var(--text); }
.notif-title svg { color: var(--primary); }
.notif-markall { background: none; border: 0; color: var(--primary); font-weight: 700; font-size: 12.5px; cursor: pointer; padding: 5px 8px; border-radius: 9px; }
.notif-markall:hover { background: var(--primary-soft); }
.notif-tabs { display: flex; gap: 6px; padding: 2px 8px 10px; }
.notif-tab {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
    border: 0; padding: 8px 6px; border-radius: 12px; background: var(--surface-2); color: var(--text-muted);
    font-weight: 700; font-size: 12.5px; font-family: inherit;
}
.notif-tab.on { background: var(--primary); color: #fff; }
.notif-c { background: rgba(140,150,190,.18); border-radius: 20px; padding: 1px 7px; font-size: 11px; min-width: 20px; }
.notif-tab.on .notif-c { background: rgba(255,255,255,.26); }
.notif-list { max-height: 380px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding: 2px; }
.notif-item {
    display: flex; align-items: flex-start; gap: 11px; width: 100%; text-align: start; cursor: pointer;
    background: none; border: 0; padding: 11px 10px; border-radius: 14px; font-family: inherit;
}
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: var(--primary-soft); }
.ni-ic { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 13px; display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.ni-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ni-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ni-title { font-weight: 700; font-size: 13.5px; color: var(--text); }
.ni-time { flex: 0 0 auto; font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.ni-text { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ni-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 7px; }
.notif-foot { display: block; text-align: center; padding: 12px; margin-top: 4px; color: var(--primary); font-weight: 800; font-size: 13px; text-decoration: none; border-top: 1px solid var(--border); }
.notif-foot:hover { background: var(--surface-2); border-radius: 0 0 16px 16px; }
.notif-empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px 16px; color: var(--text-muted); font-size: 13px; }
.notif-empty svg { color: var(--text-muted); opacity: .5; }
.ni--red { background: #ee5d50; } .ni--blue { background: #4318ff; } .ni--green { background: #05cd99; }
.ni--amber { background: #ffb547; } .ni--purple { background: #8a5cf6; } .ni--pink { background: #ff5da2; }
.ni--gray { background: #8f9bba; }
@media (max-width: 480px) { .notif-panel { position: fixed; top: 70px; inset-inline: 10px; width: auto; } }

/* Labelled Print button in the top bar — clearly discoverable on every screen. */
.topbar-print {
    height: 44px; padding: 0 16px; border-radius: 22px; cursor: pointer;
    background: var(--primary); color: #fff; border: 0; box-shadow: 0 6px 16px rgba(91,95,239,.35);
    display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; white-space: nowrap;
}
.topbar-print:hover { background: var(--primary-dark); }
@media (max-width: 760px) { .topbar-print span { display: none; } .topbar-print { padding: 0; width: 44px; justify-content: center; } }

/* ---------- Calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-head { text-align: center; font-size: 12px; font-weight: 700; color: var(--text-muted); padding-bottom: 4px; }
.cal-cell { background: var(--surface-2); border-radius: 12px; min-height: 100px; padding: 8px; }
.cal-cell.out { opacity: .35; }
.cal-cell.today { outline: 2px solid var(--primary); }
.cal-day { font-size: 12px; font-weight: 700; }
.cal-ev { font-size: 10.5px; font-weight: 600; padding: 3px 7px; border-radius: 6px; margin-top: 5px; }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1200px) { .kanban { grid-template-columns: 1fr 1fr 1fr; } }
@media (max-width: 760px) { .kanban { grid-template-columns: 1fr; } }
.kan-col { background: var(--surface-2); border-radius: 16px; padding: 14px; }
.kan-col-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 13px; margin-bottom: 12px; }
.kan-count { background: var(--card); border-radius: 20px; padding: 2px 10px; font-size: 11px; font-weight: 700; }
.kan-card { background: var(--card); border-radius: 12px; padding: 13px; box-shadow: var(--shadow-sm); margin-bottom: 10px; }
.kan-card:last-child { margin-bottom: 0; }

/* Live fleet map (Leaflet) markers */
.bus-marker { background: transparent; border: none; }
.bus-pin { display: flex; align-items: center; gap: 4px; background: #4f46e5; color: #fff; font-size: 14px;
    padding: 3px 8px 3px 6px; border-radius: 16px; box-shadow: 0 2px 8px rgba(0,0,0,.3); white-space: nowrap;
    transform: translateY(-2px); }
.bus-pin span { font-size: 11px; font-weight: 800; }
.map-canvas { width: 100%; border-radius: 16px; box-shadow: var(--shadow); }
.leaflet-container { font: inherit; }

/* ============================================================
   Aesthetic polish — depth, motion & focus (global, additive)
   Refines the system above via source order; no markup changes.
   ============================================================ */

/* One consistent, springy easing on everything that reacts to the pointer. */
.card, .stat, .icon-btn, .user-chip, .btn, .theme-toggle, .lang-toggle,
.report-card, .kan-card, .sx-stat, .mini, .tab, .nav-item, .pill, .sn-item,
.stat__icon, .table tbody tr {
    transition: transform .18s cubic-bezier(.2, .7, .2, 1), box-shadow .18s ease,
        background-color .18s ease, color .18s ease, border-color .18s ease, filter .18s ease;
}

/* Frosted, layered top bar so page content scrolls under it elegantly.
   Falls back to the opaque --bg where color-mix / backdrop-filter are unsupported. */
.topbar {
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
}

/* Summary tiles lift and deepen on hover; their icon gives a gentle pop. */
.stat:hover { transform: translateY(-4px); box-shadow: 0 24px 50px rgba(112, 144, 176, .20); }
.stat:hover .stat__icon { transform: scale(1.06); }
.stat__icon { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .30); }
.stat__value { font-variant-numeric: tabular-nums; letter-spacing: -.4px; }
:root[data-theme="dark"] .stat:hover { box-shadow: 0 24px 50px rgba(0, 0, 0, .50); }

/* Content cards only raise their shadow (no jump — they often hold forms/tables). */
.card:hover { box-shadow: 0 22px 46px rgba(112, 144, 176, .17); }
:root[data-theme="dark"] .card:hover { box-shadow: 0 22px 46px rgba(0, 0, 0, .50); }

/* Small, clearly-interactive cards lift. */
.kan-card:hover, .sx-stat:hover, .mini:hover { transform: translateY(-3px); box-shadow: var(--shadow-sm); }

/* Buttons & topbar controls: a subtle lift + press, deeper primary glow. */
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary:hover { box-shadow: 0 12px 24px rgba(91, 95, 239, .45); }
.icon-btn:hover, .theme-toggle:hover, .lang-toggle:hover, .user-chip:hover {
    transform: translateY(-2px); box-shadow: var(--shadow);
}

/* Clear, accessible keyboard focus ring across the shell. */
a:focus-visible, button:focus-visible, .btn:focus-visible, .icon-btn:focus-visible,
.nav-item:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
.user-chip:focus-visible, .tab:focus-visible, .sn-item:focus-visible {
    outline: 2px solid var(--primary); outline-offset: 2px;
}

/* Sidebar: a crisp active-tick and a gentle hover slide. */
.nav-item { position: relative; }
.nav-item.active::before {
    content: ''; position: absolute; inset-inline-start: 7px; top: 50%; transform: translateY(-50%);
    width: 3px; height: 18px; border-radius: 3px; background: rgba(255, 255, 255, .9);
}
.nav-item:hover:not(.active) { transform: translateX(2px); }
[dir="rtl"] .nav-item:hover:not(.active) { transform: translateX(-2px); }

/* Slim, themed scrollbars app-wide (the sidebar keeps its own, more-specific rule). */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); background-clip: content-box; }

/* Content rises in gently on each page mount (plays once per navigation, not on data refresh). */
.content > .page-head { animation: fadeIn .4s ease both; }
.content > .grid, .content > .card, .content > .table-card, .content > .form-section { animation: fadeIn .45s ease both; }
.stats-grid .stat { animation: riseIn .5s cubic-bezier(.2, .7, .2, 1) both; }
.stats-grid .stat:nth-child(2) { animation-delay: .06s; }
.stats-grid .stat:nth-child(3) { animation-delay: .12s; }
.stats-grid .stat:nth-child(4) { animation-delay: .18s; }
.stats-grid .stat:nth-child(5) { animation-delay: .24s; }
.stats-grid .stat:nth-child(6) { animation-delay: .30s; }

@keyframes riseIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Respect users who prefer reduced motion. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .stat:hover, .card:hover, .btn:hover, .icon-btn:hover, .user-chip:hover, .theme-toggle:hover,
    .lang-toggle:hover, .kan-card:hover, .sx-stat:hover, .mini:hover, .nav-item:hover { transform: none !important; }
}

/* ============================================================
   Dashboard content polish
   ============================================================ */
/* Attendance mini-bars rise from their base on load, brighten on hover. */
.att-bars span { transform-origin: bottom; animation: barRise .6s cubic-bezier(.2, .7, .2, 1) both; transition: filter .15s ease, transform .15s ease; }
.att-bars span:hover { filter: brightness(1.08) saturate(1.1); transform: scaleY(1.03); }
@keyframes barRise { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* The students-by-year donut pops in gently and lifts a touch on hover. */
.donut { animation: donutIn .55s ease both; transition: transform .2s cubic-bezier(.2, .7, .2, 1); }
.donut:hover { transform: scale(1.03); }
@keyframes donutIn { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }

/* Activity / unpaid / legend rows behave like hoverable list items; the negative
   inline margin tucks the highlight neatly into the surrounding card padding. */
.activity { border-radius: 12px; padding-inline: 10px; margin-inline: -10px; transition: background-color .15s ease; }
.activity:hover { background: var(--surface-2); }
.legend-row { border-radius: 8px; padding-inline: 8px; margin-inline: -8px; transition: background-color .15s ease; }
.legend-row:hover { background: var(--surface-2); }

/* ============================================================
   Responsive shell: mobile drawer + topbar user menu
   ============================================================ */
/* Hamburger lives in the topbar but only appears once the sidebar auto-hides. */
.nav-burger { display: none; }

/* Drawer state: .nav-open slides the sidebar back in over a dimmed backdrop. */
.app-shell.nav-open .sidebar { transform: translateX(0); box-shadow: 0 0 60px rgba(0, 0, 0, .35); }
[dir="rtl"] .app-shell.nav-open .sidebar { transform: translateX(0); }
.nav-backdrop {
    position: fixed; inset: 0; z-index: 39; display: none;
    background: rgba(13, 20, 55, .45); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
    animation: fadeIn .2s ease both;
}

@media (max-width: 880px) {
    .nav-burger { display: grid; flex: none; }
    .nav-backdrop { display: block; }
    .topbar { gap: 10px; padding: 0 14px; }
    .topbar__search { max-width: none; }
    .year-pill { display: none; }
    .content { padding: 8px 14px 32px; }
}
@media (max-width: 640px) {
    .topbar__search { display: none; }
    .topbar__spacer { flex: 1; }
    .user-chip .u-text, .user-chip .u-caret { display: none; }
    .user-chip { padding: 7px; }
}

/* The user chip is now a real button that opens a small account menu. */
.user-menu-wrap { position: relative; }
.user-chip { border: 0; font-family: inherit; text-align: start; }
.user-chip .u-caret { color: var(--text-muted); display: grid; place-items: center; margin-inline-start: 2px; transition: transform .18s ease; }
.user-chip .u-caret.open { transform: rotate(180deg); }

.menu-backdrop { position: fixed; inset: 0; z-index: 48; background: transparent; }
.user-menu {
    position: absolute; top: calc(100% + 10px); inset-inline-end: 0; z-index: 49;
    min-width: 210px; background: var(--card); border-radius: 16px; box-shadow: var(--shadow);
    border: 1px solid var(--border-soft); padding: 8px;
    animation: menuIn .16s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes menuIn { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.user-menu .um-head { padding: 8px 12px 10px; border-bottom: 1px solid var(--border-soft); margin-bottom: 6px; }
.user-menu .um-name { font-weight: 800; font-size: 13.5px; }
.user-menu .um-role { color: var(--text-muted); font-size: 11.5px; margin-top: 1px; }
.um-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 10px 12px; border-radius: 10px; border: 0; background: none; cursor: pointer;
    font-family: inherit; font-size: 13px; font-weight: 600; color: var(--text); text-align: start;
    transition: background-color .15s ease, color .15s ease;
}
.um-item:hover { background: var(--primary-soft); color: var(--primary); }
.um-item.um-danger { color: var(--red); }
.um-item.um-danger:hover { background: var(--red-soft); color: var(--red); }

/* Icon buttons get a tactile press to match their hover lift. */
.icon-btn:active { transform: translateY(0) scale(.95); }

/* Friendly empty states (icon above a short line) instead of a bare grey sentence.
   An empty .es-ic gets a default inbox glyph from CSS, so most call sites need no SVG;
   sites that want a specific icon just put their own <svg> inside .es-ic (e.g. the dashboard). */
.empty-state {
    display: flex; flex-direction: column; align-items: center; gap: 9px;
    padding: 22px 12px; text-align: center; color: var(--text-muted);
    --es-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='22 12 16 12 14 15 10 15 8 12 2 12'/%3E%3Cpath d='M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z'/%3E%3C/svg%3E");
}
.empty-state .es-ic { width: 46px; height: 46px; border-radius: 14px; background: var(--surface-2); display: grid; place-items: center; color: var(--text-muted); }
.empty-state .es-ic:empty::before {
    content: ''; width: 24px; height: 24px; background: currentColor;
    -webkit-mask: var(--es-mask) center / contain no-repeat; mask: var(--es-mask) center / contain no-repeat;
}
.empty-state .es-text { font-size: 13px; font-weight: 600; }
