/* ==========================================================================
   Examination Portal design layer (on top of Bootstrap 5).
   Theme: "academic editorial" - ivory paper, ink navy, vermilion accent.
   Every colour is a variable, so dark mode only redefines variables.
   ========================================================================== */

:root,
[data-bs-theme="light"] {
  --paper: #f4eee2;
  --paper-2: #ece4d3;
  --card: #fffcf5;
  --ink: #15213a;
  --ink-2: #3a4560;
  --muted: #685f4e;
  --line: #e0d6c2;
  --line-2: #efe8da;
  --accent: #b8371f;
  --accent-ink: #ffffff;
  --accent-soft: #f9e1d8;
  --gold: #7f5c12;
  --gold-soft: #f5ead0;
  --forest: #2c7253;
  --forest-soft: #dcecdf;
  --crimson: #a3231f;
  --crimson-soft: #f6dcd9;
  --sky: #2d5b8a;
  --sky-soft: #dde7f1;
  --shadow: 0 1px 0 rgba(21, 33, 58, .04), 0 12px 32px -14px rgba(21, 33, 58, .22);
  --shadow-lg: 0 2px 0 rgba(21, 33, 58, .04), 0 24px 48px -18px rgba(21, 33, 58, .30);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.08 0 0 0 0 0.12 0 0 0 0 0.22 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Schibsted Grotesk", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  /* Bootstrap hooks */
  --bs-body-bg: var(--paper);
  --bs-body-color: var(--ink);
  --bs-emphasis-color: var(--ink);
  --bs-secondary-color: var(--muted);
  --bs-tertiary-bg: var(--line-2);
  --bs-border-color: var(--line);
  --bs-body-font-family: var(--font-body);
  --bs-link-color: var(--accent);
  --bs-link-color-rgb: 184, 55, 31;
  --bs-link-hover-color: var(--ink);
  --bs-link-hover-color-rgb: 21, 33, 58;
  --bs-border-radius: .65rem;
  --bs-focus-ring-color: rgba(184, 55, 31, .3);
}

[data-bs-theme="dark"] {
  --paper: #0d1220;
  --paper-2: #111829;
  --card: #151c2e;
  --ink: #efe8d9;
  --ink-2: #c8c0ae;
  --muted: #9b937f;
  --line: #273049;
  --line-2: #1b2337;
  --accent: #ff6c4c;
  --accent-ink: #1a0d08;
  --accent-soft: rgba(255, 108, 76, .14);
  --gold: #e4b452;
  --gold-soft: rgba(228, 180, 82, .14);
  --forest: #6fcf9d;
  --forest-soft: rgba(111, 207, 157, .13);
  --crimson: #ff8a80;
  --crimson-soft: rgba(255, 138, 128, .13);
  --sky: #8ab8ec;
  --sky-soft: rgba(138, 184, 236, .13);
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 14px 34px -16px rgba(0, 0, 0, .7);
  --shadow-lg: 0 2px 0 rgba(0, 0, 0, .3), 0 26px 50px -18px rgba(0, 0, 0, .8);
  --bs-link-color-rgb: 255, 108, 76;
  --bs-link-hover-color-rgb: 239, 232, 217;
  --bs-focus-ring-color: rgba(255, 108, 76, .35);
}

/* ---------- base ---------- */
html { scroll-behavior: smooth; overflow-x: clip; } /* hidden tooltips must not add a sideways scrollbar */
body {
  font-family: var(--font-body);
  font-size: .95rem;
  background:
    var(--grain),
    radial-gradient(1200px 600px at 100% -10%, var(--accent-soft), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, var(--sky-soft), transparent 60%),
    var(--paper);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .display-font { font-family: var(--font-display); font-optical-sizing: auto; letter-spacing: -.01em; color: var(--ink); }
h1 { font-weight: 600; }
.mono, code { font-family: var(--font-mono); font-size: .85em; }
code { color: var(--accent); }
.text-muted, .text-body-secondary { color: var(--muted) !important; }
a { text-underline-offset: 3px; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.skip-link { position: absolute; left: -999px; top: 8px; z-index: 2000; background: var(--ink); color: var(--paper); padding: .5rem 1rem; border-radius: .5rem; }
.skip-link:focus { left: 8px; }

/* ---------- icons (inline SVG sprite) ---------- */
.ico { width: 1.15em; height: 1.15em; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: -.2em; }

/* ---------- app shell ---------- */
.sidebar { --bs-offcanvas-width: 272px; --bs-offcanvas-bg: var(--card); }
.sidebar-panel { display: flex; flex-direction: column; height: 100%; padding: 1.4rem 1rem 1rem; background: var(--card); border-right: 1px solid var(--line); }
@media (min-width: 992px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 272px; z-index: 1030; transition: width .35s cubic-bezier(.2, .8, .2, 1); }
  .app-main { margin-left: 272px; transition: margin-left .35s cubic-bezier(.2, .8, .2, 1); }
  .sb-text { white-space: nowrap; transition: opacity .25s .12s; }

  /* Collapsed rail (ui.js sets data-sidebar on <html>): icons only, labels become tooltips */
  [data-sidebar="collapsed"] .sidebar { width: 76px; }
  [data-sidebar="collapsed"] .app-main { margin-left: 76px; }
  [data-sidebar="collapsed"] .sb-text { opacity: 0; visibility: hidden; transition: none; }
  [data-sidebar="collapsed"] .side-link .sb-text { position: absolute; left: calc(100% + 14px); top: 50%; transform: translateY(-50%); padding: .38rem .6rem; border-radius: .45rem; background: var(--ink); color: var(--paper); font-size: .78rem; box-shadow: var(--shadow); pointer-events: none; z-index: 60; }
  [data-sidebar="collapsed"] .side-link:is(:hover, :focus-visible) .sb-text { opacity: 1; visibility: visible; transition: opacity .15s; }
  [data-sidebar="collapsed"] .side-link:hover { transform: none; }
  [data-sidebar="collapsed"] .brand { padding-inline: 3px; }
  [data-sidebar="collapsed"] .side-foot { flex-direction: column; }
  [data-sidebar="collapsed"] .side-foot .who { display: none; }
}
.brand { display: flex; align-items: center; gap: .7rem; padding: 0 .5rem 1.4rem; color: var(--ink); text-decoration: none; }
.brand-mark { width: 38px; height: 38px; flex-shrink: 0; display: grid; place-items: center; border-radius: 10px; background: var(--ink); color: var(--paper); box-shadow: var(--shadow); transition: transform .3s; }
.brand-mark svg { width: 30px; height: 30px; }
.brand:hover .brand-mark { transform: rotate(-6deg); }
.brand-name { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; line-height: 1.05; }
.brand-name small { display: block; font-family: var(--font-body); font-size: .68rem; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

.nav-section { font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); padding: 1rem .75rem .4rem; font-weight: 600; }
.side-link { display: flex; align-items: center; gap: .75rem; padding: .58rem .75rem; margin: 1px 0; border-radius: .6rem; color: var(--ink-2); text-decoration: none; font-weight: 500; position: relative; transition: background .2s, color .2s, transform .2s; }
.side-link:hover { background: var(--line-2); color: var(--ink); transform: translateX(2px); }
.side-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side-link.active::before { content: ""; position: absolute; left: -1rem; top: 20%; bottom: 20%; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.side-foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--line); display: flex; align-items: center; gap: .65rem; }
.side-foot .who { min-width: 0; flex: 1; line-height: 1.2; }
.side-foot .who b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who span { font-size: .75rem; color: var(--muted); text-transform: capitalize; }

.topbar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .75rem; padding: .8rem clamp(1rem, 3vw, 2.2rem); background: color-mix(in srgb, var(--paper) 82%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.crumb { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb b { color: var(--ink); font-weight: 600; }
.top-search { position: relative; margin-left: auto; width: min(320px, 40vw); }
.top-search .ico { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.top-search input { padding-left: 2.2rem; border-radius: 999px; }
.icon-btn { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink); transition: border-color .2s, color .2s; }
.icon-btn .ico { transition: transform .2s; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn:hover .ico { transform: rotate(-12deg); } /* rotate the icon only, so its tooltip stays level */
[data-bs-theme="dark"] .i-moon, [data-bs-theme="light"] .i-sun { display: none; }

.page { padding: clamp(1.2rem, 3vw, 2.4rem) clamp(1rem, 3vw, 2.2rem) 4rem; max-width: 1360px; }
.foot { padding: 0 clamp(1rem, 3vw, 2.2rem) 2rem; font-size: .78rem; color: var(--muted); }

/* ---------- page header ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.8rem; }
.eyebrow { font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); font-weight: 600; margin-bottom: .35rem; display: flex; align-items: center; gap: .5rem; }
.eyebrow::before { content: ""; width: 22px; height: 1.5px; background: currentColor; }
.page-head h1 { font-size: clamp(1.8rem, 3.2vw, 2.6rem); margin: 0; line-height: 1.05; }
.page-head h1 em { font-style: italic; color: var(--accent); font-weight: 500; }
.page-head p { margin: .45rem 0 0; color: var(--muted); max-width: 62ch; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---------- surfaces ---------- */
.card, .panel { background: var(--card); border: 1px solid var(--line); border-radius: 1rem; box-shadow: var(--shadow); --bs-card-bg: var(--card); --bs-card-border-color: var(--line); }
.panel { padding: 1.35rem; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: 1rem; }
.panel-title h2 { font-size: 1.15rem; margin: 0; font-weight: 600; }
.panel-title .hint { font-size: .78rem; color: var(--muted); }

/* stat "ledger" cards */
.stat { position: relative; display: block; padding: 1.15rem 1.2rem 1.1rem; background: var(--card); border: 1px solid var(--line); border-radius: 1rem; box-shadow: var(--shadow); color: var(--ink); text-decoration: none; overflow: hidden; transition: transform .25s, box-shadow .25s, border-color .25s; height: 100%; }
.stat::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--tone, var(--accent)); transform-origin: left; transform: scaleX(.25); transition: transform .4s; }
a.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--tone, var(--accent)); color: var(--ink); }
a.stat:hover::before { transform: scaleX(1); }
.stat-label { display: flex; align-items: center; justify-content: space-between; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.stat-label .ico { color: var(--tone, var(--accent)); width: 1.3em; height: 1.3em; }
.stat-value { font-family: var(--font-display); font-size: 2.6rem; font-weight: 600; line-height: 1; margin-top: .6rem; font-variant-numeric: lining-nums tabular-nums; }
.stat-note { font-size: .78rem; color: var(--muted); margin-top: .35rem; }
.tone-accent { --tone: var(--accent); } .tone-gold { --tone: var(--gold); } .tone-forest { --tone: var(--forest); } .tone-sky { --tone: var(--sky); } .tone-ink { --tone: var(--ink); } .tone-crimson { --tone: var(--crimson); }

/* ---------- tables ---------- */
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 1rem; box-shadow: var(--shadow); overflow: auto; }
.table { --bs-table-bg: transparent; --bs-table-color: var(--ink); --bs-table-hover-bg: var(--line-2); --bs-table-hover-color: var(--ink); --bs-table-border-color: var(--line-2); margin: 0; }
.table > :not(caption) > * > * { padding: .85rem 1rem; }
.table thead th { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; background: var(--paper-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { vertical-align: middle; }
.table-sm > :not(caption) > * > * { padding: .5rem .6rem; }
.cell-id { font-family: var(--font-mono); font-size: .78rem; color: var(--muted); }
.cell-main { font-weight: 600; }
.cell-sub { font-size: .78rem; color: var(--muted); }
.person { display: flex; align-items: center; gap: .65rem; }

/* avatar initials */
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; font-size: .75rem; font-weight: 700; letter-spacing: .02em; flex-shrink: 0; background: var(--av-bg); color: var(--av-fg); }
.avatar-lg { width: 46px; height: 46px; font-size: .95rem; }
.av-0 { --av-bg: var(--accent-soft); --av-fg: var(--accent); } .av-1 { --av-bg: var(--sky-soft); --av-fg: var(--sky); }
.av-2 { --av-bg: var(--forest-soft); --av-fg: var(--forest); } .av-3 { --av-bg: var(--gold-soft); --av-fg: var(--gold); }
.av-4 { --av-bg: var(--line-2); --av-fg: var(--ink); }

/* ---------- status pills ---------- */
.pill { display: inline-flex; align-items: center; gap: .4rem; padding: .22rem .65rem .22rem .5rem; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; background: var(--p-bg); color: var(--p-fg); border: 1px solid color-mix(in srgb, var(--p-fg) 22%, transparent); }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-live i { box-shadow: 0 0 0 0 currentColor; animation: pulse 1.8s infinite; }
.pill-success { --p-bg: var(--forest-soft); --p-fg: var(--forest); } .pill-info { --p-bg: var(--sky-soft); --p-fg: var(--sky); }
.pill-warning { --p-bg: var(--gold-soft); --p-fg: var(--gold); } .pill-danger { --p-bg: var(--crimson-soft); --p-fg: var(--crimson); }
.pill-neutral { --p-bg: var(--line-2); --p-fg: var(--muted); } .pill-ink { --p-bg: var(--ink); --p-fg: var(--paper); }
.pill-accent { --p-bg: var(--accent-soft); --p-fg: var(--accent); }

/* ---------- buttons ---------- */
.btn { --bs-btn-font-size: .9rem; --bs-btn-font-weight: 600; --bs-btn-padding-x: 1rem; --bs-btn-padding-y: .5rem; --bs-btn-border-radius: .6rem; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; transition: transform .15s, background .2s, color .2s, border-color .2s, box-shadow .2s; }
.btn:active { transform: translateY(1px); }
.btn-sm { --bs-btn-padding-x: .7rem; --bs-btn-padding-y: .3rem; --bs-btn-font-size: .8rem; --bs-btn-border-radius: .5rem; }
.btn-primary { --bs-btn-bg: var(--ink); --bs-btn-border-color: var(--ink); --bs-btn-color: var(--paper); --bs-btn-hover-bg: var(--accent); --bs-btn-hover-border-color: var(--accent); --bs-btn-hover-color: var(--accent-ink); --bs-btn-active-bg: var(--accent); --bs-btn-active-border-color: var(--accent); --bs-btn-active-color: var(--accent-ink); --bs-btn-disabled-bg: var(--line); --bs-btn-disabled-border-color: var(--line); --bs-btn-disabled-color: var(--muted); }
.btn-accent { --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-color: var(--accent-ink); --bs-btn-hover-bg: var(--ink); --bs-btn-hover-border-color: var(--ink); --bs-btn-hover-color: var(--paper); --bs-btn-active-bg: var(--ink); --bs-btn-active-color: var(--paper); box-shadow: 0 8px 20px -10px var(--accent); }
.btn-ghost { --bs-btn-bg: var(--card); --bs-btn-border-color: var(--line); --bs-btn-color: var(--ink); --bs-btn-hover-bg: var(--card); --bs-btn-hover-border-color: var(--ink); --bs-btn-hover-color: var(--ink); --bs-btn-active-bg: var(--line-2); --bs-btn-active-border-color: var(--ink); --bs-btn-active-color: var(--ink); }
.btn-ghost-danger { --bs-btn-bg: transparent; --bs-btn-border-color: color-mix(in srgb, var(--crimson) 35%, transparent); --bs-btn-color: var(--crimson); --bs-btn-hover-bg: var(--crimson); --bs-btn-hover-border-color: var(--crimson); --bs-btn-hover-color: var(--card); --bs-btn-active-bg: var(--crimson); --bs-btn-active-color: var(--card); }
.btn-ghost-success { --bs-btn-bg: transparent; --bs-btn-border-color: color-mix(in srgb, var(--forest) 40%, transparent); --bs-btn-color: var(--forest); --bs-btn-hover-bg: var(--forest); --bs-btn-hover-border-color: var(--forest); --bs-btn-hover-color: var(--card); --bs-btn-active-bg: var(--forest); --bs-btn-active-color: var(--card); }
.btn-ghost-warning { --bs-btn-bg: transparent; --bs-btn-border-color: color-mix(in srgb, var(--gold) 45%, transparent); --bs-btn-color: var(--gold); --bs-btn-hover-bg: var(--gold); --bs-btn-hover-border-color: var(--gold); --bs-btn-hover-color: var(--card); --bs-btn-active-bg: var(--gold); --bs-btn-active-color: var(--card); }
.page-actions .btn-sm { --bs-btn-padding-x: 1rem; --bs-btn-padding-y: .5rem; --bs-btn-font-size: .9rem; --bs-btn-border-radius: .6rem; }
.page-actions { align-items: center; }
.btn-link { --bs-btn-color: var(--muted); --bs-btn-hover-color: var(--ink); text-decoration: none; }

/* ---------- forms ---------- */
.form-label { font-size: .78rem; font-weight: 600; letter-spacing: .04em; color: var(--ink-2); margin-bottom: .35rem; }
.form-control, .form-select { background-color: var(--card); border-color: var(--line); color: var(--ink); border-radius: .6rem; padding: .6rem .85rem; transition: border-color .2s, box-shadow .2s; }
.form-control::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.form-control:focus, .form-select:focus { background-color: var(--card); color: var(--ink); border-color: var(--accent); box-shadow: 0 0 0 .22rem var(--accent-soft); }
.form-control-sm, .form-select-sm { padding: .32rem .6rem; font-size: .82rem; border-radius: .5rem; }
.form-check-input { border-color: var(--line); background-color: var(--card); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-check-input:focus { box-shadow: 0 0 0 .2rem var(--accent-soft); border-color: var(--accent); }
.form-text { color: var(--muted); }
.form-section { font-family: var(--font-display); font-size: 1rem; font-weight: 600; margin: .4rem 0 .8rem; padding-bottom: .4rem; border-bottom: 1px dashed var(--line); }

/* segmented radio (role picker) */
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.segmented input { position: absolute; opacity: 0; }
.segmented label { display: flex; gap: .7rem; align-items: center; padding: .8rem .9rem; border: 1px solid var(--line); border-radius: .8rem; cursor: pointer; background: var(--card); transition: border-color .2s, background .2s; }
.segmented label b { display: block; font-size: .9rem; }
.segmented label span { font-size: .74rem; color: var(--muted); }
.segmented input:checked + label { border-color: var(--accent); background: var(--accent-soft); }
.segmented input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- flash messages ---------- */
.toast-stack { position: fixed; top: 1rem; right: 1rem; z-index: 1090; display: grid; gap: .6rem; width: min(380px, calc(100vw - 2rem)); pointer-events: none; }
.toast-stack > * { pointer-events: auto; } /* clicks pass through the empty stack once a toast has faded */
.flash { display: flex; gap: .7rem; align-items: flex-start; padding: .85rem 1rem; margin: 0; border-radius: .85rem; border: 1px solid var(--line); border-left: 4px solid var(--f, var(--ink)); background: var(--card); color: var(--ink); box-shadow: var(--shadow-lg); animation: toast-in .45s cubic-bezier(.2, .8, .2, 1) both; }
.flash .ico { color: var(--f); margin-top: .1rem; }
.flash .btn-close { margin-left: auto; transform: scale(.75); }
.flash-success { --f: var(--forest); animation: toast-in .45s cubic-bezier(.2, .8, .2, 1) both, toast-out .5s ease 6s forwards; }
.flash-danger { --f: var(--crimson); } .flash-warning { --f: var(--gold); } .flash-info { --f: var(--sky); }
[data-bs-theme="dark"] .btn-close { filter: invert(1) grayscale(1) brightness(2); }

/* ---------- tickets (exams & bookings look like admission tickets) ---------- */
.ticket { position: relative; display: grid; grid-template-columns: 92px 1fr; background: var(--card); border: 1px solid var(--line); border-radius: 1rem; box-shadow: var(--shadow); transition: transform .25s, box-shadow .25s; height: 100%; }
.ticket:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.ticket::before, .ticket::after { content: ""; position: absolute; left: 83px; width: 18px; height: 18px; border-radius: 50%; background: var(--paper); border: 1px solid var(--line); }
.ticket::before { top: -10px; clip-path: inset(50% 0 0 0); }
.ticket::after { bottom: -10px; clip-path: inset(0 0 50% 0); }
.ticket-stub { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1rem .4rem; border-right: 2px dashed var(--line); border-radius: 1rem 0 0 1rem; background: linear-gradient(160deg, var(--accent-soft), transparent 80%); text-align: center; }
.ticket-stub .day { font-family: var(--font-display); font-size: 2.1rem; font-weight: 600; line-height: 1; color: var(--accent); }
.ticket-stub .mon { font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; font-weight: 700; color: var(--ink-2); margin-top: .2rem; }
.ticket-stub .yr { font-family: var(--font-mono); font-size: .68rem; color: var(--muted); }
.ticket-body { padding: 1rem 1.15rem; display: flex; flex-direction: column; gap: .45rem; min-width: 0; }
.ticket-body h3 { font-size: 1.12rem; margin: 0; font-weight: 600; }
.ticket-meta { display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: .8rem; color: var(--muted); }
.ticket-meta span { display: inline-flex; align-items: center; gap: .3rem; }
.ticket-foot { margin-top: auto; padding-top: .55rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; border-top: 1px solid var(--line-2); }
.ticket.is-muted { opacity: .62; }
.ticket.is-muted .ticket-stub { background: var(--line-2); }
.ticket.is-muted .ticket-stub .day { color: var(--muted); }

/* seat meter */
.meter { display: flex; align-items: center; gap: .55rem; font-size: .78rem; color: var(--muted); }
.meter-track { width: 84px; height: 6px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 99px; background: var(--forest); width: var(--w); transition: width .6s; }
.meter-fill.is-full { background: var(--gold); }

/* window timeline (admin exam page) */
.window { margin: .9rem 0 1rem; }
.window-track { position: relative; height: 8px; border-radius: 99px; background: var(--line-2); }
.window-fill { position: absolute; inset: 0 auto 0 0; width: var(--p); border-radius: 99px; background: linear-gradient(90deg, var(--accent-soft), var(--accent)); }
.window-now { position: absolute; top: 50%; left: var(--p); width: 14px; height: 14px; border-radius: 50%; background: var(--card); border: 3px solid var(--accent); transform: translate(-50%, -50%); }
.window-dates { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: .72rem; color: var(--muted); margin-top: .45rem; }

/* score ring (CSS only: conic-gradient) */
.ring { --p: 0; position: relative; width: 112px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--line-2) 0); animation: ring-in 1.1s cubic-bezier(.2, .8, .2, 1) both; }
.ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--card); }
.ring b { position: relative; font-family: var(--font-display); font-size: 1.8rem; font-weight: 600; line-height: 1; text-align: center; }
.ring b small { display: block; font-family: var(--font-body); font-size: .7rem; font-weight: 500; color: var(--muted); }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: .2rem .8rem; font-size: .84rem; margin-bottom: .65rem; }
.bar-row .track { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.bar-row .track div { height: 100%; width: var(--w); background: var(--ink); border-radius: 99px; animation: grow 1s cubic-bezier(.2, .8, .2, 1) both; }

/* list rows */
.list-row { display: flex; align-items: center; gap: .8rem; padding: .8rem 0; border-bottom: 1px solid var(--line-2); }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }

/* empty state */
.empty { text-align: center; padding: 2.4rem 1rem; color: var(--muted); }
.empty .ico { width: 2.4rem; height: 2.4rem; stroke-width: 1.3; color: var(--accent); margin-bottom: .6rem; }
.empty h3 { font-size: 1.15rem; color: var(--ink); margin-bottom: .25rem; }

/* filter bar */
.filter-bar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; padding: .7rem; background: var(--card); border: 1px solid var(--line); border-radius: 1rem; box-shadow: var(--shadow); margin-bottom: 1.4rem; }
.filter-bar .search { position: relative; flex: 1 1 240px; }
.filter-bar .search .ico { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.filter-bar .search input { padding-left: 2.3rem; }
.filter-bar .form-select { width: auto; }
.chip-check input { position: absolute; opacity: 0; }
.chip-check label { display: inline-flex; align-items: center; gap: .35rem; padding: .5rem .85rem; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: .85rem; font-weight: 500; }
.chip-check input:checked + label { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip-check input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- CSS tooltips: add data-tip="..." to any element ---------- */
[data-tip] { position: relative; }
[data-tip]::after { --x: -50%; content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(var(--x)) scale(.92); padding: .38rem .6rem; border-radius: .45rem; background: var(--ink); color: var(--paper); font: 500 .74rem/1.3 var(--font-body); letter-spacing: 0; text-transform: none; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .15s, transform .15s; z-index: 60; box-shadow: var(--shadow); }
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translateX(var(--x)); }
/* ui.js sets these near a screen or table edge, so a tip is never cut off */
[data-tip-x="start"]::after { left: 0; --x: 0px; }
[data-tip-x="end"]::after { left: auto; right: 0; --x: 0px; }
[data-tip-y="below"]::after { bottom: auto; top: calc(100% + 8px); }

/* ---------- auth (split screen) ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
@media (max-width: 991.98px) { .auth { grid-template-columns: 1fr; } .auth-hero { display: none !important; } }
.auth-hero { position: relative; overflow: hidden; padding: 3rem clamp(2rem, 5vw, 4.5rem); display: flex; flex-direction: column; justify-content: space-between; color: #f4eee2; background: radial-gradient(800px 500px at 110% 0%, rgba(210, 67, 42, .55), transparent 60%), radial-gradient(600px 400px at -10% 100%, rgba(45, 91, 138, .5), transparent 60%), #111a2e; }
.auth-hero::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(244, 238, 226, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(244, 238, 226, .06) 1px, transparent 1px); background-size: 44px 44px; mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent); }
.auth-hero > * { position: relative; }
.auth-hero .brand { color: #f4eee2; padding: 0; }
.auth-hero .brand-mark { background: #f4eee2; color: #111a2e; }
.auth-hero .brand-name small { color: rgba(244, 238, 226, .6); }
.auth-hero h1 { color: #f4eee2; font-size: clamp(2.4rem, 4.4vw, 4rem); line-height: 1; font-weight: 500; margin: 0 0 1rem; }
.auth-hero h1 em { color: #ff8a6e; }
.auth-hero p { color: rgba(244, 238, 226, .72); max-width: 44ch; font-size: 1.02rem; }
.auth-hero .facts { display: flex; gap: 2rem; font-size: .8rem; color: rgba(244, 238, 226, .6); }
.auth-hero .facts b { display: block; font-family: var(--font-display); font-size: 1.6rem; color: #f4eee2; font-weight: 500; }

/* floating timetable illustration */
.timetable { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; max-width: 460px; margin: 2rem 0; }
.timetable span { height: 34px; border-radius: 8px; background: rgba(244, 238, 226, .07); border: 1px solid rgba(244, 238, 226, .08); animation: float-in .7s cubic-bezier(.2, .8, .2, 1) both; }
.timetable span.on { background: rgba(255, 138, 110, .85); border-color: transparent; box-shadow: 0 6px 20px -6px rgba(255, 108, 76, .8); }
.timetable span.half { background: rgba(244, 238, 226, .22); }
.timetable span:nth-child(5n+1) { animation-delay: .05s; } .timetable span:nth-child(5n+2) { animation-delay: .12s; } .timetable span:nth-child(5n+3) { animation-delay: .19s; }
.timetable span:nth-child(5n+4) { animation-delay: .26s; } .timetable span:nth-child(5n) { animation-delay: .33s; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.25rem; position: relative; }
.auth-card { width: min(440px, 100%); }
.auth-card h2 { font-size: 2rem; font-weight: 600; margin-bottom: .3rem; }
.auth-card .lead-sm { color: var(--muted); margin-bottom: 1.6rem; }
.auth-theme { position: absolute; top: 1.2rem; right: 1.2rem; }

/* ---------- motion ---------- */
.reveal > * { animation: rise .6s cubic-bezier(.2, .75, .2, 1) both; }
.reveal > *:nth-child(2) { animation-delay: .06s; } .reveal > *:nth-child(3) { animation-delay: .12s; } .reveal > *:nth-child(4) { animation-delay: .18s; }
.reveal > *:nth-child(5) { animation-delay: .24s; } .reveal > *:nth-child(6) { animation-delay: .3s; } .reveal > *:nth-child(n+7) { animation-delay: .36s; }
.stagger > * { animation: rise .55s cubic-bezier(.2, .75, .2, 1) both; }
.stagger > *:nth-child(2) { animation-delay: .05s; } .stagger > *:nth-child(3) { animation-delay: .1s; } .stagger > *:nth-child(4) { animation-delay: .15s; }
.stagger > *:nth-child(5) { animation-delay: .2s; } .stagger > *:nth-child(6) { animation-delay: .25s; } .stagger > *:nth-child(n+7) { animation-delay: .3s; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes float-in { from { opacity: 0; transform: translateY(18px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); visibility: hidden; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 60%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes ring-in { from { background: conic-gradient(var(--accent) 0%, var(--line-2) 0); transform: rotate(-30deg); opacity: 0; } }
@keyframes grow { from { width: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- small screens ---------- */
@media (max-width: 575.98px) {
  .page-head { align-items: flex-start; }
  .stat-value { font-size: 2.1rem; }
  .top-search { display: none; }
  .ticket { grid-template-columns: 76px 1fr; }
  .ticket::before, .ticket::after { left: 67px; }
}
.ticket-body .pill { align-self: flex-start; }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; margin-top: 1rem; }
.form-select { padding-right: 2.4rem; }
.form-select-sm { padding-right: 2rem; }
