/* 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; }

/* Words on a button never break onto two lines (17 Nov 2026, Tom, about Shoebox's viewer bar
   showing "Not / good" and "Show in / Finder"). Every ui- button, chip, badge, tab and menu item
   is white-space: nowrap. A row that runs out of room wraps whole buttons onto a second row
   instead: .ui-actions, .ui-head, .ui-bar, .ui-actionbar and a sheet's header all wrap, and their
   title keeps at least a few words' room before the buttons drop. On purpose two-line buttons:
   .ui-btn.link (inside a sentence) and .ui-btn.choice (a second line of explanation). */
:where(.ui-tabbar, .ui-rail) > :is(a, button), .ui-stepper > button, .ui-toast > button { white-space: nowrap; }

/* ── 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; }
/* <div class="ui-actions tiles"><button class="ui-btn">${uiIcon('calendar')}<span>Pick a day</span></button>…</div>
   The actions under an opened list row: equal quiet tiles, icon over a short label, on one
   line (18 Nov 2026, Life Kanban's Today rows). Up to six fit a phone; keep labels to two words. */
.ui-actions.tiles { flex-wrap: nowrap; gap: 2px; }
.ui-actions.tiles > * { flex: 0 1 96px; min-width: 0; }
.ui-actions.tiles > .ui-btn {
  flex-direction: column; gap: 2px; min-height: var(--tap); padding: var(--sp-1) 2px;
  background: transparent; border-color: transparent; color: var(--text-2);
  font-size: var(--text-2xs); font-weight: 600; position: relative;
}
.ui-actions.tiles > .ui-btn:hover { background: var(--surface); color: var(--text); }
.ui-actions.tiles > .ui-btn > .ui-icon { inline-size: var(--icon-md); block-size: var(--icon-md); }
.ui-actions.tiles > .ui-btn.danger { color: var(--text-2); }
.ui-actions.tiles > .ui-btn.danger > .ui-icon { color: var(--danger); }
/* Groups: an <hr> between tiles is a thin upright divider, and .end pushes a tile (Edit) to the
   far end, so "move it somewhere" and "change it" read as two different kinds of action. */
.ui-actions.tiles > hr { flex: none; align-self: stretch; inline-size: 1px; margin: var(--sp-1) var(--sp-1); border: 0; background: var(--border); }
.ui-actions.tiles > .end { margin-inline-start: auto; }
.ui-spacer { flex: 1; }

/* A section: a heading with an optional action on the right, then its content. */
.ui-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); min-height: 32px; }
.ui-head > :is(h1, h2, h3) { flex: 1 1 10em; 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); }

/* ── Icons ───────────────────────────────────────────────────────────────────── */
/* Icons, not emoji (18 Nov 2026, Tom: "I hate using emojis. I'd rather just custom icons"). One
   outline set for every app: Tabler, in vendor/chassis/icons.svg, drawn with uiIcon('bed') from
   icons.js or by hand: <svg class="ui-icon"><use href="vendor/chassis/icons.svg#bed"/></svg>.
   The line takes the text colour (currentColor), so it works in Light and Dark and goes accent on a
   pressed chip or the current tab. Sizes are the --icon-* scale: md 18 by default, .sm 16, .lg 24,
   .xl 36; in a tab bar, an icon button and an empty page the container picks the size. */
.ui-icon {
  inline-size: var(--icon-md, 18px); block-size: var(--icon-md, 18px); flex: none; display: inline-block;
  vertical-align: -0.2em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.ui-icon.sm, :is(.ui-chip, .ui-badge, .ui-label, .ui-hint, .ui-btn.small) .ui-icon { inline-size: var(--icon-sm, 16px); block-size: var(--icon-sm, 16px); }
.ui-icon.lg { inline-size: var(--icon-lg, 24px); block-size: var(--icon-lg, 24px); }
.ui-icon.xl, .ui-empty > .icon > .ui-icon { inline-size: var(--icon-xl, 36px); block-size: var(--icon-xl, 36px); stroke-width: 1.5; }
ui-icon { display: inline-flex; vertical-align: middle; }
/* An icon beside words: buttons and chips have their own gap; in a heading, label or plain line of
   text the icon leads with a small gap (no space character needed). */
:is(.ui-h2, .ui-label, .ui-hint, .ui-sub, .ui-row .main > span, .ui-note) > :is(.ui-icon, ui-icon):first-child { margin-inline-end: var(--sp-1, 4px); }
.ui-empty > .icon { color: var(--text-3); }

/* ── 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: var(--icon-md, 18px); line-height: 1; }
.ui-btn.icon.small { inline-size: var(--tap-sm, 36px); font-size: var(--icon-sm, 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: var(--text-md); 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: var(--text-2xs, 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: var(--icon-lg, 24px); line-height: 1; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ui-fab > svg { inline-size: var(--icon-lg, 24px); block-size: var(--icon-lg, 24px); }
.ui-fab.quiet { inline-size: var(--tap); block-size: var(--tap); font-size: var(--icon-md, 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: var(--text-input, 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 field and its button on one line, such as an add box (rule 9: an add box is a field and its
   button, nothing else): <div class="ui-addrow"><input class="ui-input" aria-label="…"><button class="ui-btn">Add</button></div>.
   The box takes the room; the button keeps its words on one line. */
.ui-addrow { display: flex; gap: var(--sp-2); align-items: center; }
.ui-addrow > .ui-input { flex: 1 1 auto; min-inline-size: 80px; }
.ui-addrow > :not(.ui-input) { flex: none; }
/* 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; }
/* A list bleeds to the card's edges. It only pulls up or down into the card's padding when it is the
   first or last thing in the card, never into a heading above it (18 Nov 2026, found by live-check). */
.ui-card > .ui-list { margin: 0 calc(var(--sp-4) * -1); }
.ui-card > .ui-list:first-child { margin-top: calc(var(--sp-2) * -1); }
.ui-card > .ui-list:last-child { margin-bottom: calc(var(--sp-2) * -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-bullets"><li>…</li></ul>: a plain bulleted list of short notes (what was done, what to
   check). Its own gap, no browser margins, the bullet hangs in the gutter. */
.ui-bullets { margin: 0; padding: 0 0 0 var(--sp-5); display: grid; gap: var(--sp-1); color: var(--text-2); }
.ui-bullets > li { padding-left: var(--sp-1); }
.ui-bullets > li::marker { color: var(--text-3); }

/* <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; }
/* A row hidden at the top (filtered out) doesn't leave the next one with a line above it. */
.ui-list > [hidden]: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: var(--icon-md, 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: var(--tap-xs, 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: var(--icon-sm, 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: var(--icon-md, 18px); 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: var(--text-input, 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: var(--tap-sm, 36px); block-size: 34px; font-size: var(--icon-md, 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; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2);
  min-height: 52px; padding: max(var(--sp-1), env(safe-area-inset-top)) max(var(--sp-4), env(safe-area-inset-right)) var(--sp-1) 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 1 8em; 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: var(--text-2xs, 11px); font-weight: 600; text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ui-tabbar > * > :first-child { font-size: var(--icon-lg, 24px); line-height: 1; }
.ui-tabbar > * > svg:first-child { inline-size: var(--icon-lg, 24px); block-size: var(--icon-lg, 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; flex-wrap: wrap; 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 1 10em; 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)); }
}

/* ── Picker sheet ────────────────────────────────────────────────────────────── */
/* Pick one of the person's own things (a spot, a category, a person, a place), or add a new one
   (21 Nov 2026, Tom: "I hate using like native drop downs … I need the option to add it"). Drawn by
   uiPick() in picker.js: a labelled search box that filters in place, the rows under group headings,
   an Add "…" row when nothing matches exactly, an optional second step (which room), and Back to the
   sheet underneath. The sheet is a .ui-sheet; these are the only extra pieces. */
.ui-pick-group { display: grid; gap: var(--sp-2); }
.ui-pick .ui-row > .ui-icon.tick { flex: none; color: var(--accent); }
.ui-row.add { color: var(--accent); }
.ui-row.add > .main > :first-child { color: var(--accent); }
.ui-row.add > .ui-icon { flex: none; }
.ui-row[disabled] { opacity: 0.5; cursor: progress; }
.ui-pick > footer { justify-content: flex-start; }
/* One height while open, so filtering down to a row or two doesn't shrink the sheet; the search box sits
   outside the scrolling list, so it never moves. On a phone picker.js keeps it above the keyboard:
   --pick-vh is the height you can see, --pick-kb the keyboard's. */
.ui-pick { block-size: min(86vh, 760px); }
.ui-pick > .ui-pick-search { padding: 0 var(--sp-5) var(--sp-2); }
.ui-pick > .body { flex: 1; align-content: start; }
@media (max-width: 560px) {
  .ui-pick { block-size: calc(var(--pick-vh, 100dvh) * 0.92); max-block-size: none; margin-block-end: var(--pick-kb, 0px); }
}
/* The field that opens a picker: looks like a text box, shows the choice, opens uiPick() on tap.
   <label class="ui-field"><span>Kept in</span><button type="button" class="ui-input ui-pickfield"><span>Wardrobe · Bedroom</span></button></label>
   Nothing chosen yet: <span class="none">Not filed</span>. */
.ui-pickfield { display: flex; align-items: center; gap: var(--sp-2); text-align: start; cursor: pointer; color: var(--text); font: inherit; font-size: var(--text-input); }
.ui-pickfield > span { flex: 1; min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-pickfield > .none { color: var(--text-3); }
.ui-pickfield::after { content: ''; flex: none; inline-size: 8px; block-size: 8px; margin-inline-end: 4px; border: solid var(--text-3); border-width: 2px 2px 0 0; transform: rotate(45deg); }

/* The icon chooser, uiPickIcon() in picker.js: the same sheet, with a grid of icon buttons; the current one
   (aria-pressed) is ringed in the accent. */
.ui-iconpick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--tap), 1fr)); gap: var(--sp-1); }
.ui-iconpick-grid > .ui-btn[aria-pressed="true"] { color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.ui-iconpick-grid > .ui-btn[hidden] { display: none; }

/* ── Help sheet and numbered steps ──────────────────────────────────────────── */
/* Step-by-step how-to guides inside every app (21 Nov 2026, Tom: "more how-to than FAQ"). Drawn by uiHelp.open()
   in help.js: a .ui-sheet with the search box and topic chips held above the list (like the picker), the guides
   as .ui-row buttons under .ui-label headings, and one guide as where-it-starts, .ui-steps, a .ui-note.good for
   "when it's worked", and Back / Take me there in the footer. The sheet keeps one height while it's open. */
.ui-help { block-size: min(86vh, 760px); }
.ui-help > .ui-help-top { display: grid; gap: var(--sp-3); padding: 0 var(--sp-5) var(--sp-3); }
.ui-help > .ui-help-top .ui-chips.scroll { margin-inline: calc(var(--sp-5) * -1); padding-inline: var(--sp-5); }
.ui-help > .body { flex: 1; align-content: start; }
.ui-help > [hidden] { display: none; }
.ui-help > footer { justify-content: space-between; }
.ui-help-group { display: grid; gap: var(--sp-2); }
.ui-help-where { display: flex; gap: var(--sp-2); align-items: flex-start; margin: 0; font-weight: 600; color: var(--accent-ink, var(--accent)); }
.ui-help-where > .ui-icon { flex: none; margin-top: 2px; }
.ui-help-mark { flex: none; display: inline-flex; color: var(--accent-ink, var(--accent)); }
.ui-help-mark > svg { inline-size: var(--icon-md); block-size: var(--icon-md); }
.ui-help-asked { margin: 0; color: var(--text-2); }
.ui-help-answer { margin: 0; line-height: 1.5; white-space: pre-line; }
/* On a computer the topic chips wrap (no sideways scrolling with a mouse), and a guide being read sizes to
   its content instead of keeping the list's height. */
@media (min-width: 561px) {
  .ui-help > .ui-help-top .ui-chips.scroll { flex-wrap: wrap; overflow: visible; margin-inline: 0; padding-inline: 0; }
  .ui-help.reading { block-size: fit-content; }
}
@media (max-width: 560px) {
  .ui-help { block-size: calc(var(--help-vh, 100dvh) * 0.92); max-block-size: none; margin-block-end: var(--help-kb, 0px); }
}
/* <ol class="ui-steps"><li>Tap Payment in the header.</li>…</ol>: numbered steps, each number in an accent
   circle beside its words. For any "do this, then this" (a guide, a set-up, a how-to on a page). */
.ui-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-3); counter-reset: ui-step; }
.ui-steps > li { counter-increment: ui-step; display: grid; grid-template-columns: var(--tap-xs, 28px) 1fr; gap: var(--sp-3); align-items: start; line-height: 1.45; }
.ui-steps > li::before {
  content: counter(ui-step); display: grid; place-items: center; inline-size: var(--tap-xs, 28px); block-size: var(--tap-xs, 28px);
  border-radius: var(--r-full); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--text);
  font-size: var(--text-sm); font-weight: 700; font-variant-numeric: tabular-nums;
}
.ui-steps > li { padding-top: 3px; }
.ui-steps > li::before { margin-top: -3px; }

/* ── 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: var(--icon-xl, 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: var(--icon-md, 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-rail > .ui-label { padding: var(--sp-4) var(--sp-3) var(--sp-1); }   /* a group's heading among the links */
  .ui-shell:has(> .ui-rail) .ui-tabbar { display: none; }
}

/* ── A row of tabs under a top bar ───────────────────────────────────────────── */
/* <nav class="ui-tabs"><a class="lead" href="#group"><span class="ui-appicon small">…</span>Videos</a>
   <button aria-current="page">${uiIcon('scissors')}Cut</button><button>${uiIcon('cut')}Trim <span class="n">3</span></button>…</nav>
   A tool's or a section's pages, side by side (19 Nov 2026, for Shoebox's top bar): an icon and a word each, the one you're on
   underlined in the accent. An optional .lead says where you are (its group's .ui-appicon and name; a link back to it). A .n is
   a count of things waiting there, only where something waits. A .ui-seg.fit in the row switches between two areas. The row
   scrolls sideways if it runs out of room; the words never wrap. Parts of one page are a .ui-seg.fit on that page, not a
   second row of tabs or a menu. */
.ui-tabs { display: flex; align-items: center; gap: var(--sp-1); overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--border); }
.ui-tabs > :is(button, a) {
  display: inline-flex; align-items: center; gap: var(--sp-2); flex: none; min-block-size: var(--tap); padding: 0 var(--sp-3); margin: 0;
  border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--text-2);
  font: inherit; font-size: var(--text-sm); font-weight: 600; white-space: nowrap; text-decoration: none; cursor: pointer; box-shadow: none;
}
.ui-tabs > :is(button, a):hover { color: var(--text); }
.ui-tabs > [aria-current]:not([aria-current='false']) { color: var(--text); border-bottom-color: var(--accent); }
.ui-tabs > [aria-current]:not([aria-current='false']) > .ui-icon { color: var(--accent); }
.ui-tabs > :is(button, a):focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ui-tabs > :is(button, a) > .n { font-size: var(--text-xs); font-weight: 700; color: var(--text-2); background: var(--surface-2); border-radius: var(--r-full); padding: 0 var(--sp-2); }
.ui-tabs > .lead { gap: var(--sp-2); padding-inline: 0 var(--sp-3); margin-inline-end: var(--sp-1); color: var(--text); border-bottom-color: transparent; }
.ui-tabs > .lead::after { content: ''; align-self: center; block-size: var(--icon-md); margin-inline-start: var(--sp-3); border-inline-start: 1px solid var(--border); }
.ui-tabs > .ui-seg { flex: none; margin-inline-end: var(--sp-2); }
.ui-tabs > .ui-spacer { flex: 1; }

/* ── App icons and launcher tiles ────────────────────────────────────────────── */
/* An app or group icon, in the icon language: a gradient tile with one white glyph (19 Nov 2026,
   for Shoebox's home). <span class="ui-appicon" style="--c1:#8b5cf6;--c2:#6d28d9">${uiIcon('sparkles')}</span>
   --c1 is its identity colour (--c2, the gradient's foot, defaults to a darker --c1; both default to
   --accent). Sizes: .small 28 (beside a rail link), 36 by default, .large 44 (a tile), .xl 56 (a page
   heading). .soft is the quiet one: a tint of the colour and the glyph in it, for long grids. */
.ui-appicon {
  display: grid; place-items: center; flex: none; inline-size: var(--tap-sm); block-size: var(--tap-sm);
  border-radius: var(--r-md); color: #fff;
  background: linear-gradient(160deg, var(--c1, var(--accent)), var(--c2, color-mix(in srgb, var(--c1, var(--accent)) 70%, black)));
}
.ui-appicon > .ui-icon { inline-size: var(--icon-md); block-size: var(--icon-md); }
.ui-appicon.small { inline-size: var(--tap-xs); block-size: var(--tap-xs); border-radius: var(--r-sm); }
.ui-appicon.small > .ui-icon { inline-size: var(--icon-sm); block-size: var(--icon-sm); }
.ui-appicon.large { inline-size: var(--tap); block-size: var(--tap); }
.ui-appicon.large > .ui-icon { inline-size: var(--icon-lg); block-size: var(--icon-lg); }
.ui-appicon.xl { inline-size: calc(var(--tap) + var(--sp-3)); block-size: calc(var(--tap) + var(--sp-3)); border-radius: var(--r-lg); }
.ui-appicon.xl > .ui-icon { inline-size: var(--icon-xl); block-size: var(--icon-xl); stroke-width: 1.75; }
.ui-appicon.soft { background: color-mix(in srgb, var(--c1, var(--accent)) 16%, transparent); color: var(--c1, var(--accent)); }
.ui-rail > :is(a, button) > .ui-appicon:first-child { inline-size: var(--tap-xs); color: #fff; }
.ui-head:has(> .ui-appicon.xl) { gap: var(--sp-4); }   /* an .xl icon beside a page title */
/* A grid of things to open (an app's tools, a hub's apps): each tile is its icon, its name and one
   line of what it does. <div class="ui-launchers"><div class="ui-launcher"><button class="open">
   <span class="ui-appicon large soft">…</span><span class="main"><b>Name</b><span class="sub">What it does</span></span></button>
   <button class="pin" aria-pressed="false" aria-label="Add to Favourites">${uiIcon('star')}</button></div>…</div>
   .large stacks the icon over the words, for a few favourites. The .pin (optional) shows on hover
   and stays when pressed. A trailing icon after .main (a chevron) is drawn quiet. */
.ui-launchers { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: var(--sp-3); }
.ui-launcher { position: relative; min-width: 0; }
.ui-launcher > .open {
  display: flex; align-items: center; gap: var(--sp-3); inline-size: 100%; min-block-size: calc(var(--tap) + var(--sp-6));
  padding: var(--sp-3); margin: 0; border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); color: inherit; font: inherit; text-align: start; cursor: pointer; box-shadow: none;
}
.ui-launcher:has(> .pin) > .open { padding-inline-end: calc(var(--tap-xs) + var(--sp-3)); }
.ui-launcher > .open:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.ui-launcher > .open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ui-launcher .main { flex: 1; min-width: 0; display: grid; gap: calc(var(--sp-1) / 2); }
.ui-launcher .main > :first-child { font-size: var(--text-md); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }   /* the name on one line; what it does may take two */
.ui-launcher .main > .sub { font-size: var(--text-sm); color: var(--text-2); }
.ui-launcher > .open > .ui-icon:last-child { color: var(--text-3); }
.ui-launcher.large > .open { flex-direction: column; align-items: flex-start; justify-content: center; min-block-size: calc(var(--tap) * 2 + var(--sp-3)); }
.ui-launcher.large .main { inline-size: 100%; }
.ui-launcher > .pin {
  position: absolute; inset-block-start: var(--sp-2); inset-inline-end: var(--sp-2); display: grid; place-items: center;
  inline-size: var(--tap-xs); block-size: var(--tap-xs); min-block-size: 0; padding: 0; margin: 0; border: 0; border-radius: var(--r-sm);
  background: none; color: var(--text-3); cursor: pointer; opacity: 0; box-shadow: none;
}
.ui-launcher > .pin > .ui-icon { inline-size: var(--icon-sm); block-size: var(--icon-sm); }
.ui-launcher:hover > .pin, .ui-launcher > .pin:focus-visible, .ui-launcher > .pin[aria-pressed='true'] { opacity: 1; }
.ui-launcher > .pin:hover { background: var(--surface-2); }
.ui-launcher > .pin[aria-pressed='true'] { color: var(--warning); }
.ui-launcher > .pin[aria-pressed='true'] > .ui-icon { fill: currentColor; }

/* ── 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: var(--icon-sm, 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: var(--text-sm); 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; flex-wrap: wrap; 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 1 6em; 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)); }

/* ── Manage list (manage.js) ─────────────────────────────────────────────────── */
/* Add, rename, rearrange, move and delete the person's own things (21 Nov 2026, Tom: "having to default to
   Claude to add something I need in the app"). Drawn by uiManage() in manage.js inside any element, or
   uiManage.sheet() for an Organise page: groups are .ui-mgroup (a .ui-label heading, a .ui-card.flat list,
   an Add button that opens a field in place), rows are .ui-row with a drag handle (.ui-grip) and a ⋯ menu.
   Everything else is existing ui- pieces; these are the extras for dragging and picking. */
.ui-manage { display: grid; gap: var(--sp-6); }
.ui-manage.selecting { padding-block-end: calc(var(--tap) * 2); }   /* room above the action bar */
.ui-mgroup { position: relative; }
.ui-mhead { gap: var(--sp-1); }
.ui-mhead > .ui-label { margin: 0; }
.ui-mcount { color: var(--text-3); font-weight: 400; }
.ui-mrow { gap: var(--sp-1); }
.ui-mrow > button.main {
  padding: 0; margin: 0; border: 0; background: none; color: inherit; font: inherit; text-align: start;
  cursor: pointer; -webkit-tap-highlight-color: transparent; min-height: var(--tap-sm); align-content: center;
}
.ui-mrow > label.check.main { display: flex; min-height: var(--tap-sm); }
.ui-mname { display: grid; gap: 2px; min-width: 0; }
.ui-mname > :first-child { font-weight: 600; overflow-wrap: anywhere; }
.ui-mname > .sub { font-size: var(--text-sm); color: var(--text-2); }
.ui-grip { touch-action: none; cursor: grab; color: var(--text-3); }
.ui-mempty {
  display: grid; place-items: center; min-height: var(--tap); padding: var(--sp-2) var(--sp-4);
  border: 1px dashed var(--border-strong); border-radius: var(--r-md); color: var(--text-3); font-size: var(--text-sm);
}
.ui-madd { display: grid; gap: var(--sp-2); }
.ui-madd > .ui-actions { align-items: flex-end; }
.ui-madd > .ui-actions > .ui-field { flex: 1 1 12em; min-width: 0; }
.ui-mmatches { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1); }
.ui-mmatches:empty { display: none; }
.ui-mmatches > [aria-disabled='true'] { cursor: default; opacity: 0.7; }
.ui-mhidden { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; margin: 0; }
/* While dragging: the row being moved fades, a line shows where it lands, a group it would join lights up. */
.ui-mdragfrom { opacity: 0.35; }
.ui-mrow.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.ui-mrow.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
.ui-mgroup.drop-before::before, .ui-mgroup.drop-after::after {
  content: ''; position: absolute; inset-inline: 0; block-size: 2px; background: var(--accent); border-radius: var(--r-full);
}
.ui-mgroup.drop-before::before { inset-block-start: calc(var(--sp-3) * -1); }
.ui-mgroup.drop-after::after { inset-block-end: calc(var(--sp-3) * -1); }
.ui-mgroup.drop-into > .ui-card, .ui-mgroup.drop-into > .ui-mempty, .ui-manage > .ui-mgroup.drop-into:not(:has(> .ui-card, > .ui-mempty)) {
  outline: 2px solid var(--accent); outline-offset: 2px; background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.ui-mghost {
  position: fixed; inset-block-start: 0; inset-inline-start: 0; z-index: 90; margin: 0; padding: 0 var(--sp-2);
  inline-size: var(--w); transform: translate(var(--x), var(--y)); pointer-events: none; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-lg); opacity: 0.96;
}
.ui-mghost .ui-row { border-top: 0; }
body.ui-mdragging { user-select: none; -webkit-user-select: none; cursor: grabbing; }
@keyframes ui-mflash { from { background: color-mix(in srgb, var(--accent) 22%, transparent); } }
.ui-mflash { animation: ui-mflash 1.2s var(--ease); }

/* ── 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: var(--text-sm); 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: var(--tap-xs, 28px); block-size: var(--tap-xs, 28px); font-size: var(--text-2xs, 11px); }
.ui-avatar.large { inline-size: 56px; block-size: 56px; font-size: var(--text-xl); }
.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; }
