/* ============================================================================
   TTA PWA — single design-system stylesheet (M5, 2026-09-16)
   Mobile-first. ONLY min-width media queries (600 / 840 / 1280).
   premium.css is retired: everything it carried is folded in here.
   Motion: TTA_MOTION (motion.js) owns press/spring/drag. The only CSS press
   rules are the [data-touch-pressed] / :active fallbacks below, which exist so
   a control still reacts if JS has not booted yet.
   ========================================================================= */

/* ── 1. TOKENS ───────────────────────────────────────────────────────────── */
:root {
  /* Brand ramp */
  --navy: #0A2342; --navy-mid: #163A5F; --navy-light: #1E5080; --navy-deep: #071A33; --navy-ghost: #EEF2FF;
  --gold: #D4AF37; --gold-light: #F0D060; --gold-dark: #B89B2E;
  --red: #A40E1E; --red-dark: #8C0B18; --red-soft: #FDE8E8;
  --success: #10B981; --warning: #F59E0B; --info: #3B82F6; --tutor: #1d4ed8;
  --ink: #0F172A; --muted: #64748B; --paper: #FFFFFF; --canvas: #F8FAFC; --line: #E2E8F0;
  --white: #FFFFFF; --black: #000000;
  /* Quiet surfaces — pressed backgrounds, tracks, inert chips */
  --surface-quiet: #F3F4F6;
  --success-soft: #E6F7F0; --warning-soft: #FEF4E0; --info-soft: #E8F0FE;
  /* Semantic — the only names components should use */
  --primary: var(--navy); --primary-soft: var(--navy-ghost);
  --cta: var(--gold); --cta-ink: var(--navy);
  --danger: var(--red); --danger-soft: var(--red-soft);
  --selected: var(--navy);
  /* Radii (Penpot: sm10 md14 lg20 xl24 pill) */
  --radius-sm: 10px; --radius-md: 14px; --radius-lg: 20px; --radius-xl: 24px; --radius-pill: 999px;
  /* Elevation — exact offset/blur/alpha per depth (Interaction Rule 4) */
  --elev-1: 0 12px 35px rgba(10, 35, 66, .09);
  --elev-2: 0 24px 70px rgba(10, 35, 66, .22);
  --elev-sheet: 0 -8px 30px rgba(10, 35, 66, .16);
  --elev-press: 0 2px 8px rgba(10, 35, 66, .08);
  --shadow: var(--elev-1); /* alias kept: runner block still reads --shadow */
  /* Shell metrics — every fixed bar height is derived from these */
  --header-h: 62px; --nav-h: 66px; --dock-h: 56px;
  --gutter: 16px;
  /* Fluid type scale — the 12 Penpot type styles, clamp()/rem only */
  --t-display: clamp(1.625rem, 1.35rem + 1.15vw, 2rem);
  --t-h1: clamp(1.4rem, 1.22rem + 0.75vw, 1.625rem);
  --t-h2: clamp(1.15rem, 1.06rem + 0.38vw, 1.25rem);
  --t-h3: clamp(1.0625rem, 1.03rem + 0.15vw, 1.0625rem);
  --t-body: 1rem;
  --t-small: 0.875rem;
  --t-caption: 0.75rem;
  --t-label: 0.75rem;
  --t-button: 1rem;
  --t-metric: clamp(1.5rem, 1.25rem + 1.05vw, 1.75rem);
  --t-passage: 1rem;
  /* Legacy step aliases (page views still reference them) */
  --step-0: var(--t-body);
  --step-1: var(--t-h3);
  --step-2: var(--t-h2);
  --step-3: var(--t-display);
  /* Spacing rhythm — 8 inside, 16 between cards, 24 between sections */
  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem;
  --space-4: 1rem; --space-5: 1.5rem; --space-6: 2rem;
  --space-inline: 8px; --space-card: 16px; --space-section: 24px;
  /* Compatibility aliases for the retired premium.css token layer */
  --premium-radius: var(--radius-lg);
  --premium-gutter: var(--gutter);
  --premium-quiet: var(--surface-quiet);
  --premium-text: var(--ink);
  --premium-accent: var(--primary);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #0b1220; --paper: #141f38; --ink: #e8eefb; --muted: #9fb0cc; --line: #24324f;
    --navy: #0e1a30; --navy-mid: #1c2c4d; --navy-light: #26385e; --navy-deep: #060b16; --navy-ghost: #1a2540;
    --gold: #D4AF37; --gold-light: #F0D060; --gold-dark: #B89B2E;
    --red: #ff8a8a; --red-dark: #ff6b6b; --red-soft: #3a1c1c;
    --success: #34d399; --warning: #fbbf24; --info: #60a5fa; --tutor: #60a5fa;
    --surface-quiet: #1a2540;
    --success-soft: #13332a; --warning-soft: #3a2e12; --info-soft: #16264a;
    --primary: var(--navy); --primary-soft: var(--navy-ghost);
    --cta: var(--gold); --cta-ink: var(--navy-deep);
    --danger: var(--red); --danger-soft: var(--red-soft);
    --selected: var(--gold);
    --shadow: none;
    --elev-1: 0 12px 35px rgba(0, 0, 0, .35);
    --elev-2: 0 24px 70px rgba(0, 0, 0, .55);
    --elev-sheet: 0 -8px 30px rgba(0, 0, 0, .45);
    --elev-press: 0 2px 8px rgba(0, 0, 0, .3);
    --premium-quiet: var(--surface-quiet);
    --premium-accent: var(--ink);
  }
}

/* ── 2. BASE ─────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { background: var(--canvas); color: var(--ink); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--canvas); font-size: var(--t-body); line-height: 1.5; }
@supports (height: 100dvh) { body { min-height: 100dvh; } }
a { color: inherit; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:not(:disabled), label:has(input:not(:disabled)) { cursor: pointer; }
:is(button, a, label, input[type=checkbox], input[type=radio]) { touch-action: manipulation; }
body[data-authenticated=true] button { font-family: inherit; touch-action: manipulation; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; top: -60px; left: 12px; z-index: 100; background: var(--paper); color: var(--ink); padding: 12px; border-radius: var(--radius-sm); }
.skip-link:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
:is(a, button, input, select, textarea, label, summary, [tabindex]):focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
details > summary { display: flex; align-items: center; min-height: 44px; padding-block: 8px; cursor: pointer; touch-action: manipulation; }

/* ── 3. TYPE ─────────────────────────────────────────────────────────────── */
h1, h2, h3, h4, strong { font-family: inherit; }
h1 { font-size: var(--t-h1); font-weight: 700; line-height: 1.2; letter-spacing: -.02em; margin: 0 0 var(--space-inline); }
h2 { font-size: var(--t-h2); font-weight: 700; line-height: 1.3; letter-spacing: -.015em; margin: 0 0 var(--space-inline); }
h3 { font-size: var(--t-h3); font-weight: 600; line-height: 1.35; margin: 0 0 var(--space-inline); }
p { line-height: 1.5; margin: 0 0 var(--space-card); }
small, .fine-print { font-size: var(--t-small); color: var(--muted); }
.t-display { font-size: var(--t-display); font-weight: 700; line-height: 1.15; letter-spacing: -.025em; }
.t-h1 { font-size: var(--t-h1); font-weight: 700; line-height: 1.2; letter-spacing: -.02em; }
.t-h2 { font-size: var(--t-h2); font-weight: 700; line-height: 1.3; letter-spacing: -.015em; }
.t-h3 { font-size: var(--t-h3); font-weight: 600; line-height: 1.35; }
.t-body { font-size: var(--t-body); font-weight: 400; line-height: 1.5; }
.t-body-strong { font-size: var(--t-body); font-weight: 600; line-height: 1.5; }
.t-small { font-size: var(--t-small); font-weight: 400; line-height: 1.5; }
.t-small-strong { font-size: var(--t-small); font-weight: 600; line-height: 1.5; }
.t-caption { font-size: var(--t-caption); font-weight: 500; line-height: 1.4; color: var(--muted); }
.t-label, .eyebrow, .sheet-group-label { font-size: var(--t-label); font-weight: 700; line-height: 1.3; letter-spacing: .06em; text-transform: uppercase; }
.t-button { font-size: var(--t-button); font-weight: 600; line-height: 1.2; }
.t-metric { font-size: var(--t-metric); font-weight: 700; line-height: 1.15; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.t-passage, .passage { font-size: var(--t-passage); font-weight: 400; line-height: 1.65; }
.eyebrow { margin: 0; color: var(--muted); }
.muted { color: var(--muted); }
.prose { overflow-wrap: anywhere; line-height: 1.7; }
.prose img { max-width: 100%; height: auto; }

/* ── 4. BUTTONS ──────────────────────────────────────────────────────────── */
.button, .icon-button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-inline);
  min-height: 44px; padding: 10px 16px; border: 1px solid transparent; border-radius: var(--radius-md);
  font-size: var(--t-button); font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer;
  background: var(--paper); color: var(--ink); border-color: var(--line);
}
button, .button { min-height: 44px; }
.button.primary { min-height: 48px; background: var(--cta); color: var(--cta-ink); border-color: transparent; }
.button.secondary { background: var(--paper); color: var(--ink); border-color: var(--line); }
.button.ghost { background: transparent; color: var(--primary); border-color: transparent; }
.button.danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, var(--danger-soft)); }
.button.danger.solid { background: var(--danger); color: var(--white); border-color: transparent; }
.button.navy { min-height: 48px; background: var(--primary); color: var(--white); border-color: transparent; }
.button.full, .button-full { width: 100%; }
.icon-button { min-width: 44px; min-height: 44px; padding: 0 10px; }
.button:disabled, .button[aria-disabled=true], .icon-button:disabled { opacity: .5; cursor: not-allowed; }
/* Pressed fallback — one system only, matching the Penpot pressed variants.
   TTA_MOTION.press() adds the spring on top when JS is live. */
.button.primary[data-touch-pressed=true], .button.primary:active { background: var(--gold-dark); }
.button.secondary[data-touch-pressed=true], .button.secondary:active,
.icon-button[data-touch-pressed=true], .icon-button:active { background: var(--surface-quiet); }
.button.ghost[data-touch-pressed=true], .button.ghost:active { background: var(--primary-soft); }
.button.danger[data-touch-pressed=true], .button.danger:active { background: color-mix(in srgb, var(--danger) 18%, var(--danger-soft)); }
.button.navy[data-touch-pressed=true], .button.navy:active { background: var(--navy-deep); }
.button.is-loading { position: relative; color: transparent; pointer-events: none; }
.button.is-loading::after {
  content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: var(--cta-ink);
  animation: tta-spin .75s linear infinite;
}
.button.secondary.is-loading::after, .button.ghost.is-loading::after { border-top-color: var(--primary); }
@keyframes tta-spin { to { transform: rotate(360deg); } }
.link-button { min-height: 44px; padding: 0 8px; border: 0; background: none; color: var(--primary); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
[data-navigation-pending] { opacity: .72 !important; box-shadow: inset 0 0 0 2px var(--primary); }
[data-navigation-pending].primary { box-shadow: inset 0 0 0 2px var(--ink); }

/* ── 5. CHIPS ────────────────────────────────────────────────────────────── */
.chip-row { display: flex; flex-wrap: wrap; gap: var(--space-inline); align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--radius-pill);
  background: var(--paper); color: var(--muted); font-size: var(--t-small); font-weight: 600;
  text-decoration: none; cursor: pointer;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}
.chip.is-on { background: var(--primary); border-color: var(--primary); color: var(--white); }
.chip-count { padding: 1px 7px; border-radius: var(--radius-pill); background: var(--surface-quiet); color: var(--muted); font-size: var(--t-caption); font-weight: 600; }
.chip.is-on .chip-count { background: color-mix(in srgb, var(--white) 22%, transparent); color: var(--white); }
.chip-more { border-style: dashed; }
.chip[data-touch-pressed=true], .chip:active { background: var(--surface-quiet); }
.chip.is-on[data-touch-pressed=true], .chip.is-on:active { background: var(--navy-mid); }
.filter-clear { justify-self: start; min-height: 44px; display: inline-flex; align-items: center; color: var(--muted); font-size: var(--t-small); }

/* ── 6. BADGES ───────────────────────────────────────────────────────────── */
.badge, .tag, .status-pill {
  display: inline-flex; align-items: center; gap: 4px; min-height: 22px; padding: 4px 9px;
  border-radius: var(--radius-pill); background: var(--surface-quiet); color: var(--muted);
  font-size: var(--t-caption); font-weight: 600; line-height: 1.3;
}
.badge.neutral, .tag.neutral { background: var(--surface-quiet); color: var(--muted); }
.badge.success, .tag.status-accepted, .tag.status-paid, .tag.status-completed, .status-pill.status-completed { background: var(--success-soft); color: var(--success); }
.badge.warning, .tag.status-pending, .status-pill.status-in_progress { background: var(--warning-soft); color: color-mix(in srgb, var(--warning) 70%, var(--ink)); }
.badge.danger, .tag.status-revoked, .tag.status-void, .tag.status-cancelled, .tag.status-overdue { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.navy { background: var(--primary-soft); color: var(--primary); }
.badge.locked, .tag.locked { background: var(--surface-quiet); color: var(--muted); }
.tag { background: var(--success-soft); color: var(--success); }
.timer-pill { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 6px 12px; border-radius: var(--radius-pill); background: var(--surface-quiet); color: var(--ink); font-size: var(--t-small); font-weight: 600; font-variant-numeric: tabular-nums; }
.timer-pill.is-warning, .timer-pill.urgent { background: var(--danger-soft); color: var(--danger); }
.status-dot { width: 16px; height: 16px; border-radius: var(--radius-pill); background: var(--cta); box-shadow: 0 0 0 6px color-mix(in srgb, var(--cta) 18%, var(--paper)); }

/* ── 7. NOTICES & TOAST ──────────────────────────────────────────────────── */
.notice, .status-banner {
  display: flex; align-items: flex-start; gap: 10px; min-height: 44px;
  padding: 12px 16px; border-radius: var(--radius-md); background: var(--primary-soft); color: var(--ink);
  font-size: var(--t-small); line-height: 1.5;
}
.notice.success { background: var(--success-soft); color: color-mix(in srgb, var(--success) 75%, var(--ink)); }
.notice.error { background: var(--danger-soft); color: var(--danger); }
.notice.info { background: var(--info-soft); color: color-mix(in srgb, var(--info) 75%, var(--ink)); }
.notice.offline { background: var(--surface-quiet); color: var(--muted); }
.notice .button, .notice .link-button { margin-left: auto; flex: 0 0 auto; }
.status-banner {
  position: sticky; top: 0; z-index: 40; border-radius: 0; justify-content: center; text-align: center;
  color: var(--white); background: color-mix(in srgb, var(--warning) 55%, var(--black));
  padding-top: max(10px, env(safe-area-inset-top));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}
.status-banner.update { background: var(--primary); }
.status-banner button { margin-left: 10px; }
.toast {
  position: fixed; left: 50%; z-index: 60; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: var(--space-card);
  width: min(560px, calc(100% - 32px)); min-height: 48px; padding: 12px 16px;
  border-radius: var(--radius-md); background: var(--navy-deep); color: var(--white);
  font-size: var(--t-small); box-shadow: var(--elev-2);
}
.toast-action { margin-left: auto; min-height: 44px; padding: 0 8px; border: 0; background: none; color: var(--gold); font: inherit; font-weight: 700; cursor: pointer; }
body:not([data-dock]) .toast { bottom: calc(12px + env(safe-area-inset-bottom)); }

/* ── 8. FIELDS ───────────────────────────────────────────────────────────── */
.field { display: grid; gap: var(--space-inline); margin-bottom: var(--space-card); }
label { display: grid; gap: var(--space-inline); color: var(--ink); font-size: var(--t-small); font-weight: 600; }
.field > label, .field-label { font-size: var(--t-small); font-weight: 600; color: var(--ink); }
.field-help, .field-error { font-size: var(--t-caption); line-height: 1.4; }
.field-help { color: var(--muted); }
.field-error { color: var(--danger); }
input, select, textarea {
  width: 100%; min-height: 48px; max-width: 100%; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-md);
  color: var(--ink); background: var(--paper); font-size: 16px; scroll-margin: 100px 0;
}
:is(input[type=checkbox], input[type=radio]) { width: auto; min-height: 0; }
textarea { min-height: 100px; font: inherit; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-color: var(--primary); }
.field.is-error input, .field.is-error select, .field.is-error textarea, input.is-error, [aria-invalid=true] { border-color: var(--danger); }
.search input { min-width: 0; }
fieldset { min-width: 0; margin: var(--space-card) 0; padding: 0; border: 0; }
legend { margin-bottom: var(--space-inline); font-weight: 700; }
.check { display: flex; align-items: center; gap: 9px; min-height: 44px; font-weight: 500; }
.check input { width: 22px; height: 22px; min-height: 22px; accent-color: var(--primary); }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: var(--space-card); padding: 13px 0; border-top: 1px solid var(--line); }
.switch-row:first-of-type { border-top: 0; }
.switch-row span, .switch-row strong, .switch-row small { display: block; }
.switch-row input { width: 24px; height: 24px; min-height: auto; flex: 0 0 auto; accent-color: var(--cta); }
.day-picker { display: flex; flex-wrap: wrap; gap: 7px; }
.day-picker label { position: relative; }
.day-picker label input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0; opacity: 0; pointer-events: none; }
.day-picker span { display: grid; place-items: center; min-width: 44px; min-height: 44px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.day-picker input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.day-picker input:checked + span { color: var(--white); border-color: var(--primary); background: var(--primary); }
.day-picker span[data-touch-pressed=true] { background: var(--surface-quiet); }
.check-list { display: grid; gap: var(--space-inline); margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-md); }
.check-list legend { font-weight: 700; padding: 0 6px; }
.check-list label { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.check-list input { width: 20px; min-height: 20px; }

/* ── 9. CARDS, LISTS, STATS ──────────────────────────────────────────────── */
.card, .panel, .content-card, .action-card, .stat-card, .test-card, .progress-chart {
  border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper); box-shadow: var(--elev-1);
}
.card { padding: var(--space-card); }
.panel { margin: var(--space-card) 0; padding: var(--space-section); }
.panel h2 { margin-top: 0; }
.card-grid, .quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-card); margin-top: var(--space-card); }
.action-card, .content-card { padding: var(--space-card); text-align: left; text-decoration: none; }
button.action-card { color: inherit; cursor: pointer; font: inherit; }
.action-card strong, .action-card span { display: block; }
.action-card span { margin-top: var(--space-inline); color: var(--muted); font-size: var(--t-small); line-height: 1.5; }
.content-card h2 { font-size: var(--t-h3); margin: 12px 0 6px; }
.content-card .button { margin-top: 12px; }
.link-card { cursor: pointer; }
:is(.action-card, .content-card, .stat-card, .link-card)[data-touch-pressed=true] { background: var(--surface-quiet); }
.section-heading, .page-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--space-card); }
.section-heading { margin: var(--space-section) 0 var(--space-card); }
.section-heading a { min-height: 44px; display: inline-flex; align-items: center; font-size: var(--t-small); font-weight: 600; }
.page-heading { margin-bottom: var(--space-section); align-items: flex-start; flex-direction: column; }
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: var(--space-section) 0; }
.stat-card, .stat { padding: var(--space-card); text-decoration: none; }
.stat-card strong, .stat strong, .stat-value { display: block; font-size: var(--t-metric); font-weight: 700; letter-spacing: -.03em; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat-card span, .stat span, .stat-label { display: block; color: var(--muted); font-size: var(--t-small); line-height: 1.4; overflow-wrap: anywhere; }
/* 200% text must stretch a card, never spill out of it. */
.stat-card, .stat, .action-card, .content-card, .card, .list-row, .empty-state { overflow-wrap: anywhere; min-width: 0; }
.stat-card .eyebrow, .stat .eyebrow { color: var(--muted); margin: 0 0 4px; }
.list, .list-rows { display: block; }
.list-row {
  display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 0;
  border-top: 1px solid var(--line); color: inherit; text-decoration: none;
}
.list-row:first-child { border-top: 0; }
.list-row small { display: block; margin-top: 4px; line-height: 1.5; color: var(--muted); }
.list-row .lead {
  flex: 0 0 auto; display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: var(--radius-md); background: var(--primary-soft); color: var(--primary);
}
.list-row .list-body { flex: 1 1 auto; min-width: 0; }
.list-row .chevron, .list-row .tta-icon.chevron { flex: 0 0 auto; color: var(--muted); }
.list-row .button { min-width: 88px; margin-left: auto; }
.list-row[data-touch-pressed=true] { background: var(--surface-quiet); }
.inbox-row { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; min-height: 64px; padding: 14px 8px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.inbox-row:first-child { border-top: 0; }
.inbox-row .status-dot { opacity: 0; }
.inbox-row.unread { background: color-mix(in srgb, var(--cta) 7%, transparent); }
.inbox-row.unread .status-dot { opacity: 1; }
.inbox-row small { display: block; margin-top: 5px; }
.inbox-row[data-touch-pressed=true] { background: var(--surface-quiet); }
.reminder-card { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.reminder-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.row-actions { display: flex; flex-wrap: wrap; gap: var(--space-inline); align-items: center; justify-content: flex-end; }
.stack { display: grid; gap: var(--space-card); }
.two-column, .two-up { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 14px 0; }
.compact-list { columns: 1; padding-left: 20px; }
.access-summary { display: flex; align-items: center; gap: 14px; }
.focus-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
#focus-output { min-width: 220px; font-weight: 700; font-variant-numeric: tabular-nums; }
.meter { height: 10px; margin: 10px 0 6px; border-radius: 6px; background: var(--surface-quiet); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--primary); border-radius: 6px; }

/* ── 10. PROGRESS ────────────────────────────────────────────────────────── */
.progress-bar { position: relative; height: 6px; border-radius: var(--radius-pill); background: var(--surface-quiet); overflow: hidden; }
.progress-bar > span, .progress-bar .progress-value { display: block; height: 100%; width: calc(var(--pct, 0) * 1%); border-radius: var(--radius-pill); background: var(--primary); }
.progress-ring { --pct: 0; --ring-size: 72px; position: relative; display: grid; place-items: center; width: var(--ring-size); height: var(--ring-size); flex: 0 0 auto; }
.progress-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.progress-ring .ring-track { fill: none; stroke: var(--surface-quiet); stroke-width: 8; }
.progress-ring .ring-value {
  fill: none; stroke: var(--primary); stroke-width: 8; stroke-linecap: round;
  stroke-dasharray: 201.06; stroke-dashoffset: calc(201.06 - (201.06 * var(--pct) / 100));
}
.progress-ring .ring-label { position: absolute; display: grid; place-items: center; text-align: center; font-size: var(--t-small); font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.progress-ring .ring-label small { display: block; font-size: var(--t-caption); font-weight: 500; }
.progress-segments { display: flex; gap: 4px; align-items: center; }
.progress-segments > span { flex: 1 1 0; min-width: 6px; height: 4px; border-radius: var(--radius-pill); background: var(--surface-quiet); }
.progress-segments > span.is-done { background: var(--primary); }
.progress-segments > span.is-current { background: var(--cta); }

/* ── 11. SKELETON ────────────────────────────────────────────────────────── */
.skeleton { position: relative; overflow: hidden; min-height: 12px; border-radius: var(--radius-sm); background: var(--surface-quiet); }
.skeleton::after {
  content: ''; position: absolute; inset: 0; transform: translate3d(-100%, 0, 0);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--paper) 65%, transparent), transparent);
  animation: tta-shimmer 1.4s ease-in-out infinite;
}
@keyframes tta-shimmer { to { transform: translate3d(100%, 0, 0); } }
.skeleton-card { display: grid; gap: 12px; padding: var(--space-card); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper); }
.skeleton-line { height: 12px; }
.skeleton-line.short { width: 40%; }
.skeleton-line.medium { width: 65%; }

/* ── 12. SEGMENTED CONTROL & TABS ────────────────────────────────────────── */
.segmented { display: flex; gap: 4px; min-height: 48px; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-quiet); }
.segmented > * { flex: 1 1 0; min-width: 0; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); font: inherit; font-size: var(--t-small); font-weight: 600; cursor: pointer; }
.segmented > .is-on, .segmented > [aria-selected=true], .segmented > [aria-pressed=true] { background: var(--paper); color: var(--ink); box-shadow: var(--elev-press); }
.stage-tabs { display: flex; gap: var(--space-inline); padding: 4px 12px 8px; }
.stage-tab { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 10px 12px; border: 0; border-bottom: 3px solid transparent; border-radius: var(--radius-sm); background: var(--surface-quiet); color: var(--muted); font: inherit; font-weight: 600; overflow-wrap: anywhere; cursor: pointer; }
.stage-tab.active { border-bottom-color: var(--cta); background: var(--primary-soft); color: var(--ink); }
.classroom-tabs { display: flex; gap: 12px; overflow-x: auto; padding: 12px 0; margin-bottom: var(--space-card); }
.classroom-tabs a { white-space: nowrap; min-height: 44px; display: inline-flex; align-items: center; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius-md); color: var(--ink); text-decoration: none; }
.classroom-tabs a[aria-current=page] { font-weight: 700; border-color: var(--primary); background: var(--primary-soft); }

/* ── 13. MR. O (moved out of mro.blade.php) ──────────────────────────────── */
.mro { display: flex; align-items: flex-start; gap: 12px; }
.mro-sm { gap: var(--space-inline); }
.mro-avatar { flex: none; border-radius: 50%; background: var(--primary-soft); overflow: hidden; }
.mro-sm .mro-avatar { width: 56px; height: 56px; }
.mro-md .mro-avatar { width: 80px; height: 80px; }
.mro-lg .mro-avatar { width: 96px; height: 96px; }
.mro-avatar img { width: 100%; height: 100%; display: block; }
.mro-bubble { min-width: 0; flex: 1 1 auto; }
.mro-line { margin: 0; color: var(--ink); font-size: var(--t-body); line-height: 1.45; }
.mro-sm .mro-line { font-size: var(--t-small); }
.mro-cta { margin-top: var(--space-inline); }

/* ── 14. EMPTY STATE ─────────────────────────────────────────────────────── */
.empty-state {
  display: grid; justify-items: center; gap: var(--space-inline);
  padding: var(--space-section); border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--paper); text-align: center; color: var(--muted);
}
.empty-state .mro { flex-direction: column; align-items: center; gap: var(--space-card); text-align: center; }
.empty-state .empty-icon { font-size: 2rem; line-height: 1; }
.empty-state h3 { margin: var(--space-inline) 0 0; color: var(--ink); }
.empty-state p { margin: 0; font-size: var(--t-small); line-height: 1.5; }
.empty-state .button { margin-top: var(--space-inline); }

/* ── 15. DIALOG & SHEET ──────────────────────────────────────────────────── */
dialog {
  width: calc(100% - 32px); max-width: min(92vw, 480px); border: 0; border-radius: var(--radius-lg);
  padding: var(--space-section); color: var(--ink); background: var(--paper);
  max-height: calc(var(--visual-height, 100dvh) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 40px);
  overflow: auto; box-shadow: var(--elev-2);
}
dialog::backdrop { background: color-mix(in srgb, var(--navy-deep) 55%, transparent); }
.dialog.confirm { display: grid; gap: 12px; max-width: min(92vw, 400px); }
.dialog.confirm h2 { margin: 0; font-size: var(--t-h2); }
.dialog.confirm p { margin: 0; font-size: var(--t-small); color: var(--muted); }
.dialog.confirm .dialog-actions { display: flex; gap: var(--space-inline); margin-top: var(--space-inline); }
.dialog.confirm .dialog-actions > * { flex: 1 1 0; }
/* Bottom sheet. Motion lives in sheet.js (TTA_MOTION.spring/drag) — no keyframes. */
dialog.sheet {
  position: fixed; inset: auto 0 0; margin: 0; width: 100%; max-width: none; padding: 0;
  max-height: min(80vh, calc(var(--visual-height, 100dvh) - 24px));
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: var(--elev-sheet); will-change: transform;
}
.sheet-handle { display: block; width: 40px; height: 4px; margin: 10px auto 0; border-radius: var(--radius-pill); background: var(--line); touch-action: none; }
.sheet-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px 8px; }
.sheet-title { margin: 0; font-size: var(--t-h2); font-weight: 700; }
.sheet-close { min-width: 44px; min-height: 44px; padding: 0; border-color: transparent; background: transparent; }
.sheet-body { padding: 4px 20px 20px; overflow-y: auto; }
.sheet-group + .sheet-group { margin-top: var(--space-card); }
.sheet-group-label { display: block; margin: var(--space-card) 0 2px; color: var(--muted); }
.sheet-body a, .sheet-body button.link-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 0;
  border: 0; border-top: 1px solid var(--line); background: none; color: var(--ink);
  text-align: left; text-decoration: none; font: inherit; font-size: var(--t-body); cursor: pointer;
}
.sheet-body a:first-child, .sheet-body .sheet-group:first-child a:first-child, .sheet-body .sheet-group > :first-child { border-top: 0; }
.sheet-body .link-row-body { flex: 1 1 auto; min-width: 0; }
.sheet-body .link-row-body small { display: block; color: var(--muted); font-size: var(--t-caption); margin-top: 2px; }
.sheet-body .link-row-lead { flex: 0 0 auto; display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm); color: var(--primary); background: var(--primary-soft); } /* penpot fix 2026-09-19: tinted lead tile per More-mobile-sheet-open */
.sheet-body .link-row-chevron { flex: 0 0 auto; color: var(--muted); }
.sheet-body :is(a, button.link-row)[data-touch-pressed=true] { background: var(--surface-quiet); }
.sheet-body .sheet-signout, .sheet-signout { color: var(--danger); font-weight: 600; }
.sheet-body form { margin: 0; }
.sheet-body form button { width: 100%; min-height: 56px; padding: 8px 0; border: 0; border-top: 1px solid var(--line); background: none; font: inherit; text-align: left; cursor: pointer; }

/* ── 16. SHELL ───────────────────────────────────────────────────────────── */
.app-header {
  position: sticky; top: 0; z-index: 20;
  min-height: calc(var(--header-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; font-weight: 700; font-size: var(--t-small); }
.brand-mark { display: grid; place-items: center; flex: 0 0 auto; width: 32px; height: 32px; border-radius: var(--radius-sm); color: var(--white); background: var(--primary); font-weight: 700; }
.brand > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-actions { display: flex; align-items: center; gap: var(--space-inline); flex: 0 0 auto; }
.access-pill { display: inline-flex; align-items: center; min-height: 24px; border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 4px 10px; font-size: var(--t-caption); font-weight: 600; color: var(--muted); white-space: nowrap; }
.access-pill.full { color: var(--success); border-color: color-mix(in srgb, var(--success) 45%, transparent); background: var(--success-soft); }
.app-header .icon-button { border-color: transparent; background: transparent; }
.app-shell { display: block; max-width: 1440px; margin: 0 auto; }
.side-nav { display: none; }
.app-main {
  width: 100%; max-width: 1120px;
  padding: var(--space-section) max(var(--gutter), env(safe-area-inset-left)) calc(var(--nav-h) + 24px + env(safe-area-inset-bottom));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
body[data-dock]:not(.study-screen) .app-main { padding-bottom: calc(var(--nav-h) + var(--dock-h) + 24px + env(safe-area-inset-bottom)); }
.public-app { margin: auto; }

/* Bottom nav — 66px + safe area, 5 items, navy active with a 3px gold indicator. */
.bottom-nav {
  position: fixed; inset: auto 0 0; z-index: 30;
  min-height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding: 6px max(4px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
  display: grid; grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid var(--line); background: var(--paper);
}
.bottom-nav a, .bottom-nav button {
  position: relative; display: grid; place-items: center; align-content: center; gap: 3px;
  min-width: 44px; min-height: 52px; border: 0; border-radius: var(--radius-md); padding: 4px 2px;
  background: none; color: var(--muted); text-decoration: none; font: inherit;
  /* px-capped so a 200% root size cannot collide five labels into each other;
     the icon carries the meaning, the label is the secondary cue. */
  font-size: clamp(10px, var(--t-caption), 13px); font-weight: 600; cursor: pointer;
}
.bottom-nav a, .bottom-nav button { overflow: hidden; text-align: center; }
.bottom-nav .tta-icon { width: 22px; height: 22px; }
.bottom-nav a.active, .bottom-nav button.active { color: var(--primary); font-weight: 700; }
.bottom-nav a.active::before, .bottom-nav button.active::before {
  content: ''; position: absolute; top: -6px; left: 50%; transform: translateX(-50%);
  width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--cta);
}
.bottom-nav .is-pending::after {
  content: ''; position: absolute; top: 4px; right: calc(50% - 16px);
  width: 6px; height: 6px; border-radius: 50%; background: var(--cta);
}
.bottom-nav :is(a, button)[data-touch-pressed=true] { background: var(--surface-quiet); }
.keyboard-open .bottom-nav { display: none; }
.keyboard-open .stage-actions { bottom: 0; }

/* Tools dock — one 56px row, never stacked with the bottom nav on runners. */
.app-dock { position: fixed; inset: auto 0 calc(var(--nav-h) + env(safe-area-inset-bottom)); z-index: 25; }
.tools-dock, .study-tools-rail, .student-tools-rail {
  display: flex; align-items: center; gap: var(--space-inline);
  min-height: var(--dock-h); padding: 4px 12px;
  background: var(--paper); border-top: 1px solid var(--line);
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin;
}
.app-dock .tools-dock { justify-content: space-around; border-bottom: 1px solid var(--line); }
.study-tool {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  flex-shrink: 0; min-width: 64px; min-height: 48px; padding: 4px 8px;
  border: 0; border-radius: var(--radius-md); background: transparent; color: var(--ink);
  font: inherit; font-size: clamp(10px, var(--t-caption), 13px); line-height: 1.25;
  text-decoration: none; white-space: nowrap; touch-action: manipulation; cursor: pointer;
}
.study-tool .tta-icon { width: 20px; height: 20px; }
.study-tool.is-on, .study-tool[aria-pressed=true], .study-tool:has(input:checked) { background: var(--primary-soft); color: var(--primary); }
.study-tool[data-touch-pressed=true], .study-tool:active { background: var(--surface-quiet); }
.study-tool.flag-control { position: relative; }
.study-tool.flag-control input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.study-tool.flag-control:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: -2px; }
.study-tool-message { margin: 0 !important; flex-shrink: 0; padding: 8px 16px !important; border-radius: 0 !important; font-size: var(--t-small); }
.keyboard-open .app-dock { display: none; }
.study-screen .app-dock { display: none; }
:is(.topic-option, .timing-option, .mode-options label)[data-touch-pressed=true] { background: var(--primary-soft); }

/* Route status pill — "Opening Tests… Cancel" */
.route-status, .pwa-route-status {
  position: fixed; z-index: 100; top: calc(var(--header-h) + 10px + env(safe-area-inset-top)); left: 50%;
  transform: translateX(-50%); max-width: calc(100% - 24px); width: max-content;
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper);
  color: var(--ink); font-size: var(--t-small); box-shadow: var(--elev-1);
}
.route-status[hidden], .pwa-route-status[hidden] { display: none; }
.route-status button, .pwa-route-status button { min-height: 44px; padding: 10px; border: 0; border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--primary); font: inherit; font-weight: 600; }
.route-status::before, .pwa-route-status::before {
  content: ''; flex-shrink: 0; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--primary); animation: tta-wait .75s linear infinite;
}
@keyframes tta-wait { to { transform: rotate(360deg); } }

/* ── 17. HERO / HOME ─────────────────────────────────────────────────────── */
.hero {
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-card);
  padding: var(--space-section); border: 0; border-radius: var(--radius-xl);
  color: var(--white); background: var(--navy); box-shadow: none;
}
.hero h1, .student-home .hero h1 { color: var(--white); font-size: var(--t-display); line-height: 1.15; letter-spacing: -.03em; max-width: 17ch; margin: 3px 0 var(--space-inline); }
.hero p { color: var(--white); line-height: 1.5; }
.hero .eyebrow, .student-home .hero .eyebrow { color: var(--gold-light); }
.hero .button { width: 100%; gap: 12px; }
.hero .mro { margin-top: var(--space-card); }
.home-intro { margin: 0 0 var(--space-card); }
.home-intro p { color: var(--muted); font-size: var(--t-small); margin: 0; }
.home-intro strong { display: block; color: var(--ink); font-size: var(--t-h3); margin-bottom: 4px; }
.study-route-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: var(--space-card) 0; }
.study-route-card { position: relative; overflow: hidden; min-height: 140px; display: flex; align-items: flex-start; flex-direction: column; gap: 10px; padding: var(--space-card); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper); text-decoration: none; }
.study-route-card .route-icon { width: 44px; height: 44px; border-radius: var(--radius-md); display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.study-route-card strong { font-size: var(--t-h3); line-height: 1.3; }
.study-route-card small { font-size: var(--t-small); color: var(--muted); line-height: 1.5; }
.route-decoration { position: absolute; top: 18px; right: 14px; font-size: 2.5rem; color: var(--primary); opacity: .07; pointer-events: none; }
.study-route-card .route-arrow { position: absolute; right: 16px; bottom: 16px; width: 20px; height: 20px; color: var(--primary); }
.student-home .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.student-home .stat-card { padding: 16px 12px; min-width: 0; box-shadow: none; }
.student-home .stat-card span { font-size: var(--t-small); }
.student-home .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: var(--space-card); }
.student-home .action-card { min-height: 110px; padding: 18px; text-decoration: none; text-align: left; }
.student-home .action-card .tta-icon { margin-bottom: 12px; color: var(--primary); }
.student-home .panel { box-shadow: none; }
.student-home .panel .section-heading { margin-top: 0; }
.student-home details > summary { min-height: 44px; cursor: pointer; font-weight: 600; }
.student-home details .stats-grid { margin-top: var(--space-card); }

/* ── 18. AUTH ────────────────────────────────────────────────────────────── */
.auth-screen { display: grid; place-items: center; padding: var(--space-section) max(var(--gutter), env(safe-area-inset-left)); background: linear-gradient(145deg, var(--navy), var(--navy-mid)); }
.auth-card { width: min(440px, 100%); padding: var(--space-section); border-radius: var(--radius-xl); background: var(--paper); box-shadow: var(--elev-2); }
.auth-brand { margin-bottom: var(--space-section); }

/* ── 19. CATALOG / BROWSE / PRACTICE BUILDER ─────────────────────────────── */
.browse-heading { display: flex; justify-content: space-between; align-items: center; gap: var(--space-card); margin-bottom: var(--space-card); }
.browse-heading p { color: var(--muted); margin: var(--space-inline) 0 0; max-width: 48ch; font-size: var(--t-small); }
.browse-heading .eyebrow { color: var(--primary); margin: 0 0 var(--space-inline); }
.browse-heading h1 { font-size: var(--t-display); margin: 0; }
.browse-emblem { width: 48px; height: 48px; flex-shrink: 0; display: grid; place-items: center; border-radius: var(--radius-md); color: var(--primary); background: var(--primary-soft); }
.browse-emblem .tta-icon { width: 24px; height: 24px; }
.browse-shortcuts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: var(--space-card); }
.browse-shortcuts a { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper); color: var(--primary); text-decoration: none; font-weight: 600; font-size: var(--t-small); }
.browse-shortcuts a .tta-icon { width: 22px; height: 22px; }
.filter-bar { display: grid; gap: 10px; margin: 0 0 var(--space-card); padding: var(--space-card); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.filter-bar .search { margin: 0; min-width: 0; }
.filter-bar .chip-row { flex-wrap: nowrap; overflow-x: auto; padding: 4px 1px 8px; gap: var(--space-inline); scrollbar-width: thin; }
.filter-search { display: flex; gap: var(--space-inline); align-items: center; }
.filter-search .search { flex: 1 1 auto; }
.filter-search .search input { width: 100%; min-height: 48px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper); }
.filter-search-go { display: none; flex: 0 0 auto; min-width: 66px; padding: 10px; }
.catalog-sections { display: grid; gap: var(--space-section); }
.catalog-section { margin-bottom: var(--space-section); }
.catalog-section .section-heading { margin-top: 0; margin-bottom: 4px; }
.catalog-section h2 { margin: 0; font-size: var(--t-h2); }
.catalog-section .fine-print { font-size: var(--t-small); }
.catalog-section .card-grid { gap: var(--space-card); }
.catalog-more { width: 100%; margin-top: 12px; }
.catalog-pagination { margin-top: var(--space-section); }
.test-card { display: flex; flex-direction: column; gap: var(--space-inline); padding: 0; overflow: hidden; border-radius: var(--radius-lg); box-shadow: none; transition: box-shadow .18s ease; }
.test-card.is-locked { opacity: 1; }
.test-card.status-in_progress { border-color: var(--primary); }
.test-card-link { display: flex; flex-direction: column; height: 100%; padding: var(--space-card); text-decoration: none; gap: 12px; min-width: 0; }
.test-card-top { display: flex; gap: 12px; align-items: flex-start; }
.test-card-icon { width: 44px; height: 44px; border-radius: var(--radius-md); background: var(--primary-soft); color: var(--primary); flex-shrink: 0; display: grid; place-items: center; }
.test-card-tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; }
.test-card-tags .tag { font-size: var(--t-caption); border: 0; padding: 4px 8px; }
.test-card-title { margin: 0; font-size: var(--t-h3); line-height: 1.35; letter-spacing: -.015em; }
.test-card-summary { margin: 0; color: var(--muted); font-size: var(--t-small); line-height: 1.55; }
.test-card-facts { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0; color: var(--muted); font-size: var(--t-small); }
.test-card-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: auto; gap: 12px; }
.test-card-bottom .button { padding: 10px 16px; font-size: var(--t-small); }
.test-card .button { margin-top: auto; }
.pagination-controls { display: flex; flex-wrap: wrap; gap: var(--space-inline); align-items: center; }
.pagination-controls .button { min-width: 48px; }
.pagination-controls [aria-disabled=true] { opacity: .5; }
.pagination-caption { font-size: var(--t-small); color: var(--muted); }
.practice-builder { display: grid; gap: var(--space-section); }
.builder-step { margin: 0 0 var(--space-section); padding: 0 0 var(--space-section); border: 0; border-bottom: 1px solid var(--line); }
.builder-step legend { display: flex; align-items: center; gap: 10px; padding: 0 0 var(--space-card); font-weight: 700; font-size: var(--t-body); }
.step-index { display: grid; place-items: center; width: 26px; height: 26px; border-radius: var(--radius-pill); background: var(--primary-soft); color: var(--primary); font-size: var(--t-caption); }
.topic-group { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; max-height: 46vh; overflow-y: auto; }
.topic-group[hidden] { display: none; }
.topic-option { display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 16px 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper); font-size: var(--t-small); line-height: 1.45; cursor: pointer; }
.topic-option span:first-of-type { flex: 1 1 auto; }
.topic-option input:disabled + span { color: var(--muted); }
.topic-option:has(input:checked), .mode-options label:has(input:checked) { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.topic-option:has(input:disabled:not(:checked)) { opacity: .55; }
.topic-option input { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--primary); }
.topic-option .chip-count { margin-left: auto; }
.builder-availability { margin: 0; color: var(--muted); font-size: var(--t-small); }
.builder-availability.is-thin { color: var(--danger); }
.practice-resume { background: var(--primary-soft); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-card); display: flex; justify-content: space-between; align-items: center; gap: var(--space-card); margin-bottom: var(--space-card); }
.practice-resume p { margin: 5px 0 0; font-size: var(--t-small); color: var(--muted); }
.test-study-mode { border: 0; margin: var(--space-section) 0; padding: 0; }
.test-study-mode legend { font-size: var(--t-body); font-weight: 700; margin-bottom: 12px; }
.mode-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mode-options label { display: flex; align-items: flex-start; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-card); min-height: 76px; }
.mode-options small { display: block; margin-top: 5px; font-size: var(--t-small); line-height: 1.5; color: var(--muted); }
.mode-options input { accent-color: var(--primary); flex-shrink: 0; }
.test-overview { max-width: 780px; }
.test-facts { display: flex; flex-wrap: wrap; gap: 12px; margin: var(--space-section) 0; }
.test-facts span { min-width: 130px; padding: 14px; border-radius: var(--radius-md); background: var(--surface-quiet); }
.test-facts strong { display: block; font-size: var(--t-h1); }

/* ── 20. RUNNER STAGE ────────────────────────────────────────────────────── */
.stage { display: grid; gap: 0; min-width: 0; }
.stage-panes { position: relative; overflow: hidden; min-height: 0; height: clamp(280px, calc(var(--visual-height, 100dvh) - 240px), 760px); background: var(--paper); touch-action: pan-y; }
.stage-track { display: flex; align-items: stretch; width: 200%; height: 100%; }
.stage-track > * { flex: 0 0 50%; min-width: 0; height: 100%; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.stage.no-passage .stage-track { width: 100%; }
.stage.no-passage .stage-track > .stage-main { flex-basis: 100%; }
.stage-passage { padding: var(--space-card) var(--space-card) var(--space-section); border: 0; border-radius: 0; background: var(--paper); }
.stage-passage-title { margin: 0 0 var(--space-card); font-size: var(--t-body); color: var(--muted); }
.stage-passage-body { font-size: var(--study-reading-size, 1rem); line-height: 1.65; overflow-wrap: anywhere; }
.stage-passage-body img { max-width: 100%; height: auto; }
.stage-passage-body table { display: block; max-width: 100%; overflow-x: auto; }
.stage-passage-body .katex { font-size: 1.1em; }
.passage { margin-bottom: var(--space-card); padding: 18px; border-left: 4px solid var(--gold-light); border-radius: var(--radius-sm); background: var(--surface-quiet); }
.stage-main.panel { padding: var(--space-card); }
.stage-panes .stage-main.panel { margin: 0; border: 0; border-radius: 0; box-shadow: none; }
.stage-main .eyebrow { margin: 0 0 4px; }
.stage-main .question-number { margin: 0 0 var(--space-card); font-size: var(--t-body); }
.question-number { font-size: var(--t-h3); }
.stage-question { margin-bottom: var(--space-section); font-size: var(--study-reading-size, 1rem); line-height: 1.6; }
.stage-question > :first-child { margin-top: 0; }
.stage-question > :last-child { margin-bottom: 0; }
.stage-question img { max-height: 30vh; width: auto; }
.question-content, .choice-content { overflow-wrap: anywhere; line-height: 1.65; }
.question-content img, .choice-content img, .passage img { max-width: 100%; height: auto; }
.answer-choices, .stage-choices { display: grid; gap: 12px; margin: 0; padding: 0; border: 0; }
.answer-choice {
  position: relative; display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: center; gap: 12px;
  min-height: 56px; margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-md);
  background: var(--paper); font-size: var(--t-body); line-height: 1.5; cursor: pointer; touch-action: manipulation;
}
.answer-choice input { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; margin: 0; overflow: hidden; clip: rect(0, 0, 0, 0); clip-path: inset(50%); }
.answer-choice:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.choice-letter { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: var(--radius-pill); color: var(--ink); background: var(--paper); font-weight: 600; font-size: var(--t-small); }
.choice-content { font-weight: 400; overflow-wrap: anywhere; }
.choice-content > :first-child { margin-top: 0; }
.choice-content > :last-child { margin-bottom: 0; }
.answer-choice[data-touch-pressed=true] { background: var(--surface-quiet); }
.answer-choice:has(input:checked) { border-color: var(--selected); box-shadow: inset 0 0 0 1px var(--selected); background: var(--paper); }
.answer-choice:has(input:checked) .choice-letter { background: var(--selected); border-color: var(--selected); color: var(--paper); }
.answer-choice.crossed .choice-letter, .answer-choice.crossed .choice-content { opacity: .5; text-decoration: line-through; }
.answer-choice.is-correct { border-color: var(--success); background: var(--success-soft); }
.answer-choice.is-correct .choice-letter { background: var(--success); border-color: var(--success); color: var(--white); }
.answer-choice.is-wrong { border-color: var(--danger); background: var(--danger-soft); }
.answer-choice.is-wrong .choice-letter { background: var(--danger); border-color: var(--danger); color: var(--white); }
.answer-choice.locked, .answer-choice:disabled, .stage.read-only .answer-choice { cursor: default; }
.answer-choice.is-disabled { opacity: .55; cursor: not-allowed; }
.choice-cross { min-width: 44px; min-height: 44px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper); color: var(--muted); font-size: var(--t-body); cursor: pointer; }
.stage:not(.eliminating) .choice-cross { display: none; }
.stage.eliminating .answer-choice { grid-template-columns: 32px minmax(0, 1fr) 44px; gap: var(--space-inline); }
.choice-cross[aria-pressed=true] { border-color: var(--danger); color: var(--danger); }
.stage.read-only .choice-cross { cursor: default; }
.feedback-badge { grid-column: 2; justify-self: start; font-size: var(--t-small); font-weight: 600; color: var(--ink); }
.feedback-badge.badge-wrong { color: var(--danger); }
.stage-input { margin-top: var(--space-card); }
.feedback, .stage-feedback-body { margin: var(--space-card) 0; padding: var(--space-card); border-radius: var(--radius-md); font-size: var(--t-small); line-height: 1.6; color: var(--ink); }
.feedback.correct { background: var(--success-soft); border-left: 3px solid var(--success); }
.feedback.incorrect { background: var(--danger-soft); border-left: 3px solid var(--danger); }
.feedback-title { display: flex; align-items: center; gap: var(--space-inline); margin: 0 0 4px; font-weight: 600; }
.feedback.correct .feedback-title { color: var(--success); }
.feedback.incorrect .feedback-title { color: var(--danger); }
.feedback-actions { display: flex; flex-wrap: wrap; gap: var(--space-inline); margin-top: 12px; }
.stage-feedback { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-inline); margin: 0; padding: 4px 0; min-width: 0; color: var(--ink); }
.stage-feedback.correct strong::before { content: '\2713 '; color: var(--success); }
.stage-feedback.incorrect strong::before { content: '\2717 '; color: var(--danger); }
.stage-feedback-body { margin: var(--space-card) 0; background: transparent; padding: 0; line-height: 1.7; }
/* Runner actions — 72px bar, Back secondary + Next primary fill */
.runner-actions {
  display: flex; align-items: center; gap: var(--space-inline);
  min-height: 72px; margin-top: var(--space-section); padding: 12px 0;
}
.runner-actions:not(.stage-actions) .button.secondary { flex: 0 0 auto; min-width: 96px; }
.runner-actions .button.primary { flex: 1 1 auto; }
.stage-actions {
  position: sticky; bottom: env(safe-area-inset-bottom); z-index: 12;
  display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: center; gap: var(--space-inline);
  min-height: 72px; margin: 0; padding: 12px max(12px, env(safe-area-inset-left)) calc(12px + env(safe-area-inset-bottom));
  background: var(--paper); border-top: 1px solid var(--line);
}
.stage-actions:has(.study-help) { grid-template-columns: 44px 44px minmax(0, 1fr); }
.stage-actions .button { min-width: 0; min-height: 48px; padding: 10px; font-size: var(--t-button); border-radius: var(--radius-md); white-space: normal; }
.stage-actions .primary { font-weight: 700; }
.stage-actions .study-help { display: inline-flex; font-size: var(--t-caption); }
.stage-actions .stage-feedback { grid-column: 1 / -1; min-width: 0; }
.stage-actions .confirmed { background: var(--primary-soft); color: var(--ink); opacity: 1; }
.stage-actions #drill-answer-retry:not([hidden]) { grid-column: 1 / -1; }
.stage.has-check .stage-actions { grid-template-columns: 44px minmax(0, 1fr) minmax(88px, .75fr); }
.flag-control { display: flex; align-items: center; gap: var(--space-inline); }
.flag-control input { width: 20px; min-height: 20px; }
.runner-toolbar { position: sticky; top: calc(var(--header-h) + 12px); z-index: 15; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px; margin: -10px 0 var(--space-inline); padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper); box-shadow: var(--elev-1); }
.runner-toolbar .button { padding: 8px 10px; font-size: var(--t-small); }
.runner-toolbar .eyebrow { font-size: .6rem; }
.runner-toolbar strong { font-size: var(--t-small); }
.runner-toolbar > div:first-child { min-width: 0; overflow: hidden; }
#runner-timer, #adaptive-timer { min-width: 54px; font-size: var(--t-body); font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; }
#runner-timer.urgent, #adaptive-timer.urgent { color: var(--danger); }
.question-map { display: grid; gap: 7px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper); }
.question-map button { min-width: 0; aspect-ratio: 1; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); background: var(--surface-quiet); cursor: pointer; }
.question-map button.answered { border-color: var(--primary); background: var(--primary-soft); }
.question-map button.flagged { box-shadow: inset 0 -4px var(--gold-light); }
.question-map button.current { outline: 2px solid var(--selected); }
.runner-offline-state { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -6px 0 14px; font-size: var(--t-small); color: var(--muted); }
.runner-offline-state[data-state=ready] { color: var(--success); }
.runner-offline-state[data-state=failed] { color: var(--danger); }
.runner-lock-actions { margin: -8px 0 var(--space-card); }
#pwa-test-runner.read-only .answer-choice { cursor: default; opacity: .85; }
#runner-question-number:focus { outline: 2px solid var(--selected); outline-offset: 4px; border-radius: 6px; }
#runner-tab-dialog .runner-actions { margin-top: 18px; justify-content: flex-start; flex-wrap: wrap; }
#runner-reconcile { display: grid; gap: 10px; margin-bottom: var(--space-card); }
#runner-reconcile .button { justify-self: start; }
.review-card .stage-main { border-left: 5px solid var(--line); }
.review-card.correct .stage-main, .review-card.correct { border-left-color: var(--success); }
.review-card.incorrect .stage-main, .review-card.incorrect { border-left-color: var(--danger); }
.result-hero { margin-bottom: var(--space-section); }
.score-ring { display: grid; place-items: center; width: 132px; height: 132px; flex: 0 0 132px; border: 10px solid var(--primary); border-radius: var(--radius-pill); font-size: var(--t-metric); font-weight: 700; background: rgba(255, 255, 255, .08); }
.solution-grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: var(--space-card); }
.solution-grid > div, .explanation { padding: 15px; border-radius: var(--radius-md); background: var(--surface-quiet); }
.explanation { margin-top: 14px; }

/* ── 21. STUDY SHELL (runner full-screen) ────────────────────────────────── */
body.study-screen { background: var(--paper); display: flex; flex-direction: column; height: var(--visual-height, 100dvh); min-height: 0; overflow: hidden; }
.study-screen .status-banner { flex-shrink: 0; }
.study-screen .app-header, .study-screen .side-nav, .study-screen .bottom-nav { display: none; }
.study-screen .app-shell { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; margin: 0; padding: 0; max-width: none; }
/* Runner dock and actions occupy flex flow; reserve no second copy in main padding. */
.study-screen .app-main { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; padding: 0; max-width: none; width: 100%; }
.study-screen #pwa-test-runner, .study-screen #pwa-drill-runner, .study-screen #pwa-adaptive-runner { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; padding-top: env(safe-area-inset-top); }
.study-screen .runner-toolbar { position: static; top: auto; display: flex; align-items: center; gap: var(--space-inline); flex-shrink: 0; padding: 8px 12px; margin: 0; border: 0; border-radius: 0; box-shadow: none; background: var(--paper); }
.study-screen .runner-toolbar .button { flex: 0 0 44px; width: 44px; min-width: 44px; min-height: 44px; padding: 0; font-size: var(--t-h3); border-radius: var(--radius-md); }
.study-screen .runner-toolbar .study-tool-trigger { width: auto; flex: 0 0 auto; min-width: 48px; padding: 0 10px; font-size: var(--t-small); font-weight: 600; }
.study-progress { flex: 1 1 0; min-width: 0; min-height: 44px; position: relative; padding: 0 14px 0 0; border: 0; background: none; color: var(--ink); text-align: left; cursor: pointer; }
.study-progress .eyebrow { display: block; font-size: .65rem; color: var(--muted); margin: 0 0 2px; }
.study-progress strong { display: block; font-size: var(--t-small); }
.study-progress > span:last-child { position: absolute; top: 10px; right: 0; }
.study-screen .runner-toolbar time { flex: 0 0 auto; font-size: var(--t-small); font-variant-numeric: tabular-nums; color: var(--muted); }
.study-screen #runner-timer, .study-screen #drill-timer, .study-screen #adaptive-timer { font-size: var(--t-caption); }
.study-progress-track { height: 4px; background: var(--surface-quiet); flex-shrink: 0; }
.study-progress-track span { display: block; height: 100%; width: 100%; transform: scaleX(0); transform-origin: left; background: var(--cta); }
.study-screen #runner-content, .study-screen #drill-content, .study-screen #adaptive-content { flex: 1 1 0; min-height: 0; }
.study-screen .stage { height: 100%; display: flex; flex-direction: column; min-height: 0; }
.study-screen .stage-tabs { flex-shrink: 0; padding: 4px 12px 8px; }
.study-screen .stage-panes { flex: 1 1 0; min-height: 0; height: auto; }
.study-screen .stage-main { padding: var(--space-card); }
.study-screen .stage-actions { flex-shrink: 0; position: static; padding: 10px 12px max(10px, env(safe-area-inset-bottom)); }
.study-screen .runner-mode-lock { margin: 8px 12px; font-size: var(--t-caption); padding: 8px; }
.study-screen .runner-offline-state, .study-screen #runner-status, .study-screen #drill-message, .study-screen #adaptive-status { margin: 8px 12px; }
.study-status-slot { flex-shrink: 0; min-height: 24px; padding: 0 12px; }
.study-screen .study-status-slot > :is(#runner-status, #drill-message, #adaptive-status):not(.error) { margin: 0; padding: 2px 0; min-height: 24px; border: 0; border-radius: 0; background: none; color: var(--muted); font-size: var(--t-caption); line-height: 20px; }
.study-screen .study-status-slot > .error { margin: 8px 0; }
.study-screen .runner-offline-state[data-state=ready] { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.study-status-slot .button { margin: 4px 0 8px; min-height: 44px; }
.study-screen .stage { min-height: 0; }
.study-screen :is(#pwa-test-runner, #pwa-drill-runner) .study-dock { position: sticky; bottom: 0; z-index: 12; flex: 0 0 auto; min-width: 0; border-top: 1px solid var(--line); background: var(--paper); box-shadow: 0 -4px 12px color-mix(in srgb, var(--ink) 4%, transparent); padding-bottom: env(safe-area-inset-bottom); }
.study-dock .study-tools-bar { display: flex; align-items: center; min-width: 0; padding: 0 8px; gap: var(--space-inline); }
.study-dock .study-tools-rail { flex: 1 1 0; min-width: 0; max-width: 100%; border-top: 0; padding: 4px 0; gap: var(--space-inline); scroll-padding-inline: 4px; }
.study-dock .study-tool { flex: 0 0 auto; min-width: 64px; min-height: 48px; padding: 4px 6px; gap: 4px; }
.study-dock .study-tool :is(svg, .tta-icon) { width: 20px; height: 20px; min-width: 20px; max-width: 20px; max-height: 20px; }
.study-dock .study-help { font-size: var(--t-caption); border-radius: var(--radius-md); border: 1px solid var(--line); background: var(--paper); }
.study-screen .study-dock .stage-actions { position: static; border-top: 1px solid var(--line); padding-top: 8px; padding-bottom: 10px; }
.study-sheet { position: fixed; inset: auto 0 0; width: 100%; max-width: 100%; max-height: min(90dvh, var(--visual-height, 90dvh)); margin: 0; padding: var(--space-card) var(--space-card) calc(var(--space-card) + env(safe-area-inset-bottom)); border: 1px solid var(--line); border-radius: var(--radius-xl) var(--radius-xl) 0 0; color: var(--ink); background: var(--paper); overflow-y: auto; }
.study-sheet::backdrop { background: color-mix(in srgb, var(--navy-deep) 55%, transparent); }
.study-sheet-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-card); padding-bottom: var(--space-card); border-bottom: 1px solid var(--line); }
.study-sheet-header h2 { margin: 0; font-size: var(--t-h2); }
.study-sheet-header .eyebrow { margin: 0 0 4px; }
.study-sheet-header .button { min-height: 44px; }
.study-sheet .question-map { display: grid; grid-template-columns: repeat(auto-fit, minmax(44px, 1fr)); gap: var(--space-inline); max-width: 356px; margin: var(--space-card) 0; }
.study-sheet .question-map button { min-height: 44px; padding: 8px; border-radius: var(--radius-md); }
.study-sheet .question-map button.current { outline: 2px solid var(--selected); outline-offset: 1px; }
.study-tool-section { margin-top: var(--space-section); }
.study-tool-section h3 { margin: 0 0 12px; font-size: var(--t-body); }
.study-tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-inline); }
.study-tool-grid .button, .study-tool-grid .flag-control { min-height: 48px; min-width: 0; padding: 12px 8px; border-radius: var(--radius-md); font-size: var(--t-small); text-align: center; overflow-wrap: anywhere; }
.study-tool-grid .flag-control { display: flex; align-items: center; justify-content: center; gap: var(--space-inline); border: 1px solid var(--line); }
.study-tool-grid .flag-control input { width: 20px; min-height: 20px; accent-color: var(--selected); }
.study-setting { display: flex; align-items: center; justify-content: space-between; gap: var(--space-card); min-height: 48px; margin-top: var(--space-inline); }
.study-setting select { width: auto; min-height: 44px; }
.study-setting input { min-width: 44px; min-height: 44px; accent-color: var(--selected); }
.study-sheet textarea { width: 100%; resize: vertical; font-size: 16px; }
.study-sheet .muted { font-size: var(--t-small); line-height: 1.6; }
mark.study-highlight { background: var(--gold-light); color: var(--navy); border-radius: 3px; }
.study-pen-sheet { display: none; }
.study-pen-sheet[open] { display: flex; flex-direction: column; height: 90dvh; }
.study-pen-sheet [data-study-pen-host] { flex: 1; min-height: 0; }
.study-pen-sheet iframe { width: 100%; height: 100%; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper); }

/* ── 22. LEARNING TOOLS, LESSONS, MR. O SHEET ────────────────────────────── */
.tool-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: 0; background: var(--paper); z-index: 1; }
.learning-tool-dialog { max-width: 900px; padding: var(--space-card); border: 1px solid var(--line); border-radius: var(--radius-xl); color: var(--ink); background: var(--paper); overflow: auto; }
.learning-image-scroll { overflow: auto; max-height: 60dvh; }
.enlarged-learning-image { display: block; width: 100%; height: auto; }
.pwa-calculator { height: 65vh; height: 65dvh; min-height: 250px; width: 100%; }
.sheet-dialog { border-radius: var(--radius-xl); }
.katex-display { max-width: 100%; overflow-x: auto; overflow-y: hidden; padding: 6px 0; }
.question-content .katex, .passage .katex { font-size: 1.1em; }
mjx-container[display=true] { max-width: 100%; overflow-x: auto; overflow-y: hidden; }
img[data-pwa-enlarge] { cursor: zoom-in; }
.lesson-block { scroll-margin-top: 100px; line-height: 1.8; }
.lesson-block summary { min-height: 44px; padding: 10px 0; cursor: pointer; font-weight: 600; }
.lesson-video { width: 100%; aspect-ratio: 16/9; border: 0; }
.lesson-check { display: grid; gap: 10px; margin-bottom: var(--space-card); }
.lesson-check [aria-pressed="true"] { outline: 2px solid var(--cta); }
.lesson-card { padding: 14px 0; border-top: 1px solid var(--line); }
.lesson-card summary { min-height: 44px; font-weight: 700; cursor: pointer; }
.video-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--radius-md); background: var(--black); }
.video-frame iframe { width: 100%; height: 100%; border: 0; }
.mro-intro { margin: 0 0 10px; color: var(--muted); font-size: var(--t-small); }
.mro-context { margin: 0 0 12px; padding: 10px 12px; }
.mro-context-title { margin: 0 0 4px; font-size: var(--t-caption); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.mro-context-summary { margin: 0; font-size: var(--t-small); overflow-wrap: anywhere; }
.mro-history { display: grid; gap: 10px; max-height: 46vh; overflow-y: auto; }
.mro-turn { padding: 12px; }
.mro-status, .mro-quota { margin: 10px 0 0; font-size: var(--t-small); color: var(--muted); min-height: 1.2em; }
.mro-form { display: grid; gap: var(--space-inline); margin-top: 12px; }
.mro-form label { font-size: var(--t-small); font-weight: 600; }
.mro-form textarea { width: 100%; min-height: 88px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-md); font: inherit; color: var(--ink); background: var(--paper); }
.mro-form .button, #mro-check { min-height: 48px; width: 100%; }
.ai-insight .button { min-height: 48px; }
#pwa-install-help { padding: var(--space-section); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper); color: var(--ink); }
#pwa-install-help li { margin: 0 0 var(--space-card); line-height: 1.6; }

/* ── 23. CLASSROOMS, TUTOR, PARENT, CENTER ───────────────────────────────── */
.classroom-post { border-top: 1px solid var(--line); margin-top: var(--space-card); padding-top: var(--space-card); }
.student-response { white-space: pre-wrap; overflow-wrap: anywhere; }
.roster-actions, .invoice-actions { flex-wrap: wrap; justify-content: flex-start; margin-top: 12px; }
.roster-actions form, .invoice-actions form { display: inline; }
.inline-form { display: flex; gap: var(--space-inline); align-items: center; flex-wrap: wrap; }
.inline-form select { width: auto; min-width: 140px; }
.inline-form .wide { grid-column: auto; }
.tutor-quick-links { margin-bottom: var(--space-inline); }
.tutor-quick-links strong { display: block; margin-bottom: 4px; }
.child-card .child-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 12px 0; }
.child-card .stat-card { padding: 12px; }
.child-card .stat-card strong { font-size: var(--t-h1); }
.report-actions { margin-bottom: 6px; }
.report-actions #report-range label { display: flex; flex-direction: column; gap: 4px; }
.report-summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.focus-row { align-items: center; }
.focus-row .meter { flex: 1; min-width: 80px; max-width: 160px; margin: 0; }
.member-settings { margin: 8px 0 4px; }
.member-settings input[type=number] { width: 120px; }
.activity-row small[data-local-time] { white-space: nowrap; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.settings-grid .panel:last-child { grid-column: auto; }
[id^="class-"] { scroll-margin-top: 90px; }

/* ── 24. PROGRESS CHARTS ─────────────────────────────────────────────────── */
.progress-charts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin: var(--space-section) 0; }
.progress-chart { min-width: 0; margin: 0; padding: 18px; box-shadow: none; }
.progress-chart figcaption { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: var(--space-card); }
.progress-chart .eyebrow { margin: 0 0 4px; color: var(--muted); }
.progress-chart h3 { margin: 0; font-size: var(--t-h3); line-height: 1.4; }
.progress-chart figcaption > strong { font-size: var(--t-metric); line-height: 1.2; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.progress-chart figcaption small { display: block; font-size: var(--t-caption); font-weight: 500; color: var(--muted); }
.activity-bars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--space-inline); }
.activity-day { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: var(--space-inline); font-size: var(--t-caption); color: var(--muted); }
.activity-count { font-weight: 700; color: var(--ink); }
.activity-bar-track { width: min(100%, 32px); height: 108px; display: flex; align-items: flex-end; background: var(--surface-quiet); border-radius: 7px; overflow: hidden; }
.activity-bar-track > span { display: block; width: 100%; background: var(--primary); border-radius: 7px; }
.accuracy-chart { display: block; width: 100%; height: auto; max-width: 100%; overflow: visible; }
.chart-gridline { stroke: var(--line); stroke-width: 1; }
.chart-trend { fill: none; stroke: var(--primary); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart-dot { fill: var(--primary); stroke: var(--paper); stroke-width: 2; }
.chart-score { font: 600 12px system-ui; fill: var(--ink); }
.chart-date { font: 11px system-ui; fill: var(--muted); }
.chart-caption { font-size: var(--t-small); color: var(--muted); line-height: 1.5; margin: 14px 0 0; }
.chart-caption small { display: block; font-size: var(--t-caption); }
.chart-data summary { min-height: 44px; padding: 10px 0; cursor: pointer; font-size: var(--t-small); font-weight: 600; color: var(--ink); touch-action: manipulation; }
.chart-data summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.chart-data ol { list-style: none; padding: 0; margin: 0; }
.chart-data li { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); font-size: var(--t-small); }
.chart-data li a { min-height: 44px; min-width: 0; display: block; padding: 10px 0; overflow-wrap: anywhere; }
.chart-data li small { display: block; color: var(--muted); }

/* ── 25. ICONS & OVERFLOW SAFETY ─────────────────────────────────────────── */
.tta-icon { display: inline-block; width: 24px; height: 24px; max-width: 24px; max-height: 24px; flex-shrink: 0; vertical-align: middle; }
.prose, .question-content, .passage, .panel { overflow-wrap: anywhere; min-width: 0; }
.prose table, .question-content table, .passage table { display: block; max-width: 100%; overflow-x: auto; }

/* ── 26. BREAKPOINT: 600 (large phone / small tablet) ────────────────────── */
@media (min-width: 600px) {
  :root { --gutter: 20px; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; }
  .student-home .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .two-column, .two-up { grid-template-columns: 1fr 1fr; }
  .report-summary { grid-template-columns: repeat(5, 1fr); }
  .child-card .child-stats { grid-template-columns: repeat(2, 1fr); }
  .progress-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-card); }
  .progress-chart { padding: var(--space-card); }
  .topic-group { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .compact-list { columns: 2; padding-left: 20px; }
  .page-heading { flex-direction: row; align-items: center; }
  .solution-grid { grid-template-columns: 1fr 1fr; }
  .test-card-link { padding: var(--space-card); }
  .hero { flex-direction: row; justify-content: space-between; align-items: center; }
  .hero .button { width: auto; }
  .filter-search-go { display: inline-flex; }
  .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-grid .panel:last-child { grid-column: 1 / -1; }
  .search input { min-width: min(320px, 45vw); }
}

/* ── 27. BREAKPOINT: 840 (tablet / desktop shell) ────────────────────────── */
@media (min-width: 840px) {
  :root { --gutter: 24px; }
  .app-header { min-height: calc(68px + env(safe-area-inset-top)); }
  .brand { font-size: var(--t-body); }
  .brand-mark { width: 38px; height: 38px; border-radius: 12px; }
  .app-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); }
  .side-nav { display: flex; flex-direction: column; position: sticky; top: 68px; height: calc(100vh - 68px); padding: var(--space-section) var(--space-card); border-right: 1px solid var(--line); }
  .side-nav-links { flex: 1 1 auto; overflow-y: auto; }
  .side-nav a, .side-nav button {
    display: flex; align-items: center; gap: 12px; width: 100%; margin: 2px 0; min-height: 48px;
    padding: 10px 14px; border: 0; border-radius: var(--radius-md); background: transparent;
    text-align: left; text-decoration: none; color: var(--muted); font: inherit; font-size: var(--t-small); cursor: pointer;
  }
  .side-nav a.active, .side-nav a:hover, .side-nav button:hover { color: var(--primary); background: var(--primary-soft); font-weight: 600; }
  .side-nav :is(a, button)[data-touch-pressed=true] { background: var(--surface-quiet); }
  .side-nav form { margin-top: var(--space-card); border-top: 1px solid var(--line); padding-top: 10px; flex: 0 0 auto; }
  .bottom-nav, .app-dock { display: none; }
  body:not(.study-screen) .app-main, body[data-dock]:not(.study-screen) .app-main { padding: var(--space-section) clamp(24px, 4vw, 52px) 64px; }
  .toast, body:not([data-dock]) .toast { bottom: calc(24px + env(safe-area-inset-bottom)); }
  /* Sheets become centered dialogs */
  dialog.sheet { position: fixed; inset: 0; margin: auto; width: 100%; max-width: 480px; max-height: min(80vh, calc(var(--visual-height, 100dvh) - 48px)); border-radius: var(--radius-lg); box-shadow: var(--elev-2); padding-bottom: 0; }
  .sheet-handle { display: none; }
  .study-sheet { inset: 50% auto auto 50%; transform: translate(-50%, -50%); width: min(680px, 85vw); max-width: 85vw; border-radius: var(--radius-xl); }
  /* Runner: two-pane split, no tabs */
  .stage-tabs { display: none; }
  .stage-track { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.2fr); width: 100%; gap: 0; transform: none !important; opacity: 1 !important; }
  .stage.no-passage .stage-track { grid-template-columns: minmax(0, 1fr); }
  .stage-passage { border-right: 1px solid var(--line); padding: var(--space-section) 32px; }
  .stage-main.panel, .study-screen .stage-main { padding: var(--space-section) 32px; }
  .stage.no-passage .stage-main { max-width: 820px; width: 100%; margin: 0 auto; }
  .stage-actions { padding-right: 32px; padding-left: 32px; grid-template-columns: 44px minmax(160px, 320px); justify-content: end; }
  .stage-actions:has(.study-help) { grid-template-columns: 44px 44px minmax(160px, 320px); }
  .stage.has-check .stage-actions { grid-template-columns: 44px minmax(160px, 280px) minmax(100px, 160px); }
  .stage-feedback { min-width: 280px; }
  .study-screen .runner-toolbar { padding: 8px 32px; }
  .study-tools-rail { justify-content: safe center; padding: 4px var(--space-card); }
  .card-grid, .quick-grid, .student-home .quick-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .student-home .hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 260px); align-items: center; }
  .student-home .hero .button { align-self: end; }
  .browse-shortcuts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .test-card { padding: 0; }
}

/* ── 28. BREAKPOINT: 1280 (wide desktop) ─────────────────────────────────── */
@media (min-width: 1280px) {
  body:not(.study-screen) .app-main, body[data-dock]:not(.study-screen) .app-main { padding: 40px clamp(32px, 3vw, 56px) 72px; }
  .card-grid, .quick-grid { gap: var(--space-card); }
  .stage-track { grid-template-columns: minmax(360px, 1fr) minmax(420px, 1.1fr); }
  .study-route-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ── 29. LANDSCAPE PHONE (short viewport) ────────────────────────────────── */
@media (orientation: landscape) and (max-height: 500px) {
  .study-screen .stage-tabs { padding: 4px 12px; }
  .study-screen .study-tools-rail { padding: 2px 8px; }
  .study-screen .study-tool { min-height: 44px; padding: 4px 8px; gap: 2px; }
  .study-screen .study-status-slot { display: none; }
}

/* ── 30. REDUCED MOTION ──────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
  .chip, .test-card { transition: none; }
  .skeleton::after, .route-status::before, .pwa-route-status::before, .button.is-loading::after { animation: none; }
  .skeleton::after { display: none; }
}

/* ── 31. DARK-MODE COMPONENT PARITY ──────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  /* Navy focus rings vanish on a navy canvas — gold is the dark-mode ring. */
  :focus-visible, :is(a, button, input, select, textarea, label, summary, [tabindex]):focus-visible { outline-color: var(--gold); }
  .button.secondary, .icon-button { color: var(--ink); background: var(--paper); }
  input, select, textarea { border-color: var(--line); background: var(--paper); color: var(--ink); }
  .card, .panel, .content-card, .action-card, .stat-card, .test-card, .progress-chart, .empty-state { box-shadow: none; }
  .hero { background: var(--navy-deep); }
  .hero .button.primary { background: var(--gold); color: var(--navy-deep); }
  .chip.is-on { background: var(--gold); border-color: var(--gold); color: var(--navy-deep); }
  .chip.is-on .chip-count { background: color-mix(in srgb, var(--navy-deep) 25%, transparent); color: var(--navy-deep); }
  .bottom-nav a.active, .bottom-nav button.active { color: var(--ink); }
  .answer-choice:has(input:checked) .choice-letter { color: var(--navy-deep); }
  .test-card-icon, .browse-emblem, .study-route-card .route-icon, .list-row .lead { color: var(--ink); }
  .study-route-card small, .stat-card span, .mode-options small { color: var(--muted); }
  .toast { background: var(--navy-deep); border: 1px solid var(--line); }
  .badge.warning, .tag.status-pending, .status-pill.status-in_progress { color: var(--warning); }
  .notice.success { color: var(--success); }
  .notice.info { color: var(--info); }
}

/* == M6 == */
/* Home hero resume badge (gold pill on the navy hero card). */
.hero .badge { background: var(--gold); color: var(--navy-deep); margin-bottom: 6px; }
/* Home quick-action chip row + icon-bearing chips generally (filter chips carry no icon today). */
.home-quick-actions { margin: var(--space-card) 0; }
.chip .tta-icon { width: 18px; height: 18px; flex-shrink: 0; }
/* Test/drill card facts row: icon + label pairs (duration). */
.test-card-facts span { display: inline-flex; align-items: center; gap: 4px; }
.test-card-facts .tta-icon { width: 16px; height: 16px; }
/* Test detail overview badge (Free/Locked/In progress/Completed). */
.test-overview > .badge { margin-bottom: 8px; }
.badge .tta-icon { width: 14px; height: 14px; }
/* Timed/Untimed chooser (timing-choice partial) — segmented-pill look, no CSS existed before. */
.timing-heading { margin: 0 0 8px; font-size: var(--t-small); font-weight: 600; color: var(--muted); }
.timing-options { display: flex; gap: 4px; min-height: 64px; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-quiet); }
.timing-option { flex: 1 1 0; min-width: 0; cursor: pointer; }
.timing-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 100%; min-height: 56px; padding: 8px; border-radius: var(--radius-sm); text-align: center; color: var(--muted); }
.timing-card small { font-size: var(--t-caption); font-weight: 500; color: inherit; opacity: .85; }
.timing-option:has(input:checked) .timing-card { background: var(--paper); color: var(--ink); box-shadow: var(--elev-press); }
.timing-locked-value { margin: 0; }
/* Results / review: `.choice-mark` had no grid column of its own, so it fell into the
   56px letter column and wrapped one word per line ("Your"/"answer"). Give it the
   full row plus a real correct/incorrect colour (the markup only ever added
   `.is-selected` + `.is-correct`, never `.is-wrong`, so a wrong pick rendered neutral). */
.review-choices .choice-mark { grid-column: 1 / -1; margin-top: 2px; font-size: var(--t-caption); font-weight: 600; color: var(--muted); }
.review-choices .choice-mark.correct { color: var(--success); }
.answer-choice.is-wrong .choice-mark { color: var(--danger); }
/* Result hero: real proportional ring (was a static fully-coloured circle border that
   never reflected the score) + qualitative band line under it. */
.result-hero .progress-ring { margin: var(--space-card) auto; }
.result-band { margin: 4px 0 0; font-size: var(--t-h3); font-weight: 700; text-align: center; }
.result-hero .fine-print { text-align: center; }
.result-actions { display: grid; gap: 10px; margin: var(--space-card) 0; }

/* == M7 == */
/* Flashcards: due-count row + segment dots (reuses .progress-segments from M3), and a
   real 4-up 48px rating row (spec: Again/Hard/Good/Easy) instead of the old
   .focus-controls flex-wrap, which let buttons shrink below the 48px touch target on
   narrow screens. Soft semantic colours reuse the existing badge palette so no new
   tokens are needed and the one gold CTA (.button.primary "Reveal answer") stays the
   only Von Restorff primary on this screen. */
.rating-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rating-row .button { min-height: 48px; padding: 8px 4px; font-size: var(--t-small); }
.button.warning { background: var(--warning-soft); color: color-mix(in srgb, var(--warning) 70%, var(--ink)); border-color: transparent; }
.button.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.button.success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.button.warning[data-touch-pressed=true], .button.warning:active,
.button.info[data-touch-pressed=true], .button.info:active,
.button.success[data-touch-pressed=true], .button.success:active { filter: brightness(0.96); }
#flashcard-due-row { padding: 0 0 8px; }
#flashcard-dots { margin-bottom: var(--space-card); }
.notice.error { background: var(--danger-soft); color: var(--danger); border-radius: var(--radius-md); align-items: center; }
.notice.error .toast-action { color: var(--danger); font-weight: 700; }

/* Notebook: cards were flex-only .review-list/.panel with a plain <span class="tag">;
   promoted to the shared .card + .badge components (M5) so status colour (success/
   danger/neutral) matches every other result/review screen. */
.review-card .list-row:first-child { color: var(--muted); font-size: var(--t-caption); }
.review-card .list-row:last-child { margin-top: 10px; align-items: center; }
.review-card .tta-icon { width: 20px; height: 20px; color: var(--muted); }

/* Reports, courses, lessons, Mr. O sheet, onboarding sheet: already emit .panel/.card,
   .stack, .content-card, .lesson-card, .sheet from M5 — verified against
   Reports-mobile-index.png / Reports-mobile-detail.png with no structural gaps, so no
   page-specific overrides were needed beyond the flashcards/notebook fixes above. */

/* games */
.student-games .browse-emblem{color:#FFD700;}
.student-games .link-row-lead{color:#FFD700;}

/* study pages */
.chart-wrap { position: relative; width: 100%; }
.chart-wrap canvas { max-width: 100%; }
.brain-map-scroll { -webkit-overflow-scrolling: touch; }

/* ── 32. DASHBOARD V3 (W2, 2026-09-19) ───────────────────────────────────── */
/* New classes only. Everything reusable (.card, .panel, .chip, .badge, .stat,
   .meter, .progress-bar, .progress-ring, .skeleton, .section-heading,
   .list-row, .day-picker, .sheet) comes from the sections above — nothing is
   re-declared here. Press feedback stays with interaction.js
   ([data-touch-pressed]) and TTA_MOTION; no :active rules are added. */

/* Entrance: opt-in, applied by dashboard.js only when motion is allowed.
   §30 already neutralises animations under prefers-reduced-motion; the class is
   additionally never added in that case, so there is no flash either way. */
.dash-enter { opacity: 0; transform: translate3d(0, 8px, 0); }
.dash-enter-in { opacity: 1; transform: none; transition: opacity .22s ease-out, transform .22s ease-out; }
@media (prefers-reduced-motion: reduce) { .dash-enter, .dash-enter-in { opacity: 1; transform: none; transition: none; } }

.dash-hero .dash-hero-body { width: 100%; }
.dash-hero .dash-hero-meta { margin-bottom: 0; color: color-mix(in srgb, var(--white) 82%, transparent); font-size: var(--t-small); }

/* Streak — forgiving by construction: no flame, no red, no "lost" state. */
.dash-streak { margin: var(--space-card) 0; }
.dash-streak .dash-streak-head { margin: 0 0 var(--space-inline); }
.dash-streak-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-inline) 12px; }
.dash-streak-count { display: flex; align-items: baseline; gap: 8px; margin: 0; }
.dash-streak-count strong { font-size: var(--t-metric); font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.dash-streak-count strong .skeleton { display: inline-block; width: 42px; height: 22px; }
.dash-streak-row .fine-print { margin: 0; }
.dash-week-dots { display: flex; gap: 6px; list-style: none; margin: var(--space-card) 0 var(--space-inline); padding: 0; }
.dash-dot { flex: 1 1 0; min-width: 0; display: grid; place-items: center; height: 34px; border-radius: var(--radius-sm); background: var(--surface-quiet); color: var(--muted); font-size: var(--t-caption); font-weight: 700; }
.dash-dot.is-done { background: var(--primary-soft); color: var(--primary); }
.dash-dot.is-scheduled { box-shadow: inset 0 0 0 1px var(--line); }
.dash-dot.is-today { box-shadow: inset 0 0 0 2px var(--cta); }
.dash-dot-label { pointer-events: none; }
.dash-unavailable { color: var(--muted); }
.dash-stale { margin: var(--space-inline) 0 0; color: var(--muted); }

/* Goal meter */
.dash-goal { margin: var(--space-card) 0; }
.dash-goal .section-heading { margin: 0 0 var(--space-inline); }
.dash-goal-numbers { display: flex; align-items: baseline; gap: 10px; margin: 0 0 4px; font-variant-numeric: tabular-nums; }
.dash-goal-numbers strong { font-size: var(--t-metric); font-weight: 700; letter-spacing: -.03em; }
.dash-goal-numbers [data-goal-arrow] { color: var(--muted); }
.dash-goal .progress-bar { height: 10px; margin: 12px 0 8px; }
.dash-goal .progress-bar > span { background: var(--cta); }
.day-picker { display: flex; flex-wrap: wrap; gap: 8px; margin: var(--space-inline) 0 var(--space-card); }
.day-picker label { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--paper); font-size: var(--t-small); }
.day-picker label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); font-weight: 700; }

/* Today's plan */
.dash-plan { margin: var(--space-card) 0; }
.dash-plan .section-heading { margin: 0 0 var(--space-inline); }
.dash-plan-list { list-style: none; margin: 0; padding: 0; }
.dash-plan-item { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-height: 64px; padding: 12px 0; border-top: 1px solid var(--line); }
.dash-plan-item:first-child { border-top: 0; }
.dash-plan-body { flex: 1 1 200px; min-width: 0; }
.dash-plan-body strong { display: block; overflow-wrap: anywhere; }
.dash-plan-body small { display: block; margin-top: 4px; color: var(--muted); font-size: var(--t-small); }
.dash-plan-item[data-status=completed] .dash-plan-body strong,
.dash-plan-item[data-status=skipped] .dash-plan-body strong { color: var(--muted); }
.dash-plan-item[data-status=completed] { background: color-mix(in srgb, var(--success) 6%, transparent); }

/* Progress card: readiness ring + <=5 metrics */
.dash-progress { margin: var(--space-card) 0; }
.dash-progress .section-heading { margin: 0 0 var(--space-card); }
.dash-progress-top { display: flex; align-items: center; gap: var(--space-card); }
.dash-progress-hero { min-width: 0; flex: 1 1 auto; }
.dash-progress-hero p { margin: 0 0 4px; }
.dash-progress .progress-ring .ring-value { stroke: var(--cta); }
.dash-progress .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.dash-levels { margin: var(--space-inline) 0 var(--space-card); }

/* Weekly recap + milestones */
.dash-recap { margin: var(--space-card) 0; }
.dash-recap .section-heading { margin: 0 0 var(--space-inline); }
.dash-recap .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: var(--space-card) 0; }
.dash-milestones h3 { margin: var(--space-card) 0 var(--space-inline); font-size: var(--t-h3); }
.dash-milestone-shelf { list-style: none; margin: 0; padding: 0; }
.dash-milestone-new { box-shadow: inset 0 0 0 2px var(--cta); }

/* AI insights */
.dash-insights { margin: var(--space-card) 0; }
.dash-insights .section-heading { margin: 0 0 var(--space-inline); }
.dash-insight-body { display: flex; align-items: flex-start; gap: 12px; }
.dash-insight-text { flex: 1 1 auto; min-width: 0; }
.dash-insight-text p { margin: 0 0 var(--space-inline); }
.dash-insight-actions { list-style: none; margin: var(--space-inline) 0 0; padding: 0; }

/* Quota meter (non-subscribers only) */
.dash-quota { margin: var(--space-card) 0; }
.dash-quota .section-heading { margin: 0 0 var(--space-inline); }
.dash-quota-meters { display: grid; grid-template-columns: 1fr; gap: var(--space-card); }
.dash-quota-meter .eyebrow { margin: 0; }
.dash-quota-meter .fine-print { margin: 0; }
.dash-quota .meter span { background: var(--cta); }

/* Idle nudge */
.dash-nudge { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-card); margin: 0 0 var(--space-card); border-left: 4px solid var(--cta); }
.dash-nudge-body { flex: 1 1 220px; min-width: 0; }
.dash-nudge-body h2 { font-size: var(--t-h3); margin: 0 0 4px; }
.dash-nudge-body p { margin: 0; color: var(--muted); font-size: var(--t-small); }

/* Game mode */
.dash-gamemode { margin: var(--space-card) 0; }
.dash-gamemode .section-heading { margin: 0 0 var(--space-inline); }
.dash-gamemode .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: var(--space-card) 0; }
.dash-gamemode-list { list-style: none; margin: 0; padding: 0; }

/* Mr. O card */
.dash-mro { margin: var(--space-card) 0; display: grid; gap: var(--space-card); }

@media (min-width: 600px) {
  .dash-quota-meters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-progress .stats-grid, .dash-recap .stats-grid, .dash-gamemode .stats-grid { gap: 12px; }
}
@media (min-width: 840px) {
  .dash-week-dots { gap: 8px; }
  .dash-dot { height: 40px; }
}
@media (prefers-color-scheme: dark) {
  .dash-plan-item[data-status=completed] { background: color-mix(in srgb, var(--success) 12%, transparent); }
  .dash-dot.is-done { background: var(--navy-ghost); color: var(--gold-light); }
}

/* build-a-test ------------------------------------------------------------
   W3 (2026-09-19). Appended block — nothing above is touched. Everything here
   reuses the existing tokens (--space-card, --radius-md, --muted, --t-small,
   --success/--warning/--danger soft pairs) and the existing components
   (.panel, .card, .chip 44px, .check, .button 48px, .answer-choices >= 56px,
   .study-sheet, .tools-dock). Only the pieces with no existing class are new. */

/* Builder: the four-up stats strip on /app/build. */
.build-stats .list-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; align-items: start; }
.build-stats .list-row div { display: flex; flex-direction: column; gap: 2px; }
.build-stats .list-row strong { font-size: var(--t-h3, 1.15rem); }
.build-stats .list-row small { color: var(--muted); font-size: var(--t-caption); }
.build-stats > .chip { margin-top: var(--space-card); }

/* Builder: the per-topic accuracy trend under step 2. Same chart primitives as
   partials/progress-charts (.chart-trend / .chart-caption), just a shorter box. */
.build-trend { margin: var(--space-card) 0 0; }
.build-trend figcaption { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.build-trend svg { width: 100%; height: auto; }

/* Builder: a domain chip hidden by the subject filter must not leave a gap. */
.build-domain[hidden] { display: none; }

/* Runner: prefix "build" does not get partials/study-tools-rail (that rail needs
   runner-tools.js and a real attempt id), so the page renders its own 56px dock
   row with the same .tools-dock component. */
.build-dock { margin-top: var(--space-card); }

/* Runner: Mr. O sheet transcript + composer. */
.build-ai-form { display: flex; gap: 8px; margin-top: var(--space-card); }
.build-ai-form input { flex: 1 1 auto; min-height: 48px; }
.build-ai-form .button { min-height: 48px; }
#build-ai-log { max-height: 46vh; overflow: auto; }
.build-ai-you { font-weight: 700; }
.build-ai-mro { padding: 8px 0; }

/* Result: the review list re-uses .answer-choices, but its rows are static
   (no radio), so they need the touch-target height back. */
.review-choices { list-style: none; margin: 0; padding: 0; }
.review-choices .answer-choice { min-height: 56px; display: flex; align-items: center; gap: 8px; padding: 10px 12px; }

/* Runner: the build timer joins the existing caption-sized timer rule. */
.study-screen #build-timer { font-size: var(--t-caption); }
/* Runner: the study-screen flex/message rules are written per runner id; the build
   runner joins them here instead of editing those shared selectors. */
.study-screen #build-content { flex: 1 1 0; min-height: 0; }
.study-screen #build-message { margin: 8px 12px; }
.study-screen .study-status-slot > #build-message:not(.error) { margin: 0; padding: 2px 0; min-height: 24px; border: 0; border-radius: 0; background: none; color: var(--muted); font-size: var(--t-caption); line-height: 20px; }
#build-question-number:focus { outline: 2px solid var(--selected); outline-offset: 4px; border-radius: 6px; }
.study-screen #pwa-build-runner { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; padding-top: env(safe-area-inset-top); }

/* Follow-up 1 (2026-09-19): "Resume" in Recent work wrapped to "Resum/e" at
   390px when a long title squeezed the row. Scoped to the home screen. */
.student-home .list-row .button { white-space: nowrap; }

/* penpot fix 2026-09-19 */
/* Catalog (Catalog-mobile / -desktop / -empty-filter): compact title, one card per
   row on phone, state tag beside the title, meta + facts rows, in-progress bar,
   state CTA; desktop adds a right "Continue" rail. */
.browse-heading.compact { margin-bottom: var(--space-card); }
.browse-heading.compact h1 { font-size: var(--t-h1); }
.catalog-count { margin: -4px 0 var(--space-card); color: var(--muted); }
.student-catalog .filter-bar { padding: 0; border: 0; background: transparent; border-radius: 0; }
.student-catalog .filter-bar .filter-search-go { display: none; }
.student-catalog .filter-bar .chip-row { flex-wrap: wrap; overflow: visible; padding: 0; }
.student-catalog .chip:not(.is-on) { color: var(--ink); }
.student-catalog .chip.is-on .chip-count { background: var(--cta); color: var(--navy-deep); }
.student-catalog .catalog-section .card-grid { grid-template-columns: minmax(0, 1fr); }
.test-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.test-card-head .test-card-title { flex: 1 1 auto; min-width: 0; }
.test-card-state { flex: 0 0 auto; white-space: nowrap; }
.test-card-state.state-progress { background: var(--info-soft); color: var(--primary); }
.test-card-state.state-free { background: var(--surface-quiet); color: var(--ink); }
.test-card-state.state-done { background: var(--success-soft); color: var(--success); }
.test-card-state.state-locked { background: var(--surface-quiet); color: var(--muted); }
.test-card-state .tta-icon { width: 14px; height: 14px; }
.test-card-meta { margin: 0; color: var(--muted); font-size: var(--t-small); }
.test-card-facts .tta-icon { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }
.test-card-facts > span { display: inline-flex; align-items: center; }
.test-card-progress { margin: 2px 0 0; }
.test-card-bottom { justify-content: flex-start; gap: 12px; }
.test-card-bottom .button .tta-icon { width: 16px; height: 16px; margin-right: 6px; }
.test-card.status-in_progress { border-color: var(--line); }
.catalog-layout { display: grid; gap: var(--space-card); }
.catalog-rail { display: none; }
.catalog-continue { display: block; padding: var(--space-card); text-decoration: none; color: var(--ink); }
.catalog-continue .eyebrow { display: block; margin: 0 0 8px; color: var(--ink); font-size: var(--t-h3); font-weight: 700; letter-spacing: 0; text-transform: none; }
.catalog-continue-row { display: flex; align-items: center; gap: 12px; }
.catalog-continue-body { display: grid; gap: 2px; flex: 1 1 auto; min-width: 0; }
.catalog-continue-body strong { font-size: var(--t-body); line-height: 1.3; }
.catalog-continue > .catalog-continue-row > .tta-icon { flex: 0 0 auto; color: var(--muted); }
@media (min-width: 840px) {
  .student-catalog .catalog-section .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1280px) {
  .catalog-layout { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
  .catalog-rail { display: block; position: sticky; top: calc(var(--header-h) + 16px); }
}
/* Test detail (TestDetail-mobile-free / -locked / -completed). */
.detail-heading { flex-direction: row; align-items: center; gap: 12px; margin-bottom: var(--space-card); }
.detail-heading h1 { margin: 0; }
.detail-hero { max-width: none; }
.detail-hero .badge { margin-bottom: 12px; }
.detail-title { margin: 0 0 8px; font-size: var(--t-h1); line-height: 1.2; letter-spacing: -.02em; }
.detail-meta { margin: 0; color: var(--muted); font-size: var(--t-small); line-height: 1.5; }
.detail-summary { margin: 12px 0 0; color: var(--muted); font-size: var(--t-small); }
.detail-result-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 12px 0; }
.detail-result-tile { display: grid; gap: 2px; padding: 14px; border-radius: var(--radius-md); background: var(--surface-quiet); }
.detail-result-tile span, .detail-result-tile small { color: var(--muted); font-size: var(--t-small); }
.detail-result-tile strong { font-size: var(--t-display); line-height: 1.1; }
.link-quiet { color: var(--primary); font-weight: 600; font-size: var(--t-small); text-decoration: none; }
.detail-timing { margin: 0 0 var(--space-section); }
.detail-timing .eyebrow { margin: 0 0 8px; }
.detail-timing .test-study-mode { margin: 0 0 12px; }
.detail-timing .timing-heading { display: none; }
.detail-timing .fine-print { margin: 8px 0 0; }
.detail-expect-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.detail-expect-list li { display: flex; align-items: flex-start; gap: 12px; }
.detail-expect-list strong { display: block; font-size: var(--t-body); }
.detail-expect-list small { display: block; margin-top: 2px; color: var(--muted); font-size: var(--t-small); line-height: 1.45; }
.detail-expect-icon { display: grid; place-items: center; flex: 0 0 auto; width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--primary-soft); color: var(--primary); }
.detail-expect-icon .tta-icon { width: 20px; height: 20px; }
.detail-cta { position: sticky; bottom: calc(var(--nav-h) + var(--dock-h) + env(safe-area-inset-bottom)); z-index: 5; display: grid; gap: 6px; justify-items: center; margin: var(--space-section) calc(-1 * var(--gutter)) 0; padding: 12px var(--gutter) 10px; background: var(--paper); border-top: 1px solid var(--line); }
.detail-cta .button.primary { width: 100%; }
.detail-cta .button .tta-icon { width: 18px; height: 18px; margin-right: 8px; }
.detail-cta .fine-print, .detail-cta-link { margin: 0; font-size: var(--t-small); text-align: center; }
.detail-cta-link { color: var(--primary); font-weight: 600; text-decoration: none; }
.test-detail-screen .mro { margin-bottom: var(--space-card); }
@media (min-width: 840px) {
  .detail-cta { position: static; margin: var(--space-section) 0 0; padding: 0; border: 0; background: transparent; justify-items: start; }
  .detail-cta .button.primary { width: auto; min-width: 240px; }
}
.detail-heading { justify-content: flex-start; }
.detail-result .section-heading { margin-top: 0; margin-bottom: 4px; }
.detail-history .test-facts { margin: 12px 0 0; gap: 8px; }
.detail-history .test-facts span { min-width: 0; padding: 8px 12px; display: inline-flex; align-items: baseline; gap: 6px; font-size: var(--t-small); }
.detail-history .test-facts strong { display: inline; font-size: var(--t-body); }
/* Runners (TestRunner-mobile-question / -passage / -saving-error / -desktop, DrillRunner, AdaptiveRunner):
   centred "Question N of M" + subtitle, clock timer pill, icon-only exit/options, text "Back". */
.study-screen .runner-toolbar { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto 44px; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.study-screen .runner-toolbar .icon-button { flex: none; width: 44px; min-width: 44px; padding: 0; border-color: transparent; background: transparent; }
.study-screen .runner-toolbar .study-progress { padding: 0; text-align: center; }
.study-screen .runner-toolbar .study-progress strong { display: block; font-size: var(--t-body); font-weight: 700; line-height: 1.25; }
.study-screen .runner-toolbar .study-progress > span:last-child { position: static; }
.study-sub { display: block; margin-top: 2px; font-size: var(--t-caption); color: var(--muted); line-height: 1.3; }
.study-sub .eyebrow { display: inline; margin: 0; font-size: inherit; letter-spacing: 0; text-transform: none; color: inherit; }
.study-screen .runner-toolbar .timer-pill { min-height: 36px; padding: 6px 12px; }
.study-screen .runner-toolbar .timer-pill .tta-icon { width: 16px; height: 16px; }
.study-screen .runner-toolbar .timer-pill time { font-size: var(--t-small); font-weight: 700; color: inherit; }
.study-screen .runner-toolbar .timer-pill:has(.urgent) { background: var(--danger-soft); color: var(--danger); }
.study-progress-track { height: 3px; }
.stage-actions { grid-template-columns: minmax(88px, auto) minmax(0, 1fr); }
.stage-actions:has(.study-help) { grid-template-columns: minmax(88px, auto) 44px minmax(0, 1fr); }
.stage.has-check .stage-actions { grid-template-columns: minmax(72px, auto) minmax(0, 1fr) minmax(88px, .75fr); }
.stage-actions .stage-back { padding-left: 16px; padding-right: 16px; }
.stage-actions .stage-next .tta-icon { width: 18px; height: 18px; margin-left: 8px; }
/* Saving-error banner: the runner writes the message into #runner-status.error. */
.study-screen .study-status-slot > .error { display: flex; align-items: flex-start; gap: 10px; margin: 8px 0; padding: 12px 14px; border-radius: var(--radius-md); background: var(--danger-soft); color: var(--ink); font-size: var(--t-small); line-height: 1.45; }
.study-screen .study-status-slot > .error::before { content: '\2717'; flex: 0 0 auto; color: var(--danger); font-weight: 700; font-size: var(--t-body); line-height: 1.2; }
.study-screen .study-status-slot .button { margin: 0 0 8px; }
/* Adaptive module break */
.adaptive-break { display: grid; gap: var(--space-card); padding: var(--space-section) var(--gutter) var(--space-card); }
.adaptive-break-hero { display: grid; place-items: center; text-align: center; }
.adaptive-break-hero .mro { flex-direction: column; align-items: center; }
.adaptive-break-hero .mro-bubble { background: transparent; border: 0; padding: 0; box-shadow: none; }
.adaptive-break-hero .mro-line { font-size: var(--t-h1); font-weight: 700; color: var(--ink); text-align: center; }
.adaptive-break-card { margin: 0; }
.adaptive-break-card .eyebrow { margin: 0 0 8px; }
.adaptive-break-card p:last-child { margin: 0; color: var(--muted); }
.adaptive-break-note { margin: 0; text-align: center; }
.adaptive-break-cta { position: sticky; bottom: 0; margin: 0 calc(-1 * var(--gutter)); padding: 12px var(--gutter) max(12px, env(safe-area-inset-bottom)); background: var(--paper); border-top: 1px solid var(--line); }
.adaptive-break-cta .button { width: 100%; }
.adaptive-break-cta .button .tta-icon { width: 18px; height: 18px; margin-left: 8px; }
@media (min-width: 840px) {
  .study-screen .runner-toolbar { padding: 8px 32px; }
  .stage-actions { grid-template-columns: minmax(96px, auto) minmax(160px, 320px); justify-content: space-between; }
  .stage-actions:has(.study-help) { grid-template-columns: minmax(96px, auto) 44px minmax(160px, 320px); }
  .stage.has-check .stage-actions { grid-template-columns: minmax(96px, auto) minmax(160px, 280px) minmax(100px, 160px); }
  .adaptive-break { max-width: 560px; margin: 0 auto; width: 100%; }
}
/* Runner polish: the checked-state rule (:has(input:checked)) outranked .is-wrong / .is-correct
   after a check, so the wrong choice stayed navy. Same red/green now win. */
.answer-choice.is-wrong:has(input:checked) { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); background: var(--danger-soft); }
.answer-choice.is-wrong:has(input:checked) .choice-letter { background: var(--danger); border-color: var(--danger); color: var(--white); }
.answer-choice.is-correct:has(input:checked) { border-color: var(--success); box-shadow: inset 0 0 0 1px var(--success); background: var(--success-soft); }
.answer-choice.is-correct:has(input:checked) .choice-letter { background: var(--success); border-color: var(--success); color: var(--white); }
/* Feedback block as a soft card: title row, one-paragraph teaser, actions. */
.stage-actions .stage-feedback { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; margin: 0 0 4px; padding: 12px 14px; border-radius: var(--radius-md); }
.stage-actions .stage-feedback.correct { background: var(--success-soft); }
.stage-actions .stage-feedback.incorrect { background: var(--danger-soft); }
.stage-actions .stage-feedback > strong { font-size: var(--t-body); }
.stage-actions .stage-feedback.incorrect > strong { color: var(--danger); }
.stage-actions .stage-feedback.correct > strong { color: var(--success); }
.stage-actions .stage-feedback > .button { grid-column: 2; grid-row: 1 / span 2; padding: 8px 12px; font-size: var(--t-small); }
.stage-feedback-teaser { grid-column: 1; margin: 0; font-size: var(--t-small); line-height: 1.5; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
/* Toolbar subtitle never wraps; the section name already sits in the toolbar on phones. */
.study-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.study-screen #runner-section:not(:empty) { display: none; }
.study-screen #adaptive-break { flex: 1 1 0; min-height: 0; overflow: auto; align-content: start; }
@media (min-width: 840px) { .study-screen #runner-section:not(:empty) { display: block; } }
/* Results (Results-mobile / -desktop / -pending-sync) */
.result-screen .result-hero { text-align: center; }
.result-screen .result-hero .progress-ring { margin: 8px auto; }
.result-screen .result-hero .mro { text-align: left; }
.result-screen .result-actions { display: grid; gap: 12px; margin-bottom: var(--space-section); }
.result-screen .result-actions .button .tta-icon { width: 18px; height: 18px; margin-left: 8px; }
.result-pending { display: flex; align-items: center; gap: 12px; margin-bottom: var(--space-card); padding: 14px; border-radius: var(--radius-md); background: var(--warning-soft); color: var(--ink); }
.result-pending > .tta-icon { flex: 0 0 auto; color: color-mix(in srgb, var(--warning) 70%, var(--ink)); }
.result-pending p { flex: 1 1 auto; margin: 0; font-size: var(--t-small); }
.result-pending .button { flex: 0 0 auto; padding: 8px 12px; font-size: var(--t-small); }
.review-card .feedback { margin: 12px 0 0; }
.review-card .feedback-title { font-weight: 700; }
@media (min-width: 1024px) {
  .result-layout { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: var(--space-section); align-items: start; }
  .result-side { position: sticky; top: calc(var(--header-h) + 16px); }
  .result-side .result-hero { margin-bottom: var(--space-card); }
}
/* Notebook (Notebook-mobile-populated / -empty) */
.notebook-heading { flex-direction: row; align-items: center; justify-content: space-between; margin-bottom: var(--space-card); }
.notebook-heading h1 { margin: 0; font-size: var(--t-h1); }
.notebook-heading .fine-print { margin: 4px 0 0; }
.notebook-list { display: grid; gap: var(--space-card); }
.notebook-card { display: grid; gap: 12px; }
.notebook-card-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.notebook-subject { flex: 0 0 auto; }
.notebook-subject.math { background: var(--info-soft); color: var(--primary); }
.notebook-subject.rw { background: var(--primary-soft); color: var(--primary); }
.notebook-crumb { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: var(--t-small); }
.notebook-time { flex: 0 0 auto; color: var(--muted); font-size: var(--t-caption); }
.notebook-stem { font-size: var(--t-body); line-height: 1.5; }
.notebook-stem > :first-child { margin-top: 0; }
.notebook-stem > :last-child { margin-bottom: 0; }
.notebook-note { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--radius-md); background: var(--surface-quiet); font-size: var(--t-small); line-height: 1.5; }
.notebook-note .tta-icon { flex: 0 0 auto; width: 16px; height: 16px; margin-top: 2px; color: var(--muted); }
.notebook-note p { margin: 0; }
.notebook-card-actions { display: flex; align-items: center; gap: 12px; }
.notebook-card-actions .button { padding: 10px 14px; font-size: var(--t-small); }
.notebook-card-actions .button .tta-icon { width: 16px; height: 16px; margin-left: 4px; }
.notebook-bookmark { margin-left: auto; color: var(--primary); display: grid; place-items: center; width: 40px; height: 40px; }
.student-notebook .section-actions { margin: var(--space-card) 0; text-align: center; }
@media (min-width: 840px) { .notebook-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Flashcards (Flashcards-mobile-front / -back / -complete) */
.student-flashcards .flashcard-decks { margin-bottom: var(--space-card); }
.student-flashcards .flashcard-decks .section-heading { margin: 0 0 8px; }
.flashcard-due { padding: 0 0 8px; }
.flashcard-due strong { font-size: var(--t-h3); }
.flashcard { display: grid; gap: 12px; }
.flashcard-source { margin: 0; color: var(--muted); font-size: var(--t-small); }
.flashcard-front { font-size: var(--t-h3); line-height: 1.4; }
.flashcard-front p { margin: 0; }
.flashcard hr { margin: 4px 0; border: 0; border-top: 1px solid var(--line); }
#flashcard-back .eyebrow { margin: 0 0 6px; }
#flashcard-back .question-content { font-size: var(--t-body); }
#flashcard-back .question-content > p:first-child { font-size: var(--t-h2); font-weight: 700; margin: 0 0 8px; }
.flashcard-hint { margin: 12px 0 0; text-align: center; }
.flashcard-dock { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--dock-h) + env(safe-area-inset-bottom)); z-index: 5; margin: 0; padding: 12px var(--gutter) 10px; background: var(--paper); border-top: 1px solid var(--line); }
#flashcard-app { padding-bottom: 150px; }
.flashcard-dock .button.primary { width: 100%; }
.flashcard-rating-label { margin: 0 0 8px; text-align: center; }
.flashcard-dock #flashcard-rating > .fine-print:last-child { margin: 8px 0 0; text-align: center; }
.flashcard-complete { display: grid; gap: 12px; }
.flashcard-complete h2 { margin: 0; font-size: var(--t-h1); }
.flashcard-complete .fine-print { margin: 0; }
.flashcard-complete .link-quiet { justify-self: start; }
@media (min-width: 840px) {
  .flashcard-dock { position: static; margin: var(--space-card) 0 0; padding: 0; border: 0; background: transparent; }
  #flashcard-app { padding-bottom: 0; }
  .flashcard-dock .button.primary { width: auto; min-width: 240px; }
}
/* Progress (Progress-mobile / -no-data) */
.progress-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 var(--space-card); }
.progress-stats .stat-card { padding: 12px 12px 10px; border: 0; box-shadow: none; background: var(--surface-quiet); }
.progress-stats .stat-card .eyebrow { font-size: var(--t-caption); letter-spacing: 0; text-transform: none; }
.progress-stats .stat-card strong { font-size: var(--t-h1); }
.progress-stats .stat-card span:last-child { font-size: var(--t-caption); }
.progress-links { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.progress-links .stat-card strong { font-size: var(--t-body); }
.progress-links .stat-card span { font-size: var(--t-caption); }
.student-progress .progress-chart figcaption .fine-print { margin: 2px 0 0; }
.student-progress .progress-chart figcaption h3 { margin: 0; }
.student-progress .list-row .button { white-space: nowrap; }
/* Score reports (Reports-mobile-index / -processing / -detail) */
.reports-intro { margin: 0 0 var(--space-card); }
.report-chooser { display: grid; gap: 12px; margin-bottom: var(--space-card); }
.report-choice { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 72px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.report-choice.is-primary { background: var(--primary); border-color: var(--primary); color: var(--white); }
.report-choice-icon { display: grid; place-items: center; flex: 0 0 auto; width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--primary-soft); color: var(--primary); }
.report-choice.is-primary .report-choice-icon { background: color-mix(in srgb, var(--white) 16%, transparent); color: var(--gold); }
.report-choice-body { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; }
.report-choice-body strong { font-size: var(--t-body); }
.report-choice-body small { font-size: var(--t-small); color: var(--muted); }
.report-choice.is-primary .report-choice-body small { color: color-mix(in srgb, var(--white) 75%, transparent); }
.report-choice > .tta-icon:last-child { flex: 0 0 auto; color: var(--muted); }
.report-choice.is-primary > .tta-icon:last-child { color: var(--white); }
.report-choice.is-on { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.report-forms { margin-bottom: var(--space-card); }
.report-list h2 { margin-bottom: 8px; }
.report-row { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 0; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.report-row:first-of-type { border-top: 0; }
.report-row-icon { display: grid; place-items: center; flex: 0 0 auto; width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--primary-soft); color: var(--primary); }
.report-row-icon.success { background: var(--info-soft); color: var(--primary); }
.report-row-icon.danger { background: var(--danger-soft); color: var(--danger); }
.report-row-icon.warning { background: var(--warning-soft); color: color-mix(in srgb, var(--warning) 70%, var(--ink)); }
.report-row-body { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; }
.report-row-body strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-row-body small { color: var(--muted); font-size: var(--t-small); }
.report-row > .tta-icon:last-child { flex: 0 0 auto; color: var(--muted); }
.badge.info { background: var(--info-soft); color: var(--primary); }
.report-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-detail { display: grid; gap: var(--space-card); }
.report-processing { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 28px var(--space-card); }
.report-processing h2 { margin: 8px 0 0; }
.report-processing p { margin: 0; color: var(--muted); font-size: var(--t-small); max-width: 34ch; }
.report-processing .button { margin-top: 8px; }
.report-spinner { display: block; width: 48px; height: 48px; border-radius: 50%; border: 4px solid var(--surface-quiet); border-top-color: var(--primary); animation: report-spin 1s linear infinite; }
@keyframes report-spin { to { transform: rotate(360deg); } }
.report-processing-note { margin: 0; text-align: center; }
.report-score { text-align: center; }
.report-score .fine-print { margin: 0; }
.report-total { margin: 4px 0 8px; font-size: var(--t-display); font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.report-sections { display: flex; justify-content: center; gap: 28px; margin: 0 0 12px; }
.report-sections strong { display: block; font-size: var(--t-h1); line-height: 1.1; }
.report-sections small { color: var(--muted); font-size: var(--t-small); }
.report-summary { margin: 12px 0 0; text-align: left; font-size: var(--t-small); color: var(--muted); }
.report-skills h2 { margin-bottom: 2px; }
.report-skills > .fine-print:first-of-type { margin: 0 0 12px; }
.report-skill-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.report-skill-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
.report-skill-name { font-weight: 600; }
.report-skill-meta { color: var(--muted); font-size: var(--t-small); }
.report-skill-bar { grid-column: 1 / -1; }
.report-skill-bar.is-low > span { background: var(--cta); }
.report-actions { display: grid; gap: 8px; justify-items: center; }
.report-actions .button.primary { width: 100%; }
.report-actions .button .tta-icon { width: 18px; height: 18px; margin-right: 8px; }
.report-secondary { display: flex; gap: 12px; }
.report-secondary .button { flex: 1 1 0; }
.report-secondary .button .tta-icon { width: 18px; height: 18px; margin-right: 8px; }
.report-detail > .fine-print { margin: 0; text-align: center; }
@media (min-width: 840px) {
  .report-chooser { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .report-choice { flex-direction: column; align-items: flex-start; }
  .report-choice > .tta-icon:last-child { display: none; }
  .report-actions .button.primary { width: auto; min-width: 280px; }
  .report-secondary { justify-content: center; }
  .report-secondary .button { flex: 0 0 auto; min-width: 180px; }
}
.report-row .badge { flex: 0 0 auto; white-space: nowrap; }
.report-summary { max-width: none; }
.report-skill-list { margin-bottom: 12px; }
/* Account (Account-mobile / Account-desktop) */
.account-layout { display: grid; gap: var(--space-card); }
.account-main { display: grid; gap: var(--space-card); }
.account-side { display: none; }
.account-identity { display: flex; align-items: center; gap: 14px; }
.account-avatar { display: grid; place-items: center; flex: 0 0 auto; width: 56px; height: 56px; border-radius: 50%; background: var(--primary); color: var(--gold); font-weight: 700; font-size: var(--t-h3); letter-spacing: .02em; }
.account-identity-body { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; }
.account-identity-body strong { font-size: var(--t-h3); }
.account-identity-body small { color: var(--muted); font-size: var(--t-small); overflow-wrap: anywhere; }
.account-identity .button { flex: 0 0 auto; padding: 8px 14px; }
.account-card h2 { margin: 0 0 8px; font-size: var(--t-h3); }
.account-card .section-heading { margin: 0 0 8px; }
.account-card .section-heading h2 { margin: 0; }
.account-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 10px 0; border: 0; border-top: 1px solid var(--line); background: none; color: var(--ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.account-card > .account-row:first-of-type, .account-card h2 + .account-row, .account-card .section-heading + .account-row { border-top: 0; }
.account-row-icon { display: grid; place-items: center; flex: 0 0 auto; width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--primary-soft); color: var(--primary); }
.account-row-body { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; }
.account-row-body strong { font-size: var(--t-body); }
.account-row-body small { color: var(--muted); font-size: var(--t-small); }
.account-row-label { flex: 0 0 auto; color: var(--muted); font-size: var(--t-small); }
.account-row-value { flex: 1 1 auto; min-width: 0; text-align: right; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-row > .tta-icon:last-child { flex: 0 0 auto; color: var(--muted); }
.account-row .badge { flex: 0 0 auto; white-space: nowrap; }
.account-access .account-row { padding: 6px 0 0; }
.account-form { margin: 0; }
.account-access-side .button { width: 100%; margin-top: 12px; }
.account-signout { padding: 0; }
.account-signout form { margin: 0; }
.account-signout button { width: 100%; min-height: 52px; border: 0; background: none; font: inherit; font-weight: 600; color: var(--danger); cursor: pointer; }
@media (min-width: 1024px) {
  .account-layout { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
  .account-main { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-main .account-identity, .account-main .account-form, .account-main #account-status { grid-column: 1 / -1; }
  .account-main .account-access { display: none; }
  .account-side { display: grid; gap: var(--space-card); position: sticky; top: calc(var(--header-h) + 16px); }
}
/* Paywall (Paywall-mobile) */
.paywall-hero { text-align: center; }
.paywall-hero .mro { flex-direction: column; align-items: center; }
.paywall-hero .mro-bubble { background: transparent; border: 0; padding: 0; box-shadow: none; }
.paywall-hero-plans .mro-line { font-size: var(--t-h1); font-weight: 700; color: var(--ink); text-align: center; }
.paywall-hero .mro-line { text-align: center; }
.paywall-hero .fine-print { margin: 4px auto 0; max-width: 36ch; }
.paywall-plans { display: grid; gap: 12px; margin: var(--space-card) 0; padding: 0; border: 0; }
.paywall-plan { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper); cursor: pointer; }
.paywall-plan input { accent-color: var(--primary); width: 20px; height: 20px; margin: 0; flex: 0 0 auto; }
.paywall-plan-body { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; }
.paywall-plan-title { font-size: var(--t-body); font-weight: 700; }
.paywall-plan-body small strong { color: var(--ink); }
.paywall-plan-body small { color: var(--muted); font-size: var(--t-small); }
.paywall-plan .badge { flex: 0 0 auto; white-space: nowrap; }
.paywall-plan:has(input:checked) { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.student-access .mro { margin-bottom: var(--space-card); }
.paywall-included ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.paywall-included li { display: flex; align-items: center; gap: 10px; }
.paywall-included .tta-icon { flex: 0 0 auto; width: 18px; height: 18px; color: var(--success); }
.paywall-cta { position: sticky; bottom: calc(var(--nav-h) + var(--dock-h) + env(safe-area-inset-bottom)); z-index: 5; display: grid; gap: 6px; justify-items: center; margin: var(--space-card) calc(-1 * var(--gutter)); padding: 12px var(--gutter) 10px; background: var(--paper); border-top: 1px solid var(--line); }
.paywall-cta .button.primary { width: 100%; }
.paywall-cta .fine-print { margin: 0; text-align: center; }
@media (min-width: 840px) {
  .paywall-cta { position: static; margin: var(--space-card) 0; padding: 0; border: 0; background: transparent; justify-items: start; }
  .paywall-cta .button.primary { width: auto; min-width: 280px; }
}

/* native feel + push checklist (2026-09-19, W7) */
html.pwa-standalone body { overscroll-behavior-y: none; }
.bottom-nav a, .tools-dock a, .tools-dock button, .button, .chip, .icon-button { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.push-checklist { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 10px; font-size: var(--t-body); line-height: 1.5; }
.push-checklist li[data-current] { padding: 10px 12px; border-radius: var(--radius-md, 12px); background: var(--primary-soft); list-style-position: inside; }
.push-checklist li[data-current] strong { color: var(--primary); }
