/* The ZUI shell's frame (MODE-1) and its adaptive layout (ZUI-003). Every rule is scoped under
   html[data-ui='zui'], so the classic view never sees it.

   Tokens (ZUX-015, ADR-0010): every colour, type stack, radius and space is the Patch Bay
   toolkit's (/vendor/patch-bay/patch-bay.zui.css, loaded first, the same tokens as Core). The
   first block below gives the ZUI's older names (--paper, --ink, --muted, --brand…) to those
   tokens and adds the UX team's type scale, touch, focus, motion and meaning aliases, with the
   UX-SPEC section 10 amendments: --fs-* in rem, --agent-border on --line-strong, a --focus-halo
   and the note under --via-blackpath. This sheet holds no raw colour (check-patch-bay ADOPTED);
   the eight zone colours are the toolkit's too (zonePalette, by html[data-zone]). A border that
   is a control's only edge uses --control-line (3:1 on every surface), not --line-strong.

   Colour means four things only: zone colour = stays on member devices, green (--protected) =
   Protected (carried by Black Path, sealed end to end), amber (--via-blackpath) = waiting to
   send or not yet settled, red (--attention) = needs attention.

   Layout (ZUX-015, Core's shell, bp-console shell.css):
   - Phone, under 56rem: the top bar (zone switcher, Search, the status line), the module window,
     the dock, the echo, and a four-slot bottom bar (#zui-bar: Inbox, My tasks, Calendar, More).
     More opens the rail as a sheet in page flow under the top bar. From a viewport height of
     560px the bar is fixed at the bottom and html keeps scroll-padding-bottom equal to its
     height; under 560px tall nothing in the frame is fixed or sticky (WCAG 2.4.11).
   - Wide, 56rem and up: a sticky top bar over a --nav-w rail (grouped pages that roll up and
     down) and the workspace: the module window, a side window at 80rem and up, and the dock.
   - Text screens are held to --col-max; the zone screen (#z-zone) and any [data-wide] element
     keep the full width of #zui-main. Running text never runs wider than --content-max. */

html[data-ui='zui'] {
  /* --- ZUX-015 (ADR-0010): Zone's older names for the Patch Bay toolkit's tokens. Every value is
         the toolkit's (/vendor/patch-bay/patch-bay.zui.css, loaded before this sheet), the same
         as Core's in every theme; --line, --line-strong, --bad, --bg, --s-1 to --s-7, --t-fast,
         --nav-w and --top-h are the toolkit's own names and are not set here. --- */
  --paper: var(--bg);
  --surface: var(--surface-2);
  --raised: var(--surface-3);
  --ink: var(--text);
  --muted: var(--text-2);
  --amber: var(--zone-via);
  --amber-soft: var(--zone-via-bg);
  --good: var(--ok);
  --bad-soft: var(--bad-bg);
  --rail-surface: var(--surface-1);
  --brand: var(--accent);
  --brand-ink: var(--accent-ink);
  --brand-text: var(--accent-text);
  --brand-soft: var(--accent-bg);
  --brand-focus: var(--focus);
  /* The zone's own colour: the toolkit's identity colour, set per zone by html[data-zone]. */
  --zone: var(--zone-identity);
  --zone-soft: var(--zone-identity-bg);
  --on-zone: var(--zone-identity-ink);
  --sans: var(--font-sans);
  --mono: var(--font-mono);
  --r-s: var(--radius);
  --r-m: var(--radius-lg);

  /* --- Shell layout widths. --tabs is in rem (60px at the default text size) so the bottom bar
         grows with the person's text size and still holds an icon and two lines of label. --- */
  --rail: 64px;
  --side: 224px;
  --tabs: 3.75rem;
  --col-max: 44rem; /* ZUI-003: text screens in #zui-main */
  --dock: 20rem; /* ZUI-003: the dock beside #zui-main on wide screens */

  /* --- Type scale, in rem (UX-SPEC 10, tokens.css amendment 1) --- */
  --fs-xs: 0.8125rem; /* chips, kind badges, timestamps, tab labels */
  --fs-s: 0.875rem; /* meta lines, secondary text */
  --fs-m: 1rem; /* body, buttons, inputs */
  --fs-l: 1.125rem; /* card titles, the one sentence that says what happened */
  --fs-xl: 1.375rem; /* screen title on a phone */
  --fs-2xl: 1.75rem; /* zone name and screen title on a wide screen */
  --lh-tight: 1.2;
  --lh-body: 1.5;
  --fw-regular: 400;
  --fw-strong: 600;

  /* --- Touch and focus --- */
  --tap: 44px;
  --target: var(--tap); /* MODE-1's name, kept for the rules that use it */
  --tap-gap: var(--s-2);
  --focus-ring: 2px solid var(--brand-focus);
  --focus-offset: 2px;
  /* UX-SPEC 10 amendment 3: surface-coloured, 2px outside the ring (offset 2 + ring 2 + 2). */
  --focus-halo: 0 0 0 6px var(--surface);
  --content-max: 60ch;
  --edge: 1px; /* hairline borders */
  --mark: 3px; /* the current-tab edge */

  /* --- Motion --- */
  --t-base: var(--t-med);

  /* --- Meaning aliases --- */
  --on-device: var(--zone);
  --on-device-soft: var(--zone-soft);
  --on-device-ink: var(--on-zone);
  /* Protected: carried by Black Path, sealed end to end (the path chip and the chat dock chip).
     Green, on the toolkit's success tokens. */
  --protected: var(--good);
  --protected-soft: var(--ok-bg);
  /* Amber: waiting to send, waiting for you, not yet settled (UX-SPEC 10, tokens.css amendment
     4). It no longer marks the relay path; that is --protected. */
  --via-blackpath: var(--amber);
  --via-blackpath-soft: var(--amber-soft);
  --attention: var(--bad);
  --attention-soft: var(--bad-soft);
  --done: var(--good);

  /* --- Agent-authored surfaces (amendment 2: the border is --line-strong) --- */
  --agent-surface: var(--raised);
  --agent-border: var(--line-strong);

  color-scheme: light;
}

/* Dark, following the system unless the page pins light (the toolkit sets the dark values). */
@media (prefers-color-scheme: dark) {
  html[data-ui='zui']:not([data-theme='light']) {
    color-scheme: dark;
  }
}

/* Dark, pinned by the page. */
html[data-ui='zui'][data-theme='dark'] {
  color-scheme: dark;
}

@media (prefers-reduced-motion: reduce) {
  html[data-ui='zui'] {
    --t-fast: 0ms;
    --t-base: 0ms;
  }
}

html[data-ui='zui'] .shell {
  max-width: 76rem;
}

html[data-ui='zui'] .view,
html[data-ui='zui'] .zui-view {
  /* The bottom bar is cleared by the frame's own padding (below), not by each screen. */
  padding-bottom: calc(env(safe-area-inset-bottom) + var(--s-6));
  min-width: 0;
}

/* ─── the frame (ZUX-015): Core's shell ────────────────────────────────────────
   Phone first: the capture line, the top bar, the window bar, the screen, the dock, the echo, and
   the bottom bar. The rail is a sheet that More opens in page flow right under the top bar (so
   the top bar, reserved chrome, is never covered); the screen is hidden while it is open. */

html[data-ui='zui'] body {
  background: var(--paper);
  font-family: var(--sans);
}

/* The frame spans the window, as Core's .app does; classic's centred column is not the frame. */
html[data-ui='zui'] .shell:has(.zui-frame:not([hidden])) {
  max-width: none;
  margin: 0;
  padding: 0;
}

html[data-ui='zui'] .zui-frame {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    'capture'
    'top'
    'rail'
    'winbar'
    'main'
    'dock'
    'toast'
    'nav';
  align-content: start;
  min-height: 100dvh;
}

html[data-ui='zui'] .zui-frame[hidden] {
  display: none !important;
}

html[data-ui='zui'] .zui-capture {
  grid-area: capture;
}

/* The top bar: Core's .topbar. Switcher, the status line (sync, As of), Search. */
html[data-ui='zui'] .zui-top {
  grid-area: top;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    'head search'
    'status status'
    'alert alert';
  align-items: center;
  column-gap: var(--s-3);
  min-height: var(--top-h);
  padding: var(--s-1) var(--s-4);
  border-bottom: var(--edge) solid var(--line);
  background: var(--rail-surface);
}

html[data-ui='zui'] .zui-chrome {
  display: contents;
}

html[data-ui='zui'] .zui-side-head {
  grid-area: head;
  min-width: 0;
}

html[data-ui='zui'] .zui-search-slot {
  grid-area: search;
}

html[data-ui='zui'] .zui-name {
  margin: 0;
  font-weight: var(--fw-strong);
  /* Wraps between words first; a word is broken only when it alone is wider than the line.
     (anywhere, not break-word, so a long name can never widen the top bar past the screen.) */
  overflow-wrap: anywhere;
}

html[data-ui='zui'] .zui-top .zui-status {
  grid-area: status;
  max-width: none;
  border: 0;
  padding: 0;
  font: var(--fs-xs) / var(--lh-tight) var(--mono);
}

html[data-ui='zui'] .zui-top .zui-alert {
  grid-area: alert;
  max-width: none;
}

/* The rail: Core's .nav. */
html[data-ui='zui'] .zui-rail {
  grid-area: rail;
  display: none;
  min-width: 0;
  padding: var(--s-3) var(--s-3) var(--s-6);
  background: var(--rail-surface);
}

html[data-ui='zui'] .zui-frame[data-sheet='open'] .zui-rail {
  display: block;
}

html[data-ui='zui'] .zui-frame[data-sheet='open'] :is(.zui-winbar, .zui-main, .zui-dock) {
  display: none !important;
}

html[data-ui='zui'] .zui-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  margin-bottom: var(--s-2);
}

html[data-ui='zui'] .zui-sheet-head h2 {
  margin: 0;
  font-size: var(--fs-l);
}

html[data-ui='zui'] .zui-nav {
  min-width: 0;
}

html[data-ui='zui'] .zui-rgroup + .zui-rgroup {
  margin-top: var(--s-2);
}

html[data-ui='zui'] .zui-rgroup-head {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  margin: 0;
  padding: 0 var(--s-2);
  color: var(--muted);
  font: var(--fw-strong) 0.75rem / var(--lh-tight) var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

html[data-ui='zui'] .zui-fold {
  display: flex;
  flex: 1;
  align-items: center;
  gap: var(--s-2);
  min-height: var(--tap);
  margin: 0 calc(-1 * var(--s-2));
  padding: 0 var(--s-2);
  border: 0;
  border-radius: var(--r-s);
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-align: start;
  text-transform: inherit;
  cursor: pointer;
}

html[data-ui='zui'] .zui-fold-name {
  min-width: 0;
  overflow-wrap: break-word;
}

html[data-ui='zui'] .zui-chev {
  width: 1rem;
  height: 1rem;
  flex: none;
  margin-left: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  transition: transform var(--t-fast);
}

html[data-ui='zui'] .zui-fold[aria-expanded='true'] .zui-chev {
  transform: rotate(90deg);
}

html[data-ui='zui'] .zui-rgroup[data-current='true'] .zui-rgroup-head {
  color: var(--ink);
}

html[data-ui='zui'] .zui-rgroup-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Core's .nav-list: a folding group's pages sit on a hairline, indented under the heading. */
html[data-ui='zui'] .zui-rgroup[data-group='zone'] .zui-rgroup-list,
html[data-ui='zui'] .zui-rgroup[data-group='talk'] .zui-rgroup-list {
  margin-left: var(--s-4);
  padding-left: var(--s-2);
  border-left: var(--edge) solid var(--line);
}

html[data-ui='zui'] .zui-rgroup-list[hidden] {
  display: none !important;
}

html[data-ui='zui'] .zui-rgroup[data-group='foot'] {
  margin-top: var(--s-4);
  padding-top: var(--s-2);
  border-top: var(--edge) solid var(--line);
}

/* One page: icon, name, count, and the rollup line under the name. */
html[data-ui='zui'] .zui-nav a {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    'icon label count'
    '. line line';
  align-items: center;
  column-gap: var(--s-2);
  min-height: var(--tap);
  padding: var(--s-1) var(--s-2);
  border-radius: var(--r-s);
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: var(--lh-tight);
  text-decoration: none;
}

html[data-ui='zui'] .zui-nav-icon {
  grid-area: icon;
  width: 1.125rem;
  height: 1.125rem;
  flex: none;
}

html[data-ui='zui'] .zui-nav .zui-nav-label {
  grid-area: label;
  min-width: 0;
  overflow-wrap: break-word;
}

html[data-ui='zui'] .zui-nav .zui-count,
html[data-ui='zui'] .zui-nav .zui-badge {
  grid-area: count;
  font-family: var(--mono);
  font-size: var(--fs-xs);
}

html[data-ui='zui'] .zui-nav .zui-line {
  grid-area: line;
  color: var(--muted);
  font-size: var(--fs-xs);
}

html[data-ui='zui'] .zui-nav .zui-count:empty,
html[data-ui='zui'] .zui-nav .zui-line:empty {
  display: none;
}

html[data-ui='zui'] .zui-rgroup[data-group='home'] a {
  color: var(--ink);
  font-weight: var(--fw-strong);
}

/* The page on show: Core's current nav link. Weight and the ember edge as well as the fill. */
html[data-ui='zui'] .zui-nav a[aria-current='page'] {
  background: var(--brand-soft);
  color: var(--ink);
  font-weight: var(--fw-strong);
  box-shadow: inset var(--mark) 0 0 var(--brand);
}

html[data-ui='zui'] .zui-side-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-3);
}

html[data-ui='zui'] .zui-help-slot:empty {
  display: none;
}

html[data-ui='zui'] .zui-classic {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 var(--s-2);
  border-radius: var(--r-s);
  color: var(--muted);
  font: 500 var(--fs-s) / var(--lh-tight) var(--sans);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* The module window: a title bar (where you are, Roll up / Roll down) over the screen. */
html[data-ui='zui'] .zui-winbar {
  grid-area: winbar;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-width: 0;
  margin: var(--s-4) var(--s-4) 0;
  padding: var(--s-1) var(--s-1) var(--s-1) var(--s-3);
  border: var(--edge) solid var(--line);
  border-radius: var(--r-m) var(--r-m) 0 0;
  background: var(--rail-surface);
}

html[data-ui='zui'] .zui-winbar[hidden] {
  display: none !important;
}

/* Core's breadcrumb path: node, rail, node, in mono. */
html[data-ui='zui'] .zui-winbar .zui-crumbs {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  min-width: 0;
  max-width: none;
  margin: 0;
  color: var(--muted);
  font: var(--fs-xs) / var(--lh-tight) var(--mono);
}

html[data-ui='zui'] .zui-crumb {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  overflow-wrap: break-word;
}

html[data-ui='zui'] .zui-crumb-rail {
  width: 1.375rem;
  height: var(--edge);
  margin: 0 var(--s-2);
  background: var(--line-strong);
}

html[data-ui='zui'] .zui-crumb[aria-current='page'] {
  color: var(--ink);
  font-weight: var(--fw-strong);
}

html[data-ui='zui'] .zui-crumb[aria-current='page']::before {
  content: '';
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 50%;
  background: var(--brand);
}

html[data-ui='zui'] .zui-roll {
  flex: none;
  padding: 0 var(--s-3);
  border: var(--edge) solid var(--control-line);
  border-radius: var(--r-s);
  background: var(--surface);
  color: var(--ink);
  font: 500 var(--fs-s) / var(--lh-tight) var(--sans);
  cursor: pointer;
}

html[data-ui='zui'] .zui-main {
  grid-area: main;
  min-width: 0;
  padding: var(--s-4);
}

html[data-ui='zui'] .zui-winbar:not([hidden]) + .zui-main {
  /* Inside a window the page colour is the window's, so a sticky header (the inbox's) matches. */
  --bg: var(--surface);
  margin: 0 var(--s-4) var(--s-4);
  border: var(--edge) solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--r-m) var(--r-m);
  background: var(--surface);
}

/* Rolled up: only the title bar is left (the window's own state, zui/layout.mjs). */
html[data-ui='zui'] .zui-main[data-rolled='true'] {
  display: none;
}

html[data-ui='zui'] .zui-winbar:has(+ .zui-main[data-rolled='true']) {
  border-radius: var(--r-m);
}

html[data-ui='zui'] .zui-dock {
  grid-area: dock;
  min-width: 0;
}

html[data-ui='zui'] .zui-dock[hidden] {
  display: none !important;
}

/* The echo (ZUI-007) gets its own area, so in page flow it no longer auto-places into the nav row. */
html[data-ui='zui'] .zui-toast {
  grid-area: toast;
}

/* ─── the phone's bottom bar (SHELL.md D1): three pages and More ─────────────── */

html[data-ui='zui'] .zui-bar {
  grid-area: nav;
  min-width: 0;
  border-top: var(--edge) solid var(--line);
  background: var(--rail-surface);
}

html[data-ui='zui'] .zui-bar[hidden] {
  display: none !important;
}

html[data-ui='zui'] .zui-bar ul {
  display: flex;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

html[data-ui='zui'] .zui-bar li {
  display: flex;
  flex: 1 1 0;
  min-width: 0;
}

html[data-ui='zui'] .zui-bar :is(a, .zui-more) {
  display: grid;
  flex: 1;
  justify-items: center;
  align-content: center;
  gap: calc(var(--s-1) / 2);
  min-width: var(--tap);
  min-height: var(--tap);
  margin: 0;
  padding: var(--s-1);
  border: 0;
  background: none;
  color: var(--muted);
  font: 500 var(--fs-xs) / var(--lh-tight) var(--sans);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

html[data-ui='zui'] .zui-bar :is(.zui-nav-icon, .zui-nav-label, .zui-badge) {
  grid-area: auto;
}

/* 1ra.26: at 200% text a long label (Calendar) breaks inside its own cell, never over the next. */
html[data-ui='zui'] .zui-bar .zui-nav-label {
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  hyphens: auto;
}

html[data-ui='zui'] .zui-bar .zui-nav-icon {
  width: 1.5rem;
  height: 1.5rem;
}

html[data-ui='zui'] .zui-bar .zui-badge {
  margin: 0;
}

html[data-ui='zui'] .zui-bar :is(a[aria-current='page'], .zui-more[aria-expanded='true']) {
  color: var(--ink);
  font-weight: var(--fw-strong);
  box-shadow: inset 0 var(--mark) 0 var(--brand);
}

html[data-ui='zui']
  :is(.zui-nav a, .zui-bar a, .zui-more, .zui-fold, .zui-roll, .zui-side-foot a):focus-visible {
  outline: var(--focus-ring);
  outline-offset: calc(-1 * var(--focus-offset));
  box-shadow: none;
}

@media (hover: hover) {
  html[data-ui='zui'] :is(.zui-nav a, .zui-fold, .zui-classic, .zui-bar a, .zui-more):hover {
    background: var(--raised);
    color: var(--ink);
  }

  html[data-ui='zui'] .zui-nav a[aria-current='page']:hover {
    background: var(--brand-soft);
  }
}

/* Phone, 560px tall or more: the bar is fixed at the bottom and everything clears it. */
@media (max-width: 55.99rem) and (min-height: 560px) {
  html[data-ui='zui'] .zui-bar {
    position: fixed;
    inset: auto 0 0;
    z-index: 2;
    box-sizing: border-box;
    height: calc(var(--tabs) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
  }

  html[data-ui='zui']:has(#zui-bar:not([hidden])) {
    scroll-padding-bottom: calc(var(--tabs) + env(safe-area-inset-bottom));
  }

  html[data-ui='zui'] .zui-frame:has(#zui-bar:not([hidden])) {
    padding-bottom: calc(var(--tabs) + env(safe-area-inset-bottom));
  }

  /* The echo, when fixed (600px wide and up, ZUI-007), and a hosted screen's composer sit above
     the bar, not over it. */
  html[data-ui='zui']:has(#zui-bar:not([hidden])) .zui-toast {
    bottom: calc(var(--tabs) + env(safe-area-inset-bottom) + var(--s-4));
  }

  html[data-ui='zui']:has(#zui-bar:not([hidden])) .zui-frame .composer {
    bottom: calc(var(--tabs) + env(safe-area-inset-bottom));
  }
}

/* 600px wide up to 56rem, 560px tall or more: the bar and the echo are both fixed. The bar's
   scroll-padding rule above outranks dialogs.css's echo rule, so with both showing the page
   clears the two together (the echo's own allowance from dialogs.css, on top of the bar). */
@media (min-width: 600px) and (max-width: 55.99rem) and (min-height: 560px) {
  html[data-ui='zui']:has(#zui-bar:not([hidden])):has(.zui-toast:not([hidden])) {
    scroll-padding-bottom: calc(
      var(--tabs) + env(safe-area-inset-bottom) + var(--s-7, 48px) + var(--s-6, 32px)
    );
  }
}

/* Under 560px tall nothing in the frame is fixed or sticky: the bar is in flow (above), the
   echo is in flow (dialogs.css), and a hosted screen's composer joins the page too. */
@media (max-height: 559.98px) {
  html[data-ui='zui'] .zui-frame .composer {
    position: static;
  }
}

/* ─── the content column ───────────────────────────────────────────────────── */

html[data-ui='zui'] .zui-main > :is(section.view, section.zui-view):not(#z-zone):not([data-wide]) {
  max-width: var(--col-max);
  margin-inline-end: auto;
}

html[data-ui='zui'] .zui-frame :is(p, dd, blockquote, figcaption) {
  max-width: var(--content-max);
}

/* Core's headings: Plex 600, tight; the screen title is the window's h1. */
html[data-ui='zui'] .zui-main h1 {
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  font-weight: var(--fw-strong);
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
}

/* Every button in the frame is a 44px target: the theme's 36px .btn and 30px .btn.small are not
   inherited (CHAIN-INPUTS ZUI-003). Core's 6px corners, not a pill. */
html[data-ui='zui'] .zui-frame :is(button, .btn) {
  min-height: var(--tap);
  min-width: var(--tap);
  border-radius: var(--r-s);
}

/* At large text a button label wraps inside the button, not over its edge (1ra.26: Connect
   your calendar was 322 px wide in a 288 px column at 320 px and 200% text). */
html[data-ui='zui'] .zui-frame .btn {
  max-width: 100%;
  padding-block: var(--s-1);
  white-space: normal;
  text-align: center;
}

/* ─── wide: Core's grid, top bar over rail and workspace ─────────────────────── */

@media (min-width: 56rem) {
  html[data-ui='zui'] .zui-frame {
    grid-template-columns: var(--nav-w) minmax(0, 1fr);
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    grid-template-areas:
      'capture capture'
      'top top'
      'rail winbar'
      'rail main'
      'rail toast';
    align-items: start;
  }

  html[data-ui='zui'] .zui-frame:has(#zui-dock:not([hidden])) {
    grid-template-columns: var(--nav-w) minmax(0, 1fr) var(--dock);
    grid-template-areas:
      'capture capture capture'
      'top top top'
      'rail winbar dock'
      'rail main dock'
      'rail toast toast';
  }

  html[data-ui='zui'] .zui-top {
    grid-template-columns: calc(var(--nav-w) - 2 * var(--s-4)) minmax(0, 1fr) auto;
    grid-template-areas:
      'head status search'
      'alert alert alert';
    position: sticky;
    top: 0;
    z-index: 3;
  }

  html[data-ui='zui'] .zui-rail {
    display: block;
    position: sticky;
    top: var(--top-h);
    align-self: stretch;
    box-sizing: border-box;
    max-height: calc(100dvh - var(--top-h));
    overflow-y: auto;
    overscroll-behavior: contain;
    border-right: var(--edge) solid var(--line);
  }

  html[data-ui='zui'] .zui-rail:has(#zui-nav[hidden]) {
    padding-top: var(--s-4);
  }

  html[data-ui='zui'] .zui-sheet-head,
  html[data-ui='zui'] .zui-bar {
    display: none !important;
  }

  html[data-ui='zui'] .zui-winbar {
    margin: var(--s-5) var(--s-5) 0;
  }

  html[data-ui='zui'] .zui-main {
    padding: var(--s-5);
  }

  html[data-ui='zui'] .zui-winbar:not([hidden]) + .zui-main {
    margin: 0 var(--s-5) var(--s-5);
  }

  html[data-ui='zui'] .zui-dock {
    padding: var(--s-5) var(--s-5) var(--s-5) 0;
  }
}

/* Under 560px tall nothing in the frame is sticky, at any width (WCAG 2.4.11). */
@media (max-height: 559.98px) {
  html[data-ui='zui'] :is(.zui-top, .zui-rail) {
    position: static;
    max-height: none;
  }
}

/* The ZUI home: this device's zones. */
html[data-ui='zui'] .zui-zones {
  display: grid;
  gap: var(--s-2);
  margin: 0 0 var(--s-5);
  padding: 0;
  list-style: none;
}

html[data-ui='zui'] .zui-zones li {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  border-left: 4px solid var(--zone);
  border-radius: var(--r-s);
  background: var(--surface);
}

html[data-ui='zui'] .zui-zone-open {
  display: grid;
  flex: 1;
  min-width: 0;
  min-height: var(--target);
  padding: var(--s-2) var(--s-3);
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

html[data-ui='zui'] .zui-zone-open .name {
  font-weight: var(--fw-strong);
  overflow-wrap: break-word;
}

html[data-ui='zui'] .zui-zone-open .sub {
  color: var(--muted);
  font-size: var(--fs-s);
}

html[data-ui='zui'] .zui-zones .btn.small,
html[data-ui='zui'] .zui-view .btn {
  min-height: var(--target);
}

html[data-ui='zui'] .zui-zones .btn.small {
  margin-right: var(--s-2);
}

/* ZUI-008: the shell's status line and standard states (zui/states.mjs). Tone sets colour and
   colour keeps its meanings: amber (--via-blackpath) waiting, red (--attention) needs attention,
   ink with a dashed edge for checking. The chip always carries a word, so colour is never the
   only signal. No spinner and no animation anywhere here. */

html[data-ui='zui'] .zui-status,
html[data-ui='zui'] .zui-alert {
  margin: 0;
  padding: var(--s-2) var(--pad);
  font-size: var(--fs-s);
  color: var(--muted);
  border-bottom: var(--edge) solid var(--line);
}

/* Empty, the two regions collapse but stay rendered: a live region must be in the accessibility
   tree before its text changes, or the change is not announced. Never display: none. */
html[data-ui='zui'] .zui-status:empty,
html[data-ui='zui'] .zui-alert:empty {
  padding: 0;
  border: 0;
}

html[data-ui='zui'] .zui-busy {
  opacity: 0.55;
}

html[data-ui='zui'] .zui-wait {
  margin: var(--s-2) 0;
  color: var(--muted);
}

html[data-ui='zui'] .zui-cause {
  margin: var(--s-3) 0;
  padding: var(--s-3) var(--s-4);
  border-left: 4px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
}

html[data-ui='zui'] .zui-cause.zui-tone-waiting {
  border-left-color: var(--via-blackpath);
  background: var(--via-blackpath-soft);
  color: var(--ink);
}

html[data-ui='zui'] .zui-cause.zui-tone-checking {
  border: var(--edge) dashed var(--line-strong);
  border-left: 4px solid var(--ink);
}

html[data-ui='zui'] .zui-cause.zui-tone-attention,
html[data-ui='zui'] .zui-dismissed.zui-tone-attention {
  background: var(--attention-soft);
  color: var(--attention);
}

html[data-ui='zui'] .zui-cause .zui-chip {
  display: inline-block;
  font-size: var(--fs-xs);
  padding: calc(var(--s-1) / 2) var(--s-2);
  border: var(--edge) solid currentColor;
  border-radius: var(--r-s);
}

html[data-ui='zui'] .zui-cause-attempt {
  margin: var(--s-1) 0 0;
  font-size: var(--fs-s);
}

html[data-ui='zui'] .zui-cause-lead {
  margin: var(--s-1) 0 0;
  font-size: var(--fs-l);
  font-weight: var(--fw-strong);
}

html[data-ui='zui'] .zui-cause-then {
  margin: var(--s-1) 0 0;
  color: var(--muted);
}

html[data-ui='zui'] .zui-cause-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--tap-gap);
  margin-top: var(--s-3);
}

html[data-ui='zui'] .zui-cause-actions button,
html[data-ui='zui'] .zui-empty button,
html[data-ui='zui'] .zui-linkbtn,
html[data-ui='zui'] .zui-dismissed {
  min-height: max(var(--target), 2.75rem);
}

html[data-ui='zui'] .zui-linkbtn,
html[data-ui='zui'] .zui-dismissed {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  text-decoration: underline;
  text-align: left;
  cursor: pointer;
}

html[data-ui='zui'] .zui-dismissed {
  color: var(--muted);
}

html[data-ui='zui'] .zui-cause-full {
  margin-top: var(--s-3);
  padding-top: var(--s-2);
  border-top: var(--edge) solid var(--line);
  font-family: var(--mono);
  font-size: var(--fs-xs);
}

html[data-ui='zui'] .zui-cause-full code {
  display: block;
}

html[data-ui='zui'] .zui-empty-lead {
  margin: 0;
  font-weight: var(--fw-strong);
}

html[data-ui='zui'] .zui-empty-sub {
  margin: var(--s-1) 0 var(--s-3);
  color: var(--muted);
}

/* ZUI-009a: the ask card (zui/ask.mjs; UX-SPEC 2c, the ask prototype). The agent rectangle sits on
   --agent-surface with a 1 px --line-strong edge; every shell control is bordered, 44 px tall,
   8 px apart; the amber left edge marks an item waiting for the person (DECISIONS 1: the chip or
   the Needs you heading carries the words; drop the edge if the real test says so). Red only for
   an answer that did not go through (I5). */
html[data-ui='zui'] {
  --agent-surface: var(--raised);
}

html[data-ui='zui'] .zui-ask {
  margin: 0.75rem 0;
  padding: 0.75rem 1rem;
  border-left: 4px solid transparent;
  background: var(--surface);
  color: var(--ink);
}

html[data-ui='zui'] .zui-ask.zui-waiting {
  border-left-color: var(--via-blackpath);
}

html[data-ui='zui'] .zui-ask.zui-attention {
  border-left-color: var(--attention);
}

html[data-ui='zui'] .zui-ask-chip {
  display: inline-block;
  font-size: 0.8125rem;
  padding: 0.125rem 0.5rem;
  border-radius: var(--r-s);
  border: 1px solid currentColor;
  color: var(--ink);
  background: var(--via-blackpath-soft);
}

html[data-ui='zui'] .zui-byline {
  margin: 0.25rem 0 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

html[data-ui='zui'] .zui-owner,
html[data-ui='zui'] .zui-new,
html[data-ui='zui'] .zui-note,
html[data-ui='zui'] .zui-ask-help,
html[data-ui='zui'] .zui-ask-effect {
  margin: 0.125rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

html[data-ui='zui'] .agent-rect,
html[data-ui='zui'] .zui-ask-shellrect {
  margin: 0.5rem 0;
  padding: 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-s);
  overflow: hidden;
  isolation: isolate;
}

html[data-ui='zui'] .agent-rect,
html[data-ui='zui'] .agent-surface {
  background: var(--agent-surface);
}

html[data-ui='zui'] .zui-ask-question {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

html[data-ui='zui'] .zui-ask-options {
  display: grid;
  gap: 0.5rem;
}

html[data-ui='zui'] .zui-ask-btn,
html[data-ui='zui'] .zui-ask-optbtn {
  min-height: max(var(--target), 2.75rem);
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--control-line);
  border-radius: var(--r-s);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
}

html[data-ui='zui'] .zui-ask-optbtn {
  display: grid;
  width: 100%;
  gap: 0.125rem;
}

html[data-ui='zui'] .zui-ask-optbtn[aria-disabled='true'] {
  opacity: 0.6;
}

html[data-ui='zui'] .zui-ask-label {
  font-weight: 600;
}

html[data-ui='zui'] .zui-ask-cost {
  color: var(--muted);
}

html[data-ui='zui'] .zui-ask-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.25rem;
}

html[data-ui='zui'] .zui-tag {
  font-size: 0.8125rem;
  padding: 0 0.375rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-s);
  background: var(--surface);
}

html[data-ui='zui'] .zui-slot {
  display: inline-block;
  padding: 0 0.375rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-s);
  overflow-wrap: anywhere;
}

html[data-ui='zui'] .zui-ask-shellrow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}

html[data-ui='zui'] .zui-ask-decline {
  display: grid;
  gap: 0.125rem;
}

html[data-ui='zui'] .zui-ask-answer p,
html[data-ui='zui'] .zui-consequence,
html[data-ui='zui'] .zui-ask-moved p {
  margin: 0.5rem 0 0;
}

html[data-ui='zui'] .zui-ask-full {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.8125rem;
}

/* ZUI-009b: the inbox (zui/inbox.mjs; UX-SPEC 2b, the inbox prototype). The header is sticky so
   `{n} new above` and the kill switch stay reachable; the echo is in page flow (ZUI-007), so it
   never covers them. The Needs you heading carries the words; its amber rule is the one colour. */
html[data-ui='zui'] .zui-inbox-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg);
}

html[data-ui='zui'] .zui-inbox-kill,
html[data-ui='zui'] .zui-inbox-newabove {
  display: flex;
  gap: 0.5rem;
}

html[data-ui='zui'] .zui-inbox-status {
  margin: 0.5rem 0;
}

html[data-ui='zui'] .zui-inbox-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

html[data-ui='zui'] .zui-inbox-line {
  margin: 0.25rem 0;
}

html[data-ui='zui'] .zui-inbox-group {
  margin: 1rem 0;
}

html[data-ui='zui'] .zui-inbox-heading {
  margin: 0 0 0.25rem;
  font-size: 1.125rem;
}

html[data-ui='zui'] .zui-inbox-group[data-group='needs'] > .zui-inbox-heading {
  border-left: 4px solid var(--via-blackpath);
  padding-left: 0.5rem;
}

html[data-ui='zui'] .zui-inbox-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

html[data-ui='zui'] .zui-inbox-hidden,
html[data-ui='zui'] .zui-inbox-full {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

html[data-ui='zui'] .zui-inbox-full {
  font-family: var(--mono);
}

html[data-ui='zui'] .zui-badge {
  display: inline-block;
  min-width: 1.5rem;
  margin-left: 0.5rem;
  padding: 0 0.375rem;
  border-radius: var(--r-l);
  font-size: 0.8125rem;
  text-align: center;
  color: var(--ink);
  background: var(--via-blackpath-soft);
}

html[data-ui='zui'] .zui-reply {
  display: grid;
  gap: 0.25rem;
  margin: 0.5rem 0 0;
}

html[data-ui='zui'] .zui-reply-text {
  min-height: 5rem;
  font: inherit;
  font-size: 1rem;
}

/* ── ZUI-011: Settings, grouped (section z-members, views/members.mjs drawZuiMembers) ──────────
   The groups hold classic's own blocks, moved in by id; app.css styles them by class, and none of
   its rules is scoped to .view or #v-members (checked by grep), so they look as in classic.
   Every control here is at least 44 px tall. Nothing sticky or fixed. */

html[data-ui='zui'] #z-members .zui-group {
  margin-top: 1.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}

html[data-ui='zui'] #z-members .zui-group > h2:first-child {
  margin-top: 0;
}

html[data-ui='zui'] #z-members .zui-zone-name {
  margin: 0.25rem 0 0.75rem;
  font-weight: 600;
}

html[data-ui='zui'] #z-members button,
html[data-ui='zui'] #z-members .choice,
html[data-ui='zui'] #z-members label.check,
html[data-ui='zui'] #z-members a {
  min-height: max(var(--target, 44px), 2.75rem);
}

html[data-ui='zui'] #z-members a {
  display: inline-flex;
  align-items: center;
}

html[data-ui='zui'] #z-members .zui-setting-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

html[data-ui='zui'] #z-members .zui-switch[aria-checked='true'] {
  border-color: var(--ink, currentColor);
  box-shadow: inset 0 0 0 2px var(--ink, currentColor);
}

/* ── end ZUI-011 ── */

/* LIVE-1: live data elements (public/zui/live/elements.mjs). Marks are outline only: an --ink
   stroke with a --paper halo, never a fill, never the zone colour, amber or red. Authors differ
   by line style (is-solid, is-dashed, is-dotted, is-double), never by colour. Marks sit in the
   stage by position: absolute only (ui-check rule g: no z-index, fixed or sticky). A stale
   binding dims its strokes with opacity; its words keep their colour, so text stays at 4.5:1. */
html[data-ui='zui'] .live-stage {
  --live-halo: var(--paper, var(--surface));
  --live-stroke: 0.125rem;
  position: relative;
}

html[data-ui='zui'] .live-marks {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

html[data-ui='zui'] .live-mark {
  position: absolute;
  inset: 0;
  background: none;
}

html[data-ui='zui'] .live-shape {
  position: absolute;
  box-sizing: border-box;
  background: none;
  border: var(--live-stroke) solid var(--ink);
  box-shadow: 0 0 0 0.0625rem var(--live-halo);
  transition: opacity 0.2s;
}

html[data-ui='zui'] .live-point {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

html[data-ui='zui'] .live-segment {
  height: 0;
  border-width: var(--live-stroke) 0 0;
  transform-origin: 0 0;
}

html[data-ui='zui'] .is-dashed .live-shape {
  border-style: dashed;
}

html[data-ui='zui'] .is-dotted .live-shape {
  border-style: dotted;
}

html[data-ui='zui'] .is-double .live-shape {
  border-style: double;
  --live-stroke: 0.25rem;
}

html[data-ui='zui'] .live-label {
  position: absolute;
  max-width: 14rem;
  padding: 0.125rem 0.25rem;
  background: var(--live-halo);
  color: var(--ink);
  font-size: 0.8125rem;
  line-height: 1.3;
}

html[data-ui='zui'] .live-label p,
html[data-ui='zui'] .live-readout p,
html[data-ui='zui'] .live-foot p {
  margin: 0;
}

html[data-ui='zui'] .live-readouts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

html[data-ui='zui'] .live-readout {
  padding: 0.5rem;
  border: var(--live-stroke) solid var(--line-strong);
  background: none;
}

html[data-ui='zui'] .live-readout.is-dashed {
  border-style: dashed;
}

html[data-ui='zui'] .live-readout.is-dotted {
  border-style: dotted;
}

html[data-ui='zui'] .live-readout.is-double {
  border-style: double;
}

html[data-ui='zui'] .live-value {
  font-variant-numeric: tabular-nums;
  font-size: 1.25rem;
}

html[data-ui='zui'] .live-spark {
  position: relative;
  width: 6rem;
  height: 2rem;
}

html[data-ui='zui'] .is-stale .live-shape,
html[data-ui='zui'] .live-readout.is-stale .live-spark {
  opacity: 0.4;
}

html[data-ui='zui'] .live-stale-line,
html[data-ui='zui'] .live-age,
html[data-ui='zui'] .live-hidden,
html[data-ui='zui'] .live-meta {
  color: var(--muted);
}

html[data-ui='zui'] .live-meta {
  font-family: var(--mono);
  font-size: 0.8125rem;
}

@media (prefers-reduced-motion: reduce) {
  html[data-ui='zui'] .live-shape {
    transition: none;
  }
}
/* LIVE-1 end. */

/* ZUI-010: the hosts page (views/capabilities.mjs drawHosts, section z-hosts) and the Settings
   link to it. Path chips: zone colour with a round dot (stays on member devices), green with a
   diamond dot (Protected); Needs attention red with a square dot; No price agreed
   in ink. Colour is never the only signal: every chip says its meaning in words. Timeline lines
   carry a 4 px ink rule. rem only. */
html[data-ui='zui'] .zui-hosts,
html[data-ui='zui'] .zui-host-events {
  list-style: none;
  margin: 0;
  padding: 0;
}

html[data-ui='zui'] .zui-host-slot {
  display: grid;
  grid-template-columns: 1.5rem 1fr;
  gap: var(--s-1) var(--s-2);
  padding: var(--s-2) 0;
  border-bottom: var(--edge) solid var(--line);
}

html[data-ui='zui'] .zui-host-slot > svg {
  width: 1.5rem;
  height: 1.5rem;
  fill: none;
  stroke: currentColor;
}

html[data-ui='zui'] .zui-host-cause,
html[data-ui='zui'] .zui-host-actions {
  grid-column: 2;
}

html[data-ui='zui'] .zui-host-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

html[data-ui='zui'] .zui-host-title {
  margin: 0;
  font-weight: 600;
}

html[data-ui='zui'] .zui-host-by,
html[data-ui='zui'] .zui-host-state,
html[data-ui='zui'] .zui-host-sentence,
html[data-ui='zui'] .zui-host-why {
  margin: 0;
}

html[data-ui='zui'] .zui-host-by,
html[data-ui='zui'] .zui-host-why,
html[data-ui='zui'] .zui-host-seen,
html[data-ui='zui'] .zui-host-time {
  color: var(--muted);
  font-size: var(--fs-xs);
}

html[data-ui='zui'] .zui-host-seen::before {
  content: ' · ';
}

html[data-ui='zui'] .zui-host-slot[data-state='off'] .zui-host-state {
  color: var(--muted);
}

html[data-ui='zui'] .zui-host-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1);
  margin: var(--s-1) 0 0;
}

html[data-ui='zui'] .zui-host-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  font-size: var(--fs-xs);
  padding: calc(var(--s-1) / 2) var(--s-2);
  border: var(--edge) solid currentColor;
  border-radius: var(--r-s);
}

html[data-ui='zui'] .zui-host-chip::before {
  content: '';
  width: 0.5rem;
  height: 0.5rem;
  background: currentColor;
}

html[data-ui='zui'] .zui-chip-ondevice {
  background: var(--on-device-soft);
  color: var(--on-device);
}

html[data-ui='zui'] .zui-chip-ondevice::before {
  border-radius: 50%;
}

html[data-ui='zui'] .zui-chip-relay {
  background: var(--protected-soft);
  color: var(--protected);
}

html[data-ui='zui'] .zui-chip-relay::before {
  transform: rotate(45deg);
}

html[data-ui='zui'] .zui-chip-attention {
  background: var(--attention-soft);
  color: var(--attention);
}

html[data-ui='zui'] .zui-chip-noprice {
  color: var(--ink);
}

html[data-ui='zui'] .zui-host-full {
  margin: var(--s-1) 0 0;
  font-family: var(--mono);
  font-size: var(--fs-xs);
}

html[data-ui='zui'] .zui-host-event {
  padding: var(--s-1) 0 var(--s-1) var(--s-2);
  margin: var(--s-2) 0;
  border-left: 0.25rem solid var(--ink);
}

html[data-ui='zui'] .zui-host-what {
  margin: 0;
}

html[data-ui='zui'] .zui-linkrow {
  margin: var(--s-1) 0;
}
/* ZUI-010 end. */

/* Provider groups W1 (zui/groups.mjs): the group card under a hosts slot. Calm layout: the
   sentence first, then plain rows under hairlines, no tiles and no chip (Protected belongs on
   results and receipts, never here). Each state is a word: Online in ok green, Waiting and Busy
   in warn amber, Unavailable muted. The serving device carries the 3 px ember edge, the current
   place mark, plus the word Serving. Tokens and rem only. */
html[data-ui='zui'] .zui-hostgroup {
  margin: var(--s-2) 0 0;
  padding: var(--s-2) 0 0;
  border-top: var(--edge) solid var(--line);
}

html[data-ui='zui'] .zui-hostgroup-title {
  margin: 0;
  font-size: var(--fs-s);
  font-weight: 600;
}

html[data-ui='zui'] .zui-hostgroup-lead {
  margin: var(--s-1) 0 0;
}

html[data-ui='zui'] .zui-hostgroup-rows {
  list-style: none;
  margin: var(--s-2) 0 0;
  padding: 0;
}

html[data-ui='zui'] .zui-hostgroup-row {
  display: grid;
  gap: var(--s-1);
  padding: var(--s-2) 0 var(--s-2) var(--s-2);
  border-top: var(--edge) solid var(--line);
  border-left: 0.1875rem solid transparent;
}

html[data-ui='zui'] .zui-hostgroup-row[aria-current='true'] {
  border-left-color: var(--brand);
}

html[data-ui='zui'] .zui-hostgroup-head,
html[data-ui='zui'] .zui-hostgroup-status {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-1) var(--s-2);
  margin: 0;
}

html[data-ui='zui'] .zui-hostgroup-name {
  font-weight: 600;
}

html[data-ui='zui'] .zui-hostgroup-role,
html[data-ui='zui'] .zui-hostgroup-count,
html[data-ui='zui'] .zui-hostgroup-serving {
  color: var(--muted);
  font-size: var(--fs-xs);
}

html[data-ui='zui'] .zui-hostgroup-word {
  font-weight: 600;
  font-size: var(--fs-s);
}

html[data-ui='zui'] .zui-hostgroup-word.is-online {
  color: var(--ok);
}

html[data-ui='zui'] .zui-hostgroup-word.is-waiting,
html[data-ui='zui'] .zui-hostgroup-word.is-busy {
  color: var(--warn);
}

html[data-ui='zui'] .zui-hostgroup-word.is-unavailable {
  color: var(--muted);
}

html[data-ui='zui'] .zui-hostgroup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin: var(--s-1) 0 0;
}
/* Provider groups W1 end. */

/* ZUI-005: the command palette (zui/palette.mjs) and its Search button (#zui-search-slot, in the
   zone row). The palette is a zui/dialogs.mjs dialog() with the zui-palette class: the same top
   layer and backdrop as every sheet, no new fixed or sticky element, never drawn into .zui-chrome.
   Top-anchored near 12vh like the shell theme prototype's cmdk, and short enough to leave the
   phone's bottom bar clear. Tokens and rem only. Hover and the active option use --zone-soft. */
html[data-ui='zui'] .zui-search-slot {
  margin-left: auto;
}

html[data-ui='zui'] .zui-search-slot:empty {
  display: none;
}

html[data-ui='zui'] .zui-search {
  box-sizing: border-box;
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0 var(--s-3);
  border: 1px solid var(--control-line);
  border-radius: var(--r-s);
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

html[data-ui='zui'] .zui-search[hidden] {
  display: none !important;
}

html[data-ui='zui'] .zui-search:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
  box-shadow: var(--focus-halo);
}

html[data-ui='zui'] .zui-sheet.zui-palette {
  width: min(32rem, 100% - 2 * var(--s-4));
  max-height: calc(88dvh - var(--tabs) - var(--s-4));
  margin: 12vh auto auto;
}

html[data-ui='zui'] .zui-palette-input {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--tap);
  padding: 0 var(--s-3);
  border: 1px solid var(--control-line);
  border-radius: var(--r-s);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

html[data-ui='zui'] .zui-palette-input:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}

html[data-ui='zui'] .zui-palette-list {
  margin: var(--s-2) 0 0;
}

html[data-ui='zui'] .zui-palette-heading {
  padding: var(--s-2) var(--s-3) var(--s-1);
  font-size: var(--fs-s);
  font-weight: var(--fw-strong);
  color: var(--muted);
}

html[data-ui='zui'] .zui-palette-option {
  min-height: var(--tap);
  display: flex;
  align-items: center;
  padding: 0 var(--s-3);
  border-radius: var(--r-s);
  cursor: pointer;
  overflow-wrap: anywhere;
}

html[data-ui='zui'] .zui-palette-option:hover,
html[data-ui='zui'] .zui-palette-option[aria-selected='true'] {
  background: var(--zone-soft);
}

html[data-ui='zui'] .zui-palette-option[aria-selected='true'] {
  outline: 2px solid var(--ink);
  outline-offset: -2px;
}

html[data-ui='zui'] .zui-sheet-body .zui-palette-count {
  margin: var(--s-2) 0 0;
  font-size: var(--fs-s);
  color: var(--muted);
}
/* ZUI-005 end. */

/* ─── ZUI-006: the keyboard model (public/zui/keys.mjs) ──────────────────────── */

/* The skip link: the first focusable thing in the frame, out of sight until it has focus. It is
   absolute, never fixed or sticky, and carries data-skip for layout-proof's exemption anyway. */
html[data-ui='zui'] .zui-skip {
  position: absolute;
  top: var(--s-2);
  left: var(--s-2);
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

html[data-ui='zui'] .zui-skip:focus {
  z-index: 3;
  display: inline-flex;
  align-items: center;
  width: auto;
  height: auto;
  min-height: var(--tap);
  padding: 0 var(--s-3);
  overflow: visible;
  clip-path: none;
  border-radius: var(--r-s);
  background: var(--surface);
  color: var(--ink);
  font-weight: var(--fw-strong);
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
  box-shadow: var(--focus-halo);
}

/* The foot now holds Back to classic and the Keyboard button: they wrap rather than widen. */
html[data-ui='zui'] .zui-side-foot {
  flex-wrap: wrap;
}

/* The key list in the help sheet: each key on its own line, what it does under it. */
html[data-ui='zui'] .zui-keys {
  display: grid;
  gap: var(--s-1);
  margin: 0;
}

html[data-ui='zui'] .zui-keys dt {
  margin-top: var(--s-2);
  font-weight: var(--fw-strong);
}

html[data-ui='zui'] .zui-keys dd {
  margin: 0;
}
/* ZUI-006 end. */

/* LIVE-2: the chat dock (public/zui/chat/dock.mjs and feed.mjs). Three surfaces that cannot be
   confused (authorship SPEC 2): a person's bubble (.chat-bubble: --surface, --line hairline), an
   agent's, robot's or device's rectangle (.chat-rect: --agent-surface, --agent-border), and the
   shell's own line frame (.zui-chat-shell: no box, an ink rule and a small ink square on the page;
   red only for a shell warning). Path chips: zone colour with a round dot, amber with a diamond.
   The composer is in flow, never fixed or sticky (ZUI-003's 560px rule). rem and tokens only. */
html[data-ui='zui'] .zui-chat {
  display: grid;
  gap: var(--s-3);
}

html[data-ui='zui'] .zui-chat-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
}

html[data-ui='zui'] .zui-chat-title {
  margin: 0;
  font-size: var(--fs-l);
}

html[data-ui='zui'] .zui-chat-toggle {
  margin-inline-start: auto;
}

html[data-ui='zui'] .zui-chat-toggle.is-mention {
  background: var(--via-blackpath-soft);
  border-color: var(--via-blackpath);
  color: var(--ink);
}

html[data-ui='zui'] .zui-chat-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  padding: 0 var(--s-2);
  border: var(--edge) solid var(--line-strong);
  border-radius: var(--r-s);
  font-size: var(--fs-xs);
  color: var(--ink);
}

html[data-ui='zui'] .zui-chat-chip::before {
  content: '';
  width: 0.5rem;
  height: 0.5rem;
}

html[data-ui='zui'] .zui-chat-chip.is-direct {
  background: var(--on-device-soft);
}

html[data-ui='zui'] .zui-chat-chip.is-direct::before {
  background: var(--on-device);
  border-radius: 50%;
}

html[data-ui='zui'] .zui-chat-chip.is-relay {
  background: var(--protected-soft);
}

html[data-ui='zui'] .zui-chat-chip.is-relay::before {
  background: var(--protected);
  transform: rotate(45deg);
}

html[data-ui='zui'] .zui-chat-lines {
  display: grid;
  gap: var(--s-3);
  max-height: 60vh;
  overflow-y: auto;
}

html[data-ui='zui'] .zui-chat-item {
  display: grid;
  gap: var(--s-1);
}

html[data-ui='zui'] .zui-chat-item:focus-visible,
html[data-ui='zui'] .zui-chat-lines:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}

html[data-ui='zui'] .zui-chat-byline {
  margin: 0;
  font-size: var(--fs-s);
  overflow-wrap: anywhere;
}

html[data-ui='zui'] .zui-chat-name {
  font-weight: var(--fw-strong);
}

html[data-ui='zui'] .zui-chat-badge {
  padding: 0 var(--s-1);
  border: var(--edge) solid var(--line-strong);
  border-radius: var(--r-s);
  font-size: var(--fs-s);
}

html[data-ui='zui'] .zui-chat-renamed {
  margin-inline-start: var(--s-2);
  color: var(--muted);
}

html[data-ui='zui'] .chat-bubble {
  padding: var(--s-2) var(--s-3);
  background: var(--surface);
  border: var(--edge) solid var(--line);
  border-radius: var(--r-m);
}

html[data-ui='zui'] .chat-rect {
  padding: var(--s-2) var(--s-3);
  background: var(--agent-surface);
  border: var(--edge) solid var(--agent-border);
  border-radius: var(--r-s);
}

html[data-ui='zui'] .chat-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

html[data-ui='zui'] .chat-text.is-system {
  color: var(--muted);
}

html[data-ui='zui'] .chat-linkbtn {
  padding: 0;
  background: none;
  border: none;
  color: inherit;
  text-decoration: underline;
  font: inherit;
}

html[data-ui='zui'] .zui-chat-link {
  display: inline-grid;
}

html[data-ui='zui'] .zui-chat-goes {
  font-size: var(--fs-s);
  overflow-wrap: anywhere;
}

html[data-ui='zui'] .zui-chat-shell {
  position: relative;
  margin: 0;
  padding-inline-start: var(--s-4);
  border-inline-start: 0.25rem solid var(--ink);
}

html[data-ui='zui'] .zui-chat-shell::before {
  content: '';
  position: absolute;
  inset-inline-start: var(--s-1);
  top: 0.5em;
  width: 0.375rem;
  height: 0.375rem;
  background: var(--ink);
}

html[data-ui='zui'] .zui-chat-shell.is-warning {
  border-inline-start-color: var(--attention);
}

html[data-ui='zui'] .zui-chat-receipt p {
  margin: 0;
}

html[data-ui='zui'] .zui-chat-note,
html[data-ui='zui'] .zui-chat-hidden {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-s);
}

html[data-ui='zui'] .zui-chat-meta {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: var(--fs-xs);
}

html[data-ui='zui'] .zui-chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s-2);
  position: static;
}

html[data-ui='zui'] .zui-chat-text {
  min-height: var(--tap);
  font: inherit;
}

html[data-ui='zui'] .zui-chat-cause {
  grid-column: 1 / -1;
}

/* LIVE-5: durable chat. Details beside the header chip, its one explain line, and the composer's
   status row (Waiting to send while an own note is queued). */
html[data-ui='zui'] .zui-chat-more {
  min-height: var(--tap);
  font: inherit;
}

html[data-ui='zui'] .zui-chat-explain {
  margin: 0 0 var(--s-2);
  color: var(--muted);
  font-size: var(--fs-xs);
}

html[data-ui='zui'] .zui-chat-status {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-xs);
}
/* LIVE-5 end. */

@media (forced-colors: active) {
  html[data-ui='zui'] .chat-rect {
    border-style: double;
    border-width: 0.1875rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-ui='zui'] .zui-chat,
  html[data-ui='zui'] .zui-chat * {
    transition: none;
    animation: none;
  }
}
/* LIVE-2 end. */

/* LIVE-3: the path chip (public/zui/live/chip.mjs), media elements (live/media.mjs) and the
   capture indicator (#zui-capture, written by shell.capture()). Chip text is always ink; the
   meaning is in the words, then the edge colour, then the dot shape drawn here by class: round
   on --on-device, diamond on --protected, none for Link lost. Every class that paints a
   reserved colour starts with .zui- (ui-check rule h). No z-index, fixed or sticky anywhere. */
html[data-ui='zui'] .zui-path {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-1);
}

html[data-ui='zui'] .zui-path-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  font: inherit;
  font-size: var(--fs-xs);
  color: var(--ink);
  background: var(--surface);
  padding: calc(var(--s-1) / 2) var(--s-2);
  border: var(--edge) solid var(--line-strong);
  border-radius: var(--r-s);
}

html[data-ui='zui'] button.zui-path-chip {
  cursor: pointer;
}

html[data-ui='zui'] .zui-path-chip.is-ondevice {
  border-color: var(--on-device);
  border-style: solid;
}

html[data-ui='zui'] .zui-path-chip.is-relay {
  border-color: var(--protected);
  border-style: dashed;
}

html[data-ui='zui'] .zui-path-chip.is-ondevice::before,
html[data-ui='zui'] .zui-path-chip.is-relay::before {
  content: '';
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  flex: none;
}

html[data-ui='zui'] .zui-path-chip.is-ondevice::before {
  border-radius: 50%;
  background: var(--on-device);
}

html[data-ui='zui'] .zui-path-chip.is-relay::before {
  transform: rotate(45deg);
  background: var(--protected);
}

html[data-ui='zui'] .zui-path-chip.is-linklost {
  border-color: var(--ink);
}

html[data-ui='zui'] .zui-path-explain {
  font-size: var(--fs-s);
  color: var(--ink);
}
/* Media elements (live/media.mjs). The picture box holds the still or the <video>, with the
   overlay stage beside it, positioned over the picture box by media.mjs (CSSOM only). */
html[data-ui='zui'] .zui-media {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}

html[data-ui='zui'] .zui-media-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
}

html[data-ui='zui'] .zui-media-name {
  margin: 0;
  font-weight: 600;
}

html[data-ui='zui'] .zui-media-byline {
  margin: 0;
  font-size: var(--fs-s);
}

html[data-ui='zui'] .live-media-picture {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: var(--edge) solid var(--line);
  border-radius: var(--r-s);
}

html[data-ui='zui'] .zui-media-el {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  transition: opacity 0.2s;
}

html[data-ui='zui'] .live-media-stage {
  position: absolute;
  pointer-events: none;
}

html[data-ui='zui'] .zui-media-still {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2);
}

html[data-ui='zui'] .zui-media-poster {
  max-width: 100%;
}

html[data-ui='zui'] .zui-media.is-lost .zui-media-el,
html[data-ui='zui'] .zui-media.is-stale .zui-media-el {
  opacity: 0.5;
}

html[data-ui='zui'] .zui-media-twin,
html[data-ui='zui'] .zui-media-note {
  margin: 0;
  font-size: var(--fs-s);
  color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  html[data-ui='zui'] .zui-media-el {
    transition: none;
  }
}
/* The capture indicator (#zui-capture): reserved chrome at the frame's top edge while this device
   captures (A37). Only shell.capture() writes it. The frame gains a top row for it only while it
   shows; the templates repeat ZUI-003's with that row added. */
html[data-ui='zui'] .zui-capture {
  grid-area: capture;
  margin: 0;
  padding: var(--s-1) var(--s-2);
  font-weight: var(--fw-strong);
  color: var(--ink);
  background: var(--surface);
  border: var(--edge) solid var(--ink);
  border-radius: var(--r-s);
}

html[data-ui='zui'] .zui-capture[hidden] {
  display: none !important;
}

html[data-ui='zui'] .zui-frame:has(#zui-capture:not([hidden])) {
  grid-template-areas:
    'capture capture'
    'chrome foot'
    'status status'
    'alert alert'
    'main main'
    'dock dock'
    'toast toast'
    'nav nav';
}

@media (min-width: 56rem) {
  html[data-ui='zui'] .zui-frame:has(#zui-capture:not([hidden])) {
    grid-template-rows: auto auto auto auto auto auto 1fr auto;
    grid-template-areas:
      'capture capture'
      'chrome main'
      'status main'
      'alert main'
      'nav main'
      'foot main'
      '. main'
      '. toast';
  }

  html[data-ui='zui'] .zui-frame:has(#zui-capture:not([hidden])):has(#zui-dock:not([hidden])) {
    grid-template-areas:
      'capture capture capture'
      'chrome main dock'
      'status main dock'
      'alert main dock'
      'nav main dock'
      'foot main dock'
      '. main dock'
      '. toast toast';
  }
}
/* LIVE-3 end. */

/* ZUI-004: the switcher in #zui-side-head and the folded briefing lead on the zones list. The
   per-zone colours are Patch Bay tokens (zonePalette). */
/* The switcher: one button holding the zone's name (span.zui-name keeps the name's wrapping), the
   menu under it in the positioned box (ZUI-007's .zui-menu is position: absolute). Outside a zone
   the button is hidden and the static name shows. */
html[data-ui='zui'] .zui-switcher-box {
  position: relative;
  min-width: 0;
}

html[data-ui='zui'] .zui-switcher {
  box-sizing: border-box;
  display: block;
  max-width: 100%;
  min-width: var(--tap);
  min-height: var(--tap);
  margin: 0;
  padding: 0 var(--s-2);
  border: 1px solid transparent;
  border-radius: var(--r-s);
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: start;
  cursor: pointer;
}

html[data-ui='zui'] .zui-switcher[hidden],
html[data-ui='zui'] .zui-name-static[hidden] {
  display: none !important;
}

html[data-ui='zui'] .zui-switcher:hover {
  border-color: var(--control-line);
}

html[data-ui='zui'] .zui-switcher:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
  box-shadow: var(--focus-halo);
}

html[data-ui='zui'] .zui-switcher-box .zui-menu {
  top: 100%;
  inset-inline-start: 0;
  max-width: min(22rem, 100vw - 2 * var(--s-4));
}

html[data-ui='zui'] .zui-switcher-box .zui-menu-item {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  overflow-wrap: anywhere;
}

html[data-ui='zui'] .zui-switcher-box .zui-menu-item .zui-badge {
  margin-inline-start: auto;
}

/* The zone on show: bold, and the zone's mark at the start edge (the weight is the cue, not the
   colour). */
html[data-ui='zui'] .zui-switcher-box .zui-menu-item[aria-current='true'] {
  font-weight: var(--fw-strong);
  box-shadow: inset 0.25rem 0 0 var(--zone);
}

/* The folded briefing lead above the zones list. The lead is a button only while it counts
   something. */
html[data-ui='zui'] .zui-zones-lead {
  display: grid;
  gap: var(--s-1);
  margin: 0 0 var(--s-4);
}

html[data-ui='zui'] .zui-zones-lead p {
  margin: 0;
}

html[data-ui='zui'] .zui-zones-lead .zui-lead {
  font-weight: var(--fw-strong);
}

html[data-ui='zui'] .zui-zones-lead button.zui-lead {
  box-sizing: border-box;
  min-height: var(--tap);
  padding: 0 var(--s-3);
  border: 1px solid var(--control-line);
  border-radius: var(--r-s);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: var(--fw-strong);
  text-align: start;
  cursor: pointer;
}

html[data-ui='zui'] .zui-zones-lead button.zui-lead:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
  box-shadow: var(--focus-halo);
}

html[data-ui='zui'] .zui-zones-lead .zui-lead-line {
  color: var(--muted);
}

html[data-ui='zui'] .zui-zones-kill[hidden] {
  display: none !important;
}
/* ZUI-004 shell end. */
/* LIVE-4: overlay marks as buttons, legend mode and Details (public/zui/live/overlay.mjs,
   legend.mjs). Ink only: no zone colour, no amber, no red, no colour per author. A mark button is
   fitted round its shapes (at least 2.75rem, 44 px), transparent, and takes pointer events again
   (LIVE-1's .live-marks layer has none). is-late fades the strokes with opacity only; the place
   is unchanged and reduced motion drops the fade. Under stage class is-legend the labels leave the
   picture and each mark shows its number in its corner; the legend list sits under the picture
   (shell chrome, outside the stage). Forced colours drop the halos and keep the outlines. */
html[data-ui='zui'] button.live-mark {
  inset: auto;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  pointer-events: auto;
  cursor: default;
}

html[data-ui='zui'] button.live-mark:focus-visible,
html[data-ui='zui'] button.live-mark.is-current {
  outline: solid 0.1875rem var(--ink);
  outline-offset: 0.125rem;
}

html[data-ui='zui'] button.live-mark .live-label,
html[data-ui='zui'] button.live-mark .live-byline,
html[data-ui='zui'] button.live-mark .live-thinks {
  display: block;
}

html[data-ui='zui'] .live-mark.is-late .live-shape {
  opacity: 0.45;
}

html[data-ui='zui'] .live-num {
  display: none;
}

html[data-ui='zui'] .is-legend .live-label {
  display: none;
}

html[data-ui='zui'] .is-legend .live-num {
  display: block;
  position: absolute;
  left: 0;
  top: 0;
  min-width: 1.25rem;
  padding: 0 0.25rem;
  background: var(--live-halo, var(--surface));
  color: var(--ink);
  border: 0.0625rem solid var(--ink);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  text-align: center;
}

html[data-ui='zui'] .live-overlay-under {
  display: grid;
  gap: 0.5rem;
}

html[data-ui='zui'] .live-legend-head {
  margin: 0;
  font-size: 1rem;
}

html[data-ui='zui'] .live-legend {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.25rem;
}

html[data-ui='zui'] .live-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

html[data-ui='zui'] .live-legend-entry {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.25rem 0.5rem;
  border: 0.0625rem solid var(--line-strong);
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
}

html[data-ui='zui'] .live-legend-entry.is-current,
html[data-ui='zui'] .live-legend-entry:focus-visible {
  outline: solid 0.1875rem var(--ink);
  outline-offset: 0.125rem;
}

html[data-ui='zui'] .live-legend-num {
  min-width: 1.25rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

html[data-ui='zui'] .live-swatch {
  display: inline-block;
  width: 1.5rem;
  height: 0;
  border-top: 0.125rem solid var(--ink);
}

html[data-ui='zui'] .live-swatch.is-dashed {
  border-top-style: dashed;
}

html[data-ui='zui'] .live-swatch.is-dotted {
  border-top-style: dotted;
}

html[data-ui='zui'] .live-swatch.is-double {
  border-top-style: double;
  border-top-width: 0.25rem;
}

html[data-ui='zui'] .live-stage > .live-details {
  position: absolute;
  min-height: 2.75rem;
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  html[data-ui='zui'] .live-mark.is-late .live-shape {
    transition: none;
  }
}

@media (forced-colors: active) {
  html[data-ui='zui'] .live-mark .live-shape,
  html[data-ui='zui'] .is-legend .live-num {
    box-shadow: none;
  }

  html[data-ui='zui'] button.live-mark .live-shape {
    border-color: CanvasText;
  }
}
/* LIVE-4 end. */
/* BUNDLE-1: panels (zui/panel/frame.mjs). A panel is one rectangle on --agent-surface under the
   author's byline, clipped (overflow hidden, isolation isolate) with no positioned layer above
   the shell and nothing inside it hit-testable: the bundle format has no control, link, image,
   style or handler, and pointer events are off for every child. Shell controls (Show this panel,
   Not now, Close panel, Details) sit outside the rectangle in .zui-panel-actions. */
html[data-ui='zui'] .zui-panels {
  margin: var(--s-2) 0;
}

html[data-ui='zui'] .zui-panels[hidden] {
  display: none !important;
}

html[data-ui='zui'] .zui-panel-list {
  display: grid;
  gap: var(--s-2);
}

html[data-ui='zui'] .zui-panel-card {
  display: grid;
  gap: var(--s-1);
}

html[data-ui='zui'] .zui-panel-byline,
html[data-ui='zui'] .zui-panel-title,
html[data-ui='zui'] .zui-panel-line,
html[data-ui='zui'] .zui-panel-note,
html[data-ui='zui'] .zui-panel-log {
  margin: 0;
}

html[data-ui='zui'] .zui-panel-byline {
  font-weight: var(--fw-strong);
}

html[data-ui='zui'] .zui-panel-note,
html[data-ui='zui'] .zui-panel-log {
  color: var(--muted);
}

html[data-ui='zui'] .zui-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1);
}

html[data-ui='zui'] .panel-rect {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  contain: paint;
  max-width: 100%;
  padding: var(--s-2);
  background: var(--agent-surface);
  border: var(--edge) solid var(--agent-border);
  border-radius: var(--r-s);
  color: var(--ink);
}

html[data-ui='zui'] .panel-rect * {
  pointer-events: none;
}

html[data-ui='zui'] .panel-heading {
  margin: 0 0 var(--s-1);
  font-weight: var(--fw-strong);
}

html[data-ui='zui'] .panel-text,
html[data-ui='zui'] .panel-list,
html[data-ui='zui'] .panel-facts {
  margin: 0 0 var(--s-1);
  overflow-wrap: anywhere;
}

html[data-ui='zui'] .panel-facts dt {
  font-weight: var(--fw-strong);
}

html[data-ui='zui'] .panel-facts dd {
  margin: 0 0 var(--s-1);
}

html[data-ui='zui'] .panel-live {
  min-height: 6rem;
}

html[data-ui='zui'] .zui-panel-group-box[hidden] {
  display: none !important;
}

html[data-ui='zui'] .zui-panel-group {
  display: grid;
  gap: var(--s-1);
  padding: 0;
  list-style: none;
}

html[data-ui='zui'] .zui-panel-group li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-1);
}
/* BUNDLE-1 end. */

/* ROBOT-1: the robot views (public/zui/robot/): the reserved strip (#zui-robot-strip), the Full
   view panel and the simple view card (#zui-robots). The stop is ink, never coloured. Red is
   `needs attention` (double line), amber the relay path (dashed); a coloured box
   never holds a button (strip.mjs). Only the zone row and the stop row are sticky, and nothing is
   sticky under 560 px of viewport height (workspace 2c, WCAG 2.4.11). */
html[data-ui='zui'] .zui-robot-strip {
  display: block;
  margin-bottom: var(--s-3);
  border-bottom: var(--edge) solid var(--line-strong);
}

html[data-ui='zui'] .zui-robot-strip[hidden],
html[data-ui='zui'] .zui-robots[hidden] {
  display: none !important;
}

html[data-ui='zui'] .zui-robot-sticky {
  background: var(--surface);
  padding: var(--s-2) 0;
}

@media (min-height: 560px) {
  html[data-ui='zui'] .zui-robot-sticky {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  html[data-ui='zui']:has(.zui-robot-sticky) {
    scroll-padding-top: 8rem;
  }
}

html[data-ui='zui'] .zui-robot-zone {
  margin: 0 0 var(--s-2);
  font-weight: var(--fw-strong);
  border-left: var(--mark) solid var(--zone);
  padding-left: var(--s-2);
}

html[data-ui='zui'] .zui-robot-stoprow,
html[data-ui='zui'] .zui-robot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--tap-gap);
}

html[data-ui='zui'] .zui-robot-btn,
html[data-ui='zui'] .zui-robot-stop {
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 var(--s-3);
  font: inherit;
  font-size: var(--fs-m);
  border-radius: var(--r-s);
  border: var(--edge) solid var(--control-line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

html[data-ui='zui'] .zui-robot-stop {
  font-weight: var(--fw-strong);
  border: 2px solid var(--control-line);
}

html[data-ui='zui'] .zui-robot-stop-off {
  border-style: dashed;
  color: var(--muted);
  cursor: not-allowed;
}

html[data-ui='zui'] .zui-robot-outlined {
  background: transparent;
  border: 2px solid var(--ink);
}

html[data-ui='zui'] .zui-robot-btn:focus-visible,
html[data-ui='zui'] .zui-robot-stop:focus-visible,
html[data-ui='zui'] .zui-robot-heading:focus-visible,
html[data-ui='zui'] .zui-robot-lead:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
  box-shadow: var(--focus-halo);
}

html[data-ui='zui'] .zui-robot-line {
  margin: var(--s-1) 0;
  max-width: var(--content-max);
  overflow-wrap: anywhere;
}

html[data-ui='zui'] .zui-robot-meta,
html[data-ui='zui'] .zui-robot-full,
html[data-ui='zui'] .zui-robot-byline {
  font-size: var(--fs-s);
  color: var(--muted);
}

html[data-ui='zui'] .zui-robot-muted {
  color: var(--muted);
}

html[data-ui='zui'] .zui-robot-rule {
  border-top: var(--edge) solid var(--line);
  padding-top: var(--s-1);
}

html[data-ui='zui'] .zui-robot-red {
  border: 3px double var(--attention);
  background: var(--attention-soft);
  padding: var(--s-2);
  border-radius: var(--r-s);
}

html[data-ui='zui'] .zui-robot-amber {
  border: 2px dashed var(--via-blackpath);
  background: var(--via-blackpath-soft);
  padding: var(--s-2);
  border-radius: var(--r-s);
}

html[data-ui='zui'] .zui-robot-done {
  color: var(--done);
}

/* RB-K1: a hollow dot and the word, never colour alone. */
html[data-ui='zui'] .zui-robot-hollow::before {
  content: '';
  display: inline-block;
  width: 0.6em;
  height: 0.6em;
  margin-right: var(--s-1);
  border: 2px solid var(--ink);
  border-radius: 50%;
}

html[data-ui='zui'] .zui-robot-chip {
  display: inline-block;
  font-size: var(--fs-xs);
  padding: 0 var(--s-1);
  border-radius: var(--r-s);
  border: var(--edge) solid var(--line-strong);
  color: var(--ink);
  background: var(--surface);
}

html[data-ui='zui'] .zui-robot-chip-attention {
  border: 3px double var(--attention);
}

html[data-ui='zui'] .zui-robot-chip-relay {
  border: var(--edge) dashed var(--via-blackpath);
}

html[data-ui='zui'] .zui-robot-chip-ondevice {
  border: var(--edge) solid var(--on-device);
}

html[data-ui='zui'] .zui-robot-panel,
html[data-ui='zui'] .zui-robot-card {
  max-width: var(--col-max);
  margin-bottom: var(--s-4);
  padding: var(--s-3);
  border: var(--edge) solid var(--line);
  border-radius: var(--r-m);
  background: var(--surface);
}

html[data-ui='zui'] .zui-robot-section {
  border-top: var(--edge) solid var(--line);
  padding-top: var(--s-2);
  margin-top: var(--s-3);
}

html[data-ui='zui'] .zui-robot-title,
html[data-ui='zui'] .zui-robot-lead {
  font-size: var(--fs-l);
  margin: 0 0 var(--s-2);
}

html[data-ui='zui'] .zui-robot-heading {
  font-size: var(--fs-m);
  margin: 0 0 var(--s-1);
}

html[data-ui='zui'] .zui-robot-noagent {
  margin-top: var(--s-3);
}

/* The robot's own words: the agent surface, a text node in quotes, never hit-testable. */
html[data-ui='zui'] .robot-text {
  pointer-events: none;
  background: var(--agent-surface);
  border-left: var(--mark) solid var(--agent-border);
  padding: var(--s-1) var(--s-2);
  margin: var(--s-1) 0;
  overflow: hidden;
  isolation: isolate;
}

html[data-ui='zui'] .robot-text-byline {
  font-size: var(--fs-xs);
  color: var(--muted);
  margin: 0;
}

html[data-ui='zui'] .robot-text-quote {
  margin: 0;
  overflow-wrap: anywhere;
}
/* ROBOT-1 end. */

/* CAPTURE-1: capture control (design 12l). The watermark is shell chrome over a discouraged
   picture or panel: last child of the picture box or .panel-rect, above the overlay stage, never
   a target. The blackout toggle and its preview line sit with the person's own preview. */
html[data-ui='zui'] .live-media-picture {
  isolation: isolate;
}

html[data-ui='zui'] .zui-watermark {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-2);
  pointer-events: none;
  user-select: none;
  font-weight: var(--fw-strong);
  color: var(--ink);
  opacity: 0.4;
  text-align: center;
  text-shadow: 0 0 2px var(--surface);
  transform: rotate(-12deg);
  overflow-wrap: anywhere;
}

html[data-ui='zui'] .zui-capture-blackout {
  display: block;
  font-weight: var(--fw-strong);
}

html[data-ui='zui'] .zui-capture-preview-note {
  margin: 0;
  font-size: var(--fs-s);
  color: var(--ink);
}
/* CAPTURE-1 end. */

/* Library and People keep reading width and content boundaries inside the shell. */
html[data-ui='zui'] .work-collection {
  max-inline-size: var(--col-max);
}
html[data-ui='zui'] .work-collection form {
  max-inline-size: var(--col-max);
}
html[data-ui='zui'] .work-page-text {
  max-inline-size: 60ch;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  padding: var(--s-4);
}
html[data-ui='zui'] .work-page-text[data-author-kind='agent'] {
  border-color: var(--agent-border);
}
@media (min-width: 56rem) {
  html[data-ui='zui'] .work-collection .btn {
    inline-size: auto;
    align-self: start;
  }
}

html[data-ui='zui'] .work-member-kind {
  display: inline-block;
  font: var(--fs-s) var(--sans);
  border: 1px solid var(--agent-border);
  border-radius: var(--r-s);
  padding-inline: var(--s-2);
  margin-inline-start: var(--s-2);
}

/* ─── ZUX-015: Core's top bar controls (bp-console shell.css .search-trigger, .zone-switch) ──── */

html[data-ui='zui'] .zui-top .zui-search {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  min-width: 15rem;
  padding: 0 var(--s-3);
  border: var(--edge) solid var(--control-line);
  border-radius: var(--r-s);
  background: var(--paper);
  color: var(--muted);
  font: var(--fs-s) / var(--lh-tight) var(--sans);
}

html[data-ui='zui'] .zui-search-keys {
  margin-left: auto;
  padding: 0 var(--s-1);
  border: var(--edge) solid var(--line-strong);
  border-radius: 4px;
  font: var(--fs-xs) / 1.4 var(--mono);
}

html[data-ui='zui'] .zui-top .zui-switcher {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  border-color: var(--control-line);
  background: var(--surface);
}

html[data-ui='zui'] .zui-top .zui-switcher::after {
  content: '';
  width: 0.4375rem;
  height: 0.4375rem;
  margin: 0 var(--s-1) 0.1875rem var(--s-1);
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

html[data-ui='zui'] .zui-top .zui-switcher .zui-badge {
  margin: 0;
}

@media (max-width: 55.99rem) {
  html[data-ui='zui'] .zui-top .zui-search {
    min-width: var(--tap);
  }

  html[data-ui='zui'] .zui-search-keys {
    display: none;
  }
}

@media (hover: hover) {
  html[data-ui='zui'] .zui-top :is(.zui-search, .zui-switcher):hover {
    border-color: var(--muted);
    color: var(--ink);
  }
}

/* The top bar is sticky on wide screens, so a sticky header inside the window sits under it. */
@media (min-width: 56rem) and (min-height: 560px) {
  html[data-ui='zui'] .zui-main .zui-inbox-head {
    top: var(--top-h);
  }
}

/* ─── ZUX-015: the side window, and the chat dock as a window ───────────────── */

html[data-ui='zui'] .zui-side[hidden],
html[data-ui='zui'] .zui-side-body[hidden],
html[data-ui='zui'] .zui-beside[hidden] {
  display: none !important;
}

html[data-ui='zui'] .zui-beside {
  display: none;
  flex: none;
  padding: 0 var(--s-3);
  border: var(--edge) solid var(--control-line);
  border-radius: var(--r-s);
  background: var(--surface);
  color: var(--ink);
  font: 500 var(--fs-s) / var(--lh-tight) var(--sans);
  cursor: pointer;
}

html[data-ui='zui'] .zui-beside:focus-visible {
  outline: var(--focus-ring);
  outline-offset: calc(-1 * var(--focus-offset));
}

html[data-ui='zui'] .zui-side {
  grid-area: side;
  min-width: 0;
  padding: var(--s-5) var(--s-5) var(--s-5) 0;
}

html[data-ui='zui'] .zui-side .zui-side-bar {
  margin: 0;
}

html[data-ui='zui'] .zui-side-body {
  --bg: var(--surface);
  padding: var(--s-4);
  border: var(--edge) solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--r-m) var(--r-m);
  background: var(--surface);
}

html[data-ui='zui'] .zui-side-bar:has(+ .zui-side-body[hidden]) {
  border-radius: var(--r-m);
}

html[data-ui='zui'] .zui-side-body > :is(section.view, section.zui-view) {
  padding-bottom: 0;
}

@media (min-width: 80rem) {
  html[data-ui='zui'] .zui-beside {
    display: inline-flex;
    align-items: center;
  }

  html[data-ui='zui'] .zui-frame[data-side='1'] {
    grid-template-columns: var(--nav-w) minmax(0, 1fr) minmax(22rem, 0.85fr);
    grid-template-areas:
      'capture capture capture'
      'top top top'
      'rail winbar side'
      'rail main side'
      'rail toast toast';
  }

  html[data-ui='zui'] .zui-frame[data-side='1']:has(#zui-dock:not([hidden])) {
    grid-template-columns: var(--nav-w) minmax(0, 1fr) minmax(22rem, 0.85fr) var(--dock);
    grid-template-areas:
      'capture capture capture capture'
      'top top top top'
      'rail winbar side dock'
      'rail main side dock'
      'rail toast toast toast';
  }
}

@media (max-width: 79.99rem) {
  html[data-ui='zui'] .zui-side {
    display: none !important;
  }
}

/* The chat dock is a window too: Core's panel, its header the title bar, Show / Hide chat its roll. */
html[data-ui='zui'] .zui-dock > .zui-chat {
  gap: 0;
  border: var(--edge) solid var(--line);
  border-radius: var(--r-m);
  background: var(--surface);
  overflow: hidden;
}

html[data-ui='zui'] .zui-dock .zui-chat-head {
  padding: var(--s-1) var(--s-1) var(--s-1) var(--s-3);
  background: var(--rail-surface);
}

html[data-ui='zui'] .zui-dock .zui-chat-head:not(:last-child) {
  border-bottom: var(--edge) solid var(--line);
}

html[data-ui='zui'] .zui-dock .zui-chat-title {
  font: var(--fw-strong) var(--fs-xs) / var(--lh-tight) var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

html[data-ui='zui'] .zui-dock .zui-chat > :not(.zui-chat-head) {
  margin: var(--s-3);
}

@media (max-width: 55.99rem) {
  html[data-ui='zui'] .zui-dock {
    padding: 0 var(--s-4) var(--s-4);
  }
}

/* Core's type in every control in the frame, not the browser's default button face. */
html[data-ui='zui'] .zui-frame :is(button, input, select, textarea) {
  font-family: var(--sans);
}

html[data-ui='zui'] .zui-sheet-close {
  padding: 0 var(--s-3);
  border: var(--edge) solid var(--control-line);
  border-radius: var(--r-s);
  background: var(--surface);
  color: var(--ink);
  font: 500 var(--fs-s) / var(--lh-tight) var(--sans);
  cursor: pointer;
}

/* The dock's own buttons (Details, Show / Hide chat) look like the window bars' buttons; the
   amber `1 for you` toggle keeps its own colours. */
html[data-ui='zui'] .zui-dock .zui-chat-head button:not(.is-mention) {
  padding: 0 var(--s-3);
  border: var(--edge) solid var(--control-line);
  border-radius: var(--r-s);
  background: var(--surface);
  color: var(--ink);
  font: 500 var(--fs-s) / var(--lh-tight) var(--sans);
  cursor: pointer;
}

/* Wide and tall enough for the sticky top bar: a focused skip link is drawn over it, and a heading
   focused or scrolled to is never left under it (WCAG 2.4.11). */
@media (min-width: 56rem) and (min-height: 560px) {
  html[data-ui='zui'] {
    scroll-padding-top: var(--top-h);
  }

  html[data-ui='zui'] .zui-skip:focus {
    z-index: 4;
  }
}

/* Settings, Advanced: one fold, Core's disclosure look, a chevron that turns when open. */
html[data-ui='zui'] .zui-advanced {
  margin-top: var(--s-5);
  border-top: var(--edge) solid var(--line);
}

html[data-ui='zui'] .zui-advanced-head {
  margin: var(--s-2) 0 0;
}

html[data-ui='zui'] .zui-advanced-toggle {
  width: 100%;
  margin: 0;
  font-weight: var(--fw-strong);
}

html[data-ui='zui'] .zui-advanced-toggle::after {
  content: '';
  width: 0.4375rem;
  height: 0.4375rem;
  margin-left: auto;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(-45deg);
  transition: transform var(--t-fast);
}

html[data-ui='zui'] .zui-advanced-toggle[aria-expanded='true']::after {
  transform: rotate(45deg);
}

html[data-ui='zui'] .zui-advanced-body[hidden] {
  display: none !important;
}

html[data-ui='zui'] .zui-advanced-toggle:focus-visible {
  outline: var(--focus-ring);
  outline-offset: calc(-1 * var(--focus-offset));
}

/* The zone's identity colour (data-zone, ZUI-004) stays as a small marker beside its name in the
   switcher; the name says which zone, the dot is never the only cue. */
html[data-ui='zui'] .zui-top .zui-switcher::before {
  content: '';
  flex: none;
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  background: var(--zone);
}

/* ─── ZUX-015: up to three windows (the main one and two side windows) ──────── */

html[data-ui='zui'] .zui-side {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: var(--s-4);
  align-items: start;
}

html[data-ui='zui'] .zui-sidewin {
  min-width: 0;
}

html[data-ui='zui'] .zui-move {
  display: inline-grid;
  place-items: center;
  width: var(--tap);
  padding: 0;
}

html[data-ui='zui'] .zui-move[hidden] {
  display: none !important;
}

html[data-ui='zui'] .zui-move-icon {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
}

html[data-ui='zui'] .zui-move-left .zui-move-icon {
  transform: rotate(180deg);
}

html[data-ui='zui'] :is(.zui-roll, .zui-beside):focus-visible {
  outline: var(--focus-ring);
  outline-offset: calc(-1 * var(--focus-offset));
}

@media (min-width: 100rem) {
  html[data-ui='zui'] .zui-frame[data-side='2'] {
    grid-template-columns: var(--nav-w) minmax(0, 1fr) minmax(0, 1.7fr);
    grid-template-areas:
      'capture capture capture'
      'top top top'
      'rail winbar side'
      'rail main side'
      'rail toast toast';
  }

  html[data-ui='zui'] .zui-frame[data-side='2']:has(#zui-dock:not([hidden])) {
    grid-template-columns: var(--nav-w) minmax(0, 1fr) minmax(0, 1.7fr) var(--dock);
    grid-template-areas:
      'capture capture capture capture'
      'top top top top'
      'rail winbar side dock'
      'rail main side dock'
      'rail toast toast toast';
  }
}

/* A crowded window bar wraps its buttons under the title; a title never breaks inside a word. */
html[data-ui='zui'] .zui-winbar {
  flex-wrap: wrap;
  row-gap: var(--s-1);
}

html[data-ui='zui'] .zui-winbar .zui-crumbs {
  flex: 1 1 8rem;
}

html[data-ui='zui'] .zui-winbar .zui-crumb {
  overflow-wrap: break-word;
}

/* ─── ZUX-015 round 2: Core's top bar (brand, switcher, Search, Chat, theme) ─────────────── */

html[data-ui='zui'] .zui-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-1) var(--s-3);
}

html[data-ui='zui'] .zui-brand {
  order: 1;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: var(--tap);
  border-radius: var(--r-s);
  color: var(--ink);
  font-weight: var(--fw-strong);
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

html[data-ui='zui'] .zui-mark {
  width: 1.75rem;
  height: 1.75rem;
  flex: none;
}

html[data-ui='zui'] .zui-mark .plate {
  fill: var(--ink);
}

html[data-ui='zui'] .zui-mark :is(.seg, .seg-hi) {
  fill: none;
  stroke-width: 56;
  stroke-linecap: round;
  stroke-linejoin: round;
}

html[data-ui='zui'] .zui-mark .seg {
  stroke: var(--rail-surface);
}

html[data-ui='zui'] .zui-mark .seg-hi {
  stroke: var(--brand);
}

html[data-ui='zui'] .zui-brand-tail {
  color: var(--muted);
  font: 500 0.75rem / 1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

html[data-ui='zui'] .zui-top .zui-side-head {
  order: 2;
}

html[data-ui='zui'] .zui-top .zui-status {
  order: 3;
  flex: 1 1 8rem;
}

html[data-ui='zui'] .zui-top .zui-search-slot {
  order: 4;
}

html[data-ui='zui'] .zui-top-tools {
  order: 5;
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

html[data-ui='zui'] .zui-top .zui-alert {
  order: 7;
  flex: 1 0 100%;
}

/* The status line only speaks; the sync line on show is #zui-syncline beside it. */
html[data-ui='zui'] .zui-top .zui-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

html[data-ui='zui'] .zui-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  position: relative;
  padding: 0 var(--s-3);
  border: var(--edge) solid transparent;
  border-radius: var(--r-s);
  background: transparent;
  color: var(--muted);
  font: 500 var(--fs-s) / var(--lh-tight) var(--sans);
  cursor: pointer;
}

html[data-ui='zui'] .zui-tool[hidden],
html[data-ui='zui'] .zui-via-slot[hidden] {
  display: none !important;
}

html[data-ui='zui'] .zui-tool-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

html[data-ui='zui'] .zui-chat-open[aria-expanded='true'] {
  border-color: var(--control-line);
  background: var(--brand-soft);
  color: var(--ink);
}

/* Unread or for-you lines while the dock is closed: an ember dot; the words are in its name. */
html[data-ui='zui'] .zui-chat-open[data-news='true']::after {
  content: '';
  position: absolute;
  top: var(--s-2);
  right: var(--s-2);
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--brand);
}

html[data-ui='zui'] .zui-tool:focus-visible,
html[data-ui='zui'] .zui-brand:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}

@media (hover: hover) {
  html[data-ui='zui'] :is(.zui-tool, .zui-roll):hover {
    background: var(--raised);
    color: var(--ink);
  }
}

@media (max-width: 55.99rem) {
  html[data-ui='zui'] :is(.zui-brand-name, .zui-brand-tail) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  html[data-ui='zui'] .zui-chat-open span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  html[data-ui='zui'] .zui-via-slot {
    display: none;
  }
}

/* ─── ZUX-015 round 2: Core's rail headers, and windows that are the page body ──────────── */

html[data-ui='zui'] .zui-rgroup[data-group] .zui-rgroup-list {
  margin-left: 0;
  padding-left: 0;
  border-left: 0;
}

/* One window: no frame. Core's breadcrumb line, then the page; the window buttons are ghosts. */
html[data-ui='zui'] .zui-winbar {
  border: 0;
  border-radius: 0;
  background: none;
  padding: 0;
}

html[data-ui='zui'] .zui-winbar:not([hidden]) + .zui-main {
  border: 0;
  border-radius: 0;
  background: none;
  --bg: var(--paper);
}

html[data-ui='zui'] .zui-winbar:not([hidden]) + .zui-main {
  padding-inline: 0;
}

html[data-ui='zui'] .zui-roll {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

html[data-ui='zui'] .zui-roll .zui-move-icon {
  transition: transform var(--t-fast);
}

html[data-ui='zui'] .zui-roll[aria-expanded='true'] .zui-move-icon {
  transform: rotate(-90deg);
}

html[data-ui='zui'] .zui-roll[aria-expanded='false'] .zui-move-icon {
  transform: rotate(90deg);
}

html[data-ui='zui'] .zui-roll.zui-move-left .zui-move-icon {
  transform: rotate(180deg);
}

html[data-ui='zui'] .zui-roll {
  width: var(--tap);
  padding: 0;
  display: inline-grid;
  place-items: center;
}

html[data-ui='zui'] .zui-roll .zui-move-icon {
  width: 1.125rem;
  height: 1.125rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
}

/* Side by side, every window is a tile with Core's panel frame, the main one included. */
html[data-ui='zui'] .zui-frame[data-side] .zui-winbar {
  padding: var(--s-1) var(--s-1) var(--s-1) var(--s-3);
  border: var(--edge) solid var(--line);
  border-radius: var(--r-m) var(--r-m) 0 0;
  background: var(--rail-surface);
}

html[data-ui='zui'] .zui-frame[data-side] .zui-winbar:not([hidden]) + .zui-main {
  --bg: var(--surface);
  padding-inline: var(--s-4);
  border: var(--edge) solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--r-m) var(--r-m);
  background: var(--surface);
}

/* ─── ZUX-015 round 2: the Overview's action cards (Core's "What do you want to do?") ───── */

html[data-ui='zui'] .zui-actions[hidden] {
  display: none !important;
}

html[data-ui='zui'] .zui-actions {
  margin-bottom: var(--s-6);
  padding-bottom: var(--s-5);
  border-bottom: var(--edge) solid var(--line);
}

html[data-ui='zui'] .zui-eyebrow {
  margin: 0 0 var(--s-3);
  color: var(--muted);
  font: var(--fw-strong) 0.75rem / var(--lh-tight) var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

html[data-ui='zui'] .zui-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: var(--s-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

html[data-ui='zui'] .zui-action {
  display: grid;
  gap: var(--s-2);
  height: 100%;
  box-sizing: border-box;
  padding: var(--s-4);
  border: var(--edge) solid var(--line);
  border-radius: var(--r-m);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}

html[data-ui='zui'] .zui-action-icon {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--r-s);
  background: var(--brand-soft);
  color: var(--brand-text);
}

html[data-ui='zui'] .zui-action-svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

html[data-ui='zui'] .zui-action-title {
  font-size: var(--fs-l);
  font-weight: var(--fw-strong);
}

html[data-ui='zui'] .zui-action-line {
  color: var(--muted);
  font-size: var(--fs-s);
}

html[data-ui='zui'] .zui-action:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}

@media (hover: hover) {
  html[data-ui='zui'] .zui-action:hover {
    border-color: var(--muted);
  }
}

/* Module buttons (zone-work-builder's screens): Patch Bay's .btn and .btn-primary, Core's look. */
html[data-ui='zui'] .zui-frame .btn {
  border: var(--edge) solid var(--control-line);
  border-radius: var(--r-s);
  background: var(--surface);
  color: var(--ink);
  font: 500 var(--fs-s) / var(--lh-tight) var(--sans);
}

html[data-ui='zui'] .zui-frame .btn:is(.btn-primary, .primary) {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--brand-ink);
}

/* Core's danger: a soft fill with the bad colour as text, never white on red. */
html[data-ui='zui'] .zui-frame .btn.danger {
  border-color: var(--attention);
  background: var(--attention-soft);
  color: var(--attention);
}

@media (hover: hover) {
  html[data-ui='zui'] .zui-frame .btn:hover {
    background: var(--raised);
  }

  html[data-ui='zui'] .zui-frame .btn:is(.btn-primary, .primary):hover {
    background: var(--brand-text);
    border-color: var(--brand-text);
    color: var(--surface);
  }
}

/* ─── ZUX-015 round 2: the Overview below the cards ───────────────────────────── */

/* Your zones lives in the switcher's menu in the new view; the zone screen's copy is not shown. */
html[data-ui='zui'] #z-zone #zones-btn {
  display: none;
}

html[data-ui='zui'] .zui-intro-line {
  margin: var(--s-2) 0 var(--s-3);
  color: var(--muted);
  font-size: var(--fs-l);
}

html[data-ui='zui'] .zui-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin: 0 0 var(--s-5);
}

html[data-ui='zui'] .zui-chip-plain {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-1) var(--s-3);
  border-radius: 999px;
  background: var(--raised);
  color: var(--ink);
  font-size: var(--fs-xs);
  font-weight: 500;
}

html[data-ui='zui'] .zui-chip-zone {
  font-family: var(--mono);
}

html[data-ui='zui'] .zui-chip-zone::before {
  content: '';
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--zone);
}

/* What's available: its own section, rolled up until opened (per device). The finder's own
   heading is the fold's button now, so its repeat inside is not drawn. */
html[data-ui='zui'] .zui-finder-head {
  margin: 0;
}

html[data-ui='zui'] .zui-finder-toggle {
  width: 100%;
  margin: 0;
  font-size: var(--fs-l);
  font-weight: var(--fw-strong);
}

html[data-ui='zui'] .zui-finder-toggle::after {
  content: '';
  width: 0.4375rem;
  height: 0.4375rem;
  margin-left: auto;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(-45deg);
  transition: transform var(--t-fast);
}

html[data-ui='zui'] .zui-finder-toggle[aria-expanded='true']::after {
  transform: rotate(45deg);
}

html[data-ui='zui'] .zui-finder-toggle:focus-visible {
  outline: var(--focus-ring);
  outline-offset: calc(-1 * var(--focus-offset));
}

html[data-ui='zui'] .zui-finder #capability-browser[hidden] {
  display: none !important;
}

html[data-ui='zui'] .zui-finder .capability-intro h2 {
  display: none;
}

html[data-ui='zui'] .zui-finder {
  margin-bottom: var(--s-5);
  border-bottom: var(--edge) solid var(--line);
}

/* Link-buttons take Core's button look: no underline. */
html[data-ui='zui'] .zui-frame a.btn {
  text-decoration: none;
}

/* The zone's name in the switcher wraps inside the button (never widens the top bar): the button
   is a flex box, so its label must be allowed to shrink and to wrap. */
html[data-ui='zui'] .zui-top .zui-switcher .zui-name {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

html[data-ui='zui'] .zui-top .zui-syncline {
  order: 3;
  flex: 1 1 8rem;
  max-width: none;
  margin: 0;
  color: var(--muted);
  font: var(--fs-xs) / var(--lh-tight) var(--mono);
}

/* F6 lands on a landmark (tabindex -1): the landmark shows where focus went. */
html[data-ui='zui']
  :is(#zui-top, #zui-nav, #zui-main, #zui-dock, .zui-sidewin, #zui-bar):focus-visible {
  outline: var(--focus-ring);
  outline-offset: calc(-1 * var(--focus-offset));
}

/* ZOS-028: outside text (mail) wraps inside its frame at any width (WCAG 1.4.10 reflow) and the
   frame reads as a frame; Mail rows wrap long words instead of widening the page. */
html[data-ui='zui'] .zui-outside {
  margin: 0;
  max-inline-size: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-s);
  padding: var(--s-3);
}
html[data-ui='zui'] .zui-outside-text {
  margin: 0;
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
html[data-ui='zui'] [class^='zui-mail'],
html[data-ui='zui'] [class*=' zui-mail'] {
  min-inline-size: 0;
  overflow-wrap: anywhere;
}

/* ─── 1ra.22: before a zone exists ─────────────────────────────────────────────────────────
   No rail (Core draws none before you are in): the page takes the width under the top bar. The
   static zone name is not drawn beside the brand; the brand names the app, the switcher the zone
   once there is one. The Keyboard button sits in the top bar at every stage. */
html[data-ui='zui'] .zui-top .zui-name-static {
  display: none;
}

html[data-ui='zui'] .zui-top .zui-help-slot {
  order: 6;
}

html[data-ui='zui'] .zui-top .zui-help-slot .zui-help {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-width: var(--tap);
  min-height: var(--tap);
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

@media (min-width: 56rem) {
  html[data-ui='zui'] .zui-frame[data-inzone='false'] .zui-rail {
    display: none;
  }

  html[data-ui='zui'] .zui-frame[data-inzone='false'] {
    grid-template-columns: 0 minmax(0, 1fr);
  }
}

/* 1ra.23 (journey-verifier, 320px): under 400px the Keyboard button is its icon alone, so the top
   bar stays one row; the label is still its accessible name. */
@media (min-width: 25rem) {
  html[data-ui='zui'] .zui-help .zui-tool-icon {
    display: none;
  }
}

@media (max-width: 24.99rem) {
  html[data-ui='zui'] .zui-help .zui-help-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  html[data-ui='zui'] .zui-top .zui-help-slot .zui-help {
    justify-content: center;
    padding-inline: 0;
  }
}

/* ─── 1ra.23: first run (z-setup), Core's page head and a form column ────────────────────── */
html[data-ui='zui'] .zui-setup .page-head h1 {
  margin: 0 0 var(--s-2);
}

html[data-ui='zui'] .zui-setup-lede {
  margin: 0 0 var(--s-5);
  color: var(--muted);
  font-size: var(--fs-l);
}

html[data-ui='zui'] .zui-setup-form {
  max-width: 32rem;
}

html[data-ui='zui'] .zui-setup .fine {
  max-width: 32rem;
  margin-top: var(--s-4);
  color: var(--muted);
  font-size: var(--fs-s);
}

/* 1ra.23: Add a device (z-share), three steps as Patch Bay panels in a column. */
html[data-ui='zui'] .zui-share .zui-step {
  max-width: 44rem;
  margin-bottom: var(--s-4);
}

html[data-ui='zui'] .zui-share .zui-step[hidden] {
  display: none !important;
}

/* 1ra.23: model chat (z-chat): the empty state and the pickers in a readable column. */
html[data-ui='zui'] .zui-modelchat > :not(.page-head) {
  max-width: 44rem;
}

/* 1ra.23: calls and rooms (z-call, z-room) in a readable column under Core's page head. */
html[data-ui='zui'] :is(.zui-call, .zui-room) > :not(.page-head) {
  max-width: 44rem;
}

/* 1ra.23: the entry screens (join, invite link, waiting, voice link) in a readable column. */
html[data-ui='zui'] :is(.zui-join, .zui-link, .zui-wait, .zui-voice) > :not(.page-head) {
  max-width: 36rem;
}

html[data-ui='zui'] .zui-join .page-head {
  flex-direction: row;
  align-items: center;
  gap: var(--s-2);
}

/* ─── 1ra.23: the Overview (z-zone), Core's page head with the zone's own tools ──────────── */
html[data-ui='zui'] .zui-overview .page-head {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
}

html[data-ui='zui'] .zui-overview-tools {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

/* ─── 1ra.23: the phone top bar on one row, down to 320 (journey-verifier) ─────────────────
   Under 56rem: Search is its icon (the word stays its name), the zone's name in the switcher is
   cut with an ellipsis (the button's name stays the whole name), and once in a zone the Keyboard
   button moves into the More sheet (#zui-sheet-keys). The sync line takes its own line. */
html[data-ui='zui'] .zui-search-icon,
html[data-ui='zui'] .zui-sheet-keys {
  display: none;
}

@media (max-width: 55.99rem) {
  html[data-ui='zui'] .zui-top {
    column-gap: var(--s-2);
  }

  html[data-ui='zui'] .zui-top .zui-side-head {
    flex: 1 1 0;
    min-width: 0;
  }

  html[data-ui='zui'] .zui-top :is(.zui-switcher-box, .zui-switcher) {
    min-width: 0;
    max-width: 100%;
  }

  html[data-ui='zui'] .zui-top .zui-switcher::after {
    flex: none;
  }

  html[data-ui='zui'] .zui-top .zui-switcher .zui-name {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow-wrap: normal;
  }

  html[data-ui='zui'] .zui-top .zui-search {
    justify-content: center;
    padding: 0;
  }

  html[data-ui='zui'] .zui-search-icon {
    display: block;
  }

  html[data-ui='zui'] .zui-search-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  html[data-ui='zui'] .zui-top-tools {
    gap: 0;
  }

  html[data-ui='zui'] .zui-top .zui-tool {
    min-width: var(--tap);
    padding: 0;
  }

  html[data-ui='zui'] .zui-frame:not([data-inzone='false']) .zui-top .zui-help-slot {
    display: none;
  }

  html[data-ui='zui'] .zui-top .zui-syncline {
    order: 8;
    flex: 1 0 100%;
  }

  html[data-ui='zui'] .zui-top .zui-syncline:empty {
    display: none;
  }

  html[data-ui='zui'] .zui-sheet-keys {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: var(--tap);
    margin-top: var(--s-3);
    padding: 0 var(--s-3);
    border: var(--edge) solid var(--control-line);
    border-radius: var(--r-s);
    background: var(--surface);
    color: var(--ink);
    font: 500 var(--fs-s) / var(--lh-tight) var(--sans);
    cursor: pointer;
  }

  html[data-ui='zui'] .zui-sheet-keys:focus-visible {
    outline: var(--focus-ring);
    outline-offset: var(--focus-offset);
  }
}

/* Agent drafts keep the author's line breaks; long words wrap instead of widening the card. */
html[data-ui='zui'] .zui-draft-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Flow remix (zone-build/flow/design/FLOW.md 3.1 to 3.3). Sizes in rem; secondary text in ink.
   The draft's agent box scrolls inside after 24rem and never clips; a bordered left rule marks
   it, so the cue survives forced colours. */
html[data-ui='zui'] .zui-draft-rect {
  max-height: 24rem;
  overflow-y: auto;
  border: var(--edge) solid var(--agent-border);
  border-inline-start: 0.25rem solid var(--agent-border);
}

html[data-ui='zui'] .zui-draft-rect mark,
html[data-ui='zui'] .zui-answer mark {
  background: var(--amber-soft);
  color: var(--ink);
  border: var(--edge) solid var(--amber);
  border-radius: var(--r-s);
}

html[data-ui='zui'] .zui-draft-heading {
  font-size: var(--fs-l);
  margin: 0;
}

html[data-ui='zui'] .zui-draft-warn {
  color: var(--ink);
  font-size: var(--fs-m);
  border-inline-start: 0.25rem solid var(--amber);
  padding-inline-start: var(--s-2);
}

html[data-ui='zui'] .zui-draft-more {
  display: flex;
  flex-wrap: wrap;
  gap: var(--tap-gap);
}

/* What came back: a bordered box in ink, first in a replied ask row. */
html[data-ui='zui'] .zui-answer {
  border: var(--edge) solid var(--line-strong);
  border-radius: var(--r-s);
  padding: var(--s-2) var(--s-3);
  color: var(--ink);
  font-size: var(--fs-m);
}

html[data-ui='zui'] .zui-answer p {
  margin: 0;
}

/* Where the words go, beside Ask: amber when they leave or it is not known, the zone colour when
   they stay on members' devices. Words always come with the colour. */
html[data-ui='zui'] .zui-ask-go {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--tap-gap);
}

html[data-ui='zui'] .zui-path {
  display: inline-block;
  padding: var(--s-1) var(--s-2);
  border-radius: var(--r-s);
  font-size: var(--fs-s);
  color: var(--ink);
  border: var(--edge) solid var(--amber);
  background: var(--amber-soft);
}

html[data-ui='zui'] .zui-path-local {
  border-color: var(--on-device);
  background: var(--on-device-soft);
}

html[data-ui='zui'] .zui-path-where summary,
html[data-ui='zui'] .zui-jump {
  min-height: 1.5rem;
  font-size: var(--fs-s);
  color: var(--ink);
}

html[data-ui='zui'] .zui-ask-limits {
  color: var(--ink);
  font-size: var(--fs-s);
}

/* F-9: a control this person may not use stays focusable, dimmed and struck, its reason beside it. */
html[data-ui='zui'] .zui-notyours[aria-disabled='true'] {
  opacity: 0.7;
  text-decoration: line-through;
}

html[data-ui='zui'] .zui-notyours-why {
  color: var(--ink);
  font-size: var(--fs-s);
}

html[data-ui='zui'] .zui-agent-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-3);
}

/* Flow remix item 12 and 13: the zone's home and its directory. */
html[data-ui='zui'] .zui-home {
  margin-block: var(--s-3);
}

html[data-ui='zui'] .zui-home-pick {
  display: flex;
  flex-wrap: wrap;
  gap: var(--tap-gap);
  border: 0;
  padding: 0;
  margin: 0;
}

html[data-ui='zui'] .zui-home-pick label {
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
}

html[data-ui='zui'] .zui-welcome:empty {
  display: none;
}

html[data-ui='zui'] .zui-welcome {
  border: var(--edge) solid var(--line-strong);
  border-radius: var(--r-s);
  padding: var(--s-2) var(--s-3);
}

html[data-ui='zui'] .zui-cando {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--s-2);
}

html[data-ui='zui'] .zui-cando-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-1) var(--s-3);
  border-block-end: var(--edge) solid var(--line);
  padding-block: var(--s-2);
}

html[data-ui='zui'] .zui-cando-row p {
  margin: 0;
}

html[data-ui='zui'] .zui-cando-title {
  flex: 1 1 12rem;
  font-weight: var(--fw-strong);
}

html[data-ui='zui'] .zui-cando-who,
html[data-ui='zui'] .zui-cando-ready {
  color: var(--ink);
  font-size: var(--fs-s);
}

@media (forced-colors: active) {
  html[data-ui='zui'] .zui-welcome,
  html[data-ui='zui'] .zui-path,
  html[data-ui='zui'] .zui-answer,
  html[data-ui='zui'] .zui-draft-rect,
  html[data-ui='zui'] .zui-draft-warn,
  html[data-ui='zui'] .zui-draft-rect mark {
    border-color: CanvasText;
    forced-color-adjust: auto;
  }
}

/* ADR-0012: ZUI regions (zui/zuis/zui-view.mjs LAYOUT_CLASS). One column under 56rem. */
html[data-ui='zui'] .zui-zuis-region {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-4);
}

html[data-ui='zui'] .zui-zuis-block {
  min-width: 0;
}

html[data-ui='zui'] .zui-zuis-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (min-width: 56rem) {
  html[data-ui='zui'] .zui-zuis-columns-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  html[data-ui='zui'] .zui-zuis-columns-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  html[data-ui='zui'] .zui-zuis-sidebar {
    grid-template-columns: minmax(0, 1fr) minmax(14rem, 19rem);
  }
}

/* ADR-0014 slice C1: Add an API (zui/import/import-page.mjs, section z-import). Groups and actions
   are plain lists under one rule each; a data-changing group says so in words under its name; the query-key warning carries the attention edge. Calls are mono. rem only. */
html[data-ui='zui'] .zui-import-pick {
  margin-top: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  font-weight: var(--fw-strong);
}

html[data-ui='zui'] .zui-import-file {
  min-height: var(--tap);
  font: inherit;
  font-weight: var(--fw-regular);
}

html[data-ui='zui'] .zui-import-head {
  margin: var(--s-4) 0 var(--s-2);
}

html[data-ui='zui'] .zui-import-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-4);
}

html[data-ui='zui'] .zui-import-reasons,
html[data-ui='zui'] .zui-import-groups,
html[data-ui='zui'] .zui-import-ops {
  margin: 0;
  padding: 0;
  list-style: none;
}

html[data-ui='zui'] .zui-import-reasons > li {
  padding: var(--s-2) 0;
  border-bottom: var(--edge) solid var(--line);
}

html[data-ui='zui'] .zui-import-warn {
  padding: var(--s-2) var(--s-3);
  border-inline-start: 0.25rem solid var(--attention);
  background: var(--attention-soft);
}

html[data-ui='zui'] .zui-import-groups > li {
  padding: var(--s-3) 0;
  border-bottom: var(--edge) solid var(--line);
}

html[data-ui='zui'] .zui-import-group,
html[data-ui='zui'] .zui-import-tick {
  display: grid;
  grid-template-columns: var(--tap) 1fr;
  align-items: center;
  min-height: var(--tap);
  column-gap: var(--s-1);
}

/* The box stands beside both lines (the name and its call, or the group and Can change data). */
html[data-ui='zui'] .zui-import-group:has(> :nth-child(3)) > input,
html[data-ui='zui'] .zui-import-tick > input {
  grid-row: 1 / span 2;
}

html[data-ui='zui'] .zui-import-group > span,
html[data-ui='zui'] .zui-import-tick > :not(input) {
  grid-column: 2;
}

html[data-ui='zui'] .zui-import-group {
  font-weight: var(--fw-strong);
}

html[data-ui='zui'] .zui-import-changes {
  font-size: var(--fs-s);
  font-weight: var(--fw-regular);
}

html[data-ui='zui'] .zui-import-op {
  display: grid;
  padding: var(--s-1) 0 var(--s-1) calc(var(--tap) + var(--s-1));
}

html[data-ui='zui'] .zui-import-op > .zui-import-tick {
  margin-inline-start: calc(-1 * (var(--tap) + var(--s-1)));
}

html[data-ui='zui'] .zui-import-call {
  font-family: var(--mono);
  font-size: var(--fs-s);
  color: var(--muted);
  overflow-wrap: anywhere;
}

html[data-ui='zui'] .zui-import-group > input,
html[data-ui='zui'] .zui-import-tick > input {
  justify-self: center;
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--brand);
}
