/* =====================================================================
   Mansa Fee 2026 — design system
   Tailwind provides utilities; this file provides the component layer,
   design tokens and the few things utilities cannot express cleanly.
   ===================================================================== */

:root {
    --brand-900: #0b1533;
    --brand-800: #12204a;
    --brand-700: #1b2c60;
    --brand-600: #24397a;
    --brand-500: #3b4f9e;
    --accent-600: #4f46e5;
    --accent-500: #6366f1;

    --surface: #ffffff;
    --canvas: #f5f6f9;
    --line: #e6e8ef;
    --line-strong: #d5d9e4;

    --ink-900: #0f172a;
    --ink-700: #334155;
    --ink-500: #64748b;
    --ink-400: #94a3b8;

    --ok: #047857;
    --warn: #b45309;
    --bad: #be123c;

    --radius: 12px;
    --radius-sm: 8px;
    --sidebar: 256px;
    --topbar: 62px;

    /* Type scale. Enterprise density: comfortable to read, still information
       rich. Page titles and section headings carry the hierarchy; body and table
       text stay at a size that survives a 1366px laptop. */
    --text-page: 29px;
    --text-page-sub: 14px;
    --text-section: 16.5px;
    --text-card: 16px;
    --text-body: 14px;
    --text-table: 13.5px;
    --text-meta: 12.5px;
    --text-micro: 11.5px;
    --text-label: 11px;

    /* Rhythm */
    --gap: 18px;
    --gap-sm: 12px;
    --pad-card: 18px;
    --pad-cell: 13px;

    --shadow-xs: 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-md: 0 8px 24px -8px rgba(15, 23, 42, .16), 0 2px 6px rgba(15, 23, 42, .05);
    --shadow-lg: 0 24px 48px -16px rgba(15, 23, 42, .28);

    --ease: cubic-bezier(.2, .8, .3, 1);
}

/* Without this, every padded element also declaring a width overflows its
   container by its own padding — which pushed the document ~18px wider than
   the viewport on the data-heavy screens. */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* The `hidden` attribute is how the panels (AI assistant, command palette, search
   results, dropdown menus) start closed. The UA stylesheet's [hidden] rule loses
   to any author `display`, so without this every component that declares its own
   display stays on screen permanently. */
[hidden] { display: none !important; }

/* Icons are plain inline SVGs sized by context. This default keeps a context
   that forgets to size one from rendering a wall-sized glyph. */
svg { width: 1em; height: 1em; flex: 0 0 auto; }

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink-900);
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: var(--text-body);
    line-height: 1.55;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11', 'ss01';
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* ------------------------------------------------------- page furniture */
.page-head {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.page-title {
    font-size: var(--text-page);
    font-weight: 680;
    letter-spacing: -.028em;
    line-height: 1.15;
    margin: 0;
    color: var(--ink-900);
}
.page-subtitle {
    margin: 7px 0 0;
    font-size: var(--text-page-sub);
    color: var(--ink-500);
    max-width: 76ch;
}
.crumbs {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: var(--text-meta);
    color: var(--ink-400);
    margin-bottom: 8px;
}
.crumbs a { color: var(--ink-500); text-decoration: none; font-weight: 500; }
.crumbs a:hover { color: var(--accent-600); }

/* Section heading used between stacked dashboard bands. */
.section-head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin: 28px 0 12px;
}
.section-head:first-child { margin-top: 0; }
.section-title { font-size: var(--text-section); font-weight: 650; letter-spacing: -.015em; margin: 0; }
.section-sub { font-size: var(--text-meta); color: var(--ink-500); margin: 0; }
.section-head .section-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* Key/value rows. Student 360, settings, collect and masters all lean on this;
   without it the label and value render run-together ("FatherHARINATH"). */
.kv {
    display: flex;
    align-items: baseline;
    gap: 14px;
    padding: 8px 0;
    border-bottom: 1px solid #f1f4f8;
}
.kv:last-child { border-bottom: 0; }
.kv .k {
    flex: 0 0 44%;
    font-size: var(--text-meta);
    color: var(--ink-500);
    font-weight: 500;
}
.kv .v {
    flex: 1 1 auto;
    font-size: var(--text-table);
    color: var(--ink-900);
    font-weight: 560;
    font-variant-numeric: tabular-nums;
    text-align: right;
    overflow-wrap: anywhere;
}
.kv .v.mono { font-weight: 600; }
.kv.is-block { flex-direction: column; align-items: flex-start; gap: 3px; }
.kv.is-block .k { flex: 0 0 auto; }
.kv.is-block .v { text-align: left; font-weight: 520; line-height: 1.55; }
.kv.grand {
    border-bottom: 0;
    border-top: 2px solid var(--line-strong);
    margin-top: 4px;
    padding-top: 10px;
}
.kv.grand .k { color: var(--ink-700); font-weight: 620; }
.kv.grand .v { font-size: 17px; font-weight: 680; letter-spacing: -.02em; }
.kv-stack { display: grid; gap: 0; }
@media (max-width: 560px) {
    .kv { flex-direction: column; gap: 2px; align-items: flex-start; }
    .kv .v { text-align: left; }
}

.tnum { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.money { font-variant-numeric: tabular-nums; font-weight: 600; letter-spacing: -.015em; }

/* ------------------------------------------------------------ scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border: 3px solid transparent; background-clip: content-box; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; border: 3px solid transparent; background-clip: content-box; }
.scroll-thin::-webkit-scrollbar { width: 6px; }

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

.sidebar {
    width: var(--sidebar);
    flex: 0 0 var(--sidebar);
    background: var(--brand-900);
    color: #c7d0e8;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    transition: transform .22s cubic-bezier(.4, 0, .2, 1), width .22s cubic-bezier(.4, 0, .2, 1);
}

.sidebar-brand {
    height: var(--topbar);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    flex: 0 0 auto;
}

.sidebar-nav { flex: 1 1 auto; overflow-y: auto; padding: 10px 10px 24px; }

.nav-section {
    padding: 18px 12px 7px;
    font-size: var(--text-label);
    font-weight: 650;
    letter-spacing: .105em;
    text-transform: uppercase;
    color: #7183ac;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    margin: 2px 0;
    border-radius: var(--radius-sm);
    color: #c7d0e8;
    font-size: 13.5px;
    font-weight: 520;
    text-decoration: none;
    transition: background .14s ease, color .14s ease;
    position: relative;
}
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item.is-active { background: var(--brand-700); color: #fff; }
.nav-item.is-active::before {
    content: '';
    position: absolute; left: -10px; top: 20%; bottom: 20%;
    width: 3px; border-radius: 0 3px 3px 0; background: var(--accent-500);
}
.nav-item svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: .85; }
.nav-item.is-active svg { opacity: 1; }
.nav-item .nav-count {
    margin-left: auto; font-size: 11px; font-weight: 600;
    background: rgba(255, 255, 255, .1); color: #dbe3f7;
    border-radius: 999px; padding: 1px 7px;
}
.nav-group-toggle .chev { margin-left: auto; width: 14px; height: 14px; transition: transform .18s ease; opacity: .6; }
.nav-group.is-open .nav-group-toggle .chev { transform: rotate(90deg); }
.nav-sub { display: none; padding: 2px 0 4px 16px; margin-left: 14px; border-left: 1px solid rgba(255, 255, 255, .09); }
.nav-group.is-open .nav-sub { display: block; }
.nav-sub a {
    display: block; padding: 6px 10px; border-radius: 6px; font-size: 13px;
    color: #a9b5d6; text-decoration: none; transition: color .14s ease, background .14s ease;
}
.nav-sub a:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.nav-sub a.is-active { color: #fff; background: rgba(99, 102, 241, .18); }

.main-area {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: var(--sidebar);
    display: flex;
    flex-direction: column;
    transition: margin-left .22s cubic-bezier(.4, 0, .2, 1);
}

body.sidebar-collapsed .sidebar { width: 68px; flex-basis: 68px; }
body.sidebar-collapsed .sidebar .brand-text,
body.sidebar-collapsed .sidebar .nav-label,
body.sidebar-collapsed .sidebar .nav-section,
body.sidebar-collapsed .sidebar .nav-count,
body.sidebar-collapsed .sidebar .nav-sub,
body.sidebar-collapsed .sidebar .chev { display: none; }
body.sidebar-collapsed .sidebar .nav-item { justify-content: center; padding: 10px; }
body.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 0; }
body.sidebar-collapsed .main-area { margin-left: 68px; }

.topbar {
    height: var(--topbar);
    background: rgba(255, 255, 255, .86);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 18px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.page-wrap { padding: 22px 26px 100px; max-width: 1660px; width: 100%; margin: 0 auto; }

/* ------------------------------------------------------------ search box */
.global-search {
    position: relative;
    flex: 1 1 460px;
    max-width: 560px;
    min-width: 0; /* lets the search box shrink instead of overflowing the bar */
}
.global-search input {
    width: 100%;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--line-strong);
    background: #fff;
    padding: 0 74px 0 38px;
    font-size: 13.5px;
    color: var(--ink-900);
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.global-search input:focus {
    border-color: var(--accent-500);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, .12);
}
.global-search .gs-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink-400); pointer-events: none; }
.global-search kbd {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    font-size: 10.5px; color: var(--ink-500); background: var(--canvas);
    border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 2px 6px;
    pointer-events: none;
}

.search-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0; right: 0;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    z-index: 60;
    animation: pop .14s ease-out;
    max-height: 74vh;
    overflow-y: auto;
}
.search-row {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; cursor: pointer; text-decoration: none; color: inherit;
    border-bottom: 1px solid #f2f4f8;
}
.search-row:last-child { border-bottom: 0; }
.search-row:hover, .search-row.is-active { background: #f7f8fc; }
.search-head { padding: 8px 14px; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-400); background: #fafbfe; border-bottom: 1px solid #f2f4f8; font-weight: 600; }
.search-empty { padding: 26px 16px; text-align: center; color: var(--ink-500); font-size: 13px; }

/* avatar */
.avatar {
    width: 34px; height: 34px; border-radius: 9px; flex: 0 0 34px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(145deg, var(--brand-700), var(--brand-500));
    color: #fff; font-size: 12px; font-weight: 600; letter-spacing: .02em;
}
.avatar-lg { width: 68px; height: 68px; border-radius: 16px; flex-basis: 68px; font-size: 22px; }
.avatar-sm { width: 26px; height: 26px; border-radius: 7px; flex-basis: 26px; font-size: 10.5px; }
.avatar-img { object-fit: cover; background: #e2e8f0; }

/* --------------------------------------------------------------- cards */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
}
.card-head {
    display: flex; align-items: center; gap: 12px;
    padding: 15px var(--pad-card);
    border-bottom: 1px solid var(--line);
}
.card-title { font-size: var(--text-card); font-weight: 650; letter-spacing: -.015em; }
.card-sub { font-size: var(--text-meta); color: var(--ink-500); margin-top: 2px; line-height: 1.45; }
.card-body { padding: var(--pad-card); }
.card-body-lg { padding: 24px; }
.card-foot {
    padding: 12px var(--pad-card);
    border-top: 1px solid var(--line);
    display: flex; align-items: center; gap: 10px;
    background: #fcfdff;
}
.card-alert { border-top: 3px solid var(--bad); }
.card-body-flush { padding: 0; }

.kpi {
    position: relative;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 17px var(--pad-card) 16px;
    box-shadow: var(--shadow-xs);
    transition: box-shadow .18s var(--ease), transform .18s var(--ease), border-color .18s var(--ease);
    overflow: hidden;
}
.kpi:hover { box-shadow: var(--shadow-sm); border-color: var(--line-strong); transform: translateY(-1px); }
.kpi-label { font-size: var(--text-label); font-weight: 620; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-500); display: flex; align-items: center; gap: 7px; }
.kpi-value { font-size: 30px; font-weight: 690; letter-spacing: -.032em; margin-top: 10px; font-variant-numeric: tabular-nums; line-height: 1.08; }
.kpi-value .unit { font-size: 17px; font-weight: 620; letter-spacing: -.01em; color: var(--ink-500); margin-left: 3px; }
/* Stacked, so the delta and its context read as two distinct facts. */
.kpi-foot { margin-top: 10px; font-size: var(--text-meta); color: var(--ink-500); display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.kpi-foot .trend { font-size: var(--text-micro); }
.kpi-ico {
    position: absolute; top: 15px; right: 15px;
    width: 30px; height: 30px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    background: #f4f6fb; color: var(--ink-400);
}
.kpi-ico svg { width: 15px; height: 15px; }
.kpi-accent { position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--accent-600); opacity: .9; }
.kpi-accent.ok { background: #059669; }
.kpi-accent.warn { background: #d97706; }
.kpi-accent.bad { background: #e11d48; }
.kpi-accent.info { background: #0284c7; }

.trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-size: 11.5px; padding: 2px 7px; border-radius: 999px; }
.trend-up { background: #ecfdf5; color: #047857; }
.trend-down { background: #fff1f2; color: #be123c; }
.trend-flat { background: #f1f5f9; color: #475569; }

/* ------------------------------------------------------------- buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: 36px; padding: 0 14px;
    border-radius: 9px; border: 1px solid transparent;
    font-size: 13.5px; font-weight: 570; cursor: pointer;
    text-decoration: none; white-space: nowrap;
    transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .06s ease;
}
.btn:active { transform: translateY(.5px); }
.btn svg { width: 15px; height: 15px; }
.btn:focus-visible, a:focus-visible, button:focus-visible, .nav-item:focus-visible {
    outline: 2px solid var(--accent-500); outline-offset: 2px;
}
.btn-primary { background: var(--brand-700); color: #fff; box-shadow: var(--shadow-xs); }
.btn-primary:hover { box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-600); }
.btn-accent { background: var(--accent-600); color: #fff; }
.btn-accent:hover { background: #4338ca; }
.btn-success { background: #047857; color: #fff; }
.btn-success:hover { background: #065f46; }
.btn-outline { background: #fff; border-color: var(--line-strong); color: var(--ink-700); }
.btn-outline:hover { background: #f8fafc; border-color: #c3cad8; color: var(--ink-900); }
.btn-ghost { background: transparent; color: var(--ink-700); }
.btn-ghost:hover { background: #f1f5f9; }
.btn-danger { background: #be123c; color: #fff; }
.btn-danger:hover { background: #9f1239; }
.btn-danger-soft { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.btn-danger-soft:hover { background: #ffe4e6; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-lg { height: 43px; padding: 0 19px; font-size: 14.5px; border-radius: 10px; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
/* Quiet destructive affordance: only shouts on hover. */
.btn-quiet-danger { background: transparent; color: var(--ink-500); }
.btn-quiet-danger:hover { background: #fff1f2; color: var(--bad); }
.btn[disabled], .btn.is-disabled { opacity: .55; pointer-events: none; }

.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 9px 0 0 9px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 9px 9px 0; }

/* -------------------------------------------------------------- inputs */
.label { display: block; font-size: 12.5px; font-weight: 560; color: var(--ink-700); margin-bottom: 6px; }
.label .req { color: #e11d48; }
.input, .select, .textarea {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    background: #fff;
    padding: 8px 11px;
    font-size: 13.5px;
    color: var(--ink-900);
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
    font-family: inherit;
}
.textarea { min-height: 88px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent-500); box-shadow: 0 0 0 4px rgba(99, 102, 241, .12); }
.input[readonly], .input:disabled, .select:disabled { background: #f8fafc; color: var(--ink-500); }
.input.is-invalid, .select.is-invalid { border-color: #f43f5e; box-shadow: 0 0 0 4px rgba(244, 63, 94, .1); }
.select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}
.field-error { font-size: 12px; color: #be123c; margin-top: 5px; }
.hint { font-size: 11.5px; color: var(--ink-400); margin-top: 5px; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: 9px 0 0 9px; }
.input-group .addon {
    display: inline-flex; align-items: center; padding: 0 12px;
    background: #f8fafc; border: 1px solid var(--line-strong); border-left: 0;
    border-radius: 0 9px 9px 0; font-size: 13px; color: var(--ink-500);
}
.checkbox { width: 16px; height: 16px; border-radius: 4px; accent-color: var(--accent-600); }

/* segmented control */
.segmented {
    display: inline-flex; background: #eef1f6; border-radius: 9px; padding: 3px; gap: 2px;
    max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.segmented::-webkit-scrollbar { height: 0; }
@media (max-width: 640px) {
    .topbar-secondary { display: none; }
    .topbar { padding: 0 12px; gap: 8px; }

    /* Filter bars carry inline min-widths that are correct on a desk and too
       wide on a phone — stack them full-bleed instead of letting them push the
       page sideways. */
    .card-head form { flex-direction: column; align-items: stretch; }
    .card-head form > * { width: 100% !important; min-width: 0 !important; }
}
.segmented a, .segmented button {
    padding: 6px 13px; border-radius: 7px; font-size: var(--text-meta); font-weight: 560;
    color: var(--ink-500); text-decoration: none; border: 0; background: transparent; cursor: pointer;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease;
    white-space: nowrap;
}
.segmented a:hover, .segmented button:hover { color: var(--ink-900); }
.segmented .is-active { background: #fff; color: var(--ink-900); box-shadow: var(--shadow-xs); font-weight: 600; }

/* --------------------------------------------------------------- badges */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2.5px 8px; border-radius: 999px;
    font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
    white-space: nowrap; border: 1px solid transparent;
}
.badge svg { width: 12px; height: 12px; }
.ring-slate-200 { box-shadow: inset 0 0 0 1px #e2e8f0; }
.ring-emerald-200 { box-shadow: inset 0 0 0 1px #a7f3d0; }
.ring-amber-200 { box-shadow: inset 0 0 0 1px #fde68a; }
.ring-orange-200 { box-shadow: inset 0 0 0 1px #fed7aa; }
.ring-rose-200 { box-shadow: inset 0 0 0 1px #fecdd3; }
.ring-indigo-200 { box-shadow: inset 0 0 0 1px #c7d2fe; }
.ring-sky-200 { box-shadow: inset 0 0 0 1px #bae6fd; }
.ring-violet-200 { box-shadow: inset 0 0 0 1px #ddd6fe; }

.dot { width: 7px; height: 7px; border-radius: 999px; display: inline-block; flex: 0 0 7px; }

/* -------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
.table-wrap { overflow-x: auto; }
/* Constrained variant: the header can only stick when the wrapper itself scrolls. */
.table-wrap.tall { max-height: 520px; overflow-y: auto; }
table.data {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: var(--text-table);
}
table.data thead th {
    position: sticky; top: 0; z-index: 2;
    background: #fafbfd;
    border-bottom: 1px solid var(--line);
    padding: 11px var(--pad-cell);
    text-align: left;
    font-size: var(--text-label);
    font-weight: 660;
    letter-spacing: .055em;
    text-transform: uppercase;
    color: var(--ink-500);
    white-space: nowrap;
}
table.data thead th .th-sub { display: block; text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--ink-400); font-size: var(--text-micro); margin-top: 1px; }
table.data thead th a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
table.data thead th a:hover { color: var(--accent-600); }
table.data thead th.num, table.data thead th.is-right { text-align: right; }
table.data tbody td {
    padding: var(--pad-cell) var(--pad-cell);
    border-bottom: 1px solid #f1f4f8;
    vertical-align: middle;
    color: var(--ink-700);
    line-height: 1.45;
}
table.data tbody tr { transition: background .12s ease; }
table.data tbody tr:hover { background: #fafbfe; }
table.data tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--accent-500); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr.is-selected { background: #f4f6ff; }
table.data td.strong, table.data td .strong { color: var(--ink-900); font-weight: 580; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .row-actions { opacity: 0; transition: opacity .14s ease; white-space: nowrap; }
table.data tr:hover .row-actions, table.data tr:focus-within .row-actions { opacity: 1; }
/* Touch devices never hover, so actions must always be reachable. */
@media (hover: none) { table.data .row-actions { opacity: 1; } }
table.data.compact tbody td { padding: 8px var(--pad-cell); }
table.data tbody td .cell-stack { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
table.data tbody td .cell-sub { font-size: var(--text-micro); color: var(--ink-400); }
table.data ol.cell-list, table.data ul.cell-list { margin: 0; padding: 0; list-style: none; }
table.data .cell-scroll { max-width: 300px; }
table.data .cell-scroll > * { overflow: hidden; text-overflow: ellipsis; }
table.data .is-clickable { text-decoration: none; }
table.data .is-clickable:hover { text-decoration: underline; text-underline-offset: 2px; }
.tfoot-total td { background: #f8fafc; font-weight: 660; color: var(--ink-900); border-top: 1px solid var(--line); }
table.data td .money, table.data .money { font-weight: 620; color: var(--ink-900); }
/* Short cells must never fold into five-line towers when a wide table is
   squeezed — let the table scroll sideways instead. */
.data th.tnum, .data td.tnum, .data th.num, .data td.num, .data td.money { white-space: nowrap; }
.data td .badge { white-space: nowrap; }

.progress-cell { display: flex; align-items: center; gap: 9px; min-width: 112px; }
.progress-cell .meter { flex: 1 1 auto; }
.progress-cell .pct { font-size: var(--text-micro); color: var(--ink-500); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }

.pagination { display: flex; align-items: center; gap: 4px; }
.pagination a, .pagination span {
    min-width: 32px; height: 32px; padding: 0 9px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 8px; font-size: 12.5px; font-weight: 550;
    color: var(--ink-700); text-decoration: none; border: 1px solid transparent;
}
.pagination a:hover { background: #eef1f6; }
.pagination .is-current { background: var(--brand-700); color: #fff; }
.pagination .is-disabled { color: var(--ink-400); pointer-events: none; }

/* ---------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { height: 0; }
.tab {
    padding: 12px 14px;
    font-size: var(--text-table); font-weight: 560;
    color: var(--ink-500);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
    display: inline-flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--ink-900); background: #fafbfe; }
.tab.is-active { color: var(--brand-700); border-bottom-color: var(--brand-700); font-weight: 620; }
.tab .tab-count { font-size: var(--text-label); background: #eef1f6; color: var(--ink-500); border-radius: 999px; padding: 1px 7px; font-weight: 620; }
.tab.is-active .tab-count { background: #e7ebff; color: var(--brand-700); }

/* ------------------------------------------------------------- skeleton */
.skeleton {
    background: linear-gradient(90deg, #eef1f6 25%, #e2e7ef 37%, #eef1f6 63%);
    background-size: 400% 100%;
    animation: shimmer 1.3s ease-in-out infinite;
    border-radius: 6px;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ------------------------------------------------------------- feedback */
.toast-stack { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
    display: flex; align-items: flex-start; gap: 10px;
    min-width: 280px; max-width: 400px;
    background: #fff; border: 1px solid var(--line);
    border-left: 3px solid var(--accent-600);
    border-radius: 10px; padding: 12px 14px;
    box-shadow: var(--shadow-md);
    animation: slide-in .2s cubic-bezier(.2, .8, .3, 1);
}
.toast.is-ok { border-left-color: #059669; }
.toast.is-warn { border-left-color: #d97706; }
.toast.is-bad { border-left-color: #e11d48; }
.toast-title { font-size: 13px; font-weight: 620; color: var(--ink-900); }
.toast-body { font-size: 12.5px; color: var(--ink-500); margin-top: 2px; }
.toast-close { margin-left: auto; color: var(--ink-400); cursor: pointer; background: none; border: 0; padding: 0; }

.alert { padding: 13px 15px; border-radius: 10px; font-size: var(--text-body); display: flex; gap: 11px; align-items: flex-start; border: 1px solid; line-height: 1.55; }
.alert > svg { width: 16px; height: 16px; margin-top: 2px; flex: 0 0 auto; }
.alert > div { min-width: 0; }
.alert-info { background: #f0f6ff; border-color: #d3e2fb; color: #1e3a8a; }
.alert-warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-bad  { background: #fff1f2; border-color: #fecdd3; color: #9f1239; }
.alert-ok   { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }

/* ------------------------------------------------------------- overlays */
.overlay {
    position: fixed; inset: 0; z-index: 120;
    background: rgba(15, 23, 42, .48);
    backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    animation: fade .14s ease-out;
}
.modal {
    background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg);
    width: 100%; max-width: 520px; max-height: 92vh; overflow: auto;
    animation: pop .18s cubic-bezier(.2, .8, .3, 1);
}
.modal-lg { max-width: 760px; }
.modal-xl { max-width: 1000px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 9px; padding: 14px 20px; border-top: 1px solid var(--line); background: #fafbfd; position: sticky; bottom: 0; }

.drawer {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 94vw);
    background: #fff; z-index: 130; box-shadow: var(--shadow-lg);
    display: flex; flex-direction: column;
    animation: slide-left .22s cubic-bezier(.2, .8, .3, 1);
}

.dropdown {
    position: absolute; right: 0; top: calc(100% + 6px);
    min-width: 210px; background: #fff;
    border: 1px solid var(--line); border-radius: 11px;
    box-shadow: var(--shadow-md); padding: 6px; z-index: 70;
    animation: pop .13s ease-out;
}
.dropdown a, .dropdown button {
    display: flex; align-items: center; gap: 9px; width: 100%;
    padding: 8px 10px; border-radius: 8px; font-size: 13px;
    color: var(--ink-700); text-decoration: none; border: 0; background: none; cursor: pointer; text-align: left;
}
.dropdown a:hover, .dropdown button:hover { background: #f1f5f9; color: var(--ink-900); }
.dropdown svg { width: 15px; height: 15px; opacity: .7; }
.dropdown-sep { height: 1px; background: var(--line); margin: 5px 4px; }

/* ------------------------------------------------------------- timeline */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 1.5px; background: var(--line); }
.timeline-item { position: relative; padding-bottom: 18px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
    position: absolute; left: -26px; top: 3px;
    width: 15px; height: 15px; border-radius: 999px;
    background: #fff; border: 2px solid var(--line-strong);
    display: flex; align-items: center; justify-content: center;
}
.timeline-dot.is-ok { border-color: #34d399; background: #ecfdf5; }
.timeline-dot.is-bad { border-color: #fb7185; background: #fff1f2; }
.timeline-dot.is-info { border-color: #818cf8; background: #eef2ff; }

/* ------------------------------------------------------------- utilities */
.empty-state { padding: 48px 24px; text-align: center; }
.empty-state.compact { padding: 26px 20px; }
.empty-state-icon {
    width: 50px; height: 50px; margin: 0 auto 13px;
    border-radius: 14px; background: #f1f5f9;
    display: flex; align-items: center; justify-content: center; color: var(--ink-400);
}
.empty-state.compact .empty-state-icon { width: 42px; height: 42px; margin-bottom: 10px; }
.empty-state h3 { font-size: var(--text-card); font-weight: 640; margin: 0 0 6px; letter-spacing: -.015em; }
.empty-state p { font-size: var(--text-meta); color: var(--ink-500); margin: 0 auto 15px; max-width: 430px; }
.empty-state .empty-hint { font-size: var(--text-micro); color: var(--ink-400); margin-top: 11px; }

.divide-y > * + * { border-top: 1px solid var(--line); }
.stat-strip { display: flex; flex-wrap: wrap; }
.stat-strip > div { flex: 1 1 160px; padding: 15px var(--pad-card); border-right: 1px solid var(--line); }
.stat-strip > div:last-child { border-right: 0; }
.stat-strip .k { font-size: var(--text-label); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-500); font-weight: 620; }
.stat-strip .v { font-size: 17px; font-weight: 660; margin-top: 5px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
@media (max-width: 620px) {
    .stat-strip > div { flex: 1 1 100%; border-right: 0; border-bottom: 1px solid var(--line); }
    .stat-strip > div:last-child { border-bottom: 0; }
}

.meter { height: 7px; border-radius: 999px; background: #eef1f6; overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--accent-600); transition: width .4s ease; }
.meter.ok > span { background: #059669; }
.meter.warn > span { background: #d97706; }
.meter.bad > span { background: #e11d48; }

.link { color: var(--accent-600); text-decoration: none; font-weight: 550; }
.link:hover { text-decoration: underline; }
.muted { color: var(--ink-500); }
.subtle { color: var(--ink-400); }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 12.5px; }

/* ------------------------------------------------ composition & hierarchy */

/* Primary KPI band: four metrics, then the financial summary underneath. */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--gap);
}
@media (max-width: 1180px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .kpi-grid { grid-template-columns: minmax(0, 1fr); gap: var(--gap-sm); } }

/* Two-column dashboard band: a wide data panel beside a narrower action panel. */
.dash-band {
    display: grid;
    grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr);
    gap: var(--gap);
    align-items: start;
    margin-bottom: var(--gap);
}
.dash-band > div { min-width: 0; display: flex; flex-direction: column; gap: var(--gap); }
@media (max-width: 1180px) { .dash-band { grid-template-columns: minmax(0, 1fr); } }

/* Student 360: main column + side rail. */
.s360-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: var(--gap);
    align-items: start;
}
.s360-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 350px;
    gap: var(--gap);
    align-items: start;
}
@media (max-width: 1180px) {
    .s360-grid, .s360-split { grid-template-columns: minmax(0, 1fr); }
}

.stack { display: flex; flex-direction: column; gap: var(--gap); }
.stack-sm { display: flex; flex-direction: column; gap: var(--gap-sm); }

/* Compact action/insight list rows used across dashboard panels. */
.feed { display: flex; flex-direction: column; }
.feed-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px var(--pad-card);
    text-decoration: none; color: inherit;
    border-bottom: 1px solid #f1f4f8;
    transition: background .13s ease;
}
.feed-item:last-child { border-bottom: 0; }
.feed-item:hover { background: #fafbfe; }
.feed-item:hover .feed-title { color: var(--accent-600); }
.feed-item .feed-body { flex: 1 1 auto; min-width: 0; }
.feed-title { display: block; font-size: var(--text-table); font-weight: 570; color: var(--ink-900); transition: color .13s ease; }
.feed-meta { display: block; font-size: var(--text-micro); color: var(--ink-500); margin-top: 2px; }
.feed-value { font-size: var(--text-table); font-weight: 620; font-variant-numeric: tabular-nums; white-space: nowrap; }
.feed-item.is-alert { padding-left: 15px; box-shadow: inset 3px 0 0 transparent; }
.feed-item.is-alert:hover { box-shadow: inset 3px 0 0 var(--bad); }

/* Financial summary: a single reconciled row of the fee equation. */
.fin-strip { display: flex; flex-wrap: wrap; }
.fin-strip > div {
    flex: 1 1 168px; padding: 15px var(--pad-card);
    border-right: 1px solid var(--line);
    min-width: 0;
}
.fin-strip > div:last-child { border-right: 0; }
.fin-strip .k {
    font-size: var(--text-label); text-transform: uppercase; letter-spacing: .06em;
    color: var(--ink-500); font-weight: 620;
}
.fin-strip .v { font-size: 17.5px; font-weight: 660; margin-top: 5px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.fin-strip .v small { display: block; font-size: var(--text-micro); font-weight: 500; color: var(--ink-400); letter-spacing: 0; margin-top: 2px; }
@media (max-width: 620px) {
    .fin-strip > div { flex: 1 1 100%; border-right: 0; border-bottom: 1px solid var(--line); }
    .fin-strip > div:last-child { border-bottom: 0; }
}

/* Per-term fee status chips: scan a student's whole position at a glance. */
.feestat {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
    gap: 9px;
}
.feestat-item {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
    display: flex; flex-direction: column; gap: 3px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.feestat-item:hover { border-color: var(--line-strong); box-shadow: var(--shadow-xs); }
.feestat-item .t { font-size: var(--text-meta); font-weight: 620; color: var(--ink-900); }
.feestat-item .a { font-size: var(--text-table); font-weight: 660; font-variant-numeric: tabular-nums; letter-spacing: -.015em; }
.feestat-item.is-paid { border-left: 3px solid #059669; }
.feestat-item.is-paid .a { color: #047857; }
.feestat-item.is-part { border-left: 3px solid #d97706; }
.feestat-item.is-part .a { color: #b45309; }
.feestat-item.is-due { border-left: 3px solid #e11d48; }
.feestat-item.is-due .a { color: #be123c; }
.feestat-item .s { font-size: var(--text-micro); color: var(--ink-500); }

/* Student 360 identity header. */
.identity { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; padding: 20px var(--pad-card); }
.identity-main { flex: 1 1 320px; min-width: 0; }
.identity-name { font-size: 23px; font-weight: 690; letter-spacing: -.025em; margin: 0; line-height: 1.2; }
.identity-meta { display: flex; gap: 8px 18px; flex-wrap: wrap; margin-top: 10px; font-size: var(--text-meta); color: var(--ink-700); }
.identity-meta span { display: inline-flex; align-items: center; gap: 6px; }
.identity-meta svg { width: 14px; height: 14px; opacity: .55; }
.identity-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 15px; }
.identity-fee { flex: 0 0 318px; min-width: 264px; }
@media (max-width: 900px) { .identity-fee { flex: 1 1 100%; } }

/* Fee summary panel: five figures plus the outstanding headline. */
.fee-summary { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.fee-summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); }
.fee-summary-grid > div { background: #fff; padding: 11px 13px; }
.fee-summary-grid .k { font-size: var(--text-label); text-transform: uppercase; letter-spacing: .055em; color: var(--ink-500); font-weight: 620; }
.fee-summary-grid .v { font-size: 15.5px; font-weight: 660; margin-top: 3px; font-variant-numeric: tabular-nums; letter-spacing: -.015em; }
.fee-summary-due { padding: 13px; border-top: 1px solid var(--line); }
.fee-summary-due .row { display: flex; align-items: baseline; gap: 10px; }
.fee-summary-due .k { font-size: var(--text-label); text-transform: uppercase; letter-spacing: .055em; font-weight: 620; }
.fee-summary-due .v { margin-left: auto; font-size: 25px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------- loading states */
.sk-line { height: 11px; border-radius: 6px; }
.sk-title { height: 15px; border-radius: 6px; }
.sk-metric { height: 30px; border-radius: 7px; width: 62%; }
.w-25 { width: 25%; } .w-35 { width: 35%; } .w-45 { width: 45%; }
.w-55 { width: 55%; } .w-70 { width: 70%; } .w-85 { width: 85%; }
.sk-row td { padding: var(--pad-cell); }
.sk-stack { display: flex; flex-direction: column; gap: 8px; }
/* Panel-level loading veil: keeps layout stable instead of collapsing to white. */
.is-loading { position: relative; }
.is-loading::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, .7), rgba(255, 255, 255, .92));
    border-radius: inherit;
    animation: fade .18s ease-out;
    pointer-events: none;
}
.is-busy .spinner { display: block; }

/* ------------------------------------------------------------ animations */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slide-left { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }
/* Respect the OS setting: keep the product calm for people who ask for less motion. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}
.fade-up { animation: slide-in .26s cubic-bezier(.2, .8, .3, 1) both; }
.stagger > * { animation: slide-in .3s cubic-bezier(.2, .8, .3, 1) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; }
.stagger > *:nth-child(2) { animation-delay: .05s; }
.stagger > *:nth-child(3) { animation-delay: .08s; }
.stagger > *:nth-child(4) { animation-delay: .11s; }
.stagger > *:nth-child(5) { animation-delay: .14s; }
.stagger > *:nth-child(6) { animation-delay: .17s; }

.spinner {
    width: 15px; height: 15px; border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff;
    animation: spin .7s linear infinite;
}
.spinner-dark { border-color: rgba(15, 23, 42, .15); border-top-color: var(--brand-700); }
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------- AI widget */
.ai-fab {
    position: fixed; right: 20px; bottom: 20px; z-index: 90;
    width: 54px; height: 54px; border-radius: 999px;
    background: var(--brand-700); color: #fff; border: 0; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 12px 28px -8px rgba(27, 44, 96, .55);
    transition: transform .18s cubic-bezier(.2, .8, .3, 1), background .15s ease;
}
.ai-fab:hover { transform: translateY(-2px) scale(1.03); background: var(--brand-600); }
.ai-fab svg { width: 23px; height: 23px; }

.ai-panel {
    position: fixed; right: 20px; bottom: 86px; z-index: 95;
    width: min(430px, calc(100vw - 32px));
    height: min(620px, calc(100vh - 130px));
    background: #fff; border: 1px solid var(--line); border-radius: 16px;
    box-shadow: var(--shadow-lg);
    display: flex; flex-direction: column; overflow: hidden;
    animation: slide-in .22s cubic-bezier(.2, .8, .3, 1);
}
.ai-head { padding: 14px 16px; background: var(--brand-900); color: #fff; display: flex; align-items: center; gap: 10px; }
.ai-body { flex: 1 1 auto; overflow-y: auto; padding: 16px; background: #fafbfd; display: flex; flex-direction: column; gap: 12px; }
.ai-msg { max-width: 88%; padding: 10px 13px; border-radius: 12px; font-size: 13px; line-height: 1.5; }
.ai-msg.user { align-self: flex-end; background: var(--brand-700); color: #fff; border-bottom-right-radius: 4px; }
.ai-msg.bot { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; color: var(--ink-900); }
.ai-msg.bot table { width: 100%; margin-top: 8px; font-size: 12px; border-collapse: collapse; }
.ai-msg.bot th, .ai-msg.bot td { padding: 5px 7px; border-bottom: 1px solid var(--line); text-align: left; }
.ai-msg.bot th { color: var(--ink-500); font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; }
.ai-foot { border-top: 1px solid var(--line); padding: 11px 12px; background: #fff; }
.ai-chip {
    display: inline-block; padding: 4px 10px; margin: 2px 2px 0;
    border: 1px solid var(--line-strong); border-radius: 999px;
    font-size: 11.5px; color: var(--ink-700); background: #fff; cursor: pointer;
}
.ai-chip:hover { border-color: var(--accent-500); color: var(--accent-600); background: #f6f7ff; }

/* -------------------------------------------------------------- print */
.print-only { display: none; }
@media print {
    .sidebar, .topbar, .ai-fab, .ai-panel, .toast-stack, .no-print, footer { display: none !important; }
    .main-area { margin-left: 0 !important; }
    .page-wrap { padding: 0 !important; max-width: none; }
    body { background: #fff; }
    .card { box-shadow: none; border-color: #cbd5e1; break-inside: avoid; }
    .print-only { display: block; }
    a[href]::after { content: ''; }
    @page { margin: 14mm; }
}

/* --------------------------------------------------------- responsive */
@media (max-width: 1023px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    body.sidebar-open .sidebar { transform: none; }
    .main-area, body.sidebar-collapsed .main-area { margin-left: 0; }
    body.sidebar-open::after { content: ''; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 45; }
    body.sidebar-collapsed .sidebar { width: var(--sidebar); flex-basis: var(--sidebar); }
    body.sidebar-collapsed .sidebar .brand-text,
    body.sidebar-collapsed .sidebar .nav-label,
    body.sidebar-collapsed .sidebar .nav-section,
    body.sidebar-collapsed .sidebar .nav-count,
    body.sidebar-collapsed .sidebar .chev { display: block; }
    body.sidebar-collapsed .sidebar .nav-sub { display: none; }
    body.sidebar-collapsed .nav-group.is-open .nav-sub { display: block; }
    body.sidebar-collapsed .sidebar .nav-item { justify-content: flex-start; padding: 8px 12px; }
    body.sidebar-collapsed .sidebar-brand { justify-content: flex-start; padding: 0 18px; }
    .page-wrap { padding: 16px 14px 100px; }
}

.mobile-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: rgba(255, 255, 255, .95);
    backdrop-filter: saturate(180%) blur(12px);
    border-top: 1px solid var(--line);
    display: none;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.mobile-nav a {
    flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 3px;
    font-size: var(--text-label); font-weight: 560; color: var(--ink-500); text-decoration: none;
    padding: 5px 0 4px; position: relative; border-radius: 8px;
    transition: color .14s ease;
}
.mobile-nav a svg { width: 20px; height: 20px; opacity: .8; }
.mobile-nav a.is-active { color: var(--brand-700); font-weight: 620; }
.mobile-nav a.is-active svg { opacity: 1; }
.mobile-nav a.is-active::before {
    content: ''; position: absolute; top: -6px; left: 50%; transform: translateX(-50%);
    width: 26px; height: 2.5px; border-radius: 0 0 3px 3px; background: var(--brand-700);
}

@media (max-width: 1023px) {
    .mobile-nav { display: flex; }
    .ai-fab { bottom: 74px; }
    .ai-panel { bottom: 136px; height: min(560px, calc(100vh - 200px)); }
    .toast-stack { bottom: 74px; }
}

/* ========================================================== LOADING STATES */
/* Thin top-edge progress bar shown while a page navigates. */
.nav-progress {
    position: fixed; top: 0; left: 0; right: 0; height: 2.5px; z-index: 100;
    background: var(--brand-700); transform-origin: 0 50%;
    transform: scaleX(0); opacity: 0; transition: transform .5s ease-out, opacity .25s ease;
}
.nav-progress.is-running { opacity: 1; transform: scaleX(.82); }

/* Buttons waiting on a server round-trip. */
.btn.is-busy, .btn[disabled] { cursor: progress; }
.btn.is-busy { opacity: .72; pointer-events: none; }
.btn.is-busy::before {
    content: ''; width: 12px; height: 12px; margin-right: 1px; border-radius: 50%;
    border: 2px solid currentColor; border-top-color: transparent; opacity: .75;
    animation: btn-spin .6s linear infinite; flex: 0 0 auto;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ====================================================== STUDENT 360 shell */
.s360-head { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; padding: var(--pad-card); }
.s360-id { flex: 1 1 340px; min-width: 0; }
.s360-name-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.s360-name { font-size: 26px; font-weight: 700; letter-spacing: -.03em; margin: 0; line-height: 1.12; }
.s360-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.s360-chip {
    display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
    font-size: var(--text-meta); color: var(--ink-700);
    background: #f7f9fc; border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px;
}
.s360-chip svg { width: 13px; height: 13px; opacity: .55; flex: 0 0 auto; }
.s360-chip.is-key {
    background: #eef2fb; border-color: #ccd7f0; color: var(--brand-800);
    font-family: var(--font-mono); font-weight: 640; letter-spacing: .02em;
}
.s360-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 17px; align-items: center; }
.s360-actions .btn { padding-top: 9px; padding-bottom: 9px; }

/* Fee position panel beside the identity block */
.pay-panel {
    flex: 0 0 336px; min-width: 270px;
    display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
    background: var(--line); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
}
.pay-cell { background: #fff; padding: 13px 15px; }
.pay-cell .k { font-size: var(--text-label); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-500); font-weight: 620; }
.pay-cell .v { font-size: 16px; font-weight: 660; margin-top: 5px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.pay-due { grid-column: 1 / -1; padding: 14px 15px 15px; background: #fff2f4; }
.pay-due.is-clear { background: #f0fdf6; }
.pay-due-row { display: flex; align-items: baseline; gap: 10px; }
.pay-due-row .k { font-size: var(--text-label); text-transform: uppercase; letter-spacing: .06em; font-weight: 640; color: #9f1239; }
.pay-due.is-clear .pay-due-row .k { color: #047857; }
.pay-due-row .v { margin-left: auto; font-size: 25px; font-weight: 700; letter-spacing: -.032em; color: #be123c; font-variant-numeric: tabular-nums; }
.pay-due.is-clear .pay-due-row .v { color: #047857; }
.pay-due .meter { margin-top: 10px; background: rgba(255, 255, 255, .8); }
.pay-due-note { font-size: var(--text-micro); color: var(--ink-500); margin-top: 6px; }

/* Term status — quick fee intelligence */
.term-status { display: flex; flex-direction: column; }
.term-status-row { display: flex; align-items: center; gap: 12px; padding: 11px var(--pad-card); border-bottom: 1px solid var(--line); }
.term-status-row:last-child { border-bottom: 0; }
.term-status-row .t { flex: 0 0 88px; font-weight: 620; font-size: var(--text-body); letter-spacing: -.01em; }
.term-status-row .bar { flex: 1 1 auto; min-width: 56px; }
.term-status-row .amt { font-size: var(--text-meta); font-variant-numeric: tabular-nums; color: var(--ink-500); text-align: right; min-width: 92px; }

/* Compact fact grid (last payment, last receipt, activity …) */
.fact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); }
.fact-grid > div { background: #fff; padding: 12px var(--pad-card); min-width: 0; }
.fact-grid .k { font-size: var(--text-label); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-500); font-weight: 620; }
.fact-grid .v { font-size: var(--text-body); font-weight: 600; margin-top: 4px; color: var(--ink-900); overflow: hidden; text-overflow: ellipsis; }
.fact-grid .v.mono { font-family: var(--font-mono); font-size: var(--text-meta); }

/* Fee equation metrics */
.metric-grid { display: flex; flex-wrap: wrap; }
.metric { flex: 1 1 150px; padding: 16px var(--pad-card); border-right: 1px solid var(--line); min-width: 0; }
.metric:last-child { border-right: 0; }
.metric .k { font-size: var(--text-label); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-500); font-weight: 620; }
.metric .v { font-size: 22px; font-weight: 680; letter-spacing: -.028em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.metric.is-due .v { color: #be123c; }
.metric.is-ok .v { color: #047857; }
.metric.is-warn .v { color: #b45309; }
.metric .op { color: var(--ink-400); font-weight: 400; }

/* Row action menu inside tables */
.row-menu { position: relative; display: inline-flex; }

@media (max-width: 900px) {
    .s360-name { font-size: 22px; }
    .pay-panel { flex: 1 1 100%; }
    .fact-grid { grid-template-columns: 1fr; }
    .metric { flex: 1 1 50%; }
}
