:root {
  --brand: #1f5eff; --brand-d: #1747c7; --brand-l: #e8efff;
  --ink: #0f1b2d; --ink-2: #44546a; --ink-3: #7b8aa0; --line: #e3e8f0; --bg: #f5f7fb; --card: #fff;
  --ok: #138a4b; --ok-l: #e5f6ec; --warn: #b26b00; --warn-l: #fff4e0; --bad: #c62828; --bad-l: #fdeaea;
  --navy: #0b1730; --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 14px rgba(16,24,40,.06);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 Inter, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; }
h1 { font-size: 24px; } h2 { font-size: 19px; } h3 { font-size: 16px; }
.muted { color: var(--ink-3); } .small { font-size: 12px; } .mono { font-family: var(--mono); }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #c8d1df; background: #fafbfd; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; } .btn.primary:hover { background: var(--brand-d); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
label { display: block; font-weight: 600; font-size: 12px; color: var(--ink-2); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #cfd7e3; border-radius: 8px; font: inherit; background: #fff; color: var(--ink); }
textarea { font-family: var(--mono); font-size: 13px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-l); border-color: var(--brand); }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; color: var(--ink); font-size: 13px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; letter-spacing: .02em; background: #eef1f6; color: var(--ink-2); }
.badge.ok { background: var(--ok-l); color: var(--ok); } .badge.warn { background: var(--warn-l); color: var(--warn); }
.badge.bad { background: var(--bad-l); color: var(--bad); } .badge.info { background: var(--brand-l); color: var(--brand); }
.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; }
.alert.bad { background: var(--bad-l); color: var(--bad); } .alert.ok { background: var(--ok-l); color: var(--ok); }
.alert.warn { background: var(--warn-l); color: var(--warn); } .alert.info { background: var(--brand-l); color: var(--brand-d); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); background: #fafbfd; position: sticky; top: 0; }
tr:hover td { background: #fafcff; }
pre, code { font-family: var(--mono); }
.md pre { background: #0f1b2d; color: #e6edf7; padding: 12px 14px; border-radius: 8px; overflow: auto; font-size: 13px; }
.md code { background: #eef1f6; padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.md pre code { background: none; padding: 0; }
/* ```figure diagram blocks: light panel, larger type and colour-coded glyphs. */
.md pre.figure { background: #f8fafc; color: var(--ink-2); border: 1px solid var(--line);
  border-left: 3px solid var(--brand); padding: 14px 16px; border-radius: 8px;
  font-family: var(--mono); font-size: 14px; line-height: 1.5; overflow: auto; }
.md pre.figure .fg-fr { color: #94a3b8; }                         /* frame lines */
.md pre.figure .fg-dg { color: #7c3aed; font-weight: 700; }       /* diagonals */
.md pre.figure .fg-mk { color: var(--brand); font-weight: 700; }  /* dots and stars */
.md pre.figure .fg-bl { color: var(--bad); font-weight: 700; }    /* blocked cell */
.md pre.figure .fg-xx { color: #e11d48; font-weight: 800; }       /* X */
.md pre.figure .fg-oo { color: #0d9488; font-weight: 800; }       /* O */
.md pre.figure .fg-ar { color: #b26b00; font-weight: 800; }       /* arrows */
.md pre.figure .fg-lb { color: var(--ink); font-weight: 600; }    /* labels */
.md p { margin: 0 0 .7em; }

/* ---- auth pages ---- */
.auth-wrap { min-height: 100%; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { background: radial-gradient(1200px 600px at -10% -10%, #2b6bff 0%, #0b1730 60%); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-hero h1 { font-size: 34px; margin-top: 40px; } .auth-hero p { color: #c8d6f5; max-width: 520px; font-size: 17px; line-height: 1.65; }
.auth-hero ul { padding-left: 20px; color: #dbe5fb; font-size: 17px; line-height: 1.8; max-width: 540px; }
.auth-hero ul li { margin-bottom: 4px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.logo .mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #5b8cff, #1f5eff); display: grid; place-items: center; font-size: 15px; color: #fff; }
.auth-panel { display: grid; place-items: center; padding: 32px; }
.auth-panel .card { width: 100%; max-width: 420px; }
.tabs { display: flex; gap: 4px; background: #eef1f6; padding: 4px; border-radius: 9px; margin-bottom: 16px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 7px; border-radius: 7px; font: inherit; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.tabs button.active { background: #fff; color: var(--ink); box-shadow: var(--shadow); }

/* ---- system check ---- */
.syscheck { max-width: 1040px; margin: 28px auto; padding: 0 16px; }
/* The rules a candidate must actually read - deliberately larger than body text. */
#tInstr { font-size: 15.5px; line-height: 1.8; }
#tMeta { font-size: 13px; }
.syscheck .check { font-size: 14px; line-height: 1.55; }
.checks { display: grid; gap: 8px; }
.checkitem { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.checkitem .st { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: #eef1f6; color: var(--ink-3); flex: none; }
.checkitem.ok .st { background: var(--ok-l); color: var(--ok); } .checkitem.bad .st { background: var(--bad-l); color: var(--bad); }
.checkitem.wait .st { background: var(--warn-l); color: var(--warn); }
.preview { width: 100%; aspect-ratio: 4/3; background: #111; border-radius: 10px; object-fit: cover; transform: scaleX(-1); }

/* ---- exam ---- */
.exam { height: 100vh; display: grid; grid-template-rows: 56px 1fr; }
.topbar { background: var(--navy); color: #fff; display: flex; align-items: center; gap: 16px; padding: 0 16px; }
.topbar .title { font-weight: 700; } .topbar .sub { color: #9fb2d6; font-size: 12px; }
.timer { font-family: var(--mono); font-size: 20px; font-weight: 700; padding: 4px 12px; border-radius: 8px; background: rgba(255,255,255,.08); }
.timer.low { background: var(--bad); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: rgba(255,255,255,.08); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #3ddc84; box-shadow: 0 0 0 3px rgba(61,220,132,.25); }
.dot.bad { background: #ff5a5a; box-shadow: 0 0 0 3px rgba(255,90,90,.25); }
.cam-mini { width: 92px; height: 52px; border-radius: 6px; object-fit: cover; transform: scaleX(-1); background: #000; border: 2px solid rgba(255,255,255,.2); }
.exam-body { display: grid; grid-template-columns: 220px 1fr; min-height: 0; }
.palette { border-right: 1px solid var(--line); background: #fff; padding: 14px; overflow: auto; }
.palette h4 { font-size: 11px; text-transform: uppercase; color: var(--ink-3); letter-spacing: .05em; margin: 10px 0 8px; }
.qgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.qbtn { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 7px; background: #fff; font: inherit; font-weight: 700; font-size: 12px; cursor: pointer; color: var(--ink-2); }
.qbtn.done { background: var(--ok-l); border-color: #b7e3c8; color: var(--ok); }
.qbtn.flag { box-shadow: inset 0 -3px 0 var(--warn); }
.qbtn.cur { outline: 2px solid var(--brand); outline-offset: 1px; color: var(--brand); }
.legend { display: grid; gap: 4px; margin-top: 14px; font-size: 12px; color: var(--ink-2); }
.main { min-width: 0; min-height: 0; overflow: auto; }
.mcq-wrap { max-width: 860px; margin: 0 auto; padding: 28px 24px 80px; }
.opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: #fff; margin-bottom: 10px; cursor: pointer; }
.opt:hover { border-color: #b9c6dc; } .opt.sel { border-color: var(--brand); background: var(--brand-l); }
.opt .key { width: 26px; height: 26px; flex: none; border-radius: 6px; display: grid; place-items: center; font-weight: 700; background: #eef1f6; font-size: 12px; }
.opt.sel .key { background: var(--brand); color: #fff; }
.opt .txt { white-space: pre-wrap; font-family: var(--mono); font-size: 13px; padding-top: 3px; }
.coding { display: grid; grid-template-columns: minmax(320px, 38%) 1fr; height: 100%; min-height: 0; }
.problem { overflow: auto; padding: 20px 22px; border-right: 1px solid var(--line); background: #fff; }
.workbench { display: grid; grid-template-rows: 40px 1fr 230px; min-height: 0; }
.wb-bar { display: flex; align-items: center; gap: 8px; padding: 0 10px; background: #1e1e1e; color: #ccc; font-size: 12px; }
#editor { min-height: 0; }
.console { background: #fff; border-top: 1px solid var(--line); display: grid; grid-template-rows: 38px 1fr; min-height: 0; }
.console-head { display: flex; align-items: center; gap: 8px; padding: 0 10px; border-bottom: 1px solid var(--line); }
.console-body { overflow: auto; padding: 10px 12px; font-size: 12.5px; }
.tc { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; overflow: hidden; }
.tc-h { padding: 6px 10px; display: flex; gap: 8px; align-items: center; background: #fafbfd; font-weight: 600; }
.tc-b { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 8px 10px; }
.tc-b pre { margin: 0; background: #f4f6fa; padding: 6px 8px; border-radius: 6px; max-height: 120px; overflow: auto; font-size: 12px; white-space: pre-wrap; }
.qnav { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 12px 24px; background: rgba(245,247,251,.95); border-top: 1px solid var(--line); }
.banner { position: fixed; left: 50%; top: 66px; transform: translateX(-50%); z-index: 50; max-width: 640px; box-shadow: var(--shadow); }
.overlay { position: fixed; inset: 0; background: rgba(8,15,32,.86); z-index: 100; display: grid; place-items: center; color: #fff; padding: 20px; }
.overlay .box { background: #fff; color: var(--ink); border-radius: 14px; padding: 28px; max-width: 520px; width: 100%; text-align: center; }
.modal-bg { position: fixed; inset: 0; background: rgba(8,15,32,.5); z-index: 90; display: grid; place-items: center; padding: 20px; }
.modal { background: #fff; border-radius: 14px; padding: 24px; width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; }
.modal.wide { max-width: 980px; }
.toast { position: fixed; right: 16px; bottom: 16px; z-index: 200; background: var(--navy); color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); font-size: 13px; }

/* ---- admin ---- */
.admin { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--navy) 220px, var(--bg) 220px); }
.side { background: var(--navy); color: #c9d5ee; padding: 18px 12px; position: sticky; top: 0; height: 100vh; }
.side .logo { color: #fff; padding: 4px 8px 18px; }
.side a { display: block; color: #c9d5ee; padding: 9px 12px; border-radius: 8px; font-weight: 600; margin-bottom: 2px; }
.side a.active, .side a:hover { background: rgba(255,255,255,.08); color: #fff; }
.content { padding: 24px 28px; min-width: 0; }
.page-h { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; } .page-h h1 { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.stat .v { font-size: 24px; font-weight: 800; } .stat .k { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.livegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.tile.crit { border-color: var(--bad); box-shadow: 0 0 0 2px var(--bad-l); } .tile.warn { border-color: #f0c27a; }
.tile .img { position: relative; aspect-ratio: 4/3; background: #111; }
.tile .img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .img img.scr { height: auto; }
.tile .img .scr { position: absolute; right: 6px; bottom: 6px; width: 38%; border: 2px solid #fff; border-radius: 4px; aspect-ratio: 16/10; object-fit: cover; }
.tile .img .tag { position: absolute; left: 6px; top: 6px; }
.tile .meta { padding: 8px 10px; font-size: 12px; }
.tile .acts { display: flex; gap: 4px; padding: 0 8px 8px; flex-wrap: wrap; }
.tablewrap { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: auto; max-height: 72vh; }
.timeline { border-left: 2px solid var(--line); margin-left: 6px; padding-left: 16px; }
.timeline .ev { position: relative; margin-bottom: 12px; }
.timeline .ev::before { content: ""; position: absolute; left: -22px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); }
.timeline .ev.critical::before { background: var(--bad); } .timeline .ev.high::before { background: #e8710a; }
.timeline .ev.medium::before { background: #f2b200; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.thumbs img { width: 100%; border-radius: 6px; aspect-ratio: 4/3; object-fit: cover; cursor: zoom-in; background: #111; }
.verdict { font-size: 22px; font-weight: 800; padding: 6px 14px; border-radius: 8px; display: inline-block; }
.verdict.SHORTLIST, .verdict.SHORTLISTED { background: var(--ok-l); color: var(--ok); }
.verdict.BAR, .verdict.BARRED { background: var(--bad); color: #fff; }
.verdict.REJECT, .verdict.REJECTED { background: var(--bad-l); color: var(--bad); }
.verdict.REVIEW, .verdict.PENDING { background: var(--warn-l); color: var(--warn); }
@media print { .side, .no-print { display: none !important; } .admin { display: block; } .content { padding: 0; } .card { box-shadow: none; } }
@media (max-width: 900px) { .auth-wrap { grid-template-columns: 1fr; } .auth-hero { display: none; } }
