/* ═══════════════════════════════════════════════════════════
   RESET
   ═══════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

/* ═══════════════════════════════════════════════════════════
   THEME TOKENS
   ═══════════════════════════════════════════════════════════ */
:root {
    /* Dark (default) */
    --bg: #080c0b;
    --bg-rgb: 8, 12, 11;
    --surface: #0f1512;
    --surface-rgb: 15, 21, 18;
    --surface-2: #161d1a;
    --surface-3: #1e2720;
    --border: rgba(255,255,255,0.05);
    --border-mid: rgba(255,255,255,0.10);
    --border-hi: rgba(255,255,255,0.16);
    --text-1: #eef2f0;
    --text-2: #8fa399;
    --text-3: #4d6059;
    --teal: #2dd4bf;
    --teal-dim: #0d9488;
    --teal-glow: rgba(45,212,191,0.12);
    --teal-bg: rgba(45,212,191,0.07);
    --green: #4ade80;
    --green-bg: rgba(74,222,128,0.07);
    --amber: #fbbf24;
    --amber-bg: rgba(251,191,36,0.07);
    --red: #f87171;
    --red-bg: rgba(248,113,113,0.07);
    --blue: #60a5fa;

    /* Geometry */
    --radius: 7px;
    --radius-lg: 11px;
    --sidebar-w: 240px;

    /* Motion — one clock, one curve, everywhere */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --t-fast: 120ms;
    --t-med: 200ms;
    --t-slow: 320ms;

    /* Reusable glow ring — the one recurring "signature" accent */
    --glow-ring: 0 0 0 1px rgba(45,212,191,0.28), 0 0 18px rgba(45,212,191,0.10);
    --glow-ring-soft: 0 0 0 1px rgba(45,212,191,0.16), 0 0 12px rgba(45,212,191,0.06);

    /* Fonts */
    --font: 'DM Sans', sans-serif;
    --font-head: 'Syne', sans-serif;
    --mono: 'DM Mono', monospace;
}

/* Green theme */
[data-theme="green"] {
    --bg: #0e0f13;
    --bg-rgb: 14, 15, 19;
    --surface: #16181f;
    --surface-rgb: 22, 24, 31;
    --surface-2: #1e2029;
    --surface-3: #252733;
    --border: rgba(255,255,255,0.06);
    --border-mid: rgba(255,255,255,0.11);
    --border-hi: rgba(255,255,255,0.18);
    --text-1: #f0f0f4;
    --text-2: #9498a8;
    --text-3: #5a5e72;
    --teal: #00c264;
    --teal-dim: #00843f;
    --teal-glow: rgba(0,194,100,0.15);
    --teal-bg: rgba(0,194,100,0.08);
    --green: #00c264;
    --green-bg: rgba(0,194,100,0.08);
    --amber: #f0a500;
    --amber-bg: rgba(240,165,0,0.08);
    --red: #ff4f4f;
    --red-bg: rgba(255,79,79,0.08);
    --blue: #0d7cff;
    --glow-ring: 0 0 0 1px rgba(0,194,100,0.30), 0 0 18px rgba(0,194,100,0.12);
    --glow-ring-soft: 0 0 0 1px rgba(0,194,100,0.16), 0 0 12px rgba(0,194,100,0.06);
}

/* Light theme */
[data-theme="light"] {
    --bg: #f5f7f5;
    --bg-rgb: 245, 247, 245;
    --surface: #ffffff;
    --surface-rgb: 255, 255, 255;
    --surface-2: #f0f2f0;
    --surface-3: #e8ebe8;
    --border: rgba(0,0,0,0.07);
    --border-mid: rgba(0,0,0,0.11);
    --border-hi: rgba(0,0,0,0.18);
    --text-1: #1a1f1a;
    --text-2: #4a5a4f;
    --text-3: #7a8a7f;
    --teal: #0d9488;
    --teal-dim: #0f766e;
    --teal-glow: rgba(13,148,136,0.12);
    --teal-bg: rgba(13,148,136,0.07);
    --green: #22c55e;
    --green-bg: rgba(34,197,94,0.07);
    --amber: #eab308;
    --amber-bg: rgba(234,179,8,0.07);
    --red: #ef4444;
    --red-bg: rgba(239,68,68,0.07);
    --blue: #3b82f6;
    --glow-ring: 0 0 0 1px rgba(13,148,136,0.22), 0 0 14px rgba(13,148,136,0.08);
    --glow-ring-soft: 0 0 0 1px rgba(13,148,136,0.12), 0 0 10px rgba(13,148,136,0.05);
}

body, .sidebar, .main, .card, .stat-card, .modal {
    transition: background var(--t-slow) var(--ease),
                border-color var(--t-slow) var(--ease),
                color var(--t-slow) var(--ease);
}

html, body { height: 100%; overflow: hidden; }
body {
    background: var(--bg);
    font-family: var(--font);
    color: var(--text-1);
    display: flex;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--teal-bg); color: var(--teal); }

/* Thin, quiet scrollbars — reads as "instrument", not browser chrome */
* { scrollbar-width: thin; scrollbar-color: var(--border-hi) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

/* Visible, deliberate focus ring everywhere — no browser default outline left in */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
    outline: none;
    box-shadow: var(--glow-ring);
    border-radius: var(--radius);
}

h1, h2, h3, h4, .page-title, .logo-name { font-family: var(--font-head); letter-spacing: -0.02em; }

.mono, .stat-value, .qr-ref, .fee-table td.td-bal, .pill, .code,
.sc-value, .expiry-bar span, .bar-pct { font-family: var(--mono); }

/* ═══════════════════════════════════════════════════════════
   LAYOUT FIX — main / page must be a proper flex column so
   content never compresses and only .page scrolls, not .main
   ═══════════════════════════════════════════════════════════ */
.main {
    flex: 1 1 auto;
    min-width: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Scrollable Content Area — the ONLY thing that scrolls ── */
.main-content {
    flex: 1;
    min-height: 0;             /* THE fix: lets this shrink instead of expanding .main */
    overflow-y: auto;
    padding-right: 4px;
}

.main-content::-webkit-scrollbar { width: 4px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: var(--teal-dim); border-radius: 4px; }

/* ═══════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: relative;
    z-index: 10;
}

.sidebar-logo {
    padding: 1.25rem 1rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--teal-dim), #0f766e);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--glow-ring-soft);
}

.logo-mark svg { width: 14px; height: 14px; stroke: #fff; fill: none; stroke-width: 2.5; }

.logo-name { font-size: 12px; font-weight: 700; color: var(--text-1); letter-spacing: -0.01em; }
.logo-sub { font-size: 10px; color: var(--text-3); letter-spacing: 0.06em; text-transform: uppercase; font-weight: 500; }

.back-link {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    color: var(--text-3);
    text-decoration: none;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    transition: color var(--t-fast) var(--ease);
}
.back-link:hover { color: var(--text-2); }
.back-link svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2; }

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-3);
    padding: 0.5rem 0.5rem 0.25rem;
    margin-top: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-2);
    cursor: pointer;
    border: 1px solid transparent;
    transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
    user-select: none;
}
.nav-item svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }
.nav-item:hover { background: var(--surface-2); color: var(--text-1); }
.nav-item.active { background: var(--teal-bg); border-color: rgba(45,212,191,0.2); color: var(--teal); }
.nav-item.active svg { stroke: var(--teal); }

.nav-badge {
    margin-left: auto;
    font-size: 9px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(251,191,36,0.15);
    color: var(--amber);
}

.sidebar-footer { padding: 0.875rem 1rem; border-top: 1px solid var(--border); }

/* ── Theme switcher ── */
.theme-switcher { margin-bottom: 0.875rem; padding-bottom: 0.875rem; border-bottom: 1px solid var(--border); }

.theme-switcher-label {
    display: block;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-3);
    margin-bottom: 6px;
}

.theme-btn-group {
    display: flex;
    gap: 4px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 3px;
}

.theme-btn {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 4px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: calc(var(--radius) - 3px);
    cursor: pointer;
    transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
    font-size: 10px;
    color: var(--text-2);
}
.theme-btn:hover { background: var(--surface-3); color: var(--text-1); transform: translateY(-1px); }
.theme-btn.active { border-color: var(--teal); background: var(--teal-bg); color: var(--teal); box-shadow: var(--glow-ring-soft); }

.theme-btn.active {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
    transform: scale(1.1);
    box-shadow: 0 0 12px rgba(45, 212, 191, 0.3);
}

.theme-btn.active .tooltip {
    display: block;
}


.theme-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; box-shadow: 0 0 6px currentColor; }
.dot-dark  { background: #6b7cff; color: #6b7cff; }
.dot-green { background: #3ddc97; color: #3ddc97; }
.dot-light { background: #ffd166; color: #ffd166; }

.theme-btn .tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    border: 1px solid var(--border-mid);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 9px;
    color: var(--text-2);
    white-space: nowrap;
    z-index: 2;
}
.theme-btn:hover .tooltip { display: block; }

/* ── User row ── */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius);
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.su-av {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--teal), var(--teal-dim));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #06110e;
    flex-shrink: 0;
    box-shadow: var(--glow-ring-soft);
}

.su-name { font-size: 11px; font-weight: 600; color: var(--text-1); }
.su-role { font-size: 10px; color: var(--text-3); }

.su-btn {
    margin-left: auto;
    background: transparent;
    border: 1px solid var(--border-mid);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 10px;
    color: var(--text-3);
    cursor: pointer;
    transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.su-btn:hover { color: var(--red); border-color: rgba(248,113,113,0.35); }

/* ═══════════════════════════════════════════════════════════
   TOPBAR — keep everything on one line, no wrap on desktop
   ═══════════════════════════════════════════════════════════ */
.topbar {
    flex-shrink: 0;          /* topbar keeps its height, never gets squeezed by .page */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0.875rem 1.5rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: nowrap;
    overflow-x: auto;        /* if it ever truly can't fit, it scrolls sideways instead of wrapping */
    scrollbar-width: none;
}
.topbar::-webkit-scrollbar { display: none; }

.topbar-title {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-1);
    white-space: nowrap;
}
.topbar-title span:nth-child(2) { color: var(--text-3); }

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;       /* override the inline flex-wrap:wrap in your HTML */
    flex-shrink: 0;
}

/* Only the responsive breakpoint you already have should allow wrapping */
@media (max-width: 768px) {
    .topbar { flex-wrap: wrap; overflow-x: visible; }
    .topbar-actions { flex-wrap: wrap; }
}

/* ═══════════════════════════════════════════════════════════
   TB-BTN — give it real presence instead of a flat, borderless look
   ═══════════════════════════════════════════════════════════ */
.tb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius);
    color: var(--text-2);
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font);
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--t-fast) var(--ease),
                border-color var(--t-fast) var(--ease),
                color var(--t-fast) var(--ease),
                transform var(--t-fast) var(--ease),
                box-shadow var(--t-fast) var(--ease);
}
.tb-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    flex-shrink: 0;
}
.tb-btn:hover {
    background: var(--surface-3);
    border-color: var(--border-hi);
    color: var(--text-1);
    transform: translateY(-1px);
}
.tb-btn:active { transform: translateY(0) scale(0.97); }

.tb-btn.primary {
    background: linear-gradient(135deg, var(--teal-dim), #0f766e);
    border-color: transparent;
    color: #fff;
    box-shadow: var(--glow-ring-soft);
}
.tb-btn.primary:hover {
    opacity: 0.92;
    box-shadow: var(--glow-ring);
    transform: translateY(-1px);
}

/* Icon-only buttons (like your refresh button, no text) get a tighter square */
.tb-btn.icon-only {
    padding: 7px;
    width: 30px;
    height: 30px;
}

/* ── Stats Grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 1.5rem;
    flex-shrink: 0; /* Prevents stats from shrinking */
}

/* Single, authoritative .page definition — replaces both earlier ones */
.page {
    display: none;
    flex: 1 1 auto;
    min-height: 0;          /* THE key fix: lets a flex child actually shrink and scroll
                                instead of pushing the layout to fit its content */
    overflow-y: auto;
    padding: 1.75rem;
    padding-right: calc(1.75rem - 4px);
}
.page.active {
    display: flex;
    flex-direction: column;
}

/* ── Selector Wrappers (School, Term dropdowns) ── */
.selector-wrapper {
    position: relative;
    display: inline-block;
}

.selector-wrapper .selector-icon {
    position: absolute;
    right: 12px;                        /* ✅ 10 → 12 */
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.selector-wrapper select {
    background: var(--surface-2);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius);
    padding: 8px 34px 8px 14px;         /* ✅ 6/30/12 → 8/34/14 */
    font-size: 12px;                    /* ✅ 11 → 12 */
    font-family: var(--font);
    color: var(--text-1);
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    line-height: 1;
    min-height: 34px;                   /* ✅ consistent height with .tb-btn */
    transition:
        border-color var(--t-fast) var(--ease),
        background var(--t-fast) var(--ease);
}

.selector-wrapper select:hover {
    border-color: var(--border-hi);
    background: var(--surface-3);
}
.selector-wrapper select:focus {
    border-color: var(--teal);
    box-shadow: var(--glow-ring-soft);
}
.selector-wrapper select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.selector-wrapper select option {
    background: var(--surface);
    color: var(--text-1);
    padding: 8px;
}

/* ═══════════════════════════════════════════════════════════
   PAGES
   ═══════════════════════════════════════════════════════════ */
.page { display: none; flex: 1; padding: 1.75rem; }
.page.active { display: block; }
.page-title { font-size: 26px; font-weight: 700; color: var(--text-1); letter-spacing: -0.02em; line-height: 1.2; margin-bottom: 4px; }
.page-sub { font-size: 12px; color: var(--text-3); margin-bottom: 1.5rem; }

/* ── Stats ── */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 1.5rem; }
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.25rem;
    position: relative;
    overflow: hidden;
    transition: border-color var(--t-med) var(--ease), transform var(--t-med) var(--ease);
}
.stat-card:hover { border-color: var(--border-hi); transform: translateY(-2px); }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--accent-line, transparent); }
.stat-card.teal  { --accent-line: linear-gradient(90deg, var(--teal), transparent); }
.stat-card.green { --accent-line: linear-gradient(90deg, var(--green), transparent); }
.stat-card.amber { --accent-line: linear-gradient(90deg, var(--amber), transparent); }
.stat-card.red   { --accent-line: linear-gradient(90deg, var(--red), transparent); }
.stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); margin-bottom: 8px; font-weight: 500; }
.stat-value { font-size: 22px; font-weight: 500; color: var(--text-1); line-height: 1; }
.stat-meta { font-size: 10px; color: var(--text-3); margin-top: 5px; }
.stat-icon {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--icon-bg, rgba(255,255,255,0.04));
}
.stat-icon svg { width: 13px; height: 13px; stroke: var(--icon-color, var(--text-3)); fill: none; stroke-width: 2; }
.stat-card.teal .stat-icon  { background: var(--teal-bg);  --icon-color: var(--teal); }
.stat-card.green .stat-icon { background: var(--green-bg); --icon-color: var(--green); }
.stat-card.amber .stat-icon { background: var(--amber-bg); --icon-color: var(--amber); }
.stat-card.red .stat-icon   { background: var(--red-bg);   --icon-color: var(--red); }

/* ── Layout ── */
.grid-2 { display: grid; grid-template-columns: 1fr 380px; gap: 16px; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.card-header { padding: 0.875rem 1.1rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 12px; font-weight: 600; color: var(--text-1); display: flex; align-items: center; gap: 6px; }
.card-title svg { width: 13px; height: 13px; stroke: var(--teal); fill: none; stroke-width: 2; }
.card-hint { font-size: 10px; color: var(--text-3); }

/* ── Fee table ── */
.fee-table { width: 100%; border-collapse: collapse; }
.fee-table th { font-size: 9px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-3); padding: 0 1rem 0.625rem; text-align: left; }
.fee-table th:last-child { text-align: right; }
.fee-table td { font-size: 11.5px; color: var(--text-2); padding: 0.625rem 1rem; border-top: 1px solid var(--border); vertical-align: middle; }
.fee-table tbody tr { transition: background var(--t-fast) var(--ease); cursor: pointer; }
.fee-table tbody tr:hover { background: var(--surface-2); }
.fee-table tbody tr.selected { background: var(--teal-bg); }
.fee-table td.td-name { color: var(--text-1); font-weight: 500; }
.fee-table td.td-bal { text-align: right; font-size: 11px; }
.s-av { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; color: #fff; flex-shrink: 0; }
.pill { display: inline-flex; align-items: center; gap: 3px; font-size: 9px; font-weight: 600; padding: 2px 7px; border-radius: 999px; border: 1px solid transparent; }
.pill svg { width: 8px; height: 8px; stroke: currentColor; fill: none; stroke-width: 2.5; }
.pill-paid    { background: var(--green-bg); color: var(--green); border-color: rgba(74,222,128,0.2); }
.pill-partial { background: var(--amber-bg); color: var(--amber); border-color: rgba(251,191,36,0.2); }
.pill-unpaid  { background: var(--red-bg);   color: var(--red);   border-color: rgba(248,113,113,0.2); }

/* ── QR slip — the signature element: keep the scan line, quiet everything else ── */
.qr-panel { display: flex; flex-direction: column; gap: 12px; }
.slip-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.slip-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2.5rem 1rem; text-align: center; color: var(--text-3); }
.slip-empty-ring { width: 48px; height: 48px; border-radius: 50%; border: 1px dashed var(--border-mid); display: flex; align-items: center; justify-content: center; margin-bottom: 0.75rem; }
.slip-empty-ring svg { width: 18px; height: 18px; stroke: var(--text-3); fill: none; stroke-width: 1.5; }
.slip-head { display: flex; align-items: center; gap: 10px; padding: 1rem; border-bottom: 1px solid var(--border); }
.slip-av { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; }
.slip-sname { font-size: 13px; font-weight: 600; color: var(--text-1); }
.slip-smeta { font-size: 10px; color: var(--text-3); margin-top: 1px; }
.slip-amounts { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--border); }
.sc { padding: 0.75rem; text-align: center; border-right: 1px solid var(--border); }
.sc:last-child { border-right: none; }
.sc-label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); margin-bottom: 3px; }
.sc-value { font-size: 12px; font-weight: 500; }
.sc-value.total { color: var(--text-1); }
.sc-value.paid  { color: var(--green); }
.sc-value.owed  { color: var(--amber); }
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; padding: 1.25rem; }
.qr-frame {
    width: 164px;
    height: 164px;
    background: #fff;
    border-radius: var(--radius);
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    box-shadow: var(--glow-ring);
}
#qrcode canvas, #qrcode img { width: 144px !important; height: 144px !important; }
@keyframes scan { 0%,100% { top: 10px; } 50% { top: calc(100% - 12px); } }
.qr-scan {
    position: absolute;
    left: 10px;
    right: 10px;
    height: 1.5px;
    background: linear-gradient(90deg, transparent, var(--teal), transparent);
    animation: scan 2s var(--ease) infinite;
    pointer-events: none;
}
.qr-ref { font-size: 11px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border-mid); border-radius: 6px; padding: 4px 10px; letter-spacing: 0.04em; }
.qr-hint { font-size: 10px; color: var(--text-3); text-align: center; line-height: 1.5; max-width: 200px; }
.expiry-bar {
    margin: 0 1rem 0.875rem;
    padding: 6px 10px;
    background: var(--amber-bg);
    border: 1px solid rgba(251,191,36,0.15);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    color: var(--amber);
}
.expiry-bar svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }
.expiry-bar span { margin-left: auto; font-size: 11px; }
.slip-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 0 1rem 1rem; }
.sa-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px;
    border-radius: var(--radius);
    border: 1px solid var(--border-mid);
    background: var(--surface-2);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-2);
    cursor: pointer;
    transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.sa-btn svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2; }
.sa-btn:hover { background: var(--surface-3); color: var(--text-1); }
.sa-btn.send { background: linear-gradient(135deg, var(--teal-dim), #0f766e); border-color: transparent; color: #fff; }
.sa-btn.send:hover { opacity: 0.88; }

/* ── Students full page ── */
.search-wrap { flex: 1; position: relative; }
.search-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 13px; height: 13px; stroke: var(--text-3); fill: none; stroke-width: 2; pointer-events: none; }
.search-input {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius);
    padding: 7px 10px 7px 32px;
    font-size: 12px;
    color: var(--text-1);
    outline: none;
    transition: border-color var(--t-fast) var(--ease);
}
.search-input::placeholder { color: var(--text-3); }
.search-input:focus { border-color: rgba(45,212,191,0.35); }
.filter-select {
    background: var(--surface-2);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius);
    padding: 7px 10px;
    font-size: 11px;
    color: var(--text-2);
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
}
.filter-select option { background: var(--surface-2); }
.students-full-table { width: 100%; border-collapse: collapse; }
.students-full-table th { font-size: 9px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-3); padding: 0.5rem 1rem 0.625rem; text-align: left; border-bottom: 1px solid var(--border); }
.students-full-table td { font-size: 12px; color: var(--text-2); padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.students-full-table tbody tr { transition: background var(--t-fast) var(--ease); cursor: pointer; }
.students-full-table tbody tr:hover { background: var(--surface-2); }
.balance-bar-wrap { position: relative; height: 4px; background: var(--surface-3); border-radius: 2px; overflow: hidden; width: 80px; }
.balance-bar { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; transition: width var(--t-slow) var(--ease); }

/* ── Audit table ── */
.audit-table { width: 100%; border-collapse: collapse; }
.audit-table th { font-size: 9px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-3); padding: 0.5rem 1rem 0.625rem; text-align: left; border-bottom: 1px solid var(--border); }
.audit-table td { font-size: 11px; color: var(--text-2); padding: 0.625rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.audit-table td.mono { font-size: 10px; color: var(--teal); }
.dot-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 500; }ma
.dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.dot-green { background: var(--green); }
.dot-gray  { background: var(--text-3); }
.dot-amber { background: var(--amber); }

/* ── Forms ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field.full { grid-column: 1/-1; }
.form-field label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); font-weight: 600; }
.form-field label .req { color: var(--red); }
.form-field input, .form-field select, .form-field textarea {
    background: var(--surface-2);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius);
    padding: 9px 12px;
    font-size: 13px;
    font-family: var(--font);
    color: var(--text-1);
    outline: none;
    transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
    -webkit-appearance: none;
    width: 100%;
}
.form-field select { cursor: pointer; }
.form-field select option { background: var(--surface-2); }
.form-field input::placeholder, .form-field textarea::placeholder { color: var(--text-3); }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
    border-color: rgba(45,212,191,0.4);
    box-shadow: var(--glow-ring-soft);
}
.form-field textarea { resize: none; line-height: 1.6; }
.form-section-title {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-3);
    padding-bottom: 0.625rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.875rem;
}
.form-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px;
    border-radius: var(--radius);
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    background: linear-gradient(135deg, var(--teal-dim), #0f766e);
    color: #fff;
    margin-top: 4px;
    transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.form-submit:hover { opacity: 0.9; }
.form-submit:active { transform: scale(0.985); }
.form-submit svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2.5; }
.form-submit:disabled { opacity: 0.5; cursor: not-allowed; }
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 12px; margin-bottom: 1rem; display: flex; align-items: center; gap: 8px; }
.alert svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }
.alert-success { background: var(--green-bg); border: 1px solid rgba(74,222,128,0.2); color: var(--green); }
.alert-error   { background: var(--red-bg);   border: 1px solid rgba(248,113,113,0.2); color: var(--red); }

/* ── Payment modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;                         /* full viewport */
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;                    /* higher than sidebar + topbar */
    pointer-events: auto;             /* explicitly clickable */
    overscroll-behavior: contain;     /* prevent scroll chaining */
}

.modal-overlay.open,
.modal-overlay.show {
    display: flex;
}
.modal { background: var(--surface); border: 1px solid var(--border-mid); border-radius: var(--radius-lg); padding: 1.5rem; width: 440px; max-width: 90vw; box-shadow: var(--glow-ring-soft); }
.modal-title { font-size: 15px; font-weight: 600; color: var(--text-1); margin-bottom: 1rem; display: flex; align-items: center; justify-content: space-between; }
.modal-close { background: transparent; border: none; color: var(--text-3); cursor: pointer; font-size: 18px; line-height: 1; transition: color var(--t-fast) var(--ease); }
.modal-close:hover { color: var(--text-1); }

/* ── Collection summary ── */
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.bar-label { font-size: 11px; color: var(--text-3); width: 60px; }
.bar-track { flex: 1; height: 4px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 2px; transition: width var(--t-slow) var(--ease); }
.bar-pct { font-size: 10px; color: var(--text-3); width: 36px; text-align: right; }

/* ── Toast ── */
.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 200;
    background: var(--surface-2);
    border: 1px solid rgba(45,212,191,0.25);
    border-radius: var(--radius-lg);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-1);
    transform: translateY(120%);
    opacity: 0;
    transition: transform var(--t-slow) cubic-bezier(0.34,1.56,0.64,1), opacity var(--t-med) var(--ease);
    max-width: 280px;
    box-shadow: var(--glow-ring-soft);
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast-icon { width: 28px; height: 28px; border-radius: 50%; background: var(--teal-bg); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.toast-icon svg { width: 13px; height: 13px; stroke: var(--teal); fill: none; stroke-width: 2.5; }
.toast-icon.err { background: var(--red-bg); }
.toast-icon.err svg { stroke: var(--red); }
.toast-title { font-weight: 600; font-size: 12px; margin-bottom: 1px; }
.toast-body { font-size: 10px; color: var(--text-3); }

/* ── Selector wrapper ── */
.selector-wrapper { position: relative; display: inline-block; }
.selector-wrapper .selector-icon { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--text-3); }
.selector-wrapper select {
    background: var(--surface-2);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius);
    padding: 6px 30px 6px 12px;
    font-size: 11px;
    color: var(--text-1);
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.selector-wrapper select:hover { border-color: var(--border-hi); background: var(--surface-3); }
.selector-wrapper select:focus { border-color: var(--teal); box-shadow: var(--glow-ring-soft); }
.selector-wrapper select:disabled { opacity: 0.5; cursor: not-allowed; }
.selector-wrapper select option { background: var(--surface); color: var(--text-1); padding: 8px; }


/* ── School row clickable ── */
.school-row-clickable {
    cursor: pointer;
    transition: background 0.15s ease;
}

.school-row-clickable:hover {
    background: var(--surface-2) !important;
}

.school-row-clickable .click-hint {
    opacity: 0;
    transition: opacity 0.15s ease;
    font-size: 10px;
    color: var(--text-3);
}

.school-row-clickable:hover .click-hint {
    opacity: 1;
}


/* ── Checkbox Styles ── */
.form-field input[type="checkbox"] {
    accent-color: var(--teal);
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
}

.form-field label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.form-field label span {
    cursor: pointer;
}

/* Ensure checkbox is not hidden by any styles*/
input[type="checkbox"] {
    opacity: 1 !important;
    pointer-events: auto !important;
    visibility: visible !important;
    display: inline-block !important;
} 

/* ── School Details Modal Styles ── */
#schoolDetailsModal .modal {
    transition: all 0.3s ease;
}

#schoolDetailsModal .school-detail-tab {
    transition: all 0.2s ease;
}

#schoolDetailsModal .school-detail-tab:hover {
    background: var(--surface-2);
    color: var(--text-1);
}

#schoolDetailsModal .school-detail-tab.active {
    background: var(--teal-bg);
    color: var(--teal);
}

#schoolDetailsModal .school-detail-content {
    height: 100%;
    display: flex;
    flex-direction: column;
}

#schoolDetailsModal .students-full-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface);
}

/* Custom scrollbar for tables */
#schoolDetailsModal .school-detail-content::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

#schoolDetailsModal .school-detail-content::-webkit-scrollbar-track {
    background: var(--surface-2);
    border-radius: 3px;
}

#schoolDetailsModal .school-detail-content::-webkit-scrollbar-thumb {
    background: var(--border-mid);
    border-radius: 3px;
}

#schoolDetailsModal .school-detail-content::-webkit-scrollbar-thumb:hover {
    background: var(--border-hi);
}



/* ── Financial Tabs ── */
.fin-tab-content {
    display: none;
}

.fin-tab-content.active {
    display: block !important;
}

/* Ensure fee records tab content is visible */
#tab-fees .card,
#tab-fees .stats-grid,
#tab-fees .form-section-title {
    display: block;
}

/* Fix for table visibility */
#feeRecordsTable {
    width: 100%;
}

#feeRecordsTable tr {
    display: table-row;
}

#feeRecordsTable td {
    display: table-cell;
}




.search-wrap.nav-search--hud {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 12px 14px;
  padding: 6px 2px;
  border-bottom: 1px solid rgba(215, 251, 249, 0.15);
  transition: border-color 0.2s ease;
}

.search-wrap.nav-search--hud:focus-within {
  border-bottom-color: rgba(56, 224, 217, 0.6);
}

.search-wrap.nav-search--hud svg {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  stroke: rgba(215, 251, 249, 0.4);
  fill: none;
  stroke-width: 1.25;
  transition: stroke 0.2s ease;
}

.search-wrap.nav-search--hud:focus-within svg {
  stroke: rgba(56, 224, 217, 0.8);
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: #d7fbf9;
  font-family: inherit;
  font-size: 12px;
}

.search-input::placeholder {
  color: rgba(215, 251, 249, 0.3);
}


/* blinking cursor-style focus indicator */
.nav-search--hud:focus-within .nav-search-icon {
  animation: navPulse 1.2s ease-in-out infinite;
}
@keyframes navPulse {
  0%, 100% { opacity: 0.8; }
  50%      { opacity: 1; filter: drop-shadow(0 0 5px rgba(56,224,217,0.9)); }
}


/*New Modal Searchable CSS*/
/* Custom-styled native select */
.ss-select {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius);
    padding: 9px 36px 9px 12px;
    font-size: 13px;
    font-family: var(--font);
    color: var(--text-1);
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;

    /* custom chevron, replaces native arrow */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
}

.ss-select:hover {
    border-color: var(--text-3);
}

.ss-select:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px var(--teal-bg);
}

.ss-select option {
    background: var(--surface-2);
    color: var(--text-1);
    padding: 8px;
}

/* placeholder-style first option looks muted */
.ss-select:has(option:checked[value=""]) {
    color: var(--text-3);
}

/* ── Hide table during initial load ──────────────────────────── */
.table-loading {
    opacity: 0.3;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.table-loaded {
    opacity: 1;
    pointer-events: auto;
}

 
 
/* ── Admin All Schools Tab ── */
#allSchoolsSearch {
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#allSchoolsSearch:focus {
    border-color: rgba(45, 212, 191, 0.4);
    box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.1);
}

.user-tab[data-tab="schools"] {
    display: none;
}

.user-tab[data-tab="schools"].active {
    background: var(--teal-bg) !important;
    color: var(--teal) !important;
}

/* ── All Schools Table Actions ── */
#allSchoolsTableBody td:last-child button {
    opacity: 0.7;
    transition: opacity 0.15s ease;
}

#allSchoolsTableBody td:last-child button:hover {
    opacity: 1;
}

 /* ── All Schools Page ── */
#allSchoolsSearch {
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#allSchoolsSearch:focus {
    border-color: rgba(45, 212, 191, 0.4);
    box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.1);
}

#allSchoolsPageTableBody tr:hover {
    background: var(--surface-2);
}

#allSchoolsPageTableBody td:last-child button {
    opacity: 0.7;
    transition: opacity 0.15s ease;
}

#allSchoolsPageTableBody td:last-child button:hover {
    opacity: 1;
}

/* Pagination disabled state */
#allSchoolsPrevBtn:disabled,
#allSchoolsNextBtn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .topbar { flex-wrap: wrap; height: auto; padding: 0.5rem 1rem; gap: 0.5rem; }
    .topbar-title { width: 100%; font-size: 10px; }
    .topbar-actions { width: 100%; flex-wrap: wrap; gap: 4px; }
    .selector-wrapper select { min-width: 100px; font-size: 10px; padding: 4px 24px 4px 8px; }
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(2,1fr); }
    .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
    .sidebar { display: none; }
    .main { margin-left: 0; }
}


/* ═══════════════════════════════════════════════════════════════
   MOBILE SIDEBAR - Responsive Design
═══════════════════════════════════════════════════════════════ */

/* ── Mobile Menu Toggle Button ── */
.mobile-menu-toggle {
    display: none;
}

/* ── Mobile Sidebar Overlay ── */
#mobileOverlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#mobileOverlay.active {
    opacity: 1;
}

/* ── Sidebar Mobile Styles ── */
@media (max-width: 768px) {
    /* Show hamburger menu */
    .mobile-menu-toggle {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }
    
    /* Sidebar slides in from left */
    .sidebar {
        position: fixed !important;
        top: 0;
        left: 0;
        width: 300px !important;
        max-width: 85vw;
        height: 100vh !important;
        z-index: 9999 !important;
        transform: translateX(-110%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
        border-right: 1px solid var(--border);
    }
    
    /* Sidebar open state */
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    /* Show overlay when sidebar is open */
    #mobileOverlay.active {
        display: block !important;
        opacity: 1;
    }
    
    /* Topbar adjustments */
    .topbar {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
    }
    
    .topbar-title {
        display: flex;
        align-items: center;
        font-size: 15px;
    }
    
    .topbar-actions {
        flex-wrap: wrap;
        gap: 6px;
        margin-top: 4px;
    }
    
    .topbar-actions .selector-wrapper {
        flex: 1;
        min-width: 120px;
    }
    
    .topbar-actions .tb-btn {
        padding: 4px 10px;
        font-size: 10px;
    }
    
    /* Hide sidebar on mobile by default */
    .sidebar .sidebar-logo {
        padding: 1rem;
    }
    
    .sidebar .sidebar-nav {
        padding: 0.5rem 0;
    }
    
    .sidebar .nav-item {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .sidebar .nav-item svg {
        width: 18px;
        height: 18px;
    }
    
    .sidebar .sidebar-footer {
        padding: 1rem;
        border-top: 1px solid var(--border);
    }
    
    /* Close button inside sidebar for mobile */
    .sidebar-close-btn {
        display: flex !important;
        position: absolute;
        top: 12px;
        right: 12px;
        background: var(--surface-2);
        border: 1px solid var(--border-mid);
        border-radius: 50%;
        width: 32px;
        height: 32px;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        color: var(--text-2);
        font-size: 18px;
        transition: all 0.15s ease;
        z-index: 10;
    }
    
    .sidebar-close-btn:hover {
        background: var(--surface-3);
        color: var(--text-1);
    }
}

/* ── Sidebar Close Button (hidden on desktop) ── */
.sidebar-close-btn {
    display: none;
}

/* ── Mobile Sidebar Backdrop Blur ── */
@media (max-width: 768px) {
    .sidebar.mobile-open {
        box-shadow: 4px 0 40px rgba(0, 0, 0, 0.4);
    }
    
    #mobileOverlay.active {
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }
}

/* ── Prevent body scroll when sidebar is open ── */
body.sidebar-open {
    overflow: hidden !important;
}

/* ── Extra Small Screens ── */
@media (max-width: 480px) {
    .sidebar {
        width: 280px !important;
        max-width: 80vw;
    }
    
    .topbar-title {
        font-size: 13px;
    }
    
    .topbar-actions .selector-wrapper select {
        font-size: 10px;
        padding: 4px 24px 4px 8px;
        min-width: 100px;
    }
}

/* ═══════════════════════════════════════════════════════════
   FUTURISTIC ENHANCEMENTS
   Corner-bracket cards · animated grid backdrop · energy-field CTAs
   ═══════════════════════════════════════════════════════════ */

/* ── 1. Ambient background grid ──────────────────────────────
   Very low-opacity grid across the whole app shell. Sits behind
   everything since body itself is the flex container — this
   paints on body, so sidebar/main surfaces (which are opaque)
   naturally mask it except in any transparent gaps. */
body {
    background-image:
        linear-gradient(rgba(45, 212, 191, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(45, 212, 191, 0.035) 1px, transparent 1px);
    background-size: 34px 34px;
    background-position: -1px -1px;
}
[data-theme="light"] body {
    background-image:
        linear-gradient(rgba(13, 148, 136, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(13, 148, 136, 0.05) 1px, transparent 1px);
}

/* ── 2. Corner-bracket cards ──────────────────────────────────
   Replaces the idea of a "box" with a targeting-reticle read.
   Applied to .card and .slip-card via pseudo-elements; .stat-card
   already uses ::before for its top accent line, so it gets its
   corner marks via background-image layers instead, to avoid
   any collision with that rule. */
.card,
.stat-card,
.slip-card {
    position: relative;
}

.card::before,
.card::after,
.slip-card::before,
.slip-card::after {
    content: '';
    position: absolute;
    width: 9px;
    height: 9px;
    border: 1px solid var(--teal);
    opacity: 0.45;
    pointer-events: none;
    transition: opacity var(--t-med) var(--ease);
    z-index: 1;
}
.card::before,
.slip-card::before {
    top: -1px;
    left: -1px;
    border-right: none;
    border-bottom: none;
    border-top-left-radius: 3px;
}
.card::after,
.slip-card::after {
    bottom: -1px;
    right: -1px;
    border-left: none;
    border-top: none;
    border-bottom-right-radius: 3px;
}
.card:hover::before,
.card:hover::after,
.slip-card:hover::before,
.slip-card:hover::after {
    opacity: 0.9;
}

.stat-card {
    background-image:
        linear-gradient(var(--teal), var(--teal)),
        linear-gradient(var(--teal), var(--teal)),
        linear-gradient(var(--teal), var(--teal)),
        linear-gradient(var(--teal), var(--teal));
    background-repeat: no-repeat;
    background-size: 8px 1px, 1px 8px, 8px 1px, 1px 8px;
    background-position:
        top 0 left 0,
        top 0 left 0,
        bottom 0 right 0,
        bottom 0 right 0;
}

/* ── 3. Animated energy-field border on primary CTAs ─────────
   Applies to the main submit button and the "send" slip action.
   Uses a rotating conic gradient masked to a 1px ring. Falls
   back gracefully (no @property support = static ring, still fine). */
@property --angle {
    syntax: '<angle>';
    inherits: false;
    initial-value: 0deg;
}

.form-submit,
.sa-btn.send {
    position: relative;
    z-index: 0;
    isolation: isolate;
    overflow: visible;
}

.form-submit::after,
.sa-btn.send::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: conic-gradient(from var(--angle, 0deg),
        var(--teal) 0deg,
        transparent 100deg,
        transparent 260deg,
        var(--teal) 360deg);
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: rotate-energy-ring 2.6s linear infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes rotate-energy-ring {
    to { --angle: 360deg; }
}

@media (prefers-reduced-motion: reduce) {
    .form-submit::after,
    .sa-btn.send::after {
        animation: none;
    }
}

/* ── 4. Nav active item — signal indicator instead of flat fill ─ */
.nav-item {
    position: relative;
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 58%;
    background: var(--teal);
    border-radius: 2px;
    box-shadow: 0 0 8px var(--teal), 0 0 2px var(--teal);
}

/* ── 5. Mono data — subtle tracking + reserved glow for primary metric ─
   Keep this OFF by default; add class="stat-value--primary" to the one
   number per card you want to emphasize (e.g. total balance, not every
   stat) so the glow stays a signal, not noise. */
.stat-value,
.sc-value,
.qr-ref {
    letter-spacing: 0.02em;
}
.stat-value--primary,
.sc-value--primary {
    text-shadow: 0 0 10px var(--teal-glow);
}

/* ── 6. Optional: brief glitch-in flicker for values that just updated ─
   Toggle the "updated" class via JS for one animation cycle after a
   stat/value refresh (e.g. after a payment posts). */
@keyframes glitch-in {
    0%   { opacity: 0; transform: translateX(-2px); filter: hue-rotate(15deg); }
    60%  { opacity: 1; transform: translateX(1px); }
    100% { opacity: 1; transform: translateX(0); filter: none; }
}
.updated {
    animation: glitch-in 220ms steps(4) both;
}

.assignments-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    padding: 1rem;
}

@media (max-width: 800px) {
    .assignments-grid {
        grid-template-columns: 1fr;
    }
}
 