/* Family Flow design system tokens: Day (light) and Night (dark). */
:root {
  --surface: #f5f6f3;
  --surface-raised: #ffffff;
  --ink: #1d2529;
  --ink-muted: #5b666b;
  --line: #dfe3df;
  --accent: #23707f;
  --on-accent: #ffffff;
  --critical: #b3261e;
  --good: #2e7d4f;
  --accent-soft: #dceef1;
  --surface-sunken: #eceee9;
  --points: #96600f;
  --points-soft: #fbefd6;
  --good-soft: #e1f2e7;
  --warning: #a8620a;
  --warning-soft: #fbecd8;
  --critical-soft: #fbe3e1;
  --radius-md: 14px;
  --radius-lg: 22px;
  /* One tap size for everyone: kids tap like anyone else. */
  --tap: 44px;
  --kid-rail: 104px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface: #12171a;
    --surface-raised: #1b2226;
    --ink: #eef2f1;
    --ink-muted: #9aa6aa;
    --line: #2c363b;
    --accent: #6cc3d2;
    --on-accent: #0d1f23;
    --critical: #f2938c;
    --good: #7fd1ae;
    --accent-soft: #1e3b41;
    --surface-sunken: #242c30;
    --points: #f2c14e;
    --points-soft: #3b3121;
    --good-soft: #173225;
    --warning: #f0b45a;
    --warning-soft: #372812;
    --critical-soft: #3a1a18;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* Inter and Outfit load up to 600, so bold would be synthesized. */
b, strong { font-weight: 600; }

body {
  margin: 0;
  /* Room for the notch and home bar when it runs as an installed app. */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: var(--surface);
  color: var(--ink);
  font: 16px/24px Inter, system-ui, sans-serif;
}

.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 32px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

h1, h2 { font-family: Outfit, Inter, sans-serif; font-weight: 600; margin: 0; }
h1 { font-size: 28px; line-height: 34px; }
h2 { font-size: 20px; line-height: 26px; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { flex: 1; }
.brand-mark { flex: none; width: 32px; height: 32px; border-radius: 8px; }

.live { font-size: 13px; color: var(--ink-muted); }
.live[data-on="true"] { color: var(--good); }

.muted { color: var(--ink-muted); margin: 0; }

.panel {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}



input {
  min-height: var(--tap);
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
input:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn {
  min-height: var(--tap);
  margin-top: 12px;
  border: 0;
  border-radius: 999px;
  font: 600 16px/24px Inter, sans-serif;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn[disabled] { opacity: 0.6; cursor: default; }

.error { color: var(--critical); margin: 4px 0 0; }

.view { display: flex; flex-direction: column; gap: 16px; }
.panel.center { align-items: center; text-align: center; outline: none; }
.panel.accent { border-color: var(--accent); }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.panel.row { flex-direction: row; }
.grow { flex: 1; min-width: 0; }
.small { font-size: 13px; line-height: 18px; }
.block { display: block; }
.nowrap { white-space: nowrap; }

.avatar {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: 600 18px/1 Outfit, sans-serif;
  /* Member colours are light in both themes, so the initial is always dark. */
  color: #1d2529;
}
.avatar-sm { width: 32px; height: 32px; font-size: 14px; }
.avatar-lg { width: 64px; height: 64px; font-size: 28px; }

.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin-top: 8px; }
.person {
  min-height: 72px;
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.person[disabled] { opacity: 0.6; cursor: default; }
.person-name { font-weight: 600; }
.person:focus-visible, .key:focus-visible, .swatch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.dots { display: flex; gap: 14px; margin: 8px 0; }
.dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink-muted); }
.dot.on { background: var(--accent); border-color: var(--accent); }

.keypad { display: grid; grid-template-columns: repeat(3, 56px); gap: 12px; margin: 8px 0; }
.key {
  height: 56px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  font: 600 24px/1 Outfit, sans-serif;
  cursor: pointer;
}
.key:active { background: var(--line); }

.field { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.field > span, .field > label { font-weight: 600; font-size: 14px; }
select {
  min-height: var(--tap);
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.btn { padding: 0 18px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); margin-top: 0; }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn-ghost { border-color: transparent; color: var(--ink-muted); }
.btn-danger { color: var(--critical); }
form > .btn, .panel > .btn { margin-top: 12px; }

.item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
h2 + .item { border-top: 0; }
.subform { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-md); display: flex; flex-direction: column; gap: 6px; }
.join-code { margin: 16px 0; font: 600 44px/52px Outfit, Inter, sans-serif; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; color: var(--accent); }
fieldset.field { border: 0; padding: 0; margin-inline: 0; }
fieldset.field > legend { font-weight: 600; font-size: 14px; padding: 0; margin-bottom: 4px; }
.chip { padding: 2px 10px; border-radius: 999px; background: var(--line); font-size: 13px; }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: var(--tap); height: var(--tap); border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.swatch[aria-checked="true"] { border-color: var(--ink); }

.task-icon { font-size: 36px; line-height: 1; width: 44px; text-align: center; flex: none; }
.small-icon { font-size: 24px; width: 32px; }
.reward { padding: 2px 10px; border-radius: 999px; background: var(--points-soft); color: var(--points); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.checks, .icons { display: flex; gap: 8px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); font-weight: 400; }
.check input { width: 20px; height: 20px; min-height: 0; }
.icon-choice { width: var(--tap); height: var(--tap); font-size: 22px; border: 2px solid var(--line); border-radius: var(--radius-md); background: var(--surface); cursor: pointer; }
.icon-choice[aria-checked="true"] { border-color: var(--accent); }
.times { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
input[type="number"], input[type="date"], input[type="time"] { min-width: 0; }
/* On a phone the buttons wrap under the text instead of squeezing it. */
.item > .grow { flex: 1 1 220px; }
.item > select { max-width: 100%; min-width: 0; }
.progress { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 6px 0 2px; }
.progress > span { display: block; height: 100%; border-radius: 999px; transition: width 0.3s; }
.chip-accent { align-self: flex-start; margin: 0; background: var(--accent); color: var(--on-accent); font-weight: 600; }
.balances { display: flex; gap: 8px; flex-wrap: wrap; }
.eyebrow { font: 600 12px/16px Inter, sans-serif; letter-spacing: 0.6px; text-transform: uppercase; color: var(--ink-muted); }
.balance { padding: 6px 14px; border-radius: 999px; background: var(--points-soft); color: var(--points); font: 600 18px/26px Outfit, Inter, sans-serif; font-variant-numeric: tabular-nums; }
.panel.inner { padding: 12px; gap: 4px; }
details.history > summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { min-height: 36px; padding: 0 14px; border: 0; background: var(--surface); color: var(--ink); font: 600 14px/1 Inter, sans-serif; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.center-text { text-align: center; }
.week { display: flex; flex-direction: column; gap: 4px; }
.week-day { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-top: 1px solid var(--line); }
.day-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.day-head.today b { color: var(--accent); }
.event { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; flex-wrap: wrap; }
.event > .grow { flex: 1 1 200px; }
.dots { display: inline-flex; gap: 3px; flex-wrap: wrap; }
.event > .dots { flex-direction: column; padding-top: 6px; }
.dot-sm { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.month-head { text-align: center; font-size: 12px; font-weight: 600; color: var(--ink-muted); }
.month-day {
  min-height: 52px; padding: 4px 2px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: 1px solid transparent; border-radius: var(--radius-md); background: none; color: var(--ink); font: 500 15px/1 Inter, sans-serif; cursor: pointer;
}
.month-day.other { color: var(--ink-muted); opacity: 0.55; }
.month-day.today > span:first-child { color: var(--accent); font-weight: 600; }
.month-day[aria-pressed="true"] { border-color: var(--accent); background: var(--surface); }
.month-day .dot-sm { width: 7px; height: 7px; }
/* Days: a month of day types. Cells drop their note text when the panel is narrow. */
.days-cal { container-type: inline-size; }
.dc-head { gap: 8px; flex-wrap: nowrap; }
.dc-nav { width: var(--tap); padding: 0; font-size: 22px; flex: none; }
.dc-month { min-width: 9em; text-align: center; }
.dc-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.dc-key { display: inline-flex; align-items: center; gap: 6px; }
.dc-swatch { width: 14px; height: 14px; border-radius: 4px; border: 1px solid transparent; }
.dc-swatch.k-work { border: 1px dashed var(--ink-muted); }
.dc-swatch.ring { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink); }
.dc-swatch.who { border-radius: 50%; background: var(--ink-muted); }
.dc-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.dc-wd { text-align: center; font-size: 12px; font-weight: 600; color: var(--ink-muted); }
.dc-cell {
  min-width: 0; height: 60px; padding: 4px 6px; display: flex; flex-direction: column; justify-content: space-between; align-items: stretch; text-align: left;
  border: 1px solid transparent; border-radius: 8px; background: var(--surface-raised); color: var(--ink); font: 13px/16px Inter, sans-serif; cursor: pointer;
}
.k-school { background: var(--accent-soft); }
.k-weekend { background: var(--surface-sunken); }
.k-holiday { background: var(--points-soft); }
.dc-cell.k-work, .dc-cell.k-none { border-color: var(--line); }
.dc-cell.k-work { border-style: dashed; border-color: var(--ink-muted); }
.dc-cell.other, .dc-cell.past { color: var(--ink-muted); }
.dc-cell.today { border: 2px solid var(--accent); }
.dc-cell[aria-pressed="true"] { border: 2px solid var(--ink); }
.dc-cell.today[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accent); }
.dc-cell:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dc-top, .dc-bottom { display: flex; align-items: center; gap: 4px; min-width: 0; }
.dc-top { justify-content: space-between; }
.dc-n { font-weight: 600; font-variant-numeric: tabular-nums; }
.dc-ring { width: 10px; height: 10px; flex: none; border-radius: 50%; border: 2px solid currentColor; }
.dc-who { width: 18px; height: 18px; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font: 600 11px/1 Inter, sans-serif; color: #1d2529; }
.dc-note { min-width: 0; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dc-detail { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-md); background: var(--surface-sunken); }
.dc-detail > .grow { flex: 1 1 220px; }
@container (max-width: 400px) {
  .dc-cell { height: 48px; padding: 3px 4px; }
  .dc-note { display: none; }
  .dc-who { width: 14px; height: 14px; font-size: 9px; }
  .dc-head .grow { font-size: 18px; }
  .dc-month { min-width: 0; }
}

.weather-icon { font-size: 40px; line-height: 1; }
.big { font: 600 22px/28px Outfit, Inter, sans-serif; }
.alert { margin: 0; padding: 8px 12px; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--critical); }
.place { justify-content: flex-start; text-align: left; margin-top: 6px; width: 100%; }
.times.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
textarea { padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); color: var(--ink); font: inherit; resize: vertical; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn { min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: 500 14px/1 Inter, sans-serif; cursor: pointer; }
.tick { width: var(--tap); height: var(--tap); flex: none; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.tick input[type=checkbox] { width: 26px; height: 26px; }
.chip-btn, .seg button { min-height: var(--tap); }
code { font: 13px/18px ui-monospace, Consolas, monospace; }
.secret { display: block; padding: 10px; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--line); word-break: break-all; user-select: all; }
.mail { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.mail h3 { margin: 0; font: 600 17px/24px Outfit, Inter, sans-serif; }
.struck { text-decoration: line-through; color: var(--ink-muted); }
/* Task states: an icon in the state's colour beside the words that name it.
   Pinned to the first line, so a wrapped status keeps its icon beside its start. */
.state-line { display: flex; align-items: flex-start; gap: 6px; margin: 0; }
.state-icon { width: 20px; height: 20px; flex: none; margin-top: -1px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.state-done { color: var(--good); }
.state-waiting { color: var(--warning); }
.state-later { color: var(--ink-muted); }
.state-line.is-missed { color: var(--critical); }

:root[data-theme="light"] {
  --surface: #f5f6f3; --surface-raised: #ffffff; --surface-sunken: #eceee9; --ink: #1d2529; --ink-muted: #5b666b; --line: #dfe3df;
  --accent: #23707f; --on-accent: #ffffff; --accent-soft: #dceef1; --points: #96600f; --points-soft: #fbefd6;
  --good: #2e7d4f; --good-soft: #e1f2e7; --warning: #a8620a; --warning-soft: #fbecd8; --critical: #b3261e; --critical-soft: #fbe3e1;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --surface: #12171a; --surface-raised: #1b2226; --surface-sunken: #242c30; --ink: #eef2f1; --ink-muted: #9aa6aa; --line: #2c363b;
  --accent: #6cc3d2; --on-accent: #0d1f23; --accent-soft: #1e3b41; --points: #f2c14e; --points-soft: #3b3121;
  --good: #7fd1ae; --good-soft: #173225; --warning: #f0b45a; --warning-soft: #372812; --critical: #f2938c; --critical-soft: #3a1a18;
  color-scheme: dark;
}
/* At night the screen is dimmer, so it isn't a lamp in the kitchen. */
:root.screen-night body.on-screen { filter: brightness(0.7); }

body.on-screen .page { max-width: none; padding: 16px; }
body.on-screen .brand { display: none; }
.focus-bar { position: sticky; top: 0; z-index: 2; }
.offline { position: fixed; top: 8px; left: 16px; right: 16px; z-index: 3; box-shadow: 0 4px 16px rgb(0 0 0 / 25%); padding: 10px 14px; border-radius: var(--radius-md); background: var(--critical); color: var(--on-accent); font-weight: 600; }
.night-form { align-items: flex-end; }

.bell { position: relative; }
.bell-count { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font: 600 12px/20px Inter, sans-serif; text-align: center; }
.notice.unread { font-weight: 600; }
.notice-body { white-space: pre-line; font-weight: 400; }
.notice-settings { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.home-header { flex-wrap: wrap; }
.home-header > .grow { min-width: 140px; }

.live-dot { flex: none; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-muted); font-size: 14px; }
.live-dot::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--good); }
/* Room for the error line from the start, so the pad doesn't jump under a finger. */
.pin-sheet .error { min-height: 24px; }
.kitchen-flash { position: fixed; z-index: 4; left: 50%; bottom: 16px; transform: translateX(-50%); max-width: calc(100% - 32px); margin: 0; padding: 10px 16px; border-radius: var(--radius-md); background: var(--surface-raised); box-shadow: 0 4px 16px rgb(0 0 0 / 20%); }
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgb(0 0 0 / 45%); }
.pin-sheet, .parent-sheet { width: min(420px, 100%); max-height: calc(100vh - 32px); overflow: auto; }
.parent-sheet .stack { display: flex; flex-direction: column; gap: 8px; }
.parent-sheet .btn { min-height: 52px; }
.who { display: inline-flex; align-items: center; gap: 8px; }

/* --- Bigger screens: tablet from 640 px, laptop from 1024, wide from 1600 (web/layout.js) --- */
.icon { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.columns { display: grid; grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr)); gap: 16px; align-items: start; }
.column { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.wg { display: grid; grid-template-columns: 48px repeat(7, minmax(0, 1fr)); user-select: none; }
.wg-head { padding: 6px 4px 8px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink-muted); font: 600 13px/18px Inter, sans-serif; text-align: left; }
button.wg-day { min-height: var(--tap); cursor: pointer; }
button.wg-day:hover, .wg-day.today { color: var(--accent); }
.wg-allday { min-height: 30px; padding: 3px; display: flex; flex-direction: column; gap: 2px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.wg-allday-label { display: flex; align-items: center; justify-content: flex-end; padding-right: 6px; border-bottom: 1px solid var(--line); }
.wg-hours { display: flex; flex-direction: column; }
.wg-hours span { flex: none; padding: 2px 6px 0 0; font-size: 12px; line-height: 12px; color: var(--ink-muted); text-align: right; font-variant-numeric: tabular-nums; }
.wg-col {
  position: relative; border-left: 1px solid var(--line);
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--wg-hour) - 1px), var(--line) calc(var(--wg-hour) - 1px), var(--line) var(--wg-hour));
}
.wg-col.drag { cursor: crosshair; touch-action: none; }
.wg-col.today { background-color: color-mix(in srgb, var(--accent) 6%, transparent); }
/* Member colours are light in both themes, so event text is always dark. */
.wg-event, .wg-chip { border: 0; border-radius: 8px; color: #1d2529; font: 600 12px/16px Inter, sans-serif; text-align: left; overflow: hidden; }
.wg-event { position: absolute; padding: 3px 6px; display: flex; flex-direction: column; box-shadow: 0 0 0 1px var(--surface-raised); }
.wg-chip { padding: 2px 6px; white-space: nowrap; text-overflow: ellipsis; }
button.wg-event, button.wg-chip { cursor: pointer; }
.wg-title, .wg-time { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wg-time { font-weight: 500; }
.wg-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--critical); pointer-events: none; }
.wg-ghost { position: absolute; left: 2px; right: 2px; padding: 2px 6px; border: 2px solid var(--accent); border-radius: 8px; background: color-mix(in srgb, var(--accent) 25%, transparent); font: 600 12px/16px Inter, sans-serif; pointer-events: none; }

@media (min-width: 640px) {
  .page { max-width: 1040px; padding: 32px 24px; }
  .panel.center { width: 100%; max-width: 480px; align-self: center; }
  /* Sign-in and setup stay a comfortable width; signed-in pages use the room. */
  body.signed-out .page { max-width: 560px; }
  .columns, .column { gap: 20px; }
}

@media (min-width: 1024px) {
  .page { max-width: 1400px; }

  body.shell .page { max-width: none; padding: 0; }
  body.shell .brand { display: none; }
  .app-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
  .side { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 24px 14px; display: flex; flex-direction: column; gap: 20px; background: var(--surface-raised); border-right: 1px solid var(--line); }
  .side-brand { display: flex; align-items: center; gap: 10px; padding: 0 10px; font: 600 18px/24px Outfit, Inter, sans-serif; }
  .side-nav { display: flex; flex-direction: column; gap: 2px; }
  .side-nav a { min-height: var(--tap); padding: 0 12px; display: flex; align-items: center; gap: 12px; border-radius: var(--radius-md); color: var(--ink); text-decoration: none; font-weight: 500; }
  .side-nav a:hover { background: var(--surface); }
  .side-nav a[aria-current="page"] { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-weight: 600; }
  .side-nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
  .side-nav .chip { margin: 0; }

  .shell-main { min-width: 0; max-width: 2200px; padding: 0 32px 32px; display: flex; flex-direction: column; gap: 20px; }
  .topbar { position: sticky; top: 0; z-index: 2; padding: 18px 0; display: flex; align-items: center; gap: 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .topbar h1, .topbar .grow > span { font-size: 26px; line-height: 32px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .grow > span { font-size: 13px; line-height: 18px; }
  .columns.narrow { max-width: 760px; }


  /* Forms open as a side panel, so the page stays in view while typing. */
  .app-shell.drawer-open form.subform:not(.keep-inline) { position: fixed; top: 0; right: 0; bottom: 0; z-index: 4; width: min(440px, 100vw); overflow-y: auto; padding: 24px; background: var(--surface-raised); border: 0; border-left: 1px solid var(--line); border-radius: 0; box-shadow: -8px 0 24px rgb(0 0 0 / 12%); }
  .app-shell.drawer-open .shell-main { padding-right: 472px; }
  /* The page beside an open side panel is narrower, so its columns fold. */
  .app-shell.drawer-open .columns { grid-template-columns: minmax(0, 1fr); }
  .topbar .grow { min-width: 140px; }
  .topbar > .btn { white-space: nowrap; }
  .app-shell.drawer-open form.subform .times { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}

@media (min-width: 1600px) {
  .app-shell.drawer-open .columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.wg-event.short { flex-direction: row; gap: 4px; align-items: center; }
.wg-event.short .wg-time { flex: none; }
.wg-event.tall .wg-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
/* Side-by-side events can get too narrow for the time; the title wins, the tooltip has the rest. */
.wg-event { container-type: inline-size; }
@container (max-width: 72px) { .wg-time { display: none; } }
/* The calendar needs its width, so on that page the side panel opens over it. */
.app-shell.drawer-open.overlay-drawer .shell-main { padding-right: 32px; }
.app-shell.drawer-open.overlay-drawer .columns { grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr)); }

.top-chip { min-height: 36px; padding: 0 14px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-raised); color: var(--ink); font: 500 14px/1 Inter, sans-serif; white-space: nowrap; }
button.top-chip { cursor: pointer; }
.alert-chip { border-color: var(--critical); color: var(--critical); font-weight: 600; }
.list-link { min-height: var(--tap); padding: 0 12px; display: flex; align-items: center; gap: 10px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--ink); font: 600 16px/24px Inter, sans-serif; text-align: left; cursor: pointer; }
h2 + .list-link { border-top: 0; }
.list-link:hover { background: var(--surface); }
@media (min-width: 1024px) {
  .topbar .top-chip { flex: none; }
}

/* --- A kid's Today: tasks and saving for over the next seven days --- */
.fold { align-self: flex-start; min-height: 32px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-muted); font: 600 13px/18px Inter, sans-serif; cursor: pointer; }
.fold.good { color: var(--good); }
.fold:hover { background: var(--surface); }
.coming-up { flex: 1; min-width: 0; display: flex; gap: 8px; overflow: hidden; }
.soon { flex: none; min-height: 44px; padding: 0 12px 0 5px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-raised); white-space: nowrap; }
.soon-n { min-width: 38px; height: 34px; padding: 0 4px; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font: 600 16px/17px Outfit, Inter, sans-serif; }
.soon-n small { font: 600 9px/11px Inter, sans-serif; }
.soon b { font-size: 14px; line-height: 18px; }
.ahead { display: grid; grid-template-columns: minmax(0, 2fr) repeat(6, minmax(0, 1fr)); gap: 10px; }
.ahead-day { min-width: 0; padding: 12px; display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-raised); overflow-y: auto; }
.ahead-day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.ahead-name { font-size: 15px; }
.ahead-day.today .ahead-name { font: 600 20px/24px Outfit, Inter, sans-serif; color: var(--accent); }
.ahead-weather { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 8px; align-items: center; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.ahead-icon { grid-row: span 2; font-size: 26px; line-height: 30px; }
.ahead-weather b { font: 600 15px/18px Outfit, Inter, sans-serif; font-variant-numeric: tabular-nums; }
.ahead-weather span:last-child { font-size: 12px; line-height: 16px; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ahead-day.today .ahead-icon { font-size: 34px; line-height: 38px; }
.ahead-day.today .ahead-weather b { font-size: 20px; line-height: 24px; }
.ahead-day.today .ahead-weather span:last-child { font-size: 14px; line-height: 18px; color: var(--ink); font-weight: 600; }
.ahead-type { align-self: flex-start; padding: 2px 8px; border-radius: 999px; background: var(--surface); color: var(--ink-muted); font: 600 11px/16px Inter, sans-serif; letter-spacing: 0.5px; text-transform: uppercase; }
.ahead-type.off { background: var(--points-soft); color: var(--ink); }
.ahead-event { display: grid; grid-template-columns: 8px minmax(0, 1fr); gap: 6px; font-size: 13px; line-height: 17px; }
.ahead-event.big { padding: 8px 10px; border-radius: 10px; background: var(--surface); font-size: 15px; line-height: 20px; }
.ahead-dot { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; }
.ahead-event.big .ahead-dot { margin-top: 6px; }
.ahead-text { min-width: 0; display: flex; flex-direction: column; }
.ahead-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ahead-where { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.85em; color: var(--ink-muted); }
/* A 44px tap target that only takes 24px of the row: the padding overlaps plain text around it. */
a.where-link { display: block; max-width: 100%; margin: -10px 0; padding: 12px 0; line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
a.where-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px; }

@media (min-width: 1024px) {
  /* The app stops growing at 1920 px; wider screens center it. */
  .app-shell { width: 100%; max-width: 1920px; margin: 0 auto; }
  .side { overflow-x: hidden; }
  .app-shell.menu-folded { grid-template-columns: 72px minmax(0, 1fr); }
  .side { gap: 16px; }
  .side-toggle { margin-top: auto; min-height: var(--tap); border: 0; border-radius: var(--radius-md); background: transparent; color: var(--ink-muted); font: 600 18px/1 Inter, sans-serif; cursor: pointer; }
  .side-toggle:hover { background: var(--surface); }
  .menu-folded .side { padding: 20px 10px; align-items: center; }
  .menu-folded .side-label { display: none; }
  .menu-folded .side-nav a { position: relative; width: 52px; justify-content: center; padding: 0; }
  .menu-folded .side-nav .chip { position: absolute; top: 2px; right: 0; min-width: 18px; padding: 0 5px; font-size: 11px; line-height: 18px; }
  .topbar-hello { flex: none; min-width: 140px; }
  .topbar-hello h1 { white-space: nowrap; }
}

/* --- Phones, tablets and kids: Today on one page, a tab bar for parents --- */
.narrow-head { display: flex; align-items: center; gap: 10px; }
.narrow-head .hello { font-size: 24px; line-height: 30px; }
.narrow-head .btn { flex: none; }
.stars-chip { border-color: transparent; background: var(--points-soft); color: var(--points); font-weight: 600; font-variant-numeric: tabular-nums; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 3; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: var(--surface-raised); border-top: 1px solid var(--line); }
.tabbar button { position: relative; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; border-radius: var(--radius-md); background: none; color: var(--ink-muted); font: 600 12px/14px Inter, sans-serif; cursor: pointer; }
.tabbar button[aria-current="page"] { color: var(--accent); }
.tab-badge { position: absolute; top: 2px; left: 55%; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 11px; line-height: 18px; }
body.with-tabbar .page { padding-bottom: 96px; }
/* A kid's menu: five tabs under 1024 px, a rail that never folds from 1024 px. */
.kid-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 3; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--surface-raised); border-top: 1px solid var(--line); }
.kid-item { position: relative; min-height: 52px; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; border-radius: var(--radius-md); background: none; color: var(--ink-muted); font: 600 12px/14px Inter, sans-serif; text-align: center; cursor: pointer; }
.kid-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.kid-item[aria-current="page"] { color: var(--accent); }
.kid-emoji { width: 48px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 999px; font-size: 22px; line-height: 1; }
.kid-tabs .kid-item[aria-current="page"] .kid-emoji { background: var(--accent-soft); }
.kid-badge { position: absolute; top: 2px; left: calc(50% + 10px); min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font: 600 12px/20px Inter, sans-serif; font-variant-numeric: tabular-nums; }
body.with-kid-tabs .page { padding-bottom: 96px; }
body.kid-rail-on .page { max-width: none; padding: 0; }
body.kid-rail-on .brand { display: none; }
.kid-shell { width: 100%; max-width: 1920px; margin: 0 auto; display: grid; grid-template-columns: var(--kid-rail) minmax(0, 1fr); min-height: 100vh; }
.kid-rail { position: sticky; top: 0; height: 100vh; overflow-y: auto; box-sizing: border-box; display: flex; flex-direction: column; gap: 4px; padding: 16px 8px; background: var(--surface-raised); border-right: 1px solid var(--line); }
.kid-rail .kid-item { min-height: 56px; }
.kid-rail .kid-item[aria-current="page"] { background: var(--accent-soft); }
.kid-me { display: flex; flex-direction: column; align-items: center; gap: 4px; padding-bottom: 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); font: 600 14px/18px Inter, sans-serif; text-align: center; overflow-wrap: anywhere; }
.kid-rail-end { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.kid-main { min-width: 0; padding: 16px 24px 24px; display: flex; flex-direction: column; gap: 16px; }
body:not(.shell) .coming-up { overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; flex: none; }
body:not(.shell) .coming-up::-webkit-scrollbar { display: none; }
@media (min-width: 640px) {
  body:not(.shell) .coming-up { margin: 0; padding: 0; }
}
@media (max-width: 639px) {
  .narrow-head .muted.small { display: none; }
  .narrow-head .hello { font-size: 20px; line-height: 26px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* A kid's header holds the avatar, greeting, stars, bell and Done in one row. */
  .narrow-head { gap: 8px; }
  .narrow-head > .avatar-lg { width: var(--tap); height: var(--tap); font-size: 18px; }
  .narrow-head > .grow { min-width: 0; }
  .kid-head .hello { white-space: normal; overflow-wrap: anywhere; line-height: 24px; }
  .narrow-head .stars-chip { padding: 0 10px; }
  .narrow-head > .btn { padding: 0 12px; }
}

/* One task form, the job board and Take stars. */
.stack { display: flex; flex-direction: column; gap: 8px; }
.form-title, .group-title { margin: 8px 0 0; font: 600 16px/22px Outfit, Inter, sans-serif; }
.group-title { color: var(--ink-muted); }
.what-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 8px; }
.chip-btn[aria-pressed="true"], .kind-btn[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent-soft); font-weight: 600; }
.kind-btn { flex: 1 1 160px; min-height: 64px; padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-raised); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.claims { display: flex; flex-direction: column; }
.claims .check input { width: 20px; height: 20px; }
.btn-critical { background: var(--critical); color: var(--on-accent); border-color: var(--critical); }
.btn-wide { min-height: var(--tap); }
.who-chip { display: inline-flex; align-items: center; gap: 8px; padding-left: 4px; }
.who-chip .avatar { width: 32px; height: 32px; font-size: 14px; }
.rule-choice { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-raised); }
.rule-choice.other { flex-direction: column; align-items: stretch; padding: 12px; gap: 10px; }
.rule-choice.other > .rule-choice { border: 0; padding: 0; min-height: 0; background: none; }
.rule-choice input[type=radio] { width: 20px; height: 20px; min-height: 0; }
.other-fields .row input:first-child { flex: 1; min-width: 0; }
.cost-input { width: 80px; text-align: center; }
.reward-cost { color: var(--points); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.take-cost { min-width: 56px; text-align: right; color: var(--critical); font-weight: 600; font-variant-numeric: tabular-nums; }
.take-preview { margin: 8px 0 0; padding: 12px; border-radius: var(--radius-md); background: var(--surface-sunken); font-size: 14px; line-height: 20px; }
.job-banner { margin: 0; padding: 12px 16px; border-radius: var(--radius-md); font-weight: 600; }
.job-banner.open { background: var(--good-soft); }
.job-banner.closed { background: var(--warning-soft); }
.job-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.job-board h3 { margin: 0 0 8px; font: 600 18px/24px Outfit, Inter, sans-serif; }
.job-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.job-card { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius-md); background: var(--surface-raised); border: 1px solid var(--line); }
.job-card.off .job-title { color: var(--ink-muted); }
.job-icon { flex: none; width: 52px; height: 52px; display: grid; place-items: center; border-radius: var(--radius-md); background: var(--accent-soft); font-size: 30px; }
.job-title { font-size: 18px; line-height: 24px; }
.job-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.job-take { min-height: var(--tap); white-space: nowrap; }
.job-held { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 2px solid var(--accent); border-radius: var(--radius-md); background: var(--surface-raised); margin-bottom: 8px; }
.job-line { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-md); background: var(--surface-raised); margin-bottom: 8px; }
.job-line.sunken { background: var(--surface-sunken); }
.job-entry .list-link { border-top: 0; padding: 0; min-height: var(--tap); }
.jobs-sheet { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 1024px) {
  .job-layout { grid-template-columns: minmax(0, 1fr) 360px; }
}

/* Settings: admins only. Tabs from 640 px, a list of four pages on a phone. */
.side-end { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }
.side-rule { width: 100%; margin: 6px 0; border: 0; border-top: 1px solid var(--line); }
@media (min-width: 1024px) {
  .side-nav { flex: 1; }
  .menu-folded .side-rule { width: 40px; }
}
.settings { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.settings-title { margin: 0; font: 600 28px/34px Outfit, Inter, sans-serif; }
.set-head .muted { margin: 4px 0 0; }
.set-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.set-row h2 { margin: 0; font: 600 20px/26px Outfit, Inter, sans-serif; }
.stabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.stabs a { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 16px; color: var(--ink-muted); text-decoration: none; font: 600 15px/20px Inter, sans-serif; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.stabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.stabs a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.stabs .em { font-size: 18px; line-height: 1; }
.stabs .n { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font: 600 12px/20px Inter, sans-serif; text-align: center; }
.chip-warn { background: var(--warning-soft); color: var(--warning); font-weight: 600; white-space: nowrap; }
.chip-ok { background: var(--good-soft); color: var(--good); font-weight: 600; white-space: nowrap; }
.back { align-self: flex-start; display: inline-flex; align-items: center; min-height: var(--tap); color: var(--accent); font: 600 15px/1 Inter, sans-serif; text-decoration: none; }
.plist { background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.prow { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 60px; padding: 8px 14px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.prow:first-child { border-top: 0; }
.prow .em { font-size: 22px; line-height: 1; text-align: center; }
.prow b, .prow small { display: block; }
.prow small { color: var(--ink-muted); font-size: 13px; line-height: 18px; }
.prow .go { color: var(--ink-muted); font-size: 20px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 16px; align-items: start; }

.member-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 16px; }
.member-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-raised); }
.member-card b { font: 600 17px/22px Outfit, Inter, sans-serif; }
.member-card dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; margin: 0; font-size: 14px; line-height: 20px; }
.member-card dt { color: var(--ink-muted); }
.member-card dd { margin: 0; }
.member-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 160px; padding: 16px; border: 2px dashed var(--line); border-radius: var(--radius-md); background: transparent; color: var(--accent); font: 600 15px/20px Inter, sans-serif; cursor: pointer; }
.member-add:hover { border-color: var(--accent); }

/* Devices: one row per device, grouped, in columns that line up down the page. */
.dev-list { padding: 0; overflow: hidden; }
.dev-cols { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 2fr) 130px 130px 112px; gap: 16px; align-items: center; }
.dev-th { padding: 10px 18px; }
.lbl { font: 600 12px/16px Inter, sans-serif; letter-spacing: .6px; text-transform: uppercase; color: var(--ink-muted); }
.dev-group { padding: 14px 18px 6px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dev-row { padding: 10px 18px; min-height: 64px; border-top: 1px solid var(--line); cursor: pointer; }
.dev-row:hover { background: var(--surface); }
.dev-row.sel { background: var(--accent-soft); }
.dev-row.stale .dev-name b { color: var(--ink-muted); }
.dev-name { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; align-items: center; min-width: 0; }
.dev-name b { display: block; font-size: 15px; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dev-name small { display: block; font-size: 13px; line-height: 18px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.this-device { margin-left: 6px; font-size: 12px; vertical-align: 1px; }
.dev-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--surface-sunken); display: grid; place-items: center; color: var(--ink); flex: none; }
.dev-ic.shared { background: var(--accent-soft); color: var(--accent); }
.dev-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dev-who .t { min-width: 0; font-size: 14px; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.faces { display: flex; flex: none; padding-right: 6px; }
.faces .avatar { width: 28px; height: 28px; font-size: 12px; margin-right: -6px; box-shadow: 0 0 0 2px var(--surface-raised); }
.faces .avatar.ask { box-shadow: 0 0 0 2px var(--surface-raised), 0 0 0 4px var(--warning); }
.faces .avatar.off { opacity: .4; }
.seen { display: flex; align-items: center; gap: 8px; font-size: 14px; line-height: 20px; white-space: nowrap; }
.seen .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--ink-muted); }
.seen .dot.on { background: var(--good); }
.seen .dot.old { background: var(--warning); }
.seen.old { color: var(--warning); font-weight: 600; }
.theme-t { font-size: 14px; color: var(--ink-muted); white-space: nowrap; }
/* Below a laptop the five columns don't fit: each row takes two lines and names wrap. */
@media (max-width: 1023px) {
  .hide-phone { display: none; }
  .dev-name b, .dev-name small, .dev-who .t { white-space: normal; }
  .dev-cols { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name btn" "who seen"; gap: 6px 12px; }
  .dev-th, .theme-t { display: none; }
  .dev-name { grid-area: name; }
  .dev-who { grid-area: who; padding-left: 52px; }
  .seen { grid-area: seen; justify-self: end; }
  .dev-row > .btn { grid-area: btn; }
}

/* One device: in the 440 px side panel on a laptop, its own page below that. */
.device-panel { gap: 16px; }
.device-panel.keep-inline { border: 0; padding: 0; }
.device-head { gap: 12px; }
.device-title { margin: 0; font: 600 20px/26px Outfit, Inter, sans-serif; }
.device-panel .field > .row input, .device-panel .field > .row select { flex: 1; min-width: 0; }
.device-panel .seg { display: flex; }
.device-panel .seg button { flex: 1; padding: 0 8px; white-space: nowrap; }
.person-row { display: flex; align-items: center; gap: 10px; min-height: 52px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.person-row .avatar { width: 32px; height: 32px; font-size: 13px; }
.device-end { margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.device-end p { margin: 0; }
/* --- The side menu's foot: a rule, then Sign out --- */
@media (min-width: 1024px) {
  .menu-folded .side-rule { align-self: center; }
  .side-item { min-height: var(--tap); padding: 0 12px; display: flex; align-items: center; gap: 12px; border: 0; border-radius: var(--radius-md); background: none; color: var(--ink); font: 500 16px/24px Inter, sans-serif; text-align: left; cursor: pointer; }
  .side-item:hover { background: var(--surface); }
  .side-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
  .menu-folded .side-item { width: 52px; justify-content: center; padding: 0; }
  .side-toggle { margin-top: 0; }
}

/* --- A parent's Today in the display's grid: the well, then header, events and tasks, the days --- */
.dash-card { background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.dash-h2 { margin: 0; flex: 1; font: 600 22px/28px Outfit, Inter, sans-serif; }
.btn-mini { min-height: var(--tap); padding: 0 14px; font-size: 14px; white-space: nowrap; }
.dash-clock { font: 600 80px/84px Outfit, Inter, sans-serif; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.dash-date { font-size: 20px; line-height: 26px; font-weight: 600; }
.dash-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.dash-chips .chip { margin: 0; }
.dash-weather { padding: 14px 16px; display: flex; gap: 14px; align-items: center; }
.dash-wx { font-size: 40px; line-height: 1; }
.dash-temp { font: 600 32px/36px Outfit, Inter, sans-serif; font-variant-numeric: tabular-nums; }
.dash-wear-card { padding: 14px 16px; }
.dash-wear { margin-top: 4px; font-size: 18px; line-height: 24px; font-weight: 600; }
.dash-alert { padding: 12px 16px; display: flex; gap: 12px; border-radius: var(--radius-lg); background: var(--critical-soft); }
.dash-alert b { color: var(--critical); }
.critical-text { color: var(--critical); font-weight: 600; }
.good-text { color: var(--good); font-weight: 600; }

.needs { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.needs > p { margin: 0; }
.need { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: var(--radius-md); background: var(--warning-soft); }
.need-what { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-items: center; }
.need-icon { font-size: 22px; line-height: 1; text-align: center; }
.need-kind { display: block; font: 600 11px/14px Inter, sans-serif; letter-spacing: 0.5px; text-transform: uppercase; color: var(--warning); }
.need b { font-size: 15px; line-height: 20px; overflow-wrap: anywhere; }
.need-buttons { display: flex; gap: 8px; }
.need-buttons .btn { flex: 1; min-height: var(--tap); padding: 0 12px; font-size: 14px; }

.count { flex: none; padding: 8px 14px; display: flex; align-items: center; gap: 10px; }
.count b { font: 600 26px/30px Outfit, Inter, sans-serif; color: var(--accent); font-variant-numeric: tabular-nums; }
.count span { font-size: 14px; line-height: 17px; white-space: nowrap; }

.dash-panel { padding: 20px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.dash-panel-head { display: flex; align-items: center; gap: 12px; }
.dash-scroll { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.dash-sub { margin-top: 6px; }
.ev { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 14px; border-radius: var(--radius-md); background: var(--surface-sunken); }
.ev[data-next="true"] { background: var(--accent-soft); }
.ev[data-past="true"] { opacity: 0.55; }
.ev-time { font-size: 15px; line-height: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ev-body { min-width: 0; display: flex; flex-direction: column; }
.ev-title { font-size: 16px; line-height: 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-meta { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 14px; line-height: 20px; color: var(--ink-muted); }
.ev-meta > span:not(.dash-dots) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-meta a.where-link { min-width: 0; margin: -12px 0; }
.ev .chip { margin: 0; }
.dash-dots { display: inline-flex; flex: none; }
.dash-dots i { width: 10px; height: 10px; border-radius: 50%; margin-right: -2px; box-shadow: 0 0 0 2px var(--surface-sunken); }

.kid-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 14px; min-height: 0; }
.kidc { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: var(--radius-md); background: var(--surface-sunken); min-width: 0; container-type: inline-size; }
/* A narrow kid card puts the buttons under the task, so they never cover its name. */
@container (max-width: 340px) {
  .tk { grid-template-columns: 28px minmax(0, 1fr); padding: 8px 6px 8px 12px; }
  .tk-buttons { grid-column: 2; }
}
.kidc-head { display: flex; align-items: center; gap: 12px; }
.kidc-head b { font-size: 17px; line-height: 22px; }
.kidc-head .progress { display: block; margin: 6px 0 0; }
.kidc .fold { text-align: left; }
.tk { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 52px; padding: 4px 6px 4px 12px; border-radius: 12px; background: var(--surface-raised); }
.tk[data-s="later"] { background: transparent; border: 2px dashed var(--line); }
.tk[data-s="done"] { opacity: 0.7; }
.tk[data-s="missed"] { background: var(--critical-soft); }
.yesterday { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.yesterday h3 { margin: 0; font: 600 16px/22px Outfit, Inter, sans-serif; }
.yesterday-kid { display: flex; flex-direction: column; gap: 6px; }
.tk-icon { font-size: 20px; text-align: center; }
.tk-body { min-width: 0; }
.tk-body b { font-size: 15px; line-height: 20px; }
.tk-buttons { display: flex; gap: 4px; }
.tk-delete { width: var(--tap); padding: 0; color: var(--ink-muted); }

.dash-days { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.dash-day { min-width: 0; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; overflow: hidden; }
.dash-day.first { box-shadow: inset 0 0 0 2px var(--accent); }
.dash-day header { display: flex; justify-content: space-between; gap: 8px; }
.dash-day header b { font-size: 15px; }
.dash-day-note { font-size: 14px; line-height: 20px; color: var(--ink-muted); }
.dash-day-ev { display: flex; gap: 8px; align-items: center; min-width: 0; font-size: 14px; line-height: 20px; }
.dash-day-ev i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dash-day-ev .clip { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Phones and tablets: one column; the countdowns and days scroll sideways. */
.narrow-head .muted.small.keep { display: block; }
.dash-now-card { padding: 12px 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
.dash-now-date, .dash-now-line { grid-column: 1 / -1; }
.dash-now-card .dash-clock { font-size: 44px; line-height: 48px; letter-spacing: 0; }
.dash-now-wx { display: flex; align-items: center; gap: 8px; font-size: 30px; }
.dash-now-wx .dash-temp { font-size: 24px; }
.dash-now-date { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; }
.dash-now-date .dash-chips { margin: 0; }
.dash-now-wear { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 10px; padding-top: 6px; border-top: 1px solid var(--line); font-size: 14px; line-height: 20px; }
body:not(.shell) .dash-panel { padding: 14px; }
body:not(.shell) .dash-h2 { font-size: 19px; line-height: 24px; }
body:not(.shell) .ev { grid-template-columns: max-content minmax(0, 1fr) auto; gap: 10px; padding: 8px 12px; }
.ev-time { white-space: nowrap; }
/* With the pill pair, the pill already names the kid. */
.kid-pills ~ .kid-cols .kidc-head .avatar, .kid-pills ~ .kid-cols .kidc-head b { display: none; }
.dash-days.scroll .dash-day header { flex-direction: column; gap: 0; }
.dash-strip, .dash-days.scroll { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.dash-strip::-webkit-scrollbar, .dash-days.scroll::-webkit-scrollbar { display: none; }
.dash-strip .count { padding: 6px 12px; gap: 8px; }
.dash-strip .count b { font-size: 20px; line-height: 24px; }
.dash-strip .count span { font-size: 13px; line-height: 16px; }
.dash-days.scroll .dash-day { flex: none; width: 140px; padding: 10px 12px; gap: 4px; }
.kid-pills { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.kid-pills::-webkit-scrollbar { display: none; }
.kid-pills button { flex: 1 0 auto; min-height: var(--tap); display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-raised); color: var(--ink); font: 600 14px/1 Inter, sans-serif; white-space: nowrap; overflow: hidden; cursor: pointer; }
.kid-pills button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.kid-pills .avatar { width: 22px; height: 22px; font-size: 10px; }
body:not(.shell) .kidc { padding: 0; background: none; }
body:not(.shell) .tk { background: var(--surface-sunken); }
@media (min-width: 640px) {
  .dash-strip, .dash-days.scroll { margin: 0; padding: 0; }
}

@media (min-width: 1024px) {
  .shell-main.today-main { padding: 24px; }
  .dash { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 24px; align-items: start; }
  .dash-well { padding: 24px 20px; display: flex; flex-direction: column; gap: 14px; border-radius: var(--radius-lg); background: var(--surface-sunken); }
  .dash-well .needs { margin-top: auto; }
  .dash-main { min-width: 0; display: flex; flex-direction: column; gap: 24px; }
  .dash-head { min-height: 72px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
  .dash-hello { flex: none; }
  .dash-hello h1 { margin: 0; font: 600 28px/34px Outfit, Inter, sans-serif; white-space: nowrap; }
  /* Below 1440 px the counts get their own row under the greeting; they scroll if they still don't fit. */
  .dash-counts { flex: 1 1 100%; min-width: 0; display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; }
  .dash-mid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
}
/* From 1440 px the grid fills the window like the wall display, and each panel scrolls inside. */
@media (min-width: 1440px) and (min-height: 760px) {
  .shell-main.today-main { height: 100vh; }
  .dash { flex: 1; min-height: 0; align-items: stretch; }
  .dash-well { min-height: 0; overflow-y: auto; }
  .dash-main { min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1.8fr) minmax(0, 1fr); }
  .dash-mid { min-height: 0; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
  .kid-cols { grid-template-columns: repeat(var(--kids, 1), minmax(0, 1fr)); }
  .dash-head { flex-wrap: nowrap; }
  .dash-counts { flex: 1 1 auto; justify-content: safe flex-end; }
  .dash-panel { min-height: 0; overflow: hidden; }
  .dash-scroll { flex: 1; overflow-y: auto; }
  /* The kid cards and Yesterday scroll together inside the tasks panel. */
  .dash-panel.dash-tasks { overflow-y: auto; }
  .dash-tasks > * { flex-shrink: 0; }
  .dash-days { grid-template-columns: repeat(6, minmax(0, 1fr)); min-height: 0; }
  .app-shell.drawer-open .dash-mid { grid-template-columns: minmax(0, 1fr); }
  .app-shell.drawer-open .dash-days { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* --- A kid's Today in the parent grid: tiles to tick, their stars in the well --- */
.my-tasks-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.my-tasks-head h2 { flex: 0 1 auto; white-space: nowrap; }
.my-tasks-head .progress { flex: 1 1 80px; max-width: 160px; margin: 0 0 0 auto; }
.my-tasks .progress > span { background: var(--accent); }
.my-tasks .job-entry { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); grid-auto-rows: max-content; gap: 10px; }
.tile-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.tile { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 64px; padding: 10px 12px; border: 2px solid var(--line); border-radius: var(--radius-md); background: var(--surface-raised); }
.tile .ic { width: 48px; height: 48px; display: grid; place-items: center; border-radius: var(--radius-md); background: var(--surface-sunken); font-size: 26px; line-height: 1; }
.tile-body { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.tile .task-title { font-size: 18px; line-height: 22px; overflow-wrap: anywhere; }
.tile .reward { font-size: 13px; line-height: 18px; padding: 0 8px; }
.tile .go { width: var(--tap); height: var(--tap); border: 0; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 22px; line-height: 1; cursor: pointer; }
.tile .go:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile[data-s="job"] { border-color: var(--accent); background: var(--accent-soft); }
.tile[data-s="job"] .ic { background: var(--surface-raised); }
.tile[data-s="later"] { border-style: dashed; background: transparent; }
.tile[data-s="done"] { opacity: 0.7; }
.my-stars { margin-top: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.my-stars .row { align-items: center; }
@media (min-width: 1024px) {
  .kid-main.kid-today { padding: 16px; }
  .kid-dash { grid-template-columns: 250px minmax(0, 1fr); gap: 16px; }
  .kid-dash .dash-main { gap: 16px; }
}
/* A kid's tablet fills the screen like the wall display, and each panel scrolls inside. */
@media (min-width: 1024px) and (min-height: 700px) {
  .kid-main.kid-today { height: 100vh; box-sizing: border-box; }
  .kid-dash { flex: 1; min-height: 0; align-items: stretch; }
  .kid-dash .dash-well { min-height: 0; overflow-y: auto; }
  .kid-dash .dash-main { min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1.8fr) minmax(0, 1fr); }
  .kid-dash .dash-head { flex-wrap: nowrap; }
  .kid-dash .dash-counts { flex: 1 1 auto; justify-content: safe flex-end; }
  .kid-dash .dash-mid { min-height: 0; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
  .kid-dash .dash-panel { min-height: 0; overflow: hidden; }
  .kid-dash .dash-scroll { flex: 1; overflow-y: auto; }
  /* The tiles scroll; the Job board entry stays in view under them. */
  .kid-dash .my-tasks { min-height: 0; overflow: hidden; }
  .kid-dash .my-tasks > * { flex-shrink: 0; }
  .kid-dash .my-tasks > .tile-grid { flex: 1 1 auto; min-height: 0; overflow-y: auto; align-content: start; }
  .kid-dash .dash-days { min-height: 0; grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (min-width: 1440px) {
  .kid-dash { grid-template-columns: 360px minmax(0, 1fr); gap: 24px; }
}
/* A 250 px well takes the display's smaller clock. */
@media (min-width: 1024px) and (max-width: 1439px) {
  .kid-dash .dash-clock, .fscreen .dash-clock { font-size: 56px; line-height: 60px; }
  .kid-dash .dash-date, .fscreen .dash-date { font-size: 16px; line-height: 22px; }
}

/* --- The Family Screen in the parent grid: the job board in the well, everyone's tasks to tick --- */
.live-dot { flex: none; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-muted); font-size: 14px; }
.live-dot::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--good); }
.fscreen .dash-panel-head { flex-wrap: wrap; row-gap: 2px; }
.fscreen .dash-panel-head .dash-h2 { flex: 1 1 auto; }
.fjobs { margin-top: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.fjob { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 8px; align-items: center; min-height: 48px; padding: 6px 8px; border: 0; border-radius: 12px; background: var(--surface-sunken); color: var(--ink); font: inherit; text-align: left; }
button.fjob { cursor: pointer; }
button.fjob:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fjob[data-taken="true"] { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.fjob .job-ic { font-size: 22px; line-height: 1; text-align: center; }
.job-text { min-width: 0; }
.job-text b, .job-text small { display: block; overflow-wrap: anywhere; }
.job-text b { font-size: 14px; line-height: 18px; }
.job-text small { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.fwho { flex: none; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.fwho:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fwho .avatar { width: var(--tap); height: var(--tap); }
.ftk { display: grid; grid-template-columns: minmax(0, 1fr) auto var(--tap); gap: 10px; align-items: center; width: 100%; min-height: 52px; padding: 4px 4px 4px 12px; border: 0; border-radius: 12px; background: var(--surface-raised); color: var(--ink); font: 500 16px/20px Inter, sans-serif; text-align: left; cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
.ftk:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ftk-title { min-width: 0; overflow-wrap: anywhere; }
.ftk-when { color: var(--ink-muted); font-weight: 600; white-space: nowrap; }
/* A narrow kid card puts the time under the task, so the name keeps its line. */
@container (max-width: 360px) {
  .ftk { grid-template-columns: minmax(0, 1fr) var(--tap); padding-block: 6px; }
  .ftk-title { grid-column: 1; grid-row: 1; }
  .ftk-when { grid-column: 1; grid-row: 2; }
  .ftk .ring { grid-column: 2; grid-row: 1 / 3; }
}
.ftk .ring { width: var(--tap); height: var(--tap); box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 3px solid var(--line); border-radius: 50%; color: transparent; font-style: normal; font-size: 20px; }
.ftk[data-s="wait"] { background: var(--warning-soft); }
.ftk[data-s="wait"] .ftk-when { color: var(--warning); }
.ftk[data-s="wait"] .ring { border-style: dashed; border-color: var(--warning); }
.ftk[data-s="later"] { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.ftk[data-s="later"] .ring, .ftk[data-s="missed"] .ring { visibility: hidden; }
.ftk[data-s="missed"] { background: var(--critical-soft); }
.ftk[data-s="done"] { opacity: 0.7; }
.ftk[data-s="done"] .ring { border-color: var(--good); background: var(--good); color: var(--on-accent); }
body.on-screen .fscreen .kidc { padding: 12px; background: var(--surface-sunken); }
@media (min-width: 1024px) {
  .fscreen { grid-template-columns: 250px minmax(0, 1fr); gap: 16px; }
  .fscreen .dash-main { gap: 14px; }
  .fscreen .dash-mid { gap: 14px; }
}
/* A landscape screen fills the window like the wall display, and each panel scrolls inside. */
@media (min-width: 1024px) and (min-height: 700px) {
  body.on-screen .page { height: 100vh; box-sizing: border-box; }
  body.on-screen .view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .fscreen { flex: 1; min-height: 0; align-items: stretch; }
  .fscreen .dash-well { min-height: 0; overflow-y: auto; }
  .fscreen .dash-main { min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1.8fr) minmax(0, 1fr); }
  .fscreen .dash-head { flex-wrap: nowrap; }
  .fscreen .dash-counts { flex: 1 1 auto; justify-content: safe flex-end; }
  .fscreen .dash-mid { min-height: 0; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
  .fscreen .dash-panel { min-height: 0; overflow: hidden; }
  .fscreen .dash-scroll { flex: 1; overflow-y: auto; }
  .fscreen .dash-panel.dash-tasks { overflow-y: auto; }
  .fscreen .kid-cols { grid-template-columns: repeat(var(--kids, 1), minmax(0, 1fr)); }
  .fscreen .dash-days { min-height: 0; grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (min-width: 1440px) {
  .fscreen { grid-template-columns: 360px minmax(0, 1fr); gap: 24px; }
}
.fscreen .live-dot { margin-left: auto; }
