/* ==========================================================================
   Data Analyst / Data Science Placement Assessment Portal
   Shared stylesheet - clean, corporate, desktop-first.
   ========================================================================== */

:root {
  --navy-900: #0f2038;
  --navy-800: #16304f;
  --navy-700: #1e3a5f;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-50:  #eff6ff;

  --slate-900: #0f172a;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50:  #f8fafc;

  --green-600: #16a34a;
  --green-100: #dcfce7;
  --amber-600: #d97706;
  --amber-100: #fef3c7;
  --red-600:   #dc2626;
  --red-100:   #fee2e2;
  --purple-600:#7c3aed;
  --purple-100:#ede9fe;

  --surface: #fff;
  --primary-hover: #1d4ed8;
  --focus-ring: rgba(59, 130, 246, .15);
  --current-ring: rgba(37, 99, 235, .2);
  --tint-red-bg: #fef2f2;
  --tint-red-line: #fecaca;
  --tint-red-ink: #7f1d1d;
  --tint-amber-bg: #fffbeb;
  --tint-amber-line: #fde68a;
  --tint-amber-ink: #78350f;
  --tint-green-bg: #f0fdf4;
  --tint-green-line: #bbf7d0;
  --tint-green-strong: #86efac;
  --tint-green-ink: #14532d;
  --tint-blue-line: #bfdbfe;
  --tint-blue-ink: #1e3a8a;

  --answered:   #16a34a;
  --unanswered: #ffffff;
  --review:     #7c3aed;
  --current:    #2563eb;

  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 32, 56, .06), 0 1px 3px rgba(15, 32, 56, .08);
  --shadow-md: 0 4px 12px rgba(15, 32, 56, .08);
  --shadow-lg: 0 12px 32px rgba(15, 32, 56, .14);

  --font: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--slate-900);
  background: var(--slate-100);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 650; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p  { margin: 0 0 .75rem; }
a  { color: var(--blue-600); }

.muted   { color: var(--slate-500); }
.small   { font-size: .85rem; }
.tiny    { font-size: .78rem; }
.center  { text-align: center; }
.right   { text-align: right; }
.mono    { font-family: var(--mono); }
.nowrap  { white-space: nowrap; }
.hidden  { display: none !important; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: .75rem; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.grow { flex: 1; }

/* ------------------------------------------------------------- buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .6rem 1.1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 600;
  font-size: .92rem;
  cursor: pointer;
  background: var(--slate-200);
  color: var(--slate-700);
  transition: background .12s ease, border-color .12s ease, color .12s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--slate-300); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--blue-600); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-dark { background: var(--navy-700); color: #fff; }
.btn-dark:hover:not(:disabled) { background: var(--navy-800); }
.btn-success { background: var(--green-600); color: #fff; }
.btn-success:hover:not(:disabled) { background: #15803d; }
.btn-danger { background: var(--red-600); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-outline { background: var(--surface); border-color: var(--slate-300); color: var(--slate-700); }
.btn-outline:hover:not(:disabled) { background: var(--slate-50); border-color: var(--slate-400); }
.btn-ghost { background: transparent; color: var(--slate-600); }
.btn-ghost:hover:not(:disabled) { background: var(--slate-200); }
.btn-sm { padding: .35rem .7rem; font-size: .82rem; }
.btn-block { width: 100%; }

/* -------------------------------------------------------------- inputs --- */
label { display: block; font-weight: 600; font-size: .87rem; margin-bottom: .3rem; color: var(--slate-700); }
input[type=text], input[type=email], input[type=password], input[type=number],
select, textarea {
  width: 100%;
  padding: .6rem .75rem;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius);
  font: inherit;
  font-size: .92rem;
  background: var(--surface);
  color: var(--slate-900);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
textarea { min-height: 84px; resize: vertical; }
/* Code fields upper-case what is typed; their hint text should stay as written. */
::placeholder { text-transform: none; }
.field + .field { margin-top: .9rem; }
.field-hint { font-size: .8rem; color: var(--slate-500); margin-top: .25rem; }
.checkbox { display: flex; gap: .6rem; align-items: flex-start; font-weight: 500; }
.checkbox input { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--blue-600); }

/* --------------------------------------------------------------- cards --- */
.card {
  background: var(--surface);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.4rem;
}
.card-head {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  margin: -1.4rem -1.4rem 1.1rem;
  padding: 1rem 1.4rem;
  border-bottom: 1px solid var(--slate-200);
  background: var(--slate-50);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.card-head h2, .card-head h3 { margin: 0; }

/* --------------------------------------------------------------- alerts -- */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid;
  font-size: .9rem;
  line-height: 1.5;
}
.alert-error   { background: var(--tint-red-bg); border-color: var(--tint-red-line); color: var(--tint-red-ink); }
.alert-warn    { background: var(--tint-amber-bg); border-color: var(--tint-amber-line); color: var(--tint-amber-ink); }
.alert-success { background: var(--tint-green-bg); border-color: var(--tint-green-line); color: var(--tint-green-ink); }
.alert-info    { background: var(--blue-50); border-color: var(--tint-blue-line); color: var(--tint-blue-ink); }

/* --------------------------------------------------------------- badges -- */
.badge {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.badge-pass    { background: var(--green-100); color: var(--tint-green-ink); }
.badge-fail    { background: var(--red-100);   color: var(--tint-red-ink); }
.badge-pending { background: var(--slate-200); color: var(--slate-600); }
.badge-info    { background: var(--blue-50);   color: var(--tint-blue-ink); }
.badge-warn    { background: var(--amber-100); color: var(--tint-amber-ink); }

/* --------------------------------------------------------------- tables -- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--slate-200); }
table { width: 100%; border-collapse: collapse; font-size: .88rem; background: var(--surface); }
th, td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--slate-200); }
th {
  background: var(--slate-50);
  font-weight: 650;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--slate-600);
  white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
}
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--blue-600); }
th.sortable::after { content: ""; }
th.sortable.asc::after  { content: " \25B2"; font-size: .7em; }
th.sortable.desc::after { content: " \25BC"; font-size: .7em; }
tbody tr:hover { background: var(--slate-50); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-empty { padding: 2.5rem; text-align: center; color: var(--slate-500); }

/* ======================================================================
   Auth pages (student login, admin login)
   ====================================================================== */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  background: var(--surface);
}
.auth-hero {
  background: linear-gradient(160deg, var(--navy-900), var(--navy-700) 60%, #24537f);
  color: #fff;
  padding: 3.5rem 3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-hero .eyebrow {
  text-transform: uppercase; letter-spacing: .14em; font-size: .75rem;
  opacity: .75; margin-bottom: .9rem; font-weight: 700;
}
.auth-hero h1 { font-size: 2.1rem; color: #fff; margin-bottom: 1rem; }
.auth-hero p { color: rgba(255,255,255,.8); max-width: 42ch; }
.hero-facts { margin-top: 2.2rem; display: grid; gap: .75rem; }
.hero-fact {
  display: flex; gap: .8rem; align-items: baseline;
  padding: .7rem .95rem;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: var(--radius);
}
.hero-fact b { font-size: 1.15rem; min-width: 3.6rem; }
.hero-fact span { color: rgba(255,255,255,.82); font-size: .88rem; }

.auth-panel {
  padding: 3.5rem 3rem;
  display: flex; flex-direction: column; justify-content: center;
}
.auth-form { width: 100%; max-width: 400px; margin: 0 auto; }

/* ======================================================================
   Instructions page
   ====================================================================== */
.page-shell { max-width: 980px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.page-shell.wide { max-width: 1400px; }

.topbar {
  background: var(--navy-800);
  color: #fff;
  padding: .85rem 1.5rem;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
.topbar .brand { font-weight: 650; font-size: .98rem; }
.topbar .brand small { display: block; font-weight: 400; font-size: .76rem; opacity: .7; }
.topbar-right { display: flex; align-items: center; gap: .9rem; font-size: .86rem; }

.rules { list-style: none; padding: 0; margin: 0; display: grid; gap: .55rem; }
.rules li {
  display: flex; gap: .7rem; align-items: flex-start;
  padding: .55rem .8rem;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  font-size: .92rem;
}
.rules li::before {
  content: "";
  flex: none; width: 7px; height: 7px; margin-top: .55rem;
  border-radius: 50%; background: var(--blue-600);
}
.rules li.warn { background: var(--tint-amber-bg); border-color: var(--tint-amber-line); }
.rules li.warn::before { background: var(--amber-600); }

.marking-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem;
}
.marking-tile {
  border: 1px solid var(--slate-200); border-radius: var(--radius);
  padding: .9rem; text-align: center; background: var(--surface);
}
.marking-tile b { display: block; font-size: 1.5rem; line-height: 1.2; }
.marking-tile span { font-size: .8rem; color: var(--slate-500); }
.marking-tile.pos b { color: var(--green-600); }
.marking-tile.neg b { color: var(--red-600); }

/* ======================================================================
   Test interface
   ====================================================================== */
.exam-body { background: var(--slate-100); min-height: 100vh; display: flex; flex-direction: column; }

.exam-header {
  background: var(--navy-800);
  color: #fff;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: .7rem 1.25rem;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-md);
}
.exam-title { font-weight: 650; font-size: .95rem; }
.exam-title small { display: block; font-weight: 400; font-size: .75rem; opacity: .72; }
.exam-section-pill {
  justify-self: center;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  padding: .35rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: .88rem;
}
.timer-box { justify-self: end; display: flex; align-items: center; gap: .7rem; }
.timer-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; opacity: .7; }
.timer {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: .04em;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.22);
  padding: .2rem .8rem;
  border-radius: var(--radius);
  font-variant-numeric: tabular-nums;
}
.timer.warning { background: #92400e; border-color: #f59e0b; }
.timer.danger  { background: #991b1b; border-color: #ef4444; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .62; } }

.exam-main {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1.25rem;
  padding: 1.25rem;
  max-width: 1500px;
  width: 100%;
  margin: 0 auto;
  align-items: start;
}

/* --- question panel --- */
.question-panel { background: var(--surface); border: 1px solid var(--slate-200); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; min-height: 560px; }
.question-head {
  padding: .9rem 1.4rem;
  border-bottom: 1px solid var(--slate-200);
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  background: var(--slate-50);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.question-counter { font-weight: 650; font-size: .95rem; }
.question-body { padding: 1.4rem; flex: 1; }
.passage {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  margin-bottom: 1.1rem;
  font-family: var(--mono);
  font-size: .84rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-x: auto;
}
.question-text { font-size: 1.02rem; line-height: 1.6; margin-bottom: 1.2rem; white-space: pre-wrap; }

.options { display: grid; gap: .6rem; }
.option {
  display: flex; align-items: flex-start; gap: .8rem;
  padding: .8rem 1rem;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius);
  cursor: pointer;
  background: var(--surface);
  transition: border-color .12s ease, background .12s ease;
}
.option:hover { border-color: var(--blue-500); background: var(--blue-50); }
.option.selected { border-color: var(--blue-600); background: var(--blue-50); }
.option input { flex: none; margin-top: .28rem; width: 17px; height: 17px; accent-color: var(--blue-600); }
.option .key {
  flex: none; font-weight: 700; color: var(--slate-500); min-width: 1.3rem;
}
.option.selected .key { color: var(--blue-600); }
.option .text { flex: 1; }
.option.disabled { cursor: default; opacity: .85; }
.option.disabled:hover { border-color: var(--slate-200); background: var(--surface); }
.option.correct { border-color: var(--green-600); background: var(--green-100); }
.option.wrong { border-color: var(--red-600); background: var(--red-100); }

.question-actions {
  border-top: 1px solid var(--slate-200);
  padding: .9rem 1.4rem;
  display: flex; justify-content: space-between; gap: .6rem; flex-wrap: wrap;
  background: var(--slate-50);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.action-group { display: flex; gap: .6rem; flex-wrap: wrap; }

/* --- practical tasks: brief and dataset on the left, editor on the right --- */
.task-main {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.25rem;
  padding: 1.25rem;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  align-items: start;
}
.task-panel { background: var(--surface); border: 1px solid var(--slate-200); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; min-width: 0; }
.task-body { padding: 1.1rem 1.4rem; flex: 1; min-width: 0; }
.task-title { font-size: 1.15rem; margin-bottom: .6rem; }
.task-tabs { display: flex; gap: .4rem; flex-wrap: wrap; }
.task-tab {
  display: inline-flex; align-items: center; gap: .35rem;
  border: 1.5px solid var(--slate-300); background: var(--surface); border-radius: var(--radius);
  padding: .3rem .6rem; font: inherit; font-size: .82rem; cursor: pointer; color: var(--slate-700);
}
.task-tab span { color: var(--slate-500); font-size: .75rem; }
.task-tab.answered { border-color: var(--answered); background: var(--green-100); }
.task-tab.current { border-color: var(--current); box-shadow: 0 0 0 2px var(--current-ring); }
.editor-label { font-weight: 650; margin: 0; }

.dataset { border-top: 1px solid var(--slate-200); margin-top: 1rem; padding-top: .9rem; }
.dataset-head { display: flex; flex-direction: column; gap: .15rem; margin-bottom: .6rem; }
.dataset-tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .5rem; }
.dataset-tab {
  border: 1px solid var(--slate-200); background: var(--slate-50); border-radius: 999px;
  padding: .2rem .7rem; font: inherit; font-size: .8rem; cursor: pointer; font-family: var(--mono);
}
.dataset-tab.current { background: var(--navy-700); border-color: var(--navy-700); color: #fff; }
.dataset-tab.current .muted { color: #cbd5e1; }
.dataset-schema { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .5rem; }
.col-chip { font-family: var(--mono); font-size: .74rem; background: var(--slate-100); border-radius: 4px; padding: .1rem .4rem; }
.col-chip i { color: var(--slate-500); font-style: normal; }
.dataset-table { max-height: 320px; overflow: auto; }
.data-grid { font-family: var(--mono); font-size: .76rem; }
.data-grid th, .data-grid td { padding: .3rem .55rem; white-space: nowrap; }
.data-grid th { text-transform: none; letter-spacing: 0; font-size: .74rem; }

.code-editor {
  width: 100%;
  min-height: 300px;
  resize: vertical;
  font-family: var(--mono);
  font-size: .86rem;
  line-height: 1.5;
  tab-size: 4;
  background: var(--slate-900);
  color: #e2e8f0;
  border-color: var(--slate-700);
  white-space: pre;
  overflow: auto;
}
.code-editor:focus { border-color: var(--blue-500); }
.code-editor[readonly] { opacity: .8; }
.editor-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: .7rem 0; }
.run-output { border-top: 1px dashed var(--slate-200); padding-top: .7rem; min-height: 3rem; }

/* File tasks (Excel, Power BI): steps, the handed-in file, questions. */
.file-steps { margin: 0 0 1rem; padding-left: 1.3rem; display: grid; gap: .7rem; }
.file-steps li { line-height: 1.5; }
.file-steps li > span { margin-right: .5rem; }
.file-pick { display: inline-flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .35rem; }
.file-pick input[type=file] { max-width: 100%; font-size: .85rem; }
.file-status { border: 1px solid var(--slate-200); border-radius: var(--radius); padding: .7rem .8rem; background: var(--slate-50); font-size: .88rem; margin-bottom: 1rem; }
.file-status.ok { border-color: var(--tint-green-strong); background: var(--tint-green-bg); }
.file-status.missing { border-style: dashed; }
.file-status ul { margin: .35rem 0 0; padding-left: 1.1rem; }
.file-questions-title { font-size: 1rem; margin: 0 0 .6rem; }
.file-questions { display: grid; gap: .8rem; }
.file-question label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .3rem; }
.file-question input, .file-question select { width: 100%; max-width: 22rem; }
.file-question .tiny { margin-left: .3rem; }
.run-error pre, .run-stdout {
  margin: .35rem 0 0; font-family: var(--mono); font-size: .78rem; white-space: pre-wrap; word-break: break-word;
}
.run-stdout { background: var(--slate-50); border: 1px solid var(--slate-200); border-radius: var(--radius); padding: .5rem .7rem; max-height: 180px; overflow: auto; }

/* --- palette --- */
.palette {
  background: var(--surface); border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  position: sticky; top: 78px;
  display: flex; flex-direction: column;
  max-height: calc(100vh - 100px);
}
.palette-head { padding: .9rem 1.1rem; border-bottom: 1px solid var(--slate-200); background: var(--slate-50); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.palette-head h3 { margin: 0; font-size: .95rem; }
.palette-body { padding: 1rem 1.1rem; overflow-y: auto; flex: 1; }
.palette-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; }
.pal-btn {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--slate-300);
  background: var(--surface);
  border-radius: var(--radius);
  font: inherit; font-weight: 650; font-size: .88rem;
  color: var(--slate-600);
  cursor: pointer;
  position: relative;
  transition: transform .1s ease;
}
.pal-btn:hover { transform: translateY(-1px); }
.pal-btn.answered { background: var(--answered); border-color: var(--answered); color: #fff; }
.pal-btn.review   { background: var(--review);   border-color: var(--review);   color: #fff; }
.pal-btn.review.answered { background: var(--review); border-color: var(--review); }
.pal-btn.review.answered::after {
  content: ""; position: absolute; right: 3px; bottom: 3px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--answered);
  border: 1.5px solid #fff;
}
.pal-btn.current { outline: 3px solid var(--current); outline-offset: 1px; }
/* Copy blocking on the exam page: the paper cannot be selected or printed;
   the answer boxes can. */
body.no-copy { -webkit-user-select: none; user-select: none; }
body.no-copy :is(input, textarea, select, [contenteditable="true"]) { -webkit-user-select: text; user-select: text; }
@media print {
  body.no-copy > * { display: none !important; }
  body.no-copy::before { content: 'Printing is switched off for this assessment.'; display: block; padding: 2rem; font-weight: 650; }
}

/* The random draw of tasks on the exam setup page. */
.pool-box { border: 1px solid var(--slate-200); background: var(--slate-50); border-radius: var(--radius); padding: .8rem 1rem; }

/* Screen captures are wide; give them room on the attempt page. */
.snap-grid.screen-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.clip-row { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-bottom: .5rem; }
.clip-row audio { height: 32px; max-width: 100%; }

/* The microphone check on the instructions page. */
.mic-check-meter { display: inline-block; width: 160px; height: 10px; border-radius: 5px; background: var(--slate-200); overflow: hidden; }
.mic-check-meter span { display: block; height: 100%; width: 0; background: var(--green-600, #16a34a); transition: width .1s linear; }

/* Screen-share and microphone indicators in the exam header. */
.rec-chip { display: inline-flex; align-items: center; gap: .35rem; font-size: .75rem; font-weight: 650; color: #fff; background: rgba(255,255,255,.12); border-radius: 999px; padding: .25rem .6rem; }
.rec-chip .cam-dot { position: static; }
.mic-meter { display: inline-block; width: 34px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.25); overflow: hidden; }
.mic-meter span { display: block; height: 100%; width: 0; background: #4ade80; transition: width .1s linear; }

/* Domain heading inside a technical section that covers several domains. */
.pal-part { grid-column: 1 / -1; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--slate-500); margin-top: .35rem; }
.pal-part:first-child { margin-top: 0; }

.legend { display: grid; gap: .4rem; margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--slate-200); }
.legend div { display: flex; align-items: center; gap: .55rem; font-size: .8rem; color: var(--slate-600); }
.legend i {
  width: 15px; height: 15px; border-radius: 4px; flex: none;
  border: 1.5px solid var(--slate-300); background: var(--surface);
}
.legend i.answered { background: var(--answered); border-color: var(--answered); }
.legend i.review   { background: var(--review);   border-color: var(--review); }
.legend i.both     { background: var(--review);   border-color: var(--review); position: relative; }
.legend i.both::after {
  content: ""; position: absolute; right: -2px; bottom: -2px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--answered); border: 1.5px solid #fff;
}
.legend i.current  { background: var(--surface); outline: 2px solid var(--current); outline-offset: 0; }

.palette-foot { padding: .9rem 1.1rem; border-top: 1px solid var(--slate-200); background: var(--slate-50); border-radius: 0 0 var(--radius-lg) var(--radius-lg); display: grid; gap: .5rem; }
.progress-line { display: flex; justify-content: space-between; font-size: .82rem; color: var(--slate-600); }
.progress-line b { color: var(--slate-900); }

/* --- section rail --- */
.section-rail {
  display: flex; gap: .5rem; padding: .6rem 1.25rem;
  background: var(--surface); border-bottom: 1px solid var(--slate-200);
  overflow-x: auto;
}
.rail-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .35rem .85rem;
  border-radius: 999px;
  border: 1px solid var(--slate-200);
  background: var(--slate-50);
  font-size: .82rem; font-weight: 600; color: var(--slate-500);
  white-space: nowrap;
}
.rail-item.active { background: var(--blue-50); border-color: var(--blue-600); color: var(--blue-600); }
.rail-item.done { background: var(--green-100); border-color: var(--tint-green-strong); color: var(--tint-green-ink); }
.rail-item .rail-count { font-weight: 500; opacity: .8; }

/* --- domain selection --- */
.domain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 1rem;
}
.domain-card {
  border: 2px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease;
  display: flex; flex-direction: column; gap: .55rem;
}
.domain-card:hover { border-color: var(--blue-500); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.domain-card.selected { border-color: var(--blue-600); background: var(--blue-50); box-shadow: var(--shadow-md); }
.domain-icon {
  width: 42px; height: 42px; border-radius: 10px;
  background: var(--navy-700); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .82rem; letter-spacing: .02em;
}
.domain-card.selected .domain-icon { background: var(--blue-600); }
.domain-card h3 { margin: 0; font-size: 1.05rem; }
.domain-card p { margin: 0; font-size: .86rem; color: var(--slate-600); }

/* --- modal --- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 32, 56, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem; z-index: 200;
}
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
}
.modal-head { padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--slate-200); }
.modal-head h2 { margin: 0; }
.modal-body { padding: 1.4rem; }
.modal-foot { padding: 1rem 1.4rem; border-top: 1px solid var(--slate-200); display: flex; justify-content: flex-end; gap: .6rem; background: var(--slate-50); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; margin: 1rem 0; }
.summary-tile { border: 1px solid var(--slate-200); border-radius: var(--radius); padding: .8rem; text-align: center; }
.summary-tile b { display: block; font-size: 1.6rem; line-height: 1.2; }
.summary-tile span { font-size: .78rem; color: var(--slate-500); }

/* --- toast --- */
.toast-host { position: fixed; top: 1rem; right: 1rem; z-index: 300; display: grid; gap: .5rem; max-width: 380px; }
.toast {
  padding: .7rem 1rem; border-radius: var(--radius);
  box-shadow: var(--shadow-md); font-size: .88rem;
  background: var(--navy-800); color: #fff;
  border: 1px solid rgba(255, 255, 255, .1);
}
.toast.warn  { background: #78350f; }
.toast.error { background: #7f1d1d; }
.toast.ok    { background: #14532d; }

/* ======================================================================
   Result page
   ====================================================================== */
.result-hero {
  background: linear-gradient(160deg, var(--navy-900), var(--navy-700));
  color: #fff; border-radius: var(--radius-lg);
  padding: 2rem; text-align: center;
}
.result-hero .score { font-size: 3.4rem; font-weight: 750; line-height: 1; }
.result-hero .score small { font-size: 1.4rem; font-weight: 500; opacity: .7; }
.result-hero .pct { font-size: 1.2rem; opacity: .85; margin-top: .4rem; }
.status-stamp {
  display: inline-block; margin-top: 1rem;
  padding: .45rem 1.6rem; border-radius: 999px;
  font-weight: 750; font-size: 1.05rem; letter-spacing: .06em;
}
.status-stamp.pass { background: var(--green-600); color: #fff; }
.status-stamp.fail { background: var(--red-600); color: #fff; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .9rem; }
.stat {
  background: var(--surface); border: 1px solid var(--slate-200);
  border-radius: var(--radius); padding: 1rem; text-align: center;
}
.stat b { display: block; font-size: 1.8rem; line-height: 1.15; }
.stat span { font-size: .8rem; color: var(--slate-500); }
.stat.ok b   { color: var(--green-600); }
.stat.bad b  { color: var(--red-600); }
.stat.skip b { color: var(--slate-400); }

.bar-row { display: grid; grid-template-columns: 190px 1fr 92px; gap: .9rem; align-items: center; padding: .5rem 0; }
.bar-track { height: 10px; background: var(--slate-200); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--blue-600); border-radius: 999px; transition: width .4s ease; }
.bar-fill.good { background: var(--green-600); }
.bar-fill.mid  { background: var(--amber-600); }
.bar-fill.low  { background: var(--red-600); }

/* ======================================================================
   Admin
   ====================================================================== */
.admin-nav {
  background: var(--navy-900); color: #fff;
  display: flex; align-items: center; gap: .3rem;
  padding: 0 1.25rem;
}
.admin-nav .brand { font-weight: 650; padding: .9rem 1rem .9rem 0; margin-right: .6rem; font-size: .95rem; }
.admin-nav a {
  color: rgba(255,255,255,.72); text-decoration: none;
  padding: .95rem .95rem; font-size: .88rem; font-weight: 500;
  border-bottom: 3px solid transparent;
}
.admin-nav a:hover { color: #fff; background: rgba(255,255,255,.06); }
.admin-nav a.active { color: #fff; border-bottom-color: var(--blue-500); }
.admin-nav .spacer { flex: 1; }
.admin-nav .who { font-size: .84rem; color: rgba(255,255,255,.7); padding-right: .8rem; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 1rem; }
.kpi {
  background: var(--surface); border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg); padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-sm);
}
.kpi .label { font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--slate-500); font-weight: 650; }
.kpi .value { font-size: 2rem; font-weight: 700; line-height: 1.2; margin-top: .2rem; }
.kpi .sub { font-size: .8rem; color: var(--slate-500); }
.kpi .value { color: var(--navy-900); }
.kpi:is(.accent, .good, .warn) .label::before {
  content: ''; display: inline-block; width: .45rem; height: .45rem; border-radius: 50%;
  margin-right: .45rem; vertical-align: .1em; background: var(--blue-600);
}
.kpi.good .label::before { background: var(--green-600); }
.kpi.warn .label::before { background: var(--amber-600); }

.chart-bars { display: grid; gap: .55rem; }
.chart-row { display: grid; grid-template-columns: 150px 1fr 58px; gap: .8rem; align-items: center; font-size: .86rem; }
.chart-track { height: 20px; background: var(--slate-100); border-radius: 4px; overflow: hidden; }
.chart-fill { height: 100%; background: var(--blue-600); border-radius: 4px; min-width: 2px; transition: width .35s ease; }
.chart-fill.alt { background: var(--navy-700); }

.filters { display: flex; gap: .7rem; flex-wrap: wrap; align-items: flex-end; }
.filters .field { margin: 0; min-width: 150px; }
.filters .field.grow { flex: 1; min-width: 220px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; }
.q-editor { display: grid; grid-template-columns: repeat(2, 1fr); gap: .9rem; }
.q-editor .full { grid-column: 1 / -1; }
/* The grid's gap spaces these. The stacked-form margin would push down every
   field but the first, knocking a first row of two out of line. */
.q-editor > .field { margin: 0; }

/* Exam setup: syllabus topics per section, grouped by course module. */
.topic-pool { border: 1px solid var(--slate-200); border-radius: var(--radius); padding: .6rem .9rem; background: var(--surface); }
.topic-pool summary { cursor: pointer; }
.topic-module + .topic-module { margin-top: .7rem; }
.topic-module-name { text-transform: uppercase; letter-spacing: .03em; margin-bottom: .35rem; }
.topic-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem 1rem; }
.topic-empty span { color: var(--slate-500); }
.mix-inputs { display: flex; gap: .6rem; flex-wrap: wrap; }
.mix-inputs label { display: flex; align-items: center; gap: .35rem; font-weight: 500; margin: 0; }
.mix-inputs input { width: 5.5rem; }
.text-danger { color: var(--red-600); }
.text-warn { color: var(--amber-600); }
@media (max-width: 900px) { .topic-grid { grid-template-columns: 1fr; } }

/* Exam setup is a long page, so its save button stays at the bottom of the
   window and says whether anything is waiting to be saved. */
.save-bar {
  position: sticky; bottom: 1rem; z-index: 40;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .75rem;
  margin-top: 1.2rem; padding: .7rem 1rem;
  background: var(--surface); border: 1px solid var(--slate-200); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.save-bar.dirty { border-color: var(--tint-amber-line); background: var(--tint-amber-bg); }
.save-bar.dirty .save-state { color: var(--tint-amber-ink); font-weight: 600; }

/* CSV import preview: rows that will not import, and possible duplicates.
   A pale tint, so the row's badge still stands out. */
tr.import-error td     { background: var(--tint-red-bg); }
tr.import-duplicate td { background: var(--tint-amber-bg); }

.response-item { border: 1px solid var(--slate-200); border-radius: var(--radius); padding: 1rem; }
.response-item + .response-item { margin-top: .8rem; }
.response-item.correct { border-color: var(--tint-green-line); }
.response-item.wrong   { border-color: var(--tint-red-line); }
/* Practical-task feedback on the result page. */
.feedback-task + .feedback-task { margin-top: .8rem; }
.feedback-table { width: 100%; margin-top: .7rem; }
.feedback-table td { vertical-align: top; }
.feedback-table td.mark { width: 1.6rem; font-weight: 700; }
.feedback-table td.mark.ok { color: var(--green-600); }
.feedback-table td.mark.bad { color: var(--red-600); }
.feedback-sub { margin: 1rem 0 0; font-size: .9rem; }

.explain {
  margin-top: .7rem; padding: .65rem .85rem;
  background: var(--blue-50); border-radius: var(--radius);
  font-size: .86rem; color: var(--tint-blue-ink);
}

/* ======================================================================
   Loading / empty
   ====================================================================== */
.loading { padding: 3rem; text-align: center; color: var(--slate-500); }
.spinner {
  width: 30px; height: 30px; margin: 0 auto .8rem;
  border: 3px solid var(--slate-200); border-top-color: var(--blue-600);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ======================================================================
   Responsive - tablet and small laptop
   ====================================================================== */
@media (max-width: 1100px) {
  .exam-main { grid-template-columns: 1fr; }
  .task-main { grid-template-columns: 1fr; }
  .palette { position: static; max-height: none; }
  .palette-grid { grid-template-columns: repeat(10, 1fr); }
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-hero { padding: 2.2rem 1.5rem; }
  .auth-panel { padding: 2.2rem 1.5rem; }
  .exam-header { grid-template-columns: 1fr auto; gap: .6rem; }
  .exam-section-pill { grid-column: 1 / -1; grid-row: 2; justify-self: start; }
  .q-editor { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 130px 1fr 74px; gap: .6rem; font-size: .85rem; }
  .chart-row { grid-template-columns: 110px 1fr 48px; }
}

@media (max-width: 640px) {
  .palette-grid { grid-template-columns: repeat(6, 1fr); }
  .timer { font-size: 1.2rem; }
  .page-shell { padding: 1.25rem 1rem 3rem; }
  .exam-main, .task-main { padding: .8rem; }
}

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; }
}

/* ======================================================================
   On-screen calculator
   ====================================================================== */
.calc {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 268px;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 150;
  user-select: none;
  overflow: hidden;
}
.calc-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: .5rem .75rem;
  background: var(--navy-800);
  color: #fff;
  font-size: .85rem;
  font-weight: 650;
  cursor: move;
  touch-action: none;
}
.calc-close {
  background: transparent; border: 0; color: rgba(255,255,255,.75);
  font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 0 .2rem;
}
.calc-close:hover { color: #fff; }

.calc-screen {
  padding: .6rem .75rem;
  background: var(--slate-50);
  border-bottom: 1px solid var(--slate-200);
  text-align: right;
}
.calc-memory { font-size: .68rem; color: var(--purple-600); font-weight: 700; min-height: 1em; }
.calc-value {
  font-family: var(--mono);
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.25;
  overflow-x: auto;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.calc-expr { font-size: .74rem; color: var(--slate-500); min-height: 1em; font-family: var(--mono); }

.calc-keys { padding: .5rem; display: grid; gap: .3rem; }
.calc-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: .3rem; }

/* Scientific layout: six columns, denser keys. */
.calc-sci { width: 348px; }
.calc-sci .calc-row { grid-template-columns: repeat(6, 1fr); }
.calc-sci .calc-key { padding: .5rem .1rem; font-size: .82rem; }
.calc-sci .calc-key.wide { grid-column: span 2; }
.calc-sci .calc-key.mode {
  background: var(--navy-700); color: #fff; border-color: var(--navy-700);
  font-size: .72rem; font-weight: 700; letter-spacing: .02em;
}
.calc-sci .calc-key.mode:hover { background: var(--navy-800); }

.calc-status {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .66rem; font-weight: 700; letter-spacing: .04em;
  color: var(--purple-600);
  min-height: 1em;
}
.calc-status span:last-child { color: var(--navy-700); }
.calc-sci .calc-expr {
  font-size: .8rem;
  color: var(--slate-600);
  min-height: 1.3em;
  overflow-x: auto;
  white-space: nowrap;
  direction: rtl;          /* keep the tail of a long expression in view */
  text-align: right;
}
.calc-sci .calc-value { font-size: 1.4rem; }
.calc-key {
  padding: .6rem .2rem;
  border: 1px solid var(--slate-200);
  border-radius: 6px;
  background: var(--surface);
  font: inherit;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .1s ease;
}
.calc-key:hover   { background: var(--slate-100); }
.calc-key:active  { background: var(--slate-200); }
.calc-key.op      { background: var(--slate-100); color: var(--navy-700); font-size: 1.05rem; }
.calc-key.fn      { background: var(--slate-50); color: var(--slate-600); font-size: .82rem; }
.calc-key.mem     { background: var(--purple-100); color: var(--purple-600); font-size: .78rem; }
.calc-key.eq      { background: var(--blue-600); color: #fff; border-color: var(--blue-600); }
.calc-key.eq:hover { background: var(--primary-hover); }

/* ======================================================================
   Camera chip in the exam header
   ====================================================================== */
.cam-chip {
  position: relative;
  width: 62px; height: 46px;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
  border: 2px solid var(--green-600);
  flex: none;
}
.cam-chip video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.cam-dot {
  position: absolute; top: 3px; right: 3px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green-600);
  box-shadow: 0 0 0 2px rgba(0,0,0,.4);
}
.cam-dot.off { background: var(--red-600); animation: pulse 1.2s ease-in-out infinite; }

/* camera check panel on the instructions page */
.cam-check {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--slate-900);
  border-radius: var(--radius);
  overflow: hidden;
}
.cam-check video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.cam-check-empty {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--slate-400); font-size: .85rem;
}

/* ======================================================================
   Blocking overlay (fullscreen exit / camera off)
   ====================================================================== */
.block-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 32, 56, .93);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  z-index: 400;
}
.block-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  max-width: 480px;
  width: 100%;
  text-align: center;
}
.block-icon {
  width: 56px; height: 56px; margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--amber-100);
  color: var(--amber-600);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.9rem; font-weight: 800;
}
.block-card h2 { margin-bottom: .6rem; }
.block-card p { color: var(--slate-600); }

@media (max-width: 900px) {
  .calc { width: 240px; right: .75rem; bottom: .75rem; }
  .cam-chip { width: 50px; height: 38px; }
}

/* ======================================================================
   Tabs (the attempt page's proctoring card)
   ====================================================================== */
.tabs { display: flex; flex-wrap: wrap; gap: .3rem; }
.tab {
  border: 0; background: none; cursor: pointer;
  padding: .4rem .8rem; border-radius: 999px;
  font: inherit; font-size: .85rem; font-weight: 600; color: var(--slate-600);
}
.tab:hover { background: var(--slate-100); color: var(--slate-900); }
.tab.active { background: var(--navy-800); color: #fff; }
.tab-count {
  display: inline-block; min-width: 1.4rem; margin-left: .4rem; padding: 0 .4rem;
  border-radius: 999px; background: var(--slate-200); color: var(--slate-700);
  font-size: .72rem; text-align: center;
}
.tab.active .tab-count { background: rgba(255, 255, 255, .2); color: #fff; }
/* A long list scrolls inside its tab instead of stretching the page. */
.tab-panel { max-height: 640px; overflow: auto; }
.tab-panel thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); }
.tab-subhead { margin: 0 0 .6rem; font-size: .95rem; }
.tab-subhead ~ .tab-subhead { margin-top: 1.2rem; }
table.compact td, table.compact th { padding-top: .45rem; padding-bottom: .45rem; }

/* ======================================================================
   Incident snapshot gallery (admin attempt page)
   ====================================================================== */
.snap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .7rem;
}
.snap {
  margin: 0;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--slate-50);
}
.snap img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--slate-900);
  transform: scaleX(-1);
}
.snap figcaption {
  padding: .4rem .5rem;
  font-size: .72rem;
  line-height: 1.35;
}
.snap figcaption strong { display: block; color: var(--slate-700); }
.snap figcaption span { color: var(--slate-500); }
.snap-missing {
  aspect-ratio: 4 / 3;
  display: flex; align-items: center; justify-content: center;
  background: var(--slate-100);
  color: var(--slate-400);
  font-size: .75rem;
}

/* ======================================================================
   Integrity findings
   ====================================================================== */
.findings { display: grid; gap: .6rem; }
.finding {
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: .7rem .9rem;
  background: var(--surface);
}
.finding.high   { border-color: var(--tint-red-line); background: var(--tint-red-bg); }
.finding.medium { border-color: var(--tint-amber-line); background: var(--tint-amber-bg); }
.finding.info   { background: var(--slate-50); }
.finding strong { font-size: .93rem; }

/* ======================================================================
   Brand: the SpeedUp logo (white and red lettering, for dark headers)
   ====================================================================== */
.brand-logo { display: block; width: auto; height: 26px; }
.with-logo { display: flex; align-items: center; gap: .9rem; }
.with-logo .brand-text { padding-left: .9rem; border-left: 1px solid rgba(255,255,255,.22); }
.topbar .brand-logo { height: 30px; }
.exam-title .brand-logo { height: 24px; }
.admin-nav .brand { display: flex; align-items: center; gap: .6rem; }
.admin-nav .brand-logo { height: 22px; }
.admin-nav .brand span { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; opacity: .7; }
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 2.4rem; }
.hero-logo { display: block; width: auto; height: 52px; max-width: 100%; }

/* The light or dark switch, on every header (always dark, in both themes). */
.theme-toggle {
  display: inline-flex; align-items: center; gap: .45rem;
  background: rgba(255,255,255,.1); color: #fff;
  border: 1px solid rgba(255,255,255,.22); border-radius: 999px;
  padding: .3rem .75rem;
  font: inherit; font-size: .78rem; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.theme-toggle::before {
  content: ""; width: .8rem; height: .8rem; border-radius: 50%;
  border: 1.5px solid currentColor;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}
.theme-toggle:hover { background: rgba(255,255,255,.18); }
.theme-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.theme-toggle .when-dark { display: none; }
[data-theme="dark"] .theme-toggle .when-light { display: none; }
[data-theme="dark"] .theme-toggle .when-dark { display: inline; }

@media (max-width: 640px) {
  .with-logo .brand-text { display: none; }
  .hero-logo { height: 40px; }
}

/* ======================================================================
   Dark theme: the SpeedUp colours, black with white and red.
   Light stays the default; theme.js sets data-theme="dark" when chosen.
   On screen only, so printing a result is always on white.
   ====================================================================== */
@media screen {
  :root[data-theme="dark"] {
    color-scheme: dark;

    --navy-900: #000;
    --navy-800: #050505;
    --navy-700: #26262a;
    --blue-600: #fd1d17;
    --blue-500: #ff4d42;
    --blue-50:  rgba(253, 29, 23, .13);

    --slate-900: #f5f5f5;
    --slate-700: #d6d6d9;
    --slate-600: #b8b8bd;
    --slate-500: #9b9ba3;
    --slate-400: #6e6e76;
    --slate-300: #3b3b41;
    --slate-200: #2a2a2f;
    --slate-100: #0a0a0b;
    --slate-50:  #1b1b1e;
    --surface:   #141416;

    --green-100:  rgba(34, 197, 94, .16);
    --amber-100:  rgba(245, 158, 11, .16);
    --red-100:    rgba(239, 68, 68, .16);
    --purple-600: #a78bfa;
    --purple-100: rgba(139, 92, 246, .18);

    --primary-hover: #d9140f;
    --focus-ring: rgba(253, 29, 23, .28);
    --current: #fd1d17;
    --current-ring: rgba(253, 29, 23, .3);
    --unanswered: #1d1d21;

    --tint-red-bg: rgba(239, 68, 68, .12);
    --tint-red-line: rgba(239, 68, 68, .38);
    --tint-red-ink: #fca5a5;
    --tint-amber-bg: rgba(245, 158, 11, .12);
    --tint-amber-line: rgba(245, 158, 11, .38);
    --tint-amber-ink: #fcd34d;
    --tint-green-bg: rgba(34, 197, 94, .12);
    --tint-green-line: rgba(34, 197, 94, .32);
    --tint-green-strong: rgba(34, 197, 94, .5);
    --tint-green-ink: #86efac;
    --tint-blue-line: rgba(253, 29, 23, .38);
    --tint-blue-ink: #ffb4ae;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, .5);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .65);
  }

  /* Headers: black, underlined in the logo's red. */
  [data-theme="dark"] .admin-nav,
  [data-theme="dark"] .topbar,
  [data-theme="dark"] .exam-header { border-bottom: 2px solid var(--blue-600); }
  [data-theme="dark"] .auth-hero,
  [data-theme="dark"] .result-hero {
    background: radial-gradient(120% 90% at 0% 100%, rgba(253, 29, 23, .24), transparent 60%), #000;
  }
  [data-theme="dark"] .result-hero { border: 1px solid var(--slate-200); }

  /* Notes and info are neutral, so red stays for the accent and for errors. */
  [data-theme="dark"] .alert-info { background: rgba(255, 255, 255, .05); border-color: var(--slate-300); color: var(--slate-700); }
  [data-theme="dark"] .badge-info { background: rgba(255, 255, 255, .1); color: var(--slate-700); }

  /* Things that used navy as a text or fill colour on white. */
  [data-theme="dark"] .kpi .value { color: var(--slate-900); }
  [data-theme="dark"] .chart-fill.alt { background: var(--slate-500); }
  [data-theme="dark"] .btn-dark:hover:not(:disabled) { background: #34343a; }
  [data-theme="dark"] .dataset-tab.current,
  [data-theme="dark"] .tab.active { background: var(--blue-600); border-color: var(--blue-600); }
  [data-theme="dark"] .dataset-tab.current .muted { color: rgba(255, 255, 255, .8); }
  [data-theme="dark"] .calc-status span:last-child,
  [data-theme="dark"] .calc-key.op { color: var(--slate-900); }

  /* Dark panels stay dark (the light slate-900 is text colour here). */
  [data-theme="dark"] .code-editor { background: #0b0b0d; border-color: var(--slate-300); }
  [data-theme="dark"] .cam-check,
  [data-theme="dark"] .snap img { background: #000; }
  [data-theme="dark"] .pal-btn.review.answered::after { border-color: var(--surface); }
  [data-theme="dark"] .modal-backdrop { background: rgba(0, 0, 0, .7); }
  [data-theme="dark"] .block-overlay { background: rgba(0, 0, 0, .92); }
}
