/* hey Chores — every value here comes from PROJECT/BRIEFS/design_system.md (v2). */

:root {
  /* dark is the reference look; light follows below when the phone is light */
  --canvas: #0c0c0e;
  --surface: #161618;
  --raised: #1e1e21;
  --glass: rgb(22 22 24 / 0.97);   /* legible with no blur at all; the blur only softens */
  --ink: #eeeeec;
  --ink-2: #a4a4a0;
  --line: rgb(255 255 255 / 0.09);
  --edge: #6c6c70;
  --danger: #ff7a6e;
  --float-shadow: 0 12px 32px rgb(0 0 0 / 0.28);
  --scrim: rgb(0 0 0 / 0.45);
  /* the accent family (design system: Accent decision) */
  --accent: #3ddc97;
  --accent-ink: #04140d;
  /* slop-ok: the recorded signature: the logo and the total's rule, nowhere else */
  --grad: linear-gradient(90deg, #5ef2b0, #14a3a8);

  --f-ui: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-fig: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --control-h: 44px;
  --row-min: 60px;
  --bar-h: 68px;
  --bar-gap: 12px;
  --side: 12px;          /* the list panel and the bar stand this far from the screen's sides */
  --pad: 16px;           /* inside a panel, figures and text stand this far from its edge */
  --r-pill: 9999px;
  --r-type: 12px;
  --r-hold: 20px;
  --r-sheet: 28px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --canvas: #f3f3f1;
    --surface: #ffffff;
    --raised: #ecece9;
    --glass: rgb(255 255 255 / 0.97);
    --ink: #121214;
    --ink-2: #5e5e5a;
    --line: rgb(0 0 0 / 0.08);
    --edge: #8a8a86;
    --danger: #c0392b;
    --float-shadow: 0 12px 32px rgb(0 0 0 / 0.10);
    --scrim: rgb(0 0 0 / 0.30);
    --accent: #0f8a5f;
    --accent-ink: #ffffff;
    color-scheme: light;
  }
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scrollbar-color: var(--edge) var(--canvas); }   /* the page's own scrollbar wears the theme */
/* a wide screen keeps room for its scrollbar, so every page's column stands in the same place */
@media (min-width: 720px) { html { scrollbar-gutter: stable; } }
/* Focus and scroll-into-view stop clear of the pinned band and the floating bar. */
html:has(body.has-tape) { scroll-padding: 56px 0 calc(var(--bar-h) + var(--bar-gap) + var(--safe-b) + 16px); }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 400 16px/22px var(--f-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75;
       stroke-linecap: round; stroke-linejoin: round; }
.ico .fill, .ico circle.fill { fill: currentColor; stroke: none; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
p { margin: 0; }

.display { font: 500 32px/36px var(--f-ui); letter-spacing: -0.03em; margin: 0; text-wrap: balance; }
.title { font: 500 20px/24px var(--f-ui); letter-spacing: -0.015em; margin: 0; }
.label { font: 500 14px/18px var(--f-ui); color: var(--ink); }
.hint { font: 400 13px/18px var(--f-ui); letter-spacing: 0.01em; color: var(--ink-2); }
.mark { font: 400 12px/16px var(--f-fig); letter-spacing: 0.02em; color: var(--ink-2); }
.fig { font: 500 15px/22px var(--f-fig); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.fig-lg { font: 500 22px/26px var(--f-fig); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.error { color: var(--danger); font: 500 14px/18px var(--f-ui); }

/* ------------------------------------------------------------------ the top bar */
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  height: 56px; padding: 0 8px 0 16px;
  padding-top: env(safe-area-inset-top, 0px);
  box-sizing: content-box;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.wordmark { font: 600 22px/26px var(--f-ui); letter-spacing: -0.02em; }
/* "hey" in a hand, a touch larger so its x-height meets the sans one beside it */
.wm-hey { font: 600 1.3em/1 "Caveat", var(--f-ui); letter-spacing: 0; margin-right: 0.12em; }
.back {
  display: inline-flex; align-items: center; gap: 4px; height: 40px;
  margin-left: -8px; padding: 0 14px 0 6px; border-radius: var(--r-pill);
  font: 500 16px/22px var(--f-ui); text-decoration: none; color: var(--ink);
}
.bar-actions { display: flex; gap: 4px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink); padding: 0;
  text-decoration: none; flex: none;
}
.icon-btn:active, .back:active { background: var(--raised); }
.icon-btn:disabled { opacity: 0.4; cursor: default; }
/* beside a 44px field, an icon button takes the field's height and a pill's edge */
.icon-btn-edge { width: var(--control-h); height: var(--control-h); border: 1px solid var(--edge); }
.avatar {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--raised); color: var(--ink); font: 600 13px/1 var(--f-ui);
}
.avatar.is-waiting { background: transparent; border: 1px dashed var(--edge); color: var(--ink-2); }

/* ------------------------------------------------------------------ page */
.page { max-width: 600px; margin: 0 auto; padding: 4px 0 24px; }
.page > .display, .list-meta, .empty, .empty-text { padding-left: 16px; padding-right: 16px; }
.list-meta { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-top: 6px;
             font: 400 13px/18px var(--f-ui); letter-spacing: 0.01em; color: var(--ink-2); }
.list-meta .dot, .item-meta .dot { color: var(--edge); }
.has-tape .page { padding-bottom: calc(var(--bar-h) + var(--bar-gap) + var(--safe-b) + 24px); }
/* while a toast stands over the foot of the list, the list can scroll clear of it */
.has-tape:has(> .toast:not([hidden])) .page { padding-bottom: calc(var(--bar-h) + var(--bar-gap) + var(--safe-b) + 24px + 72px); }
#sections, #home-rows { margin-top: 20px; }
.empty { padding-top: 32px; color: var(--ink-2); }
.empty-text { padding-top: 16px; color: var(--ink-2); max-width: 62ch; }

/* the connection line: shown only when there is none, or while kept changes are being sent */
.sync-line { display: flex; align-items: center; gap: 8px; margin: 10px 16px 0; font: 500 13px/18px var(--f-ui); color: var(--ink-2); }
.sync-line::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.sync-line.is-offline { color: var(--ink); }
.sync-line.is-offline::before { background: transparent; border: 1.75px solid var(--ink-2); }

/* one panel per list: bands for sections inside it, rows on its surface */
#sections:has(.sec), #home-rows:has(.sec), .tally-secs:has(.sec) {
  margin-left: var(--side); margin-right: var(--side);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-hold); overflow: clip;
}
.sec-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 8px; margin: 0;
  min-height: 44px; padding: 0 var(--pad) 0 4px;
  background: var(--raised); font: inherit;
}
.sec + .sec .sec-head { border-top: 1px solid var(--line); }
.sec-toggle {
  flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px;
  min-height: 44px; padding: 11px 0 11px 12px; border: 0; background: transparent; text-align: left;
}
.sec-toggle .ico { align-self: center; margin: 0 -2px 0 -6px; color: var(--ink-2); transition: transform 120ms ease; }
.sec-toggle[aria-expanded="false"] .ico { transform: rotate(-90deg); }
/* the name keeps its words; the count gives way first */
.sec-name { font: 600 15px/20px var(--f-ui); letter-spacing: -0.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 0 auto; max-width: 70%; }
.sec-count { font: 400 12px/16px var(--f-fig); letter-spacing: 0.02em; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 100 auto; }
.sec-count .n-count + .n-flag::before { content: "·"; margin: 0 6px; }
@media (max-width: 479px) { .sec-count .n-count:has(+ .n-flag) { display: none; } .sec-count .n-flag::before { display: none; } }
.sec-head > .fig { color: var(--ink); }
.sec-head > .sec-figs { display: grid; justify-items: end; padding: 11px 0; }
/* a group's bought (or done) rows: folded under a line at the group's foot, quieter than its head */
.done-head { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 var(--pad) 0 4px;
             border-top: 1px solid var(--line); }
.done-toggle { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px;
               padding: 9px 0 9px 12px; border: 0; background: transparent; text-align: left; }
.done-toggle .ico { align-self: center; margin: 0 -2px 0 -6px; color: var(--ink-2); transition: transform 120ms ease; }
.done-toggle[aria-expanded="false"] .ico { transform: rotate(-90deg); }
.done-toggle .sec-name { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.done-head > .fig { color: var(--ink-2); }
/* Today's band carries the accent's one dot */
.sec-today .sec-name::before { content: ""; display: inline-block; width: 8px; height: 8px; margin: 0 8px 1px 0;
                               border-radius: 50%; background: var(--accent); vertical-align: middle; }

.items { list-style: none; margin: 0; padding: 0; }
.item { display: flex; align-items: stretch; min-height: var(--row-min); }
.item + .item .item-main, .home-row + .home-row .home-link { border-top: 1px solid var(--line); }

.tick {
  flex: none; width: 52px; padding: 16px 0 0 4px; border: 0; background: transparent;
  display: grid; place-items: start center;
}
.tick-ring {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  border: 1.75px solid var(--edge); color: transparent; transition: background 120ms ease, border-color 120ms ease;
}
.tick-ring .ico { width: 16px; height: 16px; stroke-width: 2.25; }
.tick[aria-pressed="true"] .tick-ring { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tick:active .tick-ring { border-color: var(--accent); }

.item-main {
  flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px;
  align-content: start; padding: 16px var(--pad) 16px 2px; border: 0; background: transparent;
  text-align: left; color: var(--ink); text-decoration: none;
}
.item-main:active, .home-link:active { background: var(--raised); }
.item-name { font: 500 16px/22px var(--f-ui); overflow-wrap: anywhere; }
.item-main > .fig { grid-column: 2; grid-row: 1; }
/* one line that trails off: a wrap would strand a separator at a line's end */
.item-meta {
  grid-column: 1 / -1; display: block; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font: 400 13px/18px var(--f-ui); letter-spacing: 0.01em; color: var(--ink-2);
}
.item-meta .dot, .list-meta .dot { margin: 0 6px; }
.item-meta .mark { font-size: 12px; }
/* the priority word under the figure, on the meta line's row; the meta keeps the left column */
.item-main > .item-prio {
  grid-column: 2; grid-row: 2; justify-self: end; margin-top: 2px; white-space: nowrap;
  font: 400 13px/18px var(--f-ui); letter-spacing: 0.01em; color: var(--ink-2);
}
.item-main.has-prio > .item-meta { grid-column: 1; grid-row: 2; }
.item-prio.prio-high { color: var(--ink); font-weight: 600; }
/* a late task says so in words and in colour, never colour alone */
.late { color: var(--danger); font-weight: 600; }
.fig.due { color: var(--ink-2); }
.fig.due.is-late { color: var(--danger); }
.item.is-late .item-name, .item.is-high .item-name { font-weight: 600; }
.item-note {
  grid-column: 1 / -1; margin-top: 2px; font: 400 13px/18px var(--f-ui); letter-spacing: 0.01em; color: var(--ink-2);
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.item-where { grid-column: 1 / -1; display: flex; flex-wrap: wrap; column-gap: 12px; margin-top: 2px;
              font: 400 13px/18px var(--f-ui); letter-spacing: 0.01em; color: var(--ink-2); min-width: 0; }
.meta-ico { display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%; }
.meta-ico .ico { width: 16px; height: 16px; stroke-width: 1.75; }
.meta-ico span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.item.is-bought .item-name { text-decoration: line-through; text-decoration-thickness: 1.5px; color: var(--ink-2); }
.item.is-bought .item-main > .fig { color: var(--ink-2); }

/* the check-off: strike, then fold away */
/* slop-ok: not a surface; a one-colour gradient draws the strike line that grows across a ticked name */
.item-name { background: linear-gradient(currentColor, currentColor) no-repeat 0 55% / 0 1.5px; }
.item.is-leaving .item-name { background-size: 100% 1.5px; transition: background-size 120ms ease-out; color: var(--ink-2); }
.item.is-leaving .tick-ring { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.item.is-leaving { animation: fold 180ms ease-in 120ms forwards; overflow: hidden; }
.item.is-returning { opacity: 0.4; transition: opacity 180ms ease; }
@keyframes fold { to { min-height: 0; max-height: 0; opacity: 0; } }
.item { max-height: 400px; }

/* home */
.home-link {
  display: flex; align-items: center; gap: 12px; min-height: var(--row-min);
  padding: 12px var(--pad); text-decoration: none; color: var(--ink);
}
.home-text { flex: 1; min-width: 0; display: grid; }
.home-link > .fig { align-self: center; }
/* rows that move when held (reorder.js): the phone's own long-press menu and text selection
   would cut in during the hold; the row in hand floats over its neighbours */
.is-sortable > li, .is-sortable > .sec > .sec-head { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.is-sorting { position: relative; }
.is-sortable > .is-lifted { position: relative; z-index: 3; background: var(--raised); box-shadow: var(--float-shadow); }
/* its edge sits above whatever the row holds, so a group's own head cannot paint over it */
.is-sortable > .is-lifted::after { content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none;
                                   border: 1px solid var(--edge); }
/* a group in hand: every group shows only its head, for the drag alone — the folds are untouched */
.is-folding > .sec > :not(.sec-head) { display: none; }
.is-folding .sec-toggle .ico { transform: rotate(-90deg); }

/* ------------------------------------------------------------------ the floating bar */
.tape {
  position: fixed; z-index: 5;
  left: var(--side); right: var(--side); bottom: calc(var(--bar-gap) + var(--safe-b));
  height: var(--bar-h); padding: 0 var(--pad) 0 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--r-pill);
  /* slop-ok: a real layering relationship: the bar floats over the list scrolling under it (97% opaque, legible without the blur) */
  -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4);
  box-shadow: var(--float-shadow);
}
/* on home the one button IS the bar: no pill around a pill */
.page-home .tape { padding: 0; height: auto; background: none; border: 0; box-shadow: none;
                   /* slop-ok: this turns the frosting OFF for the lone home button */
                   -webkit-backdrop-filter: none; backdrop-filter: none; }
.page-home .tape .btn { height: 52px; box-shadow: var(--float-shadow); }
/* with nothing to add (items shared with you), the bar hugs its total instead of floating empty */
.tape:not(:has(.btn)) { left: auto; padding-left: 24px; }
.tally { display: grid; justify-items: end; gap: 3px; margin-left: auto; }
/* slop-ok: the one place colour moves: the total stands on a double rule drawn in the gradient,
   under it, as a ledger rules off its grand total */
.tally .fig-lg { position: relative; padding-bottom: 8px; }
.tally .fig-lg::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px;
                         /* slop-ok: the double rule itself: a 1px gap cut through the gradient line */
                         background: linear-gradient(var(--surface), var(--surface)) 0 2px / 100% 1px no-repeat, var(--grad); }
@media (min-width: 720px) {
  .tape { left: max(var(--side), calc((100% - 600px) / 2)); right: max(var(--side), calc((100% - 600px) / 2)); }
  .tape:not(:has(.btn)) { left: auto; }
}
body.sheet-open .tape { visibility: hidden; }
@media (prefers-reduced-transparency: reduce) { .tape { background: var(--surface); } }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--control-h); padding: 0 20px; border-radius: var(--r-pill);
  border: 1px solid var(--edge); background: transparent; color: var(--ink);
  font: 500 16px/22px var(--f-ui); text-decoration: none; white-space: nowrap;
  transition: background 50ms linear, opacity 50ms linear;
}
.btn:active { background: var(--raised); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--canvas); }
.btn-primary:active { background: var(--ink); opacity: 0.85; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: var(--canvas); }
.btn-quiet-danger { border-color: transparent; background: transparent; color: var(--danger); padding: 0 12px; margin-left: -12px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-wide { width: 100%; }
.btn .ico { margin-left: -6px; }

/* ------------------------------------------------------------------ fields */
.stack { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; min-width: 0; }
.input {
  width: 100%; height: var(--control-h); padding: 0 14px; border-radius: var(--r-type);
  border: 1px solid var(--edge); background: var(--surface); color: var(--ink);
  font: 400 16px/22px var(--f-ui); min-width: 0;
}
.input::placeholder { color: var(--ink-2); opacity: 0.7; }
/* a value that is given, not asked (an invitation's email): read, not typed into */
.input[readonly] { background: transparent; color: var(--ink-2); }
textarea.input { height: auto; min-height: 88px; padding: 11px 14px; resize: vertical; }
select.input {
  appearance: none; padding-right: 40px;
  /* slop-ok: not a surface; two hard-stop gradients draw the select's arrow in the theme's ink */
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 20px) 20px, calc(100% - 15px) 20px;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.input:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.trio { display: grid; grid-template-columns: 1fr 0.8fr 1.2fr; gap: 8px; }
.trio .input[name=amount], .trio .input[name=price] { font-family: var(--f-fig); font-variant-numeric: tabular-nums; }
.pair { display: grid; grid-template-columns: 1fr 108px; gap: 8px; }
.pair.pair-one { grid-template-columns: 1fr; }
/* slop-ok: not cards — three buttons of one row because there are exactly three quick answers, Today · Tomorrow · No date */
.due-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.due-row .btn { padding: 0 8px; min-width: 0; }
.due-row .input { grid-column: 1 / -1; }
.with-btn { display: flex; gap: 8px; }
.field .input + .input { margin-top: 8px; }
.inline-form { display: flex; gap: 8px; }
.inline-form .input { flex: 1; }

.calc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: -8px; }
.calc-key {
  height: var(--control-h); border: 0; border-radius: var(--r-pill); background: var(--raised);
  font: 500 15px/22px var(--f-fig); color: var(--ink);
}
.calc-key:active { opacity: 0.7; }
.line-total { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-height: 22px; margin-top: -4px; }
.line-total.is-error { color: var(--danger); font: 500 14px/18px var(--f-ui); }

.seg { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 6px; }
.seg legend { padding: 0; margin-bottom: 6px; }
/* slop-ok: three segments because there are exactly three priorities, Low · Normal · High */
.seg-track { display: grid; grid-template-columns: repeat(3, 1fr); padding: 4px; border-radius: var(--r-pill);
             background: var(--raised); height: var(--control-h); }
.seg-track.seg-two { grid-template-columns: 1fr 1fr; }
.seg-opt { position: relative; display: grid; place-items: center; border-radius: var(--r-pill); font: 500 14px/18px var(--f-ui); color: var(--ink-2); cursor: pointer; }
.seg-opt input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg-opt:has(input:checked) { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }
.seg-opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }

.more { border-top: 1px solid var(--line); }
.more > summary {
  display: flex; align-items: center; justify-content: space-between; height: var(--control-h);
  list-style: none; cursor: pointer; font: 500 16px/22px var(--f-ui);
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary .ico { color: var(--ink-2); transition: transform 120ms ease; }
.more[open] > summary .ico { transform: rotate(180deg); }
.more[open] > .stack { padding-top: 8px; }

/* ------------------------------------------------------------------ sheets */
dialog.sheet {
  padding: 0; border: 0; background: transparent; color: var(--ink);
  width: 100%; max-width: 100%; margin: auto 0 var(--kb, 0px); max-height: calc(var(--vvh, 100dvh) - 24px);
}
dialog.sheet::backdrop { background: var(--scrim); }
.sheet-box {
  display: flex; flex-direction: column; max-height: calc(var(--vvh, 100dvh) - 24px);
  background: var(--surface); border: 1px solid var(--line); border-bottom: 0;
  border-radius: var(--r-sheet) var(--r-sheet) 0 0; box-shadow: var(--float-shadow);
}
.sheet-box:focus { outline: none; }
.sheet-head { display: flex; align-items: center; gap: 4px; padding: 16px 12px 8px 20px; }
.sheet-head.has-back { padding-left: 12px; }
.sheet-head .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q {
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--edge); background: transparent;
  font: 600 13px/1 var(--f-ui); color: var(--ink-2); flex: none; margin: 0 6px;
}
.help { padding: 0 20px 12px; font: 400 14px/20px var(--f-ui); color: var(--ink-2); max-width: 62ch; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px 20px 16px;
              scrollbar-width: thin; scrollbar-color: var(--edge) transparent; }   /* never a foreign bar in dark */
.sheet-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 20px calc(12px + var(--safe-b)); border-top: 1px solid var(--line);
}
.sheet-foot .btn:only-child { width: 100%; }
.sheet-text { color: var(--ink); max-width: 62ch; }
@media (min-width: 720px) {
  dialog.sheet { width: 480px; margin: auto; max-height: calc(100dvh - 64px); }
  .sheet-box { border-radius: var(--r-sheet); border-bottom: 1px solid var(--line); max-height: calc(100dvh - 64px); }
  .sheet-foot { padding-bottom: 12px; }
}
@media (prefers-reduced-motion: no-preference) {
  @media (max-width: 719px) {
    dialog.sheet[open] .sheet-box { animation: rise 200ms cubic-bezier(0.2, 0, 0, 1); }
  }
}
@keyframes rise { from { transform: translateY(32px); opacity: 0.6; } }

.actions { list-style: none; margin: 0 -20px; padding: 0; }
.action {
  display: flex; align-items: center; gap: 12px; width: 100%; height: 52px; padding: 0 20px;
  border: 0; background: transparent; color: var(--ink); font: 500 16px/22px var(--f-ui); text-align: left;
}
.action span:first-of-type { flex: 1; }
.action:active { background: var(--raised); }
.action.is-danger { color: var(--danger); }
.actions li + li .action { border-top: 1px solid var(--line); }

.people { list-style: none; margin: 16px 0 0; padding: 0; }
.person { display: flex; align-items: center; gap: 12px; min-height: var(--row-min); }
.person + .person { border-top: 1px solid var(--line); }
.person-text { flex: 1; min-width: 0; display: grid; }
.person-name { font: 500 16px/22px var(--f-ui); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-meta { font: 400 13px/18px var(--f-ui); color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-what { font: 500 16px/22px var(--f-ui); margin-bottom: 12px; overflow-wrap: anywhere; }
.share-note { margin-top: 8px; }

.group-rows { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.group-row { display: flex; gap: 8px; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 10px 16px; margin: 0 0 16px; align-items: baseline; }
.facts dt { font: 500 14px/22px var(--f-ui); color: var(--ink-2); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts dd.num { font: 500 15px/22px var(--f-fig); font-variant-numeric: tabular-nums; }
.facts dd.num-lg { font: 500 22px/26px var(--f-fig); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.link-row { display: flex; flex-wrap: wrap; gap: 8px; }
.link-row .btn { max-width: 100%; }
.link-row .btn span { overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------------------------ toast */
.toast {
  position: fixed; left: var(--side); right: var(--side); z-index: 20;
  bottom: calc(var(--bar-h) + var(--bar-gap) + var(--safe-b) + 12px);
  display: flex; align-items: center; gap: 8px; max-width: 576px; margin: 0 auto;
  min-height: 48px; padding: 4px 4px 4px 20px; border-radius: var(--r-pill);
  background: var(--ink); color: var(--canvas); font: 500 14px/18px var(--f-ui);
}
.toast.is-error { background: var(--danger); color: var(--canvas); }
.toast-text { flex: 1; min-width: 0; padding: 8px 0; }
.toast-act { height: 40px; padding: 0 14px; border: 0; border-radius: var(--r-pill); background: transparent;
             color: inherit; font: 600 15px/22px var(--f-ui); text-decoration: underline; text-underline-offset: 3px; }
.toast-x { width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: inherit; display: grid; place-items: center; }
body:not(.has-tape) .toast { bottom: calc(var(--safe-b) + 16px); }
body.sheet-open .toast { bottom: calc(var(--kb, 0px) + var(--safe-b) + 16px); }

/* ------------------------------------------------------------------ sign-in */
.auth { max-width: 400px; margin: 0 auto; padding: 16px 16px 48px; display: grid; gap: 48px; }
.auth-card { display: grid; gap: 16px; align-content: start; }
.auth-card .display { margin-bottom: 8px; }
.rule-or { display: flex; align-items: center; gap: 12px; color: var(--ink-2); font: 400 13px/18px var(--f-ui); }
.rule-or::before, .rule-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.auth-switch { color: var(--ink-2); font: 400 14px/18px var(--f-ui); }
.auth-text { margin: 0; color: var(--ink-2); }
.auth-switch a { color: var(--ink); font-weight: 600; }
.specimen { display: none; }
@media (min-width: 900px) {
  .auth { max-width: 896px; grid-template-columns: 400px 360px; justify-content: center; gap: 96px; padding-top: 64px; }
  .specimen { display: block; align-self: start; margin-top: 60px; background: var(--surface);
              border: 1px solid var(--line); border-radius: var(--r-hold); padding: 16px 0; overflow: clip; }
}
.specimen-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 16px 10px; font: 600 15px/20px var(--f-ui); }
.specimen-rows { list-style: none; margin: 0; padding: 0; }
.specimen-rows li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); font: 500 16px/22px var(--f-ui); }
.specimen-rows small { display: block; font: 400 12px/16px var(--f-fig); color: var(--ink-2); }
.specimen-rows .is-done > span:first-child { text-decoration: line-through; color: var(--ink-2); }
.specimen-rows .is-done .fig { color: var(--ink-2); }
.specimen-foot { display: grid; justify-items: end; gap: 3px; padding: 12px 16px 0; border-top: 1px solid var(--line); }
.specimen-foot .fig-lg { position: relative; padding-bottom: 8px; }
.specimen-foot .fig-lg::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px;
                                 /* slop-ok: the same double rule on the sign-in page's specimen */
                                 background: linear-gradient(var(--surface), var(--surface)) 0 2px / 100% 1px no-repeat, var(--grad); }

/* ------------------------------------------------------------------ wide screens */
@media (min-width: 720px) {
  #sections:has(.sec), #home-rows:has(.sec), .tally-secs:has(.sec) { margin-left: 0; margin-right: 0; }
  .page > .display, .list-meta, .empty, .empty-text { padding-left: 0; padding-right: 0; }
  .sync-line { margin-left: 0; margin-right: 0; }
  .bar { max-width: 600px; margin: 0 auto; padding-left: 0; padding-right: 0; }
  .page-auth .bar { max-width: 856px; }   /* the width of the form, the gap and the specimen together */
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
}

/* ------------------------------------------------------------------ the tally page */
/* A band is always written in words; the tone only repeats it (colour is never alone). */
.tone-good { color: var(--accent); }
.tone-bad { color: var(--danger); }
.tone-low { color: var(--ink-2); }

.day-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px;
           margin: 12px var(--side) 0; }
.day-next .ico { transform: rotate(180deg); }
/* the day's name is the picker: the date field lies over it, so a tap anywhere opens it */
.day-pick { position: relative; flex: 1; min-width: 0; display: grid; place-items: center; height: 40px;
            border-radius: var(--r-pill); font: 600 16px/22px var(--f-ui); }
.day-pick:active { background: var(--raised); }
.day-pick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; border: 0;
                  cursor: pointer; }
.day-pick:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.score, .entry { margin: 12px var(--side) 0; padding: var(--pad); background: var(--surface);
                 border: 1px solid var(--line); border-radius: var(--r-hold); }
.score-top { display: flex; align-items: center; gap: 16px; }
.score-fig { font: 500 44px/48px var(--f-fig); letter-spacing: -0.03em; font-variant-numeric: tabular-nums;
             min-width: 3ch; }
.score-words { display: grid; gap: 2px; min-width: 0; }
.score-band { font: 600 19px/24px var(--f-ui); letter-spacing: -0.01em; }
.score-bar { position: relative; height: 8px; margin-top: 16px; border-radius: var(--r-pill); background: var(--raised); }
.bar-fill { position: absolute; top: 0; bottom: 0; border-radius: var(--r-pill); background: currentColor; }
.bar-zero, .bar-goal { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--ink-2); }
.bar-goal { background: var(--ink); }
.score-scale { position: relative; height: 16px; margin-top: 6px; }
.score-scale span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.score-scale span:first-child { transform: none; }
.score-scale span:last-child { transform: translateX(-100%); }

.entry { display: grid; gap: 8px; }
.entry-row { display: flex; gap: 8px; min-width: 0; }
.entry-row .input { flex: 1; }
.weight { display: flex; align-items: center; gap: 4px; flex: none; }
.weight-fig { min-width: 36px; text-align: center; font: 500 16px/22px var(--f-fig); font-variant-numeric: tabular-nums; }
.weight-up .ico { transform: rotate(180deg); }
/* slop-ok: not cards — a tally line is exactly one of three signs, + · 0 · − */
.page-tally .entry { scroll-margin-top: var(--side); }   /* lifted to here when its most-used list opens */
.sign-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sign-btn { padding: 0 8px; gap: 6px; }
.sign-mark { font: 600 18px/22px var(--f-fig); }

/* Suggest (suggest.js): the most used words, floating under the field they fill */
.suggest { position: absolute; z-index: 6; list-style: none; margin: 0; padding: 4px 0;
           background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-type);
           box-shadow: var(--float-shadow); }
.suggest li { display: flex; align-items: center; justify-content: space-between; gap: 12px;
              min-height: var(--control-h); padding: 0 14px; border-top: 1px solid var(--line);
              font: 400 16px/22px var(--f-ui); color: var(--ink); cursor: pointer; }
.suggest li:first-child { border-top: 0; }
.suggest li[aria-selected="true"], .suggest li:active { background: var(--surface); }
.suggest b { font-weight: 600; color: var(--accent); }
.suggest .mark { flex: none; }
.suggest-words { min-width: 0; overflow-wrap: anywhere; }

.page-tally .tally-secs:has(.sec) { margin-top: 12px; }
.line-row .item-main { padding-left: var(--pad); }
/* the day on show: an accent edge, never the band's grey, which is a heading's */
.line-row.is-current .item-main { box-shadow: inset 3px 0 0 var(--accent); }
.line-row.is-current .item-name { font-weight: 600; }
.more-days { margin: 8px var(--pad) var(--pad); }
.page-tally .empty { padding-top: 24px; }
@media (min-width: 720px) {
  .day-bar, .score, .entry { margin-left: 0; margin-right: 0; }
}

/* the cog page (admin.js): a setting's field stands where a task's name would, the input under it */
/* the line between two fields starts where their words start, as it does between two tasks */
.admin-field { display: block; min-height: 0; padding-left: 16px; }
.admin-field .field { padding: 12px var(--pad) 14px 0; }
.admin-field + .admin-field .field { border-top: 1px solid var(--line); }
.admin-field .item-name { font: 500 14px/18px var(--f-ui); }

/* ------------------------------------------------------------------ the front door (PROJECT/BRIEFS/hero.md) */
/* the shared bar is content-box and carries the phone's safe area on top; this one keeps both */
.page-hero .bar { box-sizing: border-box; max-width: 1072px; margin: 0 auto;
                  height: calc(56px + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 16px 0; }
.hero { padding: 8px 16px 48px; }
.hero-title { margin: 0; font: 500 36px/40px var(--f-ui); letter-spacing: -0.03em; color: var(--ink); text-wrap: balance; }
.hero-line { margin: 16px 0 0; max-width: 34ch; font: 400 17px/24px var(--f-ui); color: var(--ink-2); text-wrap: pretty; }
.hero-actions { display: flex; gap: 12px; margin-top: 24px; }
.hero-actions .btn { flex: 1; }
.hero-shots { margin: 24px 0 0; display: flex; justify-content: flex-start; align-items: flex-end; column-gap: 24px; }
/* the picture frame (design_system.md): its ground is the page's own, so only a firm edge makes it a picture */
.hero-shot { display: block; flex: none; width: min(64vw, 248px); aspect-ratio: 390 / 700; border-radius: var(--r-hold);
             overflow: hidden; border: 1px solid var(--edge); background: var(--surface); }
.hero-shot img { display: block; width: 100%; height: 100%; }
/* a phone has room for one screen: the list, which carries the signature */
.hero-shots.is-pair .hero-shot-home { display: none; }
@media (min-width: 480px) { .hero-actions .btn { flex: none; } }
@media (min-width: 560px) {
  .page-hero .bar, .hero { max-width: 560px; margin-left: auto; margin-right: auto; }
  .hero-shots { margin-top: 32px; }
  .hero-shot-list { width: 272px; }
  .hero-shots.is-pair .hero-shot-home { display: block; width: 200px; }
}
@media (min-width: 1000px) {
  .page-hero .bar { max-width: 1072px; }
  .hero { max-width: 1072px; padding: 48px 16px; display: grid;
          grid-template-columns: minmax(0, 420px) auto; column-gap: 48px; align-items: center; justify-content: start; }
  .hero-title { font-size: 56px; line-height: 60px; letter-spacing: -0.035em; }
  .hero-line { font-size: 18px; line-height: 28px; }
  .hero-actions { margin-top: 32px; }
  .hero-shots { margin: 0; }
}
