/* =========================================================================
   Verto Management System (VMS)
   -------------------------------------------------------------------------
   Follows the LPU Verto design system (design.md at the repo root, written
   for LPU Notes): a quiet working surface with one warm accent. Type and tone
   do the work; orange marks what to press or where you are, and almost
   nothing else. Green, amber and red mean safe, watch and at risk.

   The rules this file keeps:
     - One face: Inter, self-hosted. Tabular figures on every number.
     - Surfaces are told apart by a step in tone, never by a 1px line.
       The one exception is the timetable, a real table.
     - Flat: no gradients, no glass, no glows. Shadows only on what floats
       (the scrolled top bar, the drawer, dialogs, the toast).
     - 6px corners on everything except dots and avatars.
     - Sentence case, nothing under 13px, no uppercase tracked labels.

   Mobile-first. The sidebar is an off-canvas drawer below 900px and a docked,
   collapsible sidebar above it.
   ========================================================================= */

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url(fonts/inter-latin-var.woff2) format('woff2');
}

/* ============================ TOKENS ============================ */

:root {
    /* --- Surface ladder (light: Tailwind slate) --- */
    --canvas:        #f8fafc;   /* page ground — slate-50 */
    --surface:       #ffffff;   /* panels, rows, fields */
    --surface-2:     #f1f5f9;   /* alternate rows, sidebar, recessed — slate-100 */
    --surface-3:     #e7ecf2;   /* soft buttons, tracks — slate-200/70 on slate-50 */
    --float:         #ffffff;   /* menus, dialogs, drawer */
    --field:         #ffffff;   /* a field on the page ground */
    --field-in:      #f1f5f9;   /* a field inside a white panel or dialog */

    /* Kept only for the timetable's table rules and the meter's 75% mark. */
    --line:          #e2e8f0;

    /* --- Ink --- */
    --text:          #0f172a;   /* slate-900 */
    --text-2:        #334155;   /* slate-700 */
    --text-3:        #475569;   /* slate-600 — never lighter for text */

    /* --- The accent --- */
    --brand:         #f97316;   /* lpu-primary; carries slate-950 text */
    --brand-hover:   #fb923c;   /* orange-400 — lighter on hover, as orange-500 is on lpunotes */
    --on-brand:      #020617;   /* slate-950 */
    --brand-ink:     #c2410c;   /* orange-700: orange as text on light */
    --tint:          #ffedd5;   /* orange-100: emphasis panels, current item */
    --tint-soft:     #fff7ed;   /* orange-50: lighter panels, row hover */
    --tint-hover:    #ffedd5;   /* soft-button hover */

    /* --- Meaning: safe / watch / at risk --- */
    --safe:      #15803d;  --safe-bg:  #f0fdf4;
    --watch:     #b45309;  --watch-bg: #fffbeb;
    --risk:      #b91c1c;  --risk-bg:  #fef2f2;

    /* --- Elevation: floating things only --- */
    --shadow-bar:  0 1px 12px rgba(15, 23, 42, .08);
    --shadow-pop:  0 25px 50px -12px rgba(15, 23, 42, .25);
    --ring-pop:    0 0 0 1px rgba(0, 0, 0, .05);

    --radius:    6px;

    --rail-w:     264px;
    --rail-w-min: 76px;
    --topbar-h:   64px;

    --ease-out: cubic-bezier(.16, 1, .3, 1);
    --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

:root[data-theme="dark"] {
    --canvas:        #0a0a0a;   /* lpu-bg */
    --surface:       #171717;   /* lpu-surface */
    --surface-2:     #111111;   /* sidebar, footer step */
    --surface-3:     #262626;
    --float:         #1f1f1f;
    --field:         #171717;
    --field-in:      #0a0a0a;
    --line:          #262626;

    --text:          #fafafa;
    --text-2:        #d4d4d4;
    --text-3:        #a3a3a3;   /* lpu-muted */

    --brand-ink:     #f97316;
    --tint:          #22160b;
    --tint-soft:     #21180f;
    --tint-hover:    #2a1d12;

    --safe:      #4ade80;  --safe-bg:  rgba(34, 197, 94, .16);
    --watch:     #fbbf24;  --watch-bg: rgba(245, 158, 11, .14);
    --risk:      #f87171;  --risk-bg:  rgba(239, 68, 68, .16);

    --shadow-bar: 0 1px 12px rgba(0, 0, 0, .6);
    --shadow-pop: 0 25px 50px -12px rgba(0, 0, 0, .7);
    --ring-pop:   0 0 0 1px rgba(255, 255, 255, .1);
}

/* The OS preference applies only until the user picks a side. Keep this block
   identical to the one above. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --canvas:        #0a0a0a;
        --surface:       #171717;
        --surface-2:     #111111;
        --surface-3:     #262626;
        --float:         #1f1f1f;
        --field:         #171717;
        --field-in:      #0a0a0a;
        --line:          #262626;

        --text:          #fafafa;
        --text-2:        #d4d4d4;
        --text-3:        #a3a3a3;

        --brand-ink:     #f97316;
        --tint:          #22160b;
        --tint-soft:     #21180f;
        --tint-hover:    #2a1d12;

        --safe:      #4ade80;  --safe-bg:  rgba(34, 197, 94, .16);
        --watch:     #fbbf24;  --watch-bg: rgba(245, 158, 11, .14);
        --risk:      #f87171;  --risk-bg:  rgba(239, 68, 68, .16);

        --shadow-bar: 0 1px 12px rgba(0, 0, 0, .6);
        --shadow-pop: 0 25px 50px -12px rgba(0, 0, 0, .7);
        --ring-pop:   0 0 0 1px rgba(255, 255, 255, .1);
    }
}

/* ============================ BASE ============================ */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
    font-family: var(--sans);
    background: var(--canvas);
    color: var(--text);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overscroll-behavior-y: none;
}

.hidden { display: none !important; }

/* Font Awesome sets an author-level `display` on its icons, which outranks the
   UA stylesheet's [hidden] rule — so an icon marked `hidden` still renders. */
[hidden] { display: none !important; }

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: var(--radius);
}

:root { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--surface-3);
    border-radius: 8px;
    border: 3px solid transparent;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.2; letter-spacing: -.015em; }
p { margin: 0; }

/* Course codes, dates and registration numbers stay in the one face; the
   class keeps their figures tabular so columns line up. */
.mono, .fig { font-variant-numeric: tabular-nums; }

/* ============================ BRANDMARK ============================ */

.brandmark {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: var(--brand);
    color: var(--on-brand);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: -.01em;
}
.brandmark-sm { width: 36px; height: 36px; font-size: 15px; }
.brandmark-lg { width: 56px; height: 56px; font-size: 18px; }

/* The wordmark (img/vms-logo.svg, inlined by vms_logo()). Its dark parts are
   currentColor, so it takes the page ink in both themes; the V stays orange. */
.logo { display: block; height: auto; color: var(--text); max-width: 100%; }
.logo-splash  { width: min(340px, 78vw); }
.logo-signin  { width: min(280px, 100%); margin-bottom: 32px; }
.logo-sidebar { width: 222px; }

/* ============================ BUTTONS ============================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--sans);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.25;
    padding: 13px 24px;
    min-height: 48px;
    border: 0;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: background-color .2s, color .2s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: default; }

.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }

/* The soft button: secondary actions. */
.btn-ghost { background: var(--surface-3); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: var(--tint-hover); }

.btn-danger { background: var(--risk-bg); color: var(--risk); }
.btn-danger:hover:not(:disabled) { background: var(--risk); color: #fff; }

.btn-block { width: 100%; }
.btn-sm { padding: 9px 16px; min-height: 40px; font-size: 14px; }

/* ============================ FORMS ============================ */

.field { margin-bottom: 18px; }

.field label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.field input[type="text"],
.field input[type="password"] {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;               /* 16px avoids iOS zoom-on-focus */
    font-family: var(--sans);
    color: var(--text);
    background: var(--field);
    border: 0;
    border-radius: var(--radius);
}
.field input::placeholder { color: #64748b; }
:root[data-theme="dark"] .field input::placeholder { color: #737373; }
.field input:focus { outline: none; box-shadow: 0 0 0 2px var(--brand); }
#username { font-variant-numeric: tabular-nums; }

.password-wrap { position: relative; }
.password-wrap input { padding-right: 52px; }
.pw-toggle {
    position: absolute;
    right: 2px; top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    border-radius: var(--radius);
    color: var(--text-3);
    font-size: 16px;
    cursor: pointer;
    display: grid;
    place-items: center;
    width: 44px; height: 44px;
}
.pw-toggle:hover { color: var(--text); }

/* A choice row: the whole row is the control, and it turns orange once
   ticked, as choice buttons do on lpunotes. */
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 10px 14px;
    border-radius: var(--radius);
    background: var(--field);
    font-size: 15px;
    color: var(--text);
    margin: 0 0 18px;
    cursor: pointer;
    transition: background-color .2s, box-shadow .2s;
}
.checkbox-row:hover { background: var(--tint-soft); }
.checkbox-row:has(input:checked) { background: var(--tint); box-shadow: inset 0 0 0 2px var(--brand); }
.checkbox-row input {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    flex: none;
    margin: 0;
    border: 0;
    border-radius: 4px;
    background: var(--surface-3);
    display: grid;
    place-items: center;
    cursor: pointer;
}
.checkbox-row input::after {
    content: "";
    width: 10px;
    height: 5px;
    margin-top: -2px;
    border-left: 2px solid var(--on-brand);
    border-bottom: 2px solid var(--on-brand);
    transform: rotate(-45deg);
    opacity: 0;
}
.checkbox-row input:checked { background: var(--brand); }
.checkbox-row input:checked::after { opacity: 1; }
.checkbox-row input:focus-visible { outline-offset: 3px; }

.form-error {
    background: var(--risk-bg);
    color: var(--risk);
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 500;
    margin: 0 0 18px;
}

/* ============================ SPLASH ============================ */

.splash {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    padding: 32px;
    z-index: 1000;
    background: var(--canvas);
    transition: opacity .35s ease;
}
.splash.fade-out { opacity: 0; pointer-events: none; }

.splash-inner { display: flex; flex-direction: column; align-items: center; text-align: center; }
.splash-title {
    margin: 0 0 14px;
    overflow: hidden;
    line-height: 0;
}
.splash-title > span { display: inline-block; animation: lineUp .9s var(--ease-out) both; }
.splash-title em { font-style: normal; color: var(--brand-ink); }
.splash-sub { font-size: 15px; color: var(--text-3); }

.splash-loader {
    width: min(50vw, 170px);
    height: 3px;
    border-radius: 2px;
    background: var(--surface-3);
    overflow: hidden;
}
.splash-loader span {
    display: block;
    width: 36%;
    height: 100%;
    border-radius: 2px;
    background: var(--brand);
    animation: slide 1.15s cubic-bezier(.65, 0, .35, 1) infinite;
}

@keyframes slide { 0% { transform: translateX(-120%); } 100% { transform: translateX(320%); } }
@keyframes lineUp { from { transform: translateY(105%); } to { transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ============================ SIGN IN ============================ */

.signin {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--canvas);
}

/* The statement half is desktop-only; on a phone the form is the screen. */
.signin-panel { display: none; }

.signin-form-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 32px 16px calc(32px + env(safe-area-inset-bottom));
}

.signin-card { width: 100%; max-width: 420px; margin: 0 auto; }

.signin-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}
.signin-title { font-size: 26px; font-weight: 800; letter-spacing: -.03em; }
.signin-sub { font-size: 15px; color: var(--text-3); margin-top: 2px; }

.signin-notes {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.note {
    display: block;
    padding: 12px 14px;
    border-radius: var(--radius);
    background: var(--surface-2);
    font-size: 14px;
    color: var(--text-2);
    line-height: 1.5;
}
.note.warn { background: var(--watch-bg); color: var(--text); }
.note i { display: none; }

.signin-disclaimer {
    margin: 24px auto 0;
    max-width: 420px;
    font-size: 13px;
    color: var(--text-3);
    line-height: 1.5;
}

/* ============================ SHELL ============================ */

.shell { display: flex; min-height: 100dvh; }

.scrim {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 55;
    animation: fade .2s ease;
}

/* ============================ SIDEBAR ============================ */
/* A tone step from the page, never a dark slab: slate-100 on slate-50,
   #111 on #0a0a0a. The current screen sits on the orange-100 tint. */

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--rail-w);
    max-width: 84vw;
    z-index: 60;
    display: flex;
    flex-direction: column;
    background: var(--surface-2);
    color: var(--text);
    transform: translateX(-100%);
    transition: transform .3s var(--ease-out);
    overflow: hidden;
}
.shell.nav-open .sidebar { transform: none; background: var(--float); box-shadow: var(--shadow-pop); }

.sb-head {
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--topbar-h);
    padding: 0 18px;
    flex: none;
}
.sb-railmark { display: none; }

/* The student row opens the profile. */
.sb-student {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 12px 8px;
    padding: 10px;
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    transition: background-color .2s;
    flex: none;
}
.sb-student:hover { background: var(--tint-soft); }
.sb-avatar {
    flex: none;
    width: 38px; height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--tint);
    color: var(--brand-ink);
    font-weight: 700;
    font-size: 14px;
    overflow: hidden;
    background-size: cover;
    background-position: center;
}
.sb-student-text { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.sb-student-text strong {
    font-size: 15px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sb-student-text small {
    font-size: 13px;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sb-student-chev { font-size: 13px; color: var(--text-3); flex: none; transition: transform .2s; }
.sb-student:hover .sb-student-chev { transform: translateX(3px); }

.sb-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 4px 12px 16px;
}
.sb-group { margin-top: 18px; }
.sb-group:first-child { margin-top: 8px; }
.sb-group-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-3);
    padding: 0 10px 6px;
}

.sb-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: none;
    background: none;
    border-radius: var(--radius);
    color: var(--text-2);
    font-family: var(--sans);
    font-size: 15px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    text-decoration: none;
    transition: background-color .2s, color .2s;
}
.sb-link i {
    font-size: 15px;
    width: 20px;
    text-align: center;
    color: var(--text-3);
    flex: none;
    transition: color .2s;
}
.sb-link:hover { background: var(--tint-soft); color: var(--text); }
.sb-link.active { background: var(--tint); color: var(--text); font-weight: 600; }
.sb-link.active i { color: var(--brand-ink); }

.sb-foot { flex: none; padding: 12px; }
.sb-signout {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: none;
    border-radius: var(--radius);
    background: none;
    color: var(--text-2);
    font-family: var(--sans);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color .2s, color .2s;
}
.sb-signout i { width: 20px; text-align: center; color: var(--text-3); font-size: 15px; }
.sb-signout:hover { background: var(--risk-bg); color: var(--risk); }
.sb-signout:hover i { color: var(--risk); }
.sb-disclaimer {
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-3);
    padding: 8px 10px 2px;
    margin: 0;
}

/* ============================ MAIN COLUMN ============================ */

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Solid page ground, 64px, no rule. A soft shadow appears once the page
   scrolls (data-scrolled, set by app.js). */
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 10px;
    height: calc(var(--topbar-h) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 12px 0;
    background: var(--canvas);
    transition: box-shadow .2s;
}
.topbar[data-scrolled] { box-shadow: var(--shadow-bar); }

.icon-btn {
    position: relative;
    flex: none;
    display: grid;
    place-items: center;
    width: 42px; height: 42px;
    border: 0;
    border-radius: var(--radius);
    background: none;
    color: var(--text-2);
    font-size: 16px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .2s, color .2s;
}
.icon-btn:hover { background: var(--tint-hover); color: var(--text); }
.icon-btn:active { transform: translateY(1px); }

.tb-rail { display: none; }

.tb-titles { flex: 1; min-width: 0; }
/* The kicker: where this screen sits, in orange, over its name. */
.tb-crumb {
    font-size: 13px;
    font-weight: 700;
    color: var(--brand-ink);
    line-height: 1.2;
}
.tb-title {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -.025em;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tb-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.tb-updated {
    font-size: 13px;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
    margin-right: 8px;
    white-space: nowrap;
}

/* --- content column --- */
.content {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 16px 48px;
}
.content.page-anim { animation: rise .45s var(--ease-out); }

.app-foot {
    width: 100%;
    padding: 28px 16px calc(28px + env(safe-area-inset-bottom));
    background: var(--surface-2);
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-3);
}
.app-foot > * { max-width: 1200px; margin-inline: auto; }

/* ============================ PAGE HEADER ============================ */

.page-head { margin: 8px 0 24px; }
.page-head h2 {
    font-size: clamp(28px, 3.4vw, 40px);
    font-weight: 800;
    letter-spacing: -.035em;
    line-height: 1.05;
    overflow: hidden;
    padding-bottom: .06em;
}
.content.page-anim .page-head h2 { animation: lineUp .9s var(--ease-out) both; }
.page-head p {
    color: var(--text-2);
    font-size: 16px;
    margin-top: 8px;
    max-width: 60ch;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    background: none;
    border: none;
    border-radius: var(--radius);
    padding: 8px 0;
    margin-bottom: 6px;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: var(--brand);
    text-decoration-thickness: 2px;
    text-underline-offset: 6px;
}
.back-link i { font-size: 13px; transition: transform .2s; }
.back-link:hover { color: var(--brand-ink); }
.back-link:hover i { transform: translateX(-3px); }

.section-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--text);
    margin: 36px 0 12px;
}
.section-label:first-child { margin-top: 0; }
.section-label .see-all,
.card-head .card-action,
.today-head .card-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--text);
    text-decoration: underline;
    text-decoration-color: var(--brand);
    text-decoration-thickness: 2px;
    text-underline-offset: 5px;
    white-space: nowrap;
    cursor: pointer;
    transition: color .2s;
}
.section-label .see-all:hover,
.card-head .card-action:hover,
.today-head .card-action:hover { color: var(--brand-ink); }

/* ============================ CARDS ============================ */
/* A panel on the page ground. Rows inside it are parted by a 2px gap of
   page ground, so each reads as its own row without a drawn line. */

.card {
    background: var(--surface);
    border-radius: var(--radius);
    margin-bottom: 16px;
    overflow: hidden;
}
.card-pad { padding: 18px; }

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px 10px;
}
.card-head h3 { font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
.card-body { padding: 18px; }
.card-note {
    padding: 12px 18px;
    background: var(--surface-2);
    font-size: 14px;
    color: var(--text-3);
}
.card > .card-note { border-top: 2px solid var(--canvas); }

/* Results page: the cumulative CGPA, said once at the top. */
.result-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px;
    background: var(--tint);
}
.result-summary .rs-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.result-summary .rs-left .chip { display: none; }
.result-summary .rs-label { font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
.result-summary .rs-sub { font-size: 14px; color: var(--text-2); margin-top: 2px; }
.result-summary .rs-value {
    font-variant-numeric: tabular-nums;
    font-size: 40px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.035em;
    color: var(--text);
}

/* Term cards collapse to their header; native <details> drives it. */
.term-card summary.card-head {
    padding: 16px 18px;
    cursor: pointer;
    list-style: none;
    -webkit-user-select: none;
    user-select: none;
    transition: background-color .2s;
}
.term-card summary.card-head::-webkit-details-marker { display: none; }
.term-card summary.card-head:hover { background: var(--tint-soft); }
.term-card[open] summary.card-head { border-bottom: 2px solid var(--canvas); }
.term-head-right { display: flex; align-items: center; gap: 12px; flex: none; }
.term-chevron { color: var(--text-3); font-size: 13px; transition: transform .2s ease; }
.term-card[open] .term-chevron { transform: rotate(180deg); }

/* ============================ KPI FIGURES ============================ */
/* Figures are tone tiles: the label on top, the value large below. No icon
   squares — the label says what it is. */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 32px;
}
.kpi {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}
.kpi[data-nav] {
    cursor: pointer;
    background: linear-gradient(var(--tint-soft), var(--tint-soft)) no-repeat left / 0% 100%, var(--surface); /* taste-skill-ignore: one flat colour, the design.md row sweep */
    transition: background-size .35s var(--ease-out);
}
.kpi[data-nav]:hover { background-size: 100% 100%; }
.kpi[data-nav]:active { transform: translateY(1px); }

.kpi-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.kpi-ico { display: none; }
.kpi-label {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.kpi-value {
    font-variant-numeric: tabular-nums;
    font-size: 32px;
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -.035em;
    color: var(--text);
}
.kpi-value .unit { font-size: 18px; font-weight: 600; color: var(--text-3); margin-left: 2px; letter-spacing: 0; }
.kpi-value .unit.pre { margin-left: 0; margin-right: 2px; }
.kpi-value.sm { font-size: 22px; letter-spacing: -.02em; padding-top: 6px; }
.kpi-value.good { color: var(--safe); }
.kpi-value.warn { color: var(--watch); }
.kpi-value.bad  { color: var(--risk); }
.kpi-value.dash { color: var(--text-3); }
.kpi-hint { font-size: 14px; color: var(--text-3); }

/* ===================== TODAY STRIP (dashboard) =====================
   Today's classes as a horizontal, swipeable rail. The track bleeds to the
   content edges so cards scroll off-screen while the first card still lines
   up with the text column. */
.today { margin-bottom: 32px; }
.today-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 12px; margin-bottom: 12px;
}
.today-head h3 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.today-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    margin-inline: -16px;
    padding-inline: 16px;
    padding-bottom: 4px;
    scroll-padding-inline: 16px;
    scrollbar-width: thin;
}
.today-scroll::-webkit-scrollbar { height: 6px; }

.class-card {
    scroll-snap-align: start;
    flex: 0 0 auto;
    width: 200px;
    display: flex; flex-direction: column; gap: 6px;
    padding: 16px;
    background: var(--surface);
    border-radius: var(--radius);
}
.class-card.is-now { background: var(--tint); }
.class-when { display: flex; align-items: center; gap: 8px; min-height: 22px; }
.class-time {
    font-size: 14px; font-weight: 700;
    color: var(--brand-ink); white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.class-name {
    font-size: 16px; font-weight: 700; color: var(--text); line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.class-sub { font-size: 14px; color: var(--text-3); line-height: 1.4; }

.today-msg { background: var(--surface); border-radius: var(--radius); padding: 20px; }
.today-msg .empty { background: none; padding: 0; text-align: left; }

@media (min-width: 620px) {
    .today-scroll { margin-inline: -24px; padding-inline: 24px; scroll-padding-inline: 24px; }
    .class-card { width: 220px; }
}
@media (min-width: 1024px) {
    .today-scroll { margin-inline: -32px; padding-inline: 32px; scroll-padding-inline: 32px; }
}

/* ============================ ELIGIBILITY METER ============================ */
/* The 75% floor drawn across the bar, so the percentage becomes a margin. */
.meter { margin-top: 16px; }
.meter-track {
    position: relative;
    height: 10px;
    border-radius: 5px;
    background: var(--surface-3);
    overflow: hidden;
}
.meter-fill {
    height: 100%;
    border-radius: 5px;
    transition: width .7s var(--ease-out);
}
.meter-fill.good { background: var(--safe); }
.meter-fill.warn { background: var(--watch); }
.meter-fill.bad  { background: var(--risk); }
.meter-mark {
    position: absolute;
    top: 0; bottom: 0;
    width: 2px;
    margin-left: -1px;
    background: var(--text);
    z-index: 2;
}
.meter-legend {
    position: relative;
    height: 20px;
    margin-top: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
}
/* Tucked left of the 75% mark so it never runs into a value on the right. */
.meter-legend span {
    position: absolute;
    transform: translateX(-100%);
    margin-left: -6px;
    white-space: nowrap;
}

/* ============================ ROWS ============================ */

.row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
}
.card > .row + .row,
.card > .card-head + .row:not(:first-child) { border-top: 2px solid var(--canvas); }
.card > .card-head + .row { border-top: 0; }

.row-main { flex: 1; min-width: 0; }
.row-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.35;
    word-break: break-word;
}
.row-sub {
    font-size: 14px;
    color: var(--text-3);
    margin-top: 2px;
    overflow-wrap: break-word;
}

/* Course metadata as a key/value grid. */
.meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 16px;
    margin: 14px 0 0;
}
.meta-grid > div { min-width: 0; }
.meta-grid dt { font-size: 13px; font-weight: 500; color: var(--text-3); line-height: 1.3; }
.meta-grid dd {
    margin: 2px 0 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    overflow-wrap: break-word;
}

/* Room and seat codes are hyphenated; hold them together. */
.nv { white-space: nowrap; }
.row-fig {
    flex: none;
    font-variant-numeric: tabular-nums;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    text-align: right;
}
.row-fig.good { color: var(--safe); }
.row-fig.warn { color: var(--watch); }
.row-fig.bad  { color: var(--risk); }

/* Placement drill-down: each category's header row toggles its companies. */
.drive + .drive { border-top: 2px solid var(--canvas); }
.drive .row { border-top: 0 !important; }
.drive-head { cursor: pointer; transition: background-color .2s; }
.drive-head:hover { background: var(--tint-soft); }
.drive-caret {
    font-size: 13px;
    color: var(--text-3);
    margin-right: 8px;
    transition: transform .2s ease;
}
.drive.open .drive-caret { transform: rotate(90deg); }
.drive-detail { background: var(--surface-2); animation: drop .3s var(--ease-out); }
.drive-detail .drive-co { padding-left: 40px; }
.drive-detail .drive-co + .drive-co { border-top: 2px solid var(--surface); }

/* A definition row: label left, value right. */
.def-rows { display: grid; }
.def-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 18px;
}
.def-row:nth-child(even) { background: var(--surface-2); }
.def-row dt { font-size: 15px; color: var(--text-3); flex: none; }
.def-row dd {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    text-align: right;
    word-break: break-word;
    min-width: 0;
    font-variant-numeric: tabular-nums;
}
/* Inline def rows sitting inside a padded body keep a little inset for the
   alternate tone. */
.card-body .def-row { padding-inline: 10px !important; border-radius: var(--radius); }

/* ============================ STATUS WORDS ============================ */
/* Status is said in a coloured word, never a pill. */

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-3);
    white-space: nowrap;
}
.chip.good { color: var(--safe); }
.chip.warn { color: var(--watch); }
.chip.bad  { color: var(--risk); }
.chip.brand { color: var(--brand-ink); font-weight: 700; }

/* ============================ ATTENDANCE ============================ */

.figure-hero { display: flex; align-items: baseline; flex-wrap: wrap; gap: 14px; }
.figure-hero .big {
    font-variant-numeric: tabular-nums;
    font-size: clamp(48px, 7vw, 72px);
    font-weight: 800;
    line-height: .95;
    letter-spacing: -.045em;
    color: var(--text);
}
.figure-hero .big > span { font-size: .4em; font-weight: 600; color: var(--text-3); letter-spacing: 0; margin-left: 2px; }
.figure-hero .big.good { color: var(--safe); }
.figure-hero .big.warn { color: var(--watch); }
.figure-hero .big.bad  { color: var(--risk); }

.att-course {
    cursor: pointer;
    background: linear-gradient(var(--tint-soft), var(--tint-soft)) no-repeat left / 0% 100%, var(--surface); /* taste-skill-ignore: one flat colour, the design.md row sweep */
    transition: background-size .35s var(--ease-out);
}
.att-course:hover { background-size: 100% 100%; }
.att-course-static, .att-course-static:hover { cursor: default; background: var(--surface); }

.course-head { display: flex; align-items: flex-start; gap: 16px; }
.course-head .course-text { flex: 1; min-width: 0; }
.course-code {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--brand-ink);
    font-variant-numeric: tabular-nums;
    margin-bottom: 4px;
}
.course-name { font-size: 18px; font-weight: 700; letter-spacing: -.02em; line-height: 1.3; }
.course-type { font-size: 14px; color: var(--text-3); font-weight: 500; }

.att-ring { position: relative; flex: none; width: 72px; height: 72px; }
.att-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); display: block; }
.att-ring circle { fill: none; stroke-width: 6; }
.att-ring .ring-bg { stroke: var(--surface-3); }
.att-ring .ring-fg { stroke: var(--brand); transition: stroke-dasharray .6s var(--ease-out); }
.att-ring.good .ring-fg { stroke: var(--safe); }
.att-ring.warn .ring-fg { stroke: var(--watch); }
.att-ring.bad  .ring-fg { stroke: var(--risk); }
.att-ring .ring-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-variant-numeric: tabular-nums;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -.03em;
    color: var(--text);
}
.att-ring .ring-label small { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 1px; }

.att-course-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-3);
}
.att-course-foot .go {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}
.att-course-foot .go i { color: var(--brand-ink); transition: transform .2s; }
.att-course:hover .att-course-foot .go i { transform: translateX(4px); }

/* Class-by-class log */
.log-tally { display: flex; gap: 8px; margin-bottom: 16px; }
.log-tally span {
    flex: 1;
    padding: 12px 10px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    background: var(--surface);
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
}
.log-tally .present { color: var(--safe);  background: var(--safe-bg); }
.log-tally .absent  { color: var(--risk);  background: var(--risk-bg); }
.log-tally .duty    { color: var(--watch); background: var(--watch-bg); }

.log-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 18px 12px 15px;
    border-left: 3px solid transparent;
}
.log-row + .log-row { border-top: 2px solid var(--canvas); }
.log-row.present { border-left-color: var(--safe); }
.log-row.absent  { border-left-color: var(--risk); }
.log-row.duty    { border-left-color: var(--watch); }
.log-main { flex: 1; min-width: 0; }
.log-date { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.log-meta { font-size: 14px; color: var(--text-3); margin-top: 2px; }
.log-block { font-size: 14px; font-weight: 600; color: var(--risk); margin-top: 3px; }

/* ============================ TERM PANELS ============================ */

.sem-panel {
    background: var(--surface);
    border-radius: var(--radius);
    margin-bottom: 8px;
    overflow: hidden;
}
.sem-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background-color .2s;
}
.sem-summary:hover { background: var(--tint-soft); }
.sem-summary::-webkit-details-marker { display: none; }
.sem-title { font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
.sem-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--text-3);
    font-weight: 500;
}
.sem-chev { transition: transform .2s ease; font-size: 13px; }
.sem-panel[open] .sem-chev { transform: rotate(180deg); }
.sem-panel[open] .sem-summary { border-bottom: 2px solid var(--canvas); }

/* ============================ CALENDAR / HOLIDAY DATE ============================ */

.date-chip {
    flex: none;
    width: 54px;
    padding: 7px 0 6px;
    text-align: center;
    border-radius: var(--radius);
    background: var(--surface-2);
    line-height: 1.05;
}
.date-chip .d {
    display: block;
    font-variant-numeric: tabular-nums;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--text);
}
.date-chip .m {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    font-weight: 600;
    text-transform: capitalize;
    color: var(--brand-ink);
}
.date-chip.holiday { background: var(--tint); }

/* ============================ MESSAGES ============================ */

.post { padding: 18px; }
.post + .post { border-top: 2px solid var(--canvas); }
.post-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
}
.post-title { font-size: 17px; font-weight: 700; line-height: 1.35; letter-spacing: -.015em; }
.post-date {
    flex: none;
    font-size: 13px;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.post-body {
    margin-top: 8px;
    font-size: 16px;
    color: var(--text-2);
    line-height: 1.6;
    white-space: pre-line;
    max-width: 68ch;
}
.post-source {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 14px;
    color: var(--text-3);
}
.post-source i { color: var(--brand-ink); }

/* RMS requests: what you asked, then the university's reply on the lighter
   orange panel. */
.post-title.is-empty { color: var(--text-3); font-weight: 600; }
.rms-meta {
    margin-top: 4px;
    font-size: 14px;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
}
.rms-item .post-body { margin-top: 10px; }
.rms-reply {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: var(--tint-soft);
    max-width: 72ch;
}
.rms-reply-label { font-size: 14px; font-weight: 700; color: var(--brand-ink); }
.rms-reply .post-body { margin-top: 4px; color: var(--text); }
.rms-awaiting { margin-top: 12px; font-size: 14px; color: var(--text-3); }

/* ============================ SKELETON / STATES ============================ */

.skeleton {
    background: var(--surface-3);
    border-radius: var(--radius);
    animation: breathe 1.4s ease-in-out infinite;
}
@keyframes breathe { 50% { opacity: .55; } }
.sk-row { height: 68px; margin-bottom: 8px; }

/* Empty state: a panel, a heading, one sentence, one button. No illustration. */
.empty {
    padding: 28px 24px;
    background: var(--surface);
    border-radius: var(--radius);
    color: var(--text-2);
}
.empty-ico { display: none; }
.empty h3 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--text);
    margin-bottom: 6px;
}
.empty p { font-size: 16px; margin-bottom: 18px; max-width: 56ch; }
.empty p:last-child { margin-bottom: 0; }
.empty.error { background: var(--risk-bg); }
.empty.error h3 { color: var(--risk); }

/* ============================ BANNERS ============================ */
/* Notices are an amber-50 panel with plain text. */

.svc-banner-host {
    position: sticky;
    top: calc(var(--topbar-h) + env(safe-area-inset-top));
    z-index: 35;
}
.svc-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--watch-bg);
    font-size: 15px;
    color: var(--text);
}
.svc-banner > i { display: none; }
.svc-banner > span { flex: 1; min-width: 0; line-height: 1.45; }
.svc-banner .btn-sm { flex: none; }

.stale-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 14px 18px 0;
    padding: 12px 14px;
    border-radius: var(--radius);
    background: var(--watch-bg);
    font-size: 15px;
    color: var(--text);
}
.stale-banner > i { display: none; }
.stale-banner > span { flex: 1; line-height: 1.45; }
.stale-banner .btn-sm { flex: none; }

/* ============================ WELCOME ============================ */
/* The dashboard's opening line: the student's name as the display line with
   the greeting as its orange kicker, on the page ground like every header. */

.welcome {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 8px 0 28px;
}
.welcome-text { flex: 1; min-width: 0; }
.welcome-kicker {
    font-size: clamp(20px, 2.4vw, 26px);
    font-weight: 700;
    color: var(--brand-ink);
    overflow: hidden;
}
.welcome-name {
    font-size: clamp(32px, 4.6vw, 56px);
    font-weight: 800;
    letter-spacing: -.04em;
    line-height: 1.02;
    margin: 2px 0 10px;
    word-break: break-word;
    overflow: hidden;
    padding-bottom: .06em;
}
.content.page-anim .welcome-kicker,
.content.page-anim .welcome-name { animation: lineUp .9s var(--ease-out) both; }
.content.page-anim .welcome-name { animation-delay: .11s; }
.welcome-meta {
    font-size: 16px;
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
    word-break: break-word;
}
.welcome-avatar {
    flex: none;
    width: 72px; height: 72px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 24px;
    font-weight: 700;
    color: var(--brand-ink);
    background: var(--tint);
    overflow: hidden;
    background-size: cover;
    background-position: center;
}

/* ============================ PROFILE ============================ */
.profile-hero {
    display: flex; align-items: center; gap: 18px;
    padding: 22px 20px;
    border-radius: var(--radius);
    background: var(--tint);
    color: var(--text);
    margin-bottom: 16px;
}
.profile-av {
    flex: none;
    width: 80px; height: 80px;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: 28px; font-weight: 700; color: var(--brand-ink);
    background: var(--surface);
    background-size: cover; background-position: center;
    overflow: hidden;
}
.profile-id { flex: 1; min-width: 0; }
.profile-name {
    font-size: clamp(24px, 3vw, 32px); font-weight: 800;
    letter-spacing: -.03em; line-height: 1.1; word-break: break-word;
}
.profile-role { font-size: 16px; color: var(--text-2); margin-top: 6px; line-height: 1.4; word-break: break-word; }
.profile-reg { font-size: 14px; color: var(--text-3); margin-top: 4px; font-variant-numeric: tabular-nums; }
.profile-chips { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; }
.hchip { font-size: 14px; font-weight: 600; color: var(--text-2); white-space: nowrap; }

.stat-band {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    padding: 0;
    margin-bottom: 16px;
    background: none;
    overflow: visible;
}
.stat-cell {
    display: flex; flex-direction: column-reverse; justify-content: flex-end;
    gap: 6px;
    padding: 16px;
    border-radius: var(--radius);
    background: var(--surface);
}
.stat-val {
    font-weight: 800; font-size: 30px; line-height: 1; letter-spacing: -.035em;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    display: inline-flex; align-items: baseline;
}
.stat-unit { font-size: 15px; font-weight: 600; margin-left: 2px; color: var(--text-3); letter-spacing: 0; }
.stat-key { font-size: 15px; font-weight: 500; color: var(--text-3); }
.prof-flags { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 4px; }
.sem-item { padding: 14px 18px; }
.sem-item + .sem-item { border-top: 2px solid var(--canvas); }
.sem-item-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sem-item-name { font-size: 16px; font-weight: 600; color: var(--text); }
.sem-item-att { font-weight: 400; color: var(--text-3); font-size: 14px; }
.sem-gpa { flex: none; font-size: 15px; font-weight: 700; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ============================ TOAST ============================ */

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(20px + env(safe-area-inset-bottom));
    transform: translateX(-50%) translateY(16px);
    max-width: calc(100vw - 32px);
    padding: 12px 18px;
    border-radius: var(--radius);
    background: var(--text);
    color: var(--canvas);
    font-size: 15px;
    font-weight: 500;
    box-shadow: var(--shadow-pop);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s, transform .3s var(--ease-out);
    z-index: 1300;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--risk); color: #fff; }

/* ============================ SYNC OVERLAY ============================ */

.sync-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 16px;
    background: var(--canvas);
    transition: opacity .3s ease;
}
.sync-overlay.fade-out { opacity: 0; pointer-events: none; }
.sync-overlay-text { font-size: 20px; font-weight: 700; letter-spacing: -.02em; color: var(--text); }
.sync-overlay-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    width: min(340px, 100%);
}
.sync-progress-wrap { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.sync-progress-bar {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--surface-3);
    overflow: hidden;
}
.sync-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 3px;
    background: var(--brand);
    transition: width .35s ease;
}
.sync-progress-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}
.sync-progress-item {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sync-progress-label {
    flex: none;
    font-variant-numeric: tabular-nums;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-3);
}
.sync-overlay-done {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--safe);
    font-size: 17px;
    font-weight: 700;
}
.sync-overlay-done i { font-size: 20px; }
.pulsing { animation: none; }

/* ============================ MODAL ============================ */
/* Floating surface, no blur behind it. A bottom sheet on phones. */

.modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    animation: fade .2s ease;
}
.modal-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
    border-radius: 8px 8px 0 0;
    background: var(--float);
    box-shadow: var(--shadow-pop), var(--ring-pop);
    animation: rise .3s var(--ease-out);
}
.modal-card h3 { font-size: 22px; font-weight: 800; letter-spacing: -.025em; }
.modal-sub { margin: 8px 0 20px; font-size: 15px; line-height: 1.55; color: var(--text-2); }
.modal-actions { display: flex; gap: 8px; margin-top: 8px; }
.modal-actions .btn { flex: 1; }
.modal-card .field input[type="text"],
.modal-card .field input[type="password"],
.modal-card .checkbox-row { background: var(--field-in); }

@media (min-width: 620px) {
    .modal { align-items: center; padding: 20px; }
    .modal-card { border-radius: var(--radius); padding: 26px; }
}

/* --- Sync dialog: the last-sync readout --- */
.sync-meta {
    margin: 0 0 14px;
    padding: 12px 14px;
    border-radius: var(--radius);
    background: var(--surface-2);
}
:root[data-theme="dark"] .sync-meta { background: var(--canvas); }
.sync-meta > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}
.sync-meta > div + div { margin-top: 6px; }
.sync-meta dt { font-size: 14px; font-weight: 500; color: var(--text-3); }
.sync-meta dd { margin: 0; font-size: 15px; color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.sync-meta dd.age { font-weight: 700; }

.sync-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 15px;
    line-height: 1.5;
}
.sync-note > i { display: none; }
.sync-note.warn { background: var(--watch-bg); color: var(--text); }
.sync-note.ok { background: var(--tint); color: var(--text); }
.sync-note.checking,
.sync-note.info { background: var(--surface-2); color: var(--text-2); }

/* ============================ ENTRY / EXIT CONTROLS ============================ */
.ee-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.ee-controls label { display: flex; flex-direction: column; gap: 6px; font-size: 15px; font-weight: 600; color: var(--text); }
.ee-controls input[type="date"] {
    font: inherit;
    font-weight: 500;
    min-height: 44px;
    padding: 9px 12px;
    border: 0;
    border-radius: var(--radius);
    background: var(--field-in);
    color: inherit;
    color-scheme: light dark;
}
.ee-controls input[type="date"]:focus { outline: none; box-shadow: 0 0 0 2px var(--brand); }

/* ============================ TIMETABLE ============================ */
/* A real week grid: days across, start times down, one block per session.
   It is a table, so it keeps faint rules. Below 1024px the day strip filters
   it to one day; same markup either way. */

/* No overflow:hidden — it would stop the sticky day header from sticking. */
.tt-panel {
    background: var(--surface);
    border-radius: var(--radius);
}

.tt-grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}
.tt-grid th, .tt-grid td { border-bottom: 1px solid var(--line); }
.tt-grid tbody tr:last-child th, .tt-grid tbody tr:last-child td { border-bottom: 0; }
.tt-grid tbody td { border-left: 1px solid var(--line); }

.tt-grid thead th {
    position: sticky;
    top: calc(var(--topbar-h) + env(safe-area-inset-top));
    z-index: 2;
    padding: 10px 6px 9px;
    background: var(--surface-2);
    border-bottom: 0;
    font: 600 14px/1.2 var(--sans);
    color: var(--text-2);
    text-align: center;
}
.tt-grid thead th:first-child { border-top-left-radius: var(--radius); }
.tt-grid thead th:last-child { border-top-right-radius: var(--radius); }
.tt-grid thead .tt-corner { width: 88px; padding-left: 14px; text-align: left; }

.tt-day-abbr { display: block; }
.tt-day-tag { display: block; min-height: 16px; margin-top: 2px; font: 700 13px/1.2 var(--sans); color: var(--brand-ink); }
.tt-grid thead .tt-day.is-today {
    color: var(--text);
    background: var(--tint);
    box-shadow: inset 0 -3px 0 var(--brand);
}

.tt-time {
    width: 88px;
    padding: 10px 8px 10px 14px;
    text-align: left;
    vertical-align: top;
    white-space: nowrap;
    font: 600 13px/1.4 var(--sans);
    font-variant-numeric: tabular-nums;
    color: var(--text);
}
.tt-time-start { display: block; }
.tt-time-end { display: block; font-weight: 500; color: var(--text-3); }

.tt-cell { padding: 5px; vertical-align: top; }
.tt-cell.is-today { background: var(--tint-soft); }

.tt-cell.has-many .tt-block { height: auto; margin-bottom: 4px; }
.tt-cell.has-many .tt-block:last-child { margin-bottom: 0; }

/* One session, on a tone step. Lectures, practicals and tutorials share
   the fill; the kind is a plain word. */
.tt-block {
    height: 100%;
    padding: 8px 9px;
    border-radius: var(--radius);
    background: var(--surface-2);
}
.tt-cell.is-today .tt-block { background: var(--surface); }
.tt-code { font: 700 14px/1.25 var(--sans); color: var(--text); overflow-wrap: break-word; font-variant-numeric: tabular-nums; }
.tt-where { margin-top: 2px; font: 500 13px/1.3 var(--sans); color: var(--text-2); font-variant-numeric: tabular-nums; }
.tt-kind { margin-top: 4px; font: 500 13px/1.25 var(--sans); color: var(--text-3); }

/* Makeup classes are inserted into the week, so they read as an annotation:
   an amber fill and a dashed outline. */
.tt-block.is-makeup,
.tt-cell.is-today .tt-block.is-makeup {
    background: var(--watch-bg);
    border: 1.5px dashed var(--watch);
}
.tt-block.is-makeup .tt-kind { color: var(--watch); font-weight: 600; }

/* The session the clock is inside, and the next one: orange tint, and an
   orange ring on the live one. */
.tt-block.is-now { background: var(--tint) !important; box-shadow: inset 0 0 0 2px var(--brand); border: 0; }
.tt-block.is-next { background: var(--tint) !important; }

.tt-flag { display: none; }
.tt-block.is-now .tt-flag,
.tt-block.is-next .tt-flag {
    display: block;
    margin-bottom: 3px;
    font: 700 13px/1.2 var(--sans);
    color: var(--brand-ink);
}

/* ---- the now strip ---- */
.tt-now-host:empty { display: none; }

.tt-now {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 16px;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: var(--surface);
}
.tt-now-dot {
    flex: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-3);
}
.tt-now-body { flex: 1 1 auto; min-width: 0; }
.tt-now-kicker { font: 700 14px/1.2 var(--sans); color: var(--text-3); }
.tt-now-line {
    margin-top: 4px;
    font: 600 16px/1.35 var(--sans);
    color: var(--text);
    overflow-wrap: break-word;
    font-variant-numeric: tabular-nums;
}
.tt-now-when { flex: none; text-align: right; }
.tt-now-time {
    font: 700 18px/1.15 var(--sans);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.02em;
    color: var(--text-2);
}
.tt-now-sub {
    margin-top: 3px;
    font: 500 13px/1.3 var(--sans);
    font-variant-numeric: tabular-nums;
    color: var(--text-3);
}

.tt-now.is-live { background: var(--tint); }
.tt-now.is-live .tt-now-dot { background: var(--brand); }
.tt-now.is-live .tt-now-kicker { color: var(--brand-ink); }
.tt-now.is-live .tt-now-time { color: var(--text); }

.tt-now.is-next { background: var(--tint-soft); }
.tt-now.is-next .tt-now-dot { background: var(--brand-ink); }
.tt-now.is-next .tt-now-kicker { color: var(--brand-ink); }
.tt-now.is-next .tt-now-time { color: var(--text); }

.tt-now.is-done, .tt-now.is-off { background: var(--surface-2); }

.tt-days { display: none; }

@media (max-width: 1023px) {
    .tt-days {
        display: flex;
        gap: 6px;
        margin: 0 0 12px;
        padding: 2px 2px 4px;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .tt-days::-webkit-scrollbar { display: none; }
    .tt-day-btn {
        flex: none;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        min-width: 58px;
        padding: 9px 10px 8px;
        border: 0;
        border-radius: var(--radius);
        background: var(--surface);
        color: var(--text);
        font: 600 14px/1 var(--sans);
        cursor: pointer;
        transition: background-color .2s;
    }
    .tt-day-btn:hover { background: var(--tint-soft); }
    .tt-day-btn .tt-day-n { font: 500 13px/1 var(--sans); color: var(--text-3); font-variant-numeric: tabular-nums; }
    .tt-day-btn.is-today .tt-day-name { color: var(--brand-ink); }
    .tt-day-btn.is-on { background: var(--tint); box-shadow: inset 0 0 0 2px var(--brand); }
    .tt-day-btn.is-on .tt-day-name { color: var(--text); }
    .tt-day-btn.is-on .tt-day-n { color: var(--text-2); }
    .tt-cell { padding: 5px 10px 5px 0; }
    .tt-grid tbody td { border-left: 0; }
    .tt-grid tbody tr:first-child .tt-time { padding-top: 12px; }
    .tt-grid tbody tr:last-child .tt-time { border-bottom-left-radius: var(--radius); }
    .tt-grid tbody tr:last-child .tt-cell { border-bottom-right-radius: var(--radius); }

    /* The day strip filters: hide every day column but the selected one, and
       every row with no class that day. Scoped to data-d / data-has so the
       time rail is never hidden. */
    .tt-grid[data-day="0"] thead .tt-day[data-d]:not([data-d="0"]),
    .tt-grid[data-day="1"] thead .tt-day[data-d]:not([data-d="1"]),
    .tt-grid[data-day="2"] thead .tt-day[data-d]:not([data-d="2"]),
    .tt-grid[data-day="3"] thead .tt-day[data-d]:not([data-d="3"]),
    .tt-grid[data-day="4"] thead .tt-day[data-d]:not([data-d="4"]),
    .tt-grid[data-day="5"] thead .tt-day[data-d]:not([data-d="5"]),
    .tt-grid[data-day="6"] thead .tt-day[data-d]:not([data-d="6"]) { display: none; }

    .tt-grid[data-day="0"] tbody .tt-cell[data-d]:not([data-d="0"]),
    .tt-grid[data-day="1"] tbody .tt-cell[data-d]:not([data-d="1"]),
    .tt-grid[data-day="2"] tbody .tt-cell[data-d]:not([data-d="2"]),
    .tt-grid[data-day="3"] tbody .tt-cell[data-d]:not([data-d="3"]),
    .tt-grid[data-day="4"] tbody .tt-cell[data-d]:not([data-d="4"]),
    .tt-grid[data-day="5"] tbody .tt-cell[data-d]:not([data-d="5"]),
    .tt-grid[data-day="6"] tbody .tt-cell[data-d]:not([data-d="6"]) { display: none; }

    .tt-grid[data-day="0"] tbody tr[data-has]:not([data-has~="0"]),
    .tt-grid[data-day="1"] tbody tr[data-has]:not([data-has~="1"]),
    .tt-grid[data-day="2"] tbody tr[data-has]:not([data-has~="2"]),
    .tt-grid[data-day="3"] tbody tr[data-has]:not([data-has~="3"]),
    .tt-grid[data-day="4"] tbody tr[data-has]:not([data-has~="4"]),
    .tt-grid[data-day="5"] tbody tr[data-has]:not([data-has~="5"]),
    .tt-grid[data-day="6"] tbody tr[data-has]:not([data-has~="6"]) { display: none; }
}

/* ============================ RESPONSIVE ============================ */

@media (max-width: 619px) {
    .tb-updated { display: none; }
    .tb-title { font-size: 18px; }
    .welcome-avatar { width: 56px; height: 56px; font-size: 20px; }
    .result-summary .rs-value { font-size: 34px; }
}

@media (min-width: 620px) {
    .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .meta-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px 20px; }
    .content { padding: 16px 24px 56px; }
    .topbar { padding-inline: 20px; }
    .app-foot { padding-inline: 24px; }
    .tb-title { font-size: 20px; }
}

@media (min-width: 900px) {
    /* --- The sidebar docks and the drawer machinery turns off --- */
    .sidebar {
        position: sticky;
        top: 0;
        height: 100dvh;
        max-width: none;
        transform: none;
        transition: width .25s var(--ease-out);
        width: var(--rail-w);
    }
    .shell.nav-open .sidebar { box-shadow: none; background: var(--surface-2); }
    .scrim { display: none !important; }
    .tb-menu { display: none; }

    /* --- Sign-in becomes a statement beside the form --- */
    .signin { flex-direction: row; }
    .signin-panel {
        display: flex;
        flex-direction: column;
        justify-content: center;
        flex: 1 1 52%;
        padding: 56px 64px;
        background: var(--surface-2);
        color: var(--text);
    }
    .sp-title {
        font-size: clamp(40px, 4.6vw, 64px);
        font-weight: 800;
        line-height: 1.02;
        letter-spacing: -.04em;
        margin: 0 0 18px;
        max-width: 12em;
    }
    .sp-title > span { display: block; overflow: hidden; padding-bottom: .06em; }
    .sp-title > span > span { display: block; animation: lineUp .9s var(--ease-out) both; }
    .sp-title > span:first-child { font-size: .42em; font-weight: 700; letter-spacing: -.02em; color: var(--brand-ink); }
    .sp-title > span + span > span { animation-delay: .11s; }
    .sp-lede { font-size: 19px; line-height: 1.55; color: var(--text-2); max-width: 34em; animation: rise .7s var(--ease-out) .4s both; }
    .sp-list {
        list-style: none;
        margin: 32px 0 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: 2px;
        max-width: 34em;
        animation: rise .7s var(--ease-out) .5s both;
    }
    .sp-list li {
        display: flex;
        align-items: baseline;
        gap: 12px;
        padding: 14px 18px;
        border-radius: var(--radius);
        background: var(--surface);
        font-size: 16px;
        color: var(--text);
    }
    .sp-list li:nth-child(even) { background: var(--canvas); }
    .sp-list li strong { flex: none; width: 9.5em; font-weight: 700; }
    .sp-list li span { color: var(--text-2); }
    .sp-list i { display: none; }
    .sp-foot {
        margin-top: auto;
        padding-top: 40px;
        font-size: 14px;
        line-height: 1.6;
        color: var(--text-3);
    }
    .signin-form-side { flex: 1 1 48%; padding: 48px; }
}

@media (min-width: 1024px) {
    .content { padding: 16px 32px 64px; }
    .topbar { padding-inline: 32px; }
    .app-foot { padding-inline: 32px; }

    /* --- Collapsed sidebar: icons only --- */
    .tb-rail { display: grid; }
    .shell.rail .sidebar { width: var(--rail-w-min); }
    .shell.rail .logo-sidebar,
    .shell.rail .sb-link-label,
    .shell.rail .sb-student-chev { display: none; }
    .shell.rail .sb-head { justify-content: center; padding-inline: 0; }
    .shell.rail .sb-railmark { display: inline-grid; }
    .shell.rail .sb-student {
        justify-content: center;
        padding: 6px;
        margin-inline: 10px;
        background: none;
    }
    .shell.rail .sb-student:hover { background: var(--tint-soft); }
    .shell.rail .sb-student-text { display: none; }
    .shell.rail .sb-group-label {
        height: 0;
        padding: 0;
        margin: 0;
        overflow: hidden;
    }
    .shell.rail .sb-group { margin-top: 14px; }
    .shell.rail .sb-link { justify-content: center; padding: 10px 0; }
    .shell.rail .sb-signout { justify-content: center; }
    .shell.rail .sb-disclaimer { display: none; }
    .shell.rail .sb-nav { padding-inline: 10px; }

    /* --- Content grids --- */
    .split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
    .split > * { margin-bottom: 0; }
    .cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
    .cols-2 > * { margin-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-delay: 0s !important;
        transition-duration: .001ms !important;
    }
}

/* ============================ PLANNER TOOLS ============================ */
/* Attendance planner and grade predictor. Inputs reuse the entry/exit field
   recipe (filled, borderless, brand focus ring); status keeps its one-hue law. */

.good-ink { color: var(--safe); }
.warn-ink { color: var(--watch); }
.bad-ink  { color: var(--risk); }

.tool-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin: 0 0 18px;
}
.tool-bar-label { font-size: 14px; font-weight: 600; color: var(--text-3); }

.seg {
    display: inline-flex;
    flex-wrap: wrap;
    max-width: 100%;
    background: var(--surface-3);
    border-radius: var(--radius);
    padding: 3px;
    gap: 2px;
}
.seg-btn {
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    min-height: 38px;
    padding: 0 14px;
    border: 0;
    border-radius: calc(var(--radius) - 2px);
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.on { background: var(--brand); color: #fff; }
.seg-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--brand); }

.calc-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.calc-wide { grid-column: 1 / -1; }
.calc-field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--text); min-width: 0; }
.calc-field input[type="number"],
.calc-field select,
.tool-select,
.pd-name {
    font: inherit;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    width: 100%;
    min-height: 44px;
    padding: 9px 12px;
    border: 0;
    border-radius: var(--radius);
    background: var(--field-in);
    color: var(--text);
    color-scheme: light dark;
}
.tool-select { width: auto; max-width: 100%; }
.calc-field input[readonly] { color: var(--text-3); }
.calc-field input:focus, .calc-field select:focus, .tool-select:focus, .pd-name:focus { outline: none; box-shadow: 0 0 0 2px var(--brand); }

.calc-out { margin-top: 14px; }
.calc-out:empty { display: none; }
.calc-result { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 4px; }
.calc-big {
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}
.calc-big small { font-size: .45em; color: var(--text-3); margin-left: 2px; }
.calc-big.good { color: var(--safe); }
.calc-big.warn { color: var(--watch); }
.calc-big.bad  { color: var(--risk); }

/* Grade predictor */
.pd-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; margin-bottom: 18px; }
.pd-course { margin-bottom: 10px; }
.pd-head { display: flex; align-items: flex-start; gap: 16px; }
.pd-head .course-text { flex: 1; min-width: 0; }
.pd-name { font-size: 16px; font-weight: 600; margin-top: 4px; }
.pd-grade { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.pd-letter {
    font-size: 30px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -.02em;
}
.pd-letter.good { color: var(--safe); }
.pd-letter.warn { color: var(--watch); }
.pd-letter.bad  { color: var(--risk); }
.pd-total { font-size: 13px; color: var(--text-3); }
.pd-parts { margin: 12px 0 0; }
.pd-parts summary { cursor: pointer; font-size: 14px; color: var(--text-2); font-weight: 500; }
.pd-part {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
    padding: 6px 0;
    border-bottom: 1px solid var(--line);
}
.pd-part:last-child { border-bottom: 0; }
.pd-part small { color: var(--text-3); }
.pd-inputs { margin-top: 14px; }
.pd-range { display: flex; align-items: center; gap: 12px; }
.pd-range input[type="range"] { flex: 1; min-width: 0; accent-color: var(--brand); height: 28px; }
.pd-range output { min-width: 3.5em; text-align: right; font-weight: 600; }
.pd-need { margin-top: 10px; }
.pd-need:empty { display: none; }
.pd-course [data-mdel] { margin-top: 12px; }
.pd-disclaimer { margin: 10px 0 24px; padding: 0; }

@media (min-width: 640px) {
    .calc-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .pd-inputs { grid-template-columns: 2fr 1fr 1fr; }
    .pd-inputs .calc-wide { grid-column: auto; }
}

/* Custom target beside the presets. A course left out of the overall stays
   listed, just quieter. */
.tool-custom { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--text-3); }
.tool-custom input {
    font: inherit;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    width: 72px;
    min-height: 40px;
    padding: 6px 10px;
    border: 0;
    border-radius: var(--radius);
    background: var(--field-in);
    color: var(--text);
}
.tool-custom input:focus { outline: none; box-shadow: 0 0 0 2px var(--brand); }
.row.is-excluded .row-main,
.row.is-excluded > .chip { opacity: .5; }
.check-line { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 14px; font-weight: 500; color: var(--text-2); cursor: pointer; }
.check-line input { width: 18px; height: 18px; accent-color: var(--brand); }

/* Planner: one answer up top, the rest folded away. */
.pl-line { font-size: 16px; line-height: 1.45; margin-top: 10px; color: var(--text); }
.pl-facts { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 14px 0 0; }
.pl-facts dt { font-size: 13px; color: var(--text-3); }
.pl-facts dd { margin: 2px 0 0; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pl-meta { font-size: 14px; color: var(--text-3); margin-top: 12px; }

/* Planner hero: now → the range the term can end in. */
.pl-pj { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 16px; padding: 14px 16px; background: var(--surface-2, var(--canvas)); border-radius: 12px; }
.pl-pj-h { display: block; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); margin-bottom: 6px; }
.pl-pj-arrow { color: var(--text-3); font-size: 16px; }
.pl-pj-end { min-width: 0; }
.pl-pj-opts { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px 14px; }
.pl-pj-or { font-size: 13px; color: var(--text-3); align-self: center; padding-bottom: 16px; }
.pl-pj-fig { display: flex; flex-direction: column; }
.pl-pj-fig b { font-size: 22px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.pl-pj-fig span { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.pl-facts-sm { margin-top: 12px; }
.pl-facts-sm dd { font-size: 15px; }
@media (max-width: 480px) {
    .pl-pj-arrow { transform: rotate(90deg); }
    .pl-pj { flex-direction: column; align-items: flex-start; }
}
.link-btn {
    font: inherit;
    font-weight: 600;
    color: var(--brand-ink);
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }
.link-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--brand); border-radius: 2px; }

.pl-status { padding: 14px 18px; display: flex; flex-direction: column; gap: 10px; }
.pl-status p { display: flex; align-items: baseline; gap: 10px; font-size: 15px; font-weight: 600; }
.pl-status i { width: 16px; flex: none; color: var(--text-3); }

.pl-more { margin-top: 18px; }
.pl-more > summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}
.pl-more > summary::-webkit-details-marker { display: none; }
.pl-more > summary i { color: var(--text-3); transition: transform .2s; }
.pl-more[open] > summary i { transform: rotate(180deg); }
.pl-more > summary:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--brand); border-radius: var(--radius); }
.pl-sec { padding: 4px 18px 18px; display: flex; flex-direction: column; gap: 10px; }
.pl-sec + .pl-sec { border-top: 2px solid var(--canvas); padding-top: 16px; }
.pl-sec h4 { font-size: 15px; font-weight: 700; }
.pl-sec .tool-bar { margin: 0; }
.pl-sec .btn { align-self: flex-start; }
.count-list { display: flex; flex-direction: column; gap: 2px; }
.count-list .check-line { margin: 0; min-height: 36px; color: var(--text); }

/* The planner's target bar sits on the page, not in a card: the custom box
   takes the card surface so it reads as a field. On a phone the six presets
   share one row equally instead of wrapping one onto a line of its own. */
.tool-bar > .tool-custom input { background: var(--surface); }
@media (max-width: 639px) {
    .tool-bar > .seg { display: flex; flex-wrap: nowrap; width: 100%; }
    .tool-bar > .seg .seg-btn { flex: 1; padding: 0; }
}

/* Attendance page → planner: the planner's headline as a tappable card. */
.planner-promo {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    margin-top: 10px;
    cursor: pointer;
    background: linear-gradient(var(--tint-soft), var(--tint-soft)) no-repeat left / 0% 100%, var(--surface); /* taste-skill-ignore: one flat colour, the design.md row sweep */
    transition: background-size .35s var(--ease-out);
}
.planner-promo:hover { background-size: 100% 100%; }
.planner-promo:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--brand); }
.pp-ico {
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: grid;
    place-items: center;
    background: var(--tint);
    color: var(--brand-ink);
}
.pp-text { flex: 1; min-width: 0; }
.pp-title { font-size: 16px; font-weight: 700; line-height: 1.35; }
.pp-sub { font-size: 14px; color: var(--text-3); margin-top: 2px; }
.pp-go { flex: none; color: var(--brand-ink); }

/* Planner: the "this is an estimate" caution under the headline number. */
.est-note {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 16px;
    margin: 10px 0;
    border-radius: var(--radius);
    background: var(--watch-bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}
.est-note i { color: var(--watch); margin-top: 3px; flex: none; }
.est-note b { color: var(--watch); }

/* Condonation: the automatic reading first, own numbers folded under it. */
.cd-edit > summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--brand-ink); width: fit-content; }
.cd-edit[open] > summary { margin-bottom: 10px; }

/* dd/mm/yyyy date field: text input + calendar button, native picker hidden
   behind it (rendered, so showPicker() can anchor to it). */
.dmy { position: relative; display: inline-flex; align-items: stretch; border-radius: var(--radius); background: var(--field-in); }
.dmy input[type="text"] {
    font: inherit;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    width: 8.5em;
    min-height: 44px;
    padding: 9px 4px 9px 12px;
    border: 0;
    border-radius: var(--radius) 0 0 var(--radius);
    background: transparent;
    color: var(--text);
}
.dmy input[type="text"]:focus { outline: none; box-shadow: 0 0 0 2px var(--brand); }
.dmy input.invalid { box-shadow: 0 0 0 2px var(--risk); }
.dmy-pick {
    border: 0;
    background: transparent;
    color: var(--text-2);
    padding: 0 12px;
    cursor: pointer;
    border-radius: 0 var(--radius) var(--radius) 0;
}
.dmy-pick:hover { color: var(--brand-ink); }
.dmy-pick:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--brand); }
.dmy input.dmy-native { min-height: 0; color-scheme: light dark; }
.dmy-native { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }

/* Pending duty leave: a card of per-subject steppers in the planner. */
/* Plan a leave: two dates joined by an arrow, the holiday rule under them. */
.lv-body { display: flex; flex-direction: column; gap: 14px; }
.lv-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }
.lv-field { display: flex; flex-direction: column; gap: 6px; }
.lv-field > span { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.lv-arrow { color: var(--text-3); height: 44px; display: flex; align-items: center; }
.lv-note { display: flex; align-items: baseline; gap: 10px; margin: 0; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); font-size: 14px; color: var(--text-2); line-height: 1.45; }
.lv-note i { flex: none; color: var(--text-3); }
.lv #lv-out:not(:empty) { border-top: 1px solid var(--line); }
@media (max-width: 480px) {
    .lv-fields { display: grid; grid-template-columns: 1fr 1fr; }
    .lv-arrow { display: none; }
    .lv-field .dmy { width: 100%; }
    .lv-field .dmy input[type="text"] { width: 100%; min-width: 0; }
}
.pdl-hint { padding: 14px 18px 4px; font-size: 14px; color: var(--text-2); line-height: 1.45; }
.pdl .row { padding-block: 10px; }
.stepper { flex: none; display: inline-flex; align-items: center; background: var(--field-in); border-radius: var(--radius); }
.stepper button {
    width: 40px;
    height: 40px;
    border: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    border-radius: var(--radius);
}
.stepper button:hover:not(:disabled) { color: var(--brand-ink); }
.stepper button:disabled { color: var(--text-3); opacity: .45; cursor: default; }
.stepper button:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--brand); }
.stepper-val { min-width: 2ch; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-3); }
.stepper-val.on { color: var(--brand-ink); }
.pdl-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-top: 2px solid var(--canvas);
    font-size: 14px;
    font-weight: 600;
}

/* Planner: the overall-first exam rule, stated above the subject list. */
.pl-rule { font-size: 14px; color: var(--text-2); line-height: 1.5; margin: -4px 0 10px; }

/* Planner: now vs term end, with the first-week bonus on its own line. */
.pj-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) repeat(2, minmax(84px, auto));
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--line);
}
.pj-row:last-child { border-bottom: 0; }
.pj-row .row-main { min-width: 0; }
.pj-head { padding-top: 10px; padding-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--text-3); }
.pj-total .row-title { font-weight: 700; }
.pj-cell { display: flex; flex-direction: column; align-items: center; text-align: center; font-variant-numeric: tabular-nums; }
.pj-cell > small { font-size: 12px; color: var(--text-3); margin-top: 4px; white-space: nowrap; }
.pj-ring { width: 64px; height: 64px; }
.pj-ring .ring-label { font-size: 14px; }
.pj-ring .ring-label small { font-size: 11px; }
.pj-ring .ring-bonus { stroke: var(--safe); opacity: .4; }
.pj-ring .ring-bonus.warn { stroke: var(--watch); }
.pj-ring .ring-bonus.bad { stroke: var(--risk); }
.pj-cell small b { font-weight: 700; }
.pj-row.is-excluded { opacity: .6; }
.pj-tag { margin-top: 6px; }
.pj-one .pj-row { grid-template-columns: minmax(0, 1fr) minmax(84px, auto); }
@media (max-width: 480px) {
    .pj-row { gap: 8px; padding: 10px 14px; grid-template-columns: minmax(0, 1fr) repeat(2, minmax(72px, auto)); }
}

/* The "rules not confirmed — ask DSR" line closing the planner's status card. */
.pl-status p.pl-confirm { font-size: 13px; font-weight: 500; color: var(--text-3); border-top: 2px solid var(--canvas); padding-top: 10px; }

/* Grade predictor: the released grade under the estimate, for comparison. */
.pd-actual { font-size: 13px; color: var(--text-3); margin-top: 4px; }
.pd-actual b { color: var(--text); font-weight: 700; }

/* Grade predictor: a subject whose marks come from a reappear sitting. */
.pd-resat { font-size: 13px; color: var(--accent-ink); margin-top: 10px; display: flex; gap: 6px; align-items: baseline; }
.pd-resat b { font-weight: 700; }
.pd-est { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.pd-est:empty { display: none; }

/* Term-to-term links: Results ⇄ View Marks ⇄ Grade predictor. */
.term-links { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 18px; border-top: 2px solid var(--canvas); }
.sem-panel > .term-links { border-top: 0; padding: 12px 12px 0; }
.term-links-bar { padding: 0; border: 0; margin: -8px 0 18px; }
.term-link {
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 14px;
    border: 0;
    border-radius: var(--radius);
    background: var(--tint);
    color: var(--brand-ink);
    cursor: pointer;
}
.term-link:hover { background: var(--tint-hover); }
.term-link:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--brand); }
.term-link .fa-arrow-right { font-size: 12px; }
/* A term reached by link lands below the sticky top bar, not under it. */
details[data-term] { scroll-margin-top: 84px; }

/* Info tip: an "i" button whose note opens on hover, focus-pinned tap or
   Enter. The note hangs under the line it explains, as wide as that line
   allows, so it never runs off a phone screen. */
.tip-host { position: static; display: inline; }
.tip-btn {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    margin: -4px 0 -4px 4px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-3);
    font-size: 14px;
    vertical-align: middle;
    cursor: pointer;
}
.tip-btn:hover, .tip-btn[aria-expanded="true"] { color: var(--brand-ink); }
.tip-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--brand); }
.tip-pop {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 30;
    max-width: 440px;
    display: none;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    box-shadow: 0 10px 28px rgba(0, 0, 0, .28);
    color: var(--text);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
    text-align: left;
}
.tip-btn[aria-expanded="true"] + .tip-pop { display: block; }
@media (hover: hover) {
    .tip-btn:hover + .tip-pop, .tip-pop:hover { display: block; }
}
.tip-h { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); margin-top: 10px; }
.tip-h:first-child { margin-top: 0; }
.tip-p { display: block; margin-top: 2px; }
/* The line the note hangs from. */
.pl-status p, .tip-line { position: relative; }
.tip-line { margin-top: 4px; font-weight: 600; }
/* Bridges the 6px gap so the pointer can move from the button onto the note. */
.tip-pop::before { content: ''; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }
/* Cards clip their content; one holding a tip lets the note hang out. */
.card:has(.tip-pop) { overflow: visible; }
.tip-lead { display: block; font-size: 14px; font-weight: 600; line-height: 1.45; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.tip-lead b { color: var(--safe); font-size: 16px; }
.tip-rows { display: block; margin-top: 8px; font-variant-numeric: tabular-nums; }
.tip-row { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.tip-row > span:last-child { font-weight: 600; white-space: nowrap; }
.tip-row.tip-total { border-bottom: 0; font-weight: 700; color: var(--safe); padding-top: 6px; }
.tip-scale { color: var(--text-2); }
.tip-note { display: block; margin-top: 10px; font-size: 12px; color: var(--text-3); }

/* Planner: condonation, explained for someone who has never heard of it.
   The student's own exam cut-off leads; the rule and the working follow. */
.cd-body { display: flex; flex-direction: column; gap: 18px; }
.cd-hero { display: flex; align-items: center; gap: 16px; }
.cd-big { flex: none; font-size: 44px; font-weight: 800; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.cd-hero p { font-size: 16px; font-weight: 600; color: var(--text); line-height: 1.4; max-width: 46ch; }
.cd-sec { display: flex; flex-direction: column; gap: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.cd-sec h4 { font-size: 15px; font-weight: 700; color: var(--text); margin: 0; }
.cd-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text-2); line-height: 1.5; max-width: 70ch; }
.cd-rows { display: flex; flex-direction: column; border-radius: var(--radius); background: var(--surface-2); padding: 4px 12px; max-width: 460px; }
.cd-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 14px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.cd-row + .cd-row { border-top: 1px solid var(--line); }
.cd-row b { color: var(--text); font-weight: 700; }
.cd-row.cd-total span, .cd-row.cd-total b { color: var(--text); font-weight: 700; }
.cd-warn { display: flex; gap: 8px; align-items: baseline; font-size: 14px; color: var(--watch); margin: 0; }
.cd-scale-h { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); margin: 6px 0 0; }
.cd-scale { display: flex; flex-wrap: wrap; gap: 6px; }
.cd-step { font-size: 13px; color: var(--text-2); padding: 5px 10px; border-radius: 999px; background: var(--surface-2); font-variant-numeric: tabular-nums; }
.cd-step b { color: var(--text); font-weight: 700; }
.cd-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cd .card-note { margin: 0; }
@media (max-width: 480px) {
    .cd-hero { align-items: flex-start; flex-direction: column; gap: 6px; }
    .cd-big { font-size: 38px; }
}
