/* Luminary · Workshop Shadow Board
   Layout concept: the kid side is a shop wall. Jobs hang as tool silhouettes in painted outlines on
   perforated pegboard; the next job is clamped on the bench; progress is a tape measure; skills carry
   stamped label-tape part numbers. The parent side is the same shop's quiet office: steel, ink, one blue.
   Color strategy: Committed on the kid wall (pegboard + safety yellow), Restrained everywhere else. */

@font-face { font-family: "Atkinson Next"; src: url("/static/fonts/atkinson-next-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson Next"; src: url("/static/fonts/atkinson-next-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Big Shoulders"; src: url("/static/fonts/big-shoulders-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Big Shoulders"; src: url("/static/fonts/big-shoulders-800.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/static/fonts/jetbrains-mono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  /* light theme: white hardboard pegboard, black paint-pen outlines, safety-yellow fills */
  --ground: #eceef1;        /* page ground (shop floor-light gray) */
  --board: #f4f4f1;         /* pegboard face: white hardboard, a step lighter than the ground */
  --board-hole: #9aa2ab;    /* perforations: ~2.4:1 on the board, read as holes without crowding slot titles */
  --surface: #ffffff;       /* steel plate / panel */
  --surface-2: #e6e9ed;
  --surface-3: #d3d8de;
  --ink: #15181c;
  --ink-2: #414953;
  --ink-3: #59626d;
  --line: #c6ccd3;          /* dividers, panel and chip edges */
  --field-line: #8a939e;    /* input/select/textarea edge: 3:1 on --surface (WCAG 1.4.11) */
  --outline: #1b1f24;       /* paint-pen outline of an empty slot: black here, light gray on the dark board */
  --outline-dash: none;     /* solid in both themes: yellow means hung, so an empty outline is never yellow */
  --paint: #f2c200;         /* safety yellow: done fills, lumens, today's mark */
  --paint-ink: #2e2500;     /* text/strokes on yellow */
  --paint-soft: #fff1bf;
  --blue: #2361cc;          /* machinist blue: everything you can press */
  --blue-ink: #ffffff;
  --blue-soft: #dbe6f8;
  --red: #c93a26;           /* tool-chest red: boss fights, goal tab (never errors) */
  --red-soft: #f8dcd6;
  --good: #17703e;
  --good-ink: #ffffff;      /* text on a --good fill */
  --good-soft: #d9f0e2;
  --warn: #8a5200;
  --warn-soft: #fbe8c8;
  --bad: #b0341b;
  --bad-ink: #ffffff;       /* text on a --bad fill */
  --bad-soft: #f9ddd5;
  --tape-case: #2a2f36;
  --label-tape: #111316;    /* embossed label tape is black in both themes */
  --label-ink: #f3f4f5;
  --focus: #2361cc;
  --shadow: 0 1px 2px rgba(21, 24, 28, .08), 0 6px 18px rgba(21, 24, 28, .08);
  --shadow-hung: 0 2px 0 rgba(21, 24, 28, .18), 0 8px 14px rgba(21, 24, 28, .12);

  /* type: one workhorse sans for UI, an industrial condensed face for page titles only, mono for codes/measurements */
  --font-display: "Big Shoulders", "Arial Narrow", "Roboto Condensed", sans-serif;
  --font-body: "Atkinson Next", "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --step--1: .833rem;
  --step-0: 1rem;
  --step-1: 1.2rem;
  --step-2: 1.44rem;
  --step-3: 1.728rem;
  --title: 2.5rem;          /* display face is condensed; this is its comfortable title size */

  --r-sm: 3px;
  --r: 6px;
  --r-lg: 10px;
  --gap: 16px;
  --gutter: 16px;
  --rail: 236px;
  --hole: 22px;             /* pegboard pitch */
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #15181c; --board: #1d2126; --board-hole: #0c0e10; --surface: #23282f; --surface-2: #2b313a; --surface-3: #363d47;
    --ink: #eef1f4; --ink-2: #b6bec8; --ink-3: #939ca8; --line: #3a424c; --field-line: #6c7581;
    --outline: #b9c0c8; --outline-dash: none;
    --paint: #f2c200; --paint-ink: #1d1700; --paint-soft: #3a3210;
    --blue: #6aa5ff; --blue-ink: #07111f; --blue-soft: #1b2c48; --red: #ff6e57; --red-soft: #3d1d18;
    --good: #52cf8a; --good-ink: #06170d; --good-soft: #123222; --warn: #f0a640; --warn-soft: #3a2a10;
    --bad: #ff8a6b; --bad-ink: #240a04; --bad-soft: #3d1c14;
    --tape-case: #0f1114; --focus: #6aa5ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 22px rgba(0, 0, 0, .3);
    --shadow-hung: 0 2px 0 rgba(0, 0, 0, .55), 0 10px 18px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #15181c; --board: #1d2126; --board-hole: #0c0e10; --surface: #23282f; --surface-2: #2b313a; --surface-3: #363d47;
  --ink: #eef1f4; --ink-2: #b6bec8; --ink-3: #939ca8; --line: #3a424c; --field-line: #6c7581;
  --outline: #b9c0c8; --outline-dash: none;
  --paint: #f2c200; --paint-ink: #1d1700; --paint-soft: #3a3210;
  --blue: #6aa5ff; --blue-ink: #07111f; --blue-soft: #1b2c48; --red: #ff6e57; --red-soft: #3d1d18;
  --good: #52cf8a; --good-ink: #06170d; --good-soft: #123222; --warn: #f0a640; --warn-soft: #3a2a10;
  --bad: #ff8a6b; --bad-ink: #240a04; --bad-soft: #3d1c14;
  --tape-case: #0f1114; --focus: #6aa5ff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 22px rgba(0, 0, 0, .3);
  --shadow-hung: 0 2px 0 rgba(0, 0, 0, .55), 0 10px 18px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base + browser surfaces */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%; scrollbar-color: var(--surface-3) transparent; accent-color: var(--blue);
  /* keyboard focus and in-page jumps stop clear of the sticky topbar and the fixed phone tab bar (WCAG 2.4.11) */
  scroll-padding-top: 72px;
  scroll-padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px);
}
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 var(--step-0)/1.55 var(--font-body); min-height: 100dvh; caret-color: var(--blue); }
::selection { background: var(--paint); color: var(--paint-ink); }
img, svg, video { max-width: 100%; }
a { color: var(--blue); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; text-wrap: balance; }
h1 { font: 800 var(--title)/1 var(--font-display); letter-spacing: .01em; text-transform: uppercase; }
h2 { font: 700 var(--step-2)/1.2 var(--font-body); }
h3 { font: 700 var(--step-1)/1.25 var(--font-body); }
h4 { font: 700 var(--step-0)/1.3 var(--font-body); }
p { margin: 0; }
code, kbd, .mono { font-family: var(--font-mono); font-size: .9em; }
.num, .mono, td.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 70; padding: 10px 16px; border-radius: var(--r); background: var(--blue); color: var(--blue-ink); font-weight: 700; text-decoration: none; transform: translateY(-150%); transition: transform .15s ease; }
.skip-link:focus-visible, .skip-link:focus { transform: none; }
.main:focus { outline: none; }
.icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.22em; }
.icon-lg { width: 1.75em; height: 1.75em; }
[x-cloak] { display: none !important; }
button, input, select, textarea { font: inherit; }

/* ------------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: 1fr; min-height: 100dvh; }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; align-items: center; gap: 12px; padding: 10px var(--gutter);
  background: var(--ground); border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font: 800 1.35rem/1 var(--font-display); letter-spacing: .06em; color: var(--ink); text-decoration: none; text-transform: uppercase; }
.brand-mark { width: 30px; height: 30px; border-radius: var(--r); display: grid; place-items: center; background: var(--paint); color: var(--paint-ink); }
.topbar .spacer { flex: 1; }
.topbar-hello { font-weight: 700; color: var(--ink-2); }
.hud { display: flex; align-items: center; gap: 8px; }
.hud-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 4px 10px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font: 700 .95rem var(--font-body); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hud-chip.lumens { background: var(--paint); color: var(--paint-ink); border-color: transparent; }
.hud-chip.streak .icon { color: var(--red); }
.main { padding-block: 20px 112px; padding-inline: var(--gutter); width: 100%; max-width: 1100px; margin-inline: auto; min-width: 0; }
.main.narrow { max-width: 720px; }

/* the shop light: a tube along the top that switches on when today is lit up */
.shoplight { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 40; background: var(--surface-3); pointer-events: none; }
/* lit: the tube glows warm and the shop's top strip takes the light. No transition: it snaps on (the flicker is the
   only motion). */
.shoplight.is-on {
  height: 4px; background: linear-gradient(90deg, #fffbe8, #ffffff 30%, #fffbe8 70%, #ffffff);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--paint) 40%, transparent), 0 8px 48px 10px color-mix(in srgb, var(--paint) 30%, transparent);
}
body:has(.shoplight.is-on) .topbar { background: color-mix(in srgb, var(--paint-soft) 55%, var(--ground)); }
.shoplight.flicker { animation: flicker .9s steps(1) 1; }
@keyframes flicker { 0% { opacity: .2 } 12% { opacity: 1 } 18% { opacity: .3 } 30% { opacity: 1 } 36% { opacity: .5 } 48%, 100% { opacity: 1 } }

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 30; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line);
}
.tabbar a { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; border-radius: var(--r); color: var(--ink-3); text-decoration: none; font-size: .74rem; font-weight: 700; }
.tabbar a .icon { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--blue); background: var(--blue-soft); }
.rail { display: none; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100dvh; padding: 18px 12px; border-right: 1px solid var(--line); background: var(--surface); overflow-y: auto; }
.rail .brand { padding: 4px 10px 18px; }
.rail a.navlink { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 8px 12px; border-radius: var(--r); color: var(--ink-2); text-decoration: none; font-weight: 700; }
.rail a.navlink:hover { background: var(--surface-2); color: var(--ink); }
.rail a.navlink[aria-current="page"] { background: var(--blue-soft); color: var(--blue); }
.rail .rail-foot { margin-top: auto; display: grid; gap: 4px; padding-top: 12px; }
@media (min-width: 900px) {
  .shell.has-rail { grid-template-columns: var(--rail) 1fr; }
  .rail { display: flex; }
  .tabbar { display: none; }
  .main { padding-bottom: 48px; }
  .topbar .brand, .topbar-logout { display: none; }
}

/* ------------------------------------------------------------------ layout helpers */
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.stack-lg { display: flex; flex-direction: column; gap: 28px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.grid-2 { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 4px; }
.page-head p { color: var(--ink-2); max-width: 60ch; }
.muted { color: var(--ink-2); }
.subtle { color: var(--ink-3); font-size: var(--step--1); }
.measure { max-width: 65ch; }
.min0 { min-width: 0; }
.scroll-x { overflow-x: auto; }
.section-title { font: 700 var(--step-1)/1.25 var(--font-body); }

/* ------------------------------------------------------------------ panels (steel plates; never nested) */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; min-width: 0; }
.panel.raised { box-shadow: var(--shadow); }
.panel.quiet { background: var(--surface-2); border-color: transparent; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
a.panel { color: inherit; text-decoration: none; display: block; transition: border-color .15s ease, transform .15s ease; }
a.panel:hover { border-color: var(--blue); }
/* legacy alias so early templates keep rendering */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; min-width: 0; }

/* ------------------------------------------------------------------ the pegboard wall + tool slots */
.board {
  --hole-c: var(--board-hole);
  background-color: var(--board);
  background-image: radial-gradient(circle at 50% 50%, var(--hole-c) 0 2.4px, transparent 3px);
  background-size: var(--hole) var(--hole);
  background-position: calc(var(--hole) / 2) calc(var(--hole) / 2);
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  padding: 22px;
}
.wall { display: grid; gap: 18px 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 156px), 1fr)); }
.slot {
  position: relative; display: grid; justify-items: center; align-content: start; gap: 8px; padding: 14px 10px 12px;
  border-radius: var(--r); color: var(--ink); text-decoration: none; text-align: center; min-height: 168px;
}
a.slot:hover .slot-outline, button.slot:hover .slot-outline { stroke: var(--blue); }
.slot-art { position: relative; width: 84px; height: 84px; }
.slot-art svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.slot-outline { fill: none; stroke: var(--outline); stroke-width: 1.4; stroke-dasharray: var(--outline-dash); stroke-linecap: round; stroke-linejoin: round; }
.slot-fill { fill: var(--paint); stroke: var(--paint); stroke-width: 5.5; stroke-linecap: round; stroke-linejoin: round; opacity: 0; clip-path: inset(0 100% 0 0); }
.slot-detail { fill: none; stroke: var(--paint-ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.slot-fill.no-fill { fill: none; } /* open line-art glyphs (ui.slot's list): a fill would close their paths into wedges */
.slot.is-done .slot-fill, .slot.is-done .slot-detail { opacity: 1; clip-path: inset(0 0 0 0); }
.slot.is-done .slot-outline { opacity: 0; }
.slot.just-hung .slot-fill { animation: paint-sweep .5s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes paint-sweep { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.slot.is-current { background: color-mix(in srgb, var(--surface) 70%, transparent); box-shadow: var(--shadow-hung); }
.slot.is-current::before { content: ""; position: absolute; top: -9px; left: 50%; translate: -50% 0; width: 14px; height: 14px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 3px var(--board); }
.slot-title { font-weight: 700; line-height: 1.25; max-width: 18ch; overflow-wrap: anywhere; }
.slot-meta { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; font: 700 .8rem var(--font-body); color: var(--ink-2); }
.slot-meta .mono { font-weight: 500; } /* numerals only (minutes, lumens) take the mono face */
.slot.is-done .slot-meta { color: var(--ink-3); }
.strike { text-decoration: line-through; text-decoration-color: var(--paint); text-decoration-thickness: 3px; }

/* the bench: the one job clamped in front of you */
.bench {
  display: grid; gap: 14px; padding: 20px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.bench-top { display: flex; gap: 14px; align-items: flex-start; }
.bench-vise { width: 52px; height: 52px; flex: none; border-radius: var(--r); display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); }
.bench-vise .icon { width: 30px; height: 30px; }
.bench h2 { font: 800 clamp(1.9rem, 1.4rem + 2vw, 2.6rem)/1 var(--font-display); text-transform: uppercase; letter-spacing: .01em; }
.bench-facts { display: flex; flex-wrap: wrap; gap: 6px 16px; font: 500 .9rem var(--font-mono); color: var(--ink-2); }

/* stamped label tape: part numbers, standard codes, skill codes */
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px 3px; border-radius: var(--r-sm); background: var(--label-tape); color: var(--label-ink); font: 500 .76rem/1.4 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.std { display: inline-flex; padding: 2px 8px 3px; border-radius: var(--r-sm); background: var(--label-tape); color: var(--label-ink); font: 500 .76rem/1.4 var(--font-mono); letter-spacing: .06em; white-space: nowrap; }

/* tape measure: the only progress meter */
.tape { --pct: 0; display: grid; gap: 4px; }
.tape-track { position: relative; height: 26px; border-radius: var(--r-sm); background: var(--tape-case); }
.tape-fill {
  position: absolute; inset: 0; border-radius: inherit; clip-path: inset(0 calc(100% - var(--pct) * 1%) 0 0);
  background-color: var(--paint);
  /* tall graduations every --major (ui.tape sets it so they meet the numerals), five short ones between */
  background-image: repeating-linear-gradient(90deg, rgba(0, 0, 0, .55) 0 1px, transparent 1px var(--major, 10%)), repeating-linear-gradient(90deg, rgba(0, 0, 0, .35) 0 1px, transparent 1px calc(var(--major, 10%) / 5));
  background-size: 100% 60%, 100% 30%; background-repeat: no-repeat; background-position: 0 0, 0 0;
  transition: clip-path .6s cubic-bezier(.16, 1, .3, 1);
}
.tape-goal { position: absolute; top: -2px; bottom: -2px; right: 0; width: 6px; background: var(--red); }
.tape-scale { display: flex; justify-content: space-between; font: 500 .72rem var(--font-mono); color: var(--ink-3); font-variant-numeric: tabular-nums; }
/* ui.tape places each numeral under its graduation (inline left/right); hand-built scales keep space-between */
.tape-scale.is-placed { position: relative; display: block; height: 1.4em; }
.tape-scale.is-placed span { position: absolute; top: 0; line-height: 1.4; white-space: nowrap; }
.tape-scale.is-placed span:not(:first-child):not(:last-child) { translate: -50% 0; }
.tape-label { display: flex; justify-content: space-between; gap: 10px; font-weight: 700; }
.tape-label .num { font-family: var(--font-mono); }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border-radius: var(--r); border: 1px solid transparent; background: var(--blue); color: var(--blue-ink);
  font: 700 1rem var(--font-body); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: filter .15s ease, transform .08s ease, background-color .15s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn-lg { min-height: 56px; padding: 14px 26px; font-size: 1.1rem; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--ink-3); filter: none; }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); filter: none; }
.btn-paint { background: var(--paint); color: var(--paint-ink); }
.btn-good { background: var(--good); color: var(--good-ink); }
.btn-danger { background: var(--bad); color: var(--bad-ink); }
.btn-block { width: 100%; }
.btn .htmx-indicator { display: none; }
.htmx-request.btn .btn-label { opacity: .55; }
.htmx-request.btn .htmx-indicator, .htmx-request .btn .htmx-indicator { display: inline-flex; }

/* ------------------------------------------------------------------ pills, chips */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: var(--r-sm); font-size: .8rem; font-weight: 700; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.pill.paint, .pill.lumen { background: var(--paint); color: var(--paint-ink); }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.red { background: var(--red-soft); color: var(--red); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font-weight: 700; text-decoration: none; }
.chip:hover { border-color: var(--ink-3); }
.chip[aria-pressed="true"], .chip.is-on, .chip:has(input:checked) { background: var(--blue); color: var(--blue-ink); border-color: transparent; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }

/* ------------------------------------------------------------------ steps (inside a job) */
.steps { display: grid; gap: 8px; }
.step { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.step .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--outline); font: 500 .85rem var(--font-mono); }
.step.is-done .dot { background: var(--paint); border-color: var(--paint); color: var(--paint-ink); }
.step.is-done .step-title { color: var(--ink-3); }
.step.is-current { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }

/* ------------------------------------------------------------------ forms */
.field { display: grid; gap: 6px; align-content: start; }
.field label, .label { font-weight: 700; font-size: .95rem; }
.hint { color: var(--ink-3); font-size: .85rem; }
input:not([type]), input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="time"], input[type="url"], input[type="email"], input[type="search"], input[type="tel"], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--field-line); background: var(--surface); color: var(--ink);
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 700; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--blue); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; }
.form-error { color: var(--bad); font-weight: 700; }
/* kid surfaces: "not yet" feedback in warm amber, never punitive red (SPEC 9). Use on learner forms. */
.form-error.calm, .field-note { justify-self: start; padding: 6px 10px; border-radius: var(--r); background: var(--warn-soft); color: var(--ink); font-weight: 700; }

/* PIN pad */
.pinpad { display: grid; grid-template-columns: repeat(3, 72px); gap: 10px; justify-content: center; }
.pinpad button { height: 64px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 500 1.5rem var(--font-mono); cursor: pointer; display: grid; place-items: center; }
.pinpad button:hover { border-color: var(--ink-3); }
.pinpad button:active { background: var(--blue-soft); }
.pin-dots { display: flex; gap: 14px; justify-content: center; min-height: 22px; }
.pin-dots span { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--outline); }
.pin-dots span.on { background: var(--paint); border-color: var(--paint); }

/* profile picker */
.profiles { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; }
.profile { display: grid; justify-items: center; gap: 10px; width: 148px; padding: 18px 10px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--ink); font-weight: 700; text-decoration: none; }
.profile:hover, .profile[aria-pressed="true"] { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.avatar { width: 64px; height: 64px; border-radius: var(--r-lg); display: grid; place-items: center; background: var(--paint); color: var(--paint-ink); }
.avatar .icon { width: 34px; height: 34px; }
.avatar.sm { width: 36px; height: 36px; border-radius: var(--r); }
.avatar.sm .icon { width: 20px; height: 20px; }
.avatar.parent { background: var(--surface-2); color: var(--ink-2); }

/* ------------------------------------------------------------------ tutor chat */
.chat { display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: min(88%, 62ch); padding: 12px 14px; border-radius: var(--r-lg); line-height: 1.55; }
.msg.me { align-self: flex-end; background: var(--blue); color: var(--blue-ink); }
.msg.ai { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); }
.msg.ai p + p { margin-top: .6em; }
.msg-who { display: block; font-size: .78rem; font-weight: 700; color: var(--ink-3); margin-bottom: 4px; }
.typing::after { content: "▍"; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ------------------------------------------------------------------ timer */
.timer { display: grid; justify-items: center; gap: 10px; }
.timer-face { font: 500 clamp(2.6rem, 2rem + 3vw, 3.6rem)/1 var(--font-mono); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ lists + tables */
.list { display: grid; gap: 8px; }
.list-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.list-row > .min0 > * { overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table th { font-size: .8rem; font-weight: 700; color: var(--ink-2); background: var(--surface-2); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ empty / loading / notices */
.empty { display: grid; justify-items: center; gap: 10px; padding: 28px 16px; text-align: center; color: var(--ink-2); border: 1.5px dashed var(--line); border-radius: var(--r-lg); }
.empty .icon { width: 36px; height: 36px; color: var(--ink-3); }
.empty strong { color: var(--ink); }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--blue-soft); color: var(--ink); }
.notice.warn { background: var(--warn-soft); }
.notice.good { background: var(--good-soft); }
.notice.paint, .notice.lumen { background: var(--paint-soft); }
.forging { display: grid; justify-items: center; gap: 12px; padding: 28px; text-align: center; }
.forging .spark { width: 56px; height: 56px; border-radius: var(--r-lg); display: grid; place-items: center; background: var(--paint); color: var(--paint-ink); }
.forging .spark .icon { animation: spin 2.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-flex; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--r-sm); min-height: 16px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ------------------------------------------------------------------ toasts + dialog */
.toasts { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: calc(86px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
@media (min-width: 900px) { .toasts { bottom: 24px; } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--r-lg); background: var(--ink); color: var(--ground); box-shadow: var(--shadow); font-weight: 700; animation: rise .25s cubic-bezier(.16, 1, .3, 1); }
.toast.lumen, .toast.paint { background: var(--paint); color: var(--paint-ink); }
.toast.good { background: var(--good); color: var(--good-ink); }
.toast.warn { background: var(--warn-soft); color: var(--ink); }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }
dialog.modal { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 0; width: min(560px, 94vw); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
dialog.modal::backdrop { background: rgba(10, 12, 15, .55); }
dialog.modal .modal-body { padding: 20px; display: grid; gap: 14px; }

/* ------------------------------------------------------------------ prose (lessons) */
.prose { max-width: 68ch; line-height: 1.65; }
.prose > * + * { margin-top: .85em; }
.prose h3 { margin-top: 1.3em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose code { background: var(--surface-2); padding: 1px 6px; border-radius: var(--r-sm); }
.prose blockquote { margin: 0; padding: 10px 14px; background: var(--paint-soft); border-radius: var(--r); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* icon sprite symbols carry no paint of their own; every <use> inherits these */
.icon, .slot-art svg, svg.draw { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------------ integration fixes (round 1) */
:root { --tabbar-h: 64px; }
@media (min-width: 900px) { :root { --tabbar-h: 0px; } .topbar-more { display: none; } }
ul.list, ol.list, ul.steps, ol.steps { list-style: none; margin: 0; padding: 0; }
@media (max-width: 520px) {
  .board { padding: 16px; }
  .wall { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 14px 10px; }
  .slot { min-height: 150px; padding-inline: 6px; }
  .slot-art { width: 72px; height: 72px; }
}
.slot.is-muted { opacity: .6; }
a.std { text-decoration: none; }
a.std:hover { background: var(--blue); color: var(--blue-ink); }
@media (max-width: 560px) {
  .topbar { gap: 8px; }
  .topbar-hello { display: none; }
  body[data-layout="kid"] .topbar-logout { display: none; } /* kids switch user from /more on phones */
  .hud { gap: 6px; }
  .hud-chip { padding: 4px 8px; }
}

/* ------------------------------------------------------------------ audit fixes (round 1) */
/* touch screens: the house 44px tap-target rule, without inflating mouse layouts */
@media (pointer: coarse) {
  .hud-chip, .btn-sm, .chip { min-height: 44px; }
  .topbar-more, #hud-bell, .hud-chip.streak { min-width: 44px; justify-content: center; }
  .topbar .brand { min-height: 44px; min-width: 44px; justify-content: center; }
}

/* radio chips show keyboard focus on the chip itself (the input is visually hidden) */
.chip:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ------------------------------------------------------------------ family calendar (/parent/calendar, core) */
/* Four big tool buttons choose the kind of day; the matching form shows below (radio + :has, no JS). */
.cal-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .cal-tools { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.cal-tool {
  position: relative; display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 12px 16px;
  border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 700; line-height: 1.2; cursor: pointer; transition: border-color .15s ease, background-color .15s ease;
}
.cal-tool input { position: absolute; opacity: 0; pointer-events: none; }
.cal-tool .icon { width: 26px; height: 26px; color: var(--ink-2); transition: color .15s ease; }
.cal-tool:hover { border-color: var(--ink-3); }
.cal-tool:active { transform: translateY(1px); }
.cal-tool:has(input:checked) { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); background: var(--blue-soft); }
.cal-tool:has(input:checked) .icon { color: var(--blue); }
.cal-tool:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
@supports selector(:has(*)) {
  .cal-pane { display: none; }
  .cal:has(#cal-tab-sick:checked) .cal-pane[data-pane="sick"],
  .cal:has(#cal-tab-no_school:checked) .cal-pane[data-pane="no_school"],
  .cal:has(#cal-tab-busy:checked) .cal-pane[data-pane="busy"],
  .cal:has(#cal-tab-event:checked) .cal-pane[data-pane="event"] { display: flex; }
  .cal-when:has(input[value="weekly"]:checked) .cal-once,
  .cal-when:has(input[value="once"]:checked) .cal-weekly { display: none; }
}
.cal-fields { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.cal-when { gap: 10px; }

.cal-kids { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.cal-kids form { display: contents; }
.cal-kid { width: 100%; min-height: 60px; justify-content: flex-start; gap: 12px; padding: 8px 14px 8px 8px; font-size: 1.05rem; white-space: normal; }
.cal-kid .avatar { flex: none; }
.cal-kid > .icon:last-child { margin-left: auto; color: var(--blue); }
.cal-kid-name { display: grid; text-align: left; overflow-wrap: anywhere; }
.cal-kid.is-on {
  display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 8px 8px 8px; border-radius: var(--r); border: 1px solid var(--blue);
  box-shadow: 0 0 0 1px var(--blue); background: var(--blue-soft); color: var(--ink);
}
.cal-kid.is-on form { display: block; margin-left: auto; }
.cal-family-sick { padding-top: 4px; }

.cal-list { list-style: none; margin: 0; padding: 0; display: grid; }
.cal-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.cal-row:first-child { border-top: 0; }
.cal-date { display: grid; font: 500 .85rem/1.3 var(--font-mono); color: var(--ink); font-variant-numeric: tabular-nums; }
.cal-dow { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.cal-date.is-repeat { visibility: hidden; }
.cal-row.is-today .cal-dow { color: var(--blue); font-weight: 700; }
.cal-what { display: grid; gap: 2px; }
.cal-what strong { overflow-wrap: anywhere; }
.cal-meta { color: var(--ink-2); font-size: .88rem; line-height: 1.45; }
.cal-meta .icon { width: 1em; height: 1em; margin-right: 5px; vertical-align: -0.14em; }
.cal-meta .mono { font-size: .85rem; }
.cal-del { min-width: 44px; padding: 0; color: var(--ink-3); }
.cal-del:hover { color: var(--bad); }
.cal-past { border-top: 1px solid var(--line); padding-top: 4px; }
.cal-past summary { display: flex; align-items: center; gap: 6px; min-height: 44px; cursor: pointer; font-weight: 700; color: var(--ink-2); }
.cal-past summary:hover { color: var(--ink); }
.cal-past[open] summary { margin-bottom: 4px; }
.cal-kid.is-on .cal-kid-name { flex: 1; }
.cal-pane > .field, .cal-pane .cal-fields { max-width: 640px; }
.cal-range summary .icon { transition: rotate .15s ease; }
.cal-range[open] summary .icon { rotate: 180deg; }
.cal-range form { padding-top: 4px; }

/* ------------------------------------------------------------------ nav badges (web.register_nav_badge) */
.nav-badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--blue); color: var(--blue-ink); font: 500 .75rem/1 var(--font-mono); font-variant-numeric: tabular-nums; }
.rail a.navlink .nav-badge { margin-left: auto; }
.tabbar a { position: relative; }
.tabbar a .nav-badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; font-size: .68rem; }
