/* Student site: phones first. Colours, font and shape come from tokens.css (load it first), shared with staff.
   Performance colours: .pill.good / .close / .poor and .v-good / .v-close / .v-poor, always with an icon or word. */

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1 { font-size: 1.35rem; line-height: 1.25; margin: 0 0 .25rem; text-wrap: balance; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
p { margin: .3rem 0; }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.eyebrow { font-size: .75rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; margin: 0 0 .1rem; }

/* ---------- Top bar ---------- */
.topbar { background: var(--bar-bg); color: var(--bar-ink); display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: .6rem 16px; padding-top: calc(.6rem + env(safe-area-inset-top, 0px)); }
.brand { color: var(--bar-ink); font-weight: 700; display: flex; align-items: center; gap: .55rem; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 28px; height: 37px; background: #fff; border-radius: 7px; padding: 3px; display: grid; place-items: center; flex: none; }
.brand-logo img { height: 31px; width: auto; }
.bar-tools { display: flex; align-items: center; gap: 8px; }
.bar-tools form { margin: 0; }
.bar-btn, a.bar-btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: .85rem; font-weight: 600; color: var(--bar-ink);
  background: transparent; border: 1px solid var(--bar-line); border-radius: var(--radius-sm); padding: 6px 10px; cursor: pointer; white-space: nowrap; }
.bar-btn:hover { background: var(--bar-hover); text-decoration: none; }
.bar-btn .icon { width: 16px; height: 16px; vertical-align: 0; }
.bar-btn.icon-only { padding: 6px 8px; }
/* The bell: the unread count sits on it (on the phone's icon-only button, at its corner) */
.bar-btn.bell { position: relative; }
.bell-count { min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.side-foot .bell .bell-count { margin-left: 2px; }
.bar-btn.icon-only .bell-count { position: absolute; top: -7px; right: -7px; box-shadow: 0 0 0 2px var(--bar-bg); }
.linkbtn { background: none; border: 0; color: var(--link); font: inherit; cursor: pointer; text-decoration: underline; padding: 0; }

/* Staff "View as student" */
.preview-bar { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; font-size: .9rem; padding: .45rem 16px; text-align: center;
  color: var(--ink); background: color-mix(in srgb, var(--close) 14%, var(--surface)); border-bottom: 1px solid color-mix(in srgb, var(--close) 35%, transparent); }
.preview-bar .icon { color: var(--close); }

/* ---------- Layout and cards ---------- */
main { max-width: 960px; margin: 0 auto; padding: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; min-width: 0; }
.card.narrow { max-width: 420px; margin: 24px auto; }
.card-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.card-head h2, .card-head h3 { margin: 0; display: flex; align-items: center; gap: 8px; }
.card-head h2 .icon { color: var(--muted); }
.card-link { font-size: .85rem; font-weight: 600; display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.card-link .icon { width: 15px; height: 15px; vertical-align: 0; }
.actions { display: flex; gap: 6px; }
/* Login: what's inside + the sign-in card; side by side on wide screens */
.login-wrap { display: grid; gap: 20px; max-width: 900px; margin: 12px auto; }
.login-intro h1 { margin: .1rem 0 .3rem; }
.login-points { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: 12px; }
.login-points li { display: flex; gap: 12px; align-items: flex-start; }
.login-points .icon { flex: none; width: 22px; height: 22px; margin-top: 2px; color: var(--accent); }
.login-points strong { display: block; }
.login-card { order: -1; } /* phones: the form first, what's inside below it */
.login-card h2 { margin-top: 0; }
.login-help { margin: 1rem 0 0; padding-left: 1.1rem; display: grid; gap: 4px; }
@media (min-width: 760px) { .login-wrap { grid-template-columns: 1fr minmax(320px, 400px); align-items: start; margin-top: 32px; } .login-card { order: 0; } }
.install-steps { margin: .4rem 0 0; padding-left: 1.3rem; }
.demo-note { display: flex; gap: 6px; align-items: flex-start; font-size: .85rem; color: var(--muted); margin: 0 0 .6rem; }
.demo-note .icon { flex: none; width: 15px; height: 15px; margin-top: 3px; color: var(--link); }
.demo-bar .btn-link { padding: .2rem .8rem; white-space: nowrap; flex: none; }
.install-steps li { margin: .25rem 0; }
label.check { display: flex; align-items: center; gap: 10px; font-weight: 600; margin: .6rem 0; }
label.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.two { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.two .card { margin-bottom: 0; }
.two + .card { margin-top: 14px; }
.grow { flex: 1; min-width: 0; }
.big { font-size: 1.6rem; font-weight: 700; margin: 0 0 .25rem; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* ---------- Forms and buttons ---------- */
label { display: block; margin: .75rem 0; font-weight: 600; }
input, select, textarea { display: block; width: 100%; margin-top: .3rem; padding: .7rem .8rem; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-color: transparent; }
input.code-input { font-size: 1.6rem; letter-spacing: .5em; text-align: center; font-variant-numeric: tabular-nums; padding: .6rem .4rem .6rem .9rem; }
.btn, .btn-link { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-weight: 700; color: var(--accent-ink);
  background: var(--accent); border: 0; border-radius: var(--radius-sm); cursor: pointer; text-decoration: none; }
.btn { width: 100%; margin-top: .5rem; padding: .75rem 1rem; }
.btn-link { padding: .4rem .9rem; font-size: .9rem; }
.btn:hover, .btn-link:hover { background: var(--accent-hover); text-decoration: none; }
.btn .icon, .btn-link .icon { width: 17px; height: 17px; vertical-align: 0; }
.btn-quiet { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-weight: 600; font-size: .9rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .5rem .9rem; text-decoration: none; }
.btn-quiet:hover { border-color: var(--muted); text-decoration: none; }
.btn-quiet.wide { display: flex; width: 100%; }
.btn-small { font: inherit; font-size: .85rem; font-weight: 600; padding: .3rem .7rem; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer; }
.btn-small:hover { border-color: var(--muted); }
button:disabled, input:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Notices, pills, chips ---------- */
.notice { border-radius: var(--radius-sm); padding: .6rem .8rem; margin-bottom: 1rem; border: 1px solid var(--line); background: var(--surface); }
.notice.error { border-color: color-mix(in srgb, var(--poor) 40%, transparent); background: color-mix(in srgb, var(--poor) 8%, var(--surface)); color: var(--ink); }
.notice.info, .notice.success { border-color: color-mix(in srgb, var(--good) 40%, transparent); background: color-mix(in srgb, var(--good) 8%, var(--surface)); color: var(--ink); }
.pill { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 1px 9px; font-size: .8rem; font-weight: 700; white-space: nowrap;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.pill .icon { width: 13px; height: 13px; stroke-width: 2.2; vertical-align: 0; }
.pill.good { color: var(--good); background: color-mix(in srgb, var(--good) 11%, var(--surface)); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.pill.close { color: var(--close); background: color-mix(in srgb, var(--close) 10%, var(--surface)); border-color: color-mix(in srgb, var(--close) 32%, transparent); }
.pill.poor { color: var(--poor); background: color-mix(in srgb, var(--poor) 10%, var(--surface)); border-color: color-mix(in srgb, var(--poor) 28%, transparent); }
.v-good { color: var(--good); } .v-close { color: var(--close); } .v-poor { color: var(--poor); }
.chip { display: inline-block; background: var(--chip-bg); color: var(--ink); border-radius: 999px; padding: 1px 9px; font-size: .8rem; font-weight: 600; margin: 1px 4px 1px 0; white-space: nowrap; }
.subj { --sj: var(--sj-default); --sj-ink: var(--sj-default-ink); }
.subj-physics { --sj: var(--sj-physics); --sj-ink: var(--sj-physics-ink); }
.subj-chemistry { --sj: var(--sj-chemistry); --sj-ink: var(--sj-chemistry-ink); }
.subj-mathematics, .subj-plus-maths { --sj: var(--sj-mathematics); --sj-ink: var(--sj-mathematics-ink); }
.subj-biology, .subj-plus-bio { --sj: var(--sj-biology); --sj-ink: var(--sj-biology-ink); }
.subj-computer-science { --sj: var(--sj-computer-science); --sj-ink: var(--sj-computer-science-ink); }
.subj-science { --sj: var(--sj-science); --sj-ink: var(--sj-science-ink); }
.chip.subj { background: var(--sj); color: var(--sj-ink); font-weight: 700; }
.paid { color: var(--good); }
.overdue { color: var(--poor); font-weight: 600; }

/* ---------- Tables (stacked into rows on phones where marked .stack) ---------- */
.table-wrap { overflow-x: auto; margin: .25rem 0 .5rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; background: var(--surface-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { padding: .5rem 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 0 10px; }
  table.stack td { border: 0; padding: 1px 0; text-align: left; }
  table.stack td.num { text-align: right; }
  table.stack td[data-label]::before { content: attr(data-label) " "; color: var(--muted); font-size: .8rem; }
}

/* ---------- Tiles ---------- */
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); margin: .5rem 0; flex: 1; }
.tile { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px; background: var(--surface-2); }
.tile-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.tile-num { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Overview ---------- */
.profile { display: flex; gap: 14px; align-items: center; }
.photo { width: 64px; height: 64px; object-fit: cover; border-radius: 50%; border: 1px solid var(--line); background: var(--chip-bg); flex: none; }
.chips { margin: .5rem 0 0; }
.next-test { border-color: color-mix(in srgb, var(--brand-orange) 45%, var(--line)); }
.next-test .eyebrow { color: var(--accent); }
.next-test h2 { margin: .1rem 0 .3rem; }
.booking-line { margin-top: .7rem; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.booking-line .btn-link { width: 100%; padding: .65rem 1rem; font-size: 1rem; }
ul.rows, ul.links { list-style: none; padding: 0; margin: .25rem 0; }
ul.rows li, ul.links li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: .5rem 0; border-bottom: 1px solid var(--line); }
ul.rows li:last-child, ul.links li:last-child { border-bottom: 0; }
/* Notifications inbox: new ones in bold with an accent edge and a "New" word (colour is never the only cue) */
ul.inbox { list-style: none; padding: 0; margin: .25rem 0; }
ul.inbox li { border-bottom: 1px solid var(--line); }
ul.inbox li:last-child { border-bottom: 0; }
.inbox-item { display: flex; gap: 12px; align-items: flex-start; padding: .7rem .5rem; color: var(--ink); border-left: 3px solid transparent; }
a.inbox-item:hover { background: var(--chip-bg); text-decoration: none; }
.inbox-icon .icon { width: 18px; height: 18px; color: var(--muted); margin-top: 2px; }
.inbox-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.inbox-body { overflow-wrap: anywhere; }
ul.inbox li.read strong { font-weight: 500; }
ul.inbox li.read .inbox-body { color: var(--muted); }
ul.inbox li.unread .inbox-item { border-left-color: var(--accent); }
ul.inbox li.unread .inbox-icon .icon { color: var(--accent); }
.inbox-new { color: var(--accent); font-weight: 700; }
.ring-row { display: flex; align-items: center; gap: 14px; }
.ring { width: 72px; height: 72px; flex: none; }
.ring circle { fill: none; stroke-width: 3.6; }
.ring .track { stroke: var(--seg-track); }
.ring .bar { stroke: var(--muted); stroke-linecap: round; }
.ring.good .bar { stroke: var(--good); } .ring.close .bar { stroke: var(--close); } .ring.poor .bar { stroke: var(--poor); }

/* Month calendar: a coloured day has something on it; tap it for details */
table.month { table-layout: fixed; margin-bottom: .25rem; max-width: 420px; }
table.month th { background: none; text-align: center; padding: 2px; border: 0; }
table.month td { text-align: center; padding: 2px; border: 0; }
.day { display: inline-block; width: 2.3rem; height: 2.3rem; line-height: 2.3rem; border-radius: 999px; border: 0; padding: 0;
  font: inherit; font-size: .9rem; background: none; color: var(--ink); font-variant-numeric: tabular-nums; }
button.day { cursor: pointer; font-weight: 700; }
.day.today { box-shadow: inset 0 0 0 2px var(--brand-orange); }
.day.sel { outline: 2px solid var(--ink); outline-offset: 1px; }
.has-test { background: var(--sj-mathematics); color: var(--sj-mathematics-ink); }
.has-holiday { background: var(--sj-biology); color: var(--sj-biology-ink); }
.has-announcement { background: var(--sj-chemistry); color: var(--sj-chemistry-ink); }
.legend { color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.key { display: inline-block; width: 12px; height: 12px; border-radius: 999px; margin-right: -6px; vertical-align: middle; }
.key.line-me { height: 3px; border-radius: 0; background: var(--accent); width: 18px; }
.key.line-avg { height: 0; border-radius: 0; border-top: 2px dashed var(--muted); width: 18px; }
.day-detail { border-top: 1px solid var(--line); margin-top: .5rem; padding-top: .25rem; }
.day-detail h3 { margin: .4rem 0; }
.agenda-item { padding: 2px 0 8px; }
.agenda-item.cancelled strong { text-decoration: line-through; }
.agenda-item.event-holiday strong { color: var(--good); }
.agenda-item.event-announcement strong { color: var(--close); }
.portions { margin: .25rem 0 0 1.1rem; padding: 0; }

/* How you're doing */
ul.doing { list-style: none; padding: 0; margin: 0; }
ul.doing li { padding: .5rem 0; border-bottom: 1px solid var(--line); }
ul.doing li:last-child { border-bottom: 0; }
ul.doing strong { display: block; }
ul.doing .arrow { font-weight: 700; margin-right: 2px; }
ul.doing li.up .arrow { color: var(--good); }
ul.doing li.nudge .arrow { color: var(--close); }

/* ---------- Tests tab ---------- */
.subject-block { border-top: 1px solid var(--line); padding-top: .6rem; margin-top: .9rem; }
.subject-block:first-of-type { border-top: 0; margin-top: 0; }
.subject-block h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.trend { width: 100%; max-width: 480px; height: auto; display: block; margin: .25rem 0 .5rem; }
.trend .grid { stroke: var(--line); stroke-width: 1; }
.trend .axis { fill: var(--muted); font-size: 9px; text-anchor: end; }
.trend text.axis[text-anchor="middle"] { text-anchor: middle; }
.trend path { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.trend path.me { stroke: var(--accent); }
.trend path.avg { stroke: var(--muted); stroke-dasharray: 5 4; stroke-width: 1.5; }
.trend circle.me { fill: var(--accent); }
details summary { cursor: pointer; color: var(--link); padding: .3rem 0; }

/* ---------- Attendance ---------- */
.att-top { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-bottom: 8px; }
.att-donut { display: flex; align-items: center; gap: 12px; }
.att-donut svg { width: 88px; height: 88px; transform: rotate(-90deg); }
.att-donut circle { fill: none; stroke-width: 3.6; }
.att-donut .track { stroke: var(--seg-track); }
.att-donut .bar { stroke: var(--muted); stroke-linecap: round; }
.att-donut.good .bar { stroke: var(--good); } .att-donut.close .bar { stroke: var(--close); } .att-donut.poor .bar { stroke: var(--poor); }
.att-donut-label strong { display: block; font-size: 1.6rem; }
.att-matrix td.att-cell, .att-matrix th.att-cell { text-align: center; }
.att-mark { display: inline-block; min-width: 28px; border-radius: 6px; padding: 1px 6px; font-weight: 700; text-align: center; }
.att-present { background: color-mix(in srgb, var(--good) 15%, var(--surface)); color: var(--good); }
.att-absent { background: color-mix(in srgb, var(--poor) 13%, var(--surface)); color: var(--poor); }
.att-excused { background: var(--chip-bg); color: var(--muted); }

/* ---------- Slot booking ---------- */
.code { font-family: var(--mono); font-weight: 700; font-size: 1.05rem; letter-spacing: .08em;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 8px; }
.booked { border-color: color-mix(in srgb, var(--good) 45%, var(--line)); background: color-mix(in srgb, var(--good) 5%, var(--surface)); }
.booked h2 { margin: .1rem 0 .4rem; }
.booked .done { display: flex; align-items: center; gap: 8px; color: var(--good); font-weight: 700; }
.booked .code { font-size: 1.5rem; padding: 4px 12px; display: inline-block; margin-top: 2px; }
ul.slots { list-style: none; padding: 0; margin: 0 0 .5rem; }
label.slot { display: flex; align-items: center; gap: 12px; font-weight: 400; margin: 0 0 8px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface); }
label.slot input { width: auto; margin: 0; display: inline; accent-color: var(--accent); }
label.slot.mine { border-color: var(--good); }
label.slot.full { opacity: .6; cursor: not-allowed; }
label.slot:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
label.slot:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Signed-in shell: navy sidebar from 900 px; on phones a top bar and a floating tab bar ---------- */
.shell { min-height: 100vh; }
.sidebar { display: contents; }
.side-brand, .side-foot { display: none; }
.page { min-width: 0; }
.tabs { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 20; display: flex; gap: 2px;
  padding: 6px; border-radius: 20px; background: var(--bar-bg); box-shadow: 0 10px 28px rgba(8, 18, 34, .32), 0 2px 6px rgba(8, 18, 34, .18);
  max-width: 520px; margin: 0 auto; }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .4rem .1rem; border-radius: 14px;
  color: var(--bar-ink-2); font-weight: 700; font-size: .72rem; }
.tabs a:hover { text-decoration: none; color: var(--bar-ink); background: var(--bar-hover); }
.tabs a.on { color: var(--accent-ink); background: var(--accent); }
.tabs .icon { width: 22px; height: 22px; vertical-align: 0; }
.tabs a.on .icon { stroke-width: 2.2; }
body.has-tabs main { padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 360px) { .brand-name { display: none; } }

/* Theme switch in the sidebar (the phone uses the cycling button in the top bar) */
.theme-switch { display: flex; gap: 2px; padding: 3px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, .08); }
.theme-switch button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px; font: inherit; font-size: .75rem; font-weight: 600;
  color: var(--bar-ink-2); background: transparent; border: 0; border-radius: 6px; padding: 5px 4px; cursor: pointer; }
.theme-switch button .icon { width: 15px; height: 15px; vertical-align: 0; }
.theme-switch button:hover { color: var(--bar-ink); background: var(--bar-hover); }
.theme-switch button[aria-pressed="true"] { color: var(--bar-bg); background: var(--bar-ink); }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); background: linear-gradient(to right, var(--bar-bg) 220px, transparent 220px); }
  .sidebar { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 12px 14px;
    background: var(--bar-bg); color: var(--bar-ink); }
  .side-brand { display: flex; font-size: 1rem; }
  .side-foot { display: flex; flex-direction: column; gap: 10px; margin-top: auto; border-top: 1px solid var(--bar-line); padding-top: 12px; }
  .side-foot form { margin: 0; }
  .side-foot .bar-btn { width: 100%; justify-content: center; }
  .phone-only { display: none; }
  .tabs { position: static; flex-direction: column; gap: 2px; padding: 0; border-radius: 0; background: none; box-shadow: none; max-width: none; margin: 0; }
  .tabs a { flex: none; flex-direction: row; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); font-size: .95rem; font-weight: 600; }
  .tabs a.on { color: var(--bar-ink); background: var(--bar-active); box-shadow: inset 3px 0 0 var(--brand-orange); }
  .tabs .icon { width: 19px; height: 19px; }
  body.has-tabs main { padding: 24px 28px 48px; }
  main { max-width: 1040px; margin: 0; }
}

/* ---------- Feedback ---------- */
textarea { resize: vertical; min-height: 7rem; font-weight: 400; }
select { font-weight: 400; }
input[type="file"] { font-weight: 400; padding: .5rem; }
.feedback-form fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.feedback-form fieldset:disabled { opacity: .6; }
.feedback-form label .small { display: block; font-weight: 400; margin-top: .25rem; }
.field-error { display: block; color: var(--poor); font-weight: 600; font-size: .85rem; margin-top: .25rem; }
.feedback-list { list-style: none; margin: 0; padding: 0; }
.feedback-list li { padding: .8rem 0; border-top: 1px solid var(--line); }
.feedback-list li:first-child { border-top: 0; padding-top: 0; }
.feedback-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.feedback-text { margin: .4rem 0; overflow-wrap: anywhere; }
.feedback-reply { margin-top: .5rem; padding: .6rem .8rem; border-left: 3px solid var(--good); background: color-mix(in srgb, var(--good) 6%, var(--surface)); border-radius: var(--radius-sm); }
.feedback-reply p { margin: .3rem 0 0; overflow-wrap: anywhere; }

/* Recordings (round 6m): subject → chapter → lecture, and the player */
.page-title { margin-bottom: .8rem; }
.rec-list { list-style: none; margin: 0; padding: 0; }
.rec-item a { display: flex; align-items: center; gap: 10px; padding: .55rem .25rem; color: var(--ink); text-decoration: none; border-top: 1px solid var(--line); }
.rec-list .rec-item:first-child a { border-top: 0; }
.rec-item a:hover { background: var(--surface-2); }
.rec-item strong { display: block; }
.rec-play { width: 34px; height: 34px; border-radius: 999px; display: grid; place-items: center; flex: none; background: var(--chip-bg); color: var(--link); }
.rec-play .icon { width: 15px; height: 15px; fill: currentColor; stroke-width: 0; margin-left: 2px; }
.subject-shelf h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.subject-shelf h2 .chip { font-size: .95rem; }
details.chapter { border-top: 1px solid var(--line); }
.subject-shelf h3.strand { margin: .9rem 0 .2rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
details.chapter > summary { display: flex; align-items: center; gap: 8px; padding: .7rem 0; color: var(--ink); font-weight: 700; list-style: none; }
details.chapter > summary::-webkit-details-marker { display: none; }
details.chapter > summary::after { content: "+"; color: var(--muted); font-weight: 600; width: 1rem; text-align: center; }
details.chapter[open] > summary::after { content: "−"; }
details.chapter .rec-list { padding-left: .25rem; margin-bottom: .5rem; }
.rec-play.note .icon { fill: none; stroke: currentColor; stroke-width: 1.85; width: 17px; height: 17px; margin: 0; }
.player { position: relative; aspect-ratio: 16 / 9; width: 100%; background: #000; border-radius: var(--radius-sm); overflow: hidden; margin: .6rem 0; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.notes-head { display: flex; align-items: flex-start; gap: .8rem; flex-wrap: wrap; }
.notes-head .btn-link { margin-top: .3rem; }

/* ---------- Print: just the content, black on white ---------- */
@media print {
  .topbar .bar-tools, .tabs, .sidebar, .preview-bar, .install-card, .btn, .btn-link, .btn-small, form { display: none !important; }
  body, .card { background: #fff !important; color: #000 !important; box-shadow: none !important; }
  .topbar { background: #fff !important; color: #000 !important; border-bottom: 1px solid #000; }
  .brand { color: #000 !important; }
}

/* ---------- Overview: per-subject attendance and results, then the calendar beside the next tests ---------- */
ul.subj-list { list-style: none; padding: 0; margin: 0; }
ul.subj-list > li { padding: .6rem 0; border-bottom: 1px solid var(--line); }
ul.subj-list > li:first-child { padding-top: .1rem; }
ul.subj-list > li:last-child { border-bottom: 0; }
.subj-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.subj-list .trend { margin: .4rem 0 0; max-width: none; }
.subj-list p { margin: .2rem 0 0; }
.sbar { height: 8px; border-radius: 999px; background: var(--seg-track); overflow: hidden; margin-top: .45rem; }
.sbar span { display: block; height: 100%; border-radius: 999px; background: var(--muted); }
.sbar .good { background: var(--good); } .sbar .close { background: var(--close); } .sbar .poor { background: var(--poor); }
.overall { border-top: 1px solid var(--line); padding-top: .5rem; margin-top: .3rem; }
.plan-row { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); margin-top: 14px; align-items: start; }
.plan-row > .card, .plan-side > .card { margin-bottom: 0; }
.plan-side { display: grid; gap: 14px; }
.plan-row + .card { margin-top: 14px; }
@media (min-width: 820px) {
  .plan-row { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
  .plan-row table.month { max-width: none; }
}

/* The app's version on every page (config/version.py), and the About page. */
.app-foot { margin: 28px 0 8px; text-align: center; font-size: .78rem; color: var(--muted); }
.app-foot a { color: inherit; }
.about .version-line { font-size: 1.1rem; }
.about ol { padding-left: 1.2em; }

/* Revision classes inside a chapter (recordings, owner 22 Oct 2026). */
.chapter .rev-head { margin: 12px 0 4px; font-size: .9rem; display: flex; align-items: center; gap: 6px; color: var(--muted); }
