:root {
  --ink: #17202a;
  --muted: #4b5866;
  --line: #d8dee6;
  --paper: #ffffff;
  --wash: #f4f6f9;
  --brand: #0f5c4d;
  --brand-ink: #ffffff;
  --accent: #1d4ed8;
  --warn-bg: #fff4d6;
  --warn-ink: #5c4300;
  --error: #b42318;
  --error-bg: #fdecea;
  --ok: #0f7a3d;
  --focus: #1d4ed8;
  --radius: 10px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--wash);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Naskh Arabic", sans-serif;
  overflow-wrap: anywhere;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
p { margin: 0 0 .75rem; }
code { font: .9em/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--wash); padding: .05rem .3rem; border-radius: 4px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
main:focus { outline: none; }

.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 10; background: var(--paper); color: var(--ink); padding: .5rem .75rem; border-radius: var(--radius); }
.skip-link:focus { top: 1rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

.site-header { background: var(--paper); border-bottom: 1px solid var(--line); }
.dev-banner { margin: 0; padding: .5rem 1rem; background: var(--warn-bg); color: var(--warn-ink); font-size: .9rem; display: flex; flex-wrap: wrap; gap: .25rem .75rem; }
.dev-banner strong { text-transform: uppercase; letter-spacing: .06em; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .75rem 1rem; max-width: 1200px; margin: 0 auto; }
.brand { font-weight: 700; display: inline-flex; align-items: center; gap: .5rem; margin-right: auto; }
.brand-mark { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 8px; background: var(--brand); color: var(--brand-ink); font-size: .8rem; letter-spacing: .04em; }
.pill { margin: 0; font-size: .85rem; padding: .25rem .65rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.pill.ok { color: var(--ok); border-color: #9fd5b5; background: #effaf3; }
.pill.bad { color: var(--error); border-color: #f0b4ae; background: var(--error-bg); }
.account { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; font-size: .9rem; }

main { max-width: 1200px; margin: 0 auto; padding: 1rem; }

button { font: inherit; min-height: 44px; padding: .55rem 1rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer; }
button.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
button.secondary { min-height: 40px; }
button:disabled { opacity: .55; cursor: not-allowed; }
input[type="text"], input[type="email"], input[type="password"] { font: inherit; width: 100%; min-height: 44px; padding: .55rem .75rem; border: 1px solid #9aa6b2; border-radius: var(--radius); background: var(--paper); color: var(--ink); }
input[aria-invalid="true"] { border-color: var(--error); border-width: 2px; }

.signin { max-width: 440px; margin: 2rem auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
/* Student / Teacher or staff: a native radio group, so the focus ring is the input's own. */
.mode-switch { border: 0; padding: 0; margin: 0 0 1rem; min-width: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.mode-switch legend { font-weight: 600; padding: 0; margin-bottom: .4rem; }
.mode-option { flex: 1 1 10rem; display: flex; align-items: center; gap: .6rem; min-height: 44px; padding: .5rem .75rem; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.mode-option input { width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--brand); }
.mode-option:has(input:checked) { border-color: var(--brand); background: #effaf6; font-weight: 600; }
.field { display: grid; gap: .3rem; margin-bottom: 1rem; }
.field label { font-weight: 600; }
.field-hint { margin: 0; color: var(--muted); font-size: .85rem; }
.hint { color: var(--muted); font-size: .9rem; }
.error { color: var(--error); background: var(--error-bg); border-radius: var(--radius); padding: .6rem .8rem; }
.notice { background: #eef4ff; color: #1e3a8a; border-radius: var(--radius); padding: .6rem .8rem; }
.warning { background: var(--warn-bg); color: var(--warn-ink); border-radius: var(--radius); padding: .6rem .8rem; }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.tabs [role="tab"] { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: transparent; font-weight: 600; color: var(--muted); }
.tabs [role="tab"][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brand); }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.panel-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .5rem 1rem; margin-bottom: 1rem; }
.panel-head > div { flex: 1 1 28rem; min-width: 0; }
.latency, .source { margin: 0; font-size: .85rem; color: var(--muted); background: var(--wash); border-radius: var(--radius); padding: .4rem .7rem; }
.coach-frame { display: block; width: 100%; min-height: 70vh; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }

.lumen-form fieldset { border: 0; padding: 0; margin: 0 0 1rem; min-width: 0; }
.lumen-form legend { font-weight: 700; margin-bottom: .5rem; padding: 0; }
.student-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); gap: .5rem; }
.student { display: flex; align-items: center; gap: .6rem; border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .75rem; min-height: 44px; cursor: pointer; }
.student input { width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--brand); }
.student small { display: block; color: var(--muted); }
.student:has(input:checked) { border-color: var(--brand); background: #effaf6; }
.student-group { grid-column: 1 / -1; margin: .5rem 0 0; font-weight: 700; color: var(--warn-ink); }
.student .tag { color: var(--warn-ink); font-weight: 600; }

.progress-wrap { margin: 1.25rem 0; }
.progress { list-style: none; margin: 0 0 .5rem; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; }
.progress li { display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; font-size: .9rem; color: var(--muted); border-top: 4px solid var(--line); padding-top: .4rem; }
.progress .dot { width: .75rem; height: .75rem; border-radius: 50%; background: var(--line); }
.progress li.done { color: var(--ink); border-top-color: var(--brand); }
.progress li.done .dot { background: var(--brand); }
.progress li[aria-current="step"] { color: var(--ink); font-weight: 700; border-top-color: var(--accent); }
.progress li[aria-current="step"] .dot { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.progress li.failed { color: var(--error); border-top-color: var(--error); }
@keyframes pulse { 50% { transform: scale(1.35); } }
@media (prefers-reduced-motion: reduce) { .progress li[aria-current="step"] .dot { animation: none; } }
.lumen-status { font-weight: 600; }

.lumen-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 1rem; }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; background: var(--paper); min-width: 0; }
.card.teacher { background: #fbfcfe; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 700; color: var(--muted); margin-bottom: .25rem; }
.kind { display: inline-block; font-size: .8rem; font-weight: 700; text-transform: capitalize; background: #effaf6; color: var(--brand); border-radius: 999px; padding: .1rem .6rem; }
.rec-title { font-size: 1.2rem; font-weight: 700; }
/* D13: Lumen speaks first. The tone sets the colour: support is warm, celebrate is bright. */
.lumen-says { display: grid; gap: .5rem; margin-bottom: .75rem; }
.says { margin: 0; padding: .75rem .9rem; border: 1px solid var(--line); border-left-width: 6px; border-radius: var(--radius); background: var(--wash); }
.says-label { display: block; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.says-text { display: block; font-size: 1.15rem; font-weight: 600; }
.says[data-tone="support"] { background: #fff1e8; border-color: #f2b48f; border-left-color: #c2410c; color: #6b2a0a; }
.says[data-tone="celebrate"] { background: #fff6c2; border-color: #f0c419; border-left-color: #b45309; color: #4a3500; }
.says[data-tone="encourage"] { background: #ecfaf3; border-color: #9fd5b5; border-left-color: var(--ok); color: #0b4f2a; }
.says[data-tone="welcome_back"] { background: #eef4ff; border-color: #b9cdfb; border-left-color: var(--accent); color: #1e3a8a; }
.says-help { margin: 0; padding: 0 .9rem; font-style: italic; color: #6b2a0a; }
.rec-item { border-top: 1px solid var(--line); padding-top: .75rem; }
.teacher-voice { margin: 0 0 .75rem; padding-left: 1.25rem; }
.simulate { margin-top: 1rem; border-style: dashed; background: #fffdf5; }
.simulate-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .5rem; }

.trace { margin: 0; padding-left: 1.25rem; display: grid; gap: .75rem; }
.trace li { padding-left: .25rem; }
.trace .trace-head { display: flex; flex-wrap: wrap; gap: .25rem .6rem; align-items: baseline; }
.trace .ms { color: var(--muted); font-size: .85rem; margin-left: auto; }
.trace p { margin: .2rem 0 0; }

@media (max-width: 600px) {
  h1 { font-size: 1.3rem; }
  main { padding: .75rem; }
  .panel { padding: .75rem; }
  .signin { margin: 1rem auto; padding: 1rem; }
  .progress { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
