/* TST Clinical Exam Prep — brand: Soft White #F5F2F0, Charcoal #1A1A1A (text only), Vibrant Gold #F3C500,
   Warm Gold #D9BD5A, Stone Grey #6E6E6E. No green. */
:root {
  --ivory: #F5F2F0; --paper: #FFFFFF; --side: #FBF8F3; --ink: #1A1A1A; --muted: #6E6E6E;
  --gold: #F3C500; --gold-warm: #D9BD5A; --gold-soft: #FBEFC0; --gold-wash: #FDF7E3;
  --line: #E7E1D6; --line-strong: #D6CEC0; --danger: #A23B2A; --danger-wash: #FBEAE6;
  --focus: #8A6D00; --radius: 12px; --shadow: 0 1px 2px rgba(26,26,26,.05), 0 4px 14px rgba(26,26,26,.04);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--ivory); }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 600; line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.85rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.05rem; font-family: inherit; }
a { color: inherit; text-decoration-color: var(--gold-warm); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.side { width: 264px; flex: none; background: var(--side); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; flex-direction: column; align-items: center; text-decoration: none; margin-bottom: 18px; gap: 6px; }
.brand img { width: 150px; height: auto; }
.brand span { font-family: Georgia, serif; font-size: 1.08rem; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side li a, .side .linkish { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; text-decoration: none; color: var(--ink); font-size: .95rem; width: 100%; }
.side li a:hover, .side .linkish:hover { background: var(--gold-wash); }
.side li a.on { background: var(--gold-soft); font-weight: 600; box-shadow: inset 3px 0 0 var(--gold); }
.devtag { margin-left: auto; font-style: normal; font-size: .66rem; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 99px; padding: 1px 6px; white-space: nowrap; }
.side-foot { margin-top: auto !important; padding-top: 14px !important; border-top: 1px solid var(--line) !important; }
.linkish { background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 14px 28px; }
.who { display: flex; align-items: center; gap: 10px; }
.who small { display: block; color: var(--muted); font-size: .8rem; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--ink); color: var(--paper); display: grid; place-items: center; font-weight: 600; font-size: .85rem; }
.menu-btn { display: none; }
main { padding: 4px 28px 40px; max-width: 1400px; width: 100%; }
.auth-main { max-width: 440px; margin: 8vh auto; padding: 0 16px; }

/* Page */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 6px 0 20px; flex-wrap: wrap; }
.sub { color: var(--muted); margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px; min-width: 0; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; gap: 14px; align-items: flex-start; box-shadow: var(--shadow); }
.stat .badge-ico { width: 46px; height: 46px; border-radius: 12px; background: var(--gold-wash); display: grid; place-items: center; color: #8A6D00; flex: none; }
.stat strong { display: block; font-size: 1.7rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .88rem; }
.stat.feature { background: var(--gold-wash); border-color: #F1DE99; }
.muted { color: var(--muted); } .small { font-size: .86rem; }
.empty { color: var(--muted); padding: 18px; text-align: center; border: 1px dashed var(--line-strong); border-radius: 10px; }
.notice { background: var(--gold-wash); border: 1px solid #F1DE99; border-radius: 10px; padding: 12px 14px; margin: 12px 0; }
.notice.plain { background: #FAF8F4; border-color: var(--line); }
.flash { border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; border: 1px solid #F1DE99; background: var(--gold-wash); }
.flash.error { background: var(--danger-wash); border-color: #EBC2B9; color: #6E2215; }

/* Buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; background: var(--gold); color: var(--ink); font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 9px; cursor: pointer; text-decoration: none; min-height: 40px; }
.btn:hover { background: #E5B900; }
.btn.secondary { background: var(--paper); border-color: var(--line-strong); font-weight: 500; }
.btn.secondary:hover { background: var(--gold-wash); }
.btn.danger { background: var(--paper); border-color: #E2B2A7; color: var(--danger); font-weight: 500; }
.btn.small { padding: 5px 10px; min-height: 32px; font-size: .86rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
form.inline { display: inline; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label, .field .lbl { font-weight: 600; font-size: .92rem; }
.field .hint { color: var(--muted); font-size: .82rem; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], input[type=search], select, textarea {
  font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 11px; width: 100%; min-height: 40px; }
textarea { min-height: 90px; resize: vertical; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 14px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 0 0 14px; }
legend { font-weight: 600; padding: 0 4px; font-size: .92rem; }
.check { display: flex; gap: 8px; align-items: center; padding: 4px 0; }
.check input { width: 18px; height: 18px; accent-color: #B38F00; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #FBF9F5; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Status chips (shape + text, never colour alone) */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; font-weight: 600; padding: 2px 9px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--paper); white-space: nowrap; }
.chip.verified { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip.verified::before { content: "✓"; }
.chip.pending { background: var(--gold-wash); border-color: var(--gold-warm); }
.chip.pending::before { content: "◔"; }
.chip.scheduled { background: #F7F4EE; }
.chip.cancelled, .chip.voided, .chip.retired { color: var(--muted); text-decoration: line-through; }
.chip.draft { border-style: dashed; }
.chip.published { background: var(--gold-soft); border-color: var(--gold-warm); }
.chip.warn { background: var(--danger-wash); border-color: #E2B2A7; color: #6E2215; }

/* Progress */
.bar { height: 10px; border-radius: 99px; background: #EFEAE1; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--gold); border-radius: 99px; }
.ring { --p: 0; width: 140px; height: 140px; border-radius: 50%; background: conic-gradient(var(--gold) calc(var(--p) * 1%), #EFEAE1 0); display: grid; place-items: center; flex: none; }
.ring > div { width: 104px; height: 104px; border-radius: 50%; background: var(--paper); display: grid; place-items: center; font: 600 1.6rem Georgia, serif; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.cal .dow { background: #FBF9F5; font-size: .76rem; color: var(--muted); padding: 6px; text-align: center; font-weight: 600; }
.cal .day { min-height: 96px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); padding: 5px; font-size: .8rem; min-width: 0; }
.cal .day:nth-child(7n+1) { border-left: 0; }
.cal .day.out { background: #FAF8F4; color: #A9A39A; }
.cal .day.today .dn { background: var(--gold); border-radius: 99px; padding: 0 6px; font-weight: 700; }
.cal .ev { display: block; margin-top: 3px; padding: 2px 5px; border-radius: 5px; background: var(--gold-wash); border: 1px solid #F1DE99; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .ev.group { background: #F3EEE4; border-color: var(--line-strong); }
.cal .ev.s-cancelled, .cal .ev.s-voided { text-decoration: line-through; color: var(--muted); }
.cal-list { display: none; }

/* Questions */
.q { border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 16px; background: var(--paper); }
.q .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.q .stem { font-size: 1.02rem; margin: 0 0 12px; white-space: pre-line; }
.opt { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.opt:hover { background: var(--gold-wash); }
.opt input { margin-top: 3px; width: 18px; height: 18px; accent-color: #B38F00; flex: none; }
.opt.locked { cursor: default; }
.opt.is-correct { border: 2px solid var(--ink); background: #FBF9F5; }
.opt.is-chosen-wrong { border: 2px dashed var(--danger); background: var(--danger-wash); }
.opt .why { display: block; color: #3d3a35; font-size: .9rem; margin-top: 4px; }
.opt .tag { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-left: 6px; }

/* Library */
.lib-entry { border-bottom: 1px solid var(--line); padding: 14px 0; }
.lib-entry:last-child { border-bottom: 0; }
.lib-entry dl { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 4px 14px; margin: 8px 0 0; }
.lib-entry dt { font-weight: 600; font-size: .86rem; color: var(--muted); }
.lib-entry dd { margin: 0; }
.ba { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.ba div { border-radius: 10px; padding: 10px 12px; border: 1px solid var(--line); }
.ba .before { background: #FAF8F4; }
.ba .after { background: var(--gold-wash); border-color: #F1DE99; }
.ba b { display: block; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 4px; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 16px; }
.pills a { text-decoration: none; border: 1px solid var(--line-strong); border-radius: 99px; padding: 4px 11px; font-size: .86rem; background: var(--paper); }
.pills a.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.accuracy { border-left: 3px solid var(--gold-warm); padding-left: 10px; }
.history { font-size: .88rem; }
.history li { margin-bottom: 6px; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 8px 0; border-bottom: 1px solid var(--line); }
ul.plain li:last-child { border-bottom: 0; }

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main, .g3 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .side { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 0 100vmax rgba(0,0,0,0); }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(26,26,26,.35); }
  .menu-btn { display: inline-flex; margin-right: auto; background: var(--paper); border: 1px solid var(--line-strong); border-radius: 9px; padding: 8px 14px; font: inherit; font-weight: 600; }
  .top { justify-content: space-between; padding: 12px 16px; }
  main { padding: 4px 16px 32px; }
  .g2 { grid-template-columns: 1fr; }
  .stats { gap: 10px; } .stat { padding: 14px; } .stat strong { font-size: 1.35rem; } .stat .badge-ico { display: none; }
  h1 { font-size: 1.5rem; }
  .lib-entry dl { grid-template-columns: 1fr; } .ba { grid-template-columns: 1fr; }
  .cal { display: none; } .cal-list { display: block; }
  /* Stacked tables on phones */
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; padding: 6px 10px; }
  table.stack td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.stack td::before { content: attr(data-l); font-weight: 600; color: var(--muted); text-align: left; }
  table.stack td.num { text-align: right; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .side, .top, .actions, .btn { display: none !important; } body { background: #fff; } .card { box-shadow: none; } }
.auth-card { padding: 28px; } .auth-brand { text-align: center; margin-bottom: 14px; } .auth-brand h1 { margin-top: 10px; font-size: 1.45rem; }
.w100 { width: 100%; } .mb0 { margin-bottom: 0; } .mt-s { margin: .3rem 0 0; } .mt { margin-top: 14px; } .right { text-align: right; }
.prog { display: block; width: 100%; height: 10px; } .prog .track { fill: #EFEAE1; } .prog .fill { fill: var(--gold); }
.ring-svg { width: 140px; height: 140px; flex: none; } .ring-svg .track { stroke: #EFEAE1; } .ring-svg .fill { stroke: var(--gold); }
.ring-svg text { font: 600 22px Georgia, serif; fill: var(--ink); }
.ring-row { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }

.nav-group { margin: 16px 12px 4px; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.side li a.dev { color: var(--muted); }
.opt.locked:hover { background: transparent; }
.opt.locked.is-correct:hover { background: #FBF9F5; }
.opt.locked.is-chosen-wrong:hover { background: var(--danger-wash); }

.env-banner{background:#7a1f1f;color:#fff;text-align:center;font-weight:600;padding:.35rem .75rem;font-size:.9rem;letter-spacing:.02em}
.side-ver{padding:0 1rem .75rem;margin:0}

.prewrap{white-space:pre-line}
.present-body{max-width:1100px;margin:0 auto;padding:24px 20px}
.present-body .stem{font-size:1.35rem;line-height:1.5}
.present-body .opt{font-size:1.15rem}
.present-head{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:16px}
.exam-grid{display:flex;flex-wrap:wrap;gap:6px;margin:8px 0}
.exam-grid a,.exam-grid span{display:inline-flex;align-items:center;justify-content:center;min-width:2.2rem;height:2.2rem;border:1px solid var(--line);border-radius:6px;text-decoration:none;font-size:.85rem;color:inherit;background:#fff}
.exam-grid .ans{background:#EFF6EE;border-color:#B9D8B5}
.exam-grid .flag{outline:2px solid #C78A00;outline-offset:-2px}
.exam-grid .cur{background:var(--gold-wash);border-color:#D9BD5A;font-weight:700}
.timer{font-variant-numeric:tabular-nums;font-weight:700;font-size:1.15rem}
.timer.low{color:#A33}
.disclaimer{font-size:.85rem;color:#555;border-left:3px solid #D9BD5A;padding:6px 10px;background:#FAF8F4}

/* v0.9.0: running live sessions stand out on the Live Supervision list */
.running-now{border:2px solid #D9BD5A}
.exam-map summary{cursor:pointer;font-size:.9rem;color:var(--muted,#555);margin:6px 0}
.exam-grid .cur.flag{outline:2px solid #C78A00}

/* TEST preview account banner */
.preview-banner{background:#7a4b00}
[hidden] { display: none !important; }
.exam-jump { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 4px 0 10px; }
.exam-jump a { margin-right: 2px; }
.jump-form { display: inline-flex; align-items: center; gap: 6px; }
.jump-num { width: 5.5em; }
.exam-grid .flag::after { content: "⚑"; font-size: .7rem; margin-left: 2px; }
.review-grid a { min-width: 2.6rem; height: 2.6rem; }
.exam-jump .jump-form { display: inline-flex; flex-wrap: nowrap; align-items: center; gap: 6px; }
.exam-jump .jump-form label { display: inline; margin: 0; font-weight: 600; }
.exam-jump .jump-form input.jump-num { width: 5em; min-width: 0; margin: 0; padding: 6px 8px; }
.sigpad { max-width: 640px; }
.sigpad-canvas { display: block; width: 100%; aspect-ratio: 900 / 260; background: #fff; border: 1px solid var(--line); border-radius: 8px; cursor: crosshair; }
.sigpad-line { height: 0; border-top: 1px dashed #b9b2a8; margin: -40px 18px 40px; pointer-events: none; }
.sigpad-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.sigpad-upload { cursor: pointer; }
.sig-img { display: block; max-width: 260px; max-height: 90px; background: #fff; border-bottom: 1px solid #b9b2a8; padding: 4px 0; }
.agreement-text { white-space: pre-wrap; font-size: .95rem; line-height: 1.55; max-height: 60vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 16px; background: #fff; }
.error-text { color: #8a1c1c; font-weight: 600; }
