/* Smart Solution portals — the shared UI library ("Swiss precision"): one stylesheet for the
 * Issuer, the client portal, Sales, Passes and the holder page (internal/platform/ui).
 *
 * Typographic and flat, after the Minimalism & Swiss Style guidance for enterprise tools: IBM Plex
 * Sans and Mono, a strict spacing scale, thin rules instead of floating shadowed cards, small
 * radii, ink text with one accent (Smart Solution blue), green kept for "issued / valid", a solid
 * navy sidebar as the brand anchor. Pages use the full width of the window; components adapt to
 * the space they are given (container queries), not to the window.
 *
 * ui.css is these parts joined in a fixed order (ui.go, cssParts); each portal's own stylesheet
 * comes after it. No external assets (the Content-Security-Policy forbids them). Every colour is
 * a token defined once with light-dark(), so light and dark come from the same line. The <html>
 * element carries the person's preferences and the page's context:
 *   data-theme        system | light | dark
 *   data-accent       tensai | teal | violet | amber | graphite
 *   data-density      comfortable | compact
 *   data-text         normal | large
 *   data-motion       system | reduce
 *   data-sidebar      expanded | collapsed
 *   data-theme-store  account | device | staff-preview (where a theme change is kept, theme.js)
 *   data-portal       issuer | client | sales | passes | holder
 * A portal's stylesheet may set only the accent family (through data-accent), --nav-bg,
 * --nav-bg-2, --nav-accent, --font-display, --sidebar-w and --topbar-h (tokens_test.go).
 * Contrast of every text/background pair is checked by scripts/tools/contrast.py
 * (WCAG 2.2: 4.5:1 for text, 3:1 for control borders, marks and large text).
 */

/* ── tokens ─────────────────────────────────────────────────────────── */
:root {
  color-scheme: light dark;

  /* neutrals. Light: soft navy-tinted greys, nothing pure white, easy on the eyes for a
     working day. Dark: deep Smart Solution navy. */
  --canvas:        light-dark(#e3e7ed, #0a1220);
  --surface:       light-dark(#f1f3f6, #101b2e);
  --surface-2:     light-dark(#ebeef2, #142139);
  --surface-3:     light-dark(#e0e5eb, #1a2a45);
  --surface-sunk:  light-dark(#e7eaef, #0d1626);
  --line:          light-dark(#cdd4dd, #213250);
  --line-strong:   light-dark(#b4becb, #2d4164);
  --control-line:  light-dark(#737f94, #6b7d9b);
  --text:          light-dark(#12203a, #e5eaf2);
  --text-2:        light-dark(#28364f, #c2cbd9);
  --muted:         light-dark(#475569, #97a4b9);
  --faint:         light-dark(#535f73, #8693a9);
  --on-solid:      #ffffff;

  /* status tones: text on its soft background, a solid fill, and a border */
  --ok-text:       light-dark(#0d6640, #5fd3a0);
  --ok-soft:       light-dark(#d9eee3, #0d2a22);
  --ok-solid:      light-dark(#178048, #3ec487);
  --ok-line:       light-dark(#9fd0b7, #1d4d3c);
  --warn-text:     light-dark(#824200, #f3b862);
  --warn-soft:     light-dark(#f4e6cf, #2c1f0e);
  --warn-solid:    light-dark(#b35c00, #f0a640);
  --warn-line:     light-dark(#e3c28e, #5a3e17);
  --bad-text:      light-dark(#a8201a, #f8897d);
  --bad-soft:      light-dark(#f4dedb, #331718);
  --bad-solid:     light-dark(#c4321f, #f07b6e);
  --bad-line:      light-dark(#e6aba3, #5e2624);
  --bad-ink:       light-dark(#ffffff, #1a0705);
  --info-text:     light-dark(#0f50b0, #85b4ff);
  --info-soft:     light-dark(#dbe5f3, #12223f);
  --info-line:     light-dark(#acc4e8, #263d68);
  --neutral-text:  light-dark(#36435a, #c3cad8);
  --neutral-soft:  light-dark(#dde2e9, #1f2c43);

  /* accent: Smart Solution blue (see [data-accent] below for the others) */
  --accent:        light-dark(#005dae, #2a6cb8);
  --accent-hover:  light-dark(#004c8e, #245fa3);
  --accent-ink:    #ffffff;
  --accent-text:   light-dark(#00529b, #80b6ee);
  --accent-soft:   light-dark(#d7e3f1, #12274a);
  --accent-soft-2: light-dark(#c3d5ea, #19335c);
  --accent-on-soft:light-dark(#003e75, #bbd5f5);

  /* the brand: Smart Solution navy and gold; Tensai blue and green (the product's logo) */
  --brand-navy:    #1c3355;
  --brand-gold:    #bf8a2f;
  --gold-text:     light-dark(#7a5311, #e2b865);
  --brand-green:   #3bba92;
  --tensai-blue:   #3354a3;

  /* the navigation: Smart Solution navy in both themes, gold marks the current page */
  --nav-bg:        light-dark(#1c3355, #0f1b30);
  --nav-bg-2:      light-dark(#284572, #1b2d4c);
  --nav-line:      light-dark(#2b456e, #1e2f4d);
  --nav-text:      #ffffff;
  --nav-text-2:    #c9d3e4;
  --nav-muted:     #9aa9c2;
  --nav-accent:    #e2b259;

  /* chart series */
  --chart-1: var(--accent);
  --chart-2: light-dark(#1b8f64, #3bba92);
  --chart-3: light-dark(#94661a, #e2b259);
  --chart-4: light-dark(#c4321f, #f07b6e);
  --chart-grid: var(--line);

  /* elevation is reserved for things that float (menus, dialogs, toasts) */
  --shadow-xs: none;
  --shadow-sm: light-dark(0 1px 2px rgba(12, 18, 32, .06), 0 1px 2px rgba(0, 0, 0, .4));
  --shadow-md: light-dark(0 4px 14px rgba(12, 18, 32, .08), 0 4px 14px rgba(0, 0, 0, .5));
  --shadow-lg: light-dark(0 16px 40px rgba(12, 18, 32, .16), 0 16px 40px rgba(0, 0, 0, .6));
  --ring: color-mix(in srgb, var(--accent) 45%, transparent);

  --font: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: var(--font);
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;

  --r-sm: 3px;
  --r-md: 4px;
  --r-lg: 6px;
  --r-xl: 8px;

  /* density (an 8px rhythm) */
  --fs: 14px;
  --ctl-h: 36px;
  --row-pad: 11px;
  --card-pad: 20px;
  --gap: 20px;
  --gutter: clamp(16px, 1.6vw + 6px, 40px);
  --sidebar-w: 248px;
  --topbar-h: 56px;
  --ease: 140ms cubic-bezier(.2, .7, .3, 1);
}

/* A theme chosen is that theme only: "only" stops a browser's own forced dark mode (Chrome's
   Auto Dark Mode for Web Contents, which otherwise draws a page set to Light in the dark colours
   below). The plain value first, for a browser that does not know "only". */
:root[data-theme="light"] { color-scheme: light; color-scheme: only light; }
:root[data-theme="dark"]  { color-scheme: dark; color-scheme: only dark; }

:root[data-accent="teal"] {
  --accent: light-dark(#0f7a5c, #13836a); --accent-hover: light-dark(#0b634a, #0f7560);
  --accent-text: light-dark(#0c6e52, #62d7b1);
  --accent-soft: light-dark(#e1f4ed, #10291f); --accent-soft-2: light-dark(#c9eadd, #173a2d);
  --accent-on-soft: light-dark(#0a5640, #94e4c8);
}
:root[data-accent="violet"] {
  --accent: light-dark(#5a45c0, #6a55cc); --accent-hover: light-dark(#4836a3, #5c47c0);
  --accent-text: light-dark(#5240b5, #b9abf7);
  --accent-soft: light-dark(#efebfb, #221c3f); --accent-soft-2: light-dark(#e0d9f8, #2e2556);
  --accent-on-soft: light-dark(#3e2f93, #d2c9fa);
}
:root[data-accent="amber"] {
  --accent: light-dark(#87601a, #8f661c); --accent-hover: light-dark(#6f4e14, #7c5818);
  --accent-text: light-dark(#79540f, #e2b865);
  --accent-soft: light-dark(#efe4cf, #2b2313); --accent-soft-2: light-dark(#e6d4b1, #3b2f16);
  --accent-on-soft: light-dark(#5a3d08, #f0d49b);
}
:root[data-accent="graphite"] {
  --accent: light-dark(#363f4e, #646f82); --accent-hover: light-dark(#252c38, #586274);
  --accent-text: light-dark(#363f4e, #d4dae2);
  --accent-soft: light-dark(#eceef2, #232a35); --accent-soft-2: light-dark(#dde1e7, #2d3542);
  --accent-on-soft: light-dark(#1f2733, #e2e6ec);
}

:root[data-density="compact"] {
  --fs: 13.5px; --ctl-h: 32px; --row-pad: 7px; --card-pad: 16px; --gap: 16px; --topbar-h: 52px;
}
:root[data-text="large"] { --fs: 15.5px; }
:root[data-density="compact"][data-text="large"] { --fs: 15px; }
@media (min-width: 2200px) { :root[data-text="normal"]:not([data-density="compact"]) { --fs: 15px; } }
/* Motion: "system" follows the computer's setting, "reduce" always turns it off. */
:root[data-motion="reduce"] *, :root[data-motion="reduce"] *::before, :root[data-motion="reduce"] *::after,
:root[data-motion="reduce"] dialog::backdrop { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  :root[data-motion="system"] *, :root[data-motion="system"] *::before, :root[data-motion="system"] *::after { animation: none !important; transition: none !important; }
}
:root[data-sidebar="collapsed"] { --sidebar-w: 68px; }

/* ── component tokens ─────────────────────────────────────────────────
   Derived from the base tokens above, for the library's components (select, menu, popover,
   dialog, toast, palette). Portals never set them (tokens_test.go). */
:root {
  /* controls and focus */
  --ui-ctl-h: var(--ctl-h);
  --ui-ctl-bg: var(--surface);
  --ui-ctl-line: var(--control-line);
  --ui-ctl-line-hover: var(--text-2);
  --ui-ctl-radius: var(--r-md);
  --ui-focus: var(--accent);
  --ui-ring: var(--ring);
  /* popups: lists, menus, popovers */
  --ui-pop-bg: var(--surface);
  --ui-pop-line: var(--line-strong);
  --ui-pop-shadow: var(--shadow-lg);
  --ui-pop-radius: var(--r-lg);
  /* rows of lists and menus: under the pointer a quiet tint; where the keys are a tint and a
     2px accent ring; chosen in accent text with a tick */
  --ui-row-h: 36px;
  --ui-row-hover-bg: var(--surface-3);
  --ui-row-active-bg: var(--accent-soft);
  --ui-row-active-ring: var(--accent-text);
  --ui-row-selected-fg: var(--accent-text);
  --ui-head-fg: var(--faint);
  /* what a search matched, painted with the Highlight API: a brand-gold tint (the light value
     is the guides' highlight) */
  --ui-match-bg: light-dark(#f4dca3, #4a3a17);
  --ui-match-fg: var(--text);
  /* other */
  --ui-shade: light-dark(rgba(8, 14, 26, .45), rgba(2, 5, 12, .62));
  --ui-z-pop: 400;
  --ui-z-toast: 80;
  --ui-motion: 120ms cubic-bezier(.2, .7, .3, 1);
}
:root[data-density="compact"] { --ui-row-h: 32px; }
/* ── fonts (SIL Open Font Licence: fonts/OFL.txt) ───────────────────── */
/* Relative to ui.css, so the fonts carry the library's version in their address too. */
@font-face {
  font-family: "IBM Plex Sans"; font-style: normal; font-weight: 100 700; font-display: swap;
  src: url(fonts/ibm-plex-sans-latin.woff2) format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/ibm-plex-mono-400-latin.woff2) format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap;
  src: url(fonts/ibm-plex-mono-500-latin.woff2) format("woff2");
}
/* ── base ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
html { font-size: var(--fs); }
/* Keyboard focus never lands under the sticky bars (WCAG 2.2, 2.4.11): the window scrolls a
   field into view clear of the top bar, and of a form's sticky save bar at its foot. */
html { scroll-padding-top: calc(var(--topbar-h) + 12px); }
html:has(.form-actions) { scroll-padding-bottom: 84px; }
html:has(.form-actions.float) { scroll-padding-bottom: 96px; }
body {
  font: 400 1rem/1.5 var(--font);
  color: var(--text);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern";
  /* A long address or file path breaks rather than push the page sideways (WCAG 1.4.10). */
  overflow-wrap: break-word;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
/* A link inside running text is underlined as well as coloured, so it is not told apart by
   colour alone (WCAG 2.1, 1.4.1). A link that stands alone (a table's, a list's title, a menu's,
   a button) keeps its look. */
:where(p, li, dd, figcaption, blockquote, .help, .hint, .li-sub, .ph-desc, .card-sub, .form-actions, .note, .empty, .small, .muted) a:not([class]) {
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, currentColor 55%, transparent);
}
:where(p, li, dd, figcaption, blockquote, .help, .hint, .li-sub, .ph-desc, .card-sub, .form-actions, .note, .empty, .small, .muted) a:not([class]):hover { text-decoration-color: currentColor; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--text); text-wrap: balance; }
h1 { font: 600 1.72rem/1.2 var(--font); letter-spacing: -.018em; }
h2 { font-size: 1rem; font-weight: 600; letter-spacing: -.003em; }
h3 { font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
p { margin: 0 0 .75em; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }
code, kbd, .mono { font-family: var(--mono); font-size: .92em; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--gap) 0; }
img { max-width: 100%; }
svg.i { width: 17px; height: 17px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
svg.i-sm { width: 14px; height: 14px; }
svg.i-lg { width: 21px; height: 21px; }
svg.i-xl { width: 26px; height: 26px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
::selection { background: var(--accent-soft-2); }
/* ── environment ribbon ─────────────────────────────────────────────── */
.env {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px; border-radius: var(--r-sm);
  font: 600 .7rem/1 var(--mono); letter-spacing: .06em; text-transform: uppercase;
  background: var(--warn-soft); color: var(--warn-text); border: 1px solid var(--warn-line);
  white-space: nowrap;
}
.env::before { content: ""; width: 6px; height: 6px; background: var(--warn-solid); }
.env-staging { background: var(--info-soft); color: var(--info-text); border-color: var(--info-line); }
.env-staging::before { background: var(--info-text); }

/* ── app shell ──────────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns var(--ease); }

/* Its own layer, over the page and the top bar, so the portal switcher's menu opens over them. */
.sidebar {
  position: sticky; top: 0; z-index: 35; height: 100vh; overflow: hidden auto;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--nav-bg); color: var(--nav-text-2);
  padding: 0 10px 12px;
  scrollbar-width: thin; scrollbar-color: var(--nav-line) transparent;
}
/* On navy (the sidebar, a portal's navy bar marked .nav-dark) the focus ring is gold: the accent
   blue would not stand out against it (3:1). A menu's or popover's panel is light again. */
.sidebar :focus-visible, .nav-dark :focus-visible, .nav-dark .seg label:has(input:focus-visible) { outline-color: var(--nav-accent); }
.sidebar .dd-panel :focus-visible, .nav-dark .dd-panel :focus-visible { outline-color: var(--accent); }
.sb-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; height: var(--topbar-h); margin: 0 -10px 10px; padding-inline: 18px;
  border-bottom: 1px solid var(--nav-line); color: var(--nav-text); }
.sb-brand:hover { text-decoration: none; }
/* The portal switcher: the brand opens a directory of the portals, numbered like an index. */
.pswitch { margin: 0 -10px 10px; }
.pswitch > .sb-brand { margin: 0; list-style: none; cursor: pointer; }
.pswitch > .sb-brand::-webkit-details-marker { display: none; }
.pswitch > .sb-brand:hover { background: rgba(255, 255, 255, .05); }
.pswitch > .sb-brand:focus-visible { outline: 2px solid var(--nav-accent); outline-offset: -2px; }
.ps-caret { margin-left: auto; color: var(--nav-muted); display: grid; transition: transform var(--ease); }
.pswitch[open] .ps-caret { transform: rotate(180deg); color: var(--nav-accent); }
[data-sidebar="collapsed"] .ps-caret { display: none; }
.ps-panel { width: 360px; max-width: calc(100vw - 24px); padding: 0; overflow: hidden; }
.ps-panel > .ps-head { display: flex; justify-content: space-between; padding: 11px 14px 9px; border-bottom: 1px solid var(--line);
  font: 500 .66rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.ps-list { list-style: none; margin: 0; padding: 0; }
.ps-list li + li { border-top: 1px solid var(--line); }
.ps-item { position: relative; display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: start; gap: 0 10px;
  padding: 12px 14px; color: var(--text); }
a.ps-item:hover { background: var(--surface-3); text-decoration: none; }
a.ps-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ps-item.is-here { background: var(--surface-2); }
.ps-item.is-here::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--gold-text); }
.ps-num { font: 500 .78rem/1.2rem var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.ps-text { display: grid; gap: 3px; min-width: 0; }
.ps-name { font-weight: 600; line-height: 1.2rem; }
.ps-note { font-size: .8rem; color: var(--muted); line-height: 1.35; }
/* The host is on its own line: a long one (issuer-admin.uat.…) is cut short, never overlaps. */
.ps-host { margin-top: 2px; font: .7rem/1.3 var(--mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps-go { align-self: center; display: grid; color: var(--muted); transition: transform var(--ease), color var(--ease); }
a.ps-item:hover .ps-go, a.ps-item:focus-visible .ps-go { color: var(--accent-text); transform: translateX(2px); }
.ps-here { font: 500 .64rem/1.2rem var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--gold-text); }
.ps-foot { margin: 0; padding: 10px 14px 12px; border-top: 1px solid var(--line); font-size: .76rem; color: var(--muted); line-height: 1.4; }
.ps-box { border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; margin: 4px 0 16px; }
.ps-box-head { padding: 9px 14px 8px; border-bottom: 1px solid var(--line); font: 500 .7rem/1 var(--mono); letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); }
.sb-logo { width: 30px; height: 30px; flex: none; border-radius: var(--r-md); display: grid; place-items: center; background: #ffffff; color: var(--brand-navy); }
.sb-logo svg { width: 18px; height: 18px; }
.sb-mark { width: 34px; height: 34px; flex: none; display: block; }
.sb-name { display: grid; gap: 5px; font: 600 .98rem/1.15 var(--font); letter-spacing: .01em; }
.sb-name small { display: block; font: 500 .68rem/1 var(--font); color: var(--nav-muted); letter-spacing: .12em; text-transform: uppercase; }
/* The Tensai logo: Tensai blue and green; white and green on navy. */
.wordmark { display: block; height: 15px; width: auto; }
.tw-a { fill: var(--tw-a, var(--tensai-blue)); }
.tw-b { fill: var(--tw-b, var(--brand-green)); }
.sidebar, .auth-side, .cp-top { --tw-a: #ffffff; }
.sb-section { margin: 16px 10px 6px; font: 600 .68rem/1 var(--font); text-transform: uppercase; letter-spacing: .1em; color: var(--nav-muted); }
.sidebar nav > div { display: grid; gap: 4px; align-content: start; }
.sb-link {
  position: relative; display: flex; align-items: center; gap: 11px;
  height: 36px; padding: 0 10px; border-radius: var(--r-md);
  color: var(--nav-text-2); font-weight: 450; white-space: nowrap;
  transition: background var(--ease), color var(--ease);
}
.sb-link:hover { background: rgba(255, 255, 255, .07); color: var(--nav-text); text-decoration: none; }
.sb-link.is-active { background: var(--nav-bg-2); color: var(--nav-text); font-weight: 550; }
.sb-link.is-active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; background: var(--nav-accent); }
.sb-link .i { opacity: .85; }
.sb-link.is-active .i { opacity: 1; color: var(--nav-accent); }
.sb-count { margin-left: auto; min-width: 22px; padding: 0 6px; height: 19px; border-radius: var(--r-sm); display: inline-grid; place-items: center;
  font: 500 .72rem/1 var(--mono); background: rgba(255, 255, 255, .1); color: var(--nav-text); }
.sb-link.is-active .sb-count { background: rgba(255, 255, 255, .16); }
/* a link that opens in a new tab (the guides): a small, quiet arrow at the end, brighter on hover */
.sb-ext { margin-left: auto; display: inline-flex; color: var(--nav-muted); opacity: .7; }
.sb-ext .i { width: 13px; height: 13px; }
.sb-link:hover .sb-ext { opacity: 1; color: var(--nav-text); }
.sb-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--nav-line); display: grid; gap: 4px; }
.sb-toggle { background: none; border: 0; font: inherit; cursor: pointer; width: 100%; }
[data-sidebar="collapsed"] .sb-name, [data-sidebar="collapsed"] .sb-section, [data-sidebar="collapsed"] .sb-label,
[data-sidebar="collapsed"] .sb-count, [data-sidebar="collapsed"] .sb-ext { display: none; }
[data-sidebar="collapsed"] .sb-link { justify-content: center; padding: 0; }
[data-sidebar="collapsed"] .sb-brand { justify-content: center; padding-inline: 0; }
[data-sidebar="collapsed"] .sb-toggle .i { transform: rotate(180deg); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 var(--gutter);
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.tb-search {
  display: flex; align-items: center; gap: 10px; flex: 0 1 460px; height: 34px; padding: 0 6px 0 11px;
  border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--faint);
  font: inherit; cursor: pointer; text-align: left;
  transition: border-color var(--ease), background var(--ease);
}
.tb-search:hover { border-color: var(--control-line); background: var(--surface); }
.tb-search .tb-search-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-search .kbd { flex: none; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 5px;
  border-radius: var(--r-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--muted); font: 500 .7rem/1 var(--mono);
}
/* Full width: pages use the whole window; text keeps a readable measure (see .measure). */
.content { width: 100%; padding: 28px var(--gutter) 72px; container: page / inline-size; }
.content-narrow { max-width: none; }
/* ── page head ──────────────────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px 24px; margin-bottom: 24px; flex-wrap: wrap;
  padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.ph-main { min-width: 0; flex: 1 1 420px; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: .84rem; color: var(--muted); margin-bottom: 10px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.crumbs .i { width: 13px; height: 13px; opacity: .55; }
.ph-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ph-desc { color: var(--muted); margin-top: 6px; max-width: 80ch; }
.ph-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.page-head:has(.crumbs) .ph-actions { margin-top: 28px; }

/* ── layout helpers ─────────────────────────────────────────────────── */
.stack { display: grid; gap: var(--gap); align-content: start; }
.stack-sm { display: grid; gap: 10px; align-content: start; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grid { display: grid; gap: var(--gap); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.auto-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
/* A main column and an aside that grows with the window. */
.split { grid-template-columns: minmax(0, 1fr) clamp(320px, 23vw, 460px); align-items: start; }
.split:not(:has(> :nth-child(2))) { grid-template-columns: minmax(0, 1fr); }
.split-wide { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.sticky-side { position: sticky; top: calc(var(--topbar-h) + 20px); }
@media (max-height: 900px) { .sticky-side { position: static; } }
.measure { max-width: 76ch; }
.form-narrow { max-width: 620px; }
.pair-wide { display: grid; gap: var(--gap); align-content: start; }
@container page (min-width: 1700px) {
  .pair-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .pair-wide > .span-all { grid-column: 1 / -1; }
}
/* ── cards: thin rules, no shadow ───────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px var(--card-pad); border-bottom: 1px solid var(--line); min-height: 52px; }
.card-head.plain { border-bottom: 0; padding-bottom: 4px; }
.card-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.card-title > .i { display: none; } /* titles are typographic; no decorative icons */
.card-title h2 { font-size: .98rem; }
.card-sub { color: var(--muted); font-size: .86rem; margin-top: 2px; max-width: 90ch; }
.card-body { padding: var(--card-pad); }
.card-body.flush { padding: 0; }
.card-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 11px var(--card-pad); border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card-foot.between { justify-content: space-between; }
a.card { display: block; color: inherit; transition: border-color var(--ease); }
a.card:hover { text-decoration: none; border-color: var(--control-line); }
.card-danger { border-color: var(--bad-line); }
.card-danger .card-head { border-bottom-color: var(--bad-line); }
/* ── buttons ────────────────────────────────────────────────────────── */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--text); --btn-line: var(--line-strong); --btn-hover: var(--surface-3);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: var(--ctl-h); padding: 0 14px; border-radius: var(--r-md);
  border: 1px solid var(--btn-line); background: var(--btn-bg); color: var(--btn-fg);
  font: 500 .93rem/1 var(--font); white-space: nowrap; cursor: pointer; user-select: none;
  transition: background var(--ease), border-color var(--ease), color var(--ease);
}
.btn:hover { background: var(--btn-hover); text-decoration: none; }
.btn:active { transform: translateY(.5px); }
.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-primary { --btn-bg: var(--accent); --btn-fg: var(--accent-ink); --btn-line: var(--accent); --btn-hover: var(--accent-hover); }
.btn-primary:hover { border-color: var(--accent-hover); }
.btn-ghost { --btn-bg: transparent; --btn-line: transparent; --btn-hover: var(--surface-3); color: var(--text-2); }
.btn-danger { --btn-bg: var(--bad-solid); --btn-fg: var(--bad-ink); --btn-line: var(--bad-solid); --btn-hover: color-mix(in srgb, var(--bad-solid) 88%, #000); }
.btn-danger-soft { --btn-bg: var(--surface); --btn-fg: var(--bad-text); --btn-line: var(--bad-line); --btn-hover: var(--bad-soft); }
.btn-sm { height: calc(var(--ctl-h) - 6px); padding: 0 10px; font-size: .86rem; gap: 6px; border-radius: var(--r-sm); }
.btn-lg { height: calc(var(--ctl-h) + 8px); padding: 0 20px; font-size: 1rem; }
.btn-icon { width: var(--ctl-h); padding: 0; }
.btn-icon.btn-sm { width: calc(var(--ctl-h) - 6px); }
.btn-block { width: 100%; }
.btn .i { width: 16px; height: 16px; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--r-md) 0 0 var(--r-md); }
.btn-group .btn:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }
.btn-group .btn + .btn { margin-left: -1px; }
.linkbtn { font: inherit; color: var(--accent-text); background: none; border: 0; padding: 0; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; text-underline-offset: 3px; }
.iconbtn {
  position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-md);
  background: transparent; border: 1px solid transparent; color: var(--text-2); cursor: pointer; transition: background var(--ease);
}
.iconbtn:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.iconbtn.tb-menu { display: none; }
.dot-badge { position: absolute; top: 3px; right: 1px; box-sizing: border-box; min-width: 17px; height: 17px; padding: 0 4px; border-radius: var(--r-sm);
  background: var(--bad-solid); color: var(--bad-ink); font: 600 .64rem/17px var(--mono); text-align: center; }
@media (pointer: coarse) { .btn-sm { height: 40px; } }
/* ── badges ─────────────────────────────────────────────────────────── */
.badge {
  --b-fg: var(--neutral-text); --b-bg: var(--neutral-soft);
  display: inline-flex; align-items: center; gap: 6px; height: 21px; padding: 0 7px; border-radius: var(--r-sm);
  font: 500 .76rem/1 var(--font); white-space: nowrap; color: var(--b-fg); background: var(--b-bg);
}
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 1px; background: currentColor; }
.badge.lg { height: 24px; padding: 0 9px; font-size: .82rem; }
.tone-info    { --b-fg: var(--info-text); --b-bg: var(--info-soft); }
.tone-ok      { --b-fg: var(--ok-text);   --b-bg: var(--ok-soft); }
.tone-warn    { --b-fg: var(--warn-text); --b-bg: var(--warn-soft); }
.tone-bad     { --b-fg: var(--bad-text);  --b-bg: var(--bad-soft); }
.tone-accent  { --b-fg: var(--accent-on-soft); --b-bg: var(--accent-soft); }
.tone-neutral { --b-fg: var(--neutral-text); --b-bg: var(--neutral-soft); }
/* A short code (QA, TEST, REQUIRED): mono, outlined, on one line (a narrow column scrolls in its
   .table-wrap rather than squeezing it). */
.tag { display: inline-flex; align-items: center; height: 19px; padding: 0 6px; border-radius: var(--r-sm); font: 500 .68rem/1 var(--mono);
  letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; background: transparent; color: var(--text-2); border: 1px solid var(--line-strong); }
.tag-test { color: var(--warn-text); border-color: var(--warn-line); background: var(--warn-soft); }
/* A label in words (a permission, a category). */
.chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: var(--r-sm);
  background: var(--surface-3); color: var(--text-2); font: 450 .8rem/1 var(--font); white-space: nowrap; }
.chip.sm { height: 18px; padding: 0 6px; font-size: .74rem; vertical-align: 1px; }

/* ── alerts ─────────────────────────────────────────────────────────── */
.alert {
  --a-fg: var(--info-text); --a-bg: var(--info-soft); --a-line: var(--info-line);
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r-md);
  background: var(--a-bg); color: var(--text); border: 1px solid var(--a-line); border-left-width: 3px; margin-bottom: var(--gap);
}
.alert > .i { color: var(--a-fg); margin-top: 2px; }
.alert-title { font-weight: 600; color: var(--a-fg); }
.alert .alert-body { flex: 1; min-width: 0; max-width: 100ch; }
.alert p { margin: 2px 0 0; color: var(--text-2); }
.alert.tone-ok   { --a-fg: var(--ok-text);   --a-bg: var(--ok-soft);   --a-line: var(--ok-line); }
.alert.tone-warn { --a-fg: var(--warn-text); --a-bg: var(--warn-soft); --a-line: var(--warn-line); }
.alert.tone-bad  { --a-fg: var(--bad-text);  --a-bg: var(--bad-soft);  --a-line: var(--bad-line); }
.alert.compact { padding: 9px 12px; margin-bottom: 0; }
/* A refused form's banner: the fields the server marked, each a link to its field (forms.js). */
.alert .alert-list { margin: 6px 0 0; padding-left: 18px; color: var(--text-2); }
.alert .alert-list li + li { margin-top: 2px; }
.alert .alert-list a { color: var(--a-fg); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.alert[tabindex="-1"]:focus-visible { outline-offset: 3px; }
/* ── toasts ─────────────────────────────────────────────────────────── */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: grid; gap: 10px; width: min(400px, calc(100vw - 40px)); }
.toast {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line-strong); border-left: 3px solid var(--ok-solid); box-shadow: var(--shadow-lg); color: var(--text);
  animation: toast-in 200ms cubic-bezier(.2, .8, .3, 1);
}
.toast > .i { color: var(--ok-text); margin-top: 1px; }
.toast.tone-bad { border-left-color: var(--bad-solid); }
.toast.tone-bad > .i { color: var(--bad-text); }
.toast.tone-info { border-left-color: var(--info-text); }
.toast.tone-info > .i { color: var(--info-text); }
.toast .t-body { flex: 1; }
.toast .t-close { margin: -4px -4px 0 0; }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity 200ms, transform 200ms; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
/* ── forms ──────────────────────────────────────────────────────────── */
/* A form section: its title and explanation on the left, its fields on the right, capped so
   fields keep sensible widths on a wide window. */
.fsec { display: grid; grid-template-columns: minmax(200px, 300px) minmax(0, 1fr); gap: 16px 32px; padding: 24px var(--card-pad); border-bottom: 1px solid var(--line); }
.fsec:last-of-type { border-bottom: 0; }
.fsec > :last-child { max-width: 1040px; min-width: 0; }
.fsec-intro h2 { margin-bottom: 6px; }
.fsec-intro p { color: var(--muted); font-size: .9rem; max-width: 46ch; }
.fields { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px 16px; align-content: start; }
.fields > .field { grid-column: span 2; }
.fields > .w-1 { grid-column: span 1; }
.fields > .w-3 { grid-column: span 3; }
.fields > .w-4 { grid-column: span 4; }
.fields > .w-full { grid-column: 1 / -1; }
.field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.label { font-size: .86rem; font-weight: 550; color: var(--text); display: flex; align-items: center; gap: 6px; }
.label .req { color: var(--bad-text); }
.label .opt { color: var(--faint); font-weight: 400; font-size: .8rem; }
.help { color: var(--muted); font-size: .85rem; max-width: 80ch; }
.err { display: flex; gap: 6px; align-items: center; color: var(--bad-text); font-size: .85rem; font-weight: 500; }
.err .i { width: 14px; height: 14px; }
.input, .select, .textarea {
  width: 100%; height: var(--ctl-h); padding: 0 11px; border-radius: var(--r-md);
  border: 1px solid var(--control-line); background: var(--surface); color: var(--text);
  font: 400 .95rem/1.4 var(--font); transition: border-color var(--ease), box-shadow var(--ease);
}
.textarea { height: auto; min-height: 96px; padding: 9px 11px; resize: vertical; }
.select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-2); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--ring); }
/* A date or time field's calendar button takes focus inside the field, where :focus no longer
   matches: the field shows the same ring (WCAG 2.4.7). */
.input:focus-within { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--ring); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input[readonly] { background: var(--surface-sunk); color: var(--muted); }
/* A value shown in a form's field, fixed by what the form is for (a request's person, the one
   person an offer can go to): read-only, with the person's initials before it and a lock after. */
.input.is-static, .input.is-static:hover { display: flex; align-items: center; gap: 8px; background: var(--surface-sunk); color: var(--text);
  border-color: var(--line-strong); cursor: default; }
.input.is-static > .i { flex: none; color: var(--muted); }
.static-mark { display: grid; place-items: center; width: 20px; height: 20px; flex: none; margin-left: -3px; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--accent-text);
  font-size: .68rem; font-weight: 700; letter-spacing: .02em; line-height: 1; }
.input-mono { font-family: var(--mono); font-size: .9rem; }
.has-err .input, .has-err .select, .has-err .textarea { border-color: var(--bad-solid); background: color-mix(in srgb, var(--bad-soft) 55%, var(--surface)); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .i { position: absolute; left: 11px; color: var(--faint); pointer-events: none; }
.input-wrap > .i ~ .input { padding-left: 35px; }
.input-wrap > .suffix { position: absolute; right: 11px; color: var(--muted); font-size: .86rem; pointer-events: none; }
.input-wrap > .input.has-suffix { padding-right: 56px; }
input[type=file].input { padding: 5px; height: auto; }
input[type=file]::file-selector-button {
  font: 500 .86rem var(--font); margin-right: 10px; cursor: pointer; height: 28px; padding: 0 12px;
  border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text);
}
.check { display: inline-flex; align-items: center; gap: 9px; font-weight: 450; cursor: pointer; }
.check input, .cb { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; margin: 0; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 450; }
.switch input { appearance: none; margin: 0; width: 38px; height: 22px; border-radius: 999px; background: var(--line-strong);
  border: 1px solid var(--control-line); position: relative; cursor: pointer; transition: background var(--ease); flex: none; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform var(--ease); }
.switch input:checked { background: var(--accent); border-color: var(--accent); }
.switch input:checked::after { transform: translateX(16px); background: var(--accent-ink); }
.switch input:disabled { opacity: .5; cursor: not-allowed; }
.switch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.input-wrap > .pw-toggle { position: absolute; right: 6px; padding: 4px 8px; font-size: .84rem; font-weight: 500; border-radius: var(--r-sm); }
.input-wrap > .input.has-toggle { padding-right: 64px; }

.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px; padding: 12px var(--card-pad); border-top: 1px solid var(--line);
  background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); position: sticky; bottom: 0; z-index: 5; }
.form-actions .grow { margin-right: auto; color: var(--muted); font-size: .88rem; }
/* A save bar floating at the foot of the window, for long forms (settings, preferences). */
.form-actions.float { position: sticky; bottom: 12px; border: 1px solid var(--line-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-md); background: var(--surface); }

/* ── form controls with the library ── */
/* Browser date and time fields stay the browser's own (its calendar follows color-scheme), in
   the fields' look; the calendar button reads as part of the field. */
.input[type="date"], .input[type="datetime-local"], .input[type="time"], .input[type="month"] { font-variant-numeric: tabular-nums; }
.input::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .7; padding: 3px; margin-inline-end: -4px; border-radius: var(--r-sm); }
.input::-webkit-calendar-picker-indicator:hover { opacity: 1; background-color: var(--surface-3); }
.input:disabled, .textarea:disabled { background: var(--surface-sunk); color: var(--muted); cursor: not-allowed; }
/* A group of choices (ui-choices) is a fieldset named by its legend, drawn as a field. */
fieldset.ui-fieldset { margin: 0; padding: 0; border: 0; min-inline-size: 0; }
fieldset.ui-fieldset > legend { padding: 0; margin-bottom: 6px; }
[dir="rtl"] .input-wrap > .pw-toggle { right: auto; left: 6px; }
[dir="rtl"] .input-wrap > .input.has-toggle { padding-right: 11px; padding-left: 64px; }
.seg { display: inline-flex; padding: 2px; gap: 2px; border-radius: var(--r-md); background: var(--surface-3); border: 1px solid var(--line); flex-wrap: wrap; justify-self: start; }
.seg label { display: inline-flex; align-items: center; gap: 7px; height: calc(var(--ctl-h) - 6px); padding: 0 12px; border-radius: var(--r-sm);
  font-weight: 500; font-size: .9rem; color: var(--muted); cursor: pointer; transition: background var(--ease), color var(--ease); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--text); color: var(--canvas); font-weight: 550; }
.seg label:has(input:checked) .i { color: inherit; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); }

/* ── segmented controls with the library ── */
/* Of links (nav.seg, the page marked with aria-current), as of radios. */
.seg > a { display: inline-flex; align-items: center; gap: 7px; height: calc(var(--ctl-h) - 6px); padding: 0 12px; border-radius: var(--r-sm);
  font-weight: 500; font-size: .9rem; color: var(--muted); transition: background var(--ease), color var(--ease); }
.seg > a:hover, .seg label:hover { color: var(--text); text-decoration: none; }
.seg > a[aria-current] { background: var(--text); color: var(--canvas); font-weight: 550; }
/* Icons only (the theme control): square cells, each named for screen readers and on hover. */
.seg.ui-seg-icons label, .seg.ui-seg-icons > a { width: calc(var(--ctl-h) - 6px); padding: 0; justify-content: center; }
.seg.ui-seg-icons.sm label { width: 28px; height: 26px; }
.seg.ui-seg-icons .i { width: 16px; height: 16px; }
.choices { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.choices.cols { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.choice {
  position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-md);
  border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer;
  transition: border-color var(--ease), background var(--ease), box-shadow var(--ease);
}
.choice:hover { border-color: var(--control-line); }
.choice input { margin: 3px 0 0; accent-color: var(--accent); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.choice:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.choice .c-title { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.choice .c-title > .i { color: var(--muted); }
.choice .c-desc { color: var(--muted); font-size: .88rem; margin-top: 3px; }
.swatch { width: 18px; height: 18px; border-radius: var(--r-sm); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-strong); flex: none; }
.sw-tensai { background: #005dae; } .sw-teal { background: #0f7a5c; } .sw-violet { background: #5a45c0; }
.sw-amber { background: #bf8a2f; } .sw-graphite { background: #363f4e; }
/* ── select: every <select> as a trigger and the library's own list (js/select.js) ── */
/* The trigger keeps the select's own classes (.select, .w-auto, a chip's), so it sizes and
   sits as the select did; the list is the library's: a search box, groups, marks, a footer. */

/* The select itself stays in the form, out of sight where the trigger is. While the form refuses
   it, select.js gives it the trigger's box, so the browser's message points at the field. */
.ui-native {
  position: absolute !important; width: 1px !important; height: 1px !important; min-width: 0 !important;
  margin: 0 !important; padding: 0 !important; border: 0 !important; opacity: 0; pointer-events: none;
  overflow: hidden;
}
/* Read by screen readers, not shown (counts, "Loading…"). */
.ui-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; }

/* The trigger. The chosen value never widens it: a long one is cut short inside the field. A
   stroke chevron (the icon set's chevron-d) replaces the select's drawn triangle and turns while
   the list is open. */
button.ui-trigger { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; text-align: start;
  white-space: nowrap; background-image: none; }
button.ui-trigger.select { padding-inline: 11px 9px; }
.ui-trigger .ui-value { flex: 1 1 0; width: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ui-trigger .ui-chevron { width: 16px; height: 16px; flex: none; margin-inline-start: auto; color: var(--muted); transition: transform var(--ui-motion); }
.ui-trigger[aria-expanded="true"] .ui-chevron { transform: rotate(180deg); color: var(--accent-text); }
/* An empty or "every" choice ("Not stated", "Every brand") is quieter than a chosen one. */
.ui-trigger.select.is-empty .ui-value { color: var(--muted); }
/* Hover, open and focus, as a form's field; a trigger made from a chip keeps the chip's look. */
.ui-trigger.select:hover { border-color: var(--ui-ctl-line-hover); }
.ui-trigger.select[aria-expanded="true"], .ui-trigger.select:focus-visible { outline: none; border-color: var(--ui-focus); box-shadow: 0 0 0 2px var(--ui-ring); }
.ui-trigger:disabled { cursor: not-allowed; opacity: 1; color: var(--muted); background-color: var(--surface-sunk); }
.ui-trigger:disabled .ui-chevron { opacity: .5; }
.ui-trigger.is-invalid, .ui-trigger.select.is-invalid { border-color: var(--bad-solid); } /* focused too */

/* The filter variant names its field before the value ("BRAND  Every brand"), so a toolbar's
   unlabelled select reads on its own; it is as wide as its content, up to 280px. */
.ui-trigger .ui-name { flex: none; font: 600 .66rem/1 var(--font); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
button.ui-trigger.ui-v-filter { width: auto; max-width: 280px; }
.ui-v-filter .ui-value { flex: 0 1 auto; width: auto; }
/* The chip variant keeps the chip's look; its chevron is the trigger's, not a drawn one. */
button.ui-trigger.ui-v-chip { padding-inline-end: 7px; gap: 5px; } /* the room a chip's drawn triangle had */
button.ui-trigger.ui-v-chip .ui-chevron { width: 14px; height: 14px; color: currentColor; }
/* The inline variant (a table cell): its width is held to its widest option by select.js. */
button.ui-trigger.ui-v-inline { height: calc(var(--ctl-h) - 4px); }

/* A clearable field's ×: the pointer's way to clear it (Delete or Backspace on the trigger is the
   keyboard's, and the list's empty choice everyone's). */
.ui-clear { display: grid; place-items: center; width: 20px; height: 20px; flex: none; margin-inline-end: -4px; border-radius: var(--r-sm);
  color: var(--muted); cursor: pointer; }
.ui-clear:hover { background: var(--surface-3); color: var(--text); }
.ui-clear .i { width: 14px; height: 14px; }

/* Several chosen (multi-select): chips, then "+N". */
.ui-chips { display: flex; align-items: center; gap: 4px; flex: 1 1 0; min-width: 0; overflow: hidden; }
.ui-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: var(--r-sm); background: var(--surface-3);
  color: var(--text-2); font-size: .82rem; max-width: 14em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; }
.ui-chip-more { flex: none; color: var(--muted); font-size: .82rem; }

/* The chosen person's initials, an organisation's building or a colour, before the text: the
   list's marks, smaller. */
.ui-mark { display: grid; place-items: center; width: 20px; height: 20px; flex: none; margin-inline-start: -3px; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--accent-text);
  font-size: .68rem; font-weight: 700; letter-spacing: .02em; line-height: 1; }
.ui-mark.k-org, .ui-mark.k-icon { border-radius: var(--r-md); background: var(--surface-3); color: var(--text-2); }
.ui-mark.k-swatch { width: 16px; height: 16px; margin-inline-start: 0; border-radius: var(--r-sm);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 28%, transparent); }
.ui-mark .i { width: 13px; height: 13px; }

/* ── the list ────────────────────────────────────────────────────────── */
/* In the top layer (popover), so a table, a scroll box or a dialog never cuts it off; placed by
   select.js at the trigger's start edge, below it or above when there is no room. */
.ui-pop {
  position: fixed; inset: auto; margin: 0; padding: 0; z-index: var(--ui-z-pop); display: flex; flex-direction: column;
  border-radius: var(--ui-pop-radius); background: var(--ui-pop-bg); border: 1px solid var(--ui-pop-line);
  box-shadow: var(--ui-pop-shadow); color: var(--text); font: 400 .93rem/1.35 var(--font); overflow: hidden;
  max-width: calc(100vw - 16px);
}
.ui-pop[popover]:not(:popover-open) { display: none; }
/* It moves in once placed (placing measures it), from the trigger's side. */
.ui-pop.is-placed { animation: ui-pop-in 110ms ease-out; }
.ui-pop.is-placed.is-up { animation-name: ui-pop-in-up; }
@keyframes ui-pop-in { from { opacity: 0; transform: translateY(-4px); } }
@keyframes ui-pop-in-up { from { opacity: 0; transform: translateY(4px); } }

.ui-search-row { position: relative; display: flex; align-items: center; padding: 6px; border-bottom: 1px solid var(--line); flex: none; }
.ui-search-row > .i { position: absolute; inset-inline-start: 16px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.ui-search {
  width: 100%; height: 34px; padding-block: 0; padding-inline: 32px 10px; border-radius: var(--r-md);
  border: 1px solid var(--control-line); background: var(--surface-sunk); color: var(--text); font: inherit;
}
.ui-search::placeholder { color: var(--faint); }
.ui-search:focus { outline: none; border-color: var(--ui-focus); box-shadow: 0 0 0 2px var(--ui-ring); background: var(--surface); }

.ui-list { overflow-y: auto; overscroll-behavior: contain; padding: 4px; max-height: 340px; scroll-padding: 4px; }
/* A sheet's list can hold the focus; its active row shows where it is. */
.ui-list:focus { outline: none; }
.ui-group + .ui-group, .ui-row + .ui-group, .ui-group + .ui-row { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); }
/* Headings as in the menus (.dd-label), held at the top while their rows scroll under them. */
.ui-group-head {
  position: sticky; top: -4px; z-index: 1; padding: 8px 10px 4px; background: var(--ui-pop-bg);
  font: 600 .68rem/1 var(--font); letter-spacing: .09em; text-transform: uppercase;
  color: var(--ui-head-fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* A row. Where the keys are: a tint and a 2px accent ring, clear against the list and the tint.
   Under the pointer: a quiet tint only. Chosen: accent text and a tick. */
.ui-row {
  display: flex; align-items: center; gap: 10px; min-height: var(--ui-row-h); padding: 6px 10px; border-radius: var(--r-sm);
  cursor: pointer; user-select: none; scroll-margin: 4px;
}
.ui-row.is-active { background: var(--ui-row-active-bg); box-shadow: inset 0 0 0 2px var(--ui-row-active-ring); }
.ui-list.is-pointing .ui-row.is-active { background: var(--ui-row-hover-bg); box-shadow: none; }
.ui-row[aria-selected="true"] { color: var(--ui-row-selected-fg); }
.ui-row[aria-selected="true"] .ui-row-label { font-weight: 600; }
.ui-row[aria-disabled="true"] { cursor: not-allowed; color: var(--faint); }
.ui-row[aria-disabled="true"] .ui-row-sub { color: var(--faint); }
.ui-row-text { display: grid; flex: 1; min-width: 0; }
.ui-row-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A second line wraps rather than lose its end ("hasn't accepted the invitation"), between words;
   a word (an email address) is broken only when it is wider than the whole list. */
.ui-row-sub { font-size: .8rem; color: var(--muted); white-space: normal; overflow-wrap: break-word; }
.ui-row-meta { flex: none; margin-inline-start: auto; font: 500 .72rem/1.2 var(--mono); color: var(--muted); white-space: nowrap; }
.ui-tick { display: grid; place-items: center; width: 16px; height: 16px; flex: none; visibility: hidden; color: var(--ui-row-selected-fg); }
.ui-tick .i { width: 15px; height: 15px; }
.ui-row[aria-selected="true"] .ui-tick { visibility: visible; }
/* Several may be chosen: a box for each row, filled when chosen. */
.ui-list[aria-multiselectable="true"] .ui-tick { visibility: visible; border: 1px solid var(--control-line); border-radius: var(--r-sm);
  background: var(--surface); color: transparent; }
.ui-list[aria-multiselectable="true"] .ui-row[aria-selected="true"] .ui-tick { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ui-list[aria-multiselectable="true"] .ui-tick .i { width: 12px; height: 12px; stroke-width: 2.2; }

/* Marks: an organisation, a person (their initials), none, an icon, a colour. People listed after
   their organisation's row sit under it; people on their own (staff) line up with the rest. */
.ui-ic { display: grid; place-items: center; width: 26px; height: 26px; flex: none; border-radius: var(--r-md);
  background: var(--surface-3); color: var(--text-2); }
.ui-ic .i { width: 15px; height: 15px; }
.ui-av { display: grid; place-items: center; width: 26px; height: 26px; flex: none; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--accent-text);
  font-size: .68rem; font-weight: 700; letter-spacing: .02em; }
.ui-sw { width: 18px; height: 18px; flex: none; border-radius: var(--r-sm); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 28%, transparent); }
.ui-row.k-org ~ .ui-row.k-person { padding-inline-start: 22px; }
.ui-row.k-none .ui-ic { background: transparent; color: var(--muted); }
.ui-row[aria-disabled="true"] .ui-av, .ui-row[aria-disabled="true"] .ui-ic, .ui-row[aria-disabled="true"] .ui-sw { opacity: .55; }

/* What a search matched (CSS Custom Highlight API; without it the list still narrows). */
::highlight(ui-match) { background-color: var(--ui-match-bg); color: var(--ui-match-fg); }

.ui-empty { padding: 14px 10px; color: var(--muted); text-align: center; font-size: .88rem; overflow-wrap: anywhere; }
.ui-loading { display: flex; align-items: center; gap: 10px; padding: 12px 10px; color: var(--muted); font-size: .88rem; }
.ui-loading::before { content: ""; width: 12px; height: 12px; flex: none; border-radius: 50%; border: 2px solid var(--line-strong);
  border-top-color: var(--accent); animation: ui-spin .8s linear infinite; }
@keyframes ui-spin { to { transform: rotate(1turn); } }
.ui-failed { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px; color: var(--bad-text); font-size: .88rem; }
.ui-pop-foot { flex: none; padding: 7px 12px; border-top: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: .8rem; }
.ui-pop-foot:empty { display: none; }

/* ── on a phone: a sheet from the bottom (a modal <dialog>) ───────────── */
dialog.ui-sheet {
  position: fixed; inset: auto 0 0 0; margin: 0; width: 100%; max-width: none; max-height: min(82vh, 680px);
  padding: 0 0 env(safe-area-inset-bottom); border: 0; border-top: 1px solid var(--ui-pop-line); border-radius: 14px 14px 0 0;
  background: var(--ui-pop-bg); color: var(--text); box-shadow: var(--ui-pop-shadow); font: 400 .97rem/1.35 var(--font);
  flex-direction: column; overflow: hidden; --ui-row-h: 48px;
}
dialog.ui-sheet[open] { display: flex; animation: ui-sheet-up 180ms cubic-bezier(.2, .8, .2, 1); }
dialog.ui-sheet::backdrop { background: var(--ui-shade); }
@keyframes ui-sheet-up { from { transform: translateY(100%); } }
.ui-sheet-head { position: relative; display: flex; align-items: center; gap: 10px; padding: 16px 10px 8px 18px; flex: none; }
.ui-sheet-head::before { content: ""; position: absolute; top: 6px; left: 50%; width: 38px; height: 4px; margin-left: -19px;
  border-radius: 2px; background: var(--line-strong); }
.ui-sheet-title { flex: 1; min-width: 0; font-weight: 650; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-x { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border: 0; border-radius: 50%; background: var(--surface-3);
  color: var(--text); cursor: pointer; }
.ui-x .i { width: 16px; height: 16px; }
.ui-sheet .ui-list { max-height: none; flex: 1; padding: 4px 8px 12px; }
/* No hover to show a cut row's full text on a phone: it wraps. */
.ui-sheet .ui-row-label { white-space: normal; overflow-wrap: anywhere; }
.ui-sheet .ui-search { height: 42px; font-size: 1rem; }
.ui-sheet-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--surface-2); flex: none; }

@media (prefers-reduced-motion: reduce) {
  .ui-pop, .ui-pop.is-placed, .ui-pop.is-placed.is-up, dialog.ui-sheet[open], .ui-loading::before, .ui-trigger .ui-chevron { animation: none; transition: none; }
}
@media (forced-colors: active) {
  .ui-trigger:focus-visible, .ui-trigger.select:focus-visible, .ui-trigger.select[aria-expanded="true"] { outline: 2px solid Highlight; outline-offset: 2px; }
  .ui-row.is-active, .ui-list.is-pointing .ui-row.is-active { outline: 2px solid Highlight; outline-offset: -2px; }
  .ui-row[aria-disabled="true"], .ui-row[aria-disabled="true"] .ui-row-sub { color: GrayText; }
  .ui-row[aria-selected="true"] .ui-tick { forced-color-adjust: auto; }
  ::highlight(ui-match) { background-color: Mark; color: MarkText; }
}
/* ── tables ─────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th, .table td { padding: var(--row-pad) 14px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
.table th:first-child, .table td:first-child { padding-left: var(--card-pad); }
.table th:last-child, .table td:last-child { padding-right: var(--card-pad); }
.table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--muted);
  font: 600 .7rem/1.2 var(--font); text-transform: uppercase; letter-spacing: .07em; white-space: nowrap; padding-top: 10px; padding-bottom: 10px; }
.table thead th a { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.table thead th a.is-sorted { color: var(--text); }
.table tbody tr { transition: background var(--ease); }
.table tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface)); }
.table tbody tr.is-selected { background: var(--accent-soft); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .col-check { width: 44px; padding-right: 0; }
.table .col-actions { width: 1%; white-space: nowrap; text-align: right; }
.table td.wrap { white-space: normal; }
/* A row with a .row-link opens from anywhere on it: the link's box stretches over the row
   (so middle-click, Ctrl+click and the keyboard work as for any link), while the row's other
   controls sit above it and keep their own clicks. */
.table tbody tr:has(.row-link) { position: relative; cursor: pointer; }
.table .row-link::after { content: ""; position: absolute; inset: 0; }
.table .row-link:focus-visible { outline: none; }
.table tbody tr:has(.row-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.table tbody tr:has(.row-link) :is(a:not(.row-link), button, input, select, textarea, label, summary, details) { position: relative; z-index: 1; }
.table tbody tr:has(.row-link) details[open] { z-index: 5; } /* an open menu stays over the rows below */
.cell-main { font-weight: 550; color: var(--text); }
a.cell-main:hover { color: var(--accent-text); }
.cell-sub { color: var(--muted); font-size: .84rem; margin-top: 1px; }
.cell-person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dim { color: var(--muted); }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px var(--card-pad); border-top: 1px solid var(--line); color: var(--muted); font-size: .86rem; flex-wrap: wrap; }
.pager { display: flex; align-items: center; gap: 6px; }
/* On a narrow page, tables marked .responsive turn each row into a small block. */
@container page (max-width: 640px) {
  .table.responsive thead { display: none; }
  .table.responsive tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px var(--card-pad); border-bottom: 1px solid var(--line); }
  .table.responsive tbody tr:last-child { border-bottom: 0; }
  .table.responsive td { display: block; padding: 0 !important; border: 0; grid-column: 1; }
  .table.responsive td.col-actions, .table.responsive td.col-end { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
  .table.responsive td.col-check { display: none; }
  .table.responsive td[data-label]::before { content: attr(data-label) " · "; color: var(--muted); font-size: .84rem; }
  .table.responsive td.num { text-align: left; }
  .table.responsive td:empty { display: none; }
}

.toolbar { display: flex; align-items: center; gap: 10px; padding: 12px var(--card-pad); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar .grow { flex: 1 1 320px; max-width: 560px; }
.toolbar .select { width: auto; min-width: 150px; max-width: 280px; }
.toolbar .end { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.bulkbar {
  position: sticky; bottom: 18px; z-index: 20; margin: 14px auto 0; width: fit-content; max-width: 100%;
  display: flex; align-items: center; gap: 12px; padding: 7px 7px 7px 16px; border-radius: var(--r-lg);
  background: var(--text); color: var(--canvas); box-shadow: var(--shadow-lg);
}
.bulkbar[hidden] { display: none; }
.bulkbar .btn { --btn-bg: transparent; --btn-fg: var(--canvas); --btn-line: color-mix(in srgb, var(--canvas) 30%, transparent); --btn-hover: color-mix(in srgb, var(--canvas) 14%, transparent); }
.bulkbar .btn-primary { --btn-bg: var(--canvas); --btn-fg: var(--text); --btn-line: var(--canvas); --btn-hover: color-mix(in srgb, var(--canvas) 86%, var(--text)); }
.bulkbar strong { font-weight: 600; }
.tabs { display: flex; gap: 0; padding: 0 var(--card-pad); border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 13px 12px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.is-active { color: var(--text); font-weight: 600; }
.tab.is-active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); }
.tab .count { min-width: 20px; height: 18px; padding: 0 5px; border-radius: var(--r-sm); display: inline-grid; place-items: center; font: 500 .72rem/1 var(--mono);
  background: var(--neutral-soft); color: var(--neutral-text); }
.tab.is-active .count { background: var(--accent-soft); color: var(--accent-on-soft); }

/* ── tabs with the library: link tabs mark the page with aria-current, in-page tabs
   (data-ui-tabs, js/tabs.js) the shown panel's tab with aria-selected ── */
.tab[aria-current="page"], .tab[aria-selected="true"] { color: var(--text); font-weight: 600; }
.tab[aria-current="page"]::after, .tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); }
.tab[aria-current="page"] .count, .tab[aria-selected="true"] .count { background: var(--accent-soft); color: var(--accent-on-soft); }
button.tab { border: 0; background: none; font: inherit; font-weight: 500; cursor: pointer; }
.tab:focus-visible { outline-offset: -2px; }
[role="tabpanel"]:focus-visible { outline-offset: 4px; }
/* ── empty states: words first, a quiet mark ────────────────────────── */
.empty { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 44px 24px; color: var(--muted); }
.empty-icon { color: var(--faint); margin-bottom: 4px; }
.empty-icon .i { width: 26px; height: 26px; stroke-width: 1.4; }
.empty strong { color: var(--text); font-size: 1rem; font-weight: 600; }
.empty p { max-width: 52ch; }
.empty .row { justify-content: center; margin-top: 10px; }
.empty.sm { padding: 24px 16px; }

/* ── description lists ──────────────────────────────────────────────── */
.dl { display: grid; grid-template-columns: minmax(120px, min(34%, 220px)) minmax(0, 1fr); column-gap: 16px; margin: 0; }
.dl > dt, .dl > dd { margin: 0; padding: 9px 0; border-bottom: 1px solid var(--line); }
.dl > dt { color: var(--muted); font-size: .88rem; }
.dl > dd { font-weight: 450; overflow-wrap: break-word; color: var(--text); min-width: 0; }
.dl > :nth-last-child(-n+2) { border-bottom: 0; }
.dl.tight > dt, .dl.tight > dd { padding: 6px 0; }
.dl .none { color: var(--faint); font-weight: 400; }
/* Label above value, in as many columns as fit (facts of a person, a phone). */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 0 24px; margin: 0; }
.facts > div { padding: 10px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.facts dt { color: var(--muted); font-size: .8rem; margin-bottom: 2px; }
.facts dd { margin: 0; font-weight: 450; overflow-wrap: break-word; }
.kv { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: .84rem; }
.kv b { color: var(--text-2); font-weight: 550; }

/* ── stats: a strip of figures ──────────────────────────────────────── */
/* Each stat is its own size container: its figure shrinks to fit a narrow card (half a phone's
   width) rather than being cut off at the card's edge. */
.stat { padding: 16px var(--card-pad) 18px; display: grid; gap: 4px; position: relative; overflow: hidden; align-content: start; container-type: inline-size; }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stat-label { color: var(--muted); font: 600 .7rem/1.2 var(--font); text-transform: uppercase; letter-spacing: .08em; }
.stat-icon { display: none; } /* figures carry the meaning */
.stat-value { font: 600 2.1rem/1.05 var(--font); font-size: clamp(1.35rem, 15cqi, 2.1rem); letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--text); margin-top: 6px; }
.stat-foot { color: var(--muted); font-size: .84rem; display: flex; align-items: center; gap: 6px; }
.stat-spark { display: block; width: 100%; height: 32px; margin-top: 6px; }
/* One card holding several figures, divided by rules. */
.statbar { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.statbar > .stat { border-left: 1px solid var(--line); }
.statbar > .stat:first-child { border-left: 0; }

/* ── lists ──────────────────────────────────────────────────────────── */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 11px var(--card-pad); border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list a.li-link { display: flex; align-items: center; gap: 12px; color: inherit; margin: -11px calc(-1 * var(--card-pad)); padding: 11px var(--card-pad); flex: 1; min-width: 0; }
.list a.li-link:hover { background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface)); text-decoration: none; }
/* A status mark: a small icon in the tone's colour, no tinted tile. */
.li-icon { width: 26px; height: 26px; display: grid; place-items: center; flex: none; color: var(--muted); border-radius: var(--r-sm); border: 1px solid var(--line); }
.li-icon .i { width: 15px; height: 15px; }
.li-icon.tone-ok { color: var(--ok-text); border-color: var(--ok-line); }
.li-icon.tone-warn { color: var(--warn-text); border-color: var(--warn-line); }
.li-icon.tone-bad { color: var(--bad-text); border-color: var(--bad-line); }
.li-icon.tone-info { color: var(--info-text); border-color: var(--info-line); }
.li-icon.tone-accent { color: var(--accent-text); border-color: var(--accent-soft-2); }
/* A title is cut short with an ellipsis on any element, a link too (a file's name), rather than
   widen the page; a link is as wide as its text. */
.li-title { display: block; max-width: 100%; font-weight: 550; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.li-title { width: fit-content; }
.li-sub { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-end { flex: none; text-align: right; color: var(--muted); font-size: .85rem; }

/* ── timeline: a rule with markers ──────────────────────────────────── */
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { position: relative; display: grid; grid-template-columns: 18px 1fr; gap: 12px; padding-bottom: 16px; }
.tl li:last-child { padding-bottom: 0; }
.tl li::after { content: ""; position: absolute; left: 8px; top: 16px; bottom: -2px; width: 1px; background: var(--line-strong); }
.tl li:last-child::after { display: none; }
.tl-dot { width: 9px; height: 9px; margin: 6px 0 0 4px; background: var(--line-strong); border-radius: 1px; color: transparent; overflow: hidden; }
.tl-dot .i { display: none; }
.tl-dot.tone-ok { background: var(--ok-solid); }
.tl-dot.tone-warn { background: var(--warn-solid); }
.tl-dot.tone-bad { background: var(--bad-solid); }
.tl-dot.tone-info { background: var(--info-text); }
.tl-dot.tone-accent { background: var(--accent); }
.tl-title { font-weight: 500; }
.tl-meta { color: var(--muted); font-size: .84rem; }

/* ── avatars ────────────────────────────────────────────────────────── */
.avatar { width: 32px; height: 32px; border-radius: var(--r-md); flex: none; display: grid; place-items: center; overflow: hidden;
  background: var(--surface-3); color: var(--text-2); font: 600 .8rem/1 var(--font); object-fit: cover; }
.avatar.sm { width: 26px; height: 26px; font-size: .7rem; }
.avatar.lg { width: 44px; height: 44px; font-size: 1rem; }
.avatar.sq { border-radius: var(--r-md); }
img.avatar { background: var(--surface-3); }
/* ── charts (server-rendered SVG; colours from tokens) ──────────────── */
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .axis { fill: var(--muted); font: 400 11px var(--font); }
.chart .bar-1 { fill: var(--chart-1); }
.chart .bar-2 { fill: var(--chart-2); }
.chart .bar-1, .chart .bar-2 { transition: opacity var(--ease); }
.chart .day:hover .bar-1, .chart .day:hover .bar-2 { opacity: .8; }
.chart .day .hit { fill: transparent; }
.chart .day:hover .hit { fill: var(--surface-3); }
.chart .spark-line { fill: none; stroke: var(--chart-1); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.chart .spark-area { fill: color-mix(in srgb, var(--chart-1) 10%, transparent); }
.chart-box { max-height: 300px; }
.chart .grid-line, .chart .spark-line { vector-effect: non-scaling-stroke; }
/* Bar chart: a stretched plot of fixed height, with HTML labels that keep their size. */
.bars { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: 220px auto; column-gap: 12px; padding-top: 8px; }
.bars-y { display: flex; flex-direction: column; justify-content: space-between; color: var(--muted); font: 400 .74rem/1 var(--mono); }
.bars-y span { height: 0; display: flex; align-items: center; justify-content: flex-end; }
.bars-plot { grid-column: 2; width: 100%; height: 100%; display: block; overflow: visible; }
.bars-x { grid-column: 2; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); padding-top: 8px; color: var(--muted); font-size: .76rem; text-align: center; white-space: nowrap; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: .85rem; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 1px; display: inline-block; }
.legend .l-1 { background: var(--chart-1); } .legend .l-2 { background: var(--chart-2); }
.legend .l-3 { background: var(--chart-3); } .legend .l-4 { background: var(--chart-4); } .legend .l-5 { background: var(--line-strong); }
.funnel { display: grid; gap: 12px; }
.funnel-row { display: grid; grid-template-columns: 120px 1fr 48px; gap: 12px; align-items: center; font-size: .9rem; }
.funnel-row .f-label { color: var(--muted); }
.funnel-row .f-val { text-align: right; font: 500 .9rem var(--mono); }
.meter { width: 100%; height: 6px; border: 0; border-radius: 1px; background: var(--surface-3); overflow: hidden; appearance: none; display: block; }
.meter::-webkit-progress-bar { background: var(--surface-3); border-radius: 1px; }
.meter::-webkit-progress-value { background: var(--accent); border-radius: 1px; }
.meter::-moz-progress-bar { background: var(--accent); border-radius: 1px; }
.meter.tone-ok::-webkit-progress-value { background: var(--chart-2); } .meter.tone-ok::-moz-progress-bar { background: var(--chart-2); }
.meter.tone-warn::-webkit-progress-value { background: var(--chart-3); } .meter.tone-warn::-moz-progress-bar { background: var(--chart-3); }
.meter.tone-bad::-webkit-progress-value { background: var(--chart-4); } .meter.tone-bad::-moz-progress-bar { background: var(--chart-4); }
.meter.sm { height: 4px; }
/* ── dropdown menus (details/summary; JS closes on outside click) ───── */
.dd { position: relative; }
.dd > summary { list-style: none; cursor: pointer; }
.dd > summary::-webkit-details-marker { display: none; }
.dd-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 230px; max-width: min(380px, calc(100vw - 24px));
  padding: 5px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow-lg);
  animation: dd-in 120ms ease-out;
}
.dd-panel.left { left: 0; right: auto; }
.dd-panel.is-floating { position: fixed; right: auto; }
.dd-panel.wide { width: 380px; }
@keyframes dd-in { from { opacity: 0; transform: translateY(-3px); } }
.dd-head { padding: 10px 10px 8px; }
.dd-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--r-sm); border: 0; background: none;
  color: var(--text); font: 450 .93rem var(--font); text-align: left; cursor: pointer; }
.dd-item:hover { background: var(--surface-3); text-decoration: none; }
.dd-item .i { color: var(--muted); }
.dd-item.danger, .dd-item.danger .i { color: var(--bad-text); }
.dd-item .end { margin-left: auto; }
/* The theme button and its ticks show the theme in force: they follow <html data-theme>, also
   when a page changes it without reloading (a choice here, or one made in another portal). */
.th-ico { display: none; }
:root[data-theme="light"] .th-light, :root[data-theme="dark"] .th-dark,
:root:not([data-theme="light"]):not([data-theme="dark"]) .th-system { display: contents; }
.th-tick { visibility: hidden; }
:root[data-theme="light"] [data-set-theme="light"] .th-tick, :root[data-theme="dark"] [data-set-theme="dark"] .th-tick,
:root:not([data-theme="light"]):not([data-theme="dark"]) [data-set-theme="system"] .th-tick { visibility: visible; }
.dd-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.dd-label { padding: 8px 10px 4px; font: 600 .68rem/1 var(--font); text-transform: uppercase; letter-spacing: .09em; color: var(--faint); }
.dd form { margin: 0; }
.dd-checks { display: grid; gap: 2px; padding: 4px; }
.dd-checks label { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: var(--r-sm); cursor: pointer; font-weight: 450; }
.dd-checks label:hover { background: var(--surface-3); }

/* ── menus and popovers with the library (js/menu.js, js/popover.js) ── */
/* The panel opens in the top layer, placed by the script against its button, so a table, the
   sidebar or a dialog never cuts it off; without the script it opens in place, as above. */
.dd-panel[popover] { position: fixed; inset: auto; margin: 0; color: var(--text); max-height: calc(100vh - 16px); overflow: auto; }
.dd-panel[popover]:not(:popover-open) { display: none; }
.dd-panel[popover].is-up { animation-name: dd-in-up; }
@keyframes dd-in-up { from { opacity: 0; transform: translateY(3px); } }
.dd-panel[popover]::backdrop { background: transparent; }
/* Rows look as the lists' rows do: where the keys are, a tint and a 2px accent ring. */
.dd-item, .dd-checks label { min-height: var(--ui-row-h); }
.dd-item:focus-visible, .dd-checks label:focus-visible, [role="menu"] .ps-item:focus-visible {
  outline: none; background: var(--ui-row-active-bg); box-shadow: inset 0 0 0 2px var(--ui-row-active-ring); }
.dd-item[aria-disabled="true"] { color: var(--faint); cursor: not-allowed; }
.dd-item[aria-disabled="true"]:hover { background: none; }
/* A radio or checkbox item's tick (data-ui-check): shown when it is checked. */
.dd-item > .ui-check { margin-inline-start: auto; display: grid; place-items: center; color: var(--accent-text); visibility: hidden; }
.dd-item > .ui-check .i { width: 14px; height: 14px; }
.dd-item[aria-checked="true"] > .ui-check { visibility: visible; }
.dd-item[data-ui-check="checkbox"] > input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); flex: none; }
.dd-item[data-ui-danger], .dd-item[data-ui-danger] .i { color: var(--bad-text); }
.dd-item .end, .dd-item > .ui-check { margin-inline-start: auto; }
[dir="rtl"] .dd-item { text-align: right; }
/* A long menu's search box (data-ui-search), as the lists' search box. */
.dd-panel > .ui-search-row { margin: -5px -5px 5px; }
.dd-panel .ui-menu-empty { padding: 12px 10px; color: var(--muted); font-size: .88rem; text-align: center; }
/* On a phone: a sheet from the bottom, over a shade. */
@media (max-width: 600px) {
  .dd-panel[popover].ui-as-sheet {
    inset: auto 0 0 0; width: 100%; max-width: none; min-width: 0; max-height: 82vh; border-width: 1px 0 0;
    border-radius: 14px 14px 0 0; padding: 14px 8px calc(8px + env(safe-area-inset-bottom)); animation: ui-sheet-up 180ms cubic-bezier(.2, .8, .2, 1);
    --ui-row-h: 48px;
  }
  .dd-panel[popover].ui-as-sheet::backdrop { background: var(--ui-shade); }
  .dd-panel.ui-as-sheet .dd-item, .dd-panel.ui-as-sheet .dd-checks label { font-size: 1rem; }
}
@keyframes ui-sheet-up { from { transform: translateY(100%); } }
@media (forced-colors: active) {
  .dd-item:focus-visible, .dd-checks label:focus-visible, [role="menu"] .ps-item:focus-visible { outline: 2px solid Highlight; outline-offset: -2px; }
}
/* ── dialogs ────────────────────────────────────────────────────────── */
dialog.modal {
  width: min(520px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line-strong); border-radius: var(--r-xl);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
dialog.modal::backdrop { background: rgba(9, 12, 22, .55); }
dialog.modal[open] { animation: modal-in 160ms cubic-bezier(.2, .8, .3, 1); }
@keyframes modal-in { from { opacity: 0; transform: translateY(6px); } }
.modal-head { display: flex; gap: 14px; align-items: flex-start; padding: 22px 22px 6px; }
.modal-icon { width: 36px; height: 36px; border-radius: var(--r-md); flex: none; display: grid; place-items: center; border: 1px solid var(--bad-line); color: var(--bad-text); }
.modal-icon.tone-info { border-color: var(--info-line); color: var(--info-text); }
.modal-body { padding: 4px 22px 18px 72px; color: var(--muted); }
.modal-body .field { margin-top: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-xl) var(--r-xl); }

/* ── dialogs with the library (js/dialog.js) ── */
dialog.modal:focus-visible { outline: none; }
[dir="rtl"] .modal-body { padding: 4px 72px 18px 22px; }
/* On a phone, a dialog marked .is-sheet rises from the bottom of the screen. */
@media (max-width: 600px) {
  dialog.modal.is-sheet { margin: auto 0 0; width: 100%; max-width: none; max-height: 88vh; border-width: 1px 0 0;
    border-radius: 14px 14px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  dialog.modal.is-sheet[open] { animation: ui-sheet-up 180ms cubic-bezier(.2, .8, .2, 1); }
  dialog.modal.is-sheet .modal-foot { border-radius: 0; }
}
/* ── command palette ────────────────────────────────────────────────── */
dialog.palette { width: min(680px, calc(100vw - 32px)); margin-top: 12vh; padding: 0; border: 1px solid var(--line-strong);
  border-radius: var(--r-xl); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog.palette::backdrop { background: rgba(9, 12, 22, .5); }
.pal-search { display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.pal-search .i { color: var(--faint); }
.pal-search input { flex: 1; height: 54px; border: 0; outline: 0; background: transparent; color: var(--text); font: 400 1.05rem var(--font); }
.pal-search input::placeholder { color: var(--faint); }
.pal-results { max-height: min(440px, 55vh); overflow: auto; padding: 6px; }
.pal-group { padding: 10px 12px 4px; font: 600 .68rem/1 var(--font); text-transform: uppercase; letter-spacing: .09em; color: var(--faint); }
.pal-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--r-md); color: var(--text); cursor: pointer; }
.pal-item:hover, .pal-item.is-active { background: var(--accent-soft); color: var(--accent-on-soft); text-decoration: none; }
button.pal-item { width: 100%; border: 0; background: none; font: inherit; text-align: left; }
.pal-item .i { color: var(--muted); }
.pal-item.is-active .i { color: var(--accent-text); }
.pal-item .p-sub { margin-left: auto; color: var(--faint); font-size: .84rem; }
.pal-empty { padding: 28px; text-align: center; color: var(--muted); }
.pal-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--faint); font-size: .8rem; background: var(--surface-2); border-radius: 0 0 var(--r-xl) var(--r-xl); }
.pal-foot span { display: inline-flex; align-items: center; gap: 6px; }

/* ── the palette with the library (js/palette.js): rows as the lists' rows ── */
.pal-item:hover { background: var(--ui-row-hover-bg); color: var(--text); }
.pal-item.is-active { background: var(--ui-row-active-bg); color: var(--text); box-shadow: inset 0 0 0 2px var(--ui-row-active-ring); }
.pal-results.is-pointing .pal-item.is-active { background: var(--ui-row-hover-bg); box-shadow: none; }
.pal-item .p-sub { margin-inline-start: auto; }
[dir="rtl"] button.pal-item { text-align: right; }
.pal-results .ui-loading, .pal-results .ui-failed { margin: 4px 6px; }
@media (forced-colors: active) {
  .pal-item.is-active { outline: 2px solid Highlight; outline-offset: -2px; }
}
/* ── offer reveal ───────────────────────────────────────────────────── */
.steps { display: grid; gap: 0; }
.step { display: grid; grid-template-columns: 36px 1fr; gap: 16px; padding: 22px var(--card-pad); border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: 0; }
.step-num { width: 28px; height: 28px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font: 600 .9rem var(--mono); }
.step-num.done { background: var(--ok-soft); color: var(--ok-text); }
.step h2 { margin-bottom: 4px; }
.step .help { margin-bottom: 14px; }
.qr-frame { background: #fff; padding: 12px; border-radius: var(--r-md); border: 1px solid var(--line); width: fit-content; }
.qr-frame img { display: block; width: 220px; height: 220px; image-rendering: pixelated; }
.qr-frame.sm img { width: 120px; height: 120px; }
.copy-field { display: flex; gap: 8px; }
.copy-field .input { font-family: var(--mono); font-size: .86rem; }
.reveal-grid { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: start; }
/* ── settings ───────────────────────────────────────────────────────── */
.select.w-auto, .input.w-auto { width: auto; min-width: 180px; }
/* Settings and preferences: groups as cards in columns on a wide page. */
.settings-grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(min(100%, 640px), 1fr)); align-items: start; }
.settings-grid > .span-all { grid-column: 1 / -1; }
.side-nav { display: grid; gap: 4px; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--r-md); color: var(--text-2); font-weight: 450; }
.side-nav a:hover { background: var(--surface-3); text-decoration: none; }
.side-nav a.is-active { background: var(--accent-soft); color: var(--accent-on-soft); font-weight: 550; }
/* ── sign-in ────────────────────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(480px, 1fr); background: var(--canvas); }
.auth-side {
  position: relative; overflow: hidden; padding: clamp(32px, 4vw, 80px); color: #fff; display: flex; flex-direction: column; justify-content: space-between;
  background-color: var(--brand-navy);
  background-image: linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 56px 56px;
}
.auth-side::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: linear-gradient(90deg, #005dae 0 72%, var(--brand-gold) 72% 100%); }
.auth-side > * { position: relative; }
.auth-brand { display: flex; align-items: center; gap: 12px; font: 600 1.1rem/1 var(--font); letter-spacing: .02em; }
.auth-logo { display: block; width: clamp(150px, 11vw, 210px); height: auto; }
.auth-product { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; color: rgba(255, 255, 255, .8); font: 500 .78rem/1 var(--font); letter-spacing: .14em; text-transform: uppercase; }
.auth-product .wordmark { height: 20px; }
.auth-brand .sb-logo { background: #fff; color: var(--brand-navy); }
.auth-pitch h2 { color: #fff; font: 600 clamp(2rem, 1.2rem + 1.7vw, 3.4rem)/1.08 var(--font); letter-spacing: -.025em; max-width: 15ch; }
.auth-pitch p { color: rgba(255, 255, 255, .8); font-size: 1.05rem; max-width: 44ch; margin-top: 18px; }
.auth-points { display: grid; gap: 0; margin-top: 32px; max-width: 46ch; border-top: 1px solid rgba(255, 255, 255, .16); }
.auth-points div { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, .16); color: rgba(255, 255, 255, .9); }
.auth-points .i { color: var(--nav-accent); }
.auth-foot-note { color: rgba(255, 255, 255, .66); font: 400 .8rem var(--mono); letter-spacing: .03em; }
.auth-main { display: grid; align-content: start; justify-items: center; padding: max(40px, 14vh) 24px 40px; }
.auth-card { width: 100%; max-width: clamp(400px, 26vw, 480px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: clamp(28px, 2.2vw, 40px); }
.auth-card.wide { max-width: clamp(480px, 32vw, 600px); }
.auth-card h1 { font-size: 1.6rem; margin-bottom: 8px; }
.auth-card .lead { color: var(--muted); margin-bottom: 24px; }
.auth-card .field { margin-bottom: 16px; }
.auth-card .env { margin-bottom: 20px; }
.code-input { font: 500 1.35rem/1 var(--mono) !important; letter-spacing: .4em; text-align: center; height: 48px !important; max-width: 16ch; }
.auth-card .code-input { max-width: none; }
.secret { font-family: var(--mono); font-size: .9rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; word-break: normal; overflow-wrap: normal; letter-spacing: .04em; }
.enrol { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; margin: 6px 0 22px; }
.enrol .qr-frame img { width: 168px; height: 168px; }
.numbered { margin: 0 0 18px; padding-left: 22px; color: var(--muted); }
.numbered li { margin-bottom: 6px; }
.numbered strong { color: var(--text); }
/* A button that steps through match the device, light and dark (theme.js). */
.theme-cycle .i { display: none; }
.theme-cycle[data-current="system"] .t-system, .theme-cycle[data-current="light"] .t-light, .theme-cycle[data-current="dark"] .t-dark,
.theme-cycle:not([data-current]) .t-system { display: block; }
/* The three-icon theme control (ui-theme-seg): match this device, light, dark. Its radios show
   the theme in force (theme.js keeps them in step with <html data-theme>). */
.ui-theme-seg { flex-wrap: nowrap; }
.btn.is-copied { --btn-line: var(--ok-line); color: var(--ok-text); }

/* ── utilities ──────────────────────────────────────────────────────── */
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .86rem; }
.tiny { font-size: .8rem; }
.strong { font-weight: 600; }
.tone-bad-text { color: var(--bad-text); }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.plain-list li { display: flex; gap: 8px; align-items: flex-start; }
.plain-list li.row-between { justify-content: space-between; }
.plain-list .i { margin-top: 2px; flex: 0 0 auto; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mt-4 { margin-top: 28px; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; }
.inline { display: inline; }
.hidden, [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.ok-text { color: var(--ok-text); } .warn-text { color: var(--warn-text); } .bad-text { color: var(--bad-text); } .accent-text { color: var(--accent-text); }
.divider { height: 1px; background: var(--line); margin: var(--gap) 0; }
/* A rule with words in it ("or anyone, by email"). */
.divider-text { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.divider-text::before, .divider-text::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.row-end { justify-content: flex-end; flex-wrap: nowrap; gap: 6px; }
.skip-link { position: absolute; left: 12px; top: -40px; z-index: 100; padding: 8px 12px; border-radius: var(--r-sm); background: var(--accent); color: var(--accent-ink); }
.skip-link:focus { top: 12px; }
/* Device-specific copy and controls: a phone or tablet, or a computer with a mouse. */
@media (hover: hover) and (pointer: fine) { .only-touch { display: none !important; } }
@media not ((hover: hover) and (pointer: fine)) { .only-mouse { display: none !important; } }
/* Right to left: arrows that point the way mirror. */
[dir="rtl"] .ps-go .i, [dir="rtl"] .ui-dir { transform: scaleX(-1); }
/* ── components that adapt to the page's width (container queries) ──── */
@container page (max-width: 1180px) {
  .split, .split-wide { grid-template-columns: minmax(0, 1fr); }
  .sticky-side { position: static; }
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container page (max-width: 900px) {
  .fsec { grid-template-columns: 1fr; gap: 14px; }
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
  .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fields > .field, .fields > .w-1, .fields > .w-3, .fields > .w-4 { grid-column: span 1; }
  .fields > .w-full { grid-column: 1 / -1; }
  .reveal-grid { grid-template-columns: 1fr; }
}
@container page (max-width: 560px) {
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fields { grid-template-columns: 1fr; }
  .dl { grid-template-columns: minmax(96px, 38%) minmax(0, 1fr); }
  .page-head { padding-bottom: 16px; }
  .ph-actions { width: 100%; }
  .ph-actions .btn-primary { order: -1; }
  .form-actions .grow { flex-basis: 100%; }
  .statbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .statbar > .stat:nth-child(odd) { border-left: 0; }
  .statbar > .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
}

/* ── the window (shell only) ────────────────────────────────────────── */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 70; left: 0; top: 0; width: 272px; transform: translateX(-100%); transition: transform var(--ease); box-shadow: var(--shadow-lg); }
  .app.is-nav-open .sidebar { transform: none; }
  [data-sidebar="collapsed"] .sidebar .sb-name, [data-sidebar="collapsed"] .sidebar .sb-section,
  [data-sidebar="collapsed"] .sidebar .sb-label, [data-sidebar="collapsed"] .sidebar .sb-count,
  [data-sidebar="collapsed"] .sidebar .sb-ext { display: revert; }
  [data-sidebar="collapsed"] .sidebar .sb-link { justify-content: flex-start; padding: 0 10px; }
  .sb-toggle { display: none !important; }
  .iconbtn.tb-menu { display: inline-grid; }
  .tb-search .tb-search-text, .tb-search .kbd { display: none; }
  .tb-search { flex: 0 0 auto; width: 36px; padding: 0; justify-content: center; }
  /* Sign-in: the brand panel becomes a band above the form. */
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 22px 20px 26px; gap: 14px; justify-content: flex-start; }
  .auth-logo { width: 120px; }
  .auth-product { margin-bottom: 10px; }
  .auth-pitch h2 { font-size: 1.45rem; max-width: none; }
  .auth-pitch p, .auth-foot-note { display: none; }
  .auth-points { margin-top: 10px; font-size: .88rem; }
  .auth-points div:not(:last-child) { display: none; }
  .auth-main { padding: 24px 16px 40px; }
  .auth-card { max-width: 520px; padding: 24px 20px; }
  .enrol { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .modal-body { padding-left: 22px; }
}
/* A phone, or the page zoomed to 400%: the top bar fits the window, so the page never scrolls
   sideways (WCAG 2.1, 1.4.10). Tighter gaps first; the environment label gives way last. */
@media (max-width: 420px) {
  .topbar { gap: 6px; }
  .tb-right { min-width: 0; gap: 2px; }
  .tb-right .env { min-width: 0; overflow: hidden; padding: 0 6px; letter-spacing: .02em; }
}
@media print {
  .sidebar, .topbar, .bulkbar, .toasts, .ph-actions { display: none !important; }
  .app { display: block; }
  body { background: #fff; }
}
