/* QS PetalStep — one stylesheet for the prototype and the build.
   Mobile-first. Desktop layout starts at 900px. Add class "phone" on <body> to pin the phone layout.
   No web fonts, no external assets. Tokens first; components below; print rules last. */

/* ---------- 1. Tokens ---------- */
:root {
  color-scheme: light;
  /* surfaces */
  --bg: #F7F4EE;
  --surface: #FFFFFF;
  --surface-2: #F1EDE5;
  --line: #DDD6CA;
  --line-strong: #B9B0A1;
  /* text */
  --ink: #1E2A2F;
  --ink-2: #55636B;
  /* brand / actions */
  --primary: #0E6E64;
  --primary-hover: #0A5A52;
  --on-primary: #FFFFFF;
  --primary-soft: #DCEFEC;
  --focus: #1B4FD6;
  /* disciplines: always shown with the text label, never colour alone */
  --physio: #1F5FA8;   --physio-soft: #E6EFF9;
  --speech: #8E3A80;   --speech-soft: #F6E9F3;
  --ot: #9A5200;       --ot-soft: #FBEEDC;
  /* status: always with a text label */
  --ok: #2B6A3C;       --ok-soft: #E3F1E6;
  --warn: #8A5300;     --warn-soft: #FFF1D6;
  --danger: #A8322A;   --danger-soft: #FBE7E4;
  /* shape and type */
  --r-control: 10px;
  --r-card: 16px;
  --shadow: 0 1px 2px rgba(30, 42, 47, .06), 0 2px 8px rgba(30, 42, 47, .04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --fs-xs: 13px; --fs-sm: 14px; --fs-md: 16px; --fs-lg: 18px; --fs-xl: 22px; --fs-2xl: 28px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --tap: 48px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #12181B; --surface: #1B2327; --surface-2: #232D32; --line: #34424A; --line-strong: #55666F;
    --ink: #E8EDEF; --ink-2: #A7B4BB;
    --primary: #63CDBF; --primary-hover: #7EDACD; --on-primary: #06211E; --primary-soft: #16332F; --focus: #9DB8FF;
    --physio: #8FBCEF; --physio-soft: #17293D;
    --speech: #E3A6D7; --speech-soft: #34192F;
    --ot: #F2B872; --ot-soft: #35240D;
    --ok: #8BD09B; --ok-soft: #16301C;
    --warn: #F0C36B; --warn-soft: #33270C;
    --danger: #F2A199; --danger-soft: #3A1815;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12181B; --surface: #1B2327; --surface-2: #232D32; --line: #34424A; --line-strong: #55666F;
  --ink: #E8EDEF; --ink-2: #A7B4BB;
  --primary: #63CDBF; --primary-hover: #7EDACD; --on-primary: #06211E; --primary-soft: #16332F; --focus: #9DB8FF;
  --physio: #8FBCEF; --physio-soft: #17293D;
  --speech: #E3A6D7; --speech-soft: #34192F;
  --ot: #F2B872; --ot-soft: #35240D;
  --ok: #8BD09B; --ok-soft: #16301C;
  --warn: #F0C36B; --warn-soft: #33270C;
  --danger: #F2A199; --danger-soft: #3A1815;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: var(--fs-md)/1.45 var(--font); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: var(--fs-2xl); line-height: 1.2; font-weight: 700; letter-spacing: -.01em; text-wrap: balance; }
h2 { font-size: var(--fs-lg); line-height: 1.3; font-weight: 700; }
h3 { font-size: var(--fs-md); line-height: 1.35; font-weight: 650; }
a { color: var(--primary); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--ink-2); }
.small { font-size: var(--fs-sm); }
.num { font-variant-numeric: tabular-nums; }
.eyebrow { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: var(--s3) var(--s4); z-index: 20; }
.skip:focus { left: var(--s2); top: var(--s2); }
.stack > * + * { margin-top: var(--s4); }
.stack-lg > * + * { margin-top: var(--s5); }
.row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }

/* ---------- 3. App shell ---------- */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s4); min-height: 56px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.demo-badge { font-size: var(--fs-xs); font-weight: 650; color: var(--warn); background: var(--warn-soft); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.who { margin-left: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; display: inline-flex; align-items: center; gap: var(--s2); min-height: 40px; padding: 4px 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink); text-decoration: none; font-size: var(--fs-sm); font-weight: 650; white-space: nowrap; }
.demo-badge .wide { display: none; }
@media (min-width: 560px) { .demo-badge .wide { display: inline; } }
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 60px; color: var(--ink-2); text-decoration: none; font-size: var(--fs-xs); font-weight: 650; border-top: 3px solid transparent; }
.nav a[aria-current="page"] { color: var(--primary); border-top-color: var(--primary); }
.nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
main { padding: var(--s4); padding-bottom: 104px; max-width: 1120px; margin: 0 auto; }
.page-head { margin-bottom: var(--s5); }
.page-head h1 + p { margin-top: var(--s1); }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); color: var(--ink-2); text-decoration: none; font-weight: 650; font-size: var(--fs-sm); }
.cols { display: grid; gap: var(--s5); grid-template-columns: minmax(0, 1fr); }

body.phone { max-width: 430px; margin: 0 auto; min-height: 100vh; border-inline: 1px solid var(--line); }
body.phone .nav, body.phone .savebar { max-width: 428px; margin: 0 auto; }

@media (min-width: 900px) {
  body:not(.phone) { display: grid; grid-template-columns: 216px 1fr; grid-template-rows: auto 1fr; min-height: 100vh; }
  body:not(.phone) .topbar { grid-column: 1 / -1; padding-inline: var(--s5); }
  body:not(.phone) .nav { position: sticky; top: 57px; align-self: start; grid-auto-flow: row; grid-auto-columns: auto; border-top: 0; border-right: 1px solid var(--line); height: calc(100vh - 57px); align-content: start; padding: var(--s4) var(--s3); gap: var(--s1); }
  body:not(.phone) .nav a { flex-direction: row; justify-content: flex-start; gap: var(--s3); min-height: var(--tap); padding: 0 var(--s3); border-top: 0; border-radius: var(--r-control); font-size: var(--fs-md); }
  body:not(.phone) .nav a[aria-current="page"] { background: var(--primary-soft); }
  body:not(.phone) main { padding: var(--s6) var(--s6) var(--s7); margin: 0; width: 100%; }
  body:not(.phone) .cols-2 { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; }
  body:not(.phone) .cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body:not(.phone) .cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- 4. Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: var(--tap); padding: 0 18px; border-radius: var(--r-control); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-weight: 650; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-lg { min-height: 56px; padding: 0 24px; font-size: var(--fs-lg); }
.btn-block { display: flex; width: 100%; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--primary); padding: 0 10px; }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

/* ---------- 5. Chips, tags, status ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 650; background: var(--surface-2); color: var(--ink); white-space: nowrap; }
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chip-physio { background: var(--physio-soft); color: var(--physio); }
.chip-speech { background: var(--speech-soft); color: var(--speech); }
.chip-speech::before { border-radius: 2px; }                 /* square: shape differs as well as colour */
.chip-ot { background: var(--ot-soft); color: var(--ot); }
.chip-ot::before { border-radius: 0; transform: rotate(45deg); } /* diamond */
.chip-plain::before { display: none; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--ink-2); }
.dot-physio { background: var(--physio); }
.dot-speech { background: var(--speech); border-radius: 2px; }
.dot-ot { background: var(--ot); border-radius: 0; transform: rotate(45deg); }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 8px; font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; }
.status-ok { background: var(--ok-soft); color: var(--ok); }
.status-warn { background: var(--warn-soft); color: var(--warn); }
.status-danger { background: var(--danger-soft); color: var(--danger); }
.status-info { background: var(--surface-2); color: var(--ink-2); }
.tag-invented { font-size: var(--fs-xs); font-weight: 650; color: var(--ink-2); border: 1px dashed var(--line-strong); border-radius: 6px; padding: 1px 8px; }

/* ---------- 6. Cards, lists, tiles ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--s4); box-shadow: var(--shadow); }
.card > h2 + *, .card > h3 + * { margin-top: var(--s3); }
.card-flat { box-shadow: none; background: var(--surface-2); border-color: transparent; }
.card-accent { border-left: 6px solid var(--primary); }
.card-accent.is-physio { border-left-color: var(--physio); }
.card-accent.is-speech { border-left-color: var(--speech); }
.card-accent.is-ot { border-left-color: var(--ot); }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.list > li:first-child { border-top: 0; }
.list-nowrap > li { flex-wrap: nowrap; align-items: baseline; }
.avatar { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 800; }
.tile { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--s4); text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.tile .big { display: block; font-size: 40px; line-height: 1.1; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tile .big small { font-size: var(--fs-lg); font-weight: 650; color: var(--ink-2); }
.banner { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r-control); background: var(--primary-soft); color: var(--ink); font-size: var(--fs-sm); }
.banner-warn { background: var(--warn-soft); }
.empty { text-align: center; padding: var(--s6) var(--s4); color: var(--ink-2); border: 1px dashed var(--line-strong); border-radius: var(--r-card); }
table.data { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
table.data th { text-align: left; font-size: var(--fs-xs); font-weight: 700; color: var(--ink-2); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
table.data td { padding: var(--s3); border-bottom: 1px solid var(--line); vertical-align: top; }
table.data td.num, table.data th.num { text-align: right; }
.table-wrap { overflow-x: auto; }
.tabs { display: flex; gap: var(--s1); overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: var(--s5); }
.tabs a { flex: none; min-height: var(--tap); display: inline-flex; align-items: center; padding: 0 var(--s4); color: var(--ink-2); text-decoration: none; font-weight: 650; border-bottom: 3px solid transparent; }
.tabs a[aria-current="page"] { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- 7. Forms ---------- */
.field { display: block; }
.field > .label, label.label { display: block; font-weight: 650; margin-bottom: 6px; }
.field .hint { display: block; font-size: var(--fs-sm); color: var(--ink-2); margin-bottom: 6px; }
.input, select.input, textarea.input { width: 100%; min-height: var(--tap); padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-control); background: var(--surface); }
textarea.input { min-height: 84px; resize: vertical; line-height: 1.4; }
.input-num { width: 96px; text-align: center; font-size: var(--fs-xl); font-weight: 700; font-variant-numeric: tabular-nums; }
.check { display: flex; gap: var(--s3); align-items: flex-start; min-height: var(--tap); padding: 10px 0; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--primary); flex: none; }
.steps { display: flex; gap: var(--s2); list-style: none; padding: 0; margin: 0 0 var(--s5); overflow-x: auto; }
.steps li { flex: none; font-size: var(--fs-sm); font-weight: 650; color: var(--ink-2); padding: 6px 12px; border-radius: 999px; background: var(--surface-2); }
.steps li[aria-current="step"] { background: var(--primary); color: var(--on-primary); }

/* Segmented control: 5 options, each a real radio. Used for cue level, independence, rating. */
.seg { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; border: 0; padding: 0; margin: 0; }
.seg label { position: relative; display: flex; }
.seg input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg span { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 60px; padding: 4px 2px; border: 1px solid var(--line-strong); border-radius: var(--r-control); background: var(--surface); font-size: 12px; font-weight: 650; line-height: 1.15; text-align: center; color: var(--ink-2); }
.seg span b { font-size: var(--fs-lg); color: var(--ink); }
.seg input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.seg input:checked + span b { color: var(--on-primary); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Tally: two large buttons and a running readout. */
.tally { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.tally-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 84px; border-radius: var(--r-card); border: 2px solid var(--line-strong); background: var(--surface); font-weight: 700; cursor: pointer; touch-action: manipulation; }
.tally-btn .n { font-size: 32px; line-height: 1; font-variant-numeric: tabular-nums; }
.tally-yes { border-color: var(--ok); color: var(--ok); background: var(--ok-soft); }
.tally-no { border-color: var(--line-strong); color: var(--ink); }
.tally-btn:active { transform: scale(.98); }
.tally-out { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.tally-out output { font-size: var(--fs-xl); font-weight: 800; font-variant-numeric: tabular-nums; }

/* Stepper (count) and stopwatch (duration). */
.stepper { display: flex; align-items: center; gap: var(--s3); }
.stepper button { width: 64px; height: 64px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); font-size: 28px; font-weight: 700; cursor: pointer; }
.stopwatch { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; }
.stopwatch .time { font-size: 36px; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 4.5ch; }

/* GAS levels: a vertical radio list. */
.levels { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.levels label { position: relative; display: block; }
.levels input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.levels .lv { display: grid; grid-template-columns: 44px 1fr; gap: var(--s3); align-items: center; min-height: 56px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-control); background: var(--surface); }
.levels .lv b { font-size: var(--fs-lg); font-variant-numeric: tabular-nums; text-align: center; }
.levels .lv small { display: block; font-size: var(--fs-xs); color: var(--ink-2); font-weight: 650; }
.levels input:checked + .lv { border: 2px solid var(--primary); background: var(--primary-soft); padding: 7px 11px; }
.levels input:focus-visible + .lv { outline: 3px solid var(--focus); outline-offset: 2px; }
.level-edit { display: grid; grid-template-columns: 88px 1fr; gap: var(--s3); align-items: start; }
.level-edit .lv-name { padding-top: 10px; font-weight: 700; }
.level-edit .lv-name small { display: block; font-weight: 500; color: var(--ink-2); font-size: var(--fs-xs); line-height: 1.25; }
.level-edit.is-zero { background: var(--primary-soft); border-radius: var(--r-control); padding: var(--s3); margin-inline: calc(var(--s3) * -1); }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: var(--fs-sm); }
.checklist li { display: grid; grid-template-columns: 64px 1fr; gap: var(--s2); align-items: baseline; }

/* ---------- 8. Goals and charts ---------- */
.goal-title { font-size: var(--fs-lg); font-weight: 700; line-height: 1.3; }
.contrib { display: grid; grid-template-columns: 1fr auto; gap: 2px var(--s3); align-items: center; padding: var(--s3) 0; border-top: 1px solid var(--line); }
.contrib .value { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.spark { width: 96px; height: 28px; }
.spark polyline { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--ink-2); font-size: 11px; font-family: var(--font); }
.chart .series { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart .pt { stroke: var(--surface); stroke-width: 2; }
.chart .ref { stroke: var(--ink-2); stroke-width: 1.5; stroke-dasharray: 4 4; }
.chart .ref-target { stroke: var(--primary); }
.chart .lbl { fill: var(--ink); font-size: 12px; font-weight: 700; font-family: var(--font); }
.s-physio { stroke: var(--physio); } .f-physio { fill: var(--physio); }
.s-speech { stroke: var(--speech); } .f-speech { fill: var(--speech); }
.s-ot { stroke: var(--ot); } .f-ot { fill: var(--ot); }
.thennow { display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--s2); align-items: center; }
.thennow div { background: var(--surface-2); border-radius: var(--r-control); padding: 6px 10px; }
.thennow .now { background: var(--primary-soft); }
.thennow small { display: block; font-size: var(--fs-xs); color: var(--ink-2); font-weight: 650; }
.thennow b { font-variant-numeric: tabular-nums; }

/* Session log: sticky Save bar above the tab bar. */
.savebar { position: fixed; left: 0; right: 0; bottom: 60px; z-index: 9; padding: var(--s3) var(--s4); background: var(--surface); border-top: 1px solid var(--line); }
.has-savebar main { padding-bottom: 200px; }
.savebar .row { flex-wrap: nowrap; }
.savebar .row .muted { display: none; }
.savebar .row .btn { flex: 1 1 auto; white-space: nowrap; padding-inline: 12px; }
@media (min-width: 900px) { body:not(.phone) .savebar .row .muted { display: inline; } body:not(.phone) .savebar .row .btn { flex: none; padding-inline: 24px; } }
@media (min-width: 900px) { body:not(.phone) .savebar { position: sticky; bottom: 0; grid-column: 2; } body:not(.phone).has-savebar main { padding-bottom: var(--s5); } }
.tscore { font-size: 44px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

/* ---------- 9. Parent report (screen preview and A4 print) ---------- */
.report-tools { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: center; margin-bottom: var(--s4); }
.sheet { background: #FFFFFF; color: #1E2A2F; max-width: 210mm; margin: 0 auto; padding: 12mm; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); font-size: 15px; line-height: 1.4;
  --ink-2: #55636B; --line: #DDD6CA; --surface-2: #F4F1EA; --primary: #0E6E64; --primary-soft: #DCEFEC;
  --physio: #1F5FA8; --physio-soft: #E6EFF9; --speech: #8E3A80; --speech-soft: #F6E9F3; --ot: #9A5200; --ot-soft: #FBEEDC; }
.sheet header { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s4); border-bottom: 3px solid var(--primary); padding-bottom: 8px; flex-wrap: wrap; }
.sheet h1 { font-size: 24px; }
.sheet h2 { font-size: 16px; margin-top: 12px; }
.sheet .goal { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; margin-top: 9px; break-inside: avoid; }
.sheet .goal h3 { font-size: 16px; }
.sheet .goal ul { margin: 6px 0 0; padding-left: 18px; }
.sheet .goal li { margin-top: 3px; }
.sheet .saw { margin-top: 6px; color: var(--ink-2); }
.sheet .home { margin-top: 12px; background: var(--primary-soft); border-radius: 10px; padding: 10px 14px; break-inside: avoid; }
.sheet footer { margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); display: grid; gap: 3px; }



/* ---------- 10. Added for the build: dialogs, side sheet, rows, chart table, errors ---------- */
dialog.dialog, dialog.side-sheet { border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: var(--s5); box-shadow: var(--shadow); }
dialog.dialog::backdrop, dialog.side-sheet::backdrop { background: rgba(30, 42, 47, .5); }
dialog.dialog { width: min(92vw, 480px); border-radius: var(--r-card); }
dialog.dialog > h2, dialog.side-sheet > h2 { margin-bottom: var(--s3); }
dialog.side-sheet { width: 100%; max-width: none; max-height: 85vh; margin: auto 0 0; border-radius: var(--r-card) var(--r-card) 0 0; overflow-y: auto; }
@media (min-width: 900px) {
  dialog.side-sheet { width: 420px; height: 100vh; max-height: none; margin: 0 0 0 auto; border-radius: 0; }
}
.dialog-close { margin-left: auto; }

.child-row { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.child-row:first-child { border-top: 0; }
.child-row .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.goal-card { display: block; }
.goal-card .row-between { margin-bottom: var(--s2); }
.part-row { display: grid; grid-template-columns: 1fr auto; gap: 2px var(--s3); align-items: center; padding: var(--s3) 0; border-top: 1px solid var(--line); }
.part-row:first-child { border-top: 0; }
.part-row .value { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
ul.part-rows { list-style: none; margin: 0; padding: 0; }

details.chart-table > summary { min-height: 48px; display: flex; align-items: center; cursor: pointer; font-weight: 650; color: var(--primary); }
.chart-table table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.chart-table th { text-align: left; font-size: var(--fs-xs); font-weight: 700; color: var(--ink-2); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line-strong); }
.chart-table td { padding: var(--s3); border-bottom: 1px solid var(--line); vertical-align: top; }
.chart-table td.num, .chart-table th.num { text-align: right; }

.field-error { display: block; margin-top: 6px; font-size: var(--fs-sm); font-weight: 650; color: var(--danger); }
.input[aria-invalid="true"], select.input[aria-invalid="true"], textarea.input[aria-invalid="true"] { border: 2px solid var(--danger); }
.seg > legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- 11. Print ---------- */
@page { size: A4; margin: 0; }
@media print {
  body { background: #fff; display: block !important; }
  .topbar, .nav, .savebar, .report-tools, .screen-only, .skip, dialog.dialog, dialog.side-sheet { display: none !important; }
  main { padding: 0 !important; max-width: none; }
  .sheet { border: 0; box-shadow: none; border-radius: 0; max-width: none; padding: 12mm; font-size: 13.5px; }
  .sheet .goal, .sheet .home { break-inside: avoid; }
}

@media (prefers-reduced-motion: no-preference) { .btn, .tally-btn, .seg span { transition: background-color .12s, transform .08s; } }

/* S01 person tiles: prototype sized the name inline (24px) */
.tile .tile-name { font-size: 24px; margin-top: 8px; }

/* ---------- 12. P5 children and intake (S02-S06): only that phase writes between these lines ---------- */

.filter-row { gap: var(--s2); }
.filter-row .btn[aria-current="true"] { border-color: var(--ink); font-weight: 700; }
.filter-row .dot { margin-right: var(--s1); }
@media (max-width: 599px) {
  table.data.data-cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.data.data-cards, table.data.data-cards tbody { display: block; }
  table.data.data-cards tr { display: block; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); padding: var(--s3); margin-bottom: var(--s3); }
  table.data.data-cards td { display: block; border: 0; padding: var(--s1) 0; text-align: left; }
  table.data.data-cards td::before { content: attr(data-label); display: block; font-size: var(--fs-xs); color: var(--ink-2); }
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.today-line { margin-top: 4px; }
.needs .tile + .tile { margin-top: var(--s3); }
.needs .tile-title { margin-top: var(--s2); }
.list > li .btn-lg { flex: none; }
p.more { margin-top: var(--s3); }
.avatar-lg { width: 56px; height: 56px; font-size: 22px; }
.priority-list { padding-left: 0; list-style: none; display: grid; gap: var(--s3); }
.priority-list .num { font-weight: 700; }
.save-row { display: flex; gap: var(--s3); flex-wrap: wrap; margin-top: var(--s4); position: sticky; bottom: 0; padding: var(--s3) 0; background: var(--bg); }
.intake-form { padding-bottom: 120px; }
.intake-form .step-card { margin-bottom: var(--s4); }
.step-card:not(.is-current) { display: none; }
.step-nav { justify-content: space-between; margin-bottom: var(--s4); }
@media (min-width: 900px) {
  .step-card:not(.is-current) { display: block; }
  .step-nav { display: none; }
  .intake-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); align-items: start; }
  .intake-form > .page-head, .intake-form > .steps, .intake-form > .savebar { grid-column: 1 / -1; }
}
.day-chip { display: inline-flex; align-items: center; gap: var(--s2); min-height: 48px; padding: 0 var(--s3); border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); cursor: pointer; font-weight: 600; }
.day-chip input { accent-color: var(--primary); width: 20px; height: 20px; }
.day-chip:has(input:checked) { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); font-weight: 800; }
.day-chip:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
fieldset { border: 0; padding: 0; margin: 0 0 var(--s4); }
/* ---------- end 12 ---------- */

/* ---------- 13. P6 goal plan and editor (S07-S08): only that phase writes between these lines ---------- */
.plan-top { align-items: center; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s4); }
.plan-group { margin-top: var(--s5); }
.plan-group > h2, .plan-group > summary { margin-bottom: var(--s3); }
details.plan-group > summary { min-height: 48px; display: flex; align-items: center; cursor: pointer; font-weight: 650; color: var(--primary); }
ul.plan-gaps { margin: var(--s2) 0; padding-left: var(--s5); color: var(--ink-2); }
.ge-rail { position: sticky; top: 76px; align-self: start; }
.savebar .row.ge-bar { flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.savebar .ge-missing:empty, .savebar .field-error:empty { display: none; }
.savebar .ge-missing { flex-basis: 100%; text-align: right; color: var(--ink-2); }

/* ---------- end 13 ---------- */

/* ---------- 14. P7 session log and timeline (S09-S10): only that phase writes between these lines ---------- */

/* S09 session log */
.log-child { font-size: var(--fs-lg, 20px); font-weight: 700; }
.log-addnote { justify-content: flex-start; }
.log-rest > summary { min-height: 48px; display: flex; align-items: center; font-weight: 650; cursor: pointer; }
.has-savebar .savebar .btn { min-height: 56px; }
.savebar .muted { margin-bottom: var(--s2); }
textarea.input { width: 100%; }


/* S10 goal timeline */
.goal-wording { font-size: var(--fs-xl, 24px); margin-top: var(--s1); }
.part-title { margin-top: var(--s2); }
.thennow { margin-top: var(--s2); }
tr.replaced td { text-decoration: line-through; color: var(--ink-2); }
tr.replaced td .sr { text-decoration: none; }
[data-entries] table.data { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
[data-entries] th { text-align: left; font-size: var(--fs-xs); font-weight: 700; color: var(--ink-2); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line-strong); }
[data-entries] td { padding: var(--s3); border-bottom: 1px solid var(--line); vertical-align: top; }
[data-levels] li { padding: var(--s2) 0; }

.correct-panel { padding: var(--s3) 0; }
tr[data-correct] td { background: var(--surface-2); }

/* ---------- end 14 ---------- */

/* ---------- 15. P8 review and report (S11, S12, S16, print): only that phase writes between these lines ---------- */
/* Report sheet: it always prints and shows as a white page with dark ink, whatever the device theme. */
.sheet { --ink: #1E2A2F; --surface: #FFFFFF; color-scheme: light; background: #FFFFFF; color: #1E2A2F; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.sheet .sheet-title { font-size: 24px; margin-top: 0; }
.sheet .sheet-centre { font-size: 13px; color: var(--ink-2); font-weight: 650; }
.sheet .sheet-month { text-align: right; font-size: 14px; }
.sheet .sheet-greeting { margin-top: 10px; }
.sheet .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.sheet .also { margin-top: 9px; color: var(--ink-2); }
.sheet .home h2 { margin-top: 0; }

/* Report screen (outside the sheet) */
.never-card { max-width: 210mm; margin: var(--s5) auto 0; }
[data-status] { font-weight: 650; }
.report-tools .check { min-height: 0; padding: 0; }
.report-tools [data-share-hint] { flex-basis: 100%; }
[data-edit-sheet] .stack { margin-bottom: var(--s4); }
[data-edit-sheet] fieldset { border: 1px solid var(--line); border-radius: var(--r-control); padding: var(--s3); }
[data-edit-sheet] .row { display: flex; gap: var(--s3); justify-content: flex-end; }
.field-error { color: var(--danger); font-size: var(--fs-sm); margin: 4px 0 0; }
.field-error:empty { display: none; }
dialog[data-confirm] .row { display: flex; gap: var(--s3); justify-content: flex-end; margin-top: var(--s4); }
[data-fallback] { max-width: 210mm; margin: var(--s4) 0; }
[data-fit-warning] { margin: var(--s3) 0; }

/* S11 review */
.review-card .thennow { margin-top: var(--s2); }
.review-card textarea { width: 100%; }

@media print {
  .sheet { --ink: #1E2A2F; --surface: #FFFFFF; background: #FFFFFF; color: #1E2A2F; border: 0; box-shadow: none; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .sheet[data-goals="4"] { font-size: 12.5px; line-height: 1.3; }
  .sheet[data-goals="4"] .goal { margin-top: 6px; padding: 6px 10px; }
  .sheet[data-goals="4"] .goal li { margin-top: 2px; }
  .sheet[data-goals="4"] .home { margin-top: 8px; padding: 8px 12px; }
  .sheet[data-goals="4"] footer { margin-top: 8px; padding-top: 6px; }
  .screen-only, .report-tools, dialog, [data-fallback], .never-card { display: none !important; }
  main { padding: 0 !important; }
  .report-item + .report-item { break-before: page; }
}

/* ---------- end 15 ---------- */

/* ---------- 16. P9 lead view and settings (S13-S15): only that phase writes between these lines ---------- */

/* S13 dashboard: prototype inline styles as classes */
.tile .tile-note { display: block; margin-top: var(--s1); }
.note-top { margin-top: var(--s2); }
.cols-top { margin-top: var(--s5); }

/* S14 settings */
.row-error { margin-top: var(--s1); color: var(--danger); font-size: var(--fs-sm); }
.row-actions { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.form-gap { margin-top: var(--s5); }
.radio-group { border: 0; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.radio-row { display: flex; align-items: center; gap: var(--s2); }
/* S15 demo */
.demo-actions { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }
/* ---------- end 16 ---------- */
