:root {
  --navy: #17365d; --navy-2: #22487a; --teal: #1f6b6e; --teal-2: #185658;
  --bg: #f3f5f8; --card: #ffffff; --line: #cfd6df; --ink: #1d2733; --muted: #566273;
  --warn-bg: #fff4e0; --warn: #8a5300; --err-bg: #fdecec; --err: #a32020; --ok-bg: #e7f4ee; --ok: #1d6b45;
  --gap: #d9dee5; --focus: #f2b134;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 16px; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; z-index: 10; background: #fff; padding: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.topbar { background: var(--navy); color: #fff; display: flex; justify-content: space-between; align-items: center;
  padding: 10px 24px; gap: 12px; min-height: 60px; }
.brand { font-size: 1.35rem; display: flex; align-items: center; gap: 10px; }
.brand select { font-size: 1.05rem; background: var(--navy-2); color: #fff; border: 1px solid #5d7aa3; border-radius: 6px; padding: 6px 10px; min-height: 40px; }
.topright { display: flex; gap: 16px; align-items: center; font-size: .95rem; }
.private { opacity: .9; }
button.link { background: none; border: 0; color: #fff; text-decoration: underline; cursor: pointer; font: inherit; min-height: 40px; }
.menu-toggle { background: var(--navy-2); color: #fff; border: 1px solid #5d7aa3; border-radius: 6px; padding: 8px 14px; font: inherit; min-height: 44px; }

.layout { display: flex; min-height: calc(100vh - 60px); }
nav { width: 200px; background: #fff; border-right: 1px solid var(--line); padding: 18px 0; flex-shrink: 0; }
nav a { display: block; padding: 12px 24px; color: var(--navy); text-decoration: none; font-size: 1.05rem; }
nav a:hover { background: #eef2f7; }
nav a[aria-current="page"] { background: #e3ebf5; border-left: 4px solid var(--teal); padding-left: 20px; font-weight: 600; }
main { flex: 1; padding: 24px 32px 48px; min-width: 0; }
main:focus { outline: none; }

h1 { color: var(--navy); font-weight: 500; font-size: 1.8rem; margin: 0 0 6px; }
h2 { color: var(--navy); font-weight: 500; font-size: 1.2rem; margin: 0 0 10px; }
h3 { font-size: 1rem; margin: 14px 0 6px; color: var(--navy); }
.sub { color: var(--muted); margin: 0 0 18px; display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; }
.footnote { color: var(--muted); font-size: .85rem; margin-top: 24px; }

.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; min-width: 0; }
a.card, button.card { text-decoration: none; color: inherit; text-align: left; font: inherit; cursor: pointer; width: 100%; }
a.card:hover, button.card:hover { border-color: var(--teal); }
.card h2 { margin-bottom: 8px; }
.card .big { font-size: 1.25rem; }
.card p { margin: 4px 0; color: var(--ink); }
.muted { color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; margin-bottom: 18px; }
.stack > * + * { margin-top: 18px; }

.btn { background: var(--teal); color: #fff; border: 0; border-radius: 6px; padding: 10px 18px; font: inherit; cursor: pointer; min-height: 44px; }
.btn:hover { background: var(--teal-2); }
.btn.secondary { background: #fff; color: var(--teal); border: 1px solid var(--teal); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.small { padding: 6px 12px; min-height: 36px; font-size: .92rem; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

label { font-size: .92rem; color: var(--muted); display: inline-flex; flex-direction: column; gap: 4px; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; min-height: 40px; background: #fff; color: var(--ink); }
textarea { width: 100%; min-height: 140px; font-family: ui-monospace, monospace; font-size: .9rem; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tabs button { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 8px 14px; font: inherit; cursor: pointer; min-height: 40px; color: var(--navy); }
.tabs button[aria-selected="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.tabs button:disabled { color: #8a96a6; cursor: not-allowed; }

.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #e4e8ee; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .85rem; position: sticky; top: 0; background: #fff; }
td input { width: 64px; min-height: 36px; padding: 4px 6px; }
td select { min-height: 36px; padding: 4px 6px; }
tr.absent td { color: var(--muted); }
td.err input, input.err { border-color: var(--err); background: var(--err-bg); }
.cellerr { color: var(--err); font-size: .8rem; display: block; max-width: 220px; }
a.rowlink { color: var(--navy); font-weight: 600; }

.pill { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: .82rem; border: 1px solid var(--line); background: #f6f8fa; white-space: nowrap; }
.pill.warn { background: var(--warn-bg); color: var(--warn); border-color: #f0c98a; }
.pill.ok { background: var(--ok-bg); color: var(--ok); border-color: #a9d6bf; }
.pill.err { background: var(--err-bg); color: var(--err); border-color: #eab1b1; }
.save-status { font-size: .92rem; }
.notice { background: var(--warn-bg); border: 1px solid #f0c98a; color: var(--warn); padding: 10px 14px; border-radius: 6px; margin: 10px 0; }
.notice.err { background: var(--err-bg); border-color: #eab1b1; color: var(--err); }
.notice.ok { background: var(--ok-bg); border-color: #a9d6bf; color: var(--ok); }

ul.actions { list-style: none; padding: 0; margin: 0; }
ul.actions li { padding: 8px 0; border-bottom: 1px solid #eef1f5; }
ul.actions li:last-child { border-bottom: 0; }
.chart svg { width: 100%; height: auto; display: block; }
details summary { cursor: pointer; color: var(--teal); margin-top: 8px; }

.signin { max-width: 560px; margin: 40px auto; }
.signin .users { display: grid; gap: 8px; margin-top: 12px; }
.timer { font-variant-numeric: tabular-nums; font-size: 2rem; color: var(--navy); }
.codebtns { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.codebtns .btn { min-height: 64px; font-size: 1.05rem; }
.codebtns .btn[aria-pressed="true"] { outline: 3px solid var(--focus); }
#toast { position: fixed; bottom: 20px; right: 20px; background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 6px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 360px; }
#toast.show { opacity: 1; }

/* Mobile cards for capture: one student at a time */
.entry-card { display: none; }

@media (max-width: 900px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .topbar { padding: 8px 16px; flex-wrap: wrap; }
  .private { display: none; }
  .menu-toggle[hidden] { display: none; }
  .menu-toggle { display: inline-block; }
  .layout { display: block; }
  nav { width: 100%; border-right: 0; border-bottom: 1px solid var(--line); padding: 4px 0; }
  nav.closed { display: none; }
  main { padding: 16px; }
  .cards { grid-template-columns: 1fr; }
  .codebtns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .desktop-grid { display: none; }
  .entry-card { display: block; }
}
@media (min-width: 721px) { .menu-toggle { display: none !important; } }
@media print { nav, .topbar, .btn { display: none !important; } main { padding: 0; } }

td:first-child { white-space: nowrap; }
.cellerr { max-width: 160px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.legend .hm { padding: 4px 10px; border-radius: 4px; font-size: .82rem; }
table.heat td.hm, .legend .hm { text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
table.heat td.hm { min-width: 54px; border: 1px solid var(--card); }
.hm.b1 { background: #f6d5cf; color: #6b1d12; } .hm.b2 { background: #fbe7c4; color: #6b4300; }
.hm.b3 { background: #d6ebe4; color: #17493a; } .hm.b4 { background: #9fd1c3; color: #0d3a2e; }
.hm.na { background: #e7eaee; color: #4d5866; font-weight: 400; } .hm.miss { background: #e7eaee; color: #8a2b2b; font-weight: 600; }
.mbar { height: 10px; background: #e4e8ee; border-radius: 5px; overflow: hidden; } .mbar b { display: block; height: 100%; background: var(--teal); }
.report-doc { max-width: 860px; } .report-doc h3 { margin-top: 18px; } .report-doc p { line-height: 1.55; }
.rh { border-bottom: 2px solid var(--navy); padding-bottom: 10px; margin-bottom: 6px; } .eyebrow-s { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--teal); margin: 0; }
@media print { .noprint, #toast, .demo-bar { display: none !important; } .report-doc { border: 0; max-width: none; } .hm { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

.qr svg { width: 200px; height: 200px; display: block; background: #fff; padding: 8px; border-radius: 6px; }
.signin .stack label { display: flex; }
.signin input { width: 100%; }

.titlerow { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.helpbox { margin: 8px 0 14px; max-width: 820px; }
.helpbox p, .helpbox li { line-height: 1.5; }
.start { margin-bottom: 18px; border-left: 4px solid var(--teal); }
.start .steps { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 10px; }
.start .steps li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.start .steps li.done { color: var(--muted); }
.start .tick { font-weight: 700; color: var(--teal); width: 1.2em; }

.capgrid th.beh, .capgrid td.beh { background: color-mix(in srgb, var(--teal) 6%, transparent); }
.capgrid tr.grp th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; border-bottom: 0; padding-bottom: 0; }
.capgrid tr.focus td:first-child { border-left: 3px solid var(--focus); }
.capgrid input.note { width: 170px; }
.capgrid select { min-width: 64px; }
.small { font-size: .8rem; }
nav a.navguide { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.guide { display: grid; gap: 18px; max-width: 900px; } .guide li { margin: 6px 0; line-height: 1.5; }
