/* Luna components. One vocabulary: the design packet's class names (2026-11-09),
   the engine's action hooks (`action action--{kind}`, `data-action`,
   `data-row-id`, the section `data-*`) beside them, and the engine's parts the
   packet does not draw (menus, the Day actions, tiles with tooltips, the graph).
   Every value comes from tokens.css. The renderer and the client emit this
   markup (COMPOSE.md); nothing here names a user, an area or a page.
   Order: base · icons · brand · app and shell · rail · page and section · fold ·
   table and row · menu · pill, glyph, area mark · buttons, chips, fields, switch ·
   card · tiles and tooltips · status, toast, skeleton, empty · threads and composer ·
   dump · band, login, prose, lists · companion · graph · motion · wide · floor. */

/* ===================================================================== base */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  overflow: hidden;   /* .app is the scroller: its fixed children (sheets, toasts) then sit on the screen */
  background: var(--bg); color: var(--text);
  font: 400 var(--fs-md)/var(--lh-text) var(--font-text);
  -webkit-font-smoothing: antialiased;
}
:where(h1, h2, h3, h4, p, ul, ol, pre, figure) { margin: 0; }
:where(ul, ol) { padding: 0; list-style: none; }
:where(button, input, textarea, select) { font: inherit; color: inherit; }
:where(button) { background: none; border: 0; padding: 0; cursor: pointer; }
:where(a) { color: var(--accent); text-decoration: none; }
:where(mark) { background: var(--warn-soft); color: inherit; border-radius: 3px; }
summary { cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.mono { font-family: var(--font-mono); font-size: var(--fs-xs); }
.num { font-variant-numeric: tabular-nums; }

/* ===================================================================== icons
   <span class="icon icon--tick" aria-hidden="true"></span>: a mask painted in
   currentColor (D-43). The packet's inline <svg class="icon"> is this span. */
.icon {
  display: inline-block; flex: none;
  width: 1.25rem; height: 1.25rem;
  background: currentColor;
  -webkit-mask: var(--i) center / contain no-repeat;
          mask: var(--i) center / contain no-repeat;
}
.icon--sm { width: 1rem; height: 1rem; }
.icon--lg { width: 1.5rem; height: 1.5rem; }
:root {
  --i-tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
  --i-more: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Ccircle cx='5' cy='12' r='2'/%3E%3Ccircle cx='12' cy='12' r='2'/%3E%3Ccircle cx='19' cy='12' r='2'/%3E%3C/svg%3E");
  --i-mic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='3' width='6' height='11' rx='3'/%3E%3Cpath d='M5.5 11a6.5 6.5 0 0 0 13 0M12 17.5V21'/%3E%3C/svg%3E");
  --i-camera: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 8h3l1.5-2.5h7L17 8h3v11H4z'/%3E%3Ccircle cx='12' cy='13' r='3.5'/%3E%3C/svg%3E");
  --i-send: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19V5M6 11l6-6 6 6'/%3E%3C/svg%3E");
  --i-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4.5 4.5'/%3E%3C/svg%3E");
  --i-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6l6 6-6 6'/%3E%3C/svg%3E");
  --i-back: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 6l-6 6 6 6'/%3E%3C/svg%3E");
  --i-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E");
  --i-today: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='5' width='16' height='15' rx='2.5'/%3E%3Cpath d='M4 10h16M9 3v4M15 3v4'/%3E%3C/svg%3E");
  --i-inbox: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 13l2.5-8h11L20 13v6H4z'/%3E%3Cpath d='M4 13h5l1 2h4l1-2h5'/%3E%3C/svg%3E");
  --i-threads: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 5h14v10h-8l-4 4v-4H5z'/%3E%3C/svg%3E");
  --i-dump: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20l1-4L16 5l3 3L8 19z'/%3E%3Cpath d='M14 7l3 3'/%3E%3C/svg%3E");
  --i-areas: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='6.5' height='6.5' rx='1.5'/%3E%3Crect x='13.5' y='4' width='6.5' height='6.5' rx='1.5'/%3E%3Crect x='4' y='13.5' width='6.5' height='6.5' rx='1.5'/%3E%3Crect x='13.5' y='13.5' width='6.5' height='6.5' rx='1.5'/%3E%3C/svg%3E");
  --i-settings: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h9M18 7h2M4 17h3M12 17h8'/%3E%3Ccircle cx='15.5' cy='7' r='2.5'/%3E%3Ccircle cx='9.5' cy='17' r='2.5'/%3E%3C/svg%3E");
  --i-link: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 5h5v5M19 5l-8 8M17 14v5H5V7h5'/%3E%3C/svg%3E");
  --i-play: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M8 5.5v13a1 1 0 0 0 1.5.87l11-6.5a1 1 0 0 0 0-1.74l-11-6.5A1 1 0 0 0 8 5.5z'/%3E%3C/svg%3E");
  --i-next: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h13M13 7l5 5-5 5'/%3E%3C/svg%3E");
  --i-photo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='5' width='16' height='14' rx='2.5'/%3E%3Ccircle cx='9' cy='10' r='1.5'/%3E%3Cpath d='M20 16l-5-5-9 8'/%3E%3C/svg%3E");
  --i-paste: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='6' y='5' width='12' height='16' rx='2'/%3E%3Cpath d='M9 5V3.5h6V5'/%3E%3C/svg%3E");
  --i-doc: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 3h7l4 4v14H7z'/%3E%3Cpath d='M14 3v4h4M10 12h5M10 16h5'/%3E%3C/svg%3E");
  --i-clock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3Cpath d='M12 8v4l3 2'/%3E%3C/svg%3E");
  --i-route: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 8h13M14 5l3 3-3 3M20 16H7M10 13l-3 3 3 3'/%3E%3C/svg%3E");
  --i-pick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='5' width='14' height='14' rx='3'/%3E%3Cpath d='M9 12l2 2 4-4'/%3E%3C/svg%3E");
  --i-move: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Ccircle cx='9' cy='6' r='1.6'/%3E%3Ccircle cx='15' cy='6' r='1.6'/%3E%3Ccircle cx='9' cy='12' r='1.6'/%3E%3Ccircle cx='15' cy='12' r='1.6'/%3E%3Ccircle cx='9' cy='18' r='1.6'/%3E%3Ccircle cx='15' cy='18' r='1.6'/%3E%3C/svg%3E");
  --i-moon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M14.5 3.2a8.8 8.8 0 1 0 6.3 13.9A7.3 7.3 0 0 1 14.5 3.2z'/%3E%3C/svg%3E");
  --i-info: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E");
  --i-device: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='7' y='3' width='10' height='18' rx='2.5'/%3E%3Cpath d='M11 18h2'/%3E%3C/svg%3E");
  --i-laptop: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='5' width='14' height='10' rx='1.5'/%3E%3Cpath d='M3 19h18'/%3E%3C/svg%3E");
  --i-sort: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 10l4-4 4 4M8 14l4 4 4-4'/%3E%3C/svg%3E");
  --i-stop: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Crect x='7' y='7' width='10' height='10' rx='2'/%3E%3C/svg%3E");
  --i-plus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
  --i-reply: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 8L5 12l5 4M5 12h9a5 5 0 0 1 5 5v1'/%3E%3C/svg%3E");
  --i-tab: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='5' width='16' height='14' rx='2.5'/%3E%3Cpath d='M4 9h7V5'/%3E%3C/svg%3E");
  --i-cancel: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3Cpath d='M6.5 6.5l11 11'/%3E%3C/svg%3E");
  --i-bell: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z'/%3E%3Cpath d='M10 20.5h4'/%3E%3C/svg%3E");
  --i-sun: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 3v2M12 19v2M3 12h2M19 12h2M5.6 5.6l1.4 1.4M17 17l1.4 1.4M5.6 18.4L7 17M17 7l1.4-1.4'/%3E%3C/svg%3E");
  --i-hand: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 12V6.5a1.5 1.5 0 0 1 3 0V11M11 10V5a1.5 1.5 0 0 1 3 0v6M14 10V6.5a1.5 1.5 0 0 1 3 0V14a6 6 0 0 1-6 6h-.5a5 5 0 0 1-4.1-2.2L4.5 15a1.5 1.5 0 0 1 2.4-1.8L8 14.5'/%3E%3C/svg%3E");
  --i-pulse: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12h4l2-6 4 12 2-6h6'/%3E%3C/svg%3E");
  --i-layers: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4l8 4-8 4-8-4zM4 12l8 4 8-4M4 16l8 4 8-4'/%3E%3C/svg%3E");
  --i-collapse: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 6l-6 6 6 6M19 6v12'/%3E%3C/svg%3E");
  --i-expand: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 6l6 6-6 6M5 6v12'/%3E%3C/svg%3E");
  --i-folder: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6.5h6l2 2.5h10v9.5H3z'/%3E%3C/svg%3E");
  --i-file: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 3h7l4 4v14H7z'/%3E%3Cpath d='M14 3v4h4'/%3E%3C/svg%3E");
  --i-globe: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M3.5 12h17M12 3.5c2.5 2.6 2.5 14.4 0 17M12 3.5c-2.5 2.6-2.5 14.4 0 17'/%3E%3C/svg%3E");
  --i-film: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='5' width='16' height='14' rx='2'/%3E%3Cpath d='M10 9.5v5l4-2.5z'/%3E%3C/svg%3E");
  --i-audio: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 17V6l10-2v11'/%3E%3Ccircle cx='6.5' cy='17' r='2.5'/%3E%3Ccircle cx='16.5' cy='15' r='2.5'/%3E%3C/svg%3E");
  --i-pdf: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 3h7l4 4v14H7z'/%3E%3Cpath d='M14 3v4h4M9.5 13h5M9.5 16.5h3'/%3E%3C/svg%3E");
  --i-table: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='5' width='16' height='14' rx='1.5'/%3E%3Cpath d='M4 10h16M4 14.5h16M10 5v14'/%3E%3C/svg%3E");
}
.icon--tick { --i: var(--i-tick); } .icon--more { --i: var(--i-more); } .icon--mic { --i: var(--i-mic); } .icon--camera { --i: var(--i-camera); } .icon--send { --i: var(--i-send); } .icon--search { --i: var(--i-search); } .icon--chevron { --i: var(--i-chevron); } .icon--back { --i: var(--i-back); } .icon--close { --i: var(--i-close); } .icon--today { --i: var(--i-today); } .icon--inbox { --i: var(--i-inbox); } .icon--threads { --i: var(--i-threads); } .icon--dump { --i: var(--i-dump); } .icon--areas { --i: var(--i-areas); } .icon--settings { --i: var(--i-settings); } .icon--link { --i: var(--i-link); } .icon--play { --i: var(--i-play); } .icon--next { --i: var(--i-next); } .icon--photo { --i: var(--i-photo); } .icon--paste { --i: var(--i-paste); } .icon--doc { --i: var(--i-doc); } .icon--clock { --i: var(--i-clock); } .icon--route { --i: var(--i-route); } .icon--pick { --i: var(--i-pick); } .icon--move { --i: var(--i-move); } .icon--moon { --i: var(--i-moon); } .icon--info { --i: var(--i-info); } .icon--device { --i: var(--i-device); } .icon--laptop { --i: var(--i-laptop); } .icon--sort { --i: var(--i-sort); } .icon--stop { --i: var(--i-stop); } .icon--plus { --i: var(--i-plus); } .icon--reply { --i: var(--i-reply); } .icon--tab { --i: var(--i-tab); } .icon--cancel { --i: var(--i-cancel); } .icon--bell { --i: var(--i-bell); } .icon--sun { --i: var(--i-sun); } .icon--hand { --i: var(--i-hand); } .icon--pulse { --i: var(--i-pulse); } .icon--layers { --i: var(--i-layers); } .icon--collapse { --i: var(--i-collapse); } .icon--expand { --i: var(--i-expand); }
/* files (F-13): a kind glyph per file type */
.icon--folder { --i: var(--i-folder); } .icon--file { --i: var(--i-file); } .icon--globe { --i: var(--i-globe); } .icon--film { --i: var(--i-film); } .icon--audio { --i: var(--i-audio); } .icon--pdf { --i: var(--i-pdf); } .icon--table { --i: var(--i-table); }


/* ===================================================================== brand */
.brand { display: inline-flex; align-items: center; gap: var(--sp-2); font: 600 var(--fs-xl)/1 var(--font-head); letter-spacing: -0.01em; color: var(--text); }
.brand .icon { width: 24px; height: 24px; color: var(--accent); }
.mark { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: var(--r-lg); background: var(--accent); color: var(--accent-ink); }
.mark .icon { width: 32px; height: 32px; }

/* ===================================================================== app and shell
   .app is the size container (D-12): narrow is the default, wide is 900 px of
   the box Luna is given, never the window. It is also the scroller. */
.app { container: app / inline-size; position: relative; height: 100dvh; overflow-y: auto; overscroll-behavior: contain; background: var(--bg); color: var(--text); }
[data-theme] { color: var(--text); }   /* a themed subtree resolves its own ink (D-2) */
.app--390 { max-width: 390px; margin-inline: auto; box-shadow: 0 0 0 1px var(--line); }
html:has(.app--390) { background: var(--surface-2); }
.shell { display: flex; flex-direction: column; min-height: 100%; }
.main { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page-holder { display: contents; }
.main:has(> .companion) .page { padding-bottom: calc(var(--sp-7) + 140px); }   /* room for the companion */
.only-wide { display: none !important; }
.skip-link { position: absolute; left: var(--sp-2); top: -100px; z-index: 60; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md); background: var(--accent); color: var(--accent-ink); }
.skip-link:focus { top: var(--sp-2); }

/* ===================================================================== rail
   Four forms of one <nav class="rail">: the phone's floating bottom bar, the
   264 px tab column, the 60 px mini column (.rail--mini), and the phone's tabs
   sheet (.sheet-up, below). */
.rail {
  order: 2; position: sticky; bottom: calc(var(--sp-2) + var(--safe-bottom)); z-index: 20;
  margin: 0 calc(var(--sp-3) + var(--safe-right)) var(--sp-2) calc(var(--sp-3) + var(--safe-left)); padding: var(--sp-1);
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--e-2);
}
.rail__top, .rail__tabs, .rail__foot, .rail__stats, .rail__btn--wide { display: none; }
.rail__dest { display: flex; gap: 2px; }
/* A destination kept to the wide rail (Files, F-13): the phone's bar stays at five. */
.rail__dest .rail__btn--wide { display: none; }
.rail__btn {
  position: relative; flex: 1; min-width: var(--tap); min-height: 52px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-radius: 18px; font-size: 0.6875rem; font-weight: 600; color: var(--text-3);
}
@media (hover: hover) { .rail__btn:hover { color: var(--text); } }
.rail__btn.is-current { background: var(--accent-soft); color: var(--accent); }
.rail__btn--fixed { flex: none; min-height: var(--tap); width: var(--tap); border-radius: var(--r-md); }
.nav__count {
  position: absolute; top: 4px; left: calc(50% + 5px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  display: inline-grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  font-size: 0.6875rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
}
.nav__count--waiting { background: var(--warn); color: var(--warn-ink); }

.rail__group > summary {
  display: flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 var(--sp-2);
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3);
}
.rail__group > summary::after { content: ""; margin-left: auto; margin-right: 6px; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); }
.rail__group[open] > summary::after { transform: translateY(1px) rotate(-135deg); }
.rail__group--waiting > summary { color: var(--warn); }
.rail__group--running > summary { color: var(--accent); }
.rail__group--done > summary { color: var(--ok); }
.rail__count { font-variant-numeric: tabular-nums; }
.rtab { display: flex; align-items: center; gap: var(--sp-3); min-height: 40px; padding: 0 var(--sp-1) 0 var(--sp-3); border-radius: var(--r-md); font-weight: 500; color: var(--text-2); }
.rtab.is-current { background: var(--surface-2); }
@media (hover: hover) { .rtab:hover { background: var(--surface-2); } }
.rtab.is-current { color: var(--text); }
.rtab--waiting { color: var(--text); font-weight: 600; }
.rtab--done { color: var(--text-3); }
.rtab__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 40px; color: inherit; }
.rtab__close { flex: none; width: 32px; height: 32px; display: none; place-items: center; border-radius: var(--r-sm); color: var(--text-3); position: relative; }
.rtab__close::after { content: ""; position: absolute; inset: -6px; }   /* a 44 px hit area */
.rtab.is-current .rtab__close, .sheet-up .rtab__close { display: grid; }
@media (hover: hover) { .rtab:hover .rtab__close { display: grid; } }
.rtab__close::before { content: "×"; font-size: 20px; line-height: 1; }
.rail__stat { flex: none; width: var(--tap); height: 32px; display: flex; align-items: center; justify-content: center; gap: 6px; border-radius: var(--r-md); font-size: var(--fs-xs); font-weight: 600; line-height: 1; color: var(--text-2); }
@media (hover: hover) { .rail__stat:hover { background: var(--surface-2); } }
.rail__stat--waiting { color: var(--warn); }
.rail__stat--running { color: var(--accent); }
.rail__stat--done { color: var(--ok); }
.rail__areas { position: relative; flex: 1; display: flex; }
.rail__areas > summary { flex: 1; }
.brand__name { white-space: nowrap; }
/* the one way to every tab, open and closed: the head of the tabs area (D3-2) */
.rail__all { flex: none; display: flex; align-items: center; gap: var(--sp-3); min-height: 36px; padding: 0 var(--sp-3); border-radius: var(--r-md); font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.rail__all.is-current { background: var(--surface-2); color: var(--text); }
@media (hover: hover) { .rail__all:hover { background: var(--surface-2); color: var(--text); } }
.rail__all::after { content: ""; margin-left: auto; margin-right: 6px; width: 6px; height: 6px; border: solid currentColor; border-width: 1.5px 1.5px 0 0; transform: rotate(45deg); }
.rail__all-label, .menu__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* A scrolling area that shows no scrollbar (D3-3): wheel, touch and keys move it, and the
   client's data-cut names the edge that hides more, where the content fades out. */
.scroll-quiet { --fade: 28px; overflow-y: auto; scrollbar-width: none; overscroll-behavior: contain; }
.scroll-quiet::-webkit-scrollbar { display: none; }
.scroll-quiet[data-cut="bottom"] { -webkit-mask-image: linear-gradient(to top, transparent, #000 var(--fade)); mask-image: linear-gradient(to top, transparent, #000 var(--fade)); }
.scroll-quiet[data-cut="top"] { -webkit-mask-image: linear-gradient(to bottom, transparent, #000 var(--fade)); mask-image: linear-gradient(to bottom, transparent, #000 var(--fade)); }
/* a menu floats over the page: a mask would show the page through it, so its cut edge is a fade of its own colour */
.menu.scroll-quiet[data-cut] { -webkit-mask-image: none; mask-image: none; }
.menu.scroll-quiet::before, .menu.scroll-quiet::after {
  content: ""; display: none; flex: none; position: sticky; z-index: 1; height: var(--fade); pointer-events: none;
}
.menu.scroll-quiet::before { top: calc(-1 * var(--sp-1)); margin-bottom: calc(-1 * var(--fade)); background: linear-gradient(to bottom, var(--menu-bg, var(--surface-2)), transparent); }
.menu.scroll-quiet::after { bottom: calc(-1 * var(--sp-1)); margin-top: calc(-1 * var(--fade)); background: linear-gradient(to top, var(--menu-bg, var(--surface-2)), transparent); }
.menu.scroll-quiet:is([data-cut="top"], [data-cut="both"])::before,
.menu.scroll-quiet:is([data-cut="bottom"], [data-cut="both"])::after { display: block; }
.scroll-quiet[data-cut="both"] { -webkit-mask-image: linear-gradient(to bottom, transparent, #000 var(--fade), #000 calc(100% - var(--fade)), transparent); mask-image: linear-gradient(to bottom, transparent, #000 var(--fade), #000 calc(100% - var(--fade)), transparent); }

/* the phone's Tabs button opens this sheet, and the mini column's counts; it holds the same three groups */
.scrim { position: fixed; inset: 0; z-index: 40; background: var(--scrim); }
.sheet-up {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 88%;
  display: flex; flex-direction: column; gap: var(--sp-2); overflow-y: auto;
  padding: var(--sp-2) calc(var(--sp-3) + var(--safe-right)) calc(var(--sp-4) + var(--safe-bottom)) calc(var(--sp-3) + var(--safe-left));
  border-radius: var(--r-lg) var(--r-lg) 0 0; background: var(--surface); box-shadow: var(--e-3);
}
.sheet-up::before { content: ""; align-self: center; flex: none; width: 36px; height: 4px; margin-bottom: var(--sp-1); border-radius: 2px; background: var(--line-strong); }
.sheet-up .rtab { min-height: 48px; }
.sheet-up .rtab__close { width: var(--tap); height: var(--tap); }
.sheet-up__head { display: flex; align-items: center; gap: var(--sp-2); padding: 0 var(--sp-2); }
.sheet-up__title { font: 600 var(--fs-lg)/1.2 var(--font-head); margin-right: auto; }
.sheet-up--tabs { overflow: hidden; }
.sheet-up__body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.sheet-up__body > * { flex: none; }
.sheet-up__all::after { display: none; }

/* ===================================================================== page and section */
.page { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-5); padding: calc(var(--sp-4) + var(--safe-top)) calc(var(--sp-4) + var(--safe-right)) calc(var(--sp-7) + 64px) calc(var(--sp-4) + var(--safe-left)); }
.page--solo { width: 100%; max-width: 720px; margin-inline: auto; }
.page__head { display: flex; align-items: center; gap: var(--sp-3); min-height: var(--tap); }
.page__title { font: 600 var(--fs-2xl)/var(--lh-tight) var(--font-head); letter-spacing: -0.01em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page__sub { font-size: var(--fs-sm); color: var(--text-3); white-space: nowrap; }
.page__tools { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); }
.page__back { margin-left: calc(-1 * var(--sp-2)); }

.section { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.section__head { display: flex; align-items: baseline; gap: var(--sp-2); padding: 0 var(--sp-1); }
.section__title { display: inline-flex; align-items: center; gap: 6px; font: 600 var(--fs-sm)/1.2 var(--font-head); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }
.section__count { font-size: var(--fs-xs); font-weight: 500; color: var(--text-3); font-variant-numeric: tabular-nums; }
.section__open { margin-left: auto; }
.section__end { margin-left: auto; display: flex; gap: var(--sp-2); }
/* The section's add action (K-13): `.section__add` holds K-13's form, one field per column and its
   button, wrapping on the phone. */
.section__add > form { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.section__add .input { flex: 1 1 160px; width: auto; min-width: 0; }
.section__add .input[type="number"] { flex: 0 1 112px; }
.fold > .section__add { padding: var(--sp-2) var(--sp-4) var(--sp-3); }
.section--arranging .row:not(.is-moving) { cursor: copy; }

.segnav { display: flex; gap: var(--sp-5); overflow-x: auto; border-bottom: 1px solid var(--line); }
.seg { flex: none; display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 600; color: var(--text-3); border-bottom: 2px solid transparent; }
.seg.is-current, .seg[aria-pressed="true"] { color: var(--text); border-color: var(--accent); }

/* ===================================================================== fold
   A folded section: <section class="section section--folded"><details class="fold">
   <summary class="fold__head">title, count</summary>…</details></section> */
.fold { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.fold__head { display: flex; align-items: center; gap: var(--sp-2); min-height: var(--tap); padding: 0 var(--sp-4); font-weight: 600; }
.fold__head::after { content: ""; margin-left: auto; width: 8px; height: 8px; border: solid var(--text-3); border-width: 0 1.75px 1.75px 0; transform: translateY(-2px) rotate(45deg); transition: transform var(--t-fast); }
.fold[open] > .fold__head::after { transform: translateY(2px) rotate(-135deg); }
.fold > .table, .fold > .stack, .fold > .empty, .fold > .tiles, .fold > .text, .fold > .undos { border-radius: 0 0 var(--r-lg) var(--r-lg); }
.fold > .table { border-width: 1px 0 0; }
.fold > .empty { border: 0; border-top: 1px solid var(--line); }
.fold > .stack, .fold > .text, .fold > .tiles { padding: var(--sp-3); }
.fold--inline { margin-block: var(--sp-2); }

/* ===================================================================== form (grammar2 G2-3)
   A form action: its fields open, in spec order, one submit; never in a menu. The markup is the
   contract's (COMPOSE.md "Form"); these are its looks and its place under a row. */
.form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-3); min-width: 0; }
.form__field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 160px; min-width: 0; margin: 0; padding: 0; border: 0; }
.form__field--number, .form__field--date, .form__field--time { flex: 0 1 144px; }
.form__field--yesno { flex: none; flex-direction: row; gap: var(--sp-2); }
.form__label { padding: 0; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
legend.form__label { margin-bottom: 6px; }
.form__field--required > .form__label::after { content: " *"; color: var(--text-3); }
.form__input { font-variant-numeric: tabular-nums; }
/* yes and no are two chips; the radio covers its chip, the checked one fills */
.form__option {
  position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 64px; min-height: var(--tap);
  padding: 0 var(--sp-4); border-radius: var(--r-pill); border: 1px solid var(--line-control); background: var(--surface);
  font-weight: 600; color: var(--text);
}
.form__radio { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.form__option:has(.form__radio:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.form__option:has(.form__radio:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.form__act { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.form__error { font-size: var(--fs-sm); font-weight: 600; color: var(--danger); }
.form__error:empty { display: none; }
.form__field--missing > .form__label { color: var(--danger); }
.form__field--missing .form__input, .form__field--missing .form__option { border-color: var(--danger); }
.row > .form { grid-column: 1 / -1; padding: 0 var(--sp-4) var(--sp-3) var(--tap); }
.table--nolead .row > .form { padding-left: 0; }

/* ===================================================================== grid (grammar2 G2-2)
   rows_by x cols_by in one markup (COMPOSE.md "Grid"). Narrow: one group per row header, each cell
   labelled by its column. Wide: the cells in columns under the heads (--grid-cols). */
.grid { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.grid__row { border-top: 1px solid var(--line); }
.grid__row--head { display: none; }
.grid__row--head + .grid__row { border-top: 0; }
.grid__head { margin: 0; font: 600 var(--fs-xs)/1.2 var(--font-head); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.grid__head--row { padding: var(--sp-3) var(--sp-4) var(--sp-1); }
.grid__head--col { padding: 0 var(--sp-3); }
.grid__cell { display: grid; grid-template-columns: 64px minmax(0, 1fr); column-gap: var(--sp-3); padding: 0 var(--sp-4); }
.grid__cell--empty { display: none; }
.grid__label { grid-column: 1; grid-row: 1; align-self: start; display: flex; align-items: center; min-height: var(--tap); font-size: var(--fs-sm); color: var(--text-2); }
.grid .grid__item { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--sp-2); min-height: var(--tap); padding: 0; border: 0; }
.grid .grid__item + .grid__item { border-top: 1px solid var(--line); }
.grid__text { flex: 1 1 0; min-width: 0; padding: var(--sp-3) 0; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }
.grid .grid__item > .row__acts { margin-left: auto; }
.grid .grid__item > .form { flex: 1 1 100%; padding: 0 0 var(--sp-3); }

/* ===================================================================== table and row
   One markup for `lines` and `rows`. Narrow: lead | text, cells and pills on line
   two | actions. Wide: each cell lands in its --cols column (subgrid). */
.table { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.table--flush { border-width: 1px 0 0; border-radius: 0; }
.table__head { display: none; }
.group__title {
  display: flex; align-items: center; gap: 6px; padding: var(--sp-3) var(--sp-4) var(--sp-1);
  border-top: 1px solid var(--line); font: 600 var(--fs-xs)/1.2 var(--font-head); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3);
}
.table > .group__title:first-child { border-top: 0; }
.stack > .group__title { border-top: 0; padding-inline: var(--sp-1); }
.row {
  position: relative; display: grid; grid-template-columns: var(--tap) minmax(0, 1fr) auto; align-items: center;
  min-height: 52px; border-top: 1px solid var(--line); color: inherit;
  transition: opacity var(--t-med) var(--ease), background var(--t-fast);
}
.row:first-child, .table__head + .row, .group__title + .row { border-top: 0; }
.table--nolead .row { grid-template-columns: minmax(0, 1fr) auto; padding-left: var(--sp-4); }
a.row { text-decoration: none; }
@media (hover: hover) { a.row:hover { background: var(--surface-2); } }
.row__lead { position: relative; width: var(--tap); height: var(--tap); display: grid; place-items: center; color: var(--text-3); }
.row__tick::before { content: ""; width: 20px; height: 20px; border-radius: 50%; border: 1.75px solid var(--line-control); transition: background var(--t-fast), border-color var(--t-fast); }
@media (hover: hover) { .row__tick:hover::before { border-color: var(--accent); } }
.row__tick::after { content: ""; position: absolute; width: 5px; height: 10px; margin-top: -2px; border: solid var(--accent-ink); border-width: 0 2px 2px 0; transform: rotate(45deg); opacity: 0; }
.row__main { min-width: 0; display: flex; flex-direction: column; gap: 3px; padding: var(--sp-2) 0; }
.row__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; color: inherit; }
@media (hover: hover) { a.row__text:hover { color: var(--accent); } }
/* `lines: 2`: the text may take the second line on a phone only when nothing else needs it
   (two lines at most); wide, every row is one line (D2-12) */
.row__text--2 { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.row__main:has(.row__cell:not(:empty), .row__meta:not(:empty)) > .row__text--2 { display: block; white-space: nowrap; }
.row__sub { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; overflow: hidden; white-space: nowrap; font-size: var(--fs-sm); color: var(--text-2); }
.row__sub:empty { display: none; }
.row__cell { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.row__cell:empty { display: none; }
.row__cell--mono { font-family: var(--font-mono); font-size: var(--fs-xs); }
.row__cell--number, .row__cell--money, .row__cell--percent { font-variant-numeric: tabular-nums; }
.row__meta { display: flex; align-items: center; gap: 6px; }
.row__meta:empty { display: none; }
.row__acts { display: flex; align-items: center; justify-content: flex-end; }
.row__acts .switch { margin-right: var(--sp-2); }
.row.is-picked { background: var(--accent-soft); }
.row.is-moving { background: var(--warn-soft); }
.row.is-focus { box-shadow: inset 3px 0 0 var(--accent); }
.row.is-busy { opacity: 0.6; }
.row.is-dragging { transform: translateY(var(--drag-y, 0)); z-index: 5; background: var(--surface-2); box-shadow: var(--e-2); }
/* optimistic tick: fills at once, the row then leaves the list */
.row.is-ticking { opacity: 0.5; }
.row.is-ticking .row__tick::before { background: var(--accent); border-color: var(--accent); }
.row.is-ticking .row__tick::after { opacity: 1; }
.row.is-leaving { animation: luna-row-out var(--t-med) var(--ease) forwards; }
/* a held undo (data-undo-hold): the acted-on row stays in its section with Undo, never struck through */
.undos { display: block; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r-lg); }
.row--undo .row__text { color: var(--text-3); }
/* a device that has gone quiet, never beat, or has no token line: a row state, never an alarm (DV-7) */
.row--stale, .row--never, .row--refused, .row--stale .row__sub, .row--never .row__sub, .row--refused .row__sub { color: var(--text-3); }
.row--refused .row__cell { font-style: italic; }
.engine__devices { display: flex; flex-direction: column; gap: var(--sp-1); margin-top: var(--sp-2); }
.engine__devices > .group__title { border-top: 0; padding-inline: var(--sp-1); }
.photos { display: flex; gap: 4px; }
.photos__img { display: block; width: 32px; height: 32px; border-radius: var(--r-sm); object-fit: cover; background: var(--surface-2); cursor: zoom-in; }
.photos__item--missing .photos__img { outline: 1px dashed var(--danger); }

/* row actions: tick lives in the lead slot; the rest sit here */
.act {
  position: relative; min-width: var(--tap); height: var(--tap);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--r-md); color: var(--text-3); text-decoration: none; white-space: nowrap;
}
@media (hover: hover) { .act:hover { color: var(--text); background: var(--surface-2); } }
.act--label { padding: 0 var(--sp-3); font-size: var(--fs-sm); font-weight: 600; color: var(--accent); }
@media (hover: hover) { .act--label:hover { color: var(--accent); } }
.act--open::before, .act--back::before { content: ""; width: 8px; height: 8px; border: solid currentColor; border-width: 1.75px 1.75px 0 0; transform: translateX(-2px) rotate(45deg); }
.act--back::before { transform: translateX(2px) rotate(-135deg); }
.act--more::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: currentColor; box-shadow: -7px 0 0 currentColor, 7px 0 0 currentColor; }
.act--pick[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
.act--grip { cursor: grab; touch-action: none; }
.act--grip:active { cursor: grabbing; }
.action__file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* ===================================================================== menu
   <details class="row__more" data-pop><summary class="act act--more">…</summary>
   <div class="menu" role="menu">…</div></details>. A popover when wide, a bottom
   sheet on the phone. Snooze, reroute, defer, photo, file, other opens and the
   row's detail live here (D-21). */
details[data-pop] { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 30;
  width: max-content; min-width: 200px; max-width: min(320px, 90vw);
  display: flex; flex-direction: column; padding: var(--sp-1);
  border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line-strong); box-shadow: var(--e-2);
  font-size: var(--fs-md); font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text);
}
.menu--start { right: auto; left: 0; }
.menu__item {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%; min-height: var(--tap); padding: 0 var(--sp-3);
  border-radius: var(--r-sm); font-weight: 500; text-align: left; color: var(--text);
}
details[open] > .menu__item { background: var(--surface); }
@media (hover: hover) { .menu__item:hover { background: var(--surface); } }
.menu__item .icon { color: var(--text-3); }
.menu__item.is-current { color: var(--accent); }
.menu__item--danger { color: var(--danger); }
.menu__item[aria-pressed="true"] { color: var(--accent); }
.menu__choices { display: flex; flex-wrap: wrap; gap: var(--sp-1); padding: var(--sp-1) var(--sp-3) var(--sp-2); }
.menu__form { display: flex; gap: var(--sp-2); padding: var(--sp-1) var(--sp-3) var(--sp-2); }
.menu__form .input { min-width: 0; flex: 1; }
.menu__detail { padding: var(--sp-2) var(--sp-3) var(--sp-3); border-bottom: 1px solid var(--line); margin-bottom: var(--sp-1); font-size: var(--fs-sm); color: var(--text-2); }
.menu--dense .menu__item { min-height: 34px; font-size: var(--fs-sm); }
details.menu__group > summary::after { content: ""; margin-left: auto; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); }
details.menu__group[open] > summary::after { transform: translateY(1px) rotate(-135deg); }

/* ===================================================================== pill, glyph, area mark */
.pill {
  display: inline-flex; align-items: center; gap: 4px; flex: none; height: 22px; padding: 0 8px;
  border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600; line-height: 1; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2); font-variant-numeric: tabular-nums;
}
.pill--area { background: none; box-shadow: inset 0 0 0 1px var(--line-strong); font-weight: 500; }
.pill--soon { background: var(--warn-soft); color: var(--warn); }
.pill--over { background: var(--warn); color: var(--warn-ink); }
.pill--on { background: var(--accent-soft); color: var(--accent); }
.pill--live { background: var(--accent); color: var(--accent-ink); }
.pill--live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: luna-pulse var(--pulse) ease-in-out infinite; }
/* Engine Room metrics only (machine states): a dot and a word, never colour alone */
.pill--state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill--state[data-state="ok"] { background: var(--ok-soft); color: var(--ok); }
.pill--state[data-state="warn"] { background: var(--warn-soft); color: var(--warn); }
.pill--state[data-state="bad"] { background: var(--danger-soft); color: var(--danger); }
.pill--state[data-state="info"] { background: var(--accent-soft); color: var(--accent); }

/* state: three colours and three shapes, never hue alone.
   waiting on the owner: an amber diamond · running: a pulsing blue dot · done: a green ring */
.glyph { flex: none; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.glyph--waiting { border-radius: 1px; transform: rotate(45deg); background: var(--warn); }
.glyph--working { background: var(--accent); animation: luna-pulse var(--pulse) ease-in-out infinite; }
.glyph--done { background: none; border: 1.5px solid var(--ok); width: 10px; height: 10px; }

/* an area tag: the area's emoji, or (no emoji in owner.md) its hue dot; the name is the label */
.emo { flex: none; display: inline-grid; place-items: center; width: 20px; font-size: 15px; line-height: 1; font-family: var(--font-emoji); }
.emo__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--hue, var(--text-3)); }
[data-hue="0"] { --hue: var(--hue-0); } [data-hue="1"] { --hue: var(--hue-1); } [data-hue="2"] { --hue: var(--hue-2); } [data-hue="3"] { --hue: var(--hue-3); }
[data-hue="4"] { --hue: var(--hue-4); } [data-hue="5"] { --hue: var(--hue-5); } [data-hue="6"] { --hue: var(--hue-6); } [data-hue="7"] { --hue: var(--hue-7); }

/* ===================================================================== buttons, chips, fields, switch */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--tap); padding: 0 var(--sp-4); border-radius: var(--r-md);
  font-size: var(--fs-md); font-weight: 600; white-space: nowrap; text-decoration: none;
  transition: transform var(--t-fast), background var(--t-fast);
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--quiet { background: var(--surface-2); color: var(--text); }
.btn--danger { background: var(--danger-soft); color: var(--danger); }
.btn--block { width: 100%; }
.btn--icon { width: var(--tap); padding: 0; }
.btn--end { margin-left: auto; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 var(--sp-4);
  border-radius: var(--r-pill); border: 1px solid var(--line-control); background: var(--surface);
  font-size: var(--fs-md); font-weight: 600; color: var(--text);
}
.chip.is-picked, .chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
@media (hover: hover) { .chip:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); } }
.chip--type { border-style: dashed; font-weight: 500; color: var(--text-2); }
.menu .chip { min-height: 36px; padding: 0 var(--sp-3); font-size: var(--fs-sm); position: relative; }
.menu .chip::after { content: ""; position: absolute; inset: -4px 0; }   /* a 44 px hit area */

.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.input {
  width: 100%; min-height: var(--tap); padding: 0 var(--sp-3); border-radius: var(--r-md);
  border: 1px solid var(--line-control); background: var(--surface); color: var(--text);
}
.input::placeholder { color: var(--text-3); opacity: 1; }
.input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.input--area { display: block; min-height: 88px; padding: var(--sp-3); resize: vertical; line-height: var(--lh-text); }
select.input { padding-right: var(--sp-6); }
.searchfield { position: relative; display: flex; align-items: center; gap: var(--sp-2); }
.searchfield > .icon { position: absolute; left: 14px; color: var(--text-3); pointer-events: none; }
.searchfield .input { min-height: 52px; padding-left: 44px; font-size: var(--fs-lg); }
.searchfield select.input { flex: none; width: auto; min-height: 52px; padding-left: var(--sp-3); font-size: var(--fs-md); }
.check { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: var(--tap); font-size: var(--fs-sm); color: var(--text-2); }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.switch { position: relative; flex: none; width: var(--tap); height: var(--tap); display: grid; place-items: center; }
.switch::before { content: ""; width: 40px; height: 24px; border-radius: 12px; background: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--line-control); transition: background var(--t-fast); }
.switch::after { content: ""; position: absolute; left: calc(50% - 18px); width: 18px; height: 18px; border-radius: 50%; background: var(--line-control); transition: transform var(--t-fast) var(--ease); }
.switch[aria-checked="true"]::before { background: var(--accent); box-shadow: none; }
.switch[aria-checked="true"]::after { transform: translateX(16px); background: var(--accent-ink); }

/* ===================================================================== card
   One shape for every kind: head, title, what, detail (folded), next, options
   as chips, evidence; a typed answer opens inline under the options. */
.stack { display: flex; flex-direction: column; gap: var(--sp-3); width: 100%; max-width: 680px; }
.card { position: relative; display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.card__head { display: flex; align-items: center; gap: 6px; min-height: 22px; font-size: var(--fs-sm); color: var(--text-3); }
.card__head > [data-pop], .card__head > .act { margin-left: auto; margin-block: -12px; }
.card__head > [data-pop] ~ .act, .card__head > .act ~ [data-pop] { margin-left: 0; }
.card__age { font-variant-numeric: tabular-nums; }
.card__title { font: 600 var(--fs-lg)/var(--lh-tight) var(--font-head); }
.card__what { color: var(--text); }
.card__detail { font-size: var(--fs-sm); color: var(--text-2); }
.card__detail > summary { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); margin: -10px 0; font-weight: 600; color: var(--text-3); }
.card__detail > summary::after { content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); }
.card__detail[open] > summary::after { transform: translateY(1px) rotate(-135deg); }
.card__detail > :not(summary) { padding-top: var(--sp-2); }
.card__next { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--text-2); }
.card__next .icon { width: 16px; height: 16px; color: var(--text-3); }
.card__options { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.card__type > summary { list-style: none; }
.card__type[open] > summary { display: none; }
.card__answer { display: flex; gap: var(--sp-2); }
.card__answer .input { flex: 1; min-width: 0; }
.card__evidence { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-4); padding-top: var(--sp-2); border-top: 1px solid var(--line); font-size: var(--fs-sm); }
.card__evidence a { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); font-weight: 500; }
.card__acts { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.card.is-busy { opacity: 0.6; }
.card.is-picked { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.card.is-focus { border-color: var(--accent); }
.card.is-leaving { animation: luna-card-out var(--t-slow) var(--ease) forwards; }

/* ===================================================================== tiles and tooltips
   A metric section is a tile; consecutive metric sections share one .tiles. The
   title's parenthesis is the tooltip on the number, never a caption (D-35). */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: var(--sp-3); }
.tile { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: var(--sp-2) var(--sp-3); padding: var(--sp-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.tile__label { grid-column: 1 / -1; font: 600 var(--fs-sm)/1.2 var(--font-text); letter-spacing: 0; text-transform: none; color: var(--text-2); }
.tile__num { justify-self: start; font: 600 var(--fs-num)/1 var(--font-head); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--text); text-align: left; }
.tile__unit { margin-left: 4px; font: 500 var(--fs-sm)/1 var(--font-text); letter-spacing: 0; color: var(--text-3); }
.spark { width: 104px; height: 36px; overflow: visible; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spark__ref { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.spark__end { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.meter { display: inline-block; vertical-align: middle; width: 72px; height: 6px; margin-right: var(--sp-2); border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 3px; background: var(--accent); }

.has-tip { position: relative; cursor: help; text-decoration: underline dotted var(--line-strong); text-underline-offset: 6px; text-decoration-thickness: 2px; }
.tip {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 10; width: max-content; max-width: 240px;
  padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md); background: var(--text); color: var(--bg);
  font: 400 var(--fs-sm)/1.35 var(--font-text); letter-spacing: 0; text-align: left; white-space: normal; box-shadow: var(--e-2);
  opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(-2px);
  transition: opacity var(--t-fast), transform var(--t-fast), visibility var(--t-fast);
}
.has-tip:focus-visible .tip, .has-tip[aria-expanded="true"] .tip, .tip.is-open { opacity: 1; visibility: visible; transform: none; }
@media (hover: hover) { .has-tip:hover .tip { opacity: 1; visibility: visible; transform: none; } }
.tile .has-tip { position: static; }
.tile .tip { left: var(--sp-3); right: var(--sp-3); top: auto; bottom: calc(100% - var(--sp-3)); width: auto; max-width: none; }

/* ===================================================================== status, toast, skeleton, empty */
.status { display: flex; align-items: center; gap: var(--sp-2); min-height: 28px; font-size: var(--fs-sm); color: var(--text-2); }
.status::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: luna-pulse var(--pulse) ease-in-out infinite; }
.status:empty, .status--idle::before { display: none; }
.status--waiting::before { border-radius: 1px; transform: rotate(45deg); background: var(--warn); animation: none; }
.status--closed::before { background: none; border: 1.5px solid var(--ok); animation: none; }

.toasts { position: fixed; left: 50%; top: calc(var(--safe-top, 0px) + var(--sp-3)); z-index: 50; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); width: max-content; max-width: calc(100% - 2 * var(--sp-4) - var(--safe-left) - var(--safe-right)); pointer-events: none; }
.toasts > * { pointer-events: auto; }
.toast { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: var(--tap); padding: 0 var(--sp-1) 0 var(--sp-4); border-radius: var(--r-md); background: var(--text); color: var(--bg); font-size: var(--fs-sm); font-weight: 500; box-shadow: var(--e-3); }
.toast:not(:has(.toast__act)) { padding-right: var(--sp-4); }
.toast--error { background: var(--danger); color: var(--danger-ink); }
.toast__act { min-height: var(--tap); padding: 0 var(--sp-3); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; color: inherit; }

.skel { display: block; height: 12px; border-radius: 6px; background: var(--surface-2); }
.skel--tick { width: 20px; height: 20px; border-radius: 50%; }
.skel--title { height: 20px; width: 40%; }
[aria-busy="true"] .row__text { width: var(--w, 60%); }

.empty { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); padding: var(--sp-6) var(--sp-4); border: 1px dashed var(--line-strong); border-radius: var(--r-lg); text-align: center; color: var(--text-3); }
.empty .icon { width: 24px; height: 24px; }
.empty__title { font-weight: 600; color: var(--text-2); }
.empty--error { border-color: var(--danger); color: var(--danger); }
.empty--error .empty__title { color: var(--danger); }
.empty--page { border: 0; padding-block: var(--sp-7); }
.empty--page .icon { width: 40px; height: 40px; }

/* ===================================================================== threads, messages, composer */
.threads { display: flex; flex-direction: column; gap: var(--sp-4); flex: 1; min-height: 0; }
.threads__find { max-width: 360px; }
.threads__more { align-self: flex-start; }
.threads__open { display: flex; flex-direction: column; gap: var(--sp-4); flex: 1; min-width: 0; }
.thread__head .card__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.is-current { background: var(--surface-2); }
.thread { display: flex; flex-direction: column; gap: var(--sp-4); flex: 1; }
.thread__head { display: flex; align-items: center; gap: var(--sp-2); min-height: var(--tap); }
.msgs { display: flex; flex-direction: column; gap: var(--sp-4); }
.msg { max-width: 60ch; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg--owner { align-self: flex-end; max-width: min(60ch, 86%); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-lg) var(--r-lg) var(--r-sm) var(--r-lg); background: var(--surface-2); }
.msg--luna { align-self: flex-start; }
.msg--system { align-self: center; font-size: var(--fs-sm); color: var(--text-3); }
/* a tab's edit of the vault: its words, the path a link, Undo beside it (V2-5) */
.msg--edit { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0 var(--sp-2); }
.msg--edit .msg__acts { margin-top: 0; }
.msg--pending { opacity: 0.6; }
.msg--failed { opacity: 1; box-shadow: inset 0 0 0 1.5px var(--danger); }
.msg__acts { display: flex; gap: var(--sp-1); margin-top: var(--sp-1); }
.thread__seam { align-self: stretch; height: 0; border-top: 1px solid var(--line); }
.toolfold { align-self: flex-start; font-size: var(--fs-sm); color: var(--text-2); }
.toolfold > summary { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: var(--tap); padding: 0 var(--sp-4); border-radius: var(--r-pill); border: 1px solid var(--line); font-weight: 500; }
.toolfold > summary::after { content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); }
.toolfold[open] > summary::after { transform: translateY(1px) rotate(-135deg); }
.toolfold__steps { display: flex; flex-direction: column; gap: 6px; padding: var(--sp-3) var(--sp-4) 0; font: var(--fs-xs)/1.4 var(--font-mono); }
/* a running turn: the glyph and its latest line, the lines in the fold, Stop; the answer so far under it */
.thread__work { display: flex; align-items: flex-start; gap: var(--sp-2); }
.thread__work .toolfold > summary { max-width: min(60ch, 70vw); }
.thread__work .toolfold > summary > span:not(.glyph) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread__stop:disabled { opacity: 0.5; cursor: default; }
.msg--partial { color: var(--text-2); }
/* history a tab was opened with (decision P-2): the secondary ink, closed by the engine's line */
.msg--carried { color: var(--text-2); }

.composer {
  position: sticky; bottom: calc(76px + var(--sp-2) + var(--safe-bottom)); z-index: 4;
  display: flex; align-items: flex-end; gap: var(--sp-1); padding: var(--sp-1);
  background: var(--surface); border: 1px solid var(--line-control); border-radius: var(--r-lg); box-shadow: var(--e-2);
}
.composer--inline { position: static; box-shadow: none; }
.composer__input { flex: 1; min-width: 0; min-height: var(--tap); max-height: 160px; padding: 10px var(--sp-2); border: 0; outline: 0; background: none; resize: none; line-height: var(--lh-text); }
.composer__input::placeholder { color: var(--text-3); opacity: 1; }
.composer__btn { flex: none; min-width: var(--tap); height: var(--tap); display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: var(--r-md); color: var(--text-2); }
@media (hover: hover) { .composer__btn:hover { background: var(--surface-2); } }
.composer__btn--send { background: var(--accent); color: var(--accent-ink); }
@media (hover: hover) { .composer__btn--send:hover { background: var(--accent); color: var(--accent-ink); } }
/* dictation: four honest states on one button; the label names the true one (D-33) */
.mic[data-state="idle"] .mic__label, .mic[data-state="arming"] .mic__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.mic[data-state="arming"] { color: var(--warn); box-shadow: inset 0 0 0 1.5px var(--warn); }
.mic[data-state="listening"] { padding: 0 var(--sp-3); background: var(--accent); color: var(--accent-ink); animation: luna-listen var(--pulse) ease-out infinite; }
.mic[data-state="sending"] { padding: 0 var(--sp-3); color: var(--text-3); background: var(--surface-2); pointer-events: none; }

/* ===================================================================== dump */
.dump { display: flex; flex-direction: column; gap: var(--sp-3); width: 100%; max-width: 720px; }
.dump__box { min-height: 240px; font-size: var(--fs-lg); }
.dump__bar { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.dropzone { display: flex; align-items: center; justify-content: center; gap: var(--sp-2); min-height: 64px; padding: 0 var(--sp-4); border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg); font-size: var(--fs-sm); color: var(--text-3); }
.receipt { display: flex; align-items: center; gap: var(--sp-2); min-height: 20px; font-size: var(--fs-sm); color: var(--text-3); }
/* The dump right rail (D3-1): drawn only when the app box is wide (below). Its lines are what
   was sent today, each with where it went and Wrong owner. */
.rail-dump { display: none; }
.rail-dump__head { display: flex; align-items: center; gap: var(--sp-1); min-height: var(--tap); }
.rail-dump__head .section__title { margin-right: auto; }
.rail-dump__open { flex: none; width: var(--tap); height: var(--tap); }
.rail-dump__why { writing-mode: vertical-rl; font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.04em; white-space: nowrap; color: var(--text-3); }
.dlines { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.dlines > * { flex: none; }
.dline { display: flex; flex-direction: column; gap: 2px; padding: var(--sp-2) 0; border-top: 1px solid var(--line); }
.dline:first-child { border-top: 0; }
.dline__text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; font-size: var(--fs-sm); }
.dline[data-state="dropped"] .dline__text { color: var(--text-3); }
.dline__where { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: 6px; min-height: 32px; font-size: var(--fs-sm); color: var(--text-2); }
.dline__area { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.dline__wrong { height: 32px; min-width: 0; padding: 0 var(--sp-2); font-size: var(--fs-xs); }
.dline__wrong::after { content: ""; position: absolute; inset: -6px 0; }   /* a 44 px hit area */
.dline__move { grid-column: 1 / -1; display: flex; gap: var(--sp-2); padding: var(--sp-1) 0 var(--sp-2); }
.dline__move .input { flex: 1; min-width: 0; }
.dline__state, .dlines__none { min-height: 32px; display: flex; align-items: center; font-size: var(--fs-sm); color: var(--text-3); }

/* ===================================================================== band, report, login, prose, lists */
.band { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-4); border-radius: var(--r-lg); background: var(--accent); color: var(--accent-ink); }
.band .section__title, .band__title, .band .section__count { color: inherit; }
.band .table, .band .text, .band .grid { background: none; border: 0; color: inherit; }
.band .row, .band .grid__row, .band .grid__cell { border-color: color-mix(in srgb, var(--accent-ink) 22%, transparent); }
.band .row__sub, .band .row__cell, .band .grid__head, .band .grid__label { color: inherit; }
.band .row__lead { color: inherit; }
.band .row__tick::before { border-color: currentColor; }
.band .row__text, .band__item { font-size: var(--fs-lg); font-weight: 600; line-height: 1.3; white-space: normal; }
.band a, .band .act { color: inherit; }
/* a form or an add in the band: the labels take the band's ink, the submit turns inside out */
.band .form__label, .band .form__error, .band .form__field--required > .form__label::after { color: inherit; }
.band .btn--primary { background: var(--accent-ink); color: var(--accent); }
.band .form__option { border-color: currentColor; background: none; color: inherit; }
.band .form__option:has(.form__radio:checked) { border-color: var(--accent-ink); background: var(--accent-ink); color: var(--accent); }
.band .form__field--missing .form__input, .band .form__field--missing .form__option { border-color: var(--accent-ink); box-shadow: 0 0 0 2px var(--accent-ink); }
.band .input:focus, .band .form__option:has(.form__radio:focus-visible) { outline-color: var(--accent-ink); }
.report { display: flex; flex-direction: column; gap: var(--sp-3); }
.report__opts { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

.login { min-height: 100%; display: grid; place-items: center; padding: var(--sp-5); }
.login__panel { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: var(--sp-5); }
.login__form { display: flex; flex-direction: column; gap: var(--sp-3); }
.login__error { min-height: 20px; font-size: var(--fs-sm); color: var(--danger); }
.login__device { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); font-weight: 500; }

.split { display: flex; flex-direction: column; gap: var(--sp-5); }
.split__pane { display: flex; flex-direction: column; gap: var(--sp-5); min-width: 0; }
.prose { max-width: 64ch; display: flex; flex-direction: column; gap: var(--sp-3); line-height: 1.6; overflow-wrap: anywhere; }
.prose h1 { font: 600 var(--fs-xl)/1.2 var(--font-head); }
.prose h2, .prose h3 { margin-top: var(--sp-3); font: 600 var(--fs-lg)/1.3 var(--font-head); }
.prose ul, .prose ol { padding-left: 1.25em; display: flex; flex-direction: column; gap: 4px; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose code, .code { font-family: var(--font-mono); font-size: var(--fs-sm); }
.prose code { padding: 1px 5px; border-radius: 4px; background: var(--surface-2); }
.prose pre { padding: var(--sp-3); border-radius: var(--r-md); background: var(--surface-2); overflow: auto; }
.prose table { border-collapse: collapse; font-size: var(--fs-sm); }
.prose th, .prose td { padding: 4px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.prose--pane { padding: var(--sp-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); max-width: none; }
.code { padding: var(--sp-4); border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); line-height: 1.55; white-space: pre; overflow: auto; color: var(--text-2); }
.text { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.text + .text { margin-top: var(--sp-2); }
.text__title { font: 600 var(--fs-lg)/1.3 var(--font-head); }
.notice { padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); background: var(--surface-2); color: var(--text-2); font-size: var(--fs-sm); }
.notice--warn { background: var(--warn-soft); color: var(--warn); }
.notice--error { background: var(--danger-soft); color: var(--danger); }

/* ===================================================================== files: the vault in the app (decisions F-13 to F-16)
   The browser is ordinary rows (a kind glyph in the lead, name, size or count, modified); the
   viewer is the Rules page shape (a pane of prose) with Back, Edit and Close in its head; the
   editor is a textarea and a toolbar of 44 px targets that sits above the phone's keyboard. */
.crumbs__list { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--sp-1); min-width: 0; font-size: var(--fs-sm); color: var(--text-3); }
.crumbs__item { display: inline-flex; align-items: center; min-width: 0; }
.crumbs__item + .crumbs__item::before { content: "/"; margin-right: var(--sp-1); color: var(--text-3); }
.crumbs__link { display: inline-flex; align-items: center; min-height: var(--tap); color: var(--text-2); overflow-wrap: anywhere; }
@media (hover: hover) { .crumbs__link:hover { color: var(--accent); } }
.crumbs__here { color: var(--text); font-weight: 500; overflow-wrap: anywhere; }
.files__search { margin: 0; }
.files__new > form { align-items: center; }
.file__kind { color: var(--text-3); }
.file__kind--folder { color: var(--accent); }
.file-row--credential .row__text, .file-row--credential .row__cell--size { color: var(--text-3); font-style: italic; }
.file__head .page__title { flex: 1; }
.file__stamp { align-self: flex-start; }
.link, .prose a, .msg__text a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; overflow-wrap: anywhere; }
.link--broken { color: var(--text-3); font-style: italic; text-decoration: none; }
.note { max-width: 72ch; }
.note .task { list-style: none; margin-left: -1.25em; }
.note .task > input { width: 1em; height: 1em; margin-right: 6px; vertical-align: -2px; accent-color: var(--accent); }
.note ul ul, .note ol ol, .note ul ol, .note ol ul { margin-top: 4px; }
.note blockquote { padding-left: var(--sp-3); border-left: 3px solid var(--line-strong); color: var(--text-2); }
.note__callout { padding: var(--sp-3); border-left-color: var(--accent); border-radius: 0 var(--r-md) var(--r-md) 0; background: var(--accent-soft); }
.note__front > summary { min-height: var(--tap); display: inline-flex; align-items: center; font-size: var(--fs-sm); font-weight: 600; color: var(--text-3); }
.note__table { max-width: 100%; overflow-x: auto; }
.note__img, .file__img { display: block; max-width: 100%; height: auto; border-radius: var(--r-md); }
.note mark { background: var(--warn-soft); color: inherit; padding: 0 2px; border-radius: 2px; }
.note h2, .note h3, .note h4, .note h5, .note h6 { scroll-margin-top: var(--sp-6); }
.is-lit { background: var(--warn-soft); border-radius: 4px; box-shadow: 0 0 0 4px var(--warn-soft); transition: background var(--t-slow) var(--ease), box-shadow var(--t-slow) var(--ease); }
.file__textwrap { min-width: 0; }
.file__text { padding: var(--sp-4); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); font: var(--fs-sm)/1.6 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); }
.file__line { display: block; min-height: 1.6em; }
.file__framewrap { min-width: 0; border-radius: var(--r-lg); border: 1px solid var(--line); overflow: hidden; background: var(--surface); }
.file__frame { display: block; width: 100%; height: 70vh; min-height: 420px; border: 0; background: #fff; }
.file__figure { margin: 0; display: flex; justify-content: center; }
.file__player { display: flex; flex-direction: column; gap: var(--sp-2); }
.file__media { width: 100%; max-height: 70vh; border-radius: var(--r-lg); background: var(--surface-2); }
.file__media--audio { height: var(--tap); background: none; }
.file__say { font-size: var(--fs-sm); color: var(--text-2); }
.file__say:empty { display: none; }
.file__sheets { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.file__sheet { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.file__table { border-collapse: collapse; font-size: var(--fs-sm); }
.file__table th, .file__table td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.file__table th { position: sticky; top: 0; background: var(--surface-2); font-weight: 600; }
.file__card { align-items: flex-start; }
.file__facts { font-size: var(--fs-sm); color: var(--text-2); }
.file__tried { padding-left: 1.25em; list-style: disc; font-size: var(--fs-sm); color: var(--text-2); }

.page--editor { gap: var(--sp-3); padding-bottom: var(--sp-3); }
/* The editor is a full-screen sheet on the phone: the bottom bar steps aside for its toolbar. */
@container app (max-width: 899.98px) { .shell--sheet > .rail { display: none; } }
.editor__status { font-size: var(--fs-sm); color: var(--text-3); white-space: nowrap; }
.editor__body { position: relative; display: flex; flex-direction: column; min-width: 0; }
/* 16 px and up so the phone never zooms into the field (M26.B22); wrapped, no line numbers. */
.editor__text {
  width: 100%; min-height: 160px; padding: var(--sp-3) var(--sp-4); resize: none;
  font: 400 max(1rem, var(--fs-md))/1.6 var(--font-text); white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 2;
  border-radius: var(--r-lg);
}
.editor__bar {
  position: sticky; bottom: var(--kb, 0px); z-index: 5;
  display: flex; flex-wrap: wrap; gap: 2px; padding: var(--sp-1);
  padding-bottom: calc(var(--sp-1) + var(--safe-bottom, 0px));
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--e-2);
}
.editor__tool {
  flex: 1 0 var(--tap); min-width: var(--tap); height: var(--tap); display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-md); font: 600 var(--fs-md)/1 var(--font-head); color: var(--text-2);
}
.editor__tool:focus-visible { background: var(--surface-2); color: var(--text); }
@media (hover: hover) { .editor__tool:hover { background: var(--surface-2); color: var(--text); } }
.editor__tool[data-act="bold"] { font-weight: 800; }
.editor__tool[data-act="italic"] { font-style: italic; font-family: var(--font-text); }
.editor__tool--save, .editor__tool--done { flex: 1 0 64px; padding: 0 var(--sp-3); }
.editor__tool--save { background: var(--accent); color: var(--accent-ink); }
.editor__tool--save:focus-visible { background: var(--accent); color: var(--accent-ink); filter: brightness(1.08); }
@media (hover: hover) { .editor__tool--save:hover { background: var(--accent); color: var(--accent-ink); filter: brightness(1.08); } }
.editor__suggest { position: absolute; left: var(--sp-2); right: var(--sp-2); bottom: var(--sp-2); max-height: 40vh; overflow-y: auto; }
.editor__suggest[hidden] { display: none; }
.menu__hint { margin-left: auto; padding-left: var(--sp-3); font-size: var(--fs-xs); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor__draft { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); }
.editor__draftacts { display: flex; gap: var(--sp-2); margin-left: auto; }
.editor__ask { gap: var(--sp-4); padding-bottom: calc(var(--sp-5) + var(--safe-bottom, 0px)); }
.editor__question { font-weight: 600; }
.editor__answers { display: flex; flex-direction: column; gap: var(--sp-2); }
.conflict { display: flex; flex-direction: column; gap: var(--sp-3); }
.conflict__panes { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); }
.conflict__pane { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.conflict__title { font: 600 var(--fs-sm)/1.2 var(--font-head); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }
.conflict__text { max-height: 50vh; white-space: pre-wrap; overflow-wrap: anywhere; }
.conflict__acts { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
@container app (min-width: 900px) {
  .conflict__panes { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .editor__answers { flex-direction: row; justify-content: flex-end; }
  .page--editor, .page--file { max-width: 960px; }
  /* The editor's one question (Done with unsaved changes, a much smaller save) is a sheet on the
     phone and a small dialog when wide, where the tabs sheet is not drawn. */
  .scrim.editor__scrim { display: block; }
  .sheet-up.editor__ask {
    display: flex; left: 50%; right: auto; top: 28%; bottom: auto; width: min(480px, 90%);
    transform: translateX(-50%); border-radius: var(--r-lg); padding: var(--sp-5);
  }
  .sheet-up.editor__ask::before { display: none; }
}

/* ===================================================================== companion
   Today's bottom corner; .is-cheering for a second when a row is ticked. A
   package's pictures (clients/companion/) replace the drawn placeholder. */
.companion { position: absolute; right: var(--sp-4); bottom: calc(var(--sp-4) + 64px); width: 56px; height: 62px; pointer-events: none; z-index: 3; }
.companion--inline { position: relative; right: auto; bottom: auto; }
.companion__body { position: absolute; left: 4px; top: 0; width: 48px; height: 48px; border-radius: 50%; background: var(--accent); box-shadow: inset -7px -6px 0 rgb(0 0 0 / 0.14); animation: luna-bob 3.2s ease-in-out infinite; }
.companion__eye { position: absolute; top: 19px; left: 13px; width: 6px; height: 10px; border-radius: 3px; background: var(--accent-ink); animation: luna-blink 4.8s infinite; }
.companion__eye + .companion__eye { left: 26px; }
.companion__shadow { position: absolute; left: 12px; bottom: 0; width: 32px; height: 6px; border-radius: 50%; background: var(--text); opacity: 0.14; animation: luna-shadow 3.2s ease-in-out infinite; }
.companion__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.companion.is-cheering .companion__body, .companion.is-cheering .companion__img { animation: luna-hop 0.5s var(--ease) 2; }
.companion.is-cheering .companion__eye { height: 5px; border-radius: 5px 5px 0 0; animation: none; }
.companion.is-sleeping .companion__eye { height: 2px; top: 23px; animation: none; }

/* ===================================================================== graph (view: graph keeps its classes) */
.graph { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--sp-2); }
.graph__svg { width: 100%; height: auto; display: block; }
.graph__edge { stroke: var(--line-control); stroke-width: 1.5; }
.graph__node { cursor: pointer; }
.graph__node:focus { outline: none; }
.graph__node:focus .graph__dot { stroke: var(--accent); stroke-width: 4; }
.graph__dot { fill: var(--node, var(--hue-0)); stroke: var(--bg); stroke-width: 2; }
.graph__label { fill: var(--text); font-size: 13px; text-anchor: middle; pointer-events: none; }
.graph__node--section-0 { --node: var(--hue-0); } .graph__node--section-1 { --node: var(--hue-1); } .graph__node--section-2 { --node: var(--hue-2); } .graph__node--section-3 { --node: var(--hue-3); }
.graph__node--section-4 { --node: var(--hue-4); } .graph__node--section-5 { --node: var(--hue-5); } .graph__node--section-6 { --node: var(--hue-6); } .graph__node--section-7 { --node: var(--hue-7); }
.graph__caption, .graph__empty { padding: var(--sp-1) var(--sp-2) 0; font-size: var(--fs-sm); color: var(--text-3); }

/* ===================================================================== motion: the companion, the pulsing glyph, the tick */
@keyframes luna-pulse { 50% { opacity: 0.35; transform: scale(0.8); } }
@keyframes luna-listen { 0% { box-shadow: 0 0 0 0 var(--accent-soft); } 100% { box-shadow: 0 0 0 10px transparent; } }
@keyframes luna-bob { 50% { transform: translateY(-5px); } }
@keyframes luna-hop { 40% { transform: translateY(-14px) scale(1.04, 0.96); } }
@keyframes luna-blink { 0%, 92%, 100% { transform: scaleY(1); } 96% { transform: scaleY(0.1); } }
@keyframes luna-shadow { 50% { transform: scaleX(0.8); opacity: 0.08; } }
@keyframes luna-row-out { to { opacity: 0; transform: translateX(12px); } }
@keyframes luna-card-out { to { opacity: 0; transform: translateX(32px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ===================================================================== narrow only: the row menu is a bottom sheet */
@container app (max-width: 899.98px) {
  details[data-pop][open] > .menu {
    position: fixed; left: 0; right: 0; top: auto; bottom: 0; z-index: 41;
    width: auto; max-width: none; max-height: 72%; overflow-y: auto;
    padding: var(--sp-3) calc(var(--sp-3) + var(--safe-right)) calc(var(--sp-4) + var(--safe-bottom)) calc(var(--sp-3) + var(--safe-left));
    border-radius: var(--r-lg) var(--r-lg) 0 0; border: 0; --menu-bg: var(--surface); background: var(--surface); box-shadow: var(--e-3);
  }
  details[data-pop][open]::before { content: ""; position: fixed; inset: 0; z-index: 40; background: var(--scrim); }
  .row__cell--wide-only { display: none; }
}

/* ===================================================================== wide (the app box 900 px and up) */
@container app (min-width: 900px) {
  .only-wide { display: revert !important; }
  .only-narrow { display: none !important; }
  /* three columns: the rail, the page, the dump rail (open, folded to its edge, or not drawn) */
  .shell { --c-rail: calc(var(--rail-w) + var(--safe-left)); --c-dump: 0px; display: grid; grid-template-columns: var(--c-rail) minmax(0, 1fr) var(--c-dump); align-items: start; }
  .shell--mini { --c-rail: calc(var(--rail-mini) + var(--safe-left)); }
  .shell--bare { --c-rail: 0px; }
  .shell--dump { --c-dump: calc(var(--dump-w) + var(--safe-right)); }
  .shell--dump-folded { --c-dump: calc(var(--dump-fold) + var(--safe-right)); }
  .shell > .rail { grid-area: 1 / 1; }
  .shell > .main { grid-area: 1 / 2; }
  .shell > .rail-dump { grid-area: 1 / 3; }
  .page { padding: calc(var(--sp-5) + var(--safe-top)) calc(var(--sp-6) + var(--safe-right)) var(--sp-7) var(--sp-6); }
  .main:has(> .companion) .page { padding-bottom: calc(var(--sp-7) + 80px); }
  .main { min-height: 100dvh; }

  .rail {
    order: 0; position: sticky; top: 0; bottom: auto; height: 100dvh; width: auto; margin: 0;
    display: flex; flex-direction: column; gap: var(--sp-3); padding: calc(var(--sp-3) + var(--safe-top)) var(--sp-2) calc(var(--sp-3) + var(--safe-bottom)) calc(var(--sp-2) + var(--safe-left));
    border: 0; border-right: 1px solid var(--line); border-radius: 0; box-shadow: none;
  }
  .rail__top { display: flex; align-items: center; padding-left: var(--sp-2); }
  .rail__top .brand { margin-right: auto; font-size: var(--fs-lg); }
  .rail__dest { padding-bottom: var(--sp-3); border-bottom: 1px solid var(--line); }
  .rail__foot { display: flex; gap: 2px; padding-top: var(--sp-2); border-top: 1px solid var(--line); }
  .rail__btn { min-height: var(--tap); border-radius: var(--r-md); }
  .rail__btn.is-current { background: var(--surface-2); color: var(--text); }
  .rail__btn--narrow { display: none; }
  .rail__btn--wide, .rail__dest .rail__btn--wide { display: flex; }
  .rail__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  /* The rail never scrolls as a whole (D3-3): its top, the destinations and the foot stay put,
     and the tabs area takes what is left and scrolls inside, with no scrollbar. */
  .rail__tabs { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--sp-1); }
  .rail__scroll { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
  .rail__scroll > * { flex: none; }
  .rail__areas > .menu { left: 0; right: auto; top: calc(100% + 4px); }
  /* mini column: destinations stack, tabs fold to All tabs and three counts */
  .rail--mini { align-items: center; gap: var(--sp-2); padding-inline: calc(var(--sp-1) + var(--safe-left)) var(--sp-1); }
  .rail--mini .rail__tabs { align-items: center; }
  .rail--mini .rail__scroll, .rail--mini .rail__all::after { display: none; }
  .rail--mini .rail__all { width: var(--tap); min-height: var(--tap); padding: 0; justify-content: center; }
  .rail--mini .rail__all-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .rail--mini .rail__top { padding: 0; flex-direction: column; gap: 2px; }
  .rail--mini .rail__top .brand { margin: 0 0 var(--sp-2); }
  .rail--mini .brand__name { display: none; }
  .rail--mini .rail__areas { flex: none; }
  .rail--mini .rail__dest, .rail--mini .rail__foot { flex-direction: column; }
  .rail--mini .rail__btn { flex: none; width: var(--tap); }
  .rail--mini .rail__stats { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: 1; min-height: 0; }
  .sheet-up, .scrim { display: none; }
  /* the mini column's counts open the tabs sheet as a panel beside the column */
  .scrim.scrim--tabs { display: block; background: none; }
  .sheet-up.sheet-up--tabs {
    display: flex; left: calc(var(--rail-mini) + var(--safe-left) + var(--sp-2)); right: auto; bottom: calc(var(--sp-3) + var(--safe-bottom)); width: 340px; max-height: 80%;
    padding: var(--sp-3); border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  }
  .sheet-up.sheet-up--tabs::before { display: none; }

  .table { display: grid; grid-template-columns: var(--tap) var(--cols, minmax(0, 1fr)) max-content max-content; }
  .table--nolead { grid-template-columns: var(--cols, minmax(0, 1fr)) max-content max-content; }
  .table__head, .row, .table--nolead .row { display: grid; grid-template-columns: subgrid; grid-column: 1 / -1; }
  .group__title { grid-column: 1 / -1; }
  .table__head { align-items: center; min-height: 36px; border-bottom: 1px solid var(--line); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-3); }
  .table__head > span { padding-right: var(--sp-4); }
  .table--nolead .table__head { padding-left: var(--sp-4); }
  .row { min-height: 48px; }
  .row__main, .row__sub { display: contents; }
  .row__text, .row__cell { padding-right: var(--sp-4); }
  .row__text--2 { display: block; white-space: nowrap; }
  .row__cell:empty { display: block; }
  .row__meta { grid-column: -3; grid-row: 1; justify-content: flex-end; padding-right: var(--sp-2); }
  .row__meta:empty { display: block; }
  .row__acts { grid-column: -2; grid-row: 1; }
  .table--dense .row { min-height: 36px; }
  .undos .row { grid-template-columns: var(--tap) minmax(0, 1fr) auto; }
  .undos .row__main { display: flex; }
  .row > .form { grid-row: 2; }
  .row--refused .row__cell { white-space: normal; }

  .grid { display: grid; grid-template-columns: minmax(96px, max-content) repeat(var(--grid-cols, 1), minmax(0, 1fr)); }
  .grid__row, .grid__row--head { display: grid; grid-template-columns: subgrid; grid-column: 1 / -1; }
  .grid__row--head { align-items: center; min-height: 36px; border-top: 0; border-bottom: 1px solid var(--line); }
  .grid__head--row { padding: var(--sp-3) var(--sp-4); }
  .grid__cell, .grid__cell--empty { display: flex; flex-direction: column; min-width: 0; padding: 0 var(--sp-3); border-left: 1px solid var(--line); }
  .grid__label { display: none; }
  .grid .grid__item { grid-column: auto; }

  /* An open thread is the whole column (D3-2): the page is the box's height, the thread scrolls
     inside it and the composer is pinned under it, never below the fold (D3-6). */
  .page--thread { flex: none; height: 100dvh; padding-bottom: var(--sp-4); }
  .page--thread .threads, .page--thread .threads__open { min-height: 0; }
  .page--thread .thread { position: relative; min-height: 0; overflow-y: auto; scrollbar-width: thin; margin: -2px calc(-1 * var(--sp-3)) -2px -2px; padding: 2px var(--sp-3) 2px 2px; }
  .page--thread .thread > * { flex: none; }
  .page--thread .composer { position: static; flex: none; }
  .composer { bottom: var(--sp-4); }

  /* The dump right rail (D3-1): open beside the page, or folded to a 44 px edge; when the
     box cannot hold it the client folds it (squeezed) and the owner may open it over the page. */
  .rail-dump { display: block; position: sticky; top: 0; z-index: 19; height: 100dvh; box-shadow: inset 1px 0 0 var(--line); background: var(--surface); }   /* the hairline is a shadow: the folded edge keeps its 44 px */
  .rail-dump__body { display: flex; flex-direction: column; gap: var(--sp-3); height: 100%; padding: calc(var(--sp-3) + var(--safe-top)) calc(var(--sp-4) + var(--safe-right)) calc(var(--sp-4) + var(--safe-bottom)) var(--sp-4); }
  .rail-dump__edge { display: none; flex-direction: column; align-items: center; gap: var(--sp-3); height: 100%; padding: calc(var(--sp-3) + var(--safe-top)) var(--safe-right) var(--sp-3) 0; }
  .rail-dump:is([data-form="folded"], [data-form="squeezed"]) .rail-dump__body { display: none; }
  .rail-dump:is([data-form="folded"], [data-form="squeezed"], [data-form="over"]) .rail-dump__edge { display: flex; }
  .rail-dump[data-form="over"] .rail-dump__body { position: absolute; top: 0; right: 0; bottom: 0; width: var(--dump-w); border-left: 1px solid var(--line); background: var(--surface); box-shadow: var(--e-3); }
  .rail-dump .input { background: var(--bg); }
  .rail-dump .receipt:empty { display: none; }
  .rail-dump .dump__box { flex: none; height: 160px; min-height: 88px; max-height: 50%; font-size: var(--fs-md); }

  .split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .companion { right: var(--sp-5); bottom: var(--sp-5); }
}

/* ===================================================================== floor: gloves, glare, a glance (D-37) */
[data-density="floor"] .row { min-height: 68px; }
[data-density="floor"] .row__tick::before { width: 28px; height: 28px; border-width: 2px; }
[data-density="floor"] .row__text { font-size: var(--fs-lg); }

/* offline */
/* ===================================================================== the device under the views (decisions OF-12 to OF-25) */
/* the status mark: down (danger ring), waiting (the amber diamond), working (pulsing accent), idle (quiet dot) */
.conn-strip { display: inline-flex; align-items: center; gap: var(--sp-2); flex: none; white-space: nowrap; }
.conn-mark { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--line-control); }
.conn-mark[data-state="down"] { background: none; box-shadow: inset 0 0 0 2px var(--danger); }
.conn-mark[data-state="waiting"] { border-radius: 1px; transform: rotate(45deg); width: 9px; height: 9px; background: var(--warn); }
.conn-mark[data-state="working"] { background: var(--accent); animation: luna-pulse var(--pulse) var(--ease) infinite; }
.strip__word { font-size: var(--fs-xs); font-weight: 600; color: var(--danger); }
.strip__pool { min-height: 24px; padding: 0 var(--sp-2); font: 600 var(--fs-xs)/1 var(--font-head); cursor: pointer; }
.strip__pool:not([data-state]) { background: var(--surface-2); color: var(--text-2); }
.page__head .strip--head { margin-left: auto; }
.rail--mini .strip--rail { flex-direction: column; gap: var(--sp-1); }
.rail--mini .strip--rail .strip__word { display: none; }
@container app (max-width: 899.98px) { .strip--rail { display: none; } }
@container app (min-width: 900px) { .strip--head { display: none; } }

/* one banner at the top of the content; the copy line under the page head */
.conn-banner { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: var(--sp-2); margin: 0 0 var(--sp-3); padding: var(--sp-2) var(--sp-4); border-radius: var(--r-md); background: var(--warn-soft); color: var(--text); font-size: var(--fs-sm); font-weight: 500; }
.conn-banner::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.conn-banner[data-state="down"] { background: var(--danger-soft); }
.conn-banner[data-state="down"]::before { background: none; box-shadow: inset 0 0 0 2px var(--danger); }
.conn-banner[data-state="slow"] { background: var(--accent-soft); }
.conn-banner[data-state="slow"]::before { background: var(--accent); }
.conn-banner--previous { background: var(--surface-2); color: var(--text-2); }
.conn-banner--previous::before { background: var(--text-3); }
.copy-line { margin: calc(-1 * var(--sp-1)) 0 var(--sp-3); font-size: var(--fs-sm); color: var(--text-3); }

/* a row, card or message the outbox still holds: the amber state, in words for a reader */
.waiting-mark { display: inline-block; flex: none; width: 8px; height: 8px; margin-left: var(--sp-2); border-radius: 1px; transform: rotate(45deg); background: var(--warn); vertical-align: middle; }

/* four kinds of toast, from the state tokens */
.toast--ok { background: var(--ok); color: var(--accent-ink); }
.toast--warn { background: var(--warn); color: var(--warn-ink); }
.toast--info { background: var(--text); color: var(--bg); }

/* a wait says it is a wait */
.skel__status { min-height: 20px; margin: 0 0 var(--sp-3); font-size: var(--fs-sm); color: var(--text-3); }

/* login says what happened */
.login__hint { margin: 0; font-size: var(--fs-sm); color: var(--text-2); }
.login__signed-out { margin: 0; }

/* the pool sheet: a sheet on the phone, a panel on a wide screen */
.pool-sheet .scrim { display: block; }
.pool-sheet .sheet-up { display: flex; z-index: 41; }
@container app (min-width: 900px) {
  .pool-sheet .sheet-up { position: fixed; left: 50%; top: 15vh; bottom: auto; right: auto; transform: translateX(-50%); width: min(560px, calc(100vw - 2 * var(--sp-6))); max-height: 70vh; border-radius: var(--r-lg); }
  .pool-sheet .sheet-up::before { display: none; }
}

/* Settings: This device */
.device__lines { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.device__build { font-size: var(--fs-sm); color: var(--text-3); }

/* the keyboard shortcuts */
.keys { width: min(480px, calc(100vw - 2 * var(--sp-4))); padding: var(--sp-4); border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--surface); color: var(--text); box-shadow: var(--e-3); }
.keys::backdrop { background: var(--scrim); }
.keys__head { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.keys__title { margin-right: auto; font: 600 var(--fs-lg)/1.2 var(--font-head); }
.keys__table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.keys__table td { padding: var(--sp-2) 0; border-top: 1px solid var(--line); }
.keys__keys { width: 40%; white-space: nowrap; }
.keys__to { color: var(--text-3); font-size: var(--fs-sm); }
.kbd { display: inline-block; min-width: 24px; margin-right: 2px; padding: 2px 6px; border: 1px solid var(--line-control); border-radius: var(--r-sm); background: var(--surface-2); font: 600 var(--fs-xs)/1.4 var(--font-text); text-align: center; }
.device__row .row__text { white-space: normal; overflow: visible; }
.device__version, .device__build { overflow-wrap: anywhere; }
/* entryroad */
/* The hosts table's free disk under 20 GB (ER-77), and a device's enrolment (ER-70 to ER-74): the
   one question is the editor's shape (a sheet on the phone, a small dialog when wide); the code an
   enrolment answers is drawn once under its row, read-only, with Copy and Done. */
.row__cell--low { color: var(--danger); font-variant-numeric: tabular-nums; }
.engine__ask { gap: var(--sp-4); padding-bottom: calc(var(--sp-5) + var(--safe-bottom, 0px)); }
.engine__question { font-weight: 600; }
.engine__answers { display: flex; flex-direction: column; gap: var(--sp-2); }
.engine__code { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--line); background: var(--surface-2); }
.engine__code-say { font-weight: 600; }
.engine__code-field { font-family: var(--font-mono); font-size: var(--fs-sm); }
.engine__code-acts { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
@container app (min-width: 900px) {
  .engine__answers { flex-direction: row; justify-content: flex-end; }
  .scrim.engine__scrim { display: block; }
  .sheet-up.engine__ask {
    display: flex; left: 50%; right: auto; top: 28%; bottom: auto; width: min(480px, 90%);
    transform: translateX(-50%); border-radius: var(--r-lg); padding: var(--sp-5);
  }
  .sheet-up.engine__ask::before { display: none; }
}

/* entryroad */
/* An entry's number (ER-80): "#n" wherever an entry is drawn, a link to its page. */
.entry__num { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--accent); white-space: nowrap; }
@media (hover: hover) { .entry__num:hover { text-decoration: underline; text-underline-offset: 3px; } }

/* The Engine Room's open entries (ER-91): one row each, "#n" and the words, the state, since; the
   trail, the notes, the drop line, the struck row with Undo and the dropped line each take a line
   of their own under the row, as wide as the row. */
.entry-row > .entry__notes, .entry-row > .entry__drop, .entry-row > .entry__undo, .entry-row > .entry__trail,
.entry-row--gone > .entry__dropped { grid-column: 1 / -1; }
.table--entries > .entry-row { align-items: center; }
.table .entry-row .row__main > .row__text, .table .entry-row .row__cell--state { display: block; white-space: normal; overflow-wrap: anywhere; padding-block: 6px; }
.entry__notes { display: flex; flex-direction: column; gap: 2px; padding: 0 var(--sp-4) var(--sp-2) 0; font-size: var(--fs-sm); }
.entry__note { min-width: 0; color: var(--text-2); overflow-wrap: anywhere; }
.entry__note--override { color: var(--warn); }
.entry__note--bad, .entry__dropped, .entry__trail-line--bad { color: var(--danger); }
.entry__note--said { font-weight: 600; color: var(--text); }
.entry__why { font-size: var(--fs-lg); font-weight: 700; }
.entry__why[aria-expanded="true"] { color: var(--accent); background: var(--accent-soft); }
.entry__pull, .entry__build, .entry__drop-open, .entry__drop-close, .entry__undo-act { flex: none; }
.entry__drop { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); padding: 0 var(--sp-4) var(--sp-3) 0; }
.entry__drop-why { flex: 1 1 220px; width: auto; min-width: 0; }
.entry__drop.is-busy { opacity: 0.6; }
.entry-row--struck .row__text, .entry-row--struck .row__cell { color: var(--text-3); text-decoration: line-through; }
.entry__undo { display: flex; align-items: center; gap: var(--sp-2); padding: 0 var(--sp-4) var(--sp-2) 0; font-size: var(--fs-sm); }
.entry__undo-text { font-weight: 600; color: var(--text-2); }
.entry__undo-left { font-variant-numeric: tabular-nums; color: var(--text-3); }
.entry__dropped { padding: var(--sp-3) var(--sp-4) var(--sp-3) 0; font-weight: 600; overflow-wrap: anywhere; }
.entry__trail { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0 var(--sp-4) var(--sp-3) 0; list-style: none; font-size: var(--fs-sm); color: var(--text-2); }
.entry__trail-line { overflow-wrap: anywhere; }
.entry__trail-at { font-variant-numeric: tabular-nums; color: var(--text-3); }
@container app (max-width: 899.98px) {
  .entry-row > .row__acts { grid-column: 1 / -1; flex-wrap: wrap; justify-content: flex-start; margin-left: calc(-1 * var(--sp-3)); }
}

/* An entry's page (ER-85): the text as typed, the facts as rows, the doors, the trail. */
.engine__top, .entry__top { display: contents; }
.entry__text { white-space: pre-wrap; overflow-wrap: anywhere; }
.entry__section > .entry__notes { padding: var(--sp-2) var(--sp-1) 0; }
.table--entry .row__cell--entry { white-space: normal; overflow-wrap: anywhere; }
.entry__acts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.entry__acts > .entry__drop, .entry__acts > .entry__undo, .entry__acts > .entry__trail, .entry__acts > .entry__dropped { flex-basis: 100%; padding-right: 0; }

/* The build hold (ER-92): the line above The numbers with Lift; the form under the Entries head. */
.engine__held { display: flex; align-items: center; gap: var(--sp-2); }
.engine__held-text { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.engine__hold { padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.engine__hold-words { flex: 2 1 240px; }
.engine__hold-set { flex-basis: 100%; }
.engine__hold-tabs { display: flex; flex-wrap: wrap; gap: 0 var(--sp-4); }
.engine__hold-tab { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: var(--tap); font-size: var(--fs-sm); }
.engine__hold-check { width: 18px; height: 18px; accent-color: var(--accent); }
.engine__hold-none { font-size: var(--fs-sm); color: var(--text-3); }
.engine__hold-open, .engine__lift, .engine__release-now, .engine__rollback { flex: none; }

/* Release now and Roll back (ER-90): in the Releases head; their question is the design's dialog
   with one required line; an act that needs an approval is a card in place. */
.engine__section--releases > .section__head { flex-wrap: wrap; }
.engine__section--releases .section__end { flex-wrap: wrap; min-width: 0; }
.engine__rollback { height: auto; min-height: var(--tap); white-space: normal; text-align: left; }
@container app (max-width: 899.98px) {
  .engine__section--releases .section__end { flex-basis: 100%; margin-left: calc(-1 * var(--sp-3)); }
}
.engine__rollback:disabled { color: var(--text-3); background: none; cursor: default; }
.engine__ask-line { width: 100%; }
.engine__answers > .form__error { align-self: center; margin-right: auto; }
.engine__approval { margin-bottom: var(--sp-2); border-color: var(--warn); }

/* The Building card (ER-81 to ER-84): at the foot of the wide rail; a one-line strip where the
   frame folds the dump rail to fit; not drawn on the phone or beside the mini column, where the
   Engine Room's count stands for it. The bar moves only while something runs, and moves under
   reduced motion too: it is the one sign that the road is at work. */
.building { display: none; }
.building__head { display: flex; align-items: center; gap: var(--sp-2); color: var(--text); }
.building__title { font: 600 var(--fs-md)/1.2 var(--font-head); }
.building[data-head="noread"] .building__title { color: var(--text-3); }
.building__held { margin-left: auto; font-size: var(--fs-xs); font-weight: 600; color: var(--warn); white-space: nowrap; }
.building__bar { position: relative; display: block; flex: none; height: 3px; overflow: hidden; border-radius: 2px; background: var(--accent-soft); }
.building__bar::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 40%; border-radius: 2px; background: var(--accent); animation: luna-building 1.4s linear infinite; }
@keyframes luna-building { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) {
  .building__bar::after { animation: luna-building 1.4s linear infinite !important; }
}
.building__lines { display: flex; flex-direction: column; gap: var(--sp-1); margin: 0; padding: 0; list-style: none; }
.building__line { overflow-wrap: anywhere; }
.building__none { color: var(--text-3); }
.building__release { align-self: flex-start; min-height: 36px; }
.building__strip { display: flex; flex-direction: column; gap: 4px; width: 100%; min-height: var(--tap); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md); text-align: left; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
@media (hover: hover) { .building__strip:hover { background: var(--surface-2); } }
.building__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.building__sheet .building__lines, .building__sheet .building__none, .building__sheet .building__held { padding: 0 var(--sp-2); font-size: var(--fs-sm); }
.building__menu .building__count { position: static; margin-left: auto; }
@container app (min-width: 900px) {
  .rail .building {
    flex: none; display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-3);
    border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); font-size: var(--fs-sm); color: var(--text-2); cursor: pointer;
  }
  @media (hover: hover) { .rail .building:hover { border-color: var(--line-strong); } }
  .rail .building[data-form="strip"] { padding: 0; border: 0; background: none; }
  .rail .building[data-form="none"], .rail--mini .building { display: none; }
  .building__menu { display: none; }
  /* the strip's sheet: a panel beside the rail's foot, as the tabs sheet is beside the mini column */
  .scrim.building__scrim { display: block; background: none; }
  .sheet-up.building__sheet {
    display: flex; left: calc(var(--rail-w) + var(--sp-2)); right: auto; bottom: var(--sp-3); width: 380px; max-height: 80%;
    padding: var(--sp-3); border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  }
  .sheet-up.building__sheet::before { display: none; }
}

/* capture */
/* capture: the dump box */
.dump__chips { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.dump__chips[hidden] { display: none; }
.dump__chip { max-width: 100%; gap: var(--sp-1); }
.dump__chip-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dump__chip[data-state="lost"] { color: var(--warn); }
.dump__chip--take { font-style: italic; color: var(--text-2); }
.dump__chip-x { min-width: 28px; min-height: 28px; border-radius: var(--r-pill); color: var(--text-2); }
@media (hover: hover) { .dump__chip-x:hover { background: var(--surface-2); } }
.dump__errors:empty { display: none; }
.dump__error { margin: 0; font-size: var(--fs-sm); color: var(--danger); }
.dump__attach { font-size: var(--fs-lg); }
.dump__status { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.dump__status:not(:has(> :not([hidden]))) { display: none; }
.dump__word { min-height: 32px; padding: 0 var(--sp-3); border-radius: var(--r-pill); font-weight: 600; font-size: var(--fs-sm); text-align: left; }
.dump__word[data-kind="sent"] { color: var(--ok); background: var(--ok-soft); }
.dump__word[data-kind="got"] { color: var(--warn); box-shadow: inset 0 0 0 1.5px var(--warn); }
.dump__word[data-kind="refused"] { color: var(--danger); box-shadow: inset 0 0 0 1.5px var(--danger); border-radius: var(--r-md); }
.dump__pending, .dump__detail p { margin: 0; font-size: var(--fs-sm); color: var(--text-2); }
.dump__waiting { display: flex; flex-direction: column; gap: 2px; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md); background: var(--surface-2); font-size: var(--fs-sm); }
.dump__waiting[hidden] { display: none; }
.dump__waiting-head { display: flex; align-items: center; gap: var(--sp-2); margin: 0; font-weight: 600; }
.dump__try { margin-left: auto; height: 32px; }
.dump__wait { margin: 0; color: var(--text-2); }
.dline__head { display: flex; align-items: flex-start; gap: var(--sp-1); }
.dline__head .dline__text { flex: 1; min-width: 0; }
.dline__text--cut { cursor: pointer; }
.dline__text.is-whole { -webkit-line-clamp: unset; display: block; }
.dline__whyglyph { flex: none; min-width: 32px; height: 32px; color: var(--text-3); }
.dline__go { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dline__go .dline__area { font-weight: 600; color: var(--text); }
.dline__why { color: var(--text-2); }
.dline__state[data-line="left"], .dline__state[data-line="repeat"] { color: var(--text-2); }
.dump__receipt { align-self: flex-start; }
.dump__now[hidden], .dump-today[hidden] { display: none; }
.dump__now-link { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 2px var(--sp-2); padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-md); color: inherit; text-decoration: none; }
.dump__now-when { grid-column: 1 / -1; font-size: var(--fs-xs); font-weight: 600; color: var(--accent); }
.dump__now-text { grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dump__now-area { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-2); }
.dump__ask:empty { display: none; }
.dump__day { margin-top: var(--sp-5); }
.dump__notetext { margin: 0; white-space: pre-wrap; font: inherit; color: var(--text-2); }
.dump-today { padding: var(--sp-4) var(--sp-4) 0; }
.dump-today__body { display: flex; flex-direction: column; gap: var(--sp-3); }
.dump-today .dump__box { min-height: 96px; height: 96px; font-size: var(--fs-md); }
.dump-today .receipt:empty { display: none; }
.dump-today .dlines { max-height: 40vh; }
@container app (min-width: 900px) {
  .dump-today { display: none; }
  /* the rail's body holds the box, the trail and what sits under it: it scrolls quietly when it outgrows the box */
  .rail-dump__body { overflow-y: auto; scrollbar-width: none; }
  .rail-dump__body::-webkit-scrollbar { display: none; }
  .rail-dump .dlines { flex: none; max-height: 45%; }
}

/* capture: voice */
.mic[data-state="paused"] { padding: 0 var(--sp-3); color: var(--warn); box-shadow: inset 0 0 0 1.5px var(--warn); }
.take--pending { align-self: center; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-style: italic; color: var(--text-3); }
.speaking {
  position: fixed; left: 50%; bottom: calc(80px + var(--safe-bottom)); z-index: 45; transform: translateX(-50%);
  display: flex; align-items: center; gap: var(--sp-2); max-width: calc(100% - 2 * var(--sp-4));
  padding: var(--sp-1) var(--sp-1) var(--sp-1) var(--sp-3); border: 1px solid var(--line-strong); border-radius: var(--r-pill);
  background: var(--surface); box-shadow: var(--e-2); font-size: var(--fs-sm);
}
.speaking__count { font-variant-numeric: tabular-nums; color: var(--text-2); }
.speaking__act { min-height: var(--tap); padding: 0 var(--sp-3); border-radius: var(--r-pill); font-weight: 600; color: var(--accent); }
@media (hover: hover) { .speaking__act:hover, .speaking__close:hover { background: var(--surface-2); } }
.speaking__close { min-width: var(--tap); min-height: var(--tap); border-radius: var(--r-pill); color: var(--text-2); }
.tap-to-hear { margin-left: var(--sp-2); }
[data-read-aloud][aria-pressed="true"] { color: var(--accent); }
@container app (min-width: 900px) {
  .speaking { bottom: var(--sp-4); }
}

/* capture: quick ask */
.ask-fold { border-top: 1px solid var(--line); padding-top: var(--sp-2); }
.ask-fold__head { display: flex; align-items: center; min-height: var(--tap); cursor: pointer; font-weight: 600; color: var(--text-2); }
.ask { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.ask__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.ask__modes { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.ask__voice { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: var(--sp-2); }
.ask__miclabel { grid-column: 2; grid-row: 1; font-weight: 600; }
.ask__voice .mic { grid-column: 1; grid-row: 1 / span 2; }
.ask__status { grid-column: 2; margin: 0; font-size: var(--fs-sm); color: var(--text-2); }
.ask__status[data-phase="failed"] { color: var(--danger); }
.ask__status[data-phase="listening"], .ask__status[data-phase="speaking"] { color: var(--accent); }
.ask__nomic { grid-column: 1 / -1; }
.ask__form { display: flex; gap: var(--sp-2); }
.ask__box { flex: 1; min-width: 0; }
.ask[data-mode="fold"] .ask__form { flex-wrap: wrap; }
.ask[data-mode="fold"] .ask__box { flex-basis: 100%; }
.ask__read { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: var(--tap); font-size: var(--fs-sm); color: var(--text-2); }
.ask__hand { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.ask__line, .ask__note { margin: 0; font-size: var(--fs-sm); color: var(--text-2); }
.ask__note--error { color: var(--danger); }
.ask__answer { display: flex; flex-direction: column; gap: var(--sp-1); padding: var(--sp-3); border-radius: var(--r-md); background: var(--surface-2); }
.ask__answer[hidden] { display: none; }
.ask__q { margin: 0; font-weight: 600; }
.ask__a { white-space: pre-wrap; }
.ask__full { align-self: flex-start; }
.ask__list { display: flex; flex-direction: column; gap: var(--sp-1); }
.ask__listtitle { margin: var(--sp-2) 0 0; font: 600 var(--fs-sm)/1.2 var(--font-head); color: var(--text-2); }
.ask__past { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: var(--sp-2); border-radius: var(--r-md); text-align: left; color: inherit; }
.ask__past:focus-visible { background: var(--surface-2); }
@media (hover: hover) { .ask__past:hover { background: var(--surface-2); } }
.ask__pastq { font-weight: 600; }
.ask__pasta, .ask__handedq { font-size: var(--fs-sm); color: var(--text-2); }
.ask__handed, .ask__take { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); padding: var(--sp-1) 0; border-bottom: 1px solid var(--line); }
.ask__handedq { flex-basis: 100%; }
.ask__takewords { flex-basis: 100%; margin: 0; }
.ask__takeacts { display: flex; gap: var(--sp-2); }
.ask__open { margin-left: auto; }
/* open, the head button stands over the scrim: a second press closes the sheet */
/* open, the head button stands over the scrim (a second press closes the sheet); narrow, under the sheet itself */
.ask__open[aria-expanded="true"] { position: relative; z-index: 41; }
.sheet-up.sheet-up--ask { z-index: 42; }
@container app (min-width: 900px) { .ask__open[aria-expanded="true"] { z-index: 43; } }
.sheet-up--ask { padding-left: var(--sp-4); padding-right: var(--sp-4); }
@container app (min-width: 900px) {
  .scrim.scrim--ask { display: block; }
  .sheet-up.sheet-up--ask {
    display: flex; left: auto; right: var(--sp-4); top: calc(var(--tap) + var(--sp-5)); bottom: auto; width: 420px; max-height: calc(100% - var(--tap) - 2 * var(--sp-5));
    padding: var(--sp-3); border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  }
  .sheet-up.sheet-up--ask::before { display: none; }
}
/* grammar4 */
/* A page refreshes in place (G4-1): the waiting line at the article's top, and the line under a
   row the server no longer lists while the human is still in it. */
.page__waiting { margin: 0 0 var(--sp-3); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md); background: var(--warn-soft); color: var(--text-2); font-size: var(--fs-sm); }
.row__gone { margin: 0 0 var(--sp-2) var(--sp-6); color: var(--warn); font-size: var(--fs-xs); }
/* An acted-on row stays where it is (G4-3): struck, its box filled, "Done · sinks in 60 s" and Undo at its right. */
.row.is-done .row__text { text-decoration: line-through; color: var(--text-3); }
.row.is-done .row__tick::before { background: var(--accent); border-color: var(--accent); }
.row.is-done .row__tick::after { opacity: 1; }
.row.is-done > .row__acts { display: none; }
.row > .row__strip { grid-column: 3; grid-row: 1; display: flex; align-items: center; gap: var(--sp-2); padding-right: var(--sp-2); }
.table--nolead .row > .row__strip { grid-column: 2; }
.row__done { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; }
/* A write that waits (G4-4): its row says so; the head counts them; an act that needs the server is off offline. */
.row > .row__waiting { grid-column: 2 / -1; padding: 0 0 var(--sp-2); font-size: var(--fs-xs); color: var(--warn); }
.row.is-waiting { box-shadow: inset 3px 0 0 var(--warn); }
.page__pending, .page__copy { margin: 0 0 var(--sp-3); font-size: var(--fs-sm); color: var(--warn); }
.offline__words { font-size: var(--fs-xs); color: var(--text-3); }
/* Confirm in the page (G4-5): an armed control is red and says "Tap again"; a template asks on the row. */
.is-armed.act, .is-armed.btn, .is-armed.chip, .is-armed.menu__item { background: var(--danger); color: var(--danger-ink); border-color: var(--danger); }
.row__tick.is-armed { width: auto; padding-inline: var(--sp-2); border-radius: var(--r-pill); font-size: var(--fs-xs); }
.row__tick.is-armed::before, .row__tick.is-armed::after { display: none; }
.confirm { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); padding: var(--sp-2) 0; }
.row > .confirm { grid-column: 2 / -1; }
.confirm__line { font-variant-numeric: tabular-nums; color: var(--text-2); }
.action__refuse { flex-basis: 100%; font-size: var(--fs-xs); color: var(--danger); }
.action__refuse:empty { display: none; }
/* Drop, copy, a stale answer and a job's notice (G4-6 to G4-8). */
.row > .drop, .row > .row__stale, .row > .row__notice, .row > .row__note { grid-column: 2 / -1; }
.drop { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); padding: 0 var(--sp-2) var(--sp-2) 0; }
.drop__why { flex: 1 1 12rem; min-width: 0; }
.btn--danger { background: var(--danger); color: var(--danger-ink); border-color: var(--danger); }
.section__dropped { margin: var(--sp-2) var(--sp-4); color: var(--danger); font-size: var(--fs-sm); }
.row__stale { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); padding: 0 0 var(--sp-2); }
.row__stale-words { color: var(--warn); font-size: var(--fs-sm); }
.row__notice { margin: 0; padding: 0 0 var(--sp-2); font-size: var(--fs-sm); color: var(--ok); }
.row__notice[data-tone="refused"] { color: var(--danger); }
.row__note { font-size: var(--fs-xs); color: var(--text-3); }
.approx { color: var(--text-3); }
/* The head says more than the title (G4-9, G4-10): the subtitle wraps on a narrow screen and never
   inside a word; the day line, the team picker and the preview's line. */
.page__head .page__sub { white-space: normal; overflow-wrap: normal; word-break: keep-all; }
.page__day, .page__days { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin: 0 0 var(--sp-3); }
.page__date { font: 600 var(--fs-sm)/1.2 var(--font-head); font-variant-numeric: tabular-nums; }
.page__dayword { color: var(--warn); font-size: var(--fs-sm); }
.page__team { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--text-2); }
.page__team-select { width: auto; min-height: 36px; }
.page__preview { margin: 0 0 var(--sp-3); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md); background: var(--surface-2); color: var(--text-2); font-size: var(--fs-sm); }
.page__off { display: contents; border: 0; margin: 0; padding: 0; min-width: 0; }
.page__off :is(button, input, select, textarea):disabled { opacity: 0.45; cursor: not-allowed; }
/* Sections: a mark, a note, a hairline over every titled head (G4-11); two columns from 900 px. */
.section__glyph { margin-right: 6px; font-family: var(--font-emoji), var(--font-head); }
.section__note { margin-left: var(--sp-2); color: var(--text-3); font-size: var(--fs-xs); font-weight: 400; }
section.section[id^="sec-"]:not(.band):not(.tile) { border-top: 1px solid var(--line); padding-top: var(--sp-3); }
.page--cols-2 { container-type: inline-size; }
@container (min-width: 900px) {
  .page__cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--sp-5); align-items: start; }
  .page__cols > .band, .page__cols > .tiles, .page__cols > .strip { grid-column: 1 / -1; }
}
/* A long press opens the row in a sheet; code can be copied or sent to a tab (G4-15). */
.sheet-up.sheet-up--row { display: flex; }
.scrim.scrim--row { display: block; }
.menu--sheet { position: static; display: flex; flex-direction: column; box-shadow: none; border: 0; padding: 0; min-width: 0; }
.code__acts { display: flex; gap: var(--sp-1); margin: 2px 0 var(--sp-2); }
/* Select all and pull a whole section (G4-16): quiet words in the section's head. */
.act--quiet { padding: 0 var(--sp-2); font-size: var(--fs-xs); font-weight: 500; color: var(--text-3); width: auto; }
.section__all { margin-left: auto; }
/* One family of chips (G4-17): the strip, a section's filters, find. Four across under 900 px, seven from there. */
.strip { container-type: inline-size; margin: 0 0 var(--sp-3); }
.strip__row, .strip__by { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-2); }
.strip__by { margin-top: var(--sp-2); }
@container (min-width: 900px) { .strip__row, .strip__by { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.strip__chip { justify-content: center; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip__glyph { margin-right: 4px; }
.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.chip__n { color: var(--text-3); font-variant-numeric: tabular-nums; }
.filters { display: flex; flex-direction: column; gap: var(--sp-2); padding: 0 0 var(--sp-2); }
.filters__row { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.page__find { margin: 0 0 var(--sp-3); }
.page__find-input { width: 100%; }
.find__none { margin: var(--sp-2) var(--sp-4); color: var(--text-3); font-size: var(--fs-sm); }
.is-filtered, .section.is-stripped, .tiles:has(> .section.is-stripped:only-child) { display: none !important; }
.tile__narrows { cursor: pointer; border: 0; background: none; color: inherit; font: inherit; }
.tile__narrows[aria-pressed="true"] { color: var(--accent); }
.section__pull { white-space: nowrap; }
/* A row that opens in place and a pane beside the list (G4-18). */
.act--chev::before { content: ""; width: 8px; height: 8px; border: solid currentColor; border-width: 0 1.75px 1.75px 0; transform: translateY(-2px) rotate(45deg); transition: transform var(--t-fast); }
.act--chev[aria-expanded="true"]::before { transform: translateY(2px) rotate(-135deg); }
.row[tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.row > .row__block { grid-column: 2 / -1; display: flex; flex-direction: column; gap: var(--sp-2); padding: 0 var(--sp-3) var(--sp-3) 0; }
.table--nolead .row > .row__block { grid-column: 1 / -1; }
.row > .row__block[hidden] { display: none; }
.row.is-selected { box-shadow: inset 3px 0 0 var(--accent); background: var(--accent-soft); }
.section.is-pane { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--sp-4); align-items: start; }
.section.is-pane > :not(.pane) { grid-column: 1; }
.section.is-pane > .pane { grid-column: 2; grid-row: 1 / span 20; position: sticky; top: var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.section.is-pane .row__chev { display: none; }
/* Answers as cells that show what is stored (G4-19). */
.cells { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.cell { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2); min-width: 12rem; flex: 1 1 12rem; padding: var(--sp-2); border: 1px solid var(--line); border-radius: var(--r-md); }
.cell--warn { border-color: var(--warn); background: var(--warn-soft); }
.cell__label { flex-basis: 100%; font-size: var(--fs-xs); color: var(--text-3); }
.cell__shown { min-height: 36px; padding: 0 var(--sp-3); border: 1px dashed var(--line-strong); border-radius: var(--r-sm); background: none; color: var(--text); font: inherit; font-variant-numeric: tabular-nums; cursor: text; }
.cell__input { flex: 1 1 6rem; min-width: 0; }
.cell [hidden] { display: none; }
/* Chips with tones, a figure with a small label, tones and stamps (G4-20). */
.chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.pill--chip[data-tone="good"] { background: var(--ok-soft); color: var(--ok); }
.pill--chip[data-tone="bad"] { background: var(--danger-soft); color: var(--danger); }
.pill--chip[data-tone="warm"] { background: var(--warn-soft); color: var(--warn); }
.pill--chip[data-tone="info"] { background: var(--info-soft); color: var(--info); }
.row__cell--figure { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.figure__num { font-variant-numeric: tabular-nums; font-weight: 600; }
.figure__sub { font-size: var(--fs-xs); color: var(--text-3); }
.row[data-tone="muted"], .row[data-tone="muted"] .row__text { color: var(--text-3); }
.row[data-tone="good"] { box-shadow: inset 3px 0 0 var(--ok); }
.row[data-tone="bad"] { box-shadow: inset 3px 0 0 var(--danger); }
.row[data-tone="warm"] { box-shadow: inset 3px 0 0 var(--warn); }
.row[data-tone="info"] { box-shadow: inset 3px 0 0 var(--info); }
.stamp { display: inline-block; margin-bottom: var(--sp-2); padding: 2px var(--sp-2); border: 1.5px solid currentColor; border-radius: var(--r-sm); font: 700 var(--fs-xs)/1.2 var(--font-head); letter-spacing: 0.06em; text-transform: uppercase; transform: rotate(-2deg); }
.stamp[data-tone="good"] { color: var(--ok); }
.stamp[data-tone="bad"] { color: var(--danger); }
.stamp[data-tone="warm"] { color: var(--warn); }
.stamp[data-tone="info"] { color: var(--info); }
.stamp__line { display: block; font-size: var(--fs-xs); font-weight: 400; color: var(--text-3); }
.stamp__off { font-size: var(--fs-sm); color: var(--danger); font-weight: 500; }
.stamp__none { color: var(--text-3); font-style: italic; }
/* A progress section (G4-21): the percent large, a bar, the words; the compact form in the head. */
.progress { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); }
.progress__big { margin: 0; font: 700 var(--fs-num)/1 var(--font-head); font-variant-numeric: tabular-nums; }
.progress__face { margin-right: var(--sp-2); font-family: var(--font-emoji); }
.progress__bar { height: 8px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; }
.progress__fill { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width var(--t-med) var(--ease); }
.progress__words { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin: 0; font-size: var(--fs-sm); color: var(--text-2); }
.progress__carry { color: var(--danger); font-weight: 600; }
.progress__caption, .progress__band { margin: 0; font-size: var(--fs-sm); color: var(--text-3); }
.progress--head { flex-direction: row; align-items: center; padding: 0; gap: var(--sp-3); font-size: var(--fs-sm); color: var(--text-2); }
.progress--head .progress__bar { flex: 1 1 8rem; max-width: 16rem; }
/* Rows under a row and a held box (G4-22). */
.row.row--child { padding-left: var(--sp-5); }
.row.row--child .row__text { font-weight: 400; }
.pill--kids { font-variant-numeric: tabular-nums; }
.row__tick--held { opacity: 0.45; cursor: not-allowed; }
.row > .row__held { grid-column: 2 / -1; margin: 0; padding: 0 0 var(--sp-2); font-size: var(--fs-sm); color: var(--warn); }
/* Where a row came from (G4-24). */
.receipt-line { display: flex; align-items: center; gap: var(--sp-1); margin: 0; font-size: var(--fs-xs); color: var(--text-3); }
.receipt-line--none { color: var(--warn); }
.act--why { width: 28px; height: 28px; min-height: 0; }
/* The notes of a vault folder (G4-25). */
.note .row__main { gap: var(--sp-1); }
.note__when { font-size: var(--fs-xs); color: var(--text-3); }
.note__fold-head { cursor: pointer; font-size: var(--fs-xs); color: var(--text-2); }
.note__prompt { max-height: 16rem; overflow: auto; margin: var(--sp-2) 0; padding: var(--sp-2); border-radius: var(--r-sm); background: var(--surface-2); font: var(--fs-xs)/1.45 var(--font-mono); white-space: pre-wrap; }
.note__none { font-size: var(--fs-xs); color: var(--text-3); }
.notes__more { margin: var(--sp-2) var(--sp-4); font-size: var(--fs-xs); color: var(--text-3); }
/* The companion behind a page's rows (G4-27): never in the way of a tap, away now and then. */
.companion.companion--behind { pointer-events: none; z-index: 0; opacity: 0.85; transition: opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease); }
.companion.companion--behind.is-away { opacity: 0; transform: translateY(24px); }
.companion.companion--behind.companion--left { right: auto; left: var(--sp-4); }
@media (prefers-reduced-motion: reduce) { .companion.companion--behind { transition: none; } }
/* The pages as tiles (G4-28): two columns under 900 px of the page's width, three from there. */
.page--pages { container-type: inline-size; }
.page-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); padding: var(--sp-2) 0; }
@container (min-width: 900px) { .page-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.page-tile { position: relative; display: flex; flex-direction: column; gap: var(--sp-1); min-height: 96px; padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: inherit; text-decoration: none; }
@media (hover: hover) { .page-tile:hover { border-color: var(--line-strong); background: var(--surface-2); } }
.page-tile__icon { color: var(--accent); min-height: 1.5rem; }
.page-tile__emoji { font-family: var(--font-emoji); font-size: 1.25rem; }
.page-tile__title { font: 600 var(--fs-md)/1.2 var(--font-head); }
.page-tile__sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: var(--fs-sm); color: var(--text-2); }
.page-tile__count { position: absolute; top: var(--sp-3); right: var(--sp-3); min-width: 1.5rem; padding: 0 6px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent); font: 600 var(--fs-xs)/1.5rem var(--font-text); text-align: center; font-variant-numeric: tabular-nums; }
/* The head's parts (G4-9, G4-10, G4-21): the title keeps its line, the subtitle and the compact progress take the next. */
.page__head:has(> [data-part]:not(.page__title)) { flex-wrap: wrap; row-gap: var(--sp-1); }
.page__head > .page__sub[data-part], .page__head > .progress--head { flex-basis: 100%; }
.page__head > .page__title { flex: 0 1 auto; }
.page__day .page__step:first-child { margin-left: calc(-1 * var(--sp-3)); }
.page__day .page__step:last-child { margin-left: auto; }
.text > .stamp, .stamp { align-self: flex-start; width: max-content; max-width: 100%; }
.row__cell--figure { overflow: visible; white-space: normal; }
.row__cell--figure .stamp__line { white-space: nowrap; text-align: right; }
.row.is-saved > .row__strip { grid-column: 2 / -1; grid-row: auto; padding: 0 0 var(--sp-2); }
/* cards */
/* The Inbox card in full (decisions CD-33 to CD-42): the kind chip in its hue, the collapsed face and
   the opened card, the buttons by tone, the words box, the checklist, the hold strip, the swipe bands,
   the lines a card says about itself, and the Why sheet. Hues: tokens.css `--kind-<hue>`. */
.card--hue-red { --kind: var(--kind-red); --kind-soft: var(--kind-red-soft); }
.card--hue-amber { --kind: var(--kind-amber); --kind-soft: var(--kind-amber-soft); }
.card--hue-green { --kind: var(--kind-green); --kind-soft: var(--kind-green-soft); }
.card--hue-blue { --kind: var(--kind-blue); --kind-soft: var(--kind-blue-soft); }
.card--hue-violet { --kind: var(--kind-violet); --kind-soft: var(--kind-violet-soft); }
.card--hue-grey { --kind: var(--kind-grey); --kind-soft: var(--kind-grey-soft); }
.card[data-kinded] { border-left: 3px solid var(--kind, var(--line)); touch-action: pan-y; overflow: hidden; }
.card__kind { display: inline-flex; align-items: center; min-height: 20px; padding: 0 var(--sp-2); border-radius: var(--r-pill); background: var(--kind-soft, var(--surface-2)); color: var(--kind, var(--text-2)); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; }
.kind--red { --kind: var(--kind-red); --kind-soft: var(--kind-red-soft); }
.kind--amber { --kind: var(--kind-amber); --kind-soft: var(--kind-amber-soft); }
.kind--green { --kind: var(--kind-green); --kind-soft: var(--kind-green-soft); }
.kind--blue { --kind: var(--kind-blue); --kind-soft: var(--kind-blue-soft); }
.kind--violet { --kind: var(--kind-violet); --kind-soft: var(--kind-violet-soft); }
.kind--grey { --kind: var(--kind-grey); --kind-soft: var(--kind-grey-soft); }
.card__repeat { font-weight: 700; color: var(--warn); cursor: help; }
.card__why { margin-left: auto; margin-block: -12px; width: var(--tap); height: var(--tap); border-radius: var(--r-md); font: 600 var(--fs-lg)/1 var(--font-head); color: var(--text-3); }
@media (hover: hover) { .card__why:hover { color: var(--accent); background: var(--accent-soft); } }
.card__head > [data-pop] ~ .card__why, .card__head > .act ~ .card__why { margin-left: 0; }
.card__unchecked { background: var(--warn-soft); color: var(--warn); }
.card__replied { background: var(--accent-soft); color: var(--accent); }
.card__titlebtn { display: block; width: 100%; padding: 0; text-align: left; font: inherit; color: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (hover: hover) { .card__titlebtn:hover { color: var(--accent); } }
.card[data-open] .card__titlebtn { white-space: normal; }
.card__opener { min-width: var(--tap); min-height: var(--tap); margin-left: auto; border-radius: var(--r-md); font-weight: 700; letter-spacing: 0.1em; color: var(--text-3); }
.card__opener[aria-expanded="true"] { color: var(--accent); background: var(--accent-soft); }
@media (hover: hover) { .card__opener:hover { color: var(--accent); background: var(--accent-soft); } }
.card__face { align-items: center; }
.card__body { display: flex; flex-direction: column; gap: var(--sp-3); }
.card__body[hidden] { display: none; }
.card__btn.btn--accent { background: var(--accent); color: var(--accent-ink); }
.card__btn.btn--danger { background: var(--danger); color: var(--danger-ink); }
.card__btn.btn--good { background: var(--ok); color: var(--accent-ink); }
.card__btn.btn--warm { background: var(--warn); color: var(--warn-ink); }
.card__btn.btn--plain { background: var(--surface-2); color: var(--text); }
.card__btn.is-pick { outline: 2px dashed var(--accent); outline-offset: 2px; }
.card__pick { font-size: var(--fs-sm); color: var(--accent); }
.card__unread { font-size: var(--fs-sm); font-weight: 600; color: var(--warn); }
.card--unread .card__title { color: var(--text-2); }
.card__status { padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md); background: var(--surface-2); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.card__status--running { background: var(--accent-soft); color: var(--accent); }
.card__status--running::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: var(--sp-2); border-radius: 50%; background: currentColor; animation: luna-pulse var(--pulse) ease-in-out infinite; }
.card__status--held { background: var(--warn-soft); color: var(--warn); }
.card__status--done { background: var(--ok-soft); color: var(--ok); }
.card__items { display: flex; flex-direction: column; gap: var(--sp-2); }
.card__item { display: flex; flex-direction: column; gap: 2px; }
.card__check { display: flex; align-items: flex-start; gap: var(--sp-2); min-height: var(--tap); cursor: pointer; }
.card__tick { flex: none; width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--accent); }
.card__itemtext { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card__found, .card__maybe { padding-left: calc(22px + var(--sp-2)); font-size: var(--fs-sm); color: var(--text-3); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card__maybe { color: var(--warn); }
.card__fold > summary { display: inline-flex; align-items: center; min-height: var(--tap); margin: -10px 0; font-size: var(--fs-sm); font-weight: 600; color: var(--text-3); cursor: pointer; }
.card__fold ul { display: flex; flex-direction: column; gap: var(--sp-1); padding-top: var(--sp-2); font-size: var(--fs-sm); color: var(--text-2); }
.card__pre { max-height: 320px; overflow: auto; padding: var(--sp-3); border-radius: var(--r-md); background: var(--surface-2); font: var(--fs-xs)/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; }
.card__replies { display: flex; flex-direction: column; gap: var(--sp-2); }
.card__reply { padding: var(--sp-2) var(--sp-3); border-left: 2px solid var(--line-strong); font-size: var(--fs-sm); }
.card__replywait { color: var(--text-3); }
.card__replyanswer { color: var(--text); font-weight: 500; }
.card__reply--answered { border-left-color: var(--accent); }
.card__landed { font-size: var(--fs-xs); color: var(--text-3); }
.card__reads { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-3); border-radius: var(--r-md); background: var(--surface-2); }
.card__reads[hidden] { display: none; }
.card__reading { display: none; color: var(--text-3); font-size: var(--fs-sm); }
.card__reads.is-reading .card__reading { display: block; }
.card__reads.is-reading > :not(.card__reading) { display: none; }
.card__readhead { font: 600 var(--fs-sm)/1.3 var(--font-head); color: var(--text-2); }
.card__sources, .card__links, .card__none { font-size: var(--fs-sm); color: var(--text-2); }
.card--line { gap: 0; padding-block: var(--sp-2); }
.card__line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); }
.card__line .card__title { flex: 1 1 12rem; min-width: 0; font-size: var(--fs-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card__back, .card__said { font-size: var(--fs-sm); color: var(--text-2); }
.card__line .card__why { margin: 0; }
.card--receipt { flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); }
.card__receipt { flex: 1 1 14rem; font-size: var(--fs-sm); color: var(--text-2); }
.card__words { display: flex; flex-direction: column; gap: var(--sp-2); }
.card__wordsin { width: 100%; min-height: 64px; resize: vertical; }
.card__wordsacts { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2); }
.card__wordshint { margin-right: auto; font-size: var(--fs-sm); color: var(--danger); }
.card__note { padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md); background: var(--surface-2); font-size: var(--fs-sm); color: var(--text-2); }
.card__refused { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.card__gone { background: var(--warn-soft); color: var(--warn); }
.card__note--changed { background: var(--accent-soft); color: var(--accent); }
.card.is-struck { gap: 0; padding-block: var(--sp-2); }
.card.is-struck > :not(.card__strip) { display: none; }
.card__strip { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); min-height: var(--tap); }
.card__striptext { flex: 1 1 12rem; font-size: var(--fs-sm); font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-2); }
.card__strip[data-state="holding"] .card__striptext { color: var(--text); }
.card__strip[data-state="done"] .card__striptext { color: var(--ok); }
.card__strip:is([data-state="retrying"], [data-state="stuck"]) .card__striptext { color: var(--warn); }
.card__strip[data-state="queued"] .card__striptext { color: var(--accent); }
.card.is-swiping > :not(.card__band) { transform: translateX(var(--swipe-x, 0)); }
.card__band { position: absolute; inset: 0; z-index: 0; display: flex; align-items: center; padding: 0 var(--sp-4); font-weight: 700; pointer-events: none; }
.card__band--right { justify-content: flex-start; background: var(--ok-soft); color: var(--ok); }
.card__band--left { justify-content: flex-end; background: var(--warn-soft); color: var(--warn); }
.card.is-swiping > :not(.card__band) { position: relative; z-index: 1; }
.card.is-armed .card__band--right { background: var(--ok); color: var(--accent-ink); }
.card.is-armed .card__band--left { background: var(--warn); color: var(--warn-ink); }
.card.is-armed > :not(.card__band) { opacity: 0.35; }
.inbox__top:empty { display: none; }
.inbox__handled { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); margin: 0 0 var(--sp-3); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md); background: var(--surface-2); font-size: var(--fs-sm); color: var(--text-2); }
.inbox__handled > span { flex: 1 1 14rem; }
.why-sheet { gap: var(--sp-3); }
.why__body { display: flex; flex-direction: column; gap: var(--sp-2); }
.why__line { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: var(--sp-3); padding: var(--sp-2) 0; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.why__key { font-weight: 600; color: var(--text-3); }
.why__reading, .why__empty, .why__noted { color: var(--text-2); }
.why__acts { display: flex; justify-content: flex-end; }
.why__form { display: flex; flex-direction: column; gap: var(--sp-2); }
.why__label { display: flex; flex-direction: column; gap: var(--sp-1); font-size: var(--fs-sm); font-weight: 600; }
.why__close { margin-left: auto; font-size: var(--fs-lg); }
@container app (min-width: 900px) {
  .sheet-up.why-sheet { display: flex; left: 50%; right: auto; bottom: auto; top: 12%; width: min(560px, 90%); transform: translateX(-50%); border-radius: var(--r-lg); }
  .sheet-up.why-sheet::before { display: none; }
  .scrim.scrim--why { display: block; }
}
/* finder */
/* ===================================================================== finder: prose tables, alarms (FN-1, FN-2) */
/* A pipe table in rendered prose: it scrolls sideways inside its own box and never widens the page. */
.prose__table { max-width: 100%; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; border: 1px solid var(--line); border-radius: var(--r-md); }
.prose__table table { width: max-content; min-width: 100%; border-collapse: collapse; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.prose__table th, .prose__table td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: normal; word-break: normal; }
.prose__table th { font-weight: 600; color: var(--text-2); background: var(--surface-2); white-space: nowrap; }
.prose__table tbody tr:last-child td { border-bottom: 0; }
.prose__table .num { text-align: right; white-space: nowrap; }
.prose__table .mid { text-align: center; }
.prose__table .num--up { color: var(--ok); font-weight: 600; }
.prose__table .num--down { color: var(--danger); font-weight: 600; }
.prose__table .prose__total td { border-top: 2px solid var(--line-control); font-weight: 600; }
.prose__alarm { color: var(--danger); }
.prose__alarm strong { font-weight: 700; }
li.prose__alarm::marker { color: var(--danger); }
@container app (max-width: 559.98px) {
  .prose__table .col--wide { display: none; }
}

/* ===================================================================== finder: the vault's browser (FN-3 to FN-7) */
:root {
  --i-lock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E");
  --i-graph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='6' cy='7' r='2.5'/%3E%3Ccircle cx='18' cy='6' r='2'/%3E%3Ccircle cx='15' cy='17' r='3'/%3E%3Cpath d='M8.3 8.2l4.6 6.6M8.4 6.6l7.6-.5M17.6 8l-1.6 6'/%3E%3C/svg%3E");
}
.icon--lock { --i: var(--i-lock); }
.icon--graph { --i: var(--i-graph); }
.file-row--credential { cursor: pointer; }
.file-row--credential .row__text { color: var(--text-3); }
.file__kind--lock { color: var(--text-3); }

/* ===================================================================== finder: search, the folder's search, the switcher (FN-6, FN-7, FN-22 to FN-26) */
.search__scopes, .search__recent, .files__shortcuts { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.search__status, .files__count { min-height: 1.4em; font-size: var(--fs-sm); color: var(--text-3); }
.search__hint { font-size: var(--fs-sm); color: var(--text-3); }
.search__more { align-self: flex-start; margin-top: var(--sp-2); }
.section--search { display: flex; flex-direction: column; }
.files__search { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.files__field { flex: 1 1 14rem; min-width: 0; }

.files__mentions[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.files__shortcut .icon { width: 16px; height: 16px; }
.hits { display: flex; flex-direction: column; }
.hit { display: flex; flex-direction: column; gap: 4px; padding: var(--sp-3) var(--sp-2); border-bottom: 1px solid var(--line); cursor: pointer; border-radius: var(--r-sm); min-width: 0; }
.hit:last-child { border-bottom: 0; }
@media (hover: hover) { .hit:hover { background: var(--surface-2); } }
.hit:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hit__head { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.hit__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.hit__meta { flex: none; font-size: var(--fs-sm); color: var(--text-3); white-space: nowrap; }
.hit__snippet { font-size: var(--fs-sm); color: var(--text-2); overflow-wrap: anywhere; }
.hit__lines { display: flex; flex-direction: column; gap: 2px; list-style: none; padding: 0; margin: 0; }
.hit__lineref { display: flex; gap: var(--sp-2); align-items: baseline; padding: 2px 4px; border-radius: 4px; color: var(--text-2); text-decoration: none; font-size: var(--fs-sm); min-width: 0; }
@media (hover: hover) { .hit__lineref:hover { background: var(--accent-soft); color: var(--text); } }
.hit__ln { flex: none; min-width: 3ch; text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-3); }
.hit__lt { min-width: 0; overflow-wrap: anywhere; }
.hit mark, .switcher mark { background: var(--warn-soft); color: inherit; border-radius: 2px; padding: 0 1px; }
.switcher { gap: var(--sp-2); }
.switcher__input { min-height: 52px; font-size: var(--fs-lg); }
.switcher__list { display: flex; flex-direction: column; overflow-y: auto; max-height: min(60vh, 520px); }
.switcher__row { display: flex; align-items: center; gap: var(--sp-3); min-height: 44px; padding: 0 var(--sp-3); border-radius: var(--r-md); color: var(--text); text-decoration: none; }
.switcher__row.is-lit { background: var(--accent-soft); color: var(--accent); box-shadow: none; }
.switcher__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher__sub, .switcher__kind { flex: none; font-size: var(--fs-sm); color: var(--text-3); }
.switcher__dot { flex: none; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--accent); }
.switcher__dot--working { background: var(--accent); }
.switcher__hint { font-size: var(--fs-xs); color: var(--text-3); text-align: center; }
@container app (min-width: 900px) {
  .scrim.switcher__scrim { display: block; }
  .sheet-up.switcher { display: flex; top: 12vh; bottom: auto; left: 50%; right: auto; width: min(640px, 90%); transform: translateX(-50%); border-radius: var(--r-lg); max-height: 76vh; }
  .sheet-up.switcher::before { display: none; }
}

/* ===================================================================== finder: the viewer (FN-8 to FN-13, FN-18, FN-21) */
.file__meta { margin-top: calc(-1 * var(--sp-2)); font-size: var(--fs-sm); color: var(--text-3); }
details.note__callout { border-left: 3px solid var(--accent); }
details.note__callout > summary { min-height: var(--tap); display: flex; align-items: center; gap: var(--sp-2); font-weight: 600; cursor: pointer; color: var(--text); }
details.note__callout > summary::marker { color: var(--accent); }
details.note__callout > :not(summary) { margin-top: var(--sp-2); }
details.note__callout[data-callout="warning"], details.note__callout[data-callout="caution"], details.note__callout[data-callout="danger"] { border-left-color: var(--danger); background: var(--danger-soft); }
details.note__callout[data-callout="tip"], details.note__callout[data-callout="success"] { border-left-color: var(--ok); background: var(--ok-soft); }
a.link--broken { cursor: help; text-decoration: underline dotted; text-underline-offset: 3px; color: var(--text-3); }
.link__why { font-size: var(--fs-sm); color: var(--danger); font-style: normal; }
.note__pic { display: inline-block; max-width: 100%; text-decoration: none; }
.note__miss { display: inline-block; padding: var(--sp-2) var(--sp-3); border: 1px dashed var(--line-strong); border-radius: var(--r-md); font-size: var(--fs-sm); color: var(--text-3); }
.note__query { padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.note__query-list > summary { min-height: var(--tap); display: flex; align-items: center; font-weight: 600; cursor: pointer; }
.note__query-cut { font-weight: 400; color: var(--text-3); }
.note__query-file { margin-top: var(--sp-2); }
.note__query-note { font-weight: 600; font-size: var(--fs-sm); }
.note__query-lines { list-style: none; padding-left: var(--sp-3); margin: 4px 0 0; display: flex; flex-direction: column; gap: 2px; }
.note__query-box { margin-right: 6px; }
.note__query-more, .note__query-wait, .note__query-none { font-size: var(--fs-sm); color: var(--text-3); }
.note__query-fail { font-size: var(--fs-sm); color: var(--danger); }
.file__framed { display: flex; flex-direction: column; gap: var(--sp-2); }
.file__missing { font-size: var(--fs-sm); color: var(--warn); }
.file__pdf { display: flex; flex-direction: column; gap: var(--sp-3); }
.file__pdfsay { font-size: var(--fs-sm); color: var(--text-3); }
.file__pdfpages { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.file__pdfpage { display: block; width: 100%; height: auto; border-radius: var(--r-sm); box-shadow: var(--e-1); background: #fff; }
.file__cardsay { color: var(--text-2); }
.file__unfinished { align-self: stretch; }

/* ===================================================================== finder: the whole vault on the device (FN-14) */
.files__vault { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--text-3); }
.files__vault[data-busy] .files__vaultsay::after { content: " · pulling…"; }

/* ===================================================================== finder: the graph (FN-29 to FN-31) */
/* ===================================================================== graph (#/graph)
   A full view: the head (Close, the two layer pills), the bar (find, Fit, Motion, the extra
   toggle), the folder legend, the canvas filling the rest of the app box's height, and the
   status line. The canvas draws in the server's palette, the same in both themes. */
.page--graph {
  height: 100dvh; min-height: 420px; gap: var(--sp-2); overflow: hidden;
  padding: var(--sp-3) var(--sp-3) calc(var(--sp-6) + 64px);   /* room for the phone's bottom bar */
}
.graph__head { flex: none; gap: var(--sp-2); min-width: 0; }
.graph__close { flex: none; margin-left: calc(-1 * var(--sp-2)); }
.graph__layers { display: flex; gap: var(--sp-1); min-width: 0; overflow-x: auto; scrollbar-width: none; }
.graph__layers::-webkit-scrollbar { display: none; }
.graph__layer {
  flex: none; display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--sp-3);
  border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface);
  font: 600 var(--fs-sm)/1 var(--font-head); color: var(--text-2); white-space: nowrap; cursor: pointer;
}
@media (hover: hover) { .graph__layer:hover { color: var(--text); border-color: var(--line-strong); } }
.graph__layer[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.graph__bar { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); min-width: 0; }
.graph__find { flex: 1 1 140px; min-width: 0; width: auto; font-size: max(16px, var(--fs-md)); }
.graph__fit, .graph__motion, .graph__extra { flex: none; padding: 0 var(--sp-3); font-size: var(--fs-sm); }
.graph__motion[aria-pressed="true"], .graph__extra[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.graph__extra { flex: 0 1 auto; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* The legend: one horizontally scrolling row of pills on a phone, wrapped when wide. */
.graph__legend {
  flex: none; display: flex; flex-wrap: nowrap; gap: var(--sp-1); min-width: 0; max-width: 100%;
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; padding-bottom: 2px;
}
.graph__legend::-webkit-scrollbar { display: none; }
.graph__legend[hidden] { display: none; }
.graph__pill {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 var(--sp-3);
  border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface);
  font-size: var(--fs-xs); font-weight: 600; color: var(--text); white-space: nowrap; cursor: pointer;
  position: relative;
}
.graph__pill::after { content: ""; position: absolute; inset: -6px 0; }   /* a 44 px hit area */
.graph__pill[aria-pressed="false"] { color: var(--text-3); background: none; border-style: dashed; }
.graph__pill[aria-pressed="false"] .graph__dot { opacity: 0.3; }
.graph__dot { width: 8px; height: 8px; flex: none; border-radius: 50%; }
.graph__name { max-width: 16ch; overflow: hidden; text-overflow: ellipsis; }
.graph__count { color: var(--text-3); font-variant-numeric: tabular-nums; }

.graph__stage {
  position: relative; flex: 1 1 auto; min-height: 200px; min-width: 0; overflow: hidden;
  border-radius: var(--r-lg); box-shadow: inset 0 0 0 1px var(--line);
}
.graph__canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.graph__canvas:active { cursor: grabbing; }
.graph__tip {
  position: absolute; left: 0; top: 0; z-index: 2; max-width: min(320px, calc(100% - 12px)); pointer-events: none;
  display: flex; flex-direction: column; gap: 2px; padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md); background: var(--surface); color: var(--text); box-shadow: var(--e-2);
  font-size: var(--fs-sm); line-height: 1.3;
}
.graph__tip[hidden] { display: none; }
.graph__tip-head { font-weight: 600; overflow-wrap: anywhere; }
.graph__tip-line { color: var(--text-2); font-size: var(--fs-xs); overflow-wrap: anywhere; }
.graph__tip-line[hidden] { display: none; }

.graph__status {
  flex: none; min-height: 1.4em; font-size: var(--fs-xs); color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

@container app (min-width: 900px) {
  .page--graph { padding: var(--sp-4) var(--sp-5) var(--sp-4); gap: var(--sp-3); }
  .graph__bar { flex-wrap: nowrap; }
  .graph__find { flex: 0 1 320px; }
  .graph__legend { flex-wrap: wrap; overflow-x: visible; }
  .graph__status { font-size: var(--fs-sm); }
}
.rail__btn--graph .icon { width: 20px; height: 20px; }
/* phone */
/* ===================================================================== phone: touch, zoom, keyboard, safe areas (items 21-25)
   No grey flash on a tap, no double-tap zoom, no pinch zoom (keyboard.js stops gesturestart), and
   a field of 16 px or more on a touch screen so the phone never zooms into it. */
html { touch-action: manipulation; }
* { -webkit-tap-highlight-color: transparent; }
@media (pointer: coarse) {
  input, textarea, select { font-size: max(1rem, var(--fs-md)); }
  .rail-dump .dump__box, .searchfield select.input { font-size: max(1rem, var(--fs-md)); }
}
/* controls are never selected or called out by a long press; messages, card words and fields are */
button, a.row, .rail__btn, .rtab__name, .menu__item, .seg { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }

/* the press: a step smaller and a step darker, within 100 ms; no scale under reduced motion */
.act, .rail__btn, .menu__item, .seg { transition: transform 100ms var(--ease), filter 100ms var(--ease); }
a.row { transition: opacity var(--t-med) var(--ease), background var(--t-fast), transform 100ms var(--ease), filter 100ms var(--ease); }
.act:not(.act--grip):active, .rail__btn:active, a.row:active, .menu__item:active, .seg:active { transform: scale(0.98); filter: brightness(0.92); }
@media (prefers-reduced-motion: reduce) {
  .btn:active, .act:active, .rail__btn:active, a.row:active, .menu__item:active, .seg:active { transform: none; }
}

/* a button whose call is running (aria-busy="true", touch.js busy()): a 14 px ring in place of its icon, no press */
:is(button, .btn, .act)[aria-busy="true"] { pointer-events: none; cursor: progress; }
:is(button, .btn, .act)[aria-busy="true"] > .icon, :is(button, .btn, .act)[aria-busy="true"]::before { display: none; }
:is(button, .btn, .act)[aria-busy="true"]::after {
  content: ""; position: static; inset: auto; flex: none; display: inline-block; width: 14px; height: 14px;
  border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; background: none;
  animation: luna-spin 0.7s linear infinite;
}
@keyframes luna-spin { to { transform: rotate(1turn); } }

/* toasts sit at the top (clear of the composer, the dump box and the bar); a new one slides down */
.toast { animation: luna-toast-in var(--t-med) var(--ease); }
.toast--warn { background: var(--warn); color: var(--warn-ink); }
@keyframes luna-toast-in { from { opacity: 0; transform: translateY(-12px); } }

/* the keyboard (keyboard.js): --kb is its height, html.kb-up while a field has focus and it is up.
   The bottom bar is not drawn, the composer rides on the keys, sheets and menus end at their top. */
html.kb-up .composer { bottom: var(--kb, 0px); }
@container app (max-width: 899.98px) {
  html.kb-up .rail { display: none; }
  html.kb-up .sheet-up, html.kb-up details[data-pop][open] > .menu {
    bottom: var(--kb, 0px); max-height: calc(100dvh - var(--kb, 0px) - var(--safe-top) - 24px);
  }
}

/* wide: the insets the rail column and the dump rail do not already take */
@container app (min-width: 900px) {
  .shell--bare .page { padding-left: calc(var(--sp-6) + var(--safe-left)); }
  .shell:is(.shell--dump, .shell--dump-folded) .page { padding-right: var(--sp-6); }
}

/* ---- the "app is behind" line: the first child of #app, above the shell */
.shellnote {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: var(--sp-2);
  padding: calc(var(--sp-1) + var(--safe-top)) calc(var(--sp-1) + var(--safe-right)) var(--sp-1) calc(var(--sp-4) + var(--safe-left));
  background: var(--warn-soft); color: var(--warn); font-size: var(--fs-sm); font-weight: 500;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.shellnote__text { flex: 1; min-width: 0; }
.shellnote__close { flex: none; margin-left: auto; color: inherit; }
.shellnote ~ .shell { --safe-top: 0px; }   /* the line already clears the notch */

/* ---- hands-free: beside the composer's mic, its label shown only while it is on */
.handsfree[data-state="off"] .handsfree__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.handsfree:not([data-state="off"]) { padding: 0 var(--sp-3); background: var(--accent); color: var(--accent-ink); }
.handsfree[data-state="listening"] { animation: luna-listen var(--pulse) ease-out infinite; }
.handsfree[data-state="sending"] { background: var(--surface-2); color: var(--text-3); }

/* ---- Settings, the app's icon: a 64 px picture leads each row */
.iconset__img { display: block; width: 64px; height: 64px; border-radius: 14px; box-shadow: 0 0 0 1px var(--line); object-fit: cover; }
.row:has(.iconset__img) { min-height: 80px; }
.row:has(.iconset__img) > .row__lead { width: 80px; height: 80px; }
.iconset__note { padding: 0 var(--sp-1); font-size: var(--fs-sm); color: var(--text-3); }
@container app (max-width: 899.98px) { .row:has(.iconset__img) { grid-template-columns: 80px minmax(0, 1fr) auto; } }
/* wide, the rows are the table's subgrid: the table's lead column widens instead */
@container app (min-width: 900px) { .table:has(.iconset__img) { grid-template-columns: 80px var(--cols, minmax(0, 1fr)) max-content max-content; } }
