/* ==========================================================================
   Winners Exams — design system
   Palette follows the school portal (teal) + logo accents (gold / sky ribbon)
   ========================================================================== */
/* Fonts served from this site (SIL Open Font License, see assets/fonts/OFL-*.txt).
   Variable fonts: one file per character set covers every weight. */
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-weight: 400 700; font-display: swap;
    src: url('../fonts/plus-jakarta-sans-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-weight: 400 700; font-display: swap;
    src: url('../fonts/plus-jakarta-sans-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Outfit'; font-style: normal; font-weight: 600 700; font-display: swap;
    src: url('../fonts/outfit-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Outfit'; font-style: normal; font-weight: 600 700; font-display: swap;
    src: url('../fonts/outfit-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
    --brand-50: #f0fdfa;
    --brand-100: #ccfbf1;
    --brand-200: #99f6e4;
    --brand-300: #5eead4;
    --brand-500: #14b8a6;
    --brand-600: #0d9488;
    --brand-700: #0f766e;
    --brand-800: #115e59;
    --brand-900: #134e4a;
    --gold-50: #fffbeb;
    --gold-100: #fef3c7;
    --gold-400: #fbbf24;
    --gold-500: #f5b400;
    --gold-700: #b45309;
    --sky-100: #e0f2fe;
    --sky-500: #0ea5e9;
    --sky-700: #0369a1;

    --slate-25: #fbfcfd;
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-150: #eaeff5;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;

    --red-50: #fef2f2;
    --red-100: #fee2e2;
    --red-600: #dc2626;
    --red-700: #b91c1c;
    --amber-50: #fffbeb;
    --amber-100: #fef3c7;
    --amber-700: #b45309;
    --green-50: #f0fdf4;
    --green-100: #dcfce7;
    --green-700: #15803d;
    --blue-50: #eff6ff;
    --blue-100: #dbeafe;
    --blue-700: #1d4ed8;
    --violet-100: #ede9fe;
    --violet-700: #6d28d9;

    --bg: #f4f7f9;
    --surface: #ffffff;
    --text: var(--slate-900);
    --muted: var(--slate-500);
    --border: var(--slate-200);
    --ring: 0 0 0 3px rgba(13, 148, 136, .18);

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow: 0 4px 12px -2px rgba(15, 23, 42, .08), 0 2px 4px -2px rgba(15, 23, 42, .05);
    --shadow-lg: 0 24px 48px -12px rgba(15, 23, 42, .22);

    --sidebar-w: 268px;
    --topbar-h: 64px;
    --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-display: "Outfit", "Plus Jakarta Sans", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: #f4f7f9; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-700); text-decoration: none; }
a:hover { color: var(--brand-800); }
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--ring); }

.icon { width: 18px; height: 18px; flex-shrink: 0; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }
.icon-xl { width: 28px; height: 28px; }

/* ------------------------------------------------------------------ Layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40;
    width: var(--sidebar-w);
    display: flex; flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--border);
    transition: transform .25s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    height: 72px; padding: 0 20px;
    border-bottom: 1px solid var(--slate-100);
}
.sidebar-brand img { width: 42px; height: 42px; object-fit: contain; }
.sidebar-brand .brand-name { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--slate-900); line-height: 1.15; }
.sidebar-brand .brand-sub { font-size: 11.5px; color: var(--muted); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 12px 20px; scrollbar-width: thin; }
.nav-section { margin-top: 18px; }
.nav-section:first-child { margin-top: 0; }
.nav-label {
    padding: 0 12px 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: var(--slate-400);
}
.nav-link {
    position: relative;
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px; margin: 1px 0;
    border-radius: 10px;
    color: var(--slate-600); font-weight: 500;
    transition: background .15s, color .15s;
}
.nav-link .icon { color: var(--slate-400); transition: color .15s; }
.nav-link:hover { background: var(--slate-50); color: var(--slate-900); }
.nav-link:hover .icon { color: var(--slate-600); }
.nav-link.active { background: var(--brand-50); color: var(--brand-800); font-weight: 600; }
.nav-link.active .icon { color: var(--brand-600); }
.nav-link.active::before {
    content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px;
    border-radius: 0 3px 3px 0; background: var(--brand-600);
}
.nav-link .nav-badge { margin-left: auto; }
.sidebar-footer { padding: 14px 16px; border-top: 1px solid var(--slate-100); }
.year-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 12px;
    background: linear-gradient(135deg, var(--brand-50), #fff);
    border: 1px solid var(--brand-100);
    font-size: 12.5px; color: var(--brand-800);
}
.year-chip strong { display: block; font-size: 13px; color: var(--brand-900); }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 30;
    height: var(--topbar-h);
    display: flex; align-items: center; gap: 14px;
    padding: 0 28px;
    background: rgba(255, 255, 255, .86);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border);
}
.topbar-title { min-width: 0; }
.topbar-title h1 { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breadcrumbs { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--brand-700); }
.breadcrumbs .icon { width: 12px; height: 12px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar .menu-toggle { display: none; }
.user-menu-btn {
    display: flex; align-items: center; gap: 10px;
    padding: 5px 10px 5px 5px; border-radius: 999px;
    border: 1px solid var(--border); background: #fff; cursor: pointer;
    font: inherit; color: inherit;
}
.user-menu-btn:hover { background: var(--slate-50); }
.user-menu-btn .who { text-align: left; line-height: 1.2; }
.user-menu-btn .who strong { display: block; font-size: 13px; }
.user-menu-btn .who span { font-size: 11.5px; color: var(--muted); }

.content { padding: 26px 28px 40px; flex: 1; }
.page-header {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    margin-bottom: 20px;
}
.page-header h2 { font-size: 22px; font-weight: 700; }
.page-header p { color: var(--muted); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.sidebar-backdrop { display: none; }

/* ------------------------------------------------------------------ Avatar */
.avatar {
    width: 34px; height: 34px; border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    font-size: 12.5px; font-weight: 700; letter-spacing: .02em;
    background: var(--brand-100); color: var(--brand-800);
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }
.avatar.f { background: #fce7f3; color: #9d174d; }
.avatar.m { background: var(--sky-100); color: var(--sky-700); }

/* ------------------------------------------------------------------ Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 38px; padding: 0 15px;
    border-radius: 10px; border: 1px solid transparent;
    font: inherit; font-weight: 600; font-size: 13.5px; line-height: 1;
    cursor: pointer; white-space: nowrap; user-select: none;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.is-loading { opacity: .65; cursor: not-allowed; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--brand-600); color: #fff; box-shadow: 0 1px 2px rgba(13, 148, 136, .35), inset 0 1px 0 rgba(255,255,255,.12); }
.btn-primary:hover { background: var(--brand-700); color: #fff; }
.btn-secondary { background: #fff; color: var(--slate-700); border-color: var(--slate-200); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--slate-50); border-color: var(--slate-300); color: var(--slate-900); }
.btn-ghost { background: transparent; color: var(--slate-600); }
.btn-ghost:hover { background: var(--slate-100); color: var(--slate-900); }
.btn-danger { background: var(--red-600); color: #fff; }
.btn-danger:hover { background: var(--red-700); color: #fff; }
.btn-soft { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
.btn-soft:hover { background: var(--brand-100); color: var(--brand-800); }
.btn-gold { background: var(--gold-500); color: #3b2800; }
.btn-gold:hover { background: #e3a700; color: #2a1d00; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 14.5px; }
.btn-icon { width: 34px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn-block { width: 100%; }
.btn .spinner { width: 15px; height: 15px; border-width: 2px; }

.spinner {
    display: inline-block; width: 18px; height: 18px;
    border: 2.5px solid currentColor; border-right-color: transparent;
    border-radius: 999px; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}
.card-header {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 16px 20px; border-bottom: 1px solid var(--slate-100);
}
.card-header h3 { font-size: 15.5px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.card-header h3 .icon { color: var(--brand-600); }
.card-header p { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--slate-100); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card + .card { margin-top: 20px; }
.grid > .card + .card { margin-top: 0; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-sidebar { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.stack > * + * { margin-top: 20px; }

/* ------------------------------------------------------------------ Stats */
.stat {
    position: relative; overflow: hidden;
    padding: 18px 20px;
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.stat-icon {
    width: 40px; height: 40px; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand-50); color: var(--brand-600);
}
.stat-icon.gold { background: var(--gold-50); color: var(--gold-700); }
.stat-icon.sky { background: var(--sky-100); color: var(--sky-700); }
.stat-icon.violet { background: var(--violet-100); color: var(--violet-700); }
.stat-value { font-family: var(--font-display); font-size: 28px; font-weight: 700; margin-top: 8px; letter-spacing: -.02em; }
.stat-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.hero {
    position: relative; overflow: hidden;
    border-radius: 20px; padding: 26px 28px;
    color: #fff;
    background: linear-gradient(120deg, var(--brand-700) 0%, var(--brand-600) 55%, #14a89a 100%);
    box-shadow: 0 12px 30px -12px rgba(13, 148, 136, .55);
}
.hero::after {
    content: ""; position: absolute; right: -60px; top: -80px; width: 280px; height: 280px;
    background: radial-gradient(circle, rgba(245, 180, 0, .35), transparent 65%);
}
.hero h2 { font-size: 23px; font-weight: 700; }
.hero p { opacity: .88; margin-top: 6px; max-width: 620px; }
.hero .hero-actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero .btn-secondary { border: 0; }
.hero-logo { position: absolute; right: 28px; top: 50%; transform: translateY(-50%); width: 110px; opacity: .95; z-index: 1; filter: drop-shadow(0 8px 16px rgba(0,0,0,.2)); }

/* ------------------------------------------------------------------ Badges */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 9px; border-radius: 999px;
    font-size: 11.5px; font-weight: 600; line-height: 1.6; white-space: nowrap;
    background: var(--slate-100); color: var(--slate-600);
}
.badge-success { background: var(--green-100); color: var(--green-700); }
.badge-warning { background: var(--amber-100); color: var(--amber-700); }
.badge-danger { background: var(--red-100); color: var(--red-700); }
.badge-info { background: var(--blue-100); color: var(--blue-700); }
.badge-brand { background: var(--brand-100); color: var(--brand-800); }
.badge-gold { background: var(--gold-100); color: var(--gold-700); }
.badge-muted { background: var(--slate-100); color: var(--slate-500); }
.badge-violet { background: var(--violet-100); color: var(--violet-700); }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.grade-pill { display: inline-flex; min-width: 26px; justify-content: center; padding: 1px 7px; border-radius: 6px; font-weight: 700; font-size: 12px; }
.grade-A { background: var(--green-100); color: var(--green-700); }
.grade-B { background: var(--brand-100); color: var(--brand-800); }
.grade-C { background: var(--blue-100); color: var(--blue-700); }
.grade-D { background: var(--amber-100); color: var(--amber-700); }
.grade-E, .grade-F { background: var(--red-100); color: var(--red-700); }

/* ------------------------------------------------------------------ Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th {
    position: sticky; top: 0; z-index: 1;
    padding: 11px 14px; text-align: left;
    font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    color: var(--slate-500); background: var(--slate-50);
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table th a { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.table th a:hover { color: var(--brand-700); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--slate-100); vertical-align: middle; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--slate-25); }
.table tbody tr.is-selected { background: var(--brand-50); }
.table tr:last-child td { border-bottom: 0; }
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .center, .table th.center { text-align: center; }
.table th.text-right, .table td.text-right { text-align: right; }
.table th.text-center, .table td.text-center { text-align: center; }
.table-compact td { padding: 8px 12px; }
.table .cell-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.table .cell-title { font-weight: 600; color: var(--slate-900); }
.table .cell-sub { font-size: 12px; color: var(--muted); }
.table .actions { display: flex; justify-content: flex-end; gap: 4px; white-space: nowrap; }
.table td:has(> .actions) { width: 1%; white-space: nowrap; }
.table .col-check { width: 44px; }
.row-muted td { color: var(--slate-400); }

/* ------------------------------------------------------------------ Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-2, .form-grid .full { grid-column: 1 / -1; }
.form-section { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--brand-700); }
.form-section::after { content: ""; flex: 1; height: 1px; background: var(--slate-150); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 12.5px; font-weight: 600; color: var(--slate-700); }
.label .req { color: var(--red-600); margin-left: 2px; }
.input, .select, .textarea {
    width: 100%; height: 40px; padding: 0 12px;
    font: inherit; font-size: 13.5px; color: var(--text);
    background: var(--slate-50);
    border: 1px solid var(--slate-200); border-radius: 10px;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.55; }
.select {
    appearance: none; padding-right: 34px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
}
select[multiple].select { height: auto; min-height: 120px; padding: 6px; background-image: none; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--slate-300); }
.input:focus, .select:focus, .textarea:focus { outline: none; background: #fff; border-color: var(--brand-500); box-shadow: var(--ring); }
.input::placeholder, .textarea::placeholder { color: var(--slate-400); }
.input:disabled, .select:disabled { opacity: .6; cursor: not-allowed; }
.input[type="color"] { padding: 4px; width: 56px; cursor: pointer; }
.input-sm, .select-sm { height: 34px; font-size: 13px; border-radius: 8px; }
.is-invalid, .is-invalid:focus { border-color: var(--red-600) !important; background: var(--red-50) !important; box-shadow: 0 0 0 3px rgba(220, 38, 38, .12) !important; }
.field-error { font-size: 12px; color: var(--red-600); font-weight: 500; display: flex; align-items: center; gap: 5px; }
.field-error .icon { width: 13px; height: 13px; }
.help { font-size: 12px; color: var(--muted); }
.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--slate-400); pointer-events: none; width: 16px; height: 16px; }
.input-icon .input { padding-left: 36px; }
.input-icon .input-action { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.input-group { display: flex; }
.input-group .input { border-radius: 10px 0 0 10px; }
.input-group .btn { border-radius: 0 10px 10px 0; height: 40px; }

.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13.5px; user-select: none; }
.check input[type="checkbox"], .check input[type="radio"], input.cb {
    width: 17px; height: 17px; margin: 0; accent-color: var(--brand-600); cursor: pointer; flex-shrink: 0;
}
.check-card {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
    cursor: pointer; transition: border-color .15s, background .15s;
}
.check-card:hover { border-color: var(--brand-300); }
.check-card:has(input:checked) { border-color: var(--brand-500); background: var(--brand-50); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 38px; height: 22px; border-radius: 99px; background: var(--slate-300); position: relative; transition: background .2s; flex-shrink: 0; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 99px; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s; }
.switch input:checked + .track { background: var(--brand-600); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }

/* ------------------------------------------------------------------ Toolbar / filters */
.toolbar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 14px 16px; border-bottom: 1px solid var(--slate-100);
}
.toolbar .search { flex: 1 1 260px; max-width: 380px; }
.toolbar .select, .toolbar .input { height: 38px; background-color: #fff; }
.toolbar .select { width: auto; min-width: 140px; }
.toolbar .spacer { flex: 1; }
.filter-count { font-size: 12.5px; color: var(--muted); }
.bulk-bar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 10px 16px; background: var(--brand-50); border-bottom: 1px solid var(--brand-100);
    font-size: 13px; color: var(--brand-900);
}
.bulk-bar strong { font-weight: 700; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 999px;
    background: var(--slate-100); color: var(--slate-700);
    font-size: 12px; font-weight: 600;
}
.chip a { color: var(--slate-400); display: inline-flex; }
.chip a:hover { color: var(--red-600); }
.chip .icon { width: 12px; height: 12px; }

/* Segmented tabs (page level) */
.tabs {
    display: flex; gap: 4px; padding: 4px;
    background: var(--slate-100); border-radius: 12px;
    width: max-content; max-width: 100%; overflow-x: auto;
    margin-bottom: 20px;
}
.tab {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 14px; border-radius: 9px; border: 0; background: transparent;
    font: inherit; font-size: 13.5px; font-weight: 600; color: var(--slate-600);
    cursor: pointer; white-space: nowrap;
}
.tab .icon { width: 16px; height: 16px; }
.tab:hover { color: var(--slate-900); }
.tab.active { background: #fff; color: var(--brand-800); box-shadow: var(--shadow-sm); }
.tab .count { font-size: 11px; padding: 0 7px; border-radius: 99px; background: var(--slate-200); color: var(--slate-600); }
.tab.active .count { background: var(--brand-100); color: var(--brand-800); }

/* ------------------------------------------------------------------ Pagination */
.pagination { display: flex; align-items: center; gap: 4px; }
.pagination a, .pagination span {
    min-width: 32px; height: 32px; padding: 0 8px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--slate-600);
}
.pagination a:hover { background: var(--slate-100); color: var(--slate-900); }
.pagination .current { background: var(--brand-600); color: #fff; }
.pagination .disabled { color: var(--slate-300); }

/* ------------------------------------------------------------------ Empty state */
.empty {
    text-align: center; padding: 48px 24px; color: var(--muted);
}
.empty .empty-icon {
    width: 56px; height: 56px; margin: 0 auto 14px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 16px; background: var(--slate-100); color: var(--slate-400);
}
.empty h4 { font-size: 15.5px; color: var(--slate-800); margin-bottom: 4px; }
.empty .btn { margin-top: 16px; }

/* ------------------------------------------------------------------ Alerts */
.alert {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 12px 14px; border-radius: 12px;
    border: 1px solid var(--blue-100); background: var(--blue-50); color: var(--blue-700);
    font-size: 13px;
}
.alert .icon { margin-top: 1px; }
.alert-warning { border-color: var(--amber-100); background: var(--amber-50); color: var(--amber-700); }
.alert-danger { border-color: var(--red-100); background: var(--red-50); color: var(--red-700); }
.alert-success { border-color: var(--green-100); background: var(--green-50); color: var(--green-700); }
.alert-brand { border-color: var(--brand-100); background: var(--brand-50); color: var(--brand-800); }
.alert strong { font-weight: 700; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }

/* ------------------------------------------------------------------ Progress */
.progress { height: 8px; border-radius: 99px; background: var(--slate-100); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: var(--brand-500); transition: width .3s; }
.progress.gold > span { background: var(--gold-500); }
.progress-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 5px; }

/* Horizontal bar list (dashboard) */
.bars { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 92px 1fr 40px; align-items: center; gap: 12px; font-size: 13px; }
.bar-row .bar-name { font-weight: 600; color: var(--slate-700); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .bar-track { height: 12px; border-radius: 4px; background: var(--slate-100); overflow: hidden; display: flex; gap: 2px; }
.bar-row .bar-track span { display: block; height: 100%; border-radius: 4px; min-width: 2px; }
.bar-row .bar-f { background: #db2777; }
.bar-row .bar-m { background: #0284c7; }
.bar-row .bar-val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ------------------------------------------------------------------ Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--slate-100); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; }
.list-item .sub { font-size: 12px; color: var(--muted); }
.icon-tile {
    width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand-50); color: var(--brand-600);
}
.icon-tile.gold { background: var(--gold-50); color: var(--gold-700); }
.icon-tile.sky { background: var(--sky-100); color: var(--sky-700); }
.icon-tile.violet { background: var(--violet-100); color: var(--violet-700); }
.icon-tile.slate { background: var(--slate-100); color: var(--slate-600); }

.dl { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; font-size: 13.5px; }
.dl dt { color: var(--muted); font-weight: 500; }
.dl dd { margin: 0; font-weight: 600; color: var(--slate-800); }

/* ------------------------------------------------------------------ Dropdown */
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 50;
    min-width: 200px; padding: 6px;
    background: #fff; border: 1px solid var(--border); border-radius: 12px;
    box-shadow: var(--shadow-lg);
    opacity: 0; visibility: hidden; transform: translateY(-4px);
    transition: opacity .15s, transform .15s, visibility .15s;
}
.dropdown.open .dropdown-menu { opacity: 1; visibility: visible; transform: none; }
.dropdown-menu.up { top: auto; bottom: calc(100% + 6px); }
.dropdown-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 8px 10px; border-radius: 8px; border: 0; background: none;
    font: inherit; font-size: 13.5px; color: var(--slate-700); text-align: left; cursor: pointer;
}
.dropdown-item .icon { width: 16px; height: 16px; color: var(--slate-400); }
.dropdown-item:hover { background: var(--slate-50); color: var(--slate-900); }
.dropdown-item.danger { color: var(--red-600); }
.dropdown-item.danger .icon { color: var(--red-600); }
.dropdown-item.danger:hover { background: var(--red-50); }
.dropdown-divider { height: 1px; background: var(--slate-100); margin: 5px 0; }
.dropdown-header { padding: 8px 10px 6px; font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------------ Modal */
.modal-root { position: fixed; inset: 0; z-index: 100; display: none; }
.modal-root.open { display: block; }
.modal-backdrop {
    position: absolute; inset: 0; background: rgba(15, 23, 42, .5);
    backdrop-filter: blur(3px); opacity: 0; transition: opacity .2s;
}
.modal-root.open .modal-backdrop { opacity: 1; }
.modal-scroller { position: absolute; inset: 0; overflow-y: auto; display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; }
.modal-panel {
    position: relative; width: 100%; max-width: 560px;
    background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg);
    transform: translateY(12px) scale(.98); opacity: 0;
    transition: transform .22s cubic-bezier(.2, .8, .2, 1), opacity .2s;
}
.modal-root.open .modal-panel { transform: none; opacity: 1; }
.modal-panel.modal-sm { max-width: 420px; }
.modal-panel.modal-lg { max-width: 760px; }
.modal-panel.modal-xl { max-width: 1040px; }
.modal-header { display: flex; align-items: flex-start; gap: 14px; padding: 20px 22px 16px; border-bottom: 1px solid var(--slate-100); }
.modal-header .icon-tile { width: 42px; height: 42px; border-radius: 12px; }
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-header p { font-size: 13px; color: var(--muted); margin-top: 3px; }
.modal-close { margin-left: auto; margin-top: -2px; }
.modal-body { padding: 20px 22px; }
.modal-footer {
    display: flex; align-items: center; justify-content: flex-end; gap: 10px;
    padding: 14px 22px; border-top: 1px solid var(--slate-100);
    background: var(--slate-25); border-radius: 0 0 18px 18px;
}
.modal-footer .left { margin-right: auto; }
.modal-loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 60px; color: var(--muted); }
.confirm-body { text-align: center; padding: 28px 26px 10px; }
.confirm-body .confirm-icon {
    width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 99px;
    display: flex; align-items: center; justify-content: center;
    background: var(--red-100); color: var(--red-600);
}
.confirm-body .confirm-icon.brand { background: var(--brand-100); color: var(--brand-700); }
.confirm-body h3 { font-size: 17px; margin-bottom: 6px; }
.confirm-body p { color: var(--muted); }
body.modal-open { overflow: hidden; }

/* ------------------------------------------------------------------ Toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: min(400px, calc(100vw - 40px)); }
.toast {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 13px 14px; border-radius: 14px;
    background: var(--slate-900); color: #fff; box-shadow: var(--shadow-lg);
    font-size: 13.5px; animation: toast-in .25s cubic-bezier(.2, .8, .2, 1);
}
.toast .icon { margin-top: 1px; }
.toast.success .icon { color: #4ade80; }
.toast.error .icon { color: #f87171; }
.toast.warning .icon { color: var(--gold-400); }
.toast.info .icon { color: #60a5fa; }
.toast .toast-close { margin-left: auto; background: none; border: 0; color: var(--slate-400); cursor: pointer; padding: 0; }
.toast.leaving { animation: toast-out .2s forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }

/* ------------------------------------------------------------------ Marks entry grid */
.marks-table td, .marks-table th { padding: 7px 10px; }
.marks-table .score-input {
    width: 76px; height: 34px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums;
    border: 1px solid var(--slate-200); border-radius: 8px; background: #fff; font: inherit; font-weight: 600;
}
.marks-table .score-input:focus { outline: none; border-color: var(--brand-500); box-shadow: var(--ring); }
.marks-table .score-input.dirty { background: var(--gold-50); border-color: var(--gold-400); }
.marks-table .score-input.saved { background: var(--green-50); border-color: #86efac; }
.marks-table .score-input.absent { background: var(--slate-100); color: var(--slate-500); }
.marks-table .score-input.is-invalid { background: var(--red-50); }
.marks-table tbody tr:focus-within { background: var(--brand-50); }
.marks-grid-wrap { max-height: calc(100vh - 290px); overflow: auto; }
.marks-grid-wrap .table th { top: 0; }
.sticky-col { position: sticky; left: 0; background: #fff; z-index: 2; }
.marks-table .sticky-col { min-width: 210px; box-shadow: 1px 0 0 var(--slate-100); }
.marks-table .sticky-col .cell-title { white-space: nowrap; }
.table th.sticky-col { z-index: 3; background: var(--slate-50); }
.save-status { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.save-status.dirty { color: var(--amber-700); }
.save-status.ok { color: var(--green-700); }
.rating-select { height: 32px; min-width: 64px; padding: 0 26px 0 8px; font-size: 13px; border-radius: 8px; background-position: right 6px center; }

/* ------------------------------------------------------------------ Misc */
.text-muted { color: var(--muted); }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11.5px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.nowrap { white-space: nowrap; }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mt-4 { margin-top: 24px; }
.mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-1 { gap: 6px; } .gap-2 { gap: 10px; } .gap-3 { gap: 16px; } .wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
.divider { height: 1px; background: var(--slate-100); margin: 18px 0; }
.kbd { display: inline-block; padding: 1px 6px; border: 1px solid var(--slate-200); border-bottom-width: 2px; border-radius: 5px; font-size: 11px; font-family: ui-monospace, monospace; background: #fff; color: var(--slate-600); }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--slate-100); padding: 1px 6px; border-radius: 5px; }
.dropzone {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    padding: 28px 18px; text-align: center;
    border: 2px dashed var(--slate-300); border-radius: 14px; background: var(--slate-50);
    cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand-500); background: var(--brand-50); }
.dropzone .icon-tile { width: 48px; height: 48px; }
.dropzone input[type=file] { display: none; }
.dropzone .file-name { font-weight: 600; color: var(--brand-800); }
.steps { display: flex; gap: 8px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.step b { width: 22px; height: 22px; border-radius: 99px; background: var(--slate-100); color: var(--slate-600); display: inline-flex; align-items: center; justify-content: center; font-size: 11.5px; }
.step.done b { background: var(--brand-600); color: #fff; }
.color-row { display: flex; align-items: center; gap: 10px; }
.color-row .input[type=text] { flex: 1; }
.scroll-y { max-height: 360px; overflow-y: auto; }

/* ------------------------------------------------------------------ Auth pages */
.auth-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
    background: linear-gradient(135deg, #e3f3f1 0%, #f8fafc 55%, #fbf5e3 100%);
}
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 22px; box-shadow: 0 30px 60px -20px rgba(15, 23, 42, .25); overflow: hidden; }
.auth-head {
    position: relative; text-align: center; padding: 30px 28px 26px; color: #fff;
    background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
}
.auth-head::after { content: ""; position: absolute; left: -40px; bottom: -90px; width: 220px; height: 220px; background: radial-gradient(circle, rgba(245, 180, 0, .3), transparent 65%); }
.auth-logo { width: 88px; height: 88px; margin: 0 auto 12px; padding: 8px; border-radius: 22px; background: rgba(255, 255, 255, .96); box-shadow: 0 10px 25px -8px rgba(0,0,0,.35); position: relative; z-index: 1; }
.auth-logo img { width: 100%; height: 100%; object-fit: contain; }
.auth-head h1 { font-size: 21px; font-weight: 700; position: relative; z-index: 1; }
.auth-head p { font-size: 13px; opacity: .85; margin-top: 4px; font-style: italic; position: relative; z-index: 1; }
.auth-body-inner { padding: 26px 28px 28px; }
.auth-body-inner h2 { font-size: 16px; font-weight: 700; }
.auth-body-inner .sub { color: var(--muted); font-size: 13px; margin: 4px 0 20px; }
.auth-foot { text-align: center; font-size: 12px; color: var(--slate-400); margin-top: 18px; }

/* Login page: one plain, centred form */
.auth-body.login-page { background: var(--bg); }
.login-wrap { width: 100%; max-width: 400px; }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-logo { width: 76px; height: 76px; object-fit: contain; }
.login-school { margin-top: 12px; font-size: 20px; font-weight: 700; color: var(--slate-900); }
.login-system { margin-top: 4px; font-size: 14px; font-weight: 600; color: var(--brand-700); }
.login-card { padding: 28px; background: #fff; border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); }
.login-card h2 { font-size: 18px; font-weight: 700; }
.login-sub { margin: 4px 0 22px; font-size: 13px; color: var(--muted); }
.login-foot { margin-top: 20px; text-align: center; font-size: 12px; color: var(--slate-400); }
@media (max-width: 480px) {
    .login-card { padding: 22px 18px; }
}

/* ------------------------------------------------------------------ Report designer */
.designer { display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 20px; align-items: start; }
.designer-panel { position: sticky; top: calc(var(--topbar-h) + 16px); max-height: calc(100vh - var(--topbar-h) - 32px); display: flex; flex-direction: column; }
.designer-panel .card-body { overflow-y: auto; }
.acc { border-bottom: 1px solid var(--slate-100); }
.acc:last-child { border-bottom: 0; }
.acc-head {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 14px 18px; background: none; border: 0; cursor: pointer;
    font: inherit; font-weight: 700; font-size: 13.5px; color: var(--slate-800); text-align: left;
}
.acc-head .icon-tile { width: 30px; height: 30px; border-radius: 9px; }
.acc-head .icon-tile .icon { width: 15px; height: 15px; }
.acc-head .chev { margin-left: auto; color: var(--slate-400); transition: transform .2s; }
.acc.open .acc-head .chev { transform: rotate(180deg); }
.acc-body { display: none; padding: 2px 18px 18px; }
.acc.open .acc-body { display: block; }
.acc-body .field + .field, .acc-body .field + .switch, .acc-body .switch + .field, .acc-body .switch + .switch, .acc-body .form-grid + .field, .acc-body .field + .form-grid { margin-top: 13px; }
.acc-body .form-grid > .field { margin-top: 0; } /* side-by-side fields stay level */
.acc-body .switch { display: flex; }
.preview-stage { background: #e5e9ef; border-radius: 16px; padding: 22px; overflow: auto; }
.preview-frame { width: 100%; border: 0; display: block; background: transparent; min-height: 600px; }
.placeholder-list { display: flex; flex-wrap: wrap; gap: 5px; }
.placeholder-list button { font-family: ui-monospace, monospace; font-size: 11px; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--slate-200); background: #fff; color: var(--slate-600); cursor: pointer; }
.placeholder-list button:hover { border-color: var(--brand-300); color: var(--brand-700); background: var(--brand-50); }
.fee-editor { overflow-x: auto; }
.fee-editor table { border-collapse: collapse; }
.fee-editor td { padding: 2px; }
.fee-editor input.input { height: 30px; font-size: 12px; min-width: 88px; padding: 0 7px; border-radius: 6px; }
.fee-editor .hdr input.input { font-weight: 700; background: var(--slate-150); }
.mark-block + .mark-block { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--slate-100); }
.mark-upload { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.mark-upload.busy { opacity: .55; pointer-events: none; }
.mark-thumb {
    width: 110px; height: 64px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border: 1px dashed var(--slate-300); border-radius: 10px; background: #fff; overflow: hidden;
}
.mark-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.mark-thumb span { padding: 4px 6px; font-size: 11.5px; line-height: 1.3; color: var(--muted); text-align: center; }
.mark-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ Responsive */
@media (max-width: 1200px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-sidebar { grid-template-columns: minmax(0, 1fr); }
    .designer { grid-template-columns: minmax(0, 1fr); }
    .designer-panel { position: static; max-height: none; }
}
@media (max-width: 960px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .sidebar.open { transform: none; }
    .sidebar-backdrop.open { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(15, 23, 42, .4); }
    .main { margin-left: 0; }
    .topbar .menu-toggle { display: inline-flex; }
    .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
    .topbar { padding: 0 16px; }
    .content { padding: 20px 16px 32px; }
    .user-menu-btn .who { display: none; }
    .hero-logo { display: none; }
}
@media (max-width: 640px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid, .form-grid-3 { grid-template-columns: minmax(0, 1fr); }
    .toolbar .search { max-width: none; }
    .toolbar .select { flex: 1 1 140px; }
    .dl { grid-template-columns: 1fr; gap: 2px 0; }
    .dl dd { margin-bottom: 8px; }
    .modal-scroller { padding: 16px 10px; }
    .page-header h2 { font-size: 19px; }
    .table td, .table th { white-space: nowrap; }
    .page-actions .btn { flex: 1 1 auto; }
    .breadcrumbs { display: none; }
}

/* ------------------------------------------------------------------ Print (lists, broadsheets) */
@media print {
    body { background: #fff; }
    .sidebar, .topbar, .no-print, .toolbar, .bulk-bar, .pagination, .toasts, .page-actions { display: none !important; }
    .main { margin: 0; }
    .content { padding: 0; }
    .card { border: 0; box-shadow: none; }
    .table th { background: #eee !important; color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .table td, .table th { padding: 4px 6px; border: 1px solid #999; font-size: 11px; }
}
.icon.flip { transform: rotate(180deg); }
