/* Stemina Classes. Tokens and components come from design/classes/boards/Classes.redesign.html.
   Light is the default; dark follows the device. Spacing is on a 4px scale. */
:root {
  --canvas: #f7f8fa; --surface: #ffffff; --sunk: #f1f2f6;
  --line: #e2e5eb; --line-strong: #c6cbd6;
  --ink: #131722; --ink-2: #3a4150; --muted: #5e6677;
  --accent: #3346c8; --accent-hover: #2737a6; --on-accent: #ffffff; --accent-soft: #eceefb; --accent-ink: #2a3aae;
  --ok: #136b40; --ok-soft: #e4f2ea; --warn: #7f5200; --warn-soft: #faf0d8; --bad: #ae231c; --bad-soft: #fbe8e6;
  --lift: 0 1px 2px rgba(19, 23, 34, 0.12);
  --ink-paper: #ffffff; /* handwriting canvas stays white in both themes so drawings upload as they look */
  --font: Geist, system-ui, sans-serif; --font-icon: "Material Symbols Rounded";
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-role="student"]):not([data-role="teacher"]) {
    --canvas: #12151b; --surface: #191d25; --sunk: #141820;
    --line: #272c37; --line-strong: #3a4150;
    --ink: #eef0f5; --ink-2: #c6cad4; --muted: #939aaa;
    --accent: #8f9cff; --accent-hover: #a9b3ff; --on-accent: #0b0d11; --accent-soft: #20264a; --accent-ink: #aeb8ff;
    --ok: #62d39b; --ok-soft: #132c1f; --warn: #f0bb52; --warn-soft: #30260f; --bad: #ff8d84; --bad-soft: #381917;
    --lift: 0 1px 2px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { font: 16px/1.5 var(--font); color: var(--ink); background: var(--canvas); -webkit-font-smoothing: antialiased; overflow-x: clip; }
body { margin: 0; overflow-x: clip; }
::selection { background: var(--accent); color: var(--on-accent); }
a { color: var(--accent-ink); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, h4, p { margin: 0; }
[hidden] { display: none !important; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ms { font-family: var(--font-icon); font-size: 20px; line-height: 1; display: inline-block; vertical-align: middle; flex: none; font-weight: normal; font-style: normal; letter-spacing: normal; text-transform: none; white-space: nowrap; direction: ltr; font-feature-settings: "liga"; -webkit-font-smoothing: antialiased; font-variation-settings: "FILL" 0, "wght" 500, "opsz" 24; overflow: hidden; }
.ms.fill { font-variation-settings: "FILL" 1, "wght" 500, "opsz" 24; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Shell ---------- */
.app { min-height: 100vh; }
.signed-in .app { display: grid; grid-template-columns: 72px minmax(0, 1fr); }
.side { display: none; }
.signed-in .side { background: var(--surface); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; align-items: center; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: block; padding-bottom: 16px; line-height: 0; }
.brand img { display: block; width: 32px; height: 32px; }
.rail-nav { display: flex; flex-direction: column; gap: 4px; }
.nav { width: 48px; height: 48px; border-radius: 8px; display: grid; place-items: center; color: var(--ink-2); text-decoration: none; position: relative; }
.nav .tab-label { font-size: 11px; line-height: 1; }
.nav:has(.tab-label) { align-content: center; gap: 2px; }
.nav .ms { font-size: 24px; }
.nav:hover { background: var(--sunk); }
.nav.on { background: var(--accent-soft); color: var(--accent-ink); }
.count { position: absolute; top: 4px; right: 0; padding: 0 4px; min-width: 16px; text-align: center; font-size: 11px; font-weight: 600; line-height: 16px; border-radius: 99px; background: var(--accent); color: var(--on-accent); }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.who { text-decoration: none; width: 44px; height: 44px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font-size: 13px; font-weight: 600; flex: none; }
.content { min-width: 0; }
.p-top { display: none; }
.tabbar { display: none; }
.main { padding: 36px 44px 48px; min-width: 0; max-width: 1240px; margin-inline: auto; }
.main h1 { font-size: 26px; letter-spacing: -0.02em; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.sub { color: var(--muted); font-size: 14px; margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; row-gap: 4px; }
.sec { margin-top: 36px; }
.sec.first { margin-top: 0; }
.sec > h2, .sec-h h2 { font-size: 16px; font-weight: 600; }
.sec-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.title-row { align-items: flex-start; flex-wrap: wrap; }
/* One reading column (student page, lesson editor), centred in the content area. */
.narrow { max-width: 760px; margin-inline: auto; }
.empty { color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.hint-text { color: var(--muted); font-size: 14px; margin-top: 4px; }
.chips { display: inline-flex; gap: 8px; align-items: center; }
.row-actions { display: flex; gap: 12px; margin-top: 16px; align-items: center; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 8px; padding: 12px 16px; font-size: 14px; font-weight: 600; background: var(--accent); color: var(--on-accent); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background 0.15s; min-height: 44px; }
.btn:active { transform: translateY(1px); }
.btn:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { border-color: var(--ink-2); background: var(--surface); }
.btn.sm { padding: 8px 12px; font-size: 13px; min-height: 36px; }
.btn[disabled] { background: var(--sunk); color: var(--muted); cursor: not-allowed; }
.btn.ib { width: 44px; height: 44px; padding: 0; }
.btn.ib.sm { width: 36px; height: 36px; }
.btn.ib .ms { font-size: 22px; }
.btn.ib.sm .ms { font-size: 20px; }
.btn.go { font-size: 16px; padding: 12px 20px; font-variant-numeric: tabular-nums; }
.btn.go .ms { font-size: 24px; }
label.btn { position: relative; }

/* ---------- Meta and status ---------- */
.m { display: inline-flex; align-items: center; gap: 4px; margin-right: 12px; white-space: nowrap; max-width: 100%; }
.m > span:last-child { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.m .ms { font-size: 16px; }
.st { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; border-radius: 6px; padding: 4px 8px; line-height: 1.25; white-space: nowrap; background: var(--sunk); color: var(--ink-2); width: max-content; }
.st .ms { font-size: 16px; }
.st.in { background: var(--accent-soft); color: var(--accent-ink); }
.st.ok { background: var(--ok-soft); color: var(--ok); }
.st.due { background: var(--warn-soft); color: var(--warn); }
.st.over { background: var(--bad-soft); color: var(--bad); }
.st.draft { background: transparent; border: 1px dashed var(--line-strong); color: var(--muted); }
.sub .st { margin-right: 12px; }

/* ---------- Family dashboards ---------- */
.main:has(> .family-overview) { max-width: 51rem; }
.family-overview .sec { margin-top: 24px; }
.family-overview .sec-h > a { font-size: 14px; }
.agenda-list { padding: 0; list-style: none; margin-block: 16px 0; }
.agenda-list .agenda-row { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; padding-block: 12px; }
.agenda-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-ink); }
.agenda-time { display: grid; justify-items: end; text-align: end; gap: 4px; color: var(--muted); font-size: 13px; }
.agenda-time time { font-weight: 600; color: var(--ink); }

/* ---------- Rows ---------- */
.rows { margin-top: 12px; border-bottom: 1px solid var(--line); }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 16px; align-items: center; padding: 16px 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
a.row:hover b { color: var(--accent-ink); }
.row b { font-weight: 600; font-size: 15px; display: block; overflow-wrap: anywhere; }
.row b .ms { font-size: 18px; color: var(--muted); margin-top: -2px; }
.row small { color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; align-items: center; row-gap: 4px; margin-top: 2px; }
.row .ms.go { color: var(--muted); }
.mark { font-weight: 600; font-size: 15px; white-space: nowrap; }
.mark small { display: inline; font-weight: 500; color: var(--muted); }

/* ---------- Boxes ---------- */
.box { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px 24px; }
.box h2 { font-size: 16px; font-weight: 600; }
.box > .btn.ib { margin-top: 12px; }
/* Student page Parents dialog: one row per parent profile, an inline email invite, then the add form. */
.parents .parent, .parents #add-parent { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.parents h3 { font-size: 14px; font-weight: 600; }
.invite-parent { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.form.invite-parent label { flex: 1; min-width: 0; margin-top: 0; }
.form.invite-parent label input[type="email"][name="email"] { margin-top: 0; }
.form.invite-parent > label + .btn { margin-top: 0; }
.invite-parent [role="status"]:empty { display: none; }
.invite-parent [role="status"] { flex-basis: 100%; }
.hint { display: grid; grid-template-columns: 20px 1fr; gap: 12px; font-size: 13px; color: var(--muted); margin-top: 16px; }
.hint .ms { font-size: 18px; }

/* ---------- Lesson report ---------- */
.crumb { font-size: 14px; color: var(--muted); display: flex; gap: 8px; align-items: center; min-width: 0; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--ink); }
.crumb span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb .ms { font-size: 16px; }
.crumb + h1, .crumb + .report, .crumb + .title-row { margin-top: 12px; }
.report { max-width: 68ch; min-width: 0; }
.report h2 { font-size: 16px; font-weight: 600; margin: 28px 0 8px; }
.report .markdown-body, .report .rich-text { font-size: 16px; line-height: 1.6; color: var(--ink-2); }
/* Student and parent lesson page: the homework card sits under the title, before the notes. */
.lesson-report > .box { margin-top: 24px; }
.lesson-report > .box h2 { margin: 0; }
.lesson-report + .sec { max-width: 68ch; }

/* ---------- Files ---------- */
.files { margin-top: 12px; border-bottom: 1px solid var(--line); }
.file-item { border-top: 1px solid var(--line); }
.file { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; font-size: 14px; width: 100%; background: none; border: 0; text-align: left; color: inherit; text-decoration: none; cursor: pointer; }
.file:has(.thumb) { grid-template-columns: 56px minmax(0, 1fr) auto; }
.file > i { width: 36px; height: 36px; border-radius: 8px; background: var(--sunk); display: grid; place-items: center; color: var(--ink-2); font-style: normal; }
.file > i.thumb { width: 56px; height: 40px; overflow: hidden; position: relative; border: 1px solid var(--line); }
.thumb img, .thumb video { background: var(--ink-paper); width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .play { position: absolute; inset: 0; margin: auto; width: 24px; height: 24px; font-size: 24px; color: var(--on-accent); text-shadow: 0 0 4px rgba(0, 0, 0, 0.6); }
.file b { font-weight: 600; display: block; overflow-wrap: anywhere; }
.file small { color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; align-items: center; row-gap: 4px; }
.file > .ms { color: var(--muted); }
.file[aria-expanded="true"] > .ms { transform: rotate(180deg); }
.file-extra { display: flex; gap: 8px; padding: 0 0 12px 48px; }
.viewer { padding: 0 0 16px; }
.viewer img, .viewer video { display: block; max-width: 100%; border-radius: 8px; }

/* ---------- Doing homework ---------- */
.hw { max-width: 820px; background: var(--canvas); }
.hw-top { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.hw-title { min-width: 0; flex: 1; }
.hw-title b { font-weight: 600; overflow-wrap: anywhere; }
.hw-title .sub { margin-top: 0; }
.saved { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.saved .ms { font-size: 16px; }
.steps { display: flex; gap: 8px; padding: 16px 0 0; flex-wrap: wrap; }
.step { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); display: grid; place-items: center; font-size: 14px; font-weight: 600; color: var(--ink-2); position: relative; cursor: pointer; padding: 0; }
.step.done { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.step.done::after { content: "check"; font-family: var(--font-icon); font-size: 12px; line-height: 1; position: absolute; right: -5px; top: -5px; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-variation-settings: "wght" 700; }
.step.cur { border: 2px solid var(--accent); color: var(--ink); }
.steps-key { font-size: 13px; color: var(--muted); padding-top: 8px; }
.q { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; margin: 20px 0; padding: 28px 32px; }
.q-meta { font-size: 14px; color: var(--muted); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.q-meta b { color: var(--ink); }
.q-meta .m { margin-right: 0; }
.q-body { font-size: 17px; line-height: 1.6; margin-top: 12px; max-width: 64ch; }
.field { display: block; margin-top: 24px; font-size: 14px; font-weight: 600; }
.ta { display: block; width: 100%; margin-top: 8px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 12px 16px; min-height: 112px; font-size: 16px; font-weight: 400; line-height: 1.6; color: var(--ink); background: var(--surface); resize: vertical; }
.choices { border: 0; padding: 0; margin: 24px 0 0; min-width: 0; }
.choices legend { font-size: 14px; font-weight: 600; padding: 0; margin-bottom: 8px; }
.option { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border: 1px solid var(--line-strong); border-radius: 10px; margin-top: 8px; cursor: pointer; min-height: 48px; }
.option:has(:checked) { border-color: var(--accent); background: var(--accent-soft); }
.option input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; margin: 0; }
.attach { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 13px; font-weight: 500; background: var(--sunk); color: var(--ink-2); text-decoration: none; }
.chip.pic { padding: 4px; }
.chip.pic img { width: 60px; height: 40px; object-fit: cover; border-radius: 4px; display: block; background: var(--ink-paper); }
.chip.pic .ms { width: 60px; height: 40px; display: grid; place-items: center; font-size: 24px; }
.ink { margin-top: 16px; }
canvas { display: block; width: 100%; aspect-ratio: 2 / 1; background: var(--ink-paper); border: 1px solid var(--line-strong); border-radius: 10px; touch-action: none; }
.whole { margin-bottom: 20px; }
.hw-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 24px; }
.confirm { margin-bottom: 24px; }
.confirm p { font-weight: 600; }

/* ---------- Marked homework ---------- */
.result { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; margin-top: 24px; }
.score { font-size: 38px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.score small { font-size: 17px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.questions { border-bottom: 1px solid var(--line); margin-top: 16px; }
.qr { display: grid; grid-template-columns: 44px minmax(0, 1fr) 300px; gap: 20px; padding: 24px 0; border-top: 1px solid var(--line); }
.qr .n { font-weight: 600; color: var(--muted); }
.qr .prompt { font-size: 15px; margin-top: 8px; }
.your-answer { margin-top: 12px; font-size: 14px; color: var(--ink-2); }
.your-answer .label { color: var(--muted); font-size: 13px; display: block; }
.fb { background: var(--sunk); border-radius: 10px; padding: 16px; font-size: 14px; color: var(--ink-2); align-self: start; }
.fb b { display: flex; justify-content: space-between; color: var(--ink); font-weight: 600; margin-bottom: 4px; }
.read-choices { margin: 12px 0 0; padding-left: 24px; font-size: 14px; color: var(--ink-2); }
.read-choices li { margin: 8px 0; }
.read-choices li > * { display: inline-flex; vertical-align: middle; }
.read-choices li.chosen { color: var(--ink); font-weight: 600; }
.read-choices li:is([data-correct], [data-incorrect]) { padding: 8px 12px; border-radius: 8px; }
.read-choices li[data-correct] { background: var(--ok-soft); color: var(--ok); }
.read-choices li:is([data-incorrect], [data-missed]) { background: var(--bad-soft); color: var(--bad); }
.read-choices .st { margin-left: 8px; padding: 2px 4px; }
.homework-result .result { margin-top: 16px; }
.st.auto { background: var(--accent-soft); color: var(--accent-ink); padding: 2px 4px; margin-right: 8px; vertical-align: 1px; }
.your-answer.model .label, .your-answer.solution .label { color: var(--ok); font-weight: 600; }
.your-answer.solution { border-left: 2px solid var(--line-strong); padding-left: 12px; }
.qr.parted { grid-template-columns: 44px minmax(0, 1fr); }
.part { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--line); }
.part .q-meta b { color: var(--ink); }
.mark-side label { margin-top: 0; }
.mark-side label + label { margin-top: 16px; }
.mark-side .st.auto { margin: 0 0 0 8px; }

/* Doing homework: parts and multiple answer */
.part[data-part-label] { display: block; margin-top: 24px; padding-top: 20px; }
.part-prompt { margin-top: 8px; }
.choices legend small { font-weight: 400; color: var(--muted); margin-left: 8px; }

/* Mistakes */
.mistakes .mistakes-h { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; }
.mistakes .mistakes-h .ms { color: var(--muted); }
.mistakes .sub-h { margin-top: 16px; color: var(--ink-2); }
.mistake-list { margin-top: 12px; display: grid; gap: 12px; }
.mistake { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 20px; min-width: 0; }
.mistake-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.mistake-h a { color: var(--ink); text-decoration: none; min-width: 0; overflow-wrap: anywhere; }
.mistake-h a:hover { color: var(--accent-ink); text-decoration: underline; }
.mistake .prompt { font-size: 15px; margin-top: 8px; }
.mistake .q-meta { margin-top: 8px; }
[data-mistakes] .mistakes { margin-top: 20px; }

/* ---------- Parent ---------- */
.seg { display: inline-flex; background: var(--sunk); border-radius: 9px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; }
.seg button { border: 0; background: transparent; border-radius: 7px; padding: 8px 16px; font-size: 14px; font-weight: 500; color: var(--ink-2); cursor: pointer; min-height: 36px; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--lift); }
.seg .num { color: var(--muted); margin-left: 4px; }
.child-picker { position: relative; min-width: 0; margin-bottom: 20px; }
.family-actions .child-picker { flex: 1; margin: 0; }
.child-picker .child-switch { vertical-align: top; overflow: hidden; }
.child-picker:not([data-compact]) .child-menu { display: none; }
/* Keep the tab widths measurable while the compact control is visible. */
.child-picker[data-compact] .child-switch { position: absolute; inset: 0 0 auto; visibility: hidden; width: 100%; height: 0; padding-block: 0; }
.child-menu summary { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); font-weight: 600; overflow-wrap: anywhere; cursor: pointer; }
.child-menu summary::-webkit-details-marker { display: none; }
.child-menu[open] summary .ms { transform: rotate(180deg); }
.child-panel { position: absolute; z-index: 4; top: calc(100% + 4px); left: 0; width: min(100%, 320px); padding: 8px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); box-shadow: var(--lift); }
.child-panel input { width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; color: inherit; background: var(--canvas); }
.child-options { margin-top: 4px; max-height: min(35vh, 260px); overflow-y: auto; }
.child-options button { display: block; width: 100%; min-height: 44px; padding: 8px 12px; text-align: left; overflow-wrap: anywhere; border: 0; border-radius: 6px; background: transparent; cursor: pointer; }
.child-options button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.child-panel p { padding: 8px 12px; color: var(--muted); }
.ans { margin: 20px 0 0; border-bottom: 1px solid var(--line); }
.ans > div { position: relative; display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.ans > div > .ms { margin-top: 2px; color: var(--accent-ink); }
.ans dt { font-size: 13px; color: var(--muted); }
.ans dd { margin: 0; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.ans dd a::after { content: ""; position: absolute; inset: 0; }
.ans dd small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; margin-top: 2px; }

.parent-work { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); column-gap: 32px; }
.parent-work ol { list-style: none; padding: 0; margin-bottom: 0; }
.parent-work .row { grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; padding-block: 12px; }
.parent-marks .row small { display: block; }
.parent-marks .row > .ms { color: var(--muted); }
.parent-marks summary { width: fit-content; padding-block: 10px; color: var(--accent-ink); font-size: 14px; cursor: pointer; }
.parent-marks details .rows { margin-top: 0; }
.parent-homework .row > .ms.go { grid-column: auto; grid-row: auto; }
.parent-due { display: grid; justify-items: end; gap: 4px; text-align: end; font-size: 13px; color: var(--muted); }
.parent-due time { font-weight: 600; color: var(--ink); }

[data-role="parent"] .main:has(> .family-overview) { max-width: 66rem; }
.parent-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 156px), 1fr)); gap: 10px; border: 0; }
.parent-facts > div { display: block; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.parent-facts > div > .ms { position: absolute; top: 17px; font-size: 16px; }
.parent-facts dt { padding-left: 23px; }
.parent-facts dd { margin-top: 8px; font-size: 18px; line-height: 1.3; }
.parent-facts dd a { color: var(--ink); text-decoration: none; }
.parent-facts > div:hover dd a, .parent-facts dd a:focus-visible { text-decoration: underline; }
.parent-facts dd small { margin-top: 6px; line-height: 1.45; }
.parent-time { white-space: nowrap; }
.parent-report { margin-top: 20px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow-wrap: anywhere; }
.parent-report .sec-h a { font-size: 13px; }
.parent-report .sec-h .ms { font-size: 16px; }
.parent-report .sub { font-size: 13px; margin-top: 0; }
.parent-report h3 { margin-top: 16px; font-size: 14px; font-weight: 600; }
.parent-report .parent-excerpt { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; margin-top: 6px; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.parent-report .parent-excerpt > :first-child { margin-top: 0; }
.parent-report .parent-excerpt > :last-child { margin-bottom: 0; }

.tuition-summary { margin-top: 16px; padding: 16px 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.tuition-summary h2 { margin: 0; font-size: 16px; font-weight: 600; }
.tuition-summary dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr)); gap: 12px; margin: 10px 0 0; }
.tuition-summary dt { font-size: 13px; color: var(--muted); }
.tuition-summary dd { margin: 0; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tuition-summary dl > :first-child dd { color: var(--accent-ink); }

/* ---------- Teacher ---------- */
.toolbar { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.toolbar label { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 12px; background: var(--surface); color: var(--muted); min-height: 44px; }
.toolbar input, .toolbar select { border: 0; background: transparent; color: var(--ink); min-height: 40px; outline: none; font-size: 14px; }
.toolbar .search-field { flex: 1; min-width: 220px; }
.toolbar .search-field input { width: 100%; }
.toolbar label:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.form label { display: block; font-size: 14px; font-weight: 600; margin-top: 20px; }
.form label small { font-weight: 400; color: var(--muted); margin-left: 8px; }
.form input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .form select, .form textarea { display: block; width: 100%; margin-top: 8px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 12px; font-weight: 400; font-size: 14px; line-height: 1.55; background: var(--surface); color: var(--ink); min-height: 40px; }
/* Date fields show dd/mm/yyyy in a text box. The native date input is only the calendar button, so a US-locale
   browser cannot paint 11/28/2026 over the value. */
.form .date-field { display: grid; grid-template-columns: 1fr 2.75rem; align-items: stretch; margin-top: 8px; width: 100%; position: relative; }
.form .date-field .date-display, .form .date-field .date-value { margin-top: 0; min-height: 40px; }
.form .date-field .date-display { grid-column: 1 / -1; grid-row: 1; padding-right: 2.75rem; }
.form .date-field .date-value { grid-column: 2; grid-row: 1; width: 100%; min-width: 0; padding: 0; border: 0; background: transparent; color: transparent; caret-color: transparent; }
.form .date-field .date-value::-webkit-datetime-edit,
.form .date-field .date-value::-webkit-datetime-edit-fields-wrapper,
.form .date-field .date-value::-webkit-datetime-edit-text,
.form .date-field .date-value::-webkit-datetime-edit-month-field,
.form .date-field .date-value::-webkit-datetime-edit-day-field,
.form .date-field .date-value::-webkit-datetime-edit-year-field { color: transparent; display: none; }
.form .date-field .date-value::-webkit-calendar-picker-indicator { cursor: pointer; width: 100%; height: 100%; margin: 0; opacity: 1; }
.form .date-field .date-value:disabled::-webkit-calendar-picker-indicator,
.form .date-field .date-value[readonly]::-webkit-calendar-picker-indicator { opacity: 0.4; cursor: default; }

.form textarea { min-height: 96px; resize: vertical; }
.file-upload { margin-block-start: 12px; }
.file-upload > .file-upload-zone {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; gap: 4px 12px; min-height: 68px; margin: 0; padding: 12px;
  border: 1px dashed var(--line-strong); border-radius: 12px; background: var(--canvas); cursor: pointer;
}
.file-upload-zone:hover, .file-upload-zone.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.file-upload-zone:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.file-upload-icon {
  display: grid; place-items: center; inline-size: 40px; block-size: 40px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent-ink);
}
.file-upload-copy { display: grid; gap: 2px; overflow-wrap: anywhere; }
.file-upload-copy strong { font-size: 14px; color: var(--ink); }
.file-upload-copy > span, .file-upload-drop-hint { font-size: 12px; font-weight: 400; color: var(--muted); }
.file-upload-browse {
  justify-self: end; white-space: nowrap; padding: 6px 10px; border: 1px solid var(--line-strong);
  border-radius: 8px; background: var(--surface); color: var(--accent-ink); font-size: 13px; font-weight: 600;
}
.file-upload-drop-hint { display: none; grid-column: 2 / -1; }
@media (hover: hover) and (pointer: fine) {
  .file-upload-drop-hint { display: block; }
}
@media (max-width: 420px) {
  .file-upload > .file-upload-zone { grid-template-columns: auto minmax(0, 1fr); }
  .file-upload-browse { grid-column: 2; justify-self: start; margin-block-start: 4px; }
}
.file-upload-list { display: grid; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.file-upload-list li {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 6px 8px 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
}
.file-upload-list li > .ms, .file-upload-list small { color: var(--muted); }
.file-upload-list strong, .file-upload-list small { display: block; overflow-wrap: anywhere; }
.file-upload-list strong { font-size: 13px; font-weight: 600; }
.file-upload-list small { font-size: 12px; }
.editor-form { max-width: 760px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.file-search { display: grid; gap: 4px; margin-block: 16px; max-width: 32rem; font-size: 14px; font-weight: 600; }
.file-search input { width: 100%; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ink); background: var(--surface); }
.family-notes { margin: 24px 0 0; padding: 0; border: 0; min-width: 0; }
.family-notes legend { padding: 0; font-weight: 600; }
.private { background: var(--warn-soft); border-radius: 10px; padding: 16px; margin-top: 24px; }
.private > label { margin-top: 0; }
.private > label, .private-h { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--warn); font-size: 14px; font-weight: 600; }
.private-h small, .private > label small { color: inherit; font-weight: 400; margin-left: 0; }
.private > label textarea { flex-basis: 100%; }
.private .markdown-body { margin-top: 8px; font-size: 14px; color: var(--ink-2); }
.library-list, .visibility-list { margin-top: 12px; border-bottom: 1px solid var(--line); max-height: 360px; overflow: auto; }
.library-file { display: grid !important; grid-template-columns: 20px minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line); margin: 0 !important; font-weight: 400 !important; cursor: pointer; }
.library-file input { width: 18px; height: 18px; accent-color: var(--accent); margin: 2px 0 0; }
.library-file strong { font-weight: 600; display: block; overflow-wrap: anywhere; }
.library-file small { color: var(--muted); font-size: 12px; margin: 0 !important; overflow-wrap: anywhere; display: block; }
.review-reason { display: flex !important; align-items: center; gap: 4px; color: var(--warn) !important; font-size: 12px; font-weight: 600; }
.review-reason .ms { font-size: 14px; }
.panel-d { border-top: 1px solid var(--line); padding-top: 12px; }
.panel-d summary { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; cursor: pointer; min-height: 44px; list-style: none; }
.panel-d summary::-webkit-details-marker { display: none; }
.panel-d summary::after { content: "expand_more"; font-family: var(--font-icon); font-size: 20px; margin-left: auto; color: var(--muted); }
.panel-d[open] summary::after { content: "expand_less"; }
.q-edit { border: 1px solid var(--line); border-radius: 14px; padding: 4px 20px 20px; margin: 16px 0 0; background: var(--surface); min-width: 0; }
/* Homework draft: hand-written questions fold to one summary row; bank questions share the row's number and height */
#editors { counter-reset: hw-q; }
#editors > .q-edit { counter-increment: hw-q; margin-top: 8px; }
#editors > .q-edit:has(> .q-fold) { padding: 0; }
.q-fold > summary { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 16px 8px 20px; cursor: pointer; list-style: none; border-radius: 13px; }
.q-fold > summary::-webkit-details-marker { display: none; }
.q-fold > summary:focus-visible { outline-offset: -2px; }
.q-fold[open] > summary { border-bottom: 1px solid var(--line); border-radius: 13px 13px 0 0; }
.q-fold > summary::before, #editors .q-bank-h::before { content: counter(hw-q) "."; flex: none; min-width: 24px; font-weight: 600; font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }
/* KaTeX superscripts are positioned and paint past a text-overflow ellipsis, so a long prompt fades out instead */
.q-sum-prompt { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; font-size: 14px; color: var(--ink-2); mask-image: linear-gradient(to left, transparent, var(--ink) 32px); }
.q-sum-prompt > .markdown-body, .q-sum-prompt > .markdown-body > *, .q-sum-prompt .katex-display, .q-sum-prompt .katex-display > .katex, .q-sum-prompt .katex-display > .katex > .katex-html { display: inline; margin: 0; padding: 0; border: 0; }
.q-sum-prompt > .markdown-body > * + *::before { content: " "; }
.q-sum-prompt img { max-height: 24px; vertical-align: middle; }
.q-untitled { color: var(--muted); }
.q-sum-facts { flex: none; display: flex; align-items: center; color: var(--muted); font-size: 13px; }
.q-sum-facts .m:last-child { margin-right: 0; }
.q-fold > summary > .ms { color: var(--muted); }
.q-fold[open] > summary > .ms { transform: rotate(180deg); }
.q-fold-body { padding: 4px 20px 20px; }
#editors .q-bank { padding-top: 0; }
#editors .q-bank-h { min-height: 56px; padding-top: 8px; padding-bottom: 8px; }
/* Question bank: the picker panel and read-only bank questions in the homework draft */
.bank { margin-top: 16px; border: 1px solid var(--line); border-radius: 14px; padding: 4px 20px 16px; background: var(--surface); min-width: 0; }
.bank-h { display: flex; flex-wrap: wrap; align-items: center; column-gap: 16px; row-gap: 4px; }
.bank-h .sub-h { flex-basis: 100%; }
.bank-h .sub { margin-top: 0; }
.form .bank-h label.check { margin-top: 0; }
.bank-topic h4 { font-size: 14px; font-weight: 600; margin-top: 20px; color: var(--ink-2); }
.bank-file-h { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; margin-top: 8px; }
.bank-file-h b { font-weight: 600; overflow-wrap: anywhere; }
.bank-file-h small { color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; align-items: center; row-gap: 4px; }
.bank-file .rows { margin-top: 8px; }
.bank-file .row { padding: 12px 0; }
.bank-file .row > .btn.ib { pointer-events: auto; } /* real buttons, unlike the decorative ones in link rows */
.q-bank-h { padding-top: 16px; }
.q-bank .prompt-copy { margin-top: 8px; font-size: 14px; color: var(--ink); }
.bank-parts { margin-top: 8px; }
.bank-part { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.bank-part .part-prompt { font-size: 14px; color: var(--ink-2); }
.question-preview { margin-top: 16px; padding: 12px 16px; border-radius: 10px; background: var(--sunk); }
.preview-label { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
.preview-label .ms { font-size: 16px; }
.prompt-preview:empty::before { content: "Prompt preview appears here."; color: var(--muted); font-size: 13px; }
.preview-options ol { margin: 8px 0 0 20px; padding: 0; }
.sub-h { font-size: 14px; font-weight: 600; margin-top: 16px; }
#mark { margin-top: 12px; }
#mark .qr .form label:first-child { margin-top: 0; }

/* Today, Students */
.hcount { display: inline-block; min-width: 20px; text-align: center; font-size: 12px; line-height: 20px; border-radius: 99px; background: var(--sunk); color: var(--ink-2); margin-left: 4px; padding: 0 4px; vertical-align: 1px; }
.row > .btn.ib { pointer-events: none; }
.tt { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 12px; }
.tt th { text-align: left; color: var(--muted); font-weight: 600; font-size: 13px; padding: 8px 12px 8px 0; }
.tt td { padding: 12px 12px 12px 0; border-top: 1px solid var(--line); vertical-align: middle; }
.tt td a { color: var(--ink); text-decoration: none; }
.tt td a:hover { color: var(--accent-ink); text-decoration: underline; }
.tt td b { font-weight: 600; }
.tt .chips { flex-wrap: wrap; }
.muted { color: var(--muted); }
.tt .enrol { display: flex; flex-wrap: wrap; align-items: center; row-gap: 4px; color: var(--muted); font-size: 13px; margin-top: 4px; }
.tt .enrol a { color: var(--accent-ink); display: inline-flex; align-items: center; gap: 4px; }
.tt .enrol a .ms { font-size: 16px; }
.enrol-form .hint { margin-top: 12px; }
.subject-picks { border: 0; padding: 0; margin: 20px 0 0; min-width: 0; }
.subject-picks legend { font-size: 14px; font-weight: 600; padding: 0; }
.subject-picks label.check { margin-top: 12px; }
.subject-picks label.check .ms { color: var(--muted); }
.correct-picks { margin-top: 20px; }
.pick-h { font-size: 14px; font-weight: 600; }
.correct-picks label.check { margin-top: 8px; font-weight: 400; overflow-wrap: anywhere; }
.child-switch .num { margin-left: 4px; }
.lib-group .sec-h { align-items: baseline; flex-wrap: wrap; }
.lib-group .sub { margin-top: 0; }
.lib-group .file { cursor: default; grid-template-columns: 36px minmax(0, 1fr); }

/* Write up a lesson: the report form, then what the family will see, collapsed until asked for */
.write { margin-top: 4px; }
.write > .form > label:first-child { margin-top: 12px; }
.preview { background: var(--sunk); border-radius: 14px; padding: 0 20px; margin-top: 24px; }
.preview[open] { padding-bottom: 20px; }
.preview > summary { display: flex; align-items: center; gap: 8px; min-height: 52px; font-size: 15px; font-weight: 600; cursor: pointer; list-style: none; }
.preview > summary::-webkit-details-marker { display: none; }
.preview > summary::after { content: "expand_more"; font-family: var(--font-icon); font-size: 20px; margin-left: auto; color: var(--muted); }
.preview[open] > summary::after { content: "expand_less"; }
.preview-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; font-size: 13px; color: var(--muted); font-weight: 600; }
.preview-h h2 { color: var(--ink); font-size: 16px; }
.preview-switch { display: flex; gap: 4px; }
.preview-switch .btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.preview-switch .btn { position: relative; }
.preview-switch .btn:focus-visible::after, .share-toggle:focus-within .share-tooltip::after {
  position: absolute; inset-block-start: 100%; inset-inline-end: 0; z-index: 2;
  border-radius: 6px; padding: 4px 8px; background: var(--ink); color: var(--surface);
  font-size: 12px; white-space: nowrap;
}
.preview-switch .btn:focus-visible::after { content: attr(aria-label); }
.preview .box { padding: 20px; }
.preview .preview-title { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; margin: 0; overflow-wrap: anywhere; }
.preview .report h2:not(.preview-title) { font-size: 14px; margin: 20px 0 4px; }
.preview .markdown-body { font-size: 14px; line-height: 1.6; }
.preview-hw { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.preview-hw h2 { margin-top: 0 !important; }
.preview .report > .sub:last-child { margin-top: 16px; }
.share-row { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; align-items: start; border-top: 1px solid var(--line); }
.share-row > .share-toggle { display: grid; place-items: center; position: relative; margin: 8px 0 0; width: 44px; height: 44px; border-radius: 8px; background: var(--sunk); color: var(--muted); }
.share-toggle:has(input:checked) { background: var(--accent-soft); color: var(--accent-ink); }
.share-toggle input { cursor: pointer; position: absolute; inset: 0; margin: 0; width: 100%; height: 100%; opacity: 0; }
.share-toggle:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.share-toggle .share-on, .share-toggle:has(input:checked) .share-off { display: none; }
.share-toggle:has(input:checked) .share-on { display: inline; }
.share-toggle:focus-within .share-tooltip::after { content: "Private"; inset-inline: 0 auto; }
.share-toggle:has(input:checked):focus-within .share-tooltip::after { content: "Shared on publish"; }
.share-legend { font-size: 13px; }
#files-section .sec-h .row-actions { margin-top: 0; }
.share-row > .file-item { border-top: 0; min-width: 0; }
.share-row .file-extra { padding-left: 48px; flex-wrap: wrap; align-items: center; }
.share-list { margin-top: 12px; }
.q-line { display: flex !important; gap: 8px; align-items: baseline; }
.q-line > .num { flex: none; }
.q-line .prompt { margin: 0; font-weight: 400; font-size: 14px; color: var(--ink-2); min-width: 0; }
#homework-section .rows .mark { font-size: 14px; }
.action-bar { display: flex; justify-content: flex-end; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--line); }
.mark-bar .tally { margin-right: auto; font-size: 14px; color: var(--ink-2); }
.mark-bar .tally b { color: var(--ink); font-weight: 600; }
.sub .btn.ib { margin-left: auto; }

/* ---------- Calendar ---------- */
[data-subject] { --lesson-ink: var(--accent-ink); --lesson-fill: var(--accent-soft); }
[data-subject="biology"] { --lesson-ink: var(--ok); --lesson-fill: var(--ok-soft); }
[data-subject="physics"] { --lesson-ink: light-dark(#713898, #dbadff); --lesson-fill: light-dark(#f0e5fa, #33213e); }
[data-subject="chemistry"] { --lesson-ink: light-dark(#964223, #ffb292); --lesson-fill: light-dark(#fbe7db, #40271f); }
.cal .ev:not(.off,.ghost,.sel), .cc .lesson:not(.off), .subject-symbol {
  color: var(--lesson-ink); background: var(--lesson-fill); box-shadow: inset 3px 0 var(--lesson-ink);
}
.lesson-sheet { margin: auto; width: min(380px, 100%); max-height: 85dvh; border: 1px solid var(--line); border-radius: 18px; padding: 22px; background: var(--surface); color: var(--ink); }
.lesson-sheet::backdrop { background: rgb(10 15 24 / 40%); }
.lesson-sheet header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.lesson-sheet h2 { font-size: 20px; }
.lesson-sheet header button { margin-left: auto; }
.lesson-sheet .subject-symbol { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; }
.lesson-sheet p { display: flex; gap: 9px; align-items: center; margin-top: 8px; font-size: 15px; }
.lesson-sheet p .ms { color: var(--muted); font-size: 18px; }
.lesson-sheet > button { margin-top: 16px; }

.cal-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; margin-top: 20px; }
.cal-scroll { overflow-x: auto; border-radius: 12px; }
.cal { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; min-width: 640px; }
.cal-h, .cal-b, .cal-due { display: grid; grid-template-columns: 52px repeat(7, minmax(0, 1fr)); }
.cal-due > * { min-width: 0; padding: 4px; border-right: 1px solid var(--line); }
.cal-due small { color: var(--muted); }
.cal-h { border-bottom: 1px solid var(--line); }
.cal-d { padding: 8px 8px 12px; border-left: 1px solid var(--line); display: flex; align-items: baseline; gap: 8px; }
.cal-d small { font-size: 13px; color: var(--muted); }
.cal-d b { font-size: 16px; font-weight: 600; }
.cal-d.today b { background: var(--accent); color: var(--on-accent); border-radius: 99px; padding: 0 8px; }
.cal-b { background-image: repeating-linear-gradient(var(--line) 0 1px, transparent 1px 44px); }
.cal-b > * { grid-row: 1; }
.cal-b .col { border-left: 1px solid var(--line); }
.cal-t { grid-column: 1; display: grid; grid-auto-rows: 44px; font-size: 12px; color: var(--muted); text-align: right; padding-right: 8px; }
.week-time { display: none; }
.cal-t > span { transform: translateY(4px); }
.ev { height: max(40px, calc(var(--lesson-height) - 4px)); align-self: start; margin: 0 4px; border-radius: 8px; border: 1px solid transparent; background: var(--accent-soft); color: var(--accent-ink); padding: 4px 8px; font: inherit; font-size: 13px; line-height: 1.25; text-align: left; overflow: hidden; position: relative; display: block; min-width: 0; cursor: pointer; }
.ev b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 20px; }
.ev .m { margin: 0; font-size: 12px; }
.ev .m .ms { font-size: 14px; }
.ev .st-i { position: absolute; top: 4px; right: 4px; font-size: 16px; }
.ev.done { background: var(--sunk); color: var(--ink-2); }
.ev.done .st-i { color: var(--ok); }
.ev.off, .ev.ghost { background: var(--surface); border: 1px dashed var(--line-strong); color: var(--muted); }
.ev.off b { text-decoration: line-through; }
.ev.sel { background: var(--accent); color: var(--on-accent); border-style: solid; border-color: var(--accent); }
.ev.sel .st-i { color: inherit; }
.cal-side { background: var(--sunk); border-radius: 14px; padding: 24px; min-width: 0; }
/* Above phone width the selected lesson or add form is a drawer over the page; the grid keeps its full width. */
@media (min-width: 601px) {
  .cal-side { position: fixed; inset: 0 0 0 auto; z-index: 6; width: min(380px, 100%); overflow-y: auto; overscroll-behavior: contain; background: var(--surface); border-left: 1px solid var(--line); border-radius: 0; box-shadow: -8px 0 24px color-mix(in srgb, var(--ink) 12%, transparent); }
  .cal-side .grid2 { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
.cal-side h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.cal-side > .sub + .sub { margin-top: 8px; }
.cal-side .empty { margin-top: 0; }
.cal-side .rows { margin-top: 8px; }
.cal-side .row b { font-size: 14px; }
.cal-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.cal-form { margin-top: 8px; }
.cal-form .sub-h { margin-top: 24px; }
.cal-form .grid2 > label { min-width: 0; }
.form label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.form label.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.mon { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.family-grid { margin-top: 20px; }
.mon-h, .mon-b { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.mon-h small { padding: 8px 12px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); }
.cc { min-height: 92px; padding: 8px; border-left: 1px solid var(--line); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; align-items: flex-start; min-width: 0; }
.cc:nth-child(7n+1) { border-left: 0; }
.cc:nth-child(-n+7) { border-top: 0; }
.cc .day-zoom { background: transparent; border: 0; border-radius: 99px; padding: 0; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); min-width: 24px; line-height: 24px; text-align: center; }
.cc.out { background: var(--sunk); }
.cc.out .day-zoom { color: var(--muted); font-weight: 400; }
.cc.today .day-zoom { background: var(--accent); color: var(--on-accent); border-radius: 99px; }
.ci { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; font-size: 12px; font-weight: 600; border-radius: 4px; padding: 0 4px; line-height: 20px; background: var(--accent-soft); color: var(--accent-ink); white-space: nowrap; overflow: hidden; }
.ci > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.ci .ms { font-size: 14px; }
.ci.done { background: var(--sunk); color: var(--muted); }
.ci.hw { background: var(--warn-soft); color: var(--warn); }
.ci.over { background: var(--bad-soft); color: var(--bad); }
.ci.off { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-strong); }
.cc .lesson { border: 0; text-align: left; cursor: pointer; width: 100%; }
.cc .lesson:focus-visible, .day-zoom:focus-visible { outline-offset: -2px; }
.cc .lesson[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accent); }
.ci-time { flex: none; }
.lesson .mobile-subject { display: none; }
.cc .ci.off .ci-time { text-decoration: line-through; }
[data-next-lesson] { margin-top: 4px; }

/* ---------- Markdown ---------- */
.markdown-body { overflow-wrap: anywhere; color: var(--ink-2); }
.markdown-body > :first-child { margin-top: 0; }
.markdown-body > :last-child { margin-bottom: 0; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { margin: 1em 0 0.4em; font-size: 18px; font-weight: 600; color: var(--ink); }
.markdown-body p, .markdown-body ul, .markdown-body ol, .markdown-body blockquote { margin: 0.6em 0; }
.markdown-body ul, .markdown-body ol { padding-left: 20px; }
.markdown-body blockquote { padding-left: 16px; border-left: 2px solid var(--line-strong); color: var(--muted); }
.markdown-body code, .markdown-body pre { background: var(--sunk); border-radius: 4px; font-family: ui-monospace, monospace; font-size: 0.9em; }
.markdown-body code { padding: 2px 4px; }
.markdown-body pre { padding: 12px; overflow: auto; }
.markdown-body pre code { padding: 0; background: transparent; }
.markdown-body table { border-collapse: collapse; display: block; overflow-x: auto; }
.markdown-body th { overflow-wrap: normal; word-break: normal; }
.markdown-body th, .markdown-body td { border: 1px solid var(--line); padding: 4px 8px; }
.viewer .markdown-body { line-height: 1.6; }
.viewer .markdown-body > :is(p, ul, ol, div, blockquote) { max-width: 88ch; }
.viewer .markdown-body h1 { font-size: 1.5rem; }
.viewer .markdown-body h2 { margin-top: 1.4em; font-size: 1.2rem; }
.viewer .markdown-body th { background: var(--sunk); text-align: left; }
.viewer .markdown-body :is(sub, sup) { line-height: 0; }
.markdown-body .katex-display { overflow-x: auto; overflow-y: hidden; }
.viewer .markdown-body { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.md-image { display: block; max-width: 100%; margin: 12px 0; border-radius: 8px; background: var(--ink-paper); }
.md-blocked-media { color: var(--muted); }
.math-source { color: var(--warn); }
.markdown-error { color: var(--bad); font-size: 14px; }
.prompt p, .option-copy p, .answer-copy p, .feedback-copy p { margin: 0; }
.option-copy { flex: 1; min-width: 0; }

/* ---------- Signed out and notices ---------- */
.empty-state { max-width: 440px; margin: 15vh auto 0; padding: 0 16px; text-align: center; }
.empty-state .form label { text-align: left; }
#teacher-sign-in { margin-top: 20px; }
#teacher-sign-in button { margin: 12px 0; }
.empty-state img { display: block; margin: 0 auto 20px; }
.empty-state h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.empty-state p { color: var(--ink-2); margin-top: 8px; }
#notice { pointer-events: none; position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); margin: 0; background: var(--ink); color: var(--canvas); border-radius: 8px; padding: 8px 16px; font-size: 14px; font-weight: 500; z-index: 10; max-width: calc(100vw - 32px); }
#notice:empty { display: none; }

/* ---------- Tablet ---------- */
.reading-card { display: flex; gap: 12px; align-items: center; margin: 16px 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-decoration: none; }
.reading-card > span:nth-child(2) { display: grid; gap: 3px; flex: 1; min-width: 0; color: var(--ink); }
.reading-card small { font-weight: 600; color: var(--accent-ink); }
.reading-card strong + span { font-size: 14px; color: var(--ink-2); }

/* The handout reader uses the author's headings and teaching cues. */
.viewer { container-type: inline-size; }
.viewer .markdown-body:has(> .handout) { padding: clamp(16px, 3cqi, 38px); }
.handout { min-width: 0; max-width: 76ch; }
.viewer .handout > h1 { font: 600 clamp(1.8rem, 4.3cqi, 3rem)/1.08 Georgia, serif; letter-spacing: -.035em; margin: 0 0 .35em; }
.viewer .handout > h2 { font: 600 clamp(1.35rem, 2.7cqi, 1.9rem)/1.2 Georgia, serif; letter-spacing: -.02em; border-top: 1px solid var(--line-strong); padding-top: .8em; margin: 1.25em 0 .6em; scroll-margin-top: 66px; }
.handout-equation {
  display: block; max-width: 100%; overflow-x: auto; white-space: nowrap;
  overflow-wrap: normal; word-break: normal; padding-block: .25em; margin-block: .35em;
}
.handout .handout-equation .katex-display { display: inline-block; margin: 0; overflow: visible; }
.handout-equation + br { display: none; }
.handout-equation .katex-html { display: inline-block; white-space: nowrap; }
.handout > h3 { padding-top: .4em; }
.handout > ol { padding-left: 1.8em; }
.handout > ol > li { padding-left: .35em; margin-block: .24em; }
.handout > ol > li::marker { color: var(--accent-ink); font-weight: 700; }
.handout [data-lesson-block] { margin-block: 1em; }
.handout [data-lesson-block="notation"] { padding: .55em 1em; border-inline-start: 3px solid var(--line-strong); font-size: .93em; }
.handout [data-lesson-block="rule"] > strong:first-child { color: var(--accent-ink); }
.handout [data-lesson-block="example"] { padding: 1em 1.2em; background: var(--accent-soft); border-radius: 8px; }
.handout [data-lesson-block="example"] > strong:first-child { display: block; color: var(--accent-ink); margin-bottom: .4em; }
.handout [data-lesson-block="example"] b { display: inline-block; margin-top: .65em; }
.handout [data-lesson-block="trap"] { border-inline-start: 3px solid var(--warn); padding: .25em .9em; }
.handout table { margin: 1em 0; }
.viewer .handout :is(th, td) { padding: .4em .85em; }
.viewer .handout blockquote {
  position: relative; margin: 1.4em 0; padding: .9em 1em .95em 2.8em;
  border: 0; border-block: 1px solid var(--line-strong);
  color: var(--ink); font: 1.16em/1.5 Georgia, serif;
}
.viewer .handout blockquote::before {
  content: "“" / ""; position: absolute; inset: .04em auto auto .16em;
  font: 3.1em/1 Georgia, serif; color: var(--accent-ink);
}
.handout blockquote > :first-child { margin-top: 0; }
.handout blockquote > :last-child { margin-bottom: 0; }
.handout blockquote cite { display: block; margin-top: .7em; color: var(--muted); font: .8em/1.4 var(--font); }
.handout tbody tr:nth-child(even) { background: var(--sunk); }
.viewer .handout pre { padding: 1em 1.2em; border-radius: 8px; border: 1px solid var(--line); }
.handout img { margin: 1em auto; }
.handout-contents { margin-bottom: 1.2em; font-size: .88rem; color: var(--ink-2); }
.handout-contents summary { font-weight: 650; cursor: pointer; color: var(--ink); }
.handout-contents button { display: block; width: 100%; text-align: left; cursor: pointer; background: transparent; border: 0; padding: .45em .35em; line-height: 1.35; }
.handout-contents button:hover { color: var(--accent-ink); background: var(--sunk); }
@container (min-width: 850px) {
  .viewer .markdown-body:has(> .handout-contents) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, 21%); gap: clamp(24px, 4cqi, 60px); align-items: start; }
  .handout-contents { grid-column: 2; grid-row: 1; position: sticky; top: 24px; padding-left: 1.3em; border-left: 1px solid var(--line); }
  .handout { grid-column: 1; grid-row: 1; }
}

@media (max-width: 1000px) {
  .qr { grid-template-columns: 32px minmax(0, 1fr); }
  .qr > .fb, .qr > .form { grid-column: 2; }
  .part { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Phone: top bar and bottom tabs instead of the rail ---------- */
@media (max-width: 600px) {
  .share-row .viewer { margin-inline-start: -56px; }
  .viewer .markdown-body { padding: 14px; }
  .viewer .markdown-body th, .viewer .markdown-body td { padding: 5px 6px; }

  .signed-in .app { display: block; }
  .signed-in .side { display: none; }
  .signed-in .p-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
  .p-top .brand { padding: 0; }
  .p-top .brand img { width: 28px; height: 28px; }
  .p-top-end { display: flex; align-items: center; gap: 8px; }
  .signed-in .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--surface); border-top: 1px solid var(--line); padding: 4px 4px calc(8px + env(safe-area-inset-bottom)); }
  .signed-in.no-tabs .tabbar { display: none; }
  .tab { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--muted); text-decoration: none; min-height: 48px; position: relative; }
  [data-role="teacher"] .tab { flex-direction: column; }
  .tab-label { font-size: 12px; }
  .action-bar > .btn { flex: 1 1 auto; }
  .action-bar > .btn:last-child { flex-basis: 100%; }
  .tab .ms { font-size: 24px; }
  .tab.on { color: var(--accent-ink); }
  .tab .count { top: 4px; right: calc(50% - 22px); }
  .main { padding: 20px 16px 28px; }
  .signed-in:not(.no-tabs) .main { padding-bottom: 96px; }
  .main h1 { font-size: 22px; }
  .row { grid-template-columns: minmax(0, 1fr) auto; }
  .row > .st { grid-column: 1; grid-row: 2; margin-top: -8px; }
  .row > .chips { grid-column: 1; grid-row: 2; margin-top: -8px; }
  .row > .ms.go { grid-column: 2; grid-row: 1 / span 2; }
  .q { padding: 20px 16px; }
  .q-body { font-size: 16px; }
  .hw-top .saved { order: 3; flex-basis: 100%; }
  .qr { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .qr > .fb, .qr > .form { grid-column: 1; }
  .qr .n { display: none; }
  .qr.parted { grid-template-columns: minmax(0, 1fr); }
  .qr h3.sr { position: static !important; width: auto; height: auto; clip-path: none; font-size: 15px; font-weight: 600; }
  .result { padding: 20px; }
  .grid3, .grid2 { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .toolbar label, .toolbar .search-field { flex: 1 1 100%; min-width: 0; }
  .file-extra { padding-left: 0; }
  .share-row .file-extra { padding-left: 0; }
  .tt th:last-child, .tt td:last-child { padding-right: 0; text-align: right; }
  .lesson-sheet { margin: auto auto 0; width: 100%; max-width: 100%; border-radius: 20px 20px 0 0; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
  .cal-scroll { margin-inline: -8px; }
  .cal { min-width: 0; }
  .cal-h, .cal-b, .cal-due { grid-template-columns: 34px repeat(7, minmax(0, 1fr)); }
  .cal-d { flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; }
  .cal-d small { font-size: 11px; }
  .cal-d b { line-height: 22px; }
  .cal-d.today b { padding: 0 4px; }
  .cal-t { font-size: 10px; padding-right: 3px; }
  .cal-due > * { padding: 3px 1px; }
  .cal-due .ci { padding: 0 2px; font-size: 10px; }
  .cal-due .ms, .cal-t .hour-long, .ev .m { display: none; }
  .week-time { display: block; font-variant-numeric: tabular-nums; }
  .ev { height: var(--lesson-height); margin-inline: 1px; padding: 0; border-radius: 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
  .cal-b .ev b { display: none; }
  .cal-b .ev .m { display: block; line-height: 1; font-size: 0; }
  .cal-b .ev .m .ms { display: inline; font-size: 13px; }
  .ev b { padding: 0; max-width: 100%; font-size: 10px; font-weight: 500; }
  .ev .st-i { position: static; font-size: 11px; }
  .mon-h small { padding: 6px 2px; text-align: center; font-size: 11px; }
  .cc { padding: 3px 1px; min-height: 76px; gap: 2px; }
  .cc .day-zoom { align-self: center; min-width: 30px; line-height: 30px; }
  .cc .ci { font-size: 10px; line-height: 14px; padding: 2px; }
  .mon .cc .lesson { display: block; padding: 1px 2px; background: transparent; box-shadow: none; }
  .mon .lesson .ci-time { display: none; }
  .mon .lesson .lesson-name { display: block; line-height: 14px; padding: 0 3px; border-radius: 5px; color: var(--lesson-ink); background: var(--lesson-fill); box-shadow: inset 2px 0 var(--lesson-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mon .lesson.off .lesson-name { text-decoration: line-through; }
  .mon .lesson[data-subject] + .lesson { margin-top: -1px; }
  .mon .lesson:last-child { padding-bottom: 5px; }
  .mon .lesson .mobile-subject { display: inline; }
  .cc .ci .ms { display: none; }
  .cal-layout:has(.cal-side) .cal-side { grid-row: 1; }
  .cal-side { padding: 20px 16px; }
  #notice { bottom: 88px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.file small .m { white-space: normal; }
.file small .m > span:last-child { overflow: visible; }
#mark .questions { border-bottom: 0; }

.formula-answer math-field { display: block; width: 100%; min-height: 52px; padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 22px; }
.formula-answer summary { cursor: pointer; margin: 12px 0; }
.formula-answer canvas { aspect-ratio: 18 / 5; background: white; }

.markdown-body img[src^="/api/gamsat-figures/"],
.markdown-body img[src^="/bank-figures/"] { display: block; max-width: 100%; height: auto; }
.fill-in input { width: 9em; max-width: 100%; font: inherit; }

:root:is([data-role="teacher"], [data-role="student"]) { --canvas: white; color-scheme: light; }
:root[data-role="teacher"] { --accent: #275740; --accent-hover: #1b4230; --accent-soft: #dff0e5; --accent-ink: #275740; }
.subject-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 12px; margin-top: 20px; }
.subject-link { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); padding: 20px; border-radius: 12px; color: var(--accent-ink); text-decoration: none; }
.subject-link:hover { background: var(--accent-soft); }
.subject-link strong { flex: 1; }
.topic-plan { max-width: 52rem; margin-top: 20px; }
.topic-add { display: flex; gap: 12px; align-items: end; }
.topic-add label { flex: 1; min-width: 0; }
.topic-add input { display: block; width: 100%; margin-top: 4px; border: 1px solid var(--line-strong); border-radius: 6px; padding: 8px; }
.topic-sequence { padding-inline-start: 2rem; }
.topic-sequence li { padding: 8px; border-bottom: 1px solid var(--line); }
.topic-sequence li::marker { color: var(--accent-ink); font-weight: 600; }
.topic-sequence li div { display: inline-flex; gap: 4px; vertical-align: middle; }
.topic-sequence li > span { display: inline-block; width: calc(100% - 98px); }
.topic-detail { padding: 14px 0; border-bottom: 1px solid var(--line); }
.topic-detail summary { color: var(--accent-ink); cursor: pointer; font-weight: 600; }
.topic-detail h3, .topic-detail p { margin: 12px 0 4px; }

.family-empty {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 12px;
  min-height: clamp(235px, 43vh, 390px);
  padding: 24px 16px;
  text-align: center;
  color: var(--ink-2);
}
.family-empty img { display: block; width: clamp(170px, 22vw, 248px); max-width: 100%; height: auto; }
.family-empty p { font-size: 16px; font-weight: 500; }

/* Keep field groups together and separate the next action from the last field. */
.form > :is(label, fieldset, p, .code-cells) + .btn,
#working-lines + .btn { margin-top: 16px; }
.form > h2 + p, .formula-answer .field + math-field { margin-top: 8px; }
#app > .btn + h1, #app > form.box + h1,
#app > .box + .box, #app > h1 + .box, .family-actions + form.box { margin-block-start: 16px; }
.field > input[name="answer"], [data-line-note], textarea[data-line-feedback] {
  display: block; width: 100%; margin-top: 8px; padding: 10px 12px;
  min-height: 44px; border: 1px solid var(--line-strong); border-radius: 8px;
  font: 400 16px/1.5 var(--font); background: var(--surface); color: var(--ink);
}
[data-working-line] > label { display: block; margin-top: 16px; }
.family-lookup {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  align-items: start; gap: 20px; margin-top: 20px;
}
[data-family-refresh] { margin-top: 12px; }
.family-actions { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.family-actions .child-switch { min-width: 0; margin: 0; }
.family-actions .btn { flex: none; margin-inline-start: auto; }
.family-actions:has(> :only-child):has(+ :is(h1, .family-overview)) { float: inline-end; margin: 0 0 8px 12px; }
.code-cells {
  --cell: clamp(30px, 10vw, 44px); --gutter: clamp(4px, 1.5vw, 8px);
  position: relative; display: grid; grid-template-columns: repeat(6, var(--cell));
  gap: var(--gutter); width: max-content; margin-top: 8px;
}
.code-cells > span {
  height: 48px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px;
}
.code-cells:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
#family-verification-code {
  position: absolute; inset: 0; width: calc(100% + var(--gutter)); height: 48px;
  margin: 0; border: 0; outline: 0; background: transparent;
  font: 500 22px/48px ui-monospace, monospace; letter-spacing: calc(var(--cell) + var(--gutter) - 1ch);
  padding: 0 0 0 calc((var(--cell) - 1ch) / 2);
}

.who:hover, .who[aria-current="page"] { box-shadow: inset 0 0 0 2px var(--accent); }
.profile-settings { max-width: 32rem; margin-top: 20px; }
.profile-settings .sub { margin-bottom: 16px; }
.profile-settings .row { grid-template-columns: auto minmax(0, 1fr) auto; }
.profile-settings > button { margin-top: 16px; }

html:has(.product-tour[open]) { overflow: hidden; }
.product-tour { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; overflow: hidden; background: transparent; color: var(--ink); }
.product-tour::backdrop { background: transparent; }
.tour-ring { position: absolute; border-radius: 10px; outline: 2px solid var(--accent); box-shadow: 0 0 0 200vmax rgb(10 14 27 / 69%); pointer-events: none; }
.tour-card { position: absolute; width: min(360px, calc(100% - 16px)); max-height: calc(100% - 16px); overflow: auto; padding: 20px; border-radius: 14px; background: var(--surface); box-shadow: 0 8px 32px rgb(0 0 0 / 24%); }
.tour-card small { color: var(--accent-ink); font-weight: 600; }
.tour-card h2 { font-size: 19px; margin: 4px 0 8px; }
.tour-card p { color: var(--muted); font-size: 14px; }
.tour-card .tour-error { color: var(--bad); }
.tour-actions { margin-top: 16px; display: flex; align-items: center; gap: 8px; }
.tour-actions [data-tour="skipped"] { margin-right: auto; }
.tour-actions [data-tour="skipped"] { color: var(--muted); border: 0; background: transparent; padding: 8px; cursor: pointer; text-decoration: underline; }
.weekday-picks { display: flex; flex-wrap: wrap; gap: 8px 16px; border: 0; padding: 0; margin: 0 0 16px; }
.weekday-picks legend { font-weight: 600; margin-bottom: 8px; }

/* Prepared lessons: teacher-only until scheduled. */
.prepared { margin-bottom: 28px; }
.prepared-row { display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--line); }
.prepared-row .row { flex: 1; border-top: 0; }
.prepared-note { margin: 0 0 16px; }
#prepared-schedule .when { display: grid; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; }
#prepared-schedule .share { display: grid; gap: 6px; border: 0; padding: 0; }

/* ---------- Question feedback (thumbs up / down once the answer is shown) ---------- */
.q-vote { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.q-vote .btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.feedback-sheet { margin: auto; width: min(480px, calc(100% - 32px)); max-height: 85dvh; border: 1px solid var(--line); border-radius: 18px; padding: 22px; background: var(--surface); color: var(--ink); }
.feedback-sheet::backdrop { background: rgb(10 15 24 / 40%); }
.feedback-sheet header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.feedback-sheet h2 { font-size: 18px; }
.feedback-sheet header button { margin-left: auto; }
.feedback-reasons { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; margin: 0; }
.feedback-reasons label { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: 8px; font-size: 14px; cursor: pointer; }
.feedback-reasons label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.feedback-sheet .row-actions { justify-content: flex-end; }

/* ---------- Student page details and edit dialogs ---------- */
/* Read-only property rows: label, value, then a pencil that opens the row's edit dialog. */
.props { margin: 12px 0 0; border-bottom: 1px solid var(--line); }
.props > div { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 16px; align-items: center; min-height: 52px; padding: 8px 0; border-top: 1px solid var(--line); }
.props dt { color: var(--muted); font-size: 14px; }
.props dd { margin: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; font-size: 14px; }
.prop-v { min-width: 0; overflow-wrap: anywhere; }
.prop-v .m { white-space: normal; }
.prop-line { display: block; }
/* A centred card, and a bottom sheet on phones, like .feedback-sheet and .lesson-sheet. */
.edit-sheet { margin: auto; width: min(480px, calc(100% - 32px)); max-height: 85dvh; overflow-y: auto; border: 1px solid var(--line); border-radius: 18px; padding: 24px; background: var(--surface); color: var(--ink); }
.edit-sheet::backdrop { background: color-mix(in srgb, var(--ink) 40%, transparent); }
.edit-sheet header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.edit-sheet form > :first-child, .edit-sheet .parents > :first-child { margin-top: 0; }
.edit-sheet header h2 { font-size: 18px; font-weight: 600; }
.edit-sheet header .btn { margin-left: auto; }
.edit-sheet h3 { font-size: 14px; font-weight: 600; margin-top: 24px; }
.edit-sheet .parents > .parent:first-child { border-top: 0; }
.sheet-error { margin-top: 16px; color: var(--bad); font-size: 14px; }
.sheet-error:empty { display: none; }
#enrolment input[name="year"] { max-width: 96px; }
#tuition-balance input[type="number"] { max-width: 160px; }
#student-identity .date-field { max-width: 200px; }
dialog:modal { overscroll-behavior: contain; }
dialog::backdrop { overflow: hidden; overscroll-behavior: contain; }
@media (max-width: 600px) {
  .props > div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .edit-sheet { margin: auto auto 0; width: 100%; max-width: 100%; border-radius: 20px 20px 0 0; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
}
.row[data-cadence-link] { grid-template-columns: auto minmax(0, 1fr) auto; } /* student page: icon, label, chevron */
