/* COPY of sites/_shared/chassis/components.css — edit the source there and run node _shared/sync.mjs */
/* The shared components: one button, field, card, list, chip, tab bar, sheet and toast for every
   app in sites/.

   Source: sites/_shared/chassis/components.css. Load order: tokens.css, controls.css, this file,
   then the app's own CSS. Specimen: sites/briefs/components.html.

   Rules:
   - Every class starts with ui-, so an app can move over one screen at a time without its own
     .btn or .card getting in the way. Once a screen uses ui- classes, delete the app's old ones.
   - Built only from the chassis tokens. An app changes how they look by setting tokens (its
     --accent, and --font-display if it has one), never by restyling a ui- class.
   - Need something that isn't here? Add it here, to the specimen, and sync, so every app gets it.
   - Sizes: every tappable thing is at least --tap (44px) tall, or 36px for .small. Text in a field
     is 16px, so iOS doesn't zoom in when you type. */

/* ── Base ────────────────────────────────────────────────────────────────────── */
/* 12 Nov 2026, from the components sweeps: `hidden` must win over every ui- display rule (two
   apps had each added this line), and ui- pieces size with their padding and border included
   (tokens.css has no reset, and a full-width .ui-input otherwise spills out of its card). */
[hidden] { display: none !important; }
:where([class^='ui-'], [class*=' ui-']) { box-sizing: border-box; }

/* ── Layout ──────────────────────────────────────────────────────────────────── */
.ui-page { display: grid; gap: var(--sp-6); }
.ui-stack { display: grid; gap: var(--sp-3); }
.ui-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.ui-actions.end { justify-content: flex-end; }
.ui-spacer { flex: 1; }

/* A section: a heading with an optional action on the right, then its content. */
.ui-head { display: flex; align-items: center; gap: var(--sp-2); min-height: 32px; }
.ui-head > :is(h1, h2, h3) { flex: 1; min-width: 0; margin: 0; }
.ui-title { font: 700 var(--text-2xl)/1.15 var(--font-display); letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
.ui-h2 { font-size: var(--text-lg); font-weight: 700; line-height: 1.3; margin: 0; }
.ui-label { font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); }
.ui-sub { color: var(--text-2); margin: 0; }
.ui-hint { font-size: var(--text-sm); color: var(--text-3); margin: 0; }
/* A section label in ordinary sentence case, for a question or a long label. */
.ui-label.plain { text-transform: none; letter-spacing: 0; font-size: var(--text-sm); color: var(--text-2); }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
/* .ui-btn is the everyday button. One .primary per screen. .quiet for low-key actions in a row,
   .danger for delete, .small inside cards and rows, .icon for a square icon-only button (give it
   an aria-label), .block to fill the width. */
.ui-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 0 var(--sp-4); margin: 0;
  border-radius: var(--r-md); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: var(--text-sm); font-weight: 600; line-height: 1.2;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: background-color 0.12s, border-color 0.12s, filter 0.12s;
}
.ui-btn:hover { border-color: var(--text-3); }
.ui-btn:active { filter: brightness(0.96); }
.ui-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ui-btn:disabled, .ui-btn[aria-disabled='true'] { opacity: 0.45; cursor: default; pointer-events: none; }
.ui-btn > svg { inline-size: 1.15em; block-size: 1.15em; flex: none; }

.ui-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--text-on-accent); }
.ui-btn.primary:hover { filter: brightness(0.95); }
.ui-btn.quiet { background: transparent; border-color: transparent; color: var(--text-2); }
.ui-btn.quiet:hover { background: var(--surface-2); color: var(--text); }
.ui-btn.danger { color: var(--danger); }
.ui-btn.danger.primary { background: var(--danger-fill); border-color: var(--danger-fill); color: #fff; }
.ui-btn.small { min-height: 36px; padding: 0 var(--sp-3); font-size: var(--text-sm); border-radius: var(--r-sm); }
.ui-btn.icon { inline-size: var(--tap); padding: 0; position: relative; font-size: 18px; line-height: 1; }
.ui-btn.icon.small { inline-size: 36px; font-size: 16px; }
/* .tiny: a corner button inside a dense card (a card's ⋯), small enough never to take a title's
   room. Pair it with .quiet. Only for a second way in: the card itself stays the main target
   (16 Nov 2026, for Life Kanban's board cards). */
.ui-btn.icon.tiny { inline-size: 24px; min-height: 24px; font-size: 15px; border-radius: var(--r-sm); }
.ui-btn.icon > svg { inline-size: 1em; block-size: 1em; }
.ui-btn.round { border-radius: var(--r-full); }
.ui-btn.block { display: flex; inline-size: 100%; }

/* More kinds (12 Nov 2026):
   .soft  a tinted button, a step down from .primary.
   .good  green words; .good.primary is the filled "Book it" button.
   .large a hero call to action.
   .link  a button that reads as a link inside a sentence.
   .choice a button with a second line of explanation: <button class="ui-btn choice"><strong>Scan
          it</strong><small>Take a photo of the page</small></button>.
   .more  a show-more button with a chevron; set aria-expanded and it turns over. */
.ui-btn.soft { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border-color: transparent; color: var(--text); }
.ui-btn.soft:hover { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
.ui-btn.good { color: color-mix(in srgb, var(--success) 75%, var(--text)); }
.ui-btn.good.primary { background: var(--success); border-color: var(--success); color: #fff; }
.ui-btn.large { min-height: 52px; padding: 0 var(--sp-6); font-size: var(--text-md); border-radius: var(--r-lg); }
.ui-btn.link {
  display: inline; min-height: 0; padding: 0; border: 0; border-radius: 0; background: none; color: inherit;
  font-size: inherit; white-space: normal; vertical-align: baseline;
  text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px;
}
.ui-btn.link:hover { text-decoration-color: currentColor; }
.ui-btn.choice {
  display: grid; justify-content: stretch; justify-items: start; align-content: center; gap: 2px; inline-size: 100%;
  min-height: 60px; padding: var(--sp-3) var(--sp-4); text-align: start; white-space: normal;
}
.ui-btn.choice > small { font-size: var(--text-xs); font-weight: 400; color: var(--text-2); }
.ui-btn.choice.primary > small { color: inherit; opacity: 0.85; }
.ui-btn.more::after {
  content: ''; inline-size: 7px; block-size: 7px; margin: -3px 2px 0 4px; flex: none;
  border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform 0.15s;
}
.ui-btn.more[aria-expanded='true']::after { transform: translateY(4px) rotate(-135deg); }

/* A toggle, such as a star, heart or bookmark: give the button aria-pressed. A .round one is a
   "done" tick that fills in. A .primary button keeps its own fill (some apps swap to .primary
   when pressed). */
.ui-btn[aria-pressed='true']:not(.primary) { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 45%, var(--border-strong)); }
.ui-btn.quiet[aria-pressed='true']:not(.primary) { background: color-mix(in srgb, var(--accent) 14%, transparent); border-color: transparent; }
.ui-btn.icon[aria-pressed='true']:not(.primary) { color: var(--accent); }
.ui-btn.round[aria-pressed='true']:not(.primary) { background: var(--accent); border-color: var(--accent); color: var(--text-on-accent); }

/* A count on an icon button or a tab bar item: <span class="ui-count">3</span> inside it.
   Leave it empty for a plain dot. */
.ui-count {
  position: absolute; top: 2px; inset-inline-end: 2px; z-index: 1;
  min-inline-size: 18px; block-size: 18px; padding: 0 5px; border-radius: var(--r-full);
  background: var(--accent); color: var(--text-on-accent); box-shadow: 0 0 0 2px var(--surface);
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.ui-count:empty { min-inline-size: 10px; block-size: 10px; padding: 0; top: 6px; inset-inline-end: 6px; }
/* On a small icon button the count sits out over the corner, so it doesn't cover the glyph. */
.ui-btn.small > .ui-count:not(:empty) { top: -6px; inset-inline-end: -6px; }

/* A round floating button: <button class="ui-fab" aria-label="Add">+</button>. It sits above the
   tab bar when there is one. .quiet for a plain one, such as back to the top. */
.ui-fab {
  position: fixed; z-index: 55; inset-inline-end: max(var(--sp-4), env(safe-area-inset-right));
  bottom: max(var(--sp-4), calc(env(safe-area-inset-bottom) + 8px));
  inline-size: 56px; block-size: 56px; margin: 0; padding: 0; border: 0; border-radius: var(--r-full);
  display: grid; place-items: center; background: var(--accent); color: var(--text-on-accent);
  box-shadow: var(--shadow-lg); font: inherit; font-size: 26px; line-height: 1; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ui-fab > svg { inline-size: 24px; block-size: 24px; }
.ui-fab.quiet { inline-size: 44px; block-size: 44px; font-size: 18px; background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.ui-fab:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
body:has(.ui-tabbar) .ui-fab { bottom: calc(80px + env(safe-area-inset-bottom)); }

/* ── Fields ──────────────────────────────────────────────────────────────────── */
/* <label class="ui-field"><span>Name</span><input class="ui-input"><small>Hint</small></label>
   Add .error to the field and the hint turns into the error message. */
.ui-field { display: grid; gap: 6px; min-width: 0; }
/* The label is the field's FIRST child only, so a wrapper round the input (a clear-× button)
   isn't styled like a label. A <div class="ui-field"> can use <label for> as its first child. */
.ui-field > :is(span, label:not(.check)):first-child { font-size: var(--text-sm); font-weight: 600; color: var(--text-2); }
.ui-field > small { font-size: var(--text-xs); color: var(--text-3); }
.ui-field.error > small { color: var(--danger); }
.ui-field.error .ui-input { border-color: var(--danger); }

.ui-input {
  inline-size: 100%; min-height: var(--tap); margin: 0; padding: 10px 12px;
  border-radius: var(--r-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 16px; line-height: 1.35;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.ui-input::placeholder { color: var(--text-3); }
.ui-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.ui-input:disabled { opacity: 0.55; }
textarea.ui-input { min-height: 96px; resize: vertical; }
select.ui-input {
  -webkit-appearance: none; appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%23888' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px;
}
/* A search box: <input class="ui-input search" type="search"> */
.ui-input.search {
  padding-left: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='4.5' fill='none' stroke='%23888' stroke-width='1.6'/%3E%3Cpath d='m10.5 10.5 3 3' stroke='%23888' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 12px center; background-size: 16px;
}

/* ── Cards ───────────────────────────────────────────────────────────────────── */
.ui-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: var(--sp-4); box-shadow: var(--shadow-md); min-width: 0;
}
.ui-card.flat { box-shadow: none; }
.ui-card.inset { background: var(--surface-2); border-color: transparent; box-shadow: none; }
.ui-card > .ui-list { margin: calc(var(--sp-2) * -1) calc(var(--sp-4) * -1); }
/* A card you tap (a <button>, <a> or <label>), and its states. A <label class="ui-card"> round a
   radio or tick box shows as selected when it's ticked, which makes an option card:
     <label class="ui-card check top"><input type="radio" name="tees"><span><strong>Yellow</strong><br>6,120 yards</span></label>
   .selected (or aria-pressed / aria-checked) is the chosen one; .highlight draws the eye ("in
   your plan"); .warn and .good tint it. */
:is(a, button, label).ui-card { color: inherit; font: inherit; text-align: start; text-decoration: none; cursor: pointer; margin: 0; -webkit-tap-highlight-color: transparent; }
:is(a, button, label).ui-card:hover { border-color: var(--border-strong); }
label.ui-card.check { display: flex; }
:is(a, button).ui-card:focus-visible, label.ui-card:has(:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.ui-card.selected, .ui-card[aria-pressed='true'], .ui-card[aria-checked='true'], label.ui-card:has(input:checked) {
  border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  box-shadow: inset 0 0 0 1px var(--accent), var(--shadow-md);
}
.ui-card.highlight { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.ui-card.warn { background: color-mix(in srgb, var(--warning) 10%, var(--surface)); border-color: color-mix(in srgb, var(--warning) 40%, var(--border)); }
.ui-card.good { background: color-mix(in srgb, var(--success) 8%, var(--surface)); border-color: color-mix(in srgb, var(--success) 35%, var(--border)); }

/* Big numbers: <div class="ui-stats"><div class="ui-stat"><strong>42</strong><span>Rounds</span></div>…</div> */
.ui-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--sp-3); }
.ui-stat { display: grid; gap: 2px; align-content: start; min-width: 0; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); background: var(--surface-2); }
.ui-stat > strong { font: 700 var(--text-2xl)/1.1 var(--font-display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--text); overflow-wrap: anywhere; }
.ui-stat > span { font-size: var(--text-xs); font-weight: 600; color: var(--text-2); }

/* ── Lists ───────────────────────────────────────────────────────────────────── */
/* <ul class="ui-list"><li class="ui-row">…</li></ul>. A row holds an optional leading icon or
   control, a .main block (title, then .sub), and trailing bits (a badge, a .small button, a
   chevron). Make the whole row a <button> or <a> when it opens something. */
.ui-list { list-style: none; margin: 0; padding: 0; display: grid; }
.ui-list > * { min-width: 0; }  /* a long title wraps instead of pushing the list off the screen */
.ui-row {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 52px; padding: var(--sp-2) var(--sp-4);
  border-top: 1px solid var(--border); color: inherit; text-decoration: none; text-align: start;
  font: inherit; background: none; inline-size: 100%; margin: 0; border-left: 0; border-right: 0; border-bottom: 0;
}
.ui-list > :first-child.ui-row, .ui-list > li:first-child > .ui-row { border-top: 0; }
.ui-row > .main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.ui-row > .main > :first-child { font-weight: 600; overflow-wrap: anywhere; }
.ui-row > .main > .sub { font-size: var(--text-sm); color: var(--text-2); }
.ui-row > .lead { flex: none; inline-size: 36px; block-size: 36px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--surface-2); font-size: 18px; }
:is(a, button).ui-row { cursor: pointer; -webkit-tap-highlight-color: transparent; }
:is(a, button).ui-row:hover { background: var(--surface-2); }
:is(a, button).ui-row::after {
  content: ''; flex: none; inline-size: 8px; block-size: 8px; margin-inline-start: 2px;
  border: solid var(--text-3); border-width: 2px 2px 0 0; transform: rotate(45deg);
}
.ui-row.no-chevron::after { content: none; }
/* .compact: a dense list inside a card (a pantry, a packing list), one line each. No rule between
   rows, and the hover fill reaches a little past the text so the words line up with the card's
   heading (16 Nov 2026, for Food Planner's Kitchen). */
.ui-row.compact {
  min-height: 32px; padding: var(--sp-1) var(--sp-2); gap: var(--sp-2); border-top: 0;
  margin-inline: calc(var(--sp-2) * -1); inline-size: calc(100% + var(--sp-2) * 2);
  border-radius: var(--r-sm); font-size: var(--text-sm);
}
/* A settings row: <label class="ui-row"><span class="main">…</span><input type="checkbox" role="switch"></label>.
   The chosen row in a list: aria-selected="true", aria-current, or .selected. */
label.ui-row { cursor: pointer; }
.ui-row.selected, .ui-row[aria-selected='true'], .ui-row[aria-current]:not([aria-current='false']) { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.ui-row.selected > .main > :first-child, .ui-row[aria-selected='true'] > .main > :first-child { color: var(--text); }

/* ── Chips, badges ───────────────────────────────────────────────────────────── */
/* Filter chips are buttons with aria-pressed. .ui-chips wraps; .ui-chips.scroll keeps one line
   and scrolls sideways (good for a long row of filters on a phone). */
.ui-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.ui-chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--sp-4) * -1); padding-inline: var(--sp-4); }
.ui-chips.scroll::-webkit-scrollbar { display: none; }
.ui-chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  min-height: 36px; padding: 0 var(--sp-3); margin: 0;
  border-radius: var(--r-full); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: var(--text-sm); font-weight: 500; line-height: 1.2; white-space: nowrap;
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.ui-chip:hover { border-color: var(--text-3); }
.ui-chip[aria-pressed='true'], .ui-chip.on { background: var(--accent); border-color: var(--accent); color: var(--text-on-accent); }
.ui-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ui-chip .n { font-size: var(--text-xs); opacity: 0.7; }
/* Smaller chips (12 Nov 2026):
   .small  a compact chip (28px).
   <span class="ui-chip">  a tag that isn't a filter (no pointer); an <a> or <button> one still taps.
   × to remove: <span class="ui-chip">Harry <button class="x" aria-label="Remove Harry">×</button></span>.
   .out  a filter set to "leave these out" (a third state after on and off). */
.ui-chip.small { min-height: 28px; padding: 0 10px; font-size: var(--text-xs); gap: 4px; }
span.ui-chip { cursor: default; }
span.ui-chip:hover { border-color: var(--border-strong); }
.ui-chip > .x {
  display: grid; place-items: center; inline-size: 22px; block-size: 22px; margin: 0 -6px 0 0; padding: 0;
  border: 0; border-radius: var(--r-full); background: none; color: var(--text-3);
  font: inherit; font-size: 16px; line-height: 1; cursor: pointer;
}
.ui-chip > .x:hover { background: var(--surface-2); color: var(--text); }
.ui-chip[aria-pressed='true'] > .x, .ui-chip.on > .x { color: inherit; }
.ui-chip.out { border-style: dashed; color: var(--text-3); text-decoration: line-through; }

.ui-badge {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  padding: 2px 8px; border-radius: var(--r-full);
  background: var(--surface-2); color: var(--text-2);
  font-size: var(--text-xs); font-weight: 600; line-height: 1.5; white-space: nowrap;
}
.ui-badge.accent { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--text); }
.ui-badge.good { background: color-mix(in srgb, var(--success) 16%, transparent); color: color-mix(in srgb, var(--success) 70%, var(--text)); }
.ui-badge.warn { background: color-mix(in srgb, var(--warning) 18%, transparent); color: color-mix(in srgb, var(--warning) 70%, var(--text)); }
.ui-badge.bad { background: color-mix(in srgb, var(--danger) 14%, transparent); color: color-mix(in srgb, var(--danger) 70%, var(--text)); }
/* good/warn/bad text leans 30% towards --text (11 Nov 2026): the raw green and amber were ~2.7:1 on their tint in
   Light. Now about 4.5:1 or better in Light and 5:1 or better in Dark. */

/* ── Notes ───────────────────────────────────────────────────────────────────── */
.ui-note { display: flex; gap: var(--sp-2); align-items: flex-start; padding: var(--sp-3); border-radius: var(--r-md); background: var(--surface-2); font-size: var(--text-sm); color: var(--text-2); }
.ui-note.warn { background: color-mix(in srgb, var(--warning) 12%, var(--surface)); color: var(--text); }
.ui-note.bad { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); color: var(--text); }
.ui-note.good { background: color-mix(in srgb, var(--success) 10%, var(--surface)); color: var(--text); }
.ui-note.info { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--text); }

/* ── Show more, stepper, progress, spinner ──────────────────────────────────── */
/* <details class="ui-more"><summary>Show more</summary>…</details> */
details.ui-more > summary {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; list-style: none; cursor: pointer;
  color: var(--text-2); font-size: var(--text-sm); font-weight: 600; -webkit-tap-highlight-color: transparent;
}
details.ui-more > summary::-webkit-details-marker { display: none; }
details.ui-more > summary::after {
  content: ''; inline-size: 7px; block-size: 7px; margin-top: -3px; border: solid currentColor;
  border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform 0.15s;
}
details.ui-more[open] > summary::after { transform: translateY(4px) rotate(-135deg); }
details.ui-more > summary:hover { color: var(--text); }
/* A list row that opens underneath it (12 Nov 2026, Vinted Helper):
     <li><details class="ui-more row"><summary class="ui-row"><span class="main"><span>Title</span><span class="sub">…</span></span></summary><div>…detail…</div></details></li>
   The summary keeps the row's look, with a chevron that turns over. Put buttons for the row (delete)
   in the detail, not the summary. */
details.ui-more.row > summary.ui-row { display: flex; min-height: 52px; gap: var(--sp-3); color: inherit; font-size: inherit; font-weight: inherit; }
details.ui-more.row > summary.ui-row:hover { background: var(--surface-2); }
details.ui-more.row > summary.ui-row::after { flex: none; margin-inline-start: 2px; border-color: var(--text-3); }
details.ui-more.row > :not(summary) { padding: 0 var(--sp-4) var(--sp-3); }
.ui-list > li:first-child > details > summary.ui-row, .ui-list > details:first-child > summary.ui-row { border-top: 0; }

/* − 4 +: <div class="ui-stepper"><button aria-label="Fewer">−</button><output>4</output><button aria-label="More">+</button></div> */
.ui-stepper { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface); }
.ui-stepper > button {
  inline-size: var(--tap); block-size: calc(var(--tap) - 2px); margin: 0; padding: 0; border: 0; border-radius: inherit;
  background: none; color: var(--text); font: inherit; font-size: 20px; line-height: 1; cursor: pointer; touch-action: manipulation;
}
.ui-stepper > button:hover { background: var(--surface-2); }
.ui-stepper > button:disabled { opacity: 0.35; cursor: default; }
.ui-stepper > :is(output, span, input) {
  min-inline-size: 2.5em; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums;
}
.ui-stepper > input { inline-size: 3em; border: 0; padding: 0; background: none; color: inherit; font: inherit; font-size: 16px; -moz-appearance: textfield; appearance: textfield; }
.ui-stepper > input::-webkit-inner-spin-button { -webkit-appearance: none; }
/* .small: 36px, to sit in a row beside .ui-btn.small (12 Nov 2026, Bozza HQ packing). */
.ui-stepper.small { border-radius: var(--r-sm); }
.ui-stepper.small > button { inline-size: 36px; block-size: 34px; font-size: 18px; }
.ui-stepper.small > :is(output, span, input) { min-inline-size: 2em; font-size: var(--text-sm); }

/* <progress class="ui-progress" value="3" max="10"></progress>, with .good/.warn/.bad for the colour. */
progress.ui-progress {
  -webkit-appearance: none; appearance: none; display: block; inline-size: 100%; block-size: 8px;
  border: 0; border-radius: var(--r-full); background: var(--surface-2); overflow: hidden; color: var(--accent);
}
progress.ui-progress::-webkit-progress-bar { background: var(--surface-2); border-radius: var(--r-full); }
progress.ui-progress::-webkit-progress-value { background: currentColor; border-radius: var(--r-full); transition: inline-size 0.3s; }
progress.ui-progress::-moz-progress-bar { background: currentColor; border-radius: var(--r-full); }
progress.ui-progress.good { color: var(--success); }
progress.ui-progress.warn { color: var(--warning); }
progress.ui-progress.bad { color: var(--danger); }

/* <span class="ui-spinner" role="status" aria-label="Loading"></span>: takes the text colour and size. */
.ui-spinner {
  display: inline-block; flex: none; inline-size: 1.25em; block-size: 1.25em; vertical-align: -0.25em;
  border: 2px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor;
  border-radius: 50%; animation: ui-spin 0.8s linear infinite;
}
@keyframes ui-spin { to { transform: rotate(1turn); } }

/* ── Pop-over menu ───────────────────────────────────────────────────────────── */
/* A ⋯ menu with no script:
     <button class="ui-btn quiet icon small" popovertarget="m1" aria-label="More">⋯</button>
     <div class="ui-menu" popover id="m1"><button>Rename</button><button>Move</button><hr><button class="danger">Delete</button></div>
   It opens under its button (on the side with room). A browser that can't pin it to the button
   shows it along the bottom of the screen. Close it from code with menu.hidePopover(). */
.ui-menu {
  margin: 0; padding: 4px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
  min-inline-size: 200px; max-inline-size: calc(100vw - 32px);
}
.ui-menu:popover-open { display: grid; }
@supports (position-area: bottom) {
  .ui-menu { inset: auto; margin-block: 4px; position-area: bottom span-left; position-try-fallbacks: flip-block, flip-inline; }
}
@supports not (position-area: bottom) {
  .ui-menu { inset: auto 16px max(16px, env(safe-area-inset-bottom)); margin: 0; }
}
.ui-menu > :is(button, a) {
  display: flex; align-items: center; gap: var(--sp-2); min-height: var(--tap); padding: 0 var(--sp-3); margin: 0;
  border: 0; border-radius: var(--r-sm); background: none; color: inherit; font: inherit; font-size: var(--text-sm);
  text-align: start; text-decoration: none; white-space: nowrap; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.ui-menu > :is(button, a):is(:hover, :focus-visible) { background: var(--surface-2); outline: none; }
.ui-menu > .danger { color: var(--danger); }
.ui-menu > hr { margin: 4px 0; border: 0; border-top: 1px solid var(--border); }

/* ── Tabs inside a page (segmented) ──────────────────────────────────────────── */
/* <div class="ui-seg" role="tablist"><button role="tab" aria-selected="true">Week</button>…</div>
   For two to four views of the same thing. More than that: chips. */
.ui-seg { display: flex; gap: 2px; padding: 3px; border-radius: var(--r-md); background: var(--surface-2); inline-size: 100%; }
.ui-seg > * {
  flex: 1; min-height: 36px; padding: 0 var(--sp-3); margin: 0; border: 0; border-radius: calc(var(--r-md) - 3px);
  background: transparent; color: var(--text-2); font: inherit; font-size: var(--text-sm); font-weight: 600;
  cursor: pointer; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
/* .fit: only as wide as its options, for a small picker beside a label. A count: <span class="n">3</span>. */
.ui-seg.fit { display: inline-flex; inline-size: auto; max-inline-size: 100%; flex: none; }
.ui-seg.fit > * { flex: none; }
.ui-seg > * > .n { font-size: var(--text-xs); opacity: 0.7; }
.ui-seg > [aria-selected='true'], .ui-seg > [aria-pressed='true'], .ui-seg > [aria-current] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / 0.08); }
.ui-seg > :focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ── Top bar and bottom tab bar ──────────────────────────────────────────────── */
/* .ui-bar: the app's top bar, sticky. Title in the middle on phones if you add .center.
   .ui-tabbar: bottom navigation for the app's main sections, links with aria-current="page".
   Give the page bottom padding of about 88px when the tab bar is there. */
.ui-bar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: var(--sp-2);
  min-height: 52px; padding: env(safe-area-inset-top) max(var(--sp-4), env(safe-area-inset-right)) 0 max(var(--sp-4), env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--border);
}
.ui-bar > .name { flex: 1; min-width: 0; font-weight: 700; font-size: var(--text-lg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ui-bar.center > .name { text-align: center; }

.ui-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; justify-content: space-around;
  padding: 6px max(var(--sp-2), env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(var(--sp-2), env(safe-area-inset-left));
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
  border-top: 1px solid var(--border);
}
.ui-tabbar > a, .ui-tabbar > button {
  flex: 1; max-inline-size: 120px; display: grid; justify-items: center; gap: 2px;
  min-height: var(--tap); padding: 4px 0; border: 0; background: none; margin: 0;
  color: var(--text-3); font: inherit; font-size: 11px; font-weight: 600; text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ui-tabbar > * > :first-child { font-size: 22px; line-height: 1; }
.ui-tabbar > * > svg:first-child { inline-size: 24px; block-size: 24px; }
.ui-tabbar > [aria-current] { color: var(--accent); }
.ui-tabbar > * { position: relative; }
.ui-tabbar .ui-count { inset-inline-end: calc(50% - 22px); top: 0; }

/* ── Sheet (dialog) ──────────────────────────────────────────────────────────── */
/* <dialog class="ui-sheet"><header><h2>Title</h2><button class="ui-btn quiet icon small"
   aria-label="Close">✕</button></header><div class="body">…</div><footer class="ui-actions end">…</footer></dialog>
   Open with dialog.showModal(). A bottom sheet on phones, a centred box on wider screens. The
   magic sheet looks the same, so AI and non-AI pop-ups match. */
.ui-sheet {
  inline-size: min(560px, 100% - 32px); max-block-size: min(86vh, 760px);
  margin: auto; padding: 0; border: 0; border-radius: var(--r-xl);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
  overflow: hidden; flex-direction: column;
}
.ui-sheet[open] { display: flex; }
.ui-sheet::backdrop { background: var(--overlay); }
.ui-sheet > header { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-4) var(--sp-4) var(--sp-2) var(--sp-5); }
.ui-sheet > header > :is(h2, h3) { flex: 1; margin: 0; font-size: var(--text-lg); font-weight: 700; }
.ui-sheet > .body { padding: var(--sp-2) var(--sp-5) var(--sp-4); overflow-y: auto; display: grid; gap: var(--sp-3); }
.ui-sheet > footer { padding: var(--sp-3) var(--sp-5) var(--sp-5); border-top: 1px solid var(--border); }
@media (max-width: 560px) {
  .ui-sheet { inline-size: 100%; max-inline-size: 100%; margin: auto 0 0; border-radius: var(--r-xl) var(--r-xl) 0 0; max-block-size: 92vh; }
  .ui-sheet > footer { padding-bottom: max(var(--sp-5), env(safe-area-inset-bottom)); }
  .ui-sheet > footer .ui-btn { flex: 1; }
}
/* <dialog class="ui-sheet page">: a sheet with a lot in it (a full edit form) fills the whole
   phone screen like a page instead of sliding up as a card; on wider screens it's a normal sheet. */
/* .wide: a roomier sheet on a big screen (760px), for a table or a two-column form. */
@media (min-width: 561px) { .ui-sheet.wide { inline-size: min(760px, 100% - 32px); } }
@media (max-width: 560px) {
  .ui-sheet.page { inline-size: 100%; block-size: 100dvh; max-block-size: 100dvh; margin: 0; border-radius: 0; box-shadow: none; }
  .ui-sheet.page > header { padding-top: max(var(--sp-4), env(safe-area-inset-top)); }
}

/* ── Toast and empty state ───────────────────────────────────────────────────── */
/* <div class="ui-toast" role="status">Saved</div>: add it, remove it after about 2.5s. */
.ui-toast {
  position: fixed; left: 50%; bottom: max(24px, calc(env(safe-area-inset-bottom) + 12px)); z-index: 900;
  transform: translateX(-50%); inline-size: max-content; max-inline-size: calc(100% - 32px);
  padding: 10px 16px; border-radius: var(--r-md);
  background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg);
  font-size: var(--text-sm); font-weight: 600; animation: ui-toast-in 0.2s var(--ease);
}
/* A toast with one action (Undo): <div class="ui-toast" role="status">Deleted <button type="button">Undo</button></div>.
   Keep it up longer (about 6s) so there's time to tap it. */
.ui-toast:has(> button) { display: flex; align-items: center; gap: var(--sp-3); padding-block: 4px; padding-inline-end: 6px; }
.ui-toast > button {
  min-height: 36px; padding: 0 var(--sp-3); border: 0; border-radius: var(--r-sm); margin: 0;
  background: transparent; color: inherit; font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.ui-toast > button:hover { background: color-mix(in srgb, var(--bg) 15%, transparent); }
body:has(.ui-tabbar) .ui-toast { bottom: calc(88px + env(safe-area-inset-bottom)); }
/* A floating button on the page: the toast sits above it, not over it (12 Nov 2026, Life Kanban). */
body:has(> .ui-fab:not([hidden])) .ui-toast { bottom: calc(88px + env(safe-area-inset-bottom)); }
body:has(.ui-tabbar):has(> .ui-fab:not([hidden])) .ui-toast { bottom: calc(152px + env(safe-area-inset-bottom)); }
@keyframes ui-toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
/* .bad: a red toast for something that failed. */
.ui-toast.bad { background: var(--danger-fill); color: #fff; }
/* A toast while a sheet is open: a sheet sits in the browser's top layer, above everything else,
   so a plain toast hides under it. Give the toast popover="manual", add it INSIDE the open
   sheet (outside it, the page can't be tapped, so Undo wouldn't work), then call
   toast.showPopover(). It shows above the sheet, at the bottom of the screen. */
.ui-toast[popover] { top: auto; right: auto; margin: 0; border: 0; overflow: visible; }
.ui-toast[popover]:not(:popover-open) { display: none; }

/* <div class="ui-empty"><span class="icon">🗂️</span><strong>Nothing here</strong><span>What to do next.</span>…</div>
   Keep each line of words in its own element: loose text becomes its own grid cell. */
.ui-empty { display: grid; justify-items: center; gap: var(--sp-2); text-align: center; padding: var(--sp-8) var(--sp-4); color: var(--text-2); }
.ui-empty > .icon { font-size: 36px; line-height: 1; }
.ui-empty > strong { color: var(--text); font-size: var(--text-lg); }

@media (prefers-reduced-motion: reduce) {
  .ui-btn, .ui-input, .ui-toast { transition: none; animation: none; }
  .ui-spinner { animation-duration: 2.4s; }
}

/* ── Table ───────────────────────────────────────────────────────────────────── */
/* <div class="ui-table-wrap"><table class="ui-table">…</table></div>. The wrap scrolls sideways
   inside itself on a phone, so the page never does. .num on a cell lines up numbers on the right.
   .sticky-first keeps the first column in view while the rest scrolls (a grid of names by day).
   .tight on a cell drops its padding, for a cell that is a block of colour (a day in that grid). */
.ui-table-wrap { overflow-x: auto; max-inline-size: 100%; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.ui-table { inline-size: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--text-sm); }
.ui-table :is(th, td) { padding: 10px 12px; text-align: start; vertical-align: middle; border-bottom: 1px solid var(--border); white-space: nowrap; }
.ui-table thead th {
  position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--text-2);
  font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
}
.ui-table tbody tr:last-child > * { border-bottom: 0; }
.ui-table tbody tr:hover > * { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.ui-table :is(th, td).num { text-align: end; font-variant-numeric: tabular-nums; }
.ui-table td.wrap { white-space: normal; min-inline-size: 12em; }
.ui-table :is(th, td).tight { padding: 0; }
.ui-table tr.selected > *, .ui-table tr[aria-selected='true'] > * { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.ui-table.sticky-first :is(th, td):first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--border); }
.ui-table.sticky-first thead th:first-child { z-index: 2; background: var(--surface-2); }
.ui-table.sticky-first tr:is(.selected, [aria-selected='true']) > :first-child { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }

/* ── Calendar ────────────────────────────────────────────────────────────────── */
/* A month: <div class="ui-cal"><span class="dow">M</span>…×7, then one <button> per day>.
   On a day: .out (another month), aria-current="date" (today), aria-selected="true" (picked),
   .range / .start / .end (a span of days, such as a holiday), and dots under the number:
   <button>14<span class="dots"><i></i><i style="--c: var(--warning)"></i></span></button> (up to
   three). Empty <span></span>s pad the first week. */
.ui-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px 0; text-align: center; }
.ui-cal > .dow { padding: 4px 0; font-size: var(--text-xs); font-weight: 600; color: var(--text-3); }
.ui-cal > :where(button, div, a) {
  position: relative; display: grid; place-items: center; align-content: center; gap: 2px;
  min-block-size: 44px; margin: 0; padding: 2px 0; border: 0; border-radius: var(--r-sm);
  background: none; color: var(--text); font: inherit; font-size: var(--text-sm); font-variant-numeric: tabular-nums;
  text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.ui-cal > button:hover { background: var(--surface-2); }
.ui-cal > button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ui-cal > .out { color: var(--text-3); }
.ui-cal > [aria-current='date'] { font-weight: 800; color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.ui-cal > .range { background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 0; }
.ui-cal > .range.start { border-start-start-radius: var(--r-sm); border-end-start-radius: var(--r-sm); }
.ui-cal > .range.end { border-start-end-radius: var(--r-sm); border-end-end-radius: var(--r-sm); }
.ui-cal > [aria-selected='true'], .ui-cal > .start, .ui-cal > .end { background: var(--accent); color: var(--text-on-accent); font-weight: 700; }
.ui-cal > * > .dots { display: flex; gap: 2px; block-size: 5px; }
.ui-cal > * > .dots > i { inline-size: 5px; block-size: 5px; border-radius: 50%; background: var(--c, var(--accent)); }
.ui-cal > :is([aria-selected='true'], .start, .end) > .dots > i { background: currentColor; }
.ui-cal.small > :where(button, div, a) { min-block-size: 32px; font-size: var(--text-xs); }

/* ── Desktop side navigation ─────────────────────────────────────────────────── */
/* <div class="ui-shell"><nav class="ui-rail">…links with aria-current="page"…</nav><main>…</main><nav class="ui-tabbar">…</nav></div>
   On a big screen (900px and up) the rail sits down the left and the shell's tab bar hides. On a
   phone the rail hides, and the same links live in the .ui-tabbar. A rail link: an icon then the
   words, <a href="#"><span>🏠</span>Home</a>. A .name at the top for the app's name. */
.ui-shell { display: block; }
.ui-rail { display: none; }
@media (min-width: 900px) {
  .ui-shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-block-size: 100dvh; }
  .ui-rail {
    position: sticky; top: 0; block-size: 100dvh; overflow-y: auto;
    display: flex; flex-direction: column; gap: 2px; padding: var(--sp-4) var(--sp-3);
    background: var(--surface); border-inline-end: 1px solid var(--border);
  }
  .ui-rail > .name { padding: var(--sp-2) var(--sp-3) var(--sp-4); font: 700 var(--text-lg)/1.2 var(--font-display); }
  .ui-rail > :is(a, button) {
    display: flex; align-items: center; gap: var(--sp-3); min-block-size: 40px; padding: 0 var(--sp-3); margin: 0;
    border: 0; border-radius: var(--r-sm); background: none; color: var(--text-2);
    font: inherit; font-size: var(--text-sm); font-weight: 600; text-align: start; text-decoration: none; cursor: pointer;
  }
  .ui-rail > :is(a, button) > :first-child { inline-size: 22px; text-align: center; font-size: 18px; line-height: 1; flex: none; }
  .ui-rail > :is(a, button):hover { background: var(--surface-2); color: var(--text); }
  .ui-rail > [aria-current]:not([aria-current='false']) { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--text); }
  .ui-rail > [aria-current]:not([aria-current='false']) > :first-child { color: var(--accent); }
  .ui-rail > hr { margin: var(--sp-2) 0; border: 0; border-top: 1px solid var(--border); }
  .ui-rail > .ui-spacer { flex: 1; }
  .ui-shell:has(> .ui-rail) .ui-tabbar { display: none; }
}

/* ── Photos ──────────────────────────────────────────────────────────────────── */
/* A drop zone that's also the file button:
     <label class="ui-drop"><input type="file" accept="image/*" multiple><strong>Add photos</strong><span>or drop them here</span></label>
   Add .over while something is dragged over it. The file input is hidden but still works.
   Thumbnails: <div class="ui-thumbs"><figure class="ui-thumb"><img …><button class="x" aria-label="Remove">×</button>
   <figcaption>Front</figcaption></figure>…</div>. A <button class="ui-thumb" aria-pressed> is a
   photo you pick (its × must be a <span class="x" role="button" tabindex="0">, as a button can't hold a button). */
.ui-drop {
  display: grid; justify-items: center; gap: 4px; padding: var(--sp-6) var(--sp-4); text-align: center;
  border: 2px dashed var(--border-strong); border-radius: var(--r-lg); background: var(--surface);
  color: var(--text-2); font-size: var(--text-sm); cursor: pointer; transition: border-color 0.12s, background-color 0.12s;
}
.ui-drop > strong { color: var(--text); font-size: var(--text-md); }
.ui-drop:hover, .ui-drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.ui-drop:has(:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.ui-drop { position: relative; }
.ui-drop > input[type='file'] { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; pointer-events: none; }

.ui-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--sp-2); }
.ui-thumb {
  position: relative; margin: 0; padding: 0; aspect-ratio: 1; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); color: inherit; font: inherit;
}
button.ui-thumb { cursor: pointer; }
.ui-thumb > :is(img, canvas) { display: block; inline-size: 100%; block-size: 100%; object-fit: cover; }
.ui-thumb > .x {
  position: absolute; top: 4px; inset-inline-end: 4px; display: grid; place-items: center;
  inline-size: 28px; block-size: 28px; margin: 0; padding: 0; border: 0; border-radius: var(--r-full);
  background: rgb(0 0 0 / 0.55); color: #fff; font: inherit; font-size: 16px; line-height: 1; cursor: pointer;
}
.ui-thumb > figcaption, .ui-thumb > .cap {
  position: absolute; inset: auto 0 0; padding: 14px 6px 4px; color: #fff; font-size: var(--text-xs); font-weight: 600;
  background: linear-gradient(transparent, rgb(0 0 0 / 0.6)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ui-thumb[aria-pressed='true'], .ui-thumb.selected { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.ui-thumb[aria-pressed='true']::after, .ui-thumb.selected::after {
  content: '✓'; position: absolute; top: 4px; inset-inline-start: 4px; display: grid; place-items: center;
  inline-size: 24px; block-size: 24px; border-radius: var(--r-full); background: var(--accent); color: var(--text-on-accent);
  font-size: 14px; font-weight: 700;
}

/* ── Bottom action bar ───────────────────────────────────────────────────────── */
/* For select mode: <div class="ui-actionbar"><span class="count">3 picked</span><button class="ui-btn small">Move</button>…</div>.
   Fixed to the bottom, above the tab bar if there is one. Show it only while something's picked
   (toggle hidden), and give the page extra bottom padding so it doesn't cover the last row. */
.ui-actionbar {
  position: fixed; z-index: 58; left: 50%; transform: translateX(-50%);
  bottom: max(var(--sp-3), calc(env(safe-area-inset-bottom) + 8px));
  inline-size: min(560px, 100% - 24px); display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--shadow-lg); animation: ui-toast-in 0.2s var(--ease);
}
.ui-actionbar > .count { flex: 1; min-width: 0; font-size: var(--text-sm); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body:has(.ui-tabbar) .ui-actionbar { bottom: calc(80px + env(safe-area-inset-bottom)); }

/* ── Colour picker ───────────────────────────────────────────────────────────── */
/* <div class="ui-swatches" role="radiogroup" aria-label="Colour">
     <button role="radio" aria-checked="true" aria-label="Blue" style="--c:#3b82f6"></button>…</div>
   The app sets aria-checked on tap. The colour itself is data, so it goes in --c. */
.ui-swatches { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.ui-swatches > * {
  inline-size: 36px; block-size: 36px; margin: 0; padding: 0; flex: none; cursor: pointer;
  border: 0; border-radius: var(--r-full); background: var(--c, var(--accent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 22%, transparent); -webkit-tap-highlight-color: transparent;
}
/* The rings use --text, so a dark colour still shows on a dark sheet (12 Nov 2026, Harry's Gallery). */
.ui-swatches > [aria-checked='true'], .ui-swatches > [aria-pressed='true'] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.ui-swatches > :focus-visible { outline: 2px solid var(--text); outline-offset: 4px; }

/* ── Avatar ──────────────────────────────────────────────────────────────────── */
/* <span class="ui-avatar">TB</span>, or with a photo: <span class="ui-avatar"><img alt="" src=…></span>.
   Its own colour: style="--c:#e11d48". .small (28px) and .large (56px). A row that overlaps: .ui-avatars. */
.ui-avatar {
  display: inline-grid; place-items: center; flex: none; overflow: hidden;
  inline-size: 36px; block-size: 36px; border-radius: var(--r-full);
  background: color-mix(in srgb, var(--c, var(--accent)) 20%, var(--surface));
  color: color-mix(in srgb, var(--c, var(--accent)) 70%, var(--text));
  font-size: 13px; font-weight: 700; line-height: 1; letter-spacing: 0.02em; text-transform: uppercase; user-select: none;
}
.ui-avatar > img { inline-size: 100%; block-size: 100%; object-fit: cover; }
.ui-avatar.small { inline-size: 28px; block-size: 28px; font-size: 11px; }
.ui-avatar.large { inline-size: 56px; block-size: 56px; font-size: 20px; }
.ui-avatars { display: inline-flex; }
.ui-avatars > .ui-avatar { box-shadow: 0 0 0 2px var(--surface); }
.ui-avatars > .ui-avatar + .ui-avatar { margin-inline-start: -8px; }

/* ── Theme switch (from theme.js) ────────────────────────────────────────────── */
/* <theme-switch> on a Settings screen, <theme-switch compact> in a top bar. */
theme-switch { display: block; }
theme-switch[compact] { display: inline-flex; }
