/* IBT Portal — exam-hall palette: navy ink, cool paper, and the four palette states. */
:root {
  --ink: #14304f;
  --ink-2: #24507f;
  --ink-soft: #e3ebf4;
  --bg: #eef2f6;
  --surface: #ffffff;
  --line: #cfd8e2;
  --line-soft: #e4e9ef;
  --text: #182330;
  --muted: #586779;
  --answered: #1d7a55;
  --answered-soft: #e2f2ea;
  --skipped: #b3261e;
  --skipped-soft: #fbe9e7;
  --review: #6a4bb5;
  --review-soft: #eee9fa;
  --amber: #a15c00;
  --amber-soft: #fff3dc;

  --font-ui: "Public Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --font-read: "Source Serif 4", "Iowan Old Style", Georgia, "Times New Roman", serif;

  --r-sm: 4px;
  --r-md: 8px;
  --gap: 1.25rem;
  --focus: 0 0 0 3px #ffffff, 0 0 0 5px var(--ink-2);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.55 var(--font-ui);
  font-feature-settings: "tnum" 0;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; color: var(--ink); }
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; font-weight: 600; }
p { margin: 0 0 .75rem; }
a { color: var(--ink-2); text-underline-offset: .15em; }
a:hover { color: var(--ink); }
code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.warn-text { color: var(--amber); font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.preserve { white-space: pre-line; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }

/* ── Top bar ───────────────────────────────────────── */
.topbar { background: var(--ink); color: #fff; }
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: .75rem 1.25rem;
  display: flex; align-items: center; gap: 2rem; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .7rem; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 6px;
  background:
    linear-gradient(var(--answered), var(--answered)) 3px 3px / 10px 10px no-repeat,
    linear-gradient(var(--review), var(--review)) 15px 3px / 10px 10px no-repeat,
    linear-gradient(#fff, #fff) 3px 15px / 10px 10px no-repeat,
    linear-gradient(var(--skipped), var(--skipped)) 15px 15px / 10px 10px no-repeat;
  background-color: rgba(255,255,255,.12);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1.05rem; }
.brand-text small { color: #b9c9dc; font-size: .78rem; }
.mainnav { display: flex; gap: .25rem; flex: 1; }
.mainnav a {
  color: #d7e2ee; text-decoration: none; padding: .45rem .8rem; border-radius: var(--r-sm); font-weight: 500;
}
.mainnav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.mainnav a.is-active { color: #fff; background: rgba(255,255,255,.14); }
.whoami { display: flex; align-items: center; gap: .75rem; margin-left: auto; font-size: .9rem; color: #d7e2ee; }
.topbar .btn-quiet { color: #fff; border-color: rgba(255,255,255,.35); background: transparent; }
.topbar .btn-quiet:hover { background: rgba(255,255,255,.1); }

/* ── Page scaffolding ──────────────────────────────── */
.page { max-width: 1200px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.page-head { margin-bottom: 1.5rem; }
.page-head-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.back { display: inline-block; margin-bottom: .5rem; font-size: .9rem; }
.section { margin-top: 2.5rem; }
.narrow { max-width: 440px; margin: 2rem auto; }
.narrow-wide { max-width: 760px; margin: 0 auto; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 1.5rem; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1.5rem; align-items: start; }
.sticky { position: sticky; top: 1rem; }
.flash {
  background: var(--answered-soft); border-left: 4px solid var(--answered);
  padding: .75rem 1rem; margin-bottom: 1.5rem; border-radius: var(--r-sm);
}
.alert {
  background: var(--skipped-soft); border-left: 4px solid var(--skipped); color: #6d1712;
  padding: .75rem 1rem; border-radius: var(--r-sm); margin-bottom: 1rem;
}
.alert ul { margin: .25rem 0 0; padding-left: 1.2rem; }
.validation-summary-valid { display: none; }
.empty {
  border: 1px dashed var(--line); border-radius: var(--r-md); padding: 2rem; text-align: center;
  color: var(--muted); background: rgba(255,255,255,.5);
}
.empty .btn { margin-top: .5rem; }

/* ── Buttons ───────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: 600 .95rem/1 var(--font-ui); padding: .7rem 1.1rem; min-height: 42px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--ink-2); color: var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-2); border-color: var(--ink-2); color: #fff; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--ink-soft); border-color: transparent; }
.btn-flag { border-color: var(--review); color: var(--review); }
.btn-flag:hover { background: var(--review-soft); border-color: var(--review); color: var(--review); }
.btn-submit { background: var(--answered); border-color: var(--answered); color: #fff; }
.btn-submit:hover { background: #166445; border-color: #166445; color: #fff; }
.btn-small { min-height: 32px; padding: .4rem .7rem; font-size: .85rem; }
.btn-block { width: 100%; }
.actions { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }
.linklike {
  background: none; border: 0; padding: 0; font: inherit; color: var(--ink-2);
  text-decoration: underline; text-underline-offset: .15em; cursor: pointer;
}
.linklike:disabled { color: var(--muted); text-decoration: none; cursor: default; opacity: .6; }
.danger { color: var(--skipped); }
.row-actions { display: flex; gap: .9rem; flex-wrap: wrap; align-items: center; font-size: .9rem; }
.row-actions form { display: inline; margin: 0; }

/* ── Forms ─────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 1rem; }
.form-wide { max-width: 820px; }
.form fieldset { border: 0; padding: 0; margin: 0 0 .75rem; display: flex; flex-direction: column; gap: 1rem; }
.form legend { font-weight: 700; color: var(--ink); font-size: 1.05rem; margin-bottom: .75rem; }
.form label, .option-editor .label { display: flex; flex-direction: column; gap: .35rem; font-weight: 600; font-size: .92rem; }
.form label .muted { font-weight: 400; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  font: 400 1rem/1.4 var(--font-ui); color: var(--text);
  padding: .6rem .7rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; width: 100%;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink-2); box-shadow: 0 0 0 3px var(--ink-soft); }
.input-validation-error { border-color: var(--skipped) !important; }
.field-error { color: var(--skipped); font-weight: 500; font-size: .85rem; }
.field-error:empty { display: none; }
.hint { color: var(--muted); font-weight: 400; font-size: .85rem; }
.form label.check, label.check { flex-direction: row; align-items: flex-start; gap: .6rem; font-weight: 400; font-size: 1rem; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; margin: .2rem 0 0; accent-color: var(--ink); flex: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.filter { display: flex; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.filter select, .filter input { min-width: 240px; }
.option-editor { display: flex; flex-direction: column; gap: .45rem; }
.option-edit-row { display: grid; grid-template-columns: auto auto 1fr; gap: .6rem; align-items: center; }
.option-edit-row input[type=checkbox] { margin: 0; accent-color: var(--answered); }

/* ── Tables ────────────────────────────────────────── */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.table th, .table td { text-align: left; padding: .7rem .9rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table thead th { font-size: .82rem; font-weight: 600; color: var(--muted); background: #f7f9fb; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfd; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-compact th, .table-compact td { padding: .45rem .6rem; }
.panel .table-wrap, .dialog .table { border: 1px solid var(--line-soft); }
.row-disabled td { color: var(--muted); }

.pill { display: inline-block; font-size: .8rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; white-space: nowrap; }
.pill-ok { background: var(--answered-soft); color: var(--answered); }
.pill-bad { background: var(--skipped-soft); color: var(--skipped); }
.pill-muted { background: var(--line-soft); color: var(--muted); }
.pill-live { background: var(--amber-soft); color: var(--amber); }

/* ── Facts & stats ─────────────────────────────────── */
.facts { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; margin: .5rem 0 0; }
.facts div { display: flex; gap: .35rem; align-items: baseline; }
.facts dt { color: var(--muted); font-size: .85rem; }
.facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.facts-large { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin: 1rem 0 1.5rem; }
.facts-large div { flex-direction: column; gap: .15rem; padding-left: .8rem; border-left: 3px solid var(--line); }
.facts-large dd { font-size: 1.15rem; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.stat {
  display: flex; flex-direction: column-reverse; gap: .25rem; padding: 1.1rem 1.2rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  text-decoration: none; color: var(--text);
}
a.stat:hover { border-color: var(--ink-2); color: var(--text); }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-value small { font-size: .95rem; font-weight: 500; color: var(--muted); }
.stat-label { color: var(--muted); font-size: .9rem; }
.stats-small { margin-bottom: 1.5rem; }
.stats-small .stat-value { font-size: 1.5rem; }

/* ── Landing ───────────────────────────────────────── */
.landing { display: grid; grid-template-columns: 1.1fr 1fr; gap: 3rem; align-items: center; padding: 2.5rem 0; }
.landing h1 { font-size: clamp(2rem, 4vw, 2.9rem); line-height: 1.1; letter-spacing: -.02em; max-width: 16ch; }
.lede { font-size: 1.12rem; color: var(--muted); max-width: 52ch; }
.landing-steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: .6rem; }
.landing-steps li {
  counter-increment: step; display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto;
  column-gap: 1rem; padding: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
}
.landing-steps li::before {
  content: counter(step); grid-row: span 2; width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: 6px; font-weight: 700; color: #fff; background: var(--ink);
}
.landing-steps li:nth-child(2)::before { background: var(--line); color: var(--ink); }
.landing-steps li:nth-child(3)::before { background: var(--review); }
.landing-steps li:nth-child(4)::before { background: var(--answered); }
.landing-steps span { color: var(--muted); font-size: .92rem; }

/* ── Candidate test list ───────────────────────────── */
.test-list { display: flex; flex-direction: column; gap: .75rem; }
.test-row {
  display: flex; justify-content: space-between; align-items: center; gap: 1.5rem;
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--ink);
  border-radius: var(--r-md); padding: 1.2rem 1.4rem;
}
.test-row h2 { margin-bottom: .25rem; }
.test-row-action { display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; text-align: right; flex: none; }
.status-note { color: var(--muted); font-size: .92rem; max-width: 24ch; }
.prose-list { padding-left: 1.2rem; }
.prose-list li { margin-bottom: .35rem; }
.start-form { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line-soft); }

/* ── Exam screen ───────────────────────────────────── */
.exam-body { background: var(--bg); user-select: none; -webkit-user-select: none; }
.exam-body input, .exam-body textarea { user-select: text; }
.exam { min-height: 100vh; display: flex; flex-direction: column; }
.exam-bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .6rem 1.25rem; background: var(--ink); color: #fff;
}
.exam-title { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.exam-title strong { font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exam-title span { color: #b9c9dc; font-size: .85rem; }

/* The timer is the one loud thing on the screen. */
.timer {
  display: flex; align-items: baseline; gap: .6rem; padding: .35rem .9rem;
  border-radius: var(--r-sm); background: rgba(255,255,255,.1); transition: background-color .3s;
}
.timer-label { font-size: .8rem; color: #b9c9dc; }
.timer-value { font: 700 1.9rem/1 var(--font-ui); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.timer-low { background: var(--amber); }
.timer-low .timer-label, .timer-critical .timer-label { color: #fff; }
.timer-critical { background: var(--skipped); animation: pulse 1s steps(2, jump-none) infinite; }
@keyframes pulse { 50% { background: #8e1d17; } }

.exam-notices { max-width: 1280px; width: 100%; margin: 0 auto; padding: 0 1.25rem; }
.notice { margin: .75rem 0 0; padding: .6rem .9rem; border-radius: var(--r-sm); font-size: .92rem; }
.notice-net { background: var(--amber-soft); color: #6b3d00; border-left: 4px solid var(--amber); }
.notice-focus { background: var(--skipped-soft); color: #6d1712; border-left: 4px solid var(--skipped); }

.exam-grid {
  flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.25rem;
  max-width: 1280px; width: 100%; margin: 0 auto; padding: 1.25rem;
}
.qpane {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 1.5rem 1.75rem; display: flex; flex-direction: column;
}
.qmeta { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; padding-bottom: .9rem; border-bottom: 1px solid var(--line-soft); }
.qnum { font-size: 1.05rem; margin: 0; }
.qsection { color: var(--muted); font-size: .9rem; }
.qmarks { margin-left: auto; font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.qtext {
  font: 400 1.22rem/1.65 var(--font-read); color: var(--text); white-space: pre-wrap;
  max-width: 68ch; margin: 1.25rem 0 .5rem; outline: none;
}
.qtext-small { font-size: 1.05rem; margin: .5rem 0; }
.qhint { color: var(--muted); font-size: .88rem; margin-bottom: 1rem; }
.options { border: 0; padding: 0; margin: 0 0 1.5rem; display: flex; flex-direction: column; gap: .55rem; max-width: 72ch; }
.option {
  display: grid; grid-template-columns: auto auto 1fr; gap: .8rem; align-items: start;
  padding: .8rem 1rem; border: 1px solid var(--line); border-radius: var(--r-md); cursor: pointer; background: #fff;
}
.option:hover { border-color: var(--ink-2); background: #fbfcfe; }
.option:has(input:checked) { border-color: var(--ink); background: var(--ink-soft); box-shadow: inset 3px 0 0 var(--ink); }
.option:has(input:focus-visible) { box-shadow: var(--focus); }
.option input { margin-top: .3rem; }
.option-key {
  display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 4px; flex: none;
  font-weight: 700; font-size: .85rem; color: var(--ink); background: var(--line-soft);
}
.option-text { font: 400 1.05rem/1.55 var(--font-read); white-space: pre-wrap; }
.qactions { margin-top: auto; display: flex; gap: .6rem; flex-wrap: wrap; padding-top: 1rem; border-top: 1px solid var(--line-soft); }
.qactions .spacer { flex: 1; }

.palette {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 1.1rem; align-self: start; position: sticky; top: 76px;
}
.palette h2 { font-size: 1rem; }
.palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: .4rem; max-height: 46vh; overflow-y: auto; padding: 3px; }
.pal {
  position: relative; height: 40px; border-radius: 6px; cursor: pointer;
  font: 600 .9rem/1 var(--font-ui); font-variant-numeric: tabular-nums;
  border: 1px solid var(--line); background: #fff; color: var(--text);
}
.pal:hover { border-color: var(--ink-2); }
.pal-answered { background: var(--answered); border-color: var(--answered); color: #fff; }
.pal-skipped { background: var(--skipped); border-color: var(--skipped); color: #fff; border-radius: 6px 6px 16px 16px; }
.pal-review { background: var(--review); border-color: var(--review); color: #fff; border-radius: 50%; }
.pal-answered-review { background: var(--review); border-color: var(--review); color: #fff; border-radius: 50%; }
.pal-answered-review::after, .chip-answered-dot::after {
  content: ""; position: absolute; right: 1px; bottom: 1px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--answered); border: 2px solid #fff;
}
.pal-current { outline: 3px solid var(--ink); outline-offset: 2px; }

.legend { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: .4rem; font-size: .86rem; }
.legend li { display: grid; grid-template-columns: 22px 1fr auto; gap: .55rem; align-items: center; }
.legend b { font-variant-numeric: tabular-nums; }
.chip { position: relative; width: 20px; height: 20px; border-radius: 4px; border: 1px solid var(--line); background: #fff; }
.chip-answered { background: var(--answered); border-color: var(--answered); }
.chip-skipped { background: var(--skipped); border-color: var(--skipped); border-radius: 4px 4px 9px 9px; }
.chip-review { background: var(--review); border-color: var(--review); border-radius: 50%; }
.chip-answered-dot::after { width: 9px; height: 9px; right: -3px; bottom: -3px; }

.dialog {
  border: 0; border-radius: var(--r-md); padding: 1.5rem; max-width: 420px; width: calc(100% - 2rem);
  box-shadow: 0 20px 60px rgba(20, 48, 79, .3);
}
.dialog::backdrop { background: rgba(20, 48, 79, .55); }
.dialog .table { margin: 1rem 0; }
.overlay { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(20, 48, 79, .8); }
.overlay[hidden] { display: none; }
.overlay-box { background: #fff; border-radius: var(--r-md); padding: 2rem; max-width: 420px; text-align: center; }

/* ── Results ───────────────────────────────────────── */
.scoreboard {
  display: grid; grid-template-columns: auto 1fr; gap: 2.5rem; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 1.5rem 2rem;
}
.score-main { display: flex; flex-direction: column; }
.score-value { font-size: 3.5rem; font-weight: 700; color: var(--ink); line-height: 1; font-variant-numeric: tabular-nums; }
.score-of { color: var(--muted); }
.scoreboard .facts-large { margin: 0; }

.review-list { list-style: none; padding: 0; margin: 0; counter-reset: rq; display: flex; flex-direction: column; gap: .75rem; }
.review-item {
  counter-increment: rq; background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--line); border-radius: var(--r-md); padding: 1rem 1.25rem;
}
.review-right { border-left-color: var(--answered); }
.review-wrong { border-left-color: var(--skipped); }
.review-head { display: flex; gap: 1rem; align-items: baseline; }
.review-head::before { content: "Q" counter(rq); font-weight: 700; color: var(--ink); }
.review-verdict { margin-left: auto; font-weight: 600; font-size: .9rem; }
.review-right .review-verdict { color: var(--answered); }
.review-wrong .review-verdict { color: var(--skipped); }
.review-skipped .review-verdict { color: var(--muted); }
.review-marks { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.review-options, .qlist-options { list-style: none; padding: 0; margin: .5rem 0; display: grid; gap: .3rem; }
.review-options li, .qlist-options li { display: flex; gap: .6rem; align-items: center; padding: .35rem .5rem; border-radius: var(--r-sm); flex-wrap: wrap; }
.opt-correct { background: var(--answered-soft); }
.opt-correct .option-key { background: var(--answered); color: #fff; }
.review-options .opt-chosen:not(.opt-correct) { background: var(--skipped-soft); }
.review-options .opt-chosen:not(.opt-correct) .option-key { background: var(--skipped); color: #fff; }
.tag { font-style: normal; font-size: .75rem; font-weight: 600; color: var(--muted); margin-left: auto; }
.tag-ok { color: var(--answered); margin-left: 0; }
.explanation { margin: .5rem 0 0; padding: .6rem .8rem; background: #f7f9fb; border-radius: var(--r-sm); font-size: .92rem; }

/* ── Admin question list ───────────────────────────── */
.qlist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .6rem; }
.qlist-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: .9rem 1.1rem; }
.qlist-item.is-editing { border-color: var(--ink); box-shadow: inset 4px 0 0 var(--ink); }
.qlist-head { display: flex; gap: .9rem; align-items: center; flex-wrap: wrap; }
.qlist-num {
  display: inline-grid; place-items: center; min-width: 1.8rem; height: 1.8rem; padding: 0 .3rem;
  border-radius: 4px; background: var(--ink); color: #fff; font-weight: 700; font-size: .85rem;
}
.qlist-text { font-family: var(--font-read); font-size: 1.02rem; margin: .5rem 0 .25rem; white-space: pre-wrap; }

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 960px) {
  .split, .landing { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .exam-grid { grid-template-columns: 1fr; }
  .palette { position: static; order: -1; }
  .palette-grid { max-height: none; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); }
  .legend { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .page { padding: 1.25rem 1rem 3rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .test-row { flex-direction: column; align-items: stretch; }
  .test-row-action { align-items: stretch; text-align: left; }
  .scoreboard { grid-template-columns: 1fr; gap: 1rem; }
  .qpane { padding: 1.1rem; }
  .qactions .btn { flex: 1 1 45%; }
  .qactions .spacer { display: none; }
  .timer-label { display: none; }
  .timer-value { font-size: 1.5rem; }
  .whoami .whoami-name { display: none; }
  .filter { flex-wrap: wrap; }
  .filter select, .filter input { min-width: 0; flex: 1; }
  .legend { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── Security & integrity additions ───────────────── */
.whoami-name { color: #d7e2ee; text-decoration: none; }
.whoami-name:hover { color: #fff; text-decoration: underline; }
.nowrap { white-space: nowrap; }
.row-flag td { background: #fff8f7; }
.row-flag td:first-child { box-shadow: inset 3px 0 0 var(--skipped); }

.exam-bar-status { display: flex; align-items: center; gap: .6rem; margin-left: auto; font-size: .85rem; }
.save-state { color: #bfe6d3; }
.save-state::before { content: "●"; margin-right: .35rem; color: #3fcf8e; }
.save-state.is-pending { color: #ffe2a8; }
.save-state.is-pending::before { color: #ffb020; }
.violation-meter { background: var(--skipped-soft); color: var(--skipped); font-weight: 700; padding: .15rem .55rem; border-radius: 999px; }
.violation-meter.is-last { background: var(--skipped); color: #fff; }

.qpane { position: relative; overflow: hidden; }
.qpane > *:not(.watermark) { position: relative; z-index: 1; }
.watermark {
  position: absolute; inset: -20%; z-index: 0; pointer-events: none;
  display: flex; flex-wrap: wrap; gap: 3.5rem 5rem; align-content: flex-start;
  transform: rotate(-24deg); opacity: .06; color: var(--ink);
  font: 600 1rem/1 var(--font-ui); white-space: nowrap; user-select: none;
}
.exam.is-hidden .exam-grid, .exam.is-hidden .exam-notices { filter: blur(14px); pointer-events: none; }
.blocker { margin-top: 4rem; }

.code-field input { max-width: 16rem; font: 600 1.2rem/1.2 ui-monospace, Consolas, monospace; letter-spacing: .15em; text-transform: uppercase; }
.start-form .code-field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; font-weight: 600; }

.inline-number { display: block; }
.inline-number input { width: 5rem; display: inline-block; margin: 0 .35rem; }

.security-strip { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin: 1rem 0; padding: .75rem 1rem;
  background: var(--skipped-soft); border-left: 4px solid var(--skipped); border-radius: var(--r-sm); }
.security-strip a { color: #6d1712; }

.release-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: 0 0 1rem; padding: .6rem .9rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.release-bar > span { margin-right: auto; }

.inline-form { display: flex; align-items: center; gap: .35rem; }
.inline-form input.input-tiny { width: 4.2rem; padding: .25rem .4rem; }
.inline-form input.input-small { width: 8rem; padding: .25rem .4rem; }

.qlist-item.is-flagged { border-color: var(--skipped); box-shadow: inset 4px 0 0 var(--skipped); }
.opt-bar-label { flex: 1 1 12rem; }
.opt-bar { width: 8rem; height: .7rem; }

/* Nothing on the exam screen or answer sheets goes to paper. */
@media print {
  .exam-body * { visibility: hidden !important; }
  .exam-body::after { content: "Printing is disabled during the test."; visibility: visible; display: block; padding: 2rem; font-size: 1.5rem; }
}

/* ── Admin shell with sidebar ─────────────────────── */
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.admin-body { background: var(--bg); }
.admin-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: .5rem;
  background: var(--ink); color: #d7e2ee; padding: 1rem .75rem;
}
.sidebar-brand { padding: .25rem .5rem .9rem; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: .25rem; }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-group { margin: .9rem .6rem .3rem; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #8fa6c0; }
.side-nav a {
  display: flex; align-items: center; gap: .65rem; padding: .5rem .6rem; border-radius: var(--r-sm);
  color: #d7e2ee; text-decoration: none; font-weight: 500; font-size: .93rem;
}
.side-nav a svg { width: 18px; height: 18px; fill: currentColor; opacity: .8; flex: none; }
.side-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.side-nav a.is-active { background: rgba(255,255,255,.14); color: #fff; box-shadow: inset 3px 0 0 #7fb3ff; }
.side-badge { margin-left: auto; min-width: 1.4rem; padding: 0 .4rem; border-radius: 999px; background: rgba(255,255,255,.18);
  color: #fff; font-size: .75rem; font-weight: 700; text-align: center; line-height: 1.4rem; }
.side-badge.is-alert { background: var(--skipped); }
.side-user { display: grid; grid-template-columns: auto 1fr; gap: .25rem .6rem; align-items: center;
  padding: .8rem .5rem .2rem; border-top: 1px solid rgba(255,255,255,.1); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: #2f5f94; color: #fff; font-weight: 700; font-size: .85rem; }
.side-user-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.side-user-text strong { color: #fff; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-text a { color: #9fc1e8; font-size: .8rem; }
.side-user form { grid-column: 1 / -1; }
.side-signout { width: 100%; color: #fff; border-color: rgba(255,255,255,.3); background: transparent; }
.side-signout:hover { background: rgba(255,255,255,.1); color: #fff; }
.admin-main { min-width: 0; display: flex; flex-direction: column; }
.admin-topbar { display: none; }
.admin-page { max-width: 1320px; width: 100%; }
.nav-scrim { display: none; }

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; left: 0; top: 0; width: 270px; transform: translateX(-100%); transition: transform .2s ease; }
  .nav-toggle:checked ~ .admin-shell .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  .nav-toggle:checked ~ .admin-shell .nav-scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(10,20,35,.45); }
  .admin-topbar { display: flex; align-items: center; gap: .75rem; position: sticky; top: 0; z-index: 20;
    padding: .55rem 1rem; background: var(--ink); color: #fff; }
  .nav-burger { cursor: pointer; background: none; border: 0; padding: 0; display: grid; place-items: center; width: 38px; height: 38px; border-radius: var(--r-sm); }
  .nav-burger svg { width: 22px; height: 22px; fill: #fff; }
  .nav-toggle:focus-visible ~ .admin-shell .nav-burger { box-shadow: var(--focus); }
  .admin-topbar-title { font-weight: 600; }
}

/* ── Sessions ───────────────────────────────────── */
.policy-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.policy-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: .9rem 1.1rem;
  display: flex; flex-direction: column; gap: .2rem; }
.policy-label { color: var(--muted); font-size: .85rem; }
.policy-card code { color: var(--muted); font-size: .78rem; }

/* ── Proctoring: exam screen ────────────────────── */
.proctor-panel { display: grid; grid-template-columns: 112px 1fr; gap: .35rem .75rem; align-items: center;
  margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line-soft); }
.proctor-panel[hidden] { display: none; }
.proctor-video { width: 112px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r-sm); background: #0d1b2a;
  transform: scaleX(-1); grid-row: span 2; }
.proctor-status { font-weight: 600; font-size: .9rem; }
.proctor-status::before { content: "●"; margin-right: .35rem; }
.proctor-status.is-ok { color: var(--answered); }
.proctor-status.is-bad { color: var(--skipped); }
.proctor-status.is-wait { color: var(--amber); }
.proctor-note { color: var(--muted); font-size: .78rem; }

/* ── Proctoring: system check ───────────────────── */
.syscheck { margin: 1.25rem 0; padding: 1rem 1.2rem; border: 1px solid var(--line); border-radius: var(--r-md); background: #f8fafc; }
.syscheck-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.25rem; align-items: start; }
.chk-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.chk { display: grid; grid-template-columns: 1.4rem 6.5rem 1fr; align-items: baseline; gap: .4rem; }
.chk::before { font-weight: 700; }
.chk.is-ok::before { content: "✓"; color: var(--answered); }
.chk.is-bad::before { content: "✕"; color: var(--skipped); }
.chk.is-wait::before { content: "…"; color: var(--amber); }
.chk-name { font-weight: 600; }
.chk.is-bad .chk-text { color: #6d1712; }
.check-cam { display: flex; flex-direction: column; gap: .5rem; align-items: center; }
.check-cam .proctor-video { width: 240px; }
@media (max-width: 640px) { .syscheck-grid { grid-template-columns: 1fr; } .check-cam .proctor-video { width: 100%; } }
.check-top { align-self: end; }

/* ── Proctoring: admin ──────────────────────────── */
.cam-cell { min-width: 120px; }
.cam-thumb { width: 112px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r-sm); background: #0d1b2a;
  display: inline-grid; place-items: center; color: #9fb3c8; font-size: .72rem; }
.cam-thumb-sm { width: 72px; }
.review-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.review-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); overflow: hidden; text-decoration: none; color: var(--text); }
.review-card:hover { border-color: var(--ink-2); box-shadow: 0 2px 10px rgba(20,48,79,.1); color: var(--text); }
.review-card img, .review-card-nophoto { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #0d1b2a; }
.review-card-nophoto { display: grid; place-items: center; color: #9fb3c8; font-size: .85rem; }
.review-card-body { display: flex; flex-direction: column; gap: .2rem; padding: .7rem .85rem; }
.review-card-pills { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .25rem; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.photo { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.photo img { width: 100%; display: block; aspect-ratio: 4 / 3; object-fit: cover; }
.photo figcaption { font-size: .75rem; padding: .3rem .45rem; color: var(--muted); }
.photo.is-warn { border: 2px solid var(--skipped); }
.photo.is-warn figcaption { color: var(--skipped); font-weight: 600; }

/* The hidden attribute must always win over component display rules (e.g. .btn). */
[hidden] { display: none !important; }
.start-form label.check { display: flex; margin: 0 0 .75rem; }
