/* NeuralMark kiosk. Colours follow the grader (grader/src/app/styles.css). */
:root {
  --blue: #1e3a8a;
  --blue-2: #2f4fb0;
  --blue-soft: #e8edfb;
  --border: #d1d5db;
  --subtle: #9ca3af;
  --text: #111827;
  --muted: #4b5563;
  --bg: #f6f7f9;
  --card: #ffffff;
  --ok: #15803d;
  --ok-soft: #e7f6ec;
  --bad: #b91c1c;
  --bad-soft: #fdecec;
  --warn: #b45309;
  --warn-soft: #fff4e0;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text); background: var(--bg);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
code { font: 12.5px/1.3 ui-monospace, "Cascadia Mono", Consolas, monospace; background: var(--blue-soft); padding: 1px 4px; border-radius: 4px; }
.boot { padding: 48px; color: var(--muted); }
#print-root { display: none; }

/* ---------------------------------------------------------------- shell */
.topbar {
  display: flex; align-items: center; gap: 18px; padding: 10px 20px; background: var(--blue); color: #fff;
  flex-wrap: wrap; position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font: 600 19px/1.2 Georgia, "Times New Roman", serif; margin: 0; letter-spacing: .2px; }
.tabs { display: flex; gap: 4px; }
.tabs button {
  border: 0; background: transparent; color: #dbe3ff; padding: 8px 14px; border-radius: 6px; font-weight: 500;
}
.tabs button:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.tabs button.active { background: #fff; color: var(--blue); }
#who { font-size: 13px; }
.muted-inv { color: #c7d2fe; }
main { max-width: 1080px; margin: 0 auto; padding: 18px 20px 40px; }
.foot { max-width: 1080px; margin: 0 auto; padding: 0 20px 28px; color: var(--muted); font-size: 12px; }
.panel h2 { font: 600 22px/1.25 Georgia, "Times New Roman", serif; color: var(--blue); margin: 6px 0 4px; }
.lead { color: var(--muted); max-width: 820px; margin: 0 0 14px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0;
}
.card h3 { margin: 0 0 10px; font-size: 16px; }
.card h4 { margin: 4px 0 6px; font-size: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.grow { flex: 1 1 auto; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px 20px; }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 14px; }
.span2 { grid-column: span 2; }
label { display: inline-flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--muted); }
label.wide, .wide { display: flex; width: 100%; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
input, select, textarea {
  border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; background: #fff; min-width: 0;
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--blue-2); outline-offset: 1px; }
textarea { width: 100%; resize: vertical; }
input.sm { width: 76px; }
input.qn { width: 70px; }
input[type="range"] { padding: 0; border: 0; width: 160px; accent-color: var(--blue); }
.small { font-size: 12px; }
.muted { color: var(--muted); }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.warn { color: var(--warn); }
.status { color: var(--muted); font-size: 13px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: #fff; color: var(--text);
  border-radius: 6px; padding: 7px 14px; font-weight: 500; font-size: 13.5px; cursor: pointer; flex-direction: row;
}
.btn:hover { border-color: var(--blue-2); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-2); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 3px 9px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: progress; }
.link { border: 0; background: none; color: var(--blue-2); padding: 0; text-decoration: underline; font-size: 12.5px; }
.x { border: 0; background: none; color: var(--subtle); font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 4px; }
.x:hover { color: var(--bad); background: var(--bad-soft); }

/* ---------------------------------------------------------------- sign-in */
.seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 6px; }
.seg button {
  border: 1px solid var(--border); background: #fff; border-radius: 8px; padding: 8px 10px; text-align: left;
  display: flex; flex-direction: column; gap: 1px;
}
.seg button span { font-size: 12px; color: var(--muted); }
.seg button.on { border-color: var(--blue); background: var(--blue-soft); box-shadow: inset 0 0 0 1px var(--blue); }
.si-form label { min-width: 150px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--subtle); display: inline-block; }
.dot.ok { background: var(--ok); }

/* ---------------------------------------------------------------- mark */
label.drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; border: 2px dashed var(--subtle);
  border-radius: 10px; background: #fff; text-align: center; color: var(--muted); cursor: pointer; font-size: 13px;
}
label.drop b { color: var(--text); font-size: 15px; }
label.drop.over, label.drop:hover { border-color: var(--blue); background: var(--blue-soft); }
label.drop input { display: none; }
.sample { margin: 4px 0 12px; }
table { border-collapse: collapse; }
table.kv { margin: 12px 0; width: 100%; }
table.kv th { text-align: left; width: 120px; color: var(--muted); font-weight: 500; vertical-align: top; padding: 4px 8px 4px 0; }
table.kv td { padding: 4px 0; }
table.sum { width: 100%; max-width: 680px; margin-bottom: 10px; }
table.sum td { padding: 5px 8px 5px 0; border-bottom: 1px solid #eef0f3; }
table.sum td.cr { text-align: right; color: var(--muted); white-space: nowrap; }
table.sum tr.total td { font-weight: 700; border-bottom: 0; border-top: 2px solid var(--text); color: var(--text); font-size: 15px; }
fieldset.read-mode { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px 10px; margin: 4px 0 12px; max-width: 680px; }
fieldset.read-mode legend { font-size: 12.5px; color: var(--muted); padding: 0 4px; }
label.mode-opt { flex-direction: row; align-items: flex-start; gap: 8px; color: var(--text); font-size: 13.5px; padding: 6px 4px; cursor: pointer; }
label.mode-opt input { margin-top: 3px; }
label.mode-opt .chip { font-size: 11px; background: #dbeafe; color: #1e3a8a; border-radius: 10px; padding: 1px 7px; font-weight: 600; }
progress { width: 100%; max-width: 680px; height: 8px; accent-color: var(--blue); }
.lockbox { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.lockbox #pw-fields { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.lockbox #pw-fields[hidden] { display: none; }
.ok-card { border-color: #9fd5b0; background: var(--ok-soft); }
details summary { cursor: pointer; color: var(--muted); }

/* ---------------------------------------------------------------- key builder */
table.ed { width: 100%; margin: 8px 0; }
table.ed th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 500; padding: 4px 6px; border-bottom: 1px solid var(--border); }
table.ed td { padding: 3px 6px; border-bottom: 1px solid #f0f1f4; vertical-align: middle; }
table.ed td.c { text-align: center; }
table.ed input.wide { width: 100%; }
.abcde { display: inline-flex; gap: 3px; }
.abcde button {
  width: 30px; height: 28px; border: 1px solid var(--border); background: #fff; border-radius: 50%; font-weight: 600; font-size: 12.5px;
}
.abcde button.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.abcde button.drop { border-radius: 6px; color: var(--muted); }
.abcde button.drop.on { background: var(--subtle); border-color: var(--subtle); color: #fff; }
.item { border: 1px solid #e5e7eb; border-radius: 8px; padding: 8px 12px; margin: 8px 0; background: #fcfcfd; }
.item.work { border-left: 3px solid var(--blue-2); }
.warn-box { background: var(--warn-soft); border: 1px solid #f3d19c; border-radius: 6px; padding: 8px 12px; color: #6b3a05; }
.warn-box ul { margin: 4px 0 0; padding-left: 18px; }

/* ---------------------------------------------------------------- admin */
.bar { height: 8px; background: #eef0f3; border-radius: 4px; overflow: hidden; display: flex; width: 160px; }
.bar span { background: var(--blue-2); display: block; height: 100%; }
.bar span.res { background: #93a8e8; }
.bar.big { height: 14px; width: 100%; border-radius: 7px; margin: 4px 0 8px; }
table.teachers { width: 100%; }
table.teachers th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 500; padding: 6px; border-bottom: 1px solid var(--border); }
table.teachers td { padding: 6px; border-bottom: 1px solid #f0f1f4; vertical-align: middle; }
table.teachers td.acts { white-space: nowrap; text-align: right; }
.token { word-break: break-all; }
.sheet-preview { border: 1px solid var(--border); border-radius: 6px; padding: 14px; background: #fff; max-height: 520px; overflow: auto; }

/* the PIN handout (preview on screen, the only thing printed) */
.pin-sheet header h1 { font: 600 18px/1.25 Georgia, "Times New Roman", serif; color: var(--blue); margin: 0 0 6px; }
.pin-sheet header p { margin: 0 0 4px; font-size: 12.5px; }
.pin-sheet .code { font: 700 15px/1 ui-monospace, Consolas, monospace; letter-spacing: 1px; }
.pin-sheet .slips { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 10px; }
.pin-sheet .slip { border: 1px dashed #6b7280; padding: 8px 10px; min-height: 26mm; display: flex; flex-direction: column; justify-content: space-between; }
.pin-sheet .who { font-weight: 600; font-size: 13px; }
.pin-sheet .pin { font: 700 22px/1.1 ui-monospace, Consolas, monospace; letter-spacing: 3px; color: var(--blue); }
.pin-sheet .how { font-size: 9.5px; color: var(--muted); word-break: break-all; }

/* ---------------------------------------------------------------- toast */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 16px;
  border-radius: 8px; max-width: min(720px, 92vw); box-shadow: 0 8px 24px rgba(0, 0, 0, .2); z-index: 20; white-space: pre-line;
}
.toast[data-kind="bad"] { background: var(--bad); }
.toast[hidden] { display: none; }

@media (max-width: 700px) {
  .topbar { gap: 8px; }
  .span2 { grid-column: auto; }
}

/* ---------------------------------------------------------------- print: the PIN handout only, on A4 */
@media print {
  @page { size: A4 portrait; margin: 10mm; }
  body { background: #fff; }
  #app, .toast { display: none !important; }
  #print-root { display: block; }
  .pin-sheet header { margin-bottom: 4mm; }
  .pin-sheet .slips { grid-template-columns: repeat(3, 1fr); }
  .pin-sheet .slip { height: 29mm; min-height: 0; break-inside: avoid; }
  .pin-sheet .code, .pin-sheet .pin, .pin-sheet header h1 { color: #000; }
}
