/* Hallmark · shape: app screen · genre: modern-minimal · theme: Coral (by request)
 * nav: left sidebar workspace, grouped (Today, People, Money, Collective), top bar under 60rem, bottom tabs on phone · signature: the Needs attention queue, one action per item with undo · states: full, empty (every list), resolved with undo
 * axes: light/grotesk-sans/warm · posture: restrained · contrast: pass · v2.0.0 */
/* Hallmark · pre-emit critique: P4 H4 E4 S4 R5 V4 · weakest: S, a sidebar workspace fits any CRM; made it this collective's by leading with the queue of real chores (failed debit, VOG, turning 21) and saying whose account the money lands in on every row */
/* Hallmark · dismissed F4 · the pressed role chip and day chip are selection states, not filled buttons; the coral primary is the only filled action recipe */
/* Hallmark · dismissed F25 · the 375 capture shows every attention item, the phone list wraps the action under the text rather than hiding it */
@import url("./tokens.css");
@import url("./base.css");

:root {
  /* Workspace palette: warm grey-white canvas, white panels, one mellow coral */
  --color-canvas: oklch(98% 0.009 38);
  --color-panel: oklch(99.6% 0.0015 80);
  --color-side: oklch(95.6% 0.018 55);
  --color-side-hover: oklch(92.6% 0.034 46);
  --color-row-hover: oklch(97.6% 0.012 70);
  --color-hair: oklch(92.4% 0.011 70);
  --color-hair-2: oklch(88.5% 0.007 70);
  --color-track: oklch(93.6% 0.014 68);
  --color-bar: oklch(68% 0.09 168);
  --color-ink: oklch(24% 0.01 50);
  --color-ink-2: oklch(36% 0.011 50);
  --color-muted: oklch(49% 0.012 55);
  --color-edge: oklch(58% 0.012 55);
  --color-edge-soft: oklch(84% 0.008 60);
  --color-accent: oklch(77% 0.092 33);
  --color-accent-hover: oklch(73.5% 0.098 33);
  --color-accent-ink: oklch(24% 0.01 50);
  --color-select: oklch(91.8% 0.05 38);
  --color-now: oklch(96% 0.03 168);
  --color-switch-on: oklch(80% 0.06 30);
  --color-switch-on-hover: oklch(77% 0.065 30);
  --color-switch-edge: oklch(64% 0.06 30);
  --color-accent-line: oklch(62% 0.11 33);
  --color-focus: oklch(55% 0.13 30);
  --color-scrim: oklch(98% 0.009 38 / 0.72);
  --tint-ok: oklch(95.2% 0.03 155); --tint-ok-ink: oklch(37% 0.065 155);
  --tint-warn: oklch(95.4% 0.042 88); --tint-warn-ink: oklch(37% 0.04 75);
  --tint-bad: oklch(94.6% 0.03 12); --tint-bad-ink: oklch(41% 0.085 12);
  --tint-plain: oklch(94.6% 0.005 70); --tint-plain-ink: oklch(36% 0.011 50);

  --font-ui: "General Sans", "Manrope", ui-sans-serif, system-ui, sans-serif;
  --font-display: var(--font-ui); --font-body: var(--font-ui);

  --fs-data: 12px; --fs-sm: 13px; --fs-body: 14px; --fs-lead: 16px; --fs-figure: 24px; --fs-title: 22px;
  --space-20: 20px; --space-32: 32px;
  --radius-panel: 8px; --radius-ctl: 6px; --radius-tag: 4px;
  --shadow-panel: inset 0 0 0 1px var(--color-hair), 0 1px 2px oklch(30% 0.02 50 / 0.04), 0 2px 6px -2px oklch(30% 0.02 50 / 0.05);
  --shadow-lift: 0 0 0 1px var(--color-hair-2), 0 6px 18px -6px oklch(30% 0.02 50 / 0.16);
  --shadow-chip: 0 0 0 1px var(--color-hair-2), 0 1px 2px oklch(30% 0.02 50 / 0.08);
  --shade-1: 0 1px 2px oklch(30% 0.02 50 / 0.08); --shade-2: 0 1px 2px oklch(30% 0.02 50 / 0.25);
  --side-w: 240px;
  --ctl-h: 32px;
  --tabbar-h: 60px;
}

body { background: var(--color-canvas); color: var(--color-ink); font-family: var(--font-ui); font-size: var(--fs-body); font-weight: 500; line-height: 1.45; letter-spacing: -0.006em; }
h1, h2, h3 { font-family: var(--font-ui); letter-spacing: -0.012em; }
.skip { position: absolute; left: var(--space-xs); top: var(--space-xs); z-index: var(--z-tooltip); padding: var(--space-xs) var(--space-sm); background: var(--color-panel); border-radius: var(--radius-ctl); box-shadow: var(--shadow-lift); transform: translateY(-200%); }
.skip:focus-visible { transform: none; }
.noscript { padding: var(--space-lg); }
svg { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Shell ---------- */
body { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100dvh; }
.topbar { display: none; }
.sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--side-w); height: 100dvh; display: flex; flex-direction: column; gap: var(--space-sm); padding: var(--space-md) var(--space-sm) var(--space-2xl); background: var(--color-side); box-shadow: inset -1px 0 0 var(--color-hair); overflow-y: auto; z-index: var(--z-sticky); }
.main { grid-column: 2; grid-row: 1; min-width: 0; width: 100%; max-width: 1240px; padding: var(--space-lg) var(--space-32) var(--space-2xl); }
.main:focus { outline: none; }
.scrim, .tabbar { display: none; }

.brand { display: flex; flex-direction: column; gap: var(--space-3xs); padding: var(--space-2xs) var(--space-xs) var(--space-xs); }
.rl-short { display: none; }
.wordmark { font-size: var(--fs-lead); font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; color: var(--color-ink); text-wrap: balance; }
.demo { font-size: var(--fs-data); color: var(--color-muted); white-space: nowrap; }

/* Role switch: a two-stop segmented control */
.roleswitch { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3xs); padding: var(--space-3xs); background: var(--color-track); border-radius: var(--radius-ctl); }
.roleswitch button { height: 32px; border: 0; border-radius: var(--radius-tag); background: transparent; color: var(--color-muted); font-size: var(--fs-sm); font-weight: 500; cursor: pointer; white-space: nowrap; padding: 0 var(--space-xs); transition: background-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out); }
.roleswitch button:hover { color: var(--color-ink); }
.roleswitch button:active { transform: translateY(1px); }
.roleswitch button[aria-pressed="true"] { background: var(--color-panel); color: var(--color-ink); box-shadow: var(--shadow-chip); }
.roleswitch button:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 1px; }

.who { display: flex; align-items: center; gap: var(--space-xs); padding: 0 var(--space-xs); min-height: 32px; }
.who:empty { display: none; }
.who b { display: block; font-size: var(--fs-sm); font-weight: 600; }
.who small { display: block; font-size: var(--fs-data); color: var(--color-muted); }

.nav { display: flex; flex-direction: column; gap: var(--space-3xs); }
.nav--foot { margin-top: auto; }
.navgroup { display: flex; flex-direction: column; gap: var(--space-3xs); margin-top: var(--space-sm); }
.navgroup > span { padding: 0 var(--space-xs) var(--space-2xs); font-size: var(--fs-data); color: var(--color-muted); }
.navlink { display: flex; align-items: center; gap: var(--space-xs); min-height: 32px; padding: 0 var(--space-xs); border-radius: var(--radius-ctl); color: var(--color-ink-2); text-decoration: none; font-size: var(--fs-body); white-space: nowrap; transition: background-color var(--dur-micro) var(--ease-out); }
.navlink svg { width: 16px; height: 16px; color: var(--color-muted); }
.navlink:hover { background: var(--color-side-hover); color: var(--color-ink); }
.navlink:active { transform: translateY(1px); }
.navlink[aria-current="page"] { background: var(--color-select); color: var(--color-ink); }
.navlink[aria-current="page"] svg { color: var(--color-accent-line); }
.navlink .count { margin-left: auto; font-size: var(--fs-data); color: var(--color-muted); }
.navlink.is-new { animation: arrive var(--dur-long) var(--ease-out); }
@keyframes arrive { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }

/* ---------- Page header ---------- */
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); flex-wrap: wrap; min-height: 40px; margin-bottom: var(--space-md); }
.pagehead h1 { font-size: var(--fs-title); font-weight: 600; max-width: none; line-height: 1.2; }
.pagehead .sub { font-size: var(--fs-sm); color: var(--color-muted); margin-top: var(--space-3xs); }
.pagehead .tools { display: flex; gap: var(--space-xs); flex-wrap: wrap; align-items: center; }

/* ---------- Panels ---------- */
.panel { background: var(--color-panel); border-radius: var(--radius-panel); box-shadow: var(--shadow-panel); min-width: 0; }
.phead { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); min-height: 44px; padding: var(--space-xs) var(--space-md); box-shadow: inset 0 -1px 0 var(--color-hair); }
.phead h2 { font-size: var(--fs-body); font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; max-width: none; }
.phead .meta { font-size: var(--fs-sm); color: var(--color-muted); white-space: nowrap; }
.pbody { padding: var(--space-sm) var(--space-md); }
.pbody--flush { padding: 0; }
.pfoot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); padding: var(--space-xs) var(--space-md); box-shadow: inset 0 1px 0 var(--color-hair); font-size: var(--fs-sm); color: var(--color-muted); min-height: 40px; }

.home { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--space-md); align-items: start; }
.home .col { display: grid; gap: var(--space-md); align-content: start; min-width: 0; }
.home .foot { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-md); align-items: start; }
.home .foot.has-wait { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }

/* ---------- Rows and lists ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li + li { box-shadow: inset 0 1px 0 var(--color-hair); }
.row { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-sm) var(--space-md); min-height: 48px; }
.row .grow { flex: 1; min-width: 0; }
.row .line { font-size: var(--fs-body); color: var(--color-ink); }
.row .note { font-size: var(--fs-data); color: var(--color-muted); margin-top: var(--space-3xs); }
.row .right { margin-left: auto; display: flex; align-items: center; gap: var(--space-xs); flex: none; }

.av { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: var(--radius-ctl); background: var(--color-track); color: var(--color-ink-2); font-size: 11.5px; font-weight: 600; letter-spacing: 0; box-shadow: inset 0 0 0 1px var(--color-hair-2); }
.av[style] { background: oklch(93% 0.05 var(--h)); color: oklch(38% 0.085 var(--h)); }
.av svg { width: 15px; height: 15px; }
.av--sm { width: 22px; height: 22px; font-size: 11px; border-radius: var(--radius-tag); }

.att-item { transition: background-color var(--dur-short) var(--ease-out); }
.att-item.is-done { background: var(--color-row-hover); }
.att-item.is-done .line { color: var(--color-ink-2); }
.att-item .tick { width: 28px; height: 28px; display: grid; place-items: center; border-radius: var(--radius-ctl); background: var(--tint-ok); color: var(--tint-ok-ink); flex: none; }
.att-item .tick svg { width: 16px; height: 16px; }
.att-item.is-leaving { animation: leave var(--dur-long) var(--ease-in) forwards; }
@keyframes leave { to { opacity: 0; transform: translateX(8px); } }
.checklist { list-style: none; margin: 0; padding: 0 var(--space-md) var(--space-sm) calc(28px + var(--space-sm) + var(--space-md)); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2xs) var(--space-md); font-size: var(--fs-sm); }
.checklist li { display: flex; align-items: center; gap: var(--space-xs); color: var(--color-ink-2); }
.checklist li svg { width: 14px; height: 14px; }
.checklist .no { color: var(--tint-bad-ink); }
.checklist .yes svg { color: var(--tint-ok-ink); }
.checklist + .inline-act { padding: 0 var(--space-md) var(--space-sm) calc(28px + var(--space-sm) + var(--space-md)); }

/* ---------- Buttons ---------- */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2xs); height: var(--ctl-h); padding: 0 var(--space-sm); border: 0; border-radius: var(--radius-ctl); background: var(--color-panel); color: var(--color-ink); box-shadow: var(--shadow-chip); font-size: var(--fs-sm); font-weight: 500; white-space: nowrap; cursor: pointer; text-decoration: none; transition: background-color var(--dur-micro) var(--ease-out), box-shadow var(--dur-micro) var(--ease-out); }
.btn svg { width: 15px; height: 15px; }
.btn:hover { background: var(--color-row-hover); box-shadow: 0 0 0 1px var(--color-edge), var(--shade-1); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--color-track); color: var(--color-muted); box-shadow: none; cursor: not-allowed; }
.btn--primary { background: var(--color-accent); color: var(--color-accent-ink); box-shadow: inset 0 0 0 1px var(--color-accent-hover); }
.btn--primary:hover { background: var(--color-accent-hover); box-shadow: inset 0 0 0 1px var(--color-accent-line); }
.btn--ghost { background: transparent; box-shadow: none; color: var(--color-ink-2); padding: 0 var(--space-xs); }
.btn--ghost:hover { background: var(--color-track); box-shadow: none; }
.btn--link { background: transparent; box-shadow: none; color: var(--color-ink); text-decoration: underline; text-decoration-color: var(--color-accent-line); text-underline-offset: 0.2em; padding: 0 var(--space-2xs); height: 32px; }
.btn--link:hover { background: transparent; box-shadow: none; text-decoration-thickness: 2px; }
.iconbtn { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: var(--radius-ctl); background: transparent; color: var(--color-ink); cursor: pointer; }
.iconbtn:hover { background: var(--color-track); }
.iconbtn:active { transform: translateY(1px); }
.iconbtn:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 1px; }

/* ---------- Tags ---------- */
.tag { display: inline-flex; align-items: center; gap: var(--space-2xs); height: 22px; padding: 0 var(--space-xs); border-radius: var(--radius-tag); font-size: var(--fs-data); font-weight: 500; white-space: nowrap; background: var(--tint-plain); color: var(--tint-plain-ink); }
.tag--ok { background: var(--tint-ok); color: var(--tint-ok-ink); }
.tag--warn { background: var(--tint-warn); color: var(--tint-warn-ink); }
.tag--bad { background: var(--tint-bad); color: var(--tint-bad-ink); }
.tag--now { background: var(--color-panel); color: var(--color-ink); box-shadow: inset 0 0 0 1px var(--color-hair-2); }

/* ---------- Figures and bars ---------- */
.figure { font-variant-numeric: tabular-nums; }
.bigfig { display: flex; align-items: baseline; gap: var(--space-xs); flex-wrap: wrap; }
.bigfig strong { font-size: var(--fs-figure); font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.bigfig span { font-size: var(--fs-sm); color: var(--color-muted); }
.meter { height: 6px; border-radius: var(--radius-tag); background: var(--color-track); overflow: hidden; }
.meter i { display: block; height: 100%; width: 100%; border-radius: var(--radius-tag); background: var(--color-bar); transform-origin: left; transform: scaleX(var(--v, 0)); }
.meter--accent i { background: var(--color-accent); }
.kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0; margin: 0; font-size: var(--fs-sm); }
.kv dd { padding-left: var(--space-md); }
.kv > * { padding: var(--space-xs) 0; box-shadow: inset 0 1px 0 var(--color-hair); }
.kv > :nth-child(-n + 2) { box-shadow: none; }
.kv dt { color: var(--color-ink-2); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.kv dd small { color: var(--color-muted); font-size: var(--fs-data); margin-left: var(--space-2xs); }
.kv .muted { color: var(--color-muted); }

.loadlist { list-style: none; margin: 0; padding: var(--space-2xs) 0; }
.loadlist li { display: grid; grid-template-columns: 22px 64px minmax(0, 1fr) 52px; align-items: center; gap: var(--space-sm); padding: var(--space-2xs) var(--space-md); min-height: 32px; font-size: var(--fs-sm); }
.loadlist .n { text-align: right; color: var(--color-ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.loadlist .off { color: var(--color-muted); font-size: var(--fs-data); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats > div { padding: var(--space-sm) var(--space-md); }
.stats > div + div { box-shadow: inset 1px 0 0 var(--color-hair); }
.stats b { display: block; font-size: var(--fs-title); font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stats span { display: block; font-size: var(--fs-data); color: var(--color-muted); }
.stats--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cost-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-lg); }
.stats small { display: block; font-size: var(--fs-data); color: var(--color-muted); margin-top: var(--space-3xs); }

/* ---------- Tables ---------- */
.tablewrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.t th { text-align: left; font-weight: 500; font-size: var(--fs-data); color: var(--color-muted); padding: var(--space-xs) var(--space-sm); white-space: nowrap; box-shadow: inset 0 -1px 0 var(--color-hair); }
.t td { padding: var(--space-xs) var(--space-sm); vertical-align: middle; box-shadow: inset 0 -1px 0 var(--color-hair); }
.t tbody tr:last-child td { box-shadow: none; }
.t tbody tr:hover td { background: var(--color-row-hover); }
.t th:first-child, .t td:first-child { padding-left: var(--space-md); }
.t th:last-child, .t td:last-child { padding-right: var(--space-md); }
.t .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t .sub { display: block; font-size: var(--fs-data); color: var(--color-muted); }
.t .name { font-weight: 600; color: var(--color-ink); }
.t tr.grouphead td { background: var(--color-row-hover); font-size: var(--fs-data); color: var(--color-ink-2); padding-top: var(--space-2xs); padding-bottom: var(--space-2xs); }
.t tr.in-group td:first-child { padding-left: var(--space-32); }
.t .acts { text-align: right; white-space: nowrap; }

/* ---------- Toolbar: search and filters ---------- */
.toolbar { display: flex; gap: var(--space-xs); align-items: center; flex-wrap: wrap; padding: var(--space-sm) var(--space-md); box-shadow: inset 0 -1px 0 var(--color-hair); }
.search { position: relative; flex: 1 1 220px; max-width: 320px; }
.search svg { position: absolute; left: var(--space-xs); top: 50%; width: 15px; height: 15px; transform: translateY(-50%); color: var(--color-muted); pointer-events: none; }
.search input { width: 100%; height: var(--ctl-h); padding: 0 var(--space-xs) 0 var(--space-32); border: 1px solid var(--color-edge); border-radius: var(--radius-ctl); background: var(--color-panel); color: var(--color-ink); font-size: var(--fs-sm); }
.search input::placeholder { color: var(--color-muted); }
.search input:hover { border-color: var(--color-ink-2); }
.search input:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 0; }
.filters { display: flex; gap: var(--space-2xs); flex-wrap: wrap; }
.chip { height: 32px; padding: 0 var(--space-sm); border: 0; border-radius: var(--radius-ctl); background: transparent; color: var(--color-ink-2); font-size: var(--fs-sm); font-weight: 500; cursor: pointer; white-space: nowrap; box-shadow: inset 0 0 0 1px var(--color-hair-2); transition: background-color var(--dur-micro) var(--ease-out); }
.chip:hover { background: var(--color-row-hover); color: var(--color-ink); }
.chip:active { transform: translateY(1px); }
.chip[aria-pressed="true"] { background: var(--color-select); color: var(--color-ink); box-shadow: inset 0 0 0 1px var(--color-ink-2); }
.chip:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 1px; }
.chip .c { color: var(--color-muted); margin-left: var(--space-2xs); }

/* ---------- Segmented control (attendance, formula, language) ---------- */
.seg { display: inline-flex; padding: var(--space-3xs); gap: var(--space-3xs); background: var(--color-track); border-radius: var(--radius-ctl); }
.seg button { height: 32px; padding: 0 var(--space-sm); border: 0; border-radius: var(--radius-tag); background: transparent; color: var(--color-ink-2); font-size: var(--fs-sm); font-weight: 500; cursor: pointer; white-space: nowrap; transition: background-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out); }
.seg button:hover { color: var(--color-ink); background: var(--color-side-hover); }
.seg button:active { transform: translateY(1px); }
.seg button[aria-pressed="true"] { background: var(--color-panel); color: var(--color-ink); box-shadow: var(--shadow-chip); }
.seg button:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 1px; }
.seg--att button[aria-pressed="true"][data-v="attended"] { background: var(--tint-ok); color: var(--tint-ok-ink); box-shadow: inset 0 0 0 1px var(--tint-ok-ink); }
.seg--att button[aria-pressed="true"][data-v="noshow"], .seg--att button[aria-pressed="true"][data-v="late"] { background: var(--tint-bad); color: var(--tint-bad-ink); box-shadow: inset 0 0 0 1px var(--tint-bad-ink); }

/* ---------- Switch ---------- */
.switch { position: relative; width: 36px; height: 20px; flex: none; border: 0; padding: 0; border-radius: var(--radius-panel); background: var(--color-hair-2); box-shadow: inset 0 0 0 1px var(--color-edge); cursor: pointer; transition: background-color var(--dur-short) var(--ease-out); }
.switch::before { content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: var(--radius-tag); background: var(--color-panel); box-shadow: inset 0 0 0 1px var(--color-edge), var(--shade-1); transition: transform var(--dur-short) var(--ease-out); }
.switch[aria-checked="true"] { background: var(--color-switch-on); box-shadow: inset 0 0 0 1px var(--color-switch-edge); }
.switch[aria-checked="true"]::before { transform: translateX(16px); box-shadow: inset 0 0 0 1px var(--color-switch-edge), var(--shade-1); }
.switch:hover { background: var(--color-edge-soft); }
.switch[aria-checked="true"]:hover { background: var(--color-switch-on-hover); }
.switch:active::before { transform: scale(0.94); }
.switch[aria-checked="true"]:active::before { transform: translateX(16px) scale(0.94); }
.switch:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.switch:disabled { background: var(--color-track); cursor: not-allowed; }

.setrow { display: flex; align-items: center; gap: var(--space-md); padding: var(--space-sm) var(--space-md); min-height: 52px; }
.setrow + .setrow { box-shadow: inset 0 1px 0 var(--color-hair); }
.setrow .grow { flex: 1; min-width: 0; }
.setrow b { display: block; font-size: var(--fs-body); font-weight: 500; }
.setrow small { display: block; font-size: var(--fs-data); color: var(--color-muted); margin-top: var(--space-3xs); }
.settings { display: grid; gap: var(--space-md); max-width: 820px; }

/* ---------- Teacher today ---------- */
.today { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--space-md); align-items: start; }
.today .side { display: grid; gap: var(--space-md); }
.weekstrip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--space-2xs); padding: var(--space-xs); box-shadow: inset 0 -1px 0 var(--color-hair); }
.day { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; height: 48px; border: 0; border-radius: var(--radius-ctl); background: transparent; color: var(--color-ink-2); cursor: pointer; font-size: var(--fs-sm); font-weight: 500; transition: background-color var(--dur-micro) var(--ease-out); }
.day small { font-size: var(--fs-data); color: var(--color-muted); }
.day .short { display: none; }
@media (max-width: 40rem) { .day .short { display: inline; } }
.day:hover { background: var(--color-row-hover); }
.day:active { transform: translateY(1px); }
.day[aria-pressed="true"] { background: var(--color-select); color: var(--color-ink); box-shadow: inset 0 0 0 1px var(--color-ink-2); }
.day:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 1px; }

.timeline { list-style: none; margin: 0; padding: var(--space-xs) 0; }
.lesson { display: grid; grid-template-columns: 56px 12px minmax(0, 1fr); gap: var(--space-sm); padding: 0 var(--space-md); }
.lesson .when { padding-top: var(--space-sm); text-align: right; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; color: var(--color-ink); }
.lesson .when small { display: block; font-size: var(--fs-data); color: var(--color-muted); }
.lesson .rail { position: relative; }
.lesson .rail::before { content: ""; position: absolute; left: 5px; top: 0; bottom: 0; width: 1px; background: var(--color-hair-2); }
.lesson:first-child .rail::before { top: 20px; }
.lesson:last-child .rail::before { bottom: calc(100% - 20px); }
.lesson .rail i { position: absolute; left: 1px; top: 16px; width: 9px; height: 9px; border-radius: var(--radius-tag); background: var(--color-panel); box-shadow: inset 0 0 0 1.5px var(--color-edge); }
.lesson.is-past .rail i { background: var(--color-edge); }
.lesson.is-now .rail i { background: var(--color-ink-2); box-shadow: inset 0 0 0 1.5px var(--color-ink-2); }
.lesson .body { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-sm); padding: var(--space-sm) var(--space-sm); margin: var(--space-2xs) 0; border-radius: var(--radius-ctl); }
.lesson.is-now .body { background: var(--color-now); box-shadow: inset 0 0 0 1px var(--color-hair-2); }
.lesson .who2 { flex: 1 1 180px; min-width: 0; }
.lesson .who2 b { font-weight: 600; font-size: var(--fs-body); }
.lesson .who2 small { display: block; font-size: var(--fs-data); color: var(--color-muted); }
.lesson .ctl { display: flex; gap: var(--space-xs); align-items: center; flex-wrap: wrap; }

.illpanel { margin-bottom: var(--space-md); }
.illpanel .acts { display: flex; gap: var(--space-xs); flex-wrap: wrap; padding: var(--space-sm) var(--space-md); box-shadow: inset 0 1px 0 var(--color-hair); }

/* ---------- Reports ---------- */
.reports { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: var(--space-md); align-items: start; }
.replist { list-style: none; margin: 0; padding: var(--space-2xs); }
.repbtn { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); width: 100%; min-height: 40px; padding: 0 var(--space-sm); border: 0; border-radius: var(--radius-ctl); background: transparent; color: var(--color-ink-2); font-size: var(--fs-body); font-weight: 500; text-align: left; cursor: pointer; transition: background-color var(--dur-micro) var(--ease-out); }
.repbtn small { font-size: var(--fs-data); color: var(--color-muted); }
.repbtn:hover { background: var(--color-row-hover); color: var(--color-ink); }
.repbtn:active { transform: translateY(1px); }
.repbtn[aria-pressed="true"] { background: var(--color-select); color: var(--color-ink); box-shadow: inset 0 0 0 1px var(--color-ink-2); }
.repbtn:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 1px; }

/* ---------- Empty states ---------- */
.empty { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-xs); padding: var(--space-lg) var(--space-md); }
.empty b { font-size: var(--fs-body); font-weight: 600; }
.empty span { font-size: var(--fs-sm); color: var(--color-muted); }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: var(--space-lg); z-index: var(--z-toast); display: flex; align-items: center; gap: var(--space-xs); padding: var(--space-xs) var(--space-md); border-radius: var(--radius-ctl); background: var(--color-panel); color: var(--color-ink); box-shadow: var(--shadow-lift); font-size: var(--fs-sm); opacity: 0; transform: translate(-50%, 8px); pointer-events: none; transition: opacity var(--dur-short) var(--ease-out), transform var(--dur-short) var(--ease-out); white-space: nowrap; }
.toast svg { width: 15px; height: 15px; color: var(--tint-ok-ink); }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Mid widths ---------- */
@media (max-width: 75rem) {
  .home, .home .foot.has-wait { grid-template-columns: minmax(0, 1fr); }
  .home .col { display: contents; }
  .p-att { order: 1; } .p-week { order: 2; } .p-money { order: 3; } .p-enq { order: 4; } .p-ready { order: 5; } .home .foot { order: 6; }
  .today { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Under 60rem: top bar and a drawer ---------- */
@media (max-width: 60rem) {
  body { display: block; }
  .topbar { position: sticky; top: 0; z-index: var(--z-sticky-nav); display: flex; align-items: center; gap: var(--space-xs); height: 56px; padding: 0 var(--space-md) 0 var(--space-xs); background: var(--color-side); box-shadow: inset 0 -1px 0 var(--color-hair); }
  .brand--bar { padding: 0; gap: 2px; min-width: 0; flex: 1; }
  .brand--bar .wordmark { font-size: var(--fs-body); }
  .roleswitch--bar { margin-left: auto; flex: none; }
  .roleswitch--bar .rl-long { display: none; }
  .roleswitch--bar .rl-short { display: inline; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86%); height: 100dvh; z-index: var(--z-modal); transform: translateX(-104%); transition: transform var(--dur-short) var(--ease-out); box-shadow: inset -1px 0 0 var(--color-hair), var(--shadow-lift); }
  .sidebar .brand, .sidebar .roleswitch--side { display: none; }
  body.menu-open .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: calc(var(--z-modal) - 1); border: 0; background: var(--color-scrim); opacity: 0; pointer-events: none; transition: opacity var(--dur-short) var(--ease-out); }
  body.menu-open .scrim { opacity: 1; pointer-events: auto; }
  .main { padding: var(--space-md) var(--space-lg) var(--space-2xl); margin-inline: auto; }
  .reports { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Phone: bottom tabs ---------- */
@media (max-width: 40rem) {
  :root { --ctl-h: 40px; }
  .main { padding: var(--space-sm) var(--space-md) calc(var(--tabbar-h) + var(--space-3xl)); }
  .pagehead { margin-bottom: var(--space-sm); }
  .pagehead h1 { font-size: 20px; }
  .roleswitch--bar button { padding: 0 var(--space-xs); }
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-sticky-nav); display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: var(--space-2xs) var(--space-xs) env(safe-area-inset-bottom); background: var(--color-side); box-shadow: inset 0 1px 0 var(--color-hair); }
  .tablink { min-width: 0; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-3xs); border-radius: var(--radius-ctl); color: var(--color-muted); text-decoration: none; font-size: var(--fs-data); white-space: nowrap; }
  .tablink svg { width: 20px; height: 20px; }
  .tablink:active { transform: translateY(1px); }
  .tablink[aria-current="page"] { color: var(--color-ink); background: var(--color-select); }
  .tablink[aria-current="page"] svg { color: var(--color-accent-line); }
  .tablink:focus-visible { outline: 2px solid var(--color-focus); outline-offset: -2px; }
  nav[aria-label="Design options"] { bottom: calc(var(--tabbar-h) + 12px) !important; }
  .toast { bottom: calc(var(--tabbar-h) + 64px); }

  .btn, .chip, .seg button, .day, .repbtn { position: relative; }
  .btn::after, .chip::after, .seg button::after, .switch::after { content: ""; position: absolute; inset: -4px; }
  .chip, .seg button { height: 36px; }
  .seg--att { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  .row { flex-wrap: wrap; padding: var(--space-sm); }
  .phead, .pbody, .pfoot, .toolbar { padding-inline: var(--space-sm); }
  .att-item .right { margin-left: calc(28px + var(--space-sm)); }
  .att-item.is-done .right { margin-left: auto; }
  .checklist { grid-template-columns: minmax(0, 1fr); padding-left: var(--space-sm); }
  .checklist + .inline-act { padding-left: var(--space-sm); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats > div:nth-child(3) { box-shadow: inset 0 1px 0 var(--color-hair); }
  .stats > div:nth-child(4) { box-shadow: inset 1px 0 0 var(--color-hair), inset 0 1px 0 var(--color-hair); }
  .loadlist li { grid-template-columns: 22px 56px minmax(0, 1fr) 48px; padding-inline: var(--space-sm); }
  .lesson { grid-template-columns: 44px 12px minmax(0, 1fr); gap: var(--space-xs); padding: 0 var(--space-sm); }
  .lesson .body { padding: var(--space-sm) var(--space-xs); }
  .lesson.is-now .body { padding-inline: var(--space-sm); }
  .weekstrip { gap: var(--space-3xs); padding: var(--space-2xs); }
  .day { height: 52px; font-size: var(--fs-data); }
  .search { max-width: none; flex-basis: 100%; }
  .search input { font-size: var(--fs-lead); }

  .cost-grid { grid-template-columns: minmax(0, 1fr); }
  .setrow:has(.seg) { flex-wrap: wrap; }
  .setrow:has(.seg) .grow { flex-basis: 100%; }
  .p-att .row > .grow, .p-ready .row > .grow { flex-basis: calc(100% - 28px - var(--space-sm)); }
  .p-ready .row .right { margin-left: calc(28px + var(--space-sm)); }
  .p-enq .row > .grow { flex-basis: 100%; }
  .p-enq .row .right { margin-left: 0; }
  .day .long { display: none; }
  .lesson .ctl { width: 100%; }
  .seg--att button { padding: 0 var(--space-2xs); }
  .stats.stats--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats--3 > div:nth-child(3) { box-shadow: inset 1px 0 0 var(--color-hair); }
  .stats--3 > div { padding-inline: var(--space-sm); }
  .stats--3 b { font-size: var(--fs-lead); }
}

@media (prefers-reduced-motion: reduce) {
  .navlink.is-new, .att-item.is-leaving { animation: none; }
  .sidebar, .toast, .switch, .switch::before, .scrim { transition: none; }
}
