/* QS PetalStep "Stepping stones" design system (Oozma, Nov 2026).
   Loaded after styles.css, which stays as the frozen v1 base. Remove the one <link> in index.html to undo the look.
   Tokens first. Jamun rail, marigold for the one action, three petals for the three disciplines. */

/* ---------- 0. Fonts: self-hosted, variable, one @font-face pair per family (OFL: see OFL-<family>.txt and SOURCES.md in app/ui/fonts/; list in app/fonts.js) ---------- */
@font-face { font-family: "Parkinsans"; font-style: normal; font-weight: 300 800; font-display: swap; src: url("fonts/parkinsans-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Parkinsans"; font-style: normal; font-weight: 300 800; font-display: swap; src: url("fonts/parkinsans-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Lexend"; font-style: normal; font-weight: 400 800; font-display: swap; src: url("fonts/lexend-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Lexend"; font-style: normal; font-weight: 400 800; font-display: swap; src: url("fonts/lexend-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
/* Noto Sans is cut at 400 to 700 only, so weight 800 draws at 700 under it. */
@font-face { font-family: "Noto Sans"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("fonts/noto-sans-latin-ext.woff2") format("woff2"); unicode-range: U+0100-017F, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113; }
@font-face { font-family: "Noto Sans"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("fonts/noto-sans-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
/* Tamil companion, in every stack. The range leaves out U+200C-200D and U+25CC on purpose so an English screen never loads it; the file keeps them for shaping. */
@font-face { font-family: "Noto Sans Tamil"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("fonts/noto-sans-tamil.woff2") format("woff2"); unicode-range: U+0964-0965, U+0B82-0BFA; }

/* Which font a person sees (data-font) and which the centre chose (data-centre-font). The attributes are set by app/shell.js; no inline style. */
:root[data-font="lexend"] { --font: var(--font-lexend); }
:root[data-font="noto"] { --font: var(--font-noto); }
:root[data-font="device"] { --font: var(--font-system); }
:root[data-centre-font="lexend"] { --font-centre: var(--font-lexend); }
:root[data-centre-font="noto"] { --font-centre: var(--font-noto); }

/* The family report is the centre's voice: never the person's own font, on screen or on paper. */
.sheet { font-family: var(--font-centre); }
.sheet .chart .axis, .sheet .chart .lbl { font-family: var(--font-centre); }
@media print { .sheet { font-family: var(--font-centre); } }

/* Tamil text (lang="ta", or the notice body marked data-notice-lang="ta"): taller lines, no tracking, no italics, no capitals, heaviest weight 700. */
:lang(ta), [data-notice-lang="ta"] { line-height: 1.7; letter-spacing: 0; font-style: normal; text-transform: none; }
:is(h1, h2, h3):lang(ta), :is(h1, h2, h3) :lang(ta), [data-notice-lang="ta"] :is(h1, h2, h3) { line-height: 1.4; }
:lang(ta) b, :lang(ta) strong, [data-notice-lang="ta"] :is(b, strong, h1, h2, h3) { font-weight: 700; }

/* ---------- 1. Tokens ---------- */
:root {
  color-scheme: light;
  --bg: #F6F2FB; --surface: #FFFFFF; --surface-2: #EFE8F7;
  --line: #E2D8EF; --line-strong: #85749F;
  --ink: #241738; --ink-2: #54466B;
  --primary: #4B2A8C; --primary-hover: #3A1F70; --on-primary: #FFFFFF; --primary-soft: #EDE4FA;
  --action: #FFB320; --action-hover: #FFA300; --on-action: #241738;
  --focus: #1257C7;
  --physio: #0A5F96; --physio-soft: #DFF1FB;
  --speech: #A81D5F; --speech-soft: #FCE4EF;
  --ot: #8A4A00; --ot-soft: #FFEFD2;
  --ok: #1C6B3A; --ok-soft: #DFF3E5;
  --warn: #7A4A00; --warn-soft: #FFF0CF;
  --danger: #B3261E; --danger-soft: #FDE5E2;
  /* the rail keeps its jamun in both themes */
  --rail-bg: #2A1A4A; --rail-2: #3B2766; --rail-ink: #F3EDFB; --rail-soft: #D9CDEC;
  /* drawings */
  --art-ink: #2A1A4A; --art-physio: #3AA6E0; --art-speech: #E0457F; --art-ot: #FFB320; --art-heart: #FFFFFF;
  --art-floor: #E7DCF5; --art-card: #FFFFFF; --art-hole: #E2D8EF; --art-stem: #2E8B57; --art-trail: #B9A6D6;
  /* shape, depth, type */
  --r-control: 14px; --r-card: 24px; --r-pill: 999px;
  --pebble-a: 46px 58px 50px 42px / 54px 44px 58px 46px;
  --pebble-b: 56px 44px 46px 54px / 46px 56px 44px 58px;
  --shadow: 0 1px 0 rgba(42, 26, 74, .06), 0 10px 26px -14px rgba(42, 26, 74, .28);
  --shadow-lift: 0 2px 0 rgba(42, 26, 74, .08), 0 18px 34px -16px rgba(42, 26, 74, .42);
  --font-tamil: "Noto Sans Tamil";
  --font-device: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-parkinsans: "Parkinsans", var(--font-tamil), var(--font-device);
  --font-lexend: "Lexend", var(--font-tamil), var(--font-device);
  --font-noto: "Noto Sans", var(--font-tamil), var(--font-device);
  --font-system: var(--font-tamil), var(--font-device);
  --font: var(--font-parkinsans);
  --font-centre: var(--font-parkinsans);
  --fs-xs: 13px; --fs-sm: 14px; --fs-md: 16px; --fs-lg: 18px; --fs-xl: 22px; --fs-2xl: 34px; --fs-3xl: 44px;
  --rail: 240px;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #171026; --surface: #231939; --surface-2: #2E2249; --line: #3D3059; --line-strong: #8D7DAD;
    --ink: #F3EEFA; --ink-2: #C7BBD9;
    --primary: #C9B2FF; --primary-hover: #DACBFF; --on-primary: #1D1233; --primary-soft: #37275A;
    --action: #FFB938; --action-hover: #FFC95C; --on-action: #241738;
    --focus: #FFC94D;
    --physio: #7CCBF5; --physio-soft: #12324A;
    --speech: #FF9CC8; --speech-soft: #451A33;
    --ot: #FFC36B; --ot-soft: #43300F;
    --ok: #7FDCA0; --ok-soft: #143824;
    --warn: #FFD37A; --warn-soft: #3D2E0C;
    --danger: #FFA99F; --danger-soft: #4A1C18;
    --rail-bg: #1E1335; --rail-2: #30224F;
    --art-ink: #C9B2FF; --art-heart: #231939; --art-floor: #2E2249; --art-card: #37275A; --art-hole: #3D3059; --art-stem: #6FCF97; --art-trail: #6F5E90;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 10px 26px -14px rgba(0, 0, 0, .7);
    --shadow-lift: 0 2px 0 rgba(0, 0, 0, .3), 0 18px 34px -16px rgba(0, 0, 0, .8);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171026; --surface: #231939; --surface-2: #2E2249; --line: #3D3059; --line-strong: #8D7DAD;
  --ink: #F3EEFA; --ink-2: #C7BBD9;
  --primary: #C9B2FF; --primary-hover: #DACBFF; --on-primary: #1D1233; --primary-soft: #37275A;
  --action: #FFB938; --action-hover: #FFC95C; --on-action: #241738;
  --focus: #FFC94D;
  --physio: #7CCBF5; --physio-soft: #12324A;
  --speech: #FF9CC8; --speech-soft: #451A33;
  --ot: #FFC36B; --ot-soft: #43300F;
  --ok: #7FDCA0; --ok-soft: #143824;
  --warn: #FFD37A; --warn-soft: #3D2E0C;
  --danger: #FFA99F; --danger-soft: #4A1C18;
  --rail-bg: #1E1335; --rail-2: #30224F;
  --art-ink: #C9B2FF; --art-heart: #231939; --art-floor: #2E2249; --art-card: #37275A; --art-hole: #3D3059; --art-stem: #6FCF97; --art-trail: #6F5E90;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 10px 26px -14px rgba(0, 0, 0, .7);
  --shadow-lift: 0 2px 0 rgba(0, 0, 0, .3), 0 18px 34px -16px rgba(0, 0, 0, .8);
}

/* ---------- 2. Base ---------- */
html { -webkit-tap-highlight-color: rgba(75, 42, 140, .16); scroll-padding-top: 88px; }
body { font: 400 var(--fs-md)/1.5 var(--font); caret-color: var(--primary); accent-color: var(--primary); }
::selection { background: var(--action); color: var(--on-action); }
h1 { font-size: var(--fs-2xl); line-height: 1.08; font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: var(--fs-xl); line-height: 1.2; font-weight: 700; letter-spacing: -.01em; text-wrap: balance; }
h3 { font-size: var(--fs-lg); line-height: 1.3; font-weight: 700; }
p { text-wrap: pretty; }
a { text-decoration-thickness: 2px; text-underline-offset: 3px; }
b, strong { font-weight: 700; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
/* The router moves focus to the h1 for screen readers. A heading is not a control, so it shows no ring. */
h1[tabindex="-1"]:focus, h1[tabindex="-1"]:focus-visible { outline: none; }
.eyebrow { font-size: var(--fs-sm); font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink-2); }
.muted { color: var(--ink-2); }
.skip { border-radius: var(--r-control); font-weight: 700; color: var(--ink); box-shadow: var(--shadow-lift); }
.nav[hidden] { display: none; }

/* ---------- 3. Shell ---------- */
.petal-mark { width: 32px; height: 32px; flex: none; display: block; }
.art-physio { fill: var(--art-physio); } .art-speech { fill: var(--art-speech); } .art-ot { fill: var(--art-ot); }
.art-heart { fill: var(--art-heart); } .art-ink { fill: var(--art-ink); } .art-floor { fill: var(--art-floor); }
.art-card { fill: var(--art-card); } .art-hole { fill: var(--art-hole); } .art-glow { fill: var(--surface-2); }
.art-stem { fill: none; stroke: var(--art-stem); stroke-width: 4; stroke-linecap: round; }
.art-trail { fill: none; stroke: var(--art-trail); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 1 10; }
.art-line { fill: none; stroke: var(--art-ink); stroke-width: 5; }
.art-line-w { fill: none; stroke: var(--art-heart); stroke-width: 3.5; }
.topbar .petal-mark .art-heart { fill: #FFFFFF; }

.topbar { background: var(--rail-bg); color: var(--rail-ink); border-bottom: 0; min-height: 60px; padding: var(--s2) var(--s4); }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--rail-ink); font-size: var(--fs-lg); font-weight: 800; letter-spacing: -.01em; white-space: nowrap; border-radius: var(--r-control); }
.brand-name { white-space: nowrap; }
.demo-badge { background: var(--action); color: var(--on-action); font-weight: 700; padding: 3px 10px; }
.who { border: 1px solid transparent; background: var(--rail-2); color: var(--rail-ink); font-weight: 600; min-height: 44px; padding: 4px 14px; }
.topbar .dot { background: var(--rail-soft); }
.topbar .dot-physio { background: #7CCBF5; } .topbar .dot-speech { background: #FF9CC8; } .topbar .dot-ot { background: #FFC36B; }
.topbar :focus-visible { outline-color: #FFC94D; }
.who { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 519px) {
  .topbar { gap: var(--s2); padding-inline: var(--s3); }
  .brand-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .who { padding-inline: 12px; }
}

.nav { left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); padding: 6px; gap: 4px; background: var(--rail-bg); border: 0; border-radius: var(--r-card); box-shadow: 0 12px 28px -10px rgba(30, 18, 54, .65); }
.nav a { min-height: 56px; border: 0; border-radius: var(--r-control); color: var(--rail-soft); font-weight: 600; }
.nav a[aria-current="page"] { background: var(--action); color: var(--on-action); font-weight: 700; }
.nav svg { width: 22px; height: 22px; }
.nav :focus-visible { outline-color: #FFC94D; outline-offset: 1px; border-radius: var(--r-control); }
main { padding: var(--s5) var(--s4); padding-bottom: 120px; max-width: 1240px; }
.page-head { margin-bottom: var(--s5); }
.page-head .muted { font-size: var(--fs-md); }
.page-head h1 + p { margin-top: var(--s2); }
.back { font-weight: 600; color: var(--primary); min-height: 44px; }

@media (min-width: 900px) {
  body:not(.phone) { grid-template-columns: var(--rail) minmax(0, 1fr); grid-template-rows: auto 1fr; }
  body:not(.phone):has(> .nav[hidden]) { grid-template-columns: minmax(0, 1fr); }
  body:not(.phone) .topbar { z-index: 12; grid-column: 2; grid-row: 1; background: var(--bg); color: var(--ink); min-height: 72px; padding-inline: var(--s6); justify-content: flex-end; }
  body:not(.phone):has(> .nav[hidden]) .topbar { grid-column: 1; background: var(--rail-bg); color: var(--rail-ink); }
  body:not(.phone) .brand { position: fixed; left: 0; top: 0; z-index: 11; width: var(--rail); height: 92px; padding-left: 26px; font-size: 20px; }
  body:not(.phone):has(> .nav[hidden]) .brand { position: static; width: auto; height: auto; padding-left: 0; margin-right: auto; }
  body:not(.phone) .demo-badge { margin-left: auto; }
  body:not(.phone):has(> .nav[hidden]) .demo-badge { margin-left: 0; }
  body:not(.phone) .who { margin-left: 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
  body:not(.phone):has(> .nav[hidden]) .who { background: var(--rail-2); color: var(--rail-ink); box-shadow: none; }
  body:not(.phone) .topbar .dot { background: var(--ink-2); }
  body:not(.phone) .topbar .dot-physio { background: var(--physio); } body:not(.phone) .topbar .dot-speech { background: var(--speech); } body:not(.phone) .topbar .dot-ot { background: var(--ot); }
  body:not(.phone) .topbar :focus-visible { outline-color: var(--focus); }
  body:not(.phone):has(> .nav[hidden]) .topbar :focus-visible { outline-color: #FFC94D; }
  body:not(.phone) .brand:focus-visible { outline-color: #FFC94D; outline-offset: -6px; }
  body:not(.phone) .nav { grid-column: 1; grid-row: 1 / span 2; left: auto; right: auto; bottom: auto; top: 0; height: 100vh; padding: 104px 14px var(--s5); border-radius: 0; box-shadow: none; gap: 6px; }
  body:not(.phone) .nav a { min-height: 48px; padding: 0 var(--s4); border-radius: var(--r-pill); font-size: var(--fs-md); }
  body:not(.phone) .nav a:hover { background: var(--rail-2); color: var(--rail-ink); }
  body:not(.phone) .nav a[aria-current="page"], body:not(.phone) .nav a[aria-current="page"]:hover { background: var(--action); color: var(--on-action); }
  body:not(.phone) .nav :focus-visible { border-radius: var(--r-pill); }
  body:not(.phone) main { grid-column: 2; grid-row: 2; padding: var(--s3) var(--s6) var(--s7); }
  body:not(.phone):has(> .nav[hidden]) main { grid-column: 1; margin-inline: auto; }
  h1 { font-size: var(--fs-3xl); }
  .page-head.has-art { display: grid; grid-template-columns: minmax(0, 1fr) 240px; column-gap: var(--s5); align-items: end; min-height: 150px; }
  .page-head.has-art > * { grid-column: 1; }
  .page-head.has-art > .page-art { grid-column: 2; grid-row: 1 / span 4; align-self: end; }
}

/* Drawings */
.art { display: block; width: 100%; height: auto; }
.page-art { display: none; }
@media (min-width: 900px) { .page-art { display: block; } }

/* ---------- 4. Buttons ---------- */
.btn { border-radius: var(--r-pill); font-weight: 600; padding: 0 22px; border-color: var(--line-strong); background: var(--surface); }
.btn:hover { background: var(--surface-2); border-color: var(--primary); }
.btn:active { transform: translateY(1px) scale(.985); }
.btn-primary, a.btn-primary { background: var(--action); border-color: var(--action); color: var(--on-action); font-weight: 700; box-shadow: 0 2px 0 rgba(122, 74, 0, .35); }
.btn-primary:hover { background: var(--action-hover); border-color: var(--action-hover); color: var(--on-action); }
.btn-primary:active { box-shadow: none; }
.btn-lg { min-height: 54px; padding: 0 28px; font-size: var(--fs-md); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--primary); padding: 0 12px; }
.btn-quiet:hover { background: var(--primary-soft); border-color: transparent; }
.btn-danger { color: var(--danger); border-color: var(--danger); background: var(--surface); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 1; background: var(--surface-2); border-color: var(--line-strong); color: var(--ink-2); box-shadow: none; }

/* ---------- 5. Chips, status ---------- */
.chip { padding: 4px 12px 4px 9px; font-weight: 600; font-size: var(--fs-xs); }
.chip::before { width: 10px; height: 10px; }
.chip-physio::before { border-radius: 50%; }
.chip-speech::before { border-radius: 3px; }
.status { border-radius: var(--r-pill); padding: 3px 11px; font-weight: 700; }
.tag-invented { border-color: var(--line-strong); border-radius: var(--r-pill); padding: 2px 10px; font-weight: 600; }

/* ---------- 6. Cards, lists, tiles ---------- */
.card { border: 0; border-radius: var(--r-card); padding: var(--s5); box-shadow: var(--shadow); }
.card-flat { background: var(--surface-2); box-shadow: none; }
.card-accent { border-left: 0; position: relative; overflow: hidden; padding-left: calc(var(--s5) + 6px); }
.card-accent::before { content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; width: 6px; border-radius: 0 6px 6px 0; background: var(--primary); }
.card-accent.is-physio::before { background: var(--physio); }
.card-accent.is-speech::before { background: var(--speech); }
.card-accent.is-ot::before { background: var(--ot); }
.list > li { border-top-color: var(--line); padding: var(--s3) 0; }
.avatar { background: var(--primary-soft); color: var(--primary); border-radius: 52% 48% 50% 18%; font-weight: 800; }
.tile { border: 0; border-radius: var(--r-card); padding: var(--s5); box-shadow: var(--shadow); }
a.tile:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); }
.tile .big { font-weight: 800; }
.banner { border-radius: var(--r-control); padding: var(--s3) var(--s4); background: var(--primary-soft); }
.banner-warn { background: var(--warn-soft); }
.empty { border: 2px dotted var(--line-strong); border-radius: var(--r-card); padding: var(--s6) var(--s5); color: var(--ink-2); background: transparent; }
.empty h3 { color: var(--ink); }
.empty > * + * { margin-top: var(--s3); }
table.data th { font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); border-bottom: 2px solid var(--line); }
table.data td { border-bottom-color: var(--line); }
table.data tbody tr:hover td { background: var(--surface-2); }
.tabs { border-bottom: 2px solid var(--line); }
.tabs a { font-weight: 600; border-bottom-width: 4px; margin-bottom: -2px; }

/* ---------- 7. Forms ---------- */
.field > .label, label.label { font-weight: 600; }
.input, select.input, textarea.input { border-radius: var(--r-control); border-color: var(--line-strong); background: var(--surface); font-size: var(--fs-md); padding: 11px 14px; }
.input:hover { border-color: var(--primary); }
.input:focus-visible { outline-offset: 1px; border-radius: var(--r-control); }
.check input, .day-chip input { accent-color: var(--primary); }
.steps li { border-radius: var(--r-pill); font-weight: 600; }
.steps li[aria-current="step"] { background: var(--primary); color: var(--on-primary); }
.day-chip { font-weight: 600; }

/* Segmented scale: five small stones. */
.seg { gap: 6px; }
.seg span { border-radius: var(--r-control); min-height: 66px; border-color: var(--line-strong); font-weight: 600; font-size: 12.500px; }
.seg span b { font-weight: 800; }
.seg label:hover span { border-color: var(--primary); background: var(--primary-soft); }
.seg input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: 0 3px 0 rgba(42, 26, 74, .35); }

/* Tally: the two big stones of the 60-second log. */
.tally-btn { min-height: 104px; border-width: 2px; font-weight: 700; }
.tally-yes { border-radius: var(--pebble-a); background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.tally-no { border-radius: var(--pebble-b); background: var(--surface); border-color: var(--line-strong); }
.tally-btn .n { font-size: 40px; font-weight: 800; }
.tally-btn:hover { box-shadow: var(--shadow-lift); }
.tally-out output { font-weight: 800; }
.stepper button { border-color: var(--line-strong); background: var(--surface); color: var(--primary); }
.stepper button:hover { background: var(--primary-soft); border-color: var(--primary); }
.stopwatch .time { font-weight: 800; }

/* GAS levels: a rising row of stones, one to pick once at the goal date. */
.levels { gap: 8px; }
.levels .lv { border-radius: var(--r-control); border-color: var(--line-strong); min-height: 60px; grid-template-columns: 48px 1fr; }
.levels .lv b { display: grid; place-items: center; width: 42px; height: 42px; font-weight: 800; background: var(--surface-2); border-radius: 52% 48% 50% 46%; }
.levels label:hover .lv { border-color: var(--primary); }
.levels input:checked + .lv { border-color: var(--primary); background: var(--primary-soft); }
.levels input:checked + .lv b { background: var(--primary); color: var(--on-primary); }
.level-edit.is-zero { border-radius: var(--r-card); }

/* ---------- 8. Goals and charts ---------- */
.goal-title { font-size: var(--fs-xl); font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
.chart .series { stroke-width: 3; }
.chart .axis, .chart .lbl { font-family: var(--font); }
.chart .ref-target { stroke: var(--primary); }
.thennow div { border-radius: var(--r-control); padding: var(--s2) var(--s3); }
.thennow .now { background: var(--primary-soft); }
.tscore { font-weight: 800; }
details.chart-table > summary, details.plan-group > summary, .log-rest > summary { color: var(--primary); font-weight: 600; border-radius: var(--r-control); }
.savebar { background: var(--surface); border-top: 0; border-radius: var(--r-card) var(--r-card) 0 0; box-shadow: 0 -10px 26px -16px rgba(42, 26, 74, .4); bottom: calc(82px + env(safe-area-inset-bottom)); left: 10px; right: 10px; }
.has-savebar main { padding-bottom: 260px; }
@media (min-width: 900px) {
  body:not(.phone) .savebar { left: auto; right: auto; bottom: var(--s3); border-radius: var(--r-card); box-shadow: var(--shadow-lift); margin-top: var(--s4); }
}

/* ---------- 9. The signature: today's children as a path of stepping stones ---------- */
[data-screen="S02"] #expected { background: transparent; box-shadow: none; padding: 0; overflow: visible; }
[data-screen="S02"] #expected > h2 { margin-bottom: var(--s4); }
[data-screen="S02"] #expected .list { display: grid; gap: 30px; }
[data-screen="S02"] #expected .list > li { position: relative; flex-wrap: wrap; gap: var(--s3) var(--s4); width: min(100%, 620px); padding: var(--s5) 30px; border: 0; background: var(--surface); border-radius: var(--pebble-a); box-shadow: var(--shadow-lift); }
[data-screen="S02"] #expected .list > li:nth-child(even) { justify-self: end; border-radius: var(--pebble-b); }
[data-screen="S02"] #expected .list > li:has(.status-ok) { background: var(--ok-soft); }
/* the footsteps between two stones */
[data-screen="S02"] #expected .list > li + li::before { content: ""; position: absolute; top: -30px; left: 42%; width: 74px; height: 30px; background-image: radial-gradient(circle, var(--art-trail) 3.500px, transparent 4px); background-size: 15px 15px; background-position: 0 50%; background-repeat: repeat-x; transform: rotate(-16deg); }
[data-screen="S02"] #expected .list > li:nth-child(odd) + li::before { transform: rotate(16deg); }
[data-screen="S02"] #expected .list > li .grow { flex: 1 1 200px; }
[data-screen="S02"] #expected .list > li .grow > a { font-size: var(--fs-xl); text-decoration: none; color: var(--ink); }
[data-screen="S02"] #expected .list > li .grow > a:hover { color: var(--primary); text-decoration: underline; }
[data-screen="S02"] .avatar { width: 56px; height: 56px; font-size: var(--fs-xl); }
@media (max-width: 899px) {
  [data-screen="S02"] #expected .list > li { padding: var(--s4) 22px; }
  [data-screen="S02"] #expected .list > li > .btn { flex: 1 1 100%; }
}

/* ---------- 10. Person picker ---------- */
[data-screen="S01"] .tile { display: grid; gap: var(--s2); justify-items: start; padding: var(--s5); border-radius: var(--pebble-a); min-height: 196px; align-content: center; }
[data-screen="S01"] .cols > .tile:nth-child(even) { border-radius: var(--pebble-b); }
[data-screen="S01"] > .tile { margin-top: var(--s5); min-height: 0; background: var(--rail-bg); color: var(--rail-ink); }
[data-screen="S01"] > .tile .muted { color: var(--rail-soft); }
[data-screen="S01"] .tile .tile-name { font-size: 28px; margin: 0; line-height: 1.1; }
@media (min-width: 900px) {
  body:not(.phone) [data-screen="S01"] .cols > .tile { min-height: 270px; }
  body:not(.phone) [data-screen="S01"] > .tile { min-height: 150px; }
}

/* ---------- 11. Sign-in and invitation pages ---------- */
[data-screen="S18"], [data-screen="S19"], [data-screen="S33"] { max-width: 460px; margin-inline: auto; }
.auth-room { display: none; }
[data-screen="S18"] form { display: grid; gap: var(--s4); background: var(--surface); border-radius: var(--r-card); padding: var(--s5); box-shadow: var(--shadow-lift); }
[data-screen="S18"] form + p { margin-top: var(--s4); }
@media (min-width: 900px) {
  body:not(.phone):has(.auth-room) main { max-width: none; width: 100%; }
  [data-screen="S18"], [data-screen="S19"], [data-screen="S33"] { max-width: 1120px; display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 1fr); column-gap: var(--s7); align-items: center; align-content: center; min-height: calc(100vh - 150px); }
  [data-screen="S18"] > *, [data-screen="S19"] > *, [data-screen="S33"] > * { grid-column: 1; }
  .auth-room { display: block; grid-column: 2 !important; grid-row: 1 / span 8; }
}

/* ---------- 12. Dialogs ---------- */
dialog.dialog, dialog.side-sheet { border: 0; box-shadow: var(--shadow-lift); }
dialog.dialog { border-radius: var(--r-card); }
dialog.side-sheet { border-radius: var(--r-card) var(--r-card) 0 0; }
dialog.dialog::backdrop, dialog.side-sheet::backdrop { background: rgba(30, 18, 54, .55); }
@media (min-width: 900px) { dialog.side-sheet { border-radius: var(--r-card) 0 0 var(--r-card); } }

/* ---------- 13. Family report: always dark ink on white, on screen and on paper ---------- */
.sheet { --ink: #241738; --ink-2: #54466B; --surface: #FFFFFF; --surface-2: #F6F2FB; --line: #E2D8EF; --primary: #4B2A8C; --primary-soft: #EDE4FA;
  --physio: #0A5F96; --physio-soft: #DFF1FB; --speech: #A81D5F; --speech-soft: #FCE4EF; --ot: #8A4A00; --ot-soft: #FFEFD2;
  background: #FFFFFF; color: #241738; border: 0; border-radius: var(--r-card); box-shadow: var(--shadow-lift); }
.sheet header { border-bottom: 3px dotted #B9A6D6; padding-bottom: 10px; }
.sheet .sheet-title { font-size: 28px; font-weight: 800; letter-spacing: -.015em; }
.sheet .goal { border: 0; background: #F6F2FB; border-radius: var(--r-control); padding: 10px 14px; }
.sheet .goal h3 { font-weight: 700; }
.sheet .home { background: #FFF0CF; border-radius: var(--r-control); }
.sheet footer { border-top: 3px dotted #E2D8EF; }

/* ---------- 13b. Working screens: forms, tables, rows ---------- */
@media (max-width: 899px) {
  :root { --r-card: 20px; --pebble-a: 30px 38px 32px 28px / 34px 28px 38px 30px; --pebble-b: 36px 28px 30px 34px / 30px 36px 28px 38px; }
}

/* Forms keep a readable measure. A long form uses the width in columns instead of one stretched field. */
main .card > .field, main form > .field { max-width: 560px; }
main .card > .field + .field, main form > .field + .field { margin-top: var(--s4); }
@media (min-width: 900px) {
  body:not(.phone) main :is(.card, form):has(> .field ~ .field ~ .field ~ .field) { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--s4) var(--s5); align-items: start; }
  body:not(.phone) main :is(.card, form):has(> .field ~ .field ~ .field ~ .field) > * { grid-column: 1 / -1; }
  body:not(.phone) main :is(.card, form):has(> .field ~ .field ~ .field ~ .field) > .field { grid-column: auto; max-width: none; margin-top: 0; }
  body:not(.phone) main :is(.card, form):has(> .field ~ .field ~ .field ~ .field) > .field:has(textarea) { grid-column: 1 / -1; }
}

/* One marigold per screen: a repeated row action steps back to an outline. */
table .btn-primary, table a.btn-primary,
[data-screen="S02"] #expected .list > li:not(:has(.status-ok)) ~ li:not(:has(.status-ok)) .btn-primary {
  background: var(--surface); border-color: var(--primary); color: var(--primary); box-shadow: none;
}
table .btn-primary:hover, table a.btn-primary:hover,
[data-screen="S02"] #expected .list > li:not(:has(.status-ok)) ~ li:not(:has(.status-ok)) .btn-primary:hover {
  background: var(--primary-soft); border-color: var(--primary); color: var(--primary);
}

/* Staff and assignment tables */
table.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
table.table th { text-align: left; font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); padding: var(--s2) var(--s3); border-bottom: 2px solid var(--line); }
table.table td { padding: var(--s3); border-bottom: 1px solid var(--line); vertical-align: middle; }
table.table tbody tr:last-child td { border-bottom: 0; }
@media (max-width: 899px) {
  table.table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.table, table.table tbody { display: block; width: 100%; }
  table.table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s2) var(--s3); align-items: center; padding: var(--s4) 0; border-bottom: 1px solid var(--line); }
  table.table tbody tr:last-child { border-bottom: 0; }
  table.table td, table.table tbody tr:last-child td { display: block; min-width: 0; padding: 0; border: 0; }
  table.table td:last-child:not(td:has(select) + td) { grid-column: 1 / -1; }
  table.data.data-cards tr { border: 0; box-shadow: var(--shadow); padding: var(--s4); }
  .card:has(> .table-wrap > table.data-cards) { background: transparent; box-shadow: none; padding: 0; }
}

/* Attendance: three plain choices, the chosen one filled. */
[data-screen="S27"] .child-row .grow { display: grid; gap: var(--s2); justify-items: start; }
[data-screen="S27"] .child-row .grow > b { font-size: var(--fs-lg); }
[data-screen="S27"] .child-row .row .btn { border-color: var(--line-strong); }
[data-screen="S27"] .child-row .row .btn[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: none; }
[data-screen="S27"] .child-row .field { width: 100%; max-width: 280px; }

/* Save bars wrap instead of cutting a button off on a phone. */
@media (max-width: 899px) {
  .savebar .row { flex-wrap: wrap; gap: var(--s2); }
  .has-savebar .savebar .btn { min-height: 48px; flex: 1 1 auto; }
  .savebar .ge-missing { font-size: var(--fs-xs); text-align: left; }
}
@media (max-width: 519px) {
  .report-tools .btn { flex: 1 1 calc(50% - var(--s3)); padding-inline: 12px; }
}

/* Reading floor and tap floor on a phone. */
@media (max-width: 899px) {
  :root { --fs-sm: 16px; }
  .brand { min-width: 44px; min-height: 44px; justify-content: center; }
  table.data td a:not(.btn) { display: inline-flex; align-items: center; min-width: 44px; min-height: 44px; }
}

/* Check boxes and radios: a 44px target around a 24px stone. Scale controls keep their own hidden input. */
main input:is([type="checkbox"], [type="radio"]):not(.seg input, .levels input),
dialog input:is([type="checkbox"], [type="radio"]):not(.seg input, .levels input) {
  appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 44px; height: 44px; margin: -11px -6px -11px -10px; padding: 0; border: 0; border-radius: var(--r-control); background: transparent; cursor: pointer;
}
main input:is([type="checkbox"], [type="radio"]):not(.seg input, .levels input)::before,
dialog input:is([type="checkbox"], [type="radio"]):not(.seg input, .levels input)::before {
  content: ""; position: absolute; inset: 10px; box-sizing: border-box; border: 2px solid var(--line-strong); border-radius: 8px; background: var(--surface);
}
main input[type="radio"]:not(.seg input, .levels input)::before, dialog input[type="radio"]:not(.seg input, .levels input)::before { border-radius: 50%; }
main input:is([type="checkbox"], [type="radio"]):not(.seg input, .levels input):hover::before,
dialog input:is([type="checkbox"], [type="radio"]):not(.seg input, .levels input):hover::before { border-color: var(--primary); }
main input:is([type="checkbox"], [type="radio"]):not(.seg input, .levels input):checked::before,
dialog input:is([type="checkbox"], [type="radio"]):not(.seg input, .levels input):checked::before { background: var(--primary); border-color: var(--primary); }
main input[type="checkbox"]:not(.seg input, .levels input):checked::after,
dialog input[type="checkbox"]:not(.seg input, .levels input):checked::after {
  content: ""; position: absolute; left: 18px; top: 14px; width: 7px; height: 13px; border: solid var(--on-primary); border-width: 0 3px 3px 0; transform: rotate(42deg);
}
main input[type="radio"]:not(.seg input, .levels input):checked::after,
dialog input[type="radio"]:not(.seg input, .levels input):checked::after { content: ""; position: absolute; inset: 17px; border-radius: 50%; background: var(--on-primary); }
main input:is([type="checkbox"], [type="radio"]):not(.seg input, .levels input):focus-visible,
dialog input:is([type="checkbox"], [type="radio"]):not(.seg input, .levels input):focus-visible { outline: 3px solid var(--focus); outline-offset: -6px; }
main input:is([type="checkbox"], [type="radio"]):not(.seg input, .levels input):disabled::before,
dialog input:is([type="checkbox"], [type="radio"]):not(.seg input, .levels input):disabled::before { background: var(--surface-2); border-color: var(--line-strong); }
.report-tools .check { min-height: var(--tap); align-items: center; }

/* Family pages and grouped lists */
.goal-list { list-style: none; margin: var(--s4) 0 0; padding: 0; display: grid; gap: var(--s3); }
.goal-list > .card { display: grid; gap: var(--s2); justify-items: start; }
.goal-words { font-size: var(--fs-lg); }
@media (min-width: 900px) { body:not(.phone) .goal-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
[data-screen="S35"] .home { margin-top: var(--s5); padding: var(--s5); border-radius: var(--r-card); background: var(--warn-soft); display: grid; gap: var(--s2); }
[data-screen="S32"] .list { list-style: none; margin: var(--s4) 0 0; padding: 0; display: grid; gap: var(--s3); }
[data-screen="S32"] .list > li { border: 0; padding: var(--s4) var(--s5); background: var(--surface); border-radius: var(--pebble-a); box-shadow: var(--shadow); flex-wrap: wrap; gap: var(--s3); }
[data-screen="S29"] h2 { margin-top: var(--s5); margin-bottom: var(--s2); }
[data-screen="S29"] .list { margin: 0; padding: var(--s2) var(--s5); background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow); }
[data-screen="S29"] .list > li:first-child { border-top: 0; }
[data-screen="S16"] section + section { margin-top: var(--s6); }
[data-screen="S16"] [data-group] > :first-child { font-size: var(--fs-sm); font-weight: 700; color: var(--ink-2); }

/* ---------- 13c. One landing point: marigold only ever means "do this next" ---------- */
.demo-badge { background: transparent; color: var(--rail-ink); border: 1px solid var(--rail-soft); font-weight: 600; }
.nav a[aria-current="page"] { background: var(--rail-2); color: var(--rail-ink); box-shadow: inset 0 0 0 2px var(--rail-soft); }
@media (min-width: 900px) {
  body:not(.phone) .demo-badge { color: var(--ink-2); border-color: var(--line-strong); }
  body:not(.phone):has(> .nav[hidden]) .demo-badge { color: var(--rail-ink); border-color: var(--rail-soft); }
  body:not(.phone) .nav a[aria-current="page"], body:not(.phone) .nav a[aria-current="page"]:hover { background: var(--rail-2); color: var(--rail-ink); }
  /* Page head: text at the top, a smaller drawing, no gap opened between title and subtitle. */
  .page-head.has-art { grid-template-columns: minmax(0, 1fr) 190px; grid-template-rows: repeat(3, auto) 1fr; min-height: 0; align-items: start; }
  .page-head.has-art > .page-art { align-self: center; }
  .page-head.has-art:has(> .btn) { grid-template-columns: minmax(0, 1fr) auto 190px; column-gap: var(--s4); }
  .page-head.has-art:has(> .btn) > .btn { grid-column: 2; grid-row: 1; align-self: center; }
  .page-head.has-art:has(> .btn) > .page-art { grid-column: 3; }
}
@media (max-width: 899px) {
  [data-screen="S02"] #expected .list > li { width: 94%; }
}

/* Phone: page content fades out above the tab bar instead of peeking out under it. */
@media (max-width: 899px) {
  body::after { content: ""; position: fixed; left: 0; right: 0; bottom: 0; z-index: 8; height: calc(108px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 72%, transparent); pointer-events: none; }
  body:has(.nav[hidden])::after { display: none; }
  .savebar .ge-missing { font-size: var(--fs-sm); line-height: 1.35; }
  .savebar .row.ge-bar .btn { flex: 1 1 40%; white-space: normal; line-height: 1.15; }
}
@media print { body::after { display: none; } }

/* Save bars: docked on a solid ground so nothing shows through. */
.savebar { left: 0; right: 0; bottom: 0; border-radius: var(--r-card) var(--r-card) 0 0; padding: var(--s3) var(--s4) calc(88px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) {
  body:not(.phone) .savebar { bottom: 0; padding: var(--s3) var(--s5); border-radius: var(--r-card) var(--r-card) 0 0; margin-top: var(--s5); }
  body:not(.phone) [data-screen="S09"] .savebar { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); }
  body:not(.phone) [data-screen="S09"] .savebar .muted { margin: 0; }
  body:not(.phone) [data-screen="S09"] .savebar [data-save] { width: auto; min-width: 240px; }
}
/* Before the first tap the bar is one quiet line. */
[data-screen="S09"] .savebar:has([data-save][disabled]:not(:focus)) [data-save] { display: none; }
[data-screen="S09"] .savebar:has([data-save][disabled]:not(:focus)) .muted { margin: 0; text-align: center; }

/* Family report page */
[data-screen="S12"] label.field:has(> select) { max-width: 300px; margin-bottom: var(--s3); }
[data-screen="S12"] .sheet { margin-top: var(--s5); }
.sheet .home:has(> p:empty) { display: none; }
.report-tools .btn { min-height: 48px; line-height: 1.15; }
.report-tools > .check, .report-tools > .muted { flex-basis: 100%; }
.report-tools > .muted { max-width: 72ch; margin-top: -6px; }
[data-screen="S12"] p:not(.sheet p) { max-width: 72ch; }
.report-tools [data-share-hint]:empty { display: none; }
@media (max-width: 519px) {
  .report-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-tools .btn { width: 100%; padding-inline: 10px; }
  .report-tools > :not(.btn) { grid-column: 1 / -1; }
}

/* Reason for opening a record: one panel, one heading. */
[data-screen="S31"] #access { position: relative; }
[data-screen="S31"] #access > p:first-of-type { padding-right: 96px; }
[data-screen="S31"] dialog.dialog[open] { position: static; display: block; width: auto; max-width: none; margin: var(--s4) 0 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: inherit; box-shadow: none; overflow: visible; }
[data-screen="S31"] dialog.dialog > .row-between { display: contents; }
[data-screen="S31"] dialog.dialog h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[data-screen="S31"] .dialog-close { position: absolute; top: var(--s3); right: var(--s3); }
[data-screen="S31"] dialog form .btn-primary { justify-self: start; }

/* Reviews and reports: two lists side by side, each row a name, a date and a way in. */
[data-screen="S16"] [data-group] { gap: var(--s2); }
[data-screen="S16"] a.tile { display: flex; align-items: center; gap: var(--s3); min-height: 56px; padding: var(--s2) var(--s4); border-radius: var(--r-control); }
[data-screen="S16"] a.tile .tile-name { font-size: var(--fs-lg); }
[data-screen="S16"] a.tile .muted { margin-left: auto; text-align: right; }
[data-screen="S16"] a.tile::after { content: ""; flex: none; width: 8px; height: 8px; border: solid var(--primary); border-width: 2px 2px 0 0; transform: rotate(45deg); }
@media (min-width: 900px) {
  body:not(.phone) [data-screen="S16"] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4) var(--s6); align-items: start; }
  body:not(.phone) [data-screen="S16"] > .page-head { grid-column: 1 / -1; }
  body:not(.phone) [data-screen="S16"] section + section { margin-top: 0; }
}

/* Children: a labelled search beside the filters */
#children-q { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2385749F' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 14px center; background-size: 20px; padding-left: 44px; }
@media (min-width: 900px) {
  body:not(.phone) [data-screen="S03"] > .stack { display: grid; grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); gap: var(--s3) var(--s4); align-items: center; }
  body:not(.phone) [data-screen="S03"] > .stack > * { grid-column: 1 / -1; }
  body:not(.phone) [data-screen="S03"] > .stack > .field { grid-column: 1; }
  body:not(.phone) [data-screen="S03"] > .stack > .filter-row { grid-column: 2; }
}

/* Goal rows on the child page: where the child is now, then the aim. */
[data-screen="S04"] .part-row { grid-template-columns: minmax(0, 1fr) 132px; }
[data-screen="S04"] .part-row > .value { grid-column: 1; text-align: left; }
[data-screen="S04"] .part-row > svg { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.part-row .value-now { display: block; }
.part-row .value-sep { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.part-row .value-aim { display: block; font-weight: 500; font-size: var(--fs-sm); color: var(--ink-2); }

/* Staff and assignment rows */
:is([data-screen="S21"], [data-screen="S22"]) > p.muted.small { margin-bottom: var(--s4); }
[data-screen="S21"] tbody tr:has(td.row-actions > :not(p) + p.muted) ~ tr td.row-actions > :not(p) + p.muted { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (min-width: 900px) {
  table.table td.row-actions { display: table-cell; }
  table.table td.row-actions > .btn { margin-right: var(--s2); }
  [data-screen="S21"] table.table :is(th, td):first-child { min-width: 190px; }
  [data-screen="S21"] table.table td:nth-child(4) { white-space: nowrap; }
}
@media (max-width: 899px) {
  [data-screen="S22"] table.table tr { grid-template-columns: minmax(0, 1fr) 84px; }
  [data-screen="S22"] table.table td:nth-child(-n+2) { grid-column: 1 / -1; }
  [data-screen="S22"] table.table td.row-actions .btn { width: 100%; padding-inline: 8px; }
}

/* ---------- 13d. Second pass: docks, phone rows, desk rows, one rhythm ---------- */

/* One rhythm: cards never touch, chips never touch, a label sits with its own field. */
main :not(.cols, .goal-list, .row, .row-between) > .card + .card { margin-top: var(--s4); }
.chip + .chip { margin-left: 6px; }
:is(.chips, .row, .row-between) > .chip + .chip { margin-left: 0; }
td > .chip { margin: 0 6px 4px 0; }
td > .chip + .chip { margin-left: 0; }
.step-card > * + *, #assessment-form > * + * { margin-top: var(--s4); }
main form > .field + .btn { margin-top: var(--s4); }
[data-screen="S02"] #expected .list > li .grow .muted { text-wrap: balance; }
.goal-card > .row-between { justify-content: flex-start; gap: var(--s2) var(--s3); }

/* Docks: a clear top edge on any ground, and the buttons stay inside. */
.savebar { border-top: 2px solid var(--line-strong); }
.savebar .ge-missing:not(:empty) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
@media (min-width: 900px) {
  body:not(.phone) .intake-form > .savebar { grid-column: 1 / -1; }
  body:not(.phone) .intake-bar .row { flex-wrap: wrap; justify-content: flex-end; }
}

/* Session log: the prompt scale is one segmented stone, and the phone keeps the tally in view. */
.seg { gap: 0; }
.seg span { border-width: 2px; border-radius: 6px; }
.seg label + label span { border-left-width: 0; }
.seg label:first-of-type span { border-radius: 26px 6px 6px 30px; }
.seg label:last-of-type span { border-radius: 6px 30px 26px 6px; }
.seg input:focus-visible + span { outline-offset: -5px; }
.tally-out { flex-wrap: wrap; }
.tally-out output { white-space: nowrap; }
.tally-out > span { display: flex; flex: none; gap: 4px; margin-left: auto; }
.tally-out .btn { padding-inline: 10px; }
@media (max-width: 899px) {
  .tally-out output { font-size: var(--fs-lg); }
  [data-screen="S09"] .page-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--s2); align-items: center; }
  [data-screen="S09"] .page-head > * { grid-column: 1 / -1; margin-top: 0; }
  [data-screen="S09"] .page-head > h1 { grid-column: 1; grid-row: 2; font-size: 26px; }
  [data-screen="S09"] .page-head > .row { grid-column: 2; grid-row: 2; }
  [data-screen="S09"] .page-head > .row:has(select:not([hidden])) { grid-column: 1 / -1; grid-row: auto; }
  [data-screen="S09"] .page-head > .muted { line-height: 1.3; }
  [data-screen="S09"] .page-head > .muted:empty { display: none; }
  [data-screen="S09"] .savebar { display: grid; grid-template-columns: minmax(0, 1fr) 148px; align-items: center; gap: var(--s3); padding-top: var(--s2); }
  [data-screen="S09"] .savebar .muted { margin: 0; font-size: 14px; line-height: 1.25; font-weight: 500; }
  [data-screen="S09"] .savebar [data-save] { width: 100%; padding-inline: 8px; }
  [data-screen="S09"] .savebar:has([data-save][disabled]:not(:focus)) { grid-template-columns: minmax(0, 1fr); }
}

/* Children on a phone: one compact stone each. */
@media (max-width: 899px) {
  [data-screen="S03"] table.data.data-cards tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3) var(--s4); padding: var(--s4) var(--s5); margin-bottom: var(--s3); border-radius: var(--pebble-a); }
  [data-screen="S03"] table.data.data-cards tr:nth-child(even) { border-radius: var(--pebble-b); }
  [data-screen="S03"] table.data.data-cards td { padding: 0; min-width: 0; }
  [data-screen="S03"] table.data.data-cards td:nth-child(-n+2)::before { content: none; }
  [data-screen="S03"] table.data.data-cards td:first-child a { font-size: var(--fs-xl); color: var(--ink); text-decoration: none; }
  [data-screen="S03"] table.data.data-cards td:nth-child(2) { display: flex; flex-wrap: wrap; justify-content: flex-end; align-content: start; gap: 4px; }
  [data-screen="S03"] table.data.data-cards td:nth-child(2) > .chip { margin: 0; }
  [data-screen="S21"] table.table tr { grid-template-columns: auto minmax(0, 1fr); }
  [data-screen="S21"] table.table td:nth-child(-n+2) { grid-column: 1 / -1; }
}

/* The family report on a phone: the words get the width. */
@media screen and (max-width: 519px) {
  .sheet { padding: var(--s4); font-size: 16px; }
  .sheet header { display: block; }
  .sheet .sheet-month { text-align: left; margin-top: 4px; }
  .sheet .goal { padding: var(--s3) 0 0; background: transparent; border-radius: 0; border-top: 3px dotted #D2C4E6; }
  .sheet .goal ul { padding-left: 18px; }
}

/* Desk rows: use the width instead of stacking in the left quarter. */
@media (min-width: 900px) {
  body:not(.phone) .brand { background: var(--rail-bg); }
  body:not(.phone) [data-screen="S27"] #att-list { margin-top: var(--s4); }
  body:not(.phone) [data-screen="S27"] .child-row .grow { grid-template-columns: minmax(130px, 190px) auto minmax(220px, 340px) auto; column-gap: var(--s4); align-items: center; }
  body:not(.phone) [data-screen="S27"] .child-row .grow > b { grid-column: 1; grid-row: 1; }
  body:not(.phone) [data-screen="S27"] .child-row .grow > .status { grid-column: 1; grid-row: 2; }
  body:not(.phone) [data-screen="S27"] .child-row .grow > .row { grid-column: 2; grid-row: 1 / span 2; flex-wrap: nowrap; }
  body:not(.phone) [data-screen="S27"] .child-row .grow > .field { grid-column: 3; grid-row: 1 / span 2; max-width: none; }
  body:not(.phone) [data-screen="S27"] .child-row .grow > .btn { grid-column: 4; grid-row: 1 / span 2; align-self: end; }
  body:not(.phone) [data-screen="S27"] .child-row .grow > .field-error { grid-column: 1 / -1; }
  body:not(.phone) [data-screen="S14"] > .stack-lg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s5); align-items: start; }
  body:not(.phone) [data-screen="S14"] > .stack-lg > * { grid-column: 1 / -1; margin-top: 0; }
  body:not(.phone) [data-screen="S14"] > .stack-lg > :nth-child(-n+2) { grid-column: auto; }
  body:not(.phone) [data-screen="S31"] { max-width: 720px; margin-inline: auto; }
  body:not(.phone) #assessment-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4) var(--s5); max-width: 920px; align-items: start; }
  body:not(.phone) #assessment-form > * { grid-column: 1 / -1; margin-top: 0; }
  body:not(.phone) #assessment-form > div:has(> .field):not(:has(textarea)) { grid-column: auto; }
  body:not(.phone) main :is(.card, form):has(> .field ~ .field ~ .field ~ .field) > .btn { margin-top: 0; justify-self: start; }
}

/* ---------- 13e. Third pass: nothing clipped, quiet stays quiet, the width is used ---------- */

/* Quiet stays quiet when it is off, and an off button never looks like an outline button. */
.btn-quiet[disabled], .btn-quiet[aria-disabled="true"] { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn[disabled]:not(.btn-quiet), .btn[aria-disabled="true"]:not(.btn-quiet) { border-color: transparent; }

/* A quiet text button lines up with the edge it belongs to. */
main .row > .btn-quiet:first-child, main .row-actions > .btn-quiet:first-child, main .card > .btn-quiet { margin-inline-start: -12px; }
.savebar .row > .btn-quiet:first-child, [data-screen="S32"] .row-actions > .btn-quiet:first-child { margin-inline-start: 0; }
[data-screen="S32"] .row-actions .btn-quiet { border-color: var(--primary); background: var(--surface); padding-inline: 16px; }
[data-screen="S32"] .row-actions .btn-quiet:hover { background: var(--primary-soft); border-color: var(--primary); }

/* Form rhythm: legends read as labels, and every button and card keeps one gap. */
main legend { padding: 0; font-weight: 600; margin-bottom: 6px; }
main fieldset:not(.fieldset) { margin-inline: 0; padding-inline: 0; }
main .thennow + *, main p.muted + .card, main .page-head + .card, [data-screen="S27"] #att-list { margin-top: var(--s4); }
[data-screen="S14"] #gaps .btn-primary, [data-screen="S14"] #form-cadence > .btn { margin-top: var(--s4); }
[data-screen="S14"] :is(#gaps, #form-cadence, #therapists) .btn-primary { background: var(--surface); border-color: var(--primary); color: var(--primary); box-shadow: none; }
[data-screen="S14"] :is(#gaps, #form-cadence, #therapists) .btn-primary:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

/* Reviews: a group with nothing in it does not paint its heading. */
[data-screen="S16"] [data-group]:not(:has(> :nth-child(2))) { display: none; }

/* Access reason: Cancel sits level with the main button, so the text keeps the width. */
[data-screen="S31"] #access > p:first-of-type { padding-right: 0; }
[data-screen="S31"] .dialog-close { top: auto; right: var(--s4); bottom: calc(var(--s5) + 2px); }

/* The goal editor's dock keeps the reason readable. */
.savebar .ge-missing:not(:empty) { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; white-space: normal; overflow: hidden; }

/* Centre: stones for the four figures, and tables that are never cut off. */
[data-screen="S13"] .cols-4 > .tile:nth-child(odd) { border-radius: var(--pebble-a); }
[data-screen="S13"] .cols-4 > .tile:nth-child(even) { border-radius: var(--pebble-b); }
@media (max-width: 899px) {
  [data-screen="S13"] table.data.data-cards tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2) var(--s4); padding: var(--s3) var(--s4); margin-bottom: var(--s2); border-radius: var(--r-card); }
  [data-screen="S13"] table.data.data-cards td { padding: 0; min-width: 0; }
  [data-screen="S13"] table.data.data-cards td:first-child { grid-column: 1 / -1; font-size: var(--fs-lg); }
  [data-screen="S13"] table.data.data-cards td:first-child::before { content: none; }
  .auth-room { display: block; width: min(240px, 70%); margin: var(--s5) auto 0; }
}
@media (min-width: 900px) {
  body:not(.phone) [data-screen="S13"] .cols-2 { grid-template-columns: minmax(0, 1.45fr) minmax(360px, 1fr); }
  body:not(.phone) [data-screen="S13"] aside .table-wrap { overflow: visible; }
  body:not(.phone) [data-screen="S13"] aside table.data { width: 100%; }
  body:not(.phone) [data-screen="S13"] aside table.data :is(th, td) { padding-inline: 6px; white-space: normal; }

  /* Rows line up on the input, whatever sits above it. */
  body:not(.phone) #assessment-form { align-items: end; }
  body:not(.phone) .intake-form > .card + .card { margin-top: 0; }
  body:not(.phone) [data-screen="S27"] .child-row .grow { align-items: end; }
  body:not(.phone) [data-screen="S27"] .child-row .grow > .row { align-self: end; }

  /* Goal timeline: the three cards share their rows, and Start sits over Latest. */
  body:not(.phone) .cols-3:has(> .card-accent .thennow) { row-gap: 0; }
  body:not(.phone) .cols-3 > .card-accent:has(> .thennow) { display: grid; grid-row: span 5; grid-template-rows: subgrid; row-gap: var(--s2); }
  body:not(.phone) .cols-3 > .card-accent > .thennow { grid-template-columns: minmax(0, 1fr); align-self: end; }
  body:not(.phone) .cols-3 > .card-accent > .thennow > span { display: none; }
}
@media (min-width: 1200px) {
  body:not(.phone) section.plan-group { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
  body:not(.phone) section.plan-group > :not(.goal-card) { grid-column: 1 / -1; }
  body:not(.phone) section.plan-group > .card + .card { margin-top: 0; }
  body:not(.phone) [data-screen="S24"] > div:has(> #fh-expected) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s5); align-items: start; }
  body:not(.phone) [data-screen="S24"] > div:has(> #fh-expected) > :not(.card) { grid-column: 1 / -1; }
  body:not(.phone) [data-screen="S24"] > div:has(> #fh-expected) > .card + .card { margin-top: 0; }
}

/* The report: the paper leads, the tools sit in a rail beside it. The parent's page shares one edge. */
@media screen and (min-width: 1200px) {
  body:not(.phone) [data-screen="S12"]:has(> .sheet) { display: grid; grid-template-columns: minmax(0, 1fr) 300px; grid-template-rows: repeat(4, auto) 1fr; column-gap: var(--s5); align-items: start; }
  body:not(.phone) [data-screen="S12"]:has(> .sheet) > .screen-only { display: contents; }
  body:not(.phone) [data-screen="S12"] .screen-only > .page-head { grid-column: 1 / -1; grid-row: 1; }
  body:not(.phone) [data-screen="S12"] .screen-only > :not(.page-head) { grid-column: 2; }
  body:not(.phone) [data-screen="S12"]:has(> .sheet) > .sheet { grid-column: 1; grid-row: 2 / -1; width: 100%; margin: 0; }
  body:not(.phone) [data-screen="S12"] .report-tools { display: grid; grid-template-columns: minmax(0, 1fr); }
  body:not(.phone) [data-screen="S12"] .report-tools .btn { width: 100%; }
}
@media screen and (min-width: 900px) {
  body:not(.phone) [data-screen="S34"]:has(> .sheet) { max-width: 210mm; margin-inline: auto; }
}

/* ---------- 13f. Fourth pass: the reader's facts on a phone, and amber belongs to OT ---------- */

/* Attention is an outline, so filled amber only ever means occupational therapy. */
.status-warn { background: transparent; box-shadow: inset 0 0 0 1.5px var(--warn); }
p.status { white-space: normal; }
.keep-together { white-space: nowrap; }
::placeholder { color: var(--ink-2); opacity: 1; }
[data-screen="S21"] #invite { margin-top: var(--s4); }
.seg span { justify-content: flex-start; padding-top: 8px; }
body:has([data-screen="S18"], [data-screen="S19"], [data-screen="S33"]) .brand-name { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
[data-screen="S27"] .child-row .row > .btn-quiet:first-child { margin-inline-start: 0; }

/* Settings: one form reads as one card, with its Save at the foot. */
[data-screen="S14"] #form-cadence { padding: var(--s5); background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow); }
[data-screen="S14"] #form-cadence .card { padding: 0; background: transparent; box-shadow: none; border-radius: 0; }
[data-screen="S14"] #form-cadence .form-gap { margin-top: var(--s5); }

/* Phone: the child's goal rows and the logged stone keep their words whole. */
@media (max-width: 519px) {
  [data-screen="S04"] .part-row { grid-template-columns: minmax(0, 1fr); }
  [data-screen="S04"] .part-row > svg { grid-column: 1; grid-row: auto; width: 100%; max-width: 200px; height: auto; }
  [data-screen="S04"] .part-row > div:first-child .chip { display: flex; width: fit-content; margin-bottom: 4px; }
  [data-screen="S02"] .today-line > .status { display: flex; width: fit-content; margin-bottom: 4px; }
}

/* Report below the rail width: the paper comes straight after the month, the tools after the paper. */
.never-card { padding: 0; background: transparent; box-shadow: none; }
@media screen and (max-width: 1199px) {
  [data-screen="S12"]:has(> .sheet) { display: flex; flex-direction: column; gap: var(--s3); }
  [data-screen="S12"]:has(> .sheet) > .screen-only:not(.never-card) { display: contents; }
  [data-screen="S12"] .screen-only > .page-head { order: 1; }
  [data-screen="S12"] .screen-only > label.field { order: 2; margin-bottom: 0; }
  [data-screen="S12"]:has(> .sheet) > .sheet { order: 3; width: 100%; margin-top: 0; }
  [data-screen="S12"] .screen-only > .report-tools { order: 4; margin-top: var(--s3); }
  [data-screen="S12"] .screen-only > :not(.page-head, label.field, .report-tools) { order: 5; }
  [data-screen="S12"]:has(> .sheet) > .never-card { order: 6; margin-top: 0; }
}

@media (min-width: 900px) {
  /* Attendance: the date's label and hint show once, at the top of the column. */
  body:not(.phone) [data-screen="S27"] .child-row + .child-row .grow > .field > :is(.label, .hint) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  /* A header with no lead of its own keeps a smaller drawing, so the lead below sits right under the title. */
  .page-head.has-art:not(:has(> p, > div > p, > .btn)) { grid-template-columns: minmax(0, 1fr) 112px; }
}

/* ---------- 13g. Last details ---------- */
.checklist li { grid-template-columns: 84px minmax(0, 1fr); }
[data-screen="S27"] > .row { margin-top: var(--s3); }
@media (max-width: 899px) {
  /* The report is white paper in both themes, so the tab bar's ground stops cleanly instead of fading over it. */
  body:has([data-screen="S12"], [data-screen="S34"])::after { background: linear-gradient(to top, var(--bg) 84px, transparent 84px); }
}
@media (min-width: 900px) {
  /* Attendance: name and status sit together on the same line as the buttons and the date, in every row. */
  body:not(.phone) [data-screen="S27"] .child-row .grow { grid-template-rows: 1fr auto auto; row-gap: 2px; }
  body:not(.phone) [data-screen="S27"] .child-row .grow > b { grid-row: 2; }
  body:not(.phone) [data-screen="S27"] .child-row .grow > .status { grid-row: 3; }
  body:not(.phone) [data-screen="S27"] .child-row .grow > :is(.row, .field, .btn) { grid-row: 1 / -1; align-self: end; }
}

/* ---------- 13h. Blocked states: the reason is seen where the person is ---------- */
#banners:has(.banner) { margin-bottom: var(--s4); }
[data-screen="S29"] .card > .row + [role="status"] { margin-top: var(--s3); font-size: var(--fs-md); color: var(--ink); }
@media screen {
  /* The report's Copy and Print sit far down the page, so its message stays in view, flush under the top bar on a strip of page ground. */
  body:has([data-screen="S12"]) #banners { position: sticky; top: 60px; z-index: 9; }
  body:has([data-screen="S12"]) #banners:has(.banner) { background: var(--bg); padding-block: var(--s2); margin-bottom: var(--s2); }
  body:has([data-screen="S12"]) #banners .banner { box-shadow: var(--shadow-lift); font-size: var(--fs-md); }
}
@media screen and (min-width: 900px) {
  body:not(.phone):has([data-screen="S12"]) #banners { top: 72px; }
}

/* ---------- 14. Motion: small, and only when it is welcome ---------- */
@media (prefers-reduced-motion: no-preference) {
  .btn, .tally-btn, .seg span, .levels .lv, a.tile, .nav a, .input { transition: background-color 140ms var(--ease-out), border-color 140ms var(--ease-out), box-shadow 140ms var(--ease-out), transform 140ms var(--ease-out); }
}
@media (prefers-reduced-motion: reduce) {
  .btn:active, a.tile:hover { transform: none; }
}

/* ---------- 15. Print: the report stays dark on white, and the shell's art goes ---------- */
@media print {
  .page-art, .auth-room { display: none !important; }
  body { font-family: var(--font); }
  .sheet { border-radius: 0; box-shadow: none; }
  .sheet .goal { background: #F6F2FB; }
}

/* ── Phase 19 ── */
/* S40 notice page: a white sheet that prints on one A4 page (plan 19-06). */
.notice-sheet { padding: var(--s5); max-width: 72ch; }
.notice-sheet .notice-section { margin-top: var(--s4); }
.notice-sheet h2 { font-size: 18px; font-weight: 700; }
.notice-sheet p { margin-top: var(--s2); }
.notice-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); margin-bottom: var(--s3); }
.notice-tools .is-current { font-weight: 700; text-decoration: underline; }
.notice-status { margin-bottom: var(--s3); }
/* S39 consent capture: five steps stacked in one column (plan 19-06). */
.consent-form { display: grid; gap: var(--s4); max-width: 72ch; }
.step-card { display: grid; gap: var(--s3); padding: var(--s4); background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-lift); }
.step-card .step-count { order: -1; }
.step-card h2 { font-size: 20px; font-weight: 700; }
.notice-holder { max-height: 320px; overflow-y: auto; padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r-control); }
@media (min-width: 900px) { .notice-holder { max-height: 420px; } }
@media print {
  .notice-tools, .notice-status, [data-screen="S40"] .banner { display: none !important; }
  .notice-sheet { font-size: 11pt; box-shadow: none; padding: 0; max-width: none; }
  .notice-sheet .notice-section { break-inside: avoid; margin-top: 8pt; }
}
/* S41 rights queue, S43 retention decisions (plan 19-07). */
.rights-list { display: grid; gap: var(--s3); list-style: none; padding: 0; margin: 0; }
.rights-row { display: grid; gap: var(--s2); padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r-control); }
.rights-row-actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.retention-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r-control); }
.retention-form { display: grid; gap: var(--s3); max-width: 72ch; }
/* S44 incident log: the three notice reminders (plan 19-08). */
.reminder-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.reminder-list li { padding: 10px 12px; background: var(--surface-2); border-radius: var(--r-control); }

/* parent screens S36 to S38 (19-09) */
.parent-links { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s4); }
.consent-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); padding: var(--s2) 0; }
.consent-purpose { font-weight: 600; }
.request-item { display: grid; gap: var(--s1); padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r-control); list-style: none; }
.request-item p { margin: 0; }


/* ── Phase 20 ── */
/* S48 centre settings: one card per slot, spaced by the stack. */
.settings-section { display: block; margin: 0; }
.settings-section .check { margin-top: var(--s2); }
.settings-section .check + .muted { margin: var(--s1) 0 var(--s3); }

/* Centre switcher in the top bar (plan 20-05 fills it). */
.centre-switcher { min-height: var(--tap); padding: 0 var(--s3); border: 1px solid var(--line); border-radius: var(--r-control); background: var(--surface); color: inherit; font: inherit; }

/* Idle warning: the banner colours with a primary edge (plan 20-05). */
.idle-warning { border-inline-start: 4px solid var(--primary); }

/* S14 no longer holds the centre and cadence cards, so its first two children no longer pair up on the desk grid. */
body:not(.phone) [data-screen="S14"] > .stack-lg > :nth-child(-n+2) { grid-column: 1 / -1; }


/* ── Phase 20.1 ── */
/* The font picker (app/ui/font-picker.js): a real fieldset of native radios, one whole-row label per option. */
.font-picker { min-width: 0; }
.font-picker-set { border: 0; margin: 0; padding: 0; min-width: 0; }
.font-picker-set > legend { padding: 0; font-weight: 700; }
/* Account: the card title already says "Your font", so the legend is read out but not drawn twice. */
.font-picker:not(.has-preview) .font-picker-set > legend { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.font-hint { margin-top: 2px; color: var(--ink-2); max-width: 60ch; }
.font-options { display: grid; gap: var(--s2); margin-top: var(--s4); }
.font-option { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: var(--s3); align-items: start; min-height: 64px; padding: 12px 14px; border: 2px solid var(--line-strong); border-radius: var(--r-control); background: var(--surface); cursor: pointer; transition: background-color .12s, border-color .12s; }
.font-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.font-option:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.font-option:has(input:disabled) { cursor: default; }
/* the radio: a 44px target around a 24px stone, filled with a dot when chosen (the level stones' language) */
.font-option input { appearance: none; -webkit-appearance: none; position: relative; grid-column: 1; grid-row: 1 / span 3; width: 44px; height: 44px; margin: -8px 0 -8px -8px; padding: 0; border: 0; background: transparent; cursor: inherit; outline: none; }
.font-option input::before { content: ""; position: absolute; inset: 10px; border: 2px solid var(--line-strong); border-radius: 50%; background: var(--surface); }
.font-option input:checked::before { background: var(--primary); border-color: var(--primary); }
.font-option input:checked::after { content: ""; position: absolute; inset: 17px; border-radius: 50%; background: var(--on-primary); }
.font-option-name { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-weight: 700; overflow-wrap: break-word; }
.font-option-note { grid-column: 2; color: var(--ink-2); }
.font-option-sample { grid-column: 2; margin-top: 6px; font-size: var(--fs-lg); line-height: 1.35; overflow-wrap: break-word; }
.font-tag { display: inline-flex; align-items: center; padding: 2px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: var(--surface); color: var(--ink); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0; white-space: nowrap; }
.font-tag:empty { display: none; }
/* only the sample line is set in the option's own font; the name and note keep the person's current font */
.font-option[data-font="parkinsans"] .font-option-sample, .font-preview[data-font="parkinsans"] { font-family: var(--font-parkinsans); }
.font-option[data-font="lexend"] .font-option-sample, .font-preview[data-font="lexend"] { font-family: var(--font-lexend); }
.font-option[data-font="noto"] .font-option-sample, .font-preview[data-font="noto"] { font-family: var(--font-noto); }
.font-option[data-font="device"] .font-option-sample, .font-preview[data-font="device"] { font-family: var(--font-system); }
/* Centre: Save sits quiet until the choice differs, then turns to the marigold action colour */
.font-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); margin-top: var(--s4); }
.font-actions.is-dirty .btn:not([disabled]) { background: var(--action); border-color: var(--action); color: var(--on-action); font-weight: 700; }
.font-actions.is-dirty .btn:not([disabled]):hover { background: var(--action-hover); border-color: var(--action-hover); }
.font-actions .font-status { margin-top: 0; flex: 1 1 0; min-width: 0; }
#account-font-msg { margin-top: var(--s3); }
/* Account: what is on now and the way back sit above the options; the height is held so the list does not jump */
.font-now { display: flex; flex-wrap: wrap; align-items: center; align-content: start; gap: var(--s2) var(--s4); min-height: 104px; margin-top: var(--s3); }
.font-now .font-status { margin-top: 0; }
.font-now .font-status span { display: block; }
.font-status { margin-top: var(--s3); font-weight: 600; }
.font-status:empty { display: none; }
/* the live preview: a corner of the family report, on its own white paper in both themes (it is the .sheet) */
.font-preview-wrap { margin-top: var(--s4); }
.font-preview-label { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); margin-bottom: var(--s2); }
.font-preview.sheet { max-width: none; margin: 0; padding: var(--s4); border-radius: var(--r-control); box-shadow: none; font-size: var(--fs-md); text-align: left; }
.font-preview header { border-bottom-width: 3px; }
.font-preview h4 { margin: 0; font-size: var(--fs-md); font-weight: 700; }
/* the preview keeps the real sheet's spacing: goal heading near the tray edge, bullets close under it, "What we saw:" inline */
.font-preview .goal ul { margin: 6px 0 0; padding-left: 18px; }
.font-preview .goal li { margin-top: 3px; }
.font-preview .saw h4, .font-preview .saw p { display: inline; }
.font-preview .saw h4 { font-weight: 700; margin-right: .3em; }
@media (min-width: 520px) { .font-preview .goal { border-radius: var(--r-control); } }
@media (hover: hover) {
  .font-option:not(:has(input:disabled)):hover { border-color: var(--primary); }
}
@media (min-width: 640px) {
  .font-options.is-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .font-now { min-height: 48px; }
}
@media (min-width: 900px) {
  /* options and Save on the left, the preview on the right spanning both */
  .font-picker.has-preview { display: grid; grid-template-columns: 5fr 6fr; column-gap: var(--s6); align-items: start; }
  .font-picker.has-preview .font-preview-wrap { grid-column: 2; grid-row: 1 / span 2; margin-top: 0; }
  .font-picker.has-preview .font-actions { grid-column: 1; }
}
@media (max-width: 899px) {
  /* an unsaved choice, and the "Saved" line after it, stay in view while the Admin reads the preview */
  .font-actions.is-stuck { position: sticky; bottom: calc(82px + env(safe-area-inset-bottom)); z-index: 2; flex-wrap: nowrap; margin-inline: calc(-1 * var(--s5)); padding: var(--s3) var(--s5) calc(var(--s3) + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line-strong); }
  .font-actions.is-stuck .font-status { font-size: var(--fs-sm); line-height: 1.35; }
}
/* Without :has the row keeps its stone and the name still shows the choice and the focus */
@supports not selector(:has(*)) {
  .font-option input:checked + .font-option-name { color: var(--primary); }
  .font-option input:focus-visible + .font-option-name { outline: 3px solid var(--focus); outline-offset: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  .font-option { transition: none; }
}
@media (forced-colors: active) { .font-option input { appearance: auto; } .font-option input::before, .font-option input::after { display: none; } }


/* ── Phase 21 ── */

/* Environment tag on test and staging builds (plan 21-03): a small label centred on the top edge, 1.4rem high, never takes a tap. */
.env-tag { position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 50; max-height: 1.4rem; padding: 0 var(--s2); border-radius: 0 0 var(--r-control) var(--r-control); background: var(--primary-soft); color: var(--primary); font-size: var(--fs-xs); line-height: 1.4rem; font-weight: 600; pointer-events: none; }


/* ── Phase 21.1 ── */
/* First-run checklist (plan 21.1-04, S51): the number sits beside the text, the button under it; nothing wider than the phone. */
.start-steps > li { flex-wrap: nowrap; align-items: flex-start; padding: var(--s4) 0; }
.start-steps > li .grow > p { margin: var(--s1) 0 0; }
.start-steps > li .start-action { margin-top: var(--s3); }
/* Sandbox banner (plan 21.1-07): the shell's permanent banner, drawn only while the centre is a sandbox. */
#sandbox-banner { margin-bottom: var(--s3); font-weight: 600; }
.register-form > [data-sandbox-line] { margin: 0 0 var(--s3); }
