/* packages/ui: base styles and every shared component, theme "A2 Control room" (2026-11-28).
   Buttons, inputs, the app shell (graphite sidebar, context bar, 900px drawer), page header,
   sections, figure bands, key/value, tabs, tables, toolbar, status marks and tags, empty /
   locked / error / not-found states, banners, notices, toasts, code, dialogs and drawers,
   popovers, forms, skeletons, the 900px and 640px layouts, the bar chart. Needs tokens.css
   first. Served at /ui/styles/base.css; each UI links its own app.css after it.

   The look in one paragraph: a soft cool-grey page, a dark graphite sidebar, and white cards
   (12px corners, a 1px edge, a very soft shadow, 24px padding, 16px apart) holding each section,
   each figure and each list. Controls have 8px corners. No pills, no gradients, no pastel hues.
   A table in a card has a soft grey header row and comfortable rows. Status is a small square and
   a word: green only for live and healthy, orange only for problems, grey for everything else.
   Big figures are monospace. Floating layers carry the one deeper shadow. */

/* ================================================================== base */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--t-13) / 1.45 var(--sans);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-weight: 600; }
h1 { font-family: var(--display); letter-spacing: -0.02em; }
ul, ol { margin: 0; padding: 0; }
ul[role="list"] { list-style: none; }

a { color: var(--ink); text-decoration-color: var(--faint); text-underline-offset: 3px; }
a:hover { color: var(--ink); text-decoration-color: var(--ink); }

code, kbd, pre, .mono { font-family: var(--mono); font-size: var(--t-12); letter-spacing: -0.01em; }
pre { margin: 0; }
strong { font-weight: 600; }

.icon { width: 16px; height: 16px; flex: none; vertical-align: -3px; }

:focus { outline: none; }
:focus-visible { outline: var(--focus); outline-offset: 2px; border-radius: var(--radius); }
.main:focus { outline: none; }
/* The page <h1> (tabindex="-1") is focused by the router after a navigation so a screen reader
   announces the new page. It is never in the tab order and cannot be operated, so it draws no
   ring. Interactive elements keep theirs. */
.page-title:focus, .page-title:focus-visible { outline: none; }

[hidden] { display: none !important; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  padding: 8px 12px; background: var(--panel); border: 1px solid var(--ink);
  border-radius: var(--radius); font-weight: 600;
}
.skip-link:focus { top: 8px; }

.dim { color: var(--dim); }
.muted { color: var(--dim); font-size: var(--fs-xs); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }
.bad-text { color: var(--bad); }
/* A figure: monospace, tabular. For ids, hex, JSON and numbers that are read as readings. */
.fig-num { font-family: var(--mono); letter-spacing: -0.03em; }

/* ================================================================== buttons + inputs */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--control-h); padding: 0 14px;
  font: 600 var(--t-13) / 1.2 var(--sans);
  color: var(--ink); background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color 120ms ease-out, border-color 120ms ease-out, color 120ms ease-out, transform 80ms ease-out;
}
.btn:hover { background: var(--panel-2); border-color: var(--line-strong); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: var(--bad-ink); }
.btn-danger:hover { filter: brightness(1.08); background: var(--bad); color: var(--bad-ink); border-color: var(--bad); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--panel-2); border-color: transparent; color: var(--ink); }
.btn-sm { min-height: 26px; padding: 0 9px; font-size: var(--t-12); gap: 4px; border-radius: var(--radius-sm); }
.btn-sm .icon { width: 14px; height: 14px; }
.btn-lg { min-height: 40px; padding: 0 18px; font-size: var(--t-14); }
.btn-icon { padding: 0; min-width: var(--control-h); }
.btn-sm.btn-icon { min-width: 26px; padding: 0; }
.btn:disabled, .btn[aria-disabled="true"] {
  cursor: not-allowed; opacity: 0.55; color: var(--dim);
  background: var(--panel-2); border-color: var(--line); transform: none;
}
.btn-primary:disabled { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); opacity: 0.4; }
.btn-danger:disabled { background: var(--bad); color: var(--bad-ink); border-color: var(--bad); opacity: 0.4; }
/* On a page (header actions, sections) a destructive button is quiet: orange words on white. It
   fills only inside the confirm dialog that carries it out. */
.page .btn-danger { background: var(--panel); color: var(--bad); border-color: var(--line); }
.page .btn-danger:hover { filter: none; background: var(--bad-bg); color: var(--bad); border-color: var(--bad-mark); }
.page .btn-danger:disabled { background: var(--panel-2); color: var(--dim); border-color: var(--line); }
.btn-copy { color: var(--dim); }
.btn-copy.copied { color: var(--ok); border-color: var(--ok); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--control-h); height: var(--control-h); padding: 0;
  color: var(--dim); background: transparent; border: 1px solid transparent; border-radius: var(--radius);
  cursor: pointer; transition: background-color 120ms ease-out, color 120ms ease-out;
}
.icon-btn:hover { color: var(--ink); background: var(--panel-2); }

.input {
  display: block; width: 100%; min-height: 34px; padding: 6px 10px;
  font: 400 var(--t-13) / 1.4 var(--sans); color: var(--ink);
  background: var(--panel); border: 1px solid var(--input-line); border-radius: var(--radius);
  transition: border-color 120ms ease-out, box-shadow 120ms ease-out;
}
.input.mono { font-family: var(--mono); font-size: var(--t-12); letter-spacing: 0.01em; }
.input::placeholder { color: var(--faint); opacity: 1; }
.input:hover { border-color: var(--dim); }
.input:focus-visible { outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.input:disabled { background: var(--panel-2); color: var(--dim); cursor: not-allowed; }
select.input {
  appearance: none; -webkit-appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3E%3Cpath d='M1 2.5 4 5.5 7 2.5' fill='none' stroke='%236B7178' stroke-width='1.2'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
textarea.input { resize: vertical; min-height: 72px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--ink); width: 15px; height: 15px; margin: 0; flex: none; }

/* A checkbox styled as a switch (role="switch"): a square-cornered track, a square knob. */
input.switch {
  appearance: none; -webkit-appearance: none;
  width: 32px; height: 18px; border-radius: 5px;
  background: var(--line-strong); position: relative; cursor: pointer;
  transition: background-color 120ms ease-out;
}
input.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 3px; background: var(--panel);
  transition: transform 120ms ease-out;
}
input.switch:checked { background: var(--ink); }
input.switch:checked::after { transform: translateX(14px); }
input.switch:disabled { opacity: 0.5; cursor: not-allowed; }

/* ================================================================== shell */

.app { min-height: 100vh; }

/* The top bar (the admin dashboard). The console has no top bar: its brand sits in the sidebar
   and its context bar (account, client picker, account menu) heads the content column. */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  height: var(--topbar-h); padding: 0 16px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.menu-btn { display: none; }

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none; flex: none;
}
.brand:hover { color: var(--ink); }
/* The mark: a small outlined square (A2). */
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 12px; height: 12px; border: 1.5px solid currentColor; border-radius: 0;
  background: transparent; color: inherit;
}
.brand-mark .icon { display: none; }
.brand-name { font-family: var(--display); font-weight: 600; font-size: var(--t-18); letter-spacing: -0.02em; }
.brand-sub { color: var(--dim); font-size: var(--t-12); }
.topbar-sep { width: 1px; height: 22px; background: var(--line); flex: none; }

.int { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.int-name { font-weight: 400; font-size: var(--t-12); color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.int-id { display: inline-flex; align-items: center; gap: 4px; color: var(--dim); font-size: var(--fs-xs); white-space: nowrap; }
.int-id-label { font-family: var(--mono); font-size: var(--t-11); }
.int-id-code { color: var(--ink-2); }

.topbar-picker { margin-left: 8px; }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* The client picker: one bordered control, "Client" as a quiet prefix inside it (A2 .ctl). */
.picker {
  display: inline-flex; align-items: center; gap: 0;
  height: var(--control-h); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
}
.picker:hover { border-color: var(--line-strong); }
.picker:focus-within { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.picker-label { display: inline-flex; align-items: center; gap: 4px; padding-left: 12px; color: var(--dim); font-size: var(--t-13); font-weight: 400; white-space: nowrap; }
.picker-label .icon { display: none; }
.picker-select {
  min-width: 150px; max-width: 260px; min-height: 30px; height: 30px; padding-top: 0; padding-bottom: 0; padding-left: 8px;
  border: 0; background-color: transparent; font-weight: 600;
}
.picker-select:hover { border: 0; }
.picker-select:focus-visible { box-shadow: none; border: 0; }

/* The data-source indicator ("Live data"): a green square and a word. Its tip is CSS (data-tip). */
.demo-chip {
  position: relative;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 0; border: 0;
  color: var(--ink-2); font-size: var(--t-12); white-space: nowrap; cursor: help;
}
.demo-chip .icon { display: none; }
.demo-chip::before { content: ""; width: 6px; height: 6px; flex: none; background: var(--faint); }
.demo-chip:hover::after, .demo-chip:focus-visible::after {
  content: attr(data-tip);
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 50;
  width: max-content; max-width: 220px; padding: 7px 10px 8px;
  background: #15171A; color: #FFFFFF; border-radius: var(--radius);
  font-size: var(--t-12); line-height: 1.45; white-space: normal; box-shadow: var(--shadow-float);
}

.acct { position: relative; }
.acct-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: var(--control-h); padding: 0 10px; max-width: 300px;
  color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  cursor: pointer; text-align: left; font: inherit;
}
.acct-btn:hover { border-color: var(--line-strong); background: var(--panel-2); }
.acct-btn > .icon { width: 14px; height: 14px; color: var(--dim); }
.acct-text { display: flex; align-items: baseline; gap: 6px; line-height: 1.2; min-width: 0; }
.acct-name { font-weight: 600; font-size: var(--t-13); white-space: nowrap; }
.acct-sub { color: var(--dim); font-size: var(--t-12); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
  width: 320px; padding: 4px 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-float);
}
.acct-section { padding: 12px 0; display: grid; gap: 6px; }
.acct-section + .acct-section { border-top: 1px solid var(--line); }
.acct-section:first-child { border-bottom: 1px solid var(--line); }
.acct-section:first-child + .acct-section { border-top: 0; }
.acct-token { font-weight: 600; font-size: var(--t-14); }
.acct-meta { color: var(--dim); font-size: var(--fs-xs); }
.acct-actions { gap: 0; padding: 6px 0; }
.menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 6px; border: 0; border-radius: var(--radius);
  background: transparent; color: var(--ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer;
}
.menu-item:hover { background: var(--hover); color: var(--ink); }
.menu-item .icon { width: 14px; height: 14px; color: var(--dim); }

.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px;
  border: 0; background: transparent; color: var(--dim); font: inherit; font-size: var(--t-12); cursor: pointer;
}
.seg + .seg { border-left: 1px solid var(--line); }
.seg:hover { color: var(--ink); background: var(--panel-2); }
.seg-on { background: var(--ink); color: var(--accent-ink); font-weight: 600; }
.seg-on:hover { background: var(--ink); color: var(--accent-ink); }
.seg:focus-visible { outline-offset: -2px; }
.seg .icon { width: 13px; height: 13px; }

.body {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: calc(100vh - var(--topbar-h));
}
.main-col { min-width: 0; }

/* The sidebar: graphite in both UIs (light in the admin dashboard's light mode, data-side="light"
   in tokens.css). It re-points the ink and surface tokens at the sidebar's own, so anything inside
   it (a picker, a link, a muted line) reads right on it unchanged. */
.sidebar {
  --ink: var(--side-ink);
  --ink-2: var(--side-text);
  --dim: var(--side-muted);
  --faint: var(--side-muted);
  --line: var(--side-rule);
  --line-strong: var(--side-line-strong);
  --input-line: var(--side-input-line);
  --panel: var(--side);
  --panel-2: var(--side-on);
  --hover: var(--side-on);
  --accent: var(--side-ink);
  --accent-ink: var(--side);
  --rule-strong: var(--side-rule);
  color-scheme: var(--side-scheme);
  position: sticky; top: var(--topbar-h);
  display: flex; flex-direction: column;
  height: calc(100vh - var(--topbar-h)); overflow-y: auto;
  padding: 18px 0 16px;
  background: var(--side); color: var(--side-text);
}
.sidebar a { color: inherit; }
.sidebar-picker { display: none; }
.sidebar-close { display: none; }
.side-brand { padding: 4px 22px 0; }
.side-brand .brand { color: var(--side-ink); }
/* The system line under the brand ("Data  Live"), between two rules, monospace (A2 .sys). */
.side-sys {
  margin: 16px 22px 0; padding: 9px 0;
  border-top: 1px solid var(--side-rule); border-bottom: 1px solid var(--side-rule);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-family: var(--mono); font-size: var(--t-11); color: var(--side-muted);
}
.side-sys .demo-chip { font-family: var(--mono); font-size: var(--t-11); color: var(--side-text); }
/* "Last message 45 h ago": a grey hollow mark, green and filled only within the online window. */
.side-sys-v { font-weight: 400; color: var(--side-text); display: inline-flex; align-items: center; gap: 6px; }
.side-sys-v::before { content: ""; width: 6px; height: 6px; flex: none; box-sizing: border-box; border: 1px solid var(--side-muted); }
.side-sys-v.side-fresh::before { background: var(--ok); border-color: var(--ok); }
/* The sidebar scrolls (overflow clips), so the chip's tip opens leftwards, inside it. */
.side-sys .demo-chip:hover::after, .side-sys .demo-chip:focus-visible::after {
  left: auto; right: 0; max-width: 164px; font-family: var(--sans); background: #2B2F34;
}
.nav { display: grid; gap: 18px; margin-top: 20px; }
.nav-group-label {
  padding: 0 22px 6px; color: var(--side-muted);
  font-size: var(--t-11); font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase;
}
.nav ul { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.nav-link {
  position: relative;
  display: flex; align-items: baseline; gap: 9px;
  padding: 7px 22px 7px 20px; border-left: 2px solid transparent; border-radius: 0;
  color: var(--side-text); text-decoration: none; font-size: var(--t-13);
  transition: background-color 120ms ease-out, color 120ms ease-out;
}
.nav-link:hover { background: var(--side-on); color: var(--side-ink); }
.nav-link .icon { display: none; }
.nav-label { flex: 1; min-width: 0; }
.nav-count { color: var(--side-muted); font-family: var(--mono); font-size: var(--t-11); }
.nav-on { background: var(--side-on); color: var(--side-ink); font-weight: 600; border-left-color: var(--ok); }
.nav-on .nav-count { color: var(--side-text); font-weight: 400; }
.nav-chip {
  padding: 0 5px; border: 1px solid var(--side-rule); border-radius: var(--radius);
  color: var(--side-muted); font-size: var(--t-11); line-height: 16px; font-weight: 400;
}
.nav-recent .nav-link { font-size: var(--t-12); }
.sidebar-foot { margin-top: auto; padding: 14px 22px 0; border-top: 1px solid var(--side-rule); font-size: var(--t-12); color: var(--side-muted); }
.sidebar-foot .nav-link { padding-left: 0; padding-right: 0; border-left: 0; }
.sidebar-foot .nav-link.nav-on { background: transparent; }
.side-who { display: grid; gap: 1px; padding-top: 10px; }
.side-who b { color: var(--side-ink); font-weight: 600; font-size: var(--t-13); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scrim { display: none; }

.main { min-width: 0; padding: 26px var(--gutter) 72px; }
/* Cards sit 16px apart; the page header keeps a little more air under it. */
.page { max-width: 1232px; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--card-gap); align-content: start; }
.page > .page-header { margin-bottom: 8px; }

/* The console's shell: no top bar, a full-height sidebar, a context bar over the content. */
.shell-side { --topbar-h: 0px; }
.ctxbar {
  display: flex; align-items: center; gap: 12px;
  max-width: calc(1232px + 2 * var(--gutter)); padding: 20px var(--gutter) 0;
}
.ctxbar-who { flex: 1; min-width: 0; color: var(--dim); font-size: var(--t-12); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctxbar-end { display: flex; align-items: center; gap: 8px; }
.shell-side .main { padding-top: 6px; }

/* ================================================================== sign-in */

.app-login { display: grid; place-items: center; padding: 32px 16px; min-height: 100vh; }
.login { width: 100%; display: grid; place-items: center; }
.login-card {
  width: 100%; max-width: 560px; display: grid; gap: 18px;
  padding: 28px 32px; background: var(--card); border: 1px solid var(--card-line);
  border-radius: var(--radius-card); box-shadow: var(--shadow-card);
}
.login-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.login-pitch { color: var(--ink-2); font-size: var(--t-14); max-width: 60ch; }
.login-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.login-foot { color: var(--dim); font-size: var(--fs-xs); padding-top: 12px; border-top: 1px solid var(--line); }

/* ================================================================== page header */

.page-header { display: grid; gap: 6px; padding-bottom: 0; }
.page-header .crumb { margin-bottom: 0; }
.crumb {
  display: inline-flex; align-items: center; gap: 4px; width: max-content;
  color: var(--dim); font-size: var(--fs-xs); text-decoration: none;
}
.crumb:hover { color: var(--ink); }
.crumb .icon { width: 13px; height: 13px; }
.page-header-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-header-main { display: grid; gap: 4px; min-width: 0; flex: 1 1 360px; }
.page-header-lead { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1 1 360px; }
.page-header-lead > .page-header-main { flex: 1 1 auto; }
.page-header-media { flex: none; display: inline-flex; }
.eyebrow { color: var(--dim); font-size: var(--t-12); font-weight: 400; letter-spacing: 0; text-transform: none; }
.page-title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-title { font-family: var(--display); font-size: var(--t-24); line-height: 1.15; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.page-subtitle { color: var(--dim); font-size: var(--t-13); max-width: 72ch; }
/* "About this page": the longer explanation, folded away under the one-line intro. */
.about { max-width: 80ch; color: var(--ink-2); }
/* "About this page" as a small (i) next to the H1: a button that opens a floating note. */
.about-tip {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0;
  border: 0; border-radius: var(--radius); background: transparent; color: var(--faint); cursor: pointer; align-self: center;
}
.about-tip:hover, .about-tip:focus-visible, .about-tip[aria-expanded="true"] { color: var(--ink); background: var(--panel-2); }
.about-tip .icon { width: 15px; height: 15px; }
.about-pop { width: min(420px, calc(100vw - 32px)); padding: 14px 16px; display: grid; gap: 8px; font-size: var(--t-12); color: var(--ink-2); }
.about-pop p { margin: 0; }
.about > summary {
  display: inline-flex; align-items: center; gap: 5px; width: max-content; list-style: none;
  color: var(--dim); font-size: var(--fs-xs); cursor: pointer; border-radius: var(--radius);
  text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px;
}
.about > summary::-webkit-details-marker { display: none; }
.about > summary:hover { color: var(--ink); }
.about > summary .icon { width: 13px; height: 13px; }
.about[open] > summary { margin-bottom: 6px; }
.about-body { display: grid; gap: 6px; padding: 12px 14px; border-radius: var(--radius); background: var(--panel-2); border: 1px solid var(--line); font-size: var(--t-12); }
.page-meta { display: flex; align-items: center; gap: 6px 16px; flex-wrap: wrap; color: var(--dim); font-size: var(--fs-xs); margin-top: 2px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-actions .needs { flex-basis: 100%; justify-content: flex-end; }

/* ================================================================== cards, figure cards, grids */

/* A section is a card: white, a 1px edge, 12px corners, a very soft shadow, 24px padding. Its
   header row is the title (with an optional count), an optional muted note under it, and the
   actions on the right. A flush card (tables) runs its table edge to edge under the header. */
.card {
  min-width: 0; padding: 20px var(--card-pad) var(--card-pad);
  background: var(--card); border: 1px solid var(--card-line); border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 0; border-top: 0; min-height: 26px;
}
.card-head-text { display: grid; gap: 3px; min-width: 0; padding-top: 3px; }
.card-title { font-size: var(--t-14); letter-spacing: -0.005em; display: flex; align-items: baseline; gap: 10px; }
.card-subtitle { color: var(--dim); font-size: var(--fs-xs); max-width: 80ch; }
.card-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-body { padding: 16px 0 0; display: grid; gap: 14px; min-width: 0; }
.card:not(:has(> .card-head)) > .card-body { padding-top: 0; }
/* Flush: no side or bottom padding, the header keeps its own; the corners clip the table rows.
   Anything in a flush body that holds no table (a filter bar, a banner, a foot line, a skeleton)
   keeps the card's side padding; a table, bare or in a wrapper, runs edge to edge. */
.card-flush { padding: 0; overflow: clip; }
.card-flush > .card-head { padding: 18px var(--card-pad) 0; }
.card-flush .card-body { padding: 14px 0 0; gap: 0; }
.card-flush:not(:has(> .card-head)) > .card-body { padding-top: 0; }
.card-flush .card-body > :not(.table-wrap):not(:has(.table-wrap)):not(:empty) { margin: 0 var(--card-pad) 14px; }
.card-flush .card-body > :not(.table-wrap):not(:has(.table-wrap)):not(:empty):last-child { margin-bottom: 20px; }
.card-flush:not(:has(> .card-head)) > .card-body > :not(.table-wrap):not(:has(.table-wrap)):not(:empty):first-child { margin-top: 20px; }
.card-flush .card-body > :is(.table-wrap, :has(.table-wrap)) + :not(:empty) { margin-top: 14px; }
.card-flush .card-body > .table-wrap { border: 0; border-radius: 0; }

/* A card inside a floating layer or inside another card is not a second box: it falls back to a
   plain section, a 1px rule over its heading. */
.card .card, .dialog .card, .drawer .card, .list-card .card {
  padding: 0; background: transparent; border: 0; border-radius: 0; box-shadow: none; overflow: visible;
}
.card .card > .card-head, .dialog .card > .card-head, .drawer .card > .card-head { padding: 12px 0 0; border-top: 1px solid var(--line); }
.card .card .card-body, .dialog .card .card-body, .drawer .card .card-body { padding-top: 10px; }
.card .card:not(:has(> .card-head)) > .card-body, .dialog .card:not(:has(> .card-head)) > .card-body, .drawer .card:not(:has(> .card-head)) > .card-body { padding-top: 0; }
:is(.card, .dialog, .drawer) .card-flush .card-body > * { margin-left: 0; margin-right: 0; }

/* A list page: the filter bar and the table share one card (.list-card wraps both). The bar is a
   padded row under a rule; the table card inside loses its own box and keeps its header row. */
.list-card {
  min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr);
  background: var(--card); border: 1px solid var(--card-line); border-radius: var(--radius-card);
  box-shadow: var(--shadow-card); overflow: clip;
}
.list-card .toolbar { margin: 0; padding: 14px var(--card-pad); border-bottom: 1px solid var(--card-line); }
.list-card > :empty { display: none; }
.page .list-card .stack { gap: 0; }
.list-card .card-flush { overflow: visible; }
.list-card .card-flush > .card-head { padding: 16px var(--card-pad) 0; }
.list-card .card-flush .card-body { padding-top: 12px; }
.list-card .card:not(.card-flush) { padding: 16px var(--card-pad) var(--card-pad); }
.list-card .tabs { padding: 4px var(--card-pad) 0; }
.list-card .notice, .list-card .banner { margin: 16px var(--card-pad) 0; }
.list-card .card .notice, .list-card .card .banner { margin-top: 0; }
.count {
  display: inline-block; min-width: 0; padding: 0; border: 0; background: none;
  color: var(--dim); font-family: var(--mono); font-size: var(--t-12); font-weight: 400; line-height: inherit;
}

/* Figure cards: each readout its own card, side by side 16px apart. A small monoline icon in a
   light grey rounded square, the label, the big monospace figure, then a change line (green up
   or orange down, only where the API gives a comparison) or a muted context line. */
.tiles { display: grid; gap: var(--card-gap); grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.tile {
  position: relative; display: grid; gap: 0; align-content: start;
  padding: 20px 22px; min-height: 0; min-width: 0;
  background: var(--card); border: 1px solid var(--card-line); border-radius: var(--radius-card);
  box-shadow: var(--shadow-card); color: var(--ink); text-decoration: none;
}
a.tile { transition: border-color 120ms ease-out, box-shadow 120ms ease-out, background-color 120ms ease-out; }
a.tile:hover { border-color: var(--line-strong); box-shadow: var(--shadow-card-hover); color: var(--ink); }
.tile-label { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: var(--t-13); font-weight: 400; }
.tile-label:has(> .icon) { min-height: 30px; }
/* The icon square: 30px, 8px corners, a 16px icon drawn at a 1.5px stroke (2.25 on its 24 grid). */
.tile-label > .icon {
  width: 30px; height: 30px; padding: 7px; box-sizing: border-box; flex: none; vertical-align: 0;
  border-radius: var(--radius); background: var(--chip); color: var(--ink-2); stroke-width: 2.25;
}
.tile-value {
  margin-top: 16px; font-family: var(--mono); font-size: var(--t-30); font-weight: 400;
  letter-spacing: -0.04em; line-height: 1; overflow-wrap: anywhere;
}
.tile-unit { margin-left: 8px; font-family: var(--sans); font-size: var(--t-13); font-weight: 400; letter-spacing: 0; color: var(--dim); }
.tile-value-text { font-family: var(--sans); font-size: var(--t-18); letter-spacing: -0.01em; color: var(--ink-2); line-height: 1.2; }
.tile-sub { margin-top: 10px; color: var(--dim); font-size: var(--t-12); }
/* The change line (statTile({ change })): the figure that moved, then its context, muted. */
.tile-change { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; margin-top: 10px; color: var(--dim); font-size: var(--t-12); }
.tile-change-v { font-family: var(--mono); font-weight: 600; color: var(--ink-2); letter-spacing: -0.02em; }
.tile-change-ok .tile-change-v { color: var(--ok); }
.tile-change-bad .tile-change-v { color: var(--bad); }
.tile-go { position: absolute; right: 18px; top: 26px; color: var(--faint); opacity: 0; transform: translateX(-4px); transition: opacity 120ms ease-out, transform 120ms ease-out; }
.tile-go .icon { width: 14px; height: 14px; }
a.tile:hover .tile-go, a.tile:focus-visible .tile-go { opacity: 1; transform: none; color: var(--ink); }
/* A tile that opens a popover (statTile({ button: true })): the same card, a button underneath. */
button.tile { width: 100%; font: inherit; text-align: left; cursor: pointer; transition: border-color 120ms ease-out, box-shadow 120ms ease-out; }
button.tile:hover, button.tile[aria-expanded="true"] { border-color: var(--line-strong); box-shadow: var(--shadow-card-hover); }
button.tile:hover .tile-go, button.tile:focus-visible .tile-go, button.tile[aria-expanded="true"] .tile-go { opacity: 1; transform: none; color: var(--ink); }
button.tile-feature:hover, button.tile-feature[aria-expanded="true"] { background: var(--feature-hover); border-color: var(--feature-hover); }
button.tile-feature .tile-go, button.tile-feature:hover .tile-go { color: var(--feature-text); }
.tile-warn .tile-value, .tile-bad .tile-value { color: var(--bad-mark); }
.tile-ok .tile-value { color: var(--ink); }
/* Not measured: no reading reached the page, so it claims nothing (grey, never a colour). */
.tile-none .tile-value { color: var(--faint); }
/* The highlighted figure (statTile({ feature: true })): graphite like the sidebar, white words.
   One per row at most, for the figure that matters most. */
.tile-feature { background: var(--feature); border-color: var(--feature); color: var(--feature-ink); }
.tile-feature .tile-label, .tile-feature .tile-sub, .tile-feature .tile-change { color: var(--feature-text); }
.tile-feature .tile-unit { color: var(--feature-muted); }
.tile-feature .tile-label > .icon { background: var(--feature-chip); color: var(--feature-ink); }
.tile-feature .tile-value, .tile-feature.tile-ok .tile-value, .tile-feature .tile-value-text { color: var(--feature-ink); }
.tile-feature .tile-change-v { color: var(--feature-ink); }
.tile-feature .tile-change-ok .tile-change-v { color: #3FBF8A; }
.tile-feature .tile-change-bad .tile-change-v { color: #F2814F; }
.tile-feature.tile-none .tile-value { color: var(--feature-muted); }
a.tile-feature:hover { background: var(--feature-hover); border-color: var(--feature-hover); color: var(--feature-ink); }
a.tile-feature:hover .tile-go, a.tile-feature:focus-visible .tile-go { color: var(--feature-ink); }
.tile-feature .skel { background: var(--feature-chip); }
/* Figure cards inside a card (a usage block on a detail page): the edge only, no second shadow. */
.card .tile, .card a.tile:hover { box-shadow: none; }

.grid { display: grid; gap: var(--card-gap); align-items: start; }
/* Cards side by side share one height. */
.grid > .card { align-self: stretch; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stack { display: grid; gap: 12px; min-width: 0; }
.page .stack:has(> .card) { gap: var(--card-gap); }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ================================================================== key/value */

.kv { display: grid; gap: 0; margin: 0; }
.kv-row { display: grid; grid-template-columns: minmax(120px, 34%) minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.kv-row:last-child { border-bottom: 1px solid var(--line); }
.card .kv-row:last-child, .card .kv-2 > .kv-row:nth-last-child(2):nth-child(odd) { border-bottom: 0; padding-bottom: 0; }

.kv dt { color: var(--dim); font-size: var(--fs-xs); padding-top: 1px; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kv dd.mono { font-family: var(--mono); font-size: var(--t-12); }
.kv-hint { color: var(--dim); font-size: var(--fs-xs); flex-basis: 100%; font-family: var(--sans); }
.kv-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }

/* ================================================================== tabs */

/* The baseline is an inset shadow, not a border: the active tab's 2px underline paints over it. */
.tabs { display: flex; gap: 4px; box-shadow: inset 0 -1px 0 var(--line); overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 10px 9px;
  border: 0; border-bottom: 2px solid transparent; background: transparent;
  color: var(--dim); font: 400 var(--t-13) / 1.2 var(--sans); text-decoration: none; white-space: nowrap; cursor: pointer;
}
.tab:first-child { padding-left: 0; }
.tab:hover { color: var(--ink); }
.tab-on { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }
.tab:disabled { opacity: 0.5; cursor: not-allowed; }
.tab:focus-visible { outline-offset: -2px; }
.tab-count { padding: 0; border: 0; background: none; color: var(--dim); font-family: var(--mono); font-size: var(--t-11); font-weight: 400; line-height: 1; }
.tabs-sm .tab { padding: 5px 8px 6px; font-size: var(--fs-xs); }
.tab-panel { min-width: 0; }

/* ================================================================== table */

/* Tables live in cards: a soft grey header row (uppercase 11px), comfortable rows on 1px rules,
   right-aligned tabular numbers, a wash and a chevron on a clickable row. In a flush card, or as
   the direct body of a card, the table runs edge to edge and its outer cells take the card's
   24px padding. */
.table-wrap { overflow-x: auto; min-width: 0; background: transparent; border: 0; border-radius: 0; padding: 0; margin: 0; }
.table { width: 100%; border-collapse: collapse; font-size: var(--t-13); }
.table th {
  position: sticky; top: 0;
  height: 36px; padding: 0 12px; text-align: left; white-space: nowrap; vertical-align: middle;
  background: var(--card-head); border-bottom: 1px solid var(--card-line);
  color: var(--dim); font-size: var(--t-11); font-weight: 400; letter-spacing: 0.04em; text-transform: uppercase;
}
.table td { height: 46px; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.card:not(.card-flush) > .card-body > .table-wrap { margin: 0 calc(-1 * var(--card-pad)); }
.card-flush .table thead th { border-top: 1px solid var(--card-line); }
:is(.card-flush, .card:not(.card-flush) > .card-body > .table-wrap) .table :is(th, td):first-child { padding-left: var(--card-pad); }
:is(.card-flush, .card:not(.card-flush) > .card-body > .table-wrap) .table :is(th, td):last-child { padding-right: var(--card-pad); }
/* Inside a floating layer or a second card the table does not bleed; its outer cells keep 12px. */
:is(.card, .dialog, .drawer) .card > .card-body > .table-wrap { margin: 0; }
:is(.card, .dialog, .drawer) .card .table :is(th, td):first-child { padding-left: 12px; }
:is(.card, .dialog, .drawer) .card .table :is(th, td):last-child { padding-right: 12px; }
.list-card .table :is(th, td):first-child { padding-left: var(--card-pad); }
.list-card .table :is(th, td):last-child { padding-right: var(--card-pad); }
/* An icon-only copy button in a table row shows on hover or keyboard focus of its row. */
@media (hover: hover) {
  .table tbody tr .btn-copy.btn-icon { opacity: 0; transition: opacity 120ms ease-out; }
  .table tbody tr:hover .btn-copy.btn-icon, .table tbody tr:focus-within .btn-copy.btn-icon, .table .btn-copy.copied { opacity: 1; }
}
.table .btn-copy.btn-icon { border-color: transparent; background: transparent; }
/* A name cell: plain words first, the technical name under it, small, muted, monospace. */
.name-cell { display: grid; gap: 1px; min-width: 0; }
.name-plain { color: var(--ink); font-weight: 600; }
.name-tech { display: inline-flex; align-items: center; gap: 2px; color: var(--dim); font-family: var(--mono); font-size: var(--t-11); overflow-wrap: anywhere; }
.table td.mono { font-family: var(--mono); font-size: var(--t-12); }
.al-num { text-align: right; font-variant-numeric: tabular-nums; }
.al-end { text-align: right; }
td.al-num { font-family: var(--mono); font-size: var(--t-12); }
th.al-num .th-sort, th.al-end .th-sort { flex-direction: row-reverse; }
.th-sort {
  display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none;
  color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer;
}
.th-sort:hover { color: var(--ink); }
.th-sort .icon { width: 12px; height: 12px; }
.sort-off { opacity: 0.35; }
.row-click { cursor: pointer; }
.row-click td { transition: background-color 120ms ease-out, box-shadow 120ms ease-out; }
.row-click:hover td, .row-click:focus-within td { background: var(--hover); }
.row-click:focus-visible { outline: var(--focus); outline-offset: -2px; }
.row-link { color: var(--ink); font-weight: 600; text-decoration: none; }
.row-link:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--faint); }
/* The chevron of a clickable row: hidden until the row is hovered or focused. */
.table th.go-c, .table td.go-c { width: 28px; padding-left: 0; padding-right: 0; text-align: right; }
.chev { display: inline-flex; align-items: center; justify-content: flex-end; width: 24px; height: 24px; color: var(--faint); opacity: 0; transform: translateX(-4px); transition: opacity 120ms ease-out, transform 120ms ease-out, color 120ms ease-out; vertical-align: middle; }
.chev .icon { width: 14px; height: 14px; }
.row-click:hover .chev, .row-click:focus-within .chev { opacity: 1; transform: none; color: var(--ink); }
/* A row with a problem: the orange wash (A2 tr.flag). A warning: an orange rule on its left. */
.row-bad td { background: var(--bad-bg); }
.row-bad.row-click:hover td { background: var(--bad-hover); }
.row-warn td:first-child { box-shadow: inset 2px 0 0 var(--bad-mark); }
.row-selected td { background: var(--panel-2); }
.row-selected td:first-child { box-shadow: inset 2px 0 0 var(--ink); }
.row-muted td { color: var(--dim); }
.table-dense td { height: 40px; padding: 6px 10px; }
.table-dense th { height: 34px; padding: 0 10px; }
/* A time cell (pages/live/common.js timeCell): the time never wraps mid-date. */
.ms-when time, .table td time { white-space: nowrap; }
.cell-sub { display: block; color: var(--dim); font-size: var(--fs-xs); font-weight: 400; }
.zero { color: var(--faint); }

/* ================================================================== toolbar */

/* One filter row of 32px controls (A2 .ctl): a white search with a 1px rule, then selects with
   their label inline ("Client  All clients"), toggles, and the count on the same line, right. */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.tb-search { position: relative; flex: 0 1 280px; min-width: 200px; }
.tb-search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 13px; height: 13px; color: var(--faint); pointer-events: none; }
.tb-search .input { padding-left: 30px; min-height: var(--control-h); height: var(--control-h); background: var(--panel); border-color: var(--line); }
.tb-search .input:hover { border-color: var(--line-strong); }
.tb-search .input:focus-visible { background: var(--panel); border-color: var(--ink); }
.tb-select {
  display: inline-flex; align-items: center; gap: 0; flex: none;
  height: var(--control-h); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
}
.tb-select:hover { border-color: var(--line-strong); }
.tb-select:focus-within { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.tb-select label { padding-left: 12px; color: var(--dim); font-size: var(--t-13); font-weight: 400; white-space: nowrap; }
.tb-select .input {
  min-height: 30px; height: 30px; padding-top: 0; padding-bottom: 0; padding-left: 8px;
  border: 0; background-color: transparent; max-width: 200px;
}
.tb-select .input:hover { border: 0; }
.tb-select .input:focus-visible { box-shadow: none; border: 0; }
.tb-toggle { display: inline-flex; align-items: center; gap: 7px; height: var(--control-h); padding: 0 4px; cursor: pointer; white-space: nowrap; font-size: var(--t-13); color: var(--ink-2); }
.tb-end { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: var(--t-12); color: var(--dim); min-height: var(--control-h); }

/* ================================================================== status marks and tags */

/* A status is a small square and a word, never a filled pill (A2 .st). Green only for live and
   healthy, orange only for problems (filled: broken; outlined: needs a look), grey for
   everything else. The word starts with a capital on screen; its text stays as written. */
.pills { display: inline-flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; }
.pill, .st {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 0; border: 0; border-radius: 0; background: none;
  color: var(--dim); font-size: var(--t-12); font-weight: 400; line-height: 18px; white-space: nowrap;
}
.pill .icon, .st .icon { display: none; }
.pill-text { display: inline-block; }
.pill-text::first-letter { text-transform: uppercase; }
.st::before {
  content: ""; width: 6px; height: 6px; flex: none; box-sizing: border-box;
  border: 1px solid var(--faint); background: transparent;
}
.st-ok { color: var(--ink-2); }
.st-ok::before { background: var(--ok); border-color: var(--ok); }
.st-bad { color: var(--bad); font-weight: 600; }
.st-bad::before { background: var(--bad-mark); border-color: var(--bad-mark); }
.st-warn { color: var(--ink); font-weight: 600; }
.st-warn::before { border: 1.5px solid var(--bad-mark); }
.st-neutral { color: var(--dim); }
.st-dark { color: var(--ink); }
.st-dark::before { background: var(--ink); border-color: var(--ink); }

/* A tag names a category (a family, a type, "Shared port"): plain words, no box, no mark. A2 has
   no pills, square or round; a boxed look is kept only for a code token inside running prose. */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 0; border: 0; border-radius: 0; background: transparent;
  color: var(--ink-2); font-size: var(--t-12); font-weight: 400; line-height: 18px; white-space: nowrap;
}
.tag::before { content: none; }
.tag .pill-text::first-letter { text-transform: none; }
.pill.mono .pill-text, .tag.mono .pill-text { font-family: var(--mono); font-size: var(--t-11); }

/* Permission ids: a monospace list with commas, no boxes ("data:read, raw:read and 7 more"). */
.perm-chips { display: inline; color: var(--ink-2); font-size: var(--t-12); line-height: 18px; }
.perm {
  display: inline; padding: 0; border: 0; border-radius: 0; background: transparent;
  color: var(--ink-2); font-family: var(--mono); font-size: var(--t-12); white-space: nowrap;
}
.perm-sep { color: var(--dim); }
.perm-more { font-family: var(--sans); color: var(--dim); white-space: nowrap; }
.perm-chips[tabindex] { cursor: help; }

/* An empty value: blank (screen readers hear "none"), or a muted word. Never a dash. */
.blank { color: var(--dim); }

/* One line, cut with an ellipsis; the full text is in the title. For names, clients and models
   in a table, so a row keeps the 42px rhythm. */
.clip { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table td .clip { max-width: 240px; }

/* ================================================================== empty / locked / not found */

.empty, .locked {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 16px 18px; border: 0; border-radius: var(--radius);
  background: var(--panel-2);
}
.empty-icon {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 30px; height: 30px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); color: var(--dim);
}
.empty-icon .icon { width: 15px; height: 15px; }
.empty-text { flex: 1 1 260px; display: grid; gap: 2px; }
.empty-title { font-weight: 600; }
.empty-body { color: var(--dim); max-width: 70ch; font-size: var(--t-12); }
.empty-action { flex: none; }
.empty-compact { padding: 10px 12px; gap: 10px; }
.empty-compact .empty-title { font-weight: 400; color: var(--dim); }
.empty-compact .empty-icon { display: none; }
.locked .empty-icon { color: var(--ink); }

.not-found {
  display: grid; justify-items: start; gap: 10px;
  max-width: 560px; margin: 24px 0; padding: 24px;
  background: var(--card); border: 1px solid var(--card-line); border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

/* ================================================================== banners, notices, needs */

.banner {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel-2); color: var(--ink);
}
.banner > .icon { margin-top: 1px; width: 15px; height: 15px; }
.banner-body { flex: 1; min-width: 0; display: grid; gap: 4px; }
.banner-action { flex: none; align-self: center; }
.banner-info > .icon { color: var(--ink-2); }
.banner-warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--bad-mark) 28%, transparent); }
.banner-warn > .icon { color: var(--bad); }
.banner-bad { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad-mark) 40%, transparent); }
.banner-bad > .icon { color: var(--bad); }
.banner-ok { border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.banner-ok > .icon { color: var(--ok); }

.notice {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 9px 12px; border-radius: var(--radius); font-size: var(--t-12);
  background: var(--panel-2); border: 1px solid var(--line);
}
.notice > .icon { margin-top: 1px; width: 14px; height: 14px; }
.notice-info > .icon { color: var(--ink-2); }
.notice-warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--bad-mark) 28%, transparent); }
.notice-warn > .icon { color: var(--bad); }
.notice-bad { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad-mark) 40%, transparent); }
.notice-bad > .icon { color: var(--bad); }
.notice ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.notice p { margin: 0; }

.needs {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--dim); font-size: var(--fs-xs); white-space: nowrap;
}
.needs .icon { width: 12px; height: 12px; }
.needs code { color: var(--ink-2); }

/* ================================================================== toasts */

/* A toast is a floating layer: ink, white words, a square mark, the one shadow (A2 .toast). */
.toasts {
  position: fixed; left: 50%; bottom: 28px; z-index: 200; transform: translateX(-50%);
  display: grid; gap: 8px; width: min(440px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 8px 9px 14px; border-radius: var(--radius);
  background: #15171A; color: #FFFFFF; border: 0;
  box-shadow: var(--shadow-float); pointer-events: auto; font-size: var(--t-13);
  animation: toast-in 140ms var(--ease);
}
.toast > .icon { display: none; }
.toast::before { content: ""; width: 6px; height: 6px; flex: none; background: #3FBF8A; }
.toast-text { flex: 1; }
.toast .icon-btn { width: 24px; height: 24px; color: #B4B9BF; }
.toast .icon-btn:hover { background: #2B2F34; color: #FFFFFF; }
.toast-info::before { background: transparent; border: 1px solid #B4B9BF; }
.toast-warn::before { background: transparent; border: 1.5px solid #F2814F; }
.toast-bad::before { background: #F2814F; }
.toast-out { opacity: 0; transform: translateY(4px); transition: opacity 140ms ease-out, transform 140ms ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ================================================================== code, ids */

.code {
  position: relative; display: flex; align-items: flex-start; gap: 8px;
  padding: 8px 8px 8px 12px; border-radius: var(--radius);
  background: var(--panel-2); border: 1px solid var(--line); min-width: 0;
}
.code-label {
  display: block; color: var(--dim); font-size: var(--t-11); font-weight: 400; letter-spacing: 0.04em; text-transform: uppercase;
}
.code > .code-label { position: absolute; top: -9px; left: 10px; padding: 0 4px; background: var(--panel); border-radius: 0; line-height: 16px; }
.code-text { flex: 1; min-width: 0; overflow-x: auto; font-size: var(--t-12); line-height: 1.55; padding-top: 3px; }
.code-wrap .code-text { white-space: pre-wrap; word-break: break-all; }
.code .btn-copy { flex: none; }

.id-chip { display: inline-flex; align-items: center; gap: 2px; }
.id-chip code { color: var(--ink-2); }

/* ================================================================== dialog + drawer */

/* Floating layers carry the one shadow. Motion (A2): a modal fades in with a 4px rise from scale
   0.98 in 150 ms, a drawer slides in from the right in 160 ms, the scrim (::backdrop) fades in
   160 ms. Closing runs the same way back: dialog.js removes [open] at once, and the transitions on
   display and overlay (allow-discrete) keep the layer painted while it fades. A browser without
   those transitions just closes it. prefers-reduced-motion turns all of it off (end of file). */
.dialog, .drawer {
  padding: 0; border: 1px solid var(--line); color: var(--ink); background: var(--panel);
  box-shadow: var(--shadow-float);
}
.dialog::backdrop, .drawer::backdrop {
  background: var(--scrim);
  transition: opacity 160ms ease-out, overlay 160ms allow-discrete, display 160ms allow-discrete;
}
.dialog:not([open])::backdrop, .drawer:not([open])::backdrop { opacity: 0; }
.dialog[open]::backdrop, .drawer[open]::backdrop { animation: scrim-in 160ms ease-out; }
@keyframes scrim-in { from { opacity: 0; } to { opacity: 1; } }
.dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px);
  border-radius: var(--radius-card); overflow: hidden;
  flex-direction: column;
  transition: opacity 120ms ease-out, transform 120ms ease-out, overlay 120ms allow-discrete, display 120ms allow-discrete;
}
.dialog:not([open]) { opacity: 0; transform: translateY(4px) scale(.98); }
.dialog[open] { display: flex; animation: dialog-in 150ms var(--ease); }
.dialog-sm { width: min(460px, calc(100vw - 32px)); }
.dialog-lg { width: min(600px, calc(100vw - 32px)); }
.dialog-head, .drawer-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin: 0 24px; padding: 20px 0 14px; border-bottom: 1px solid var(--line);
}
.dialog-title, .drawer-title { font-family: var(--display); font-size: var(--t-18); line-height: 1.25; letter-spacing: -0.015em; }
.dialog-close { margin: -4px -6px 0 0; }
/* The head and the footer keep their height; the body takes what is left and scrolls, so the
   actions stay in view on a short screen (a phone, a tall result such as a one-time secret). */
.dialog-head, .dialog-foot, .drawer-head, .drawer-foot { flex: none; }
.dialog-body { flex: 1 1 auto; min-height: 0; padding: 16px 24px; overflow-y: auto; overscroll-behavior: contain; display: grid; gap: 14px; align-content: start; }
.dialog-desc { color: var(--ink-2); }
.dialog-foot, .drawer-foot {
  display: flex; justify-content: flex-end; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 14px 24px; border-top: 1px solid var(--line); background: var(--card-head);
}
/* A "More" menu in a footer sits at the far left, away from the main action. */
.dialog-foot > .menu-wrap:first-child, .drawer-foot > .menu-wrap:first-child { margin-right: auto; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(4px) scale(.98); } to { opacity: 1; transform: none; } }

/* The side drawer: 420px, floating 8px in from the right edge, full height, 12px corners, over
   the scrim. */
.drawer {
  position: fixed; inset: 8px 8px 8px auto; margin: 0;
  width: min(420px, calc(100vw - 16px)); height: calc(100vh - 16px); max-height: calc(100vh - 16px); height: calc(100dvh - 16px); max-height: calc(100dvh - 16px);
  border-radius: var(--radius-card); overflow: hidden;
  flex-direction: column;
  transition: transform 160ms var(--ease), overlay 160ms allow-discrete, display 160ms allow-discrete;
}
.drawer:not([open]) { transform: translateX(calc(100% + 16px)); }
.drawer[open] { display: flex; animation: drawer-in 160ms var(--ease); }
.drawer-lg { width: min(560px, calc(100vw - 16px)); }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 24px 24px; display: grid; gap: 18px; align-content: start; }
.drawer-foot:empty { display: none; }
@keyframes drawer-in { from { transform: translateX(calc(100% + 16px)); } to { transform: none; } }
/* A toast raised while a modal or a drawer is open sits in that layer (dialog.js mounts its toast
   area there), never over its actions: the area is a zero-height strip between the body and the
   footer, and its toasts rise from it over the end of the body. However tall the footer grows (it
   wraps on a phone), the toast stays above it; Done and the primary action are always clickable,
   even while a hovered toast waits. */
:is(.dialog, .drawer) > .toasts {
  position: relative; left: auto; bottom: auto; top: -10px; transform: none; z-index: 1;
  flex: none; height: 0; width: auto; margin: 0 24px;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 8px;
}
:is(.dialog, .drawer) > .toasts > .toast { width: min(100%, 440px); }

/* ================================================================== popover and menu (js/popover.js) */

/* A floating layer on the native popover API, placed by Floating UI next to its trigger. The
   UA centres a popover with margin: auto and inset: 0; the kit places it, so both are reset.
   It fades in with a 4px rise in 140 ms and fades out in 120 ms. */
.popover {
  position: fixed; inset: auto; margin: 0; left: 0; top: 0;
  min-width: 200px; max-width: min(360px, calc(100vw - 16px)); padding: 4px 16px;
  color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-float); overflow: visible;
  transition: opacity 120ms ease-out, transform 120ms ease-out, overlay 120ms allow-discrete, display 120ms allow-discrete;
}
/* display: none too: a popover whose own class sets display (.about-pop is a grid) would otherwise
   stay laid out while closed, invisible over the page, and swallow clicks (the phone menu button,
   found by lane search-palette). The display transition above keeps the fade-out. */
.popover[popover]:not(:popover-open) { opacity: 0; transform: translateY(4px); display: none; }
.popover:popover-open { animation: pop-in 140ms var(--ease); }
@keyframes pop-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
/* The account menu is a popover: the static placement rules of .acct-menu do not apply. */
.acct-menu.popover { right: auto; width: 320px; z-index: auto; }

/* The "More" menu (menuButton): a button with a small chevron, a list of plain rows. A
   destructive row is last, under a rule, in orange words; it opens a confirm modal. */
.menu-wrap { display: inline-flex; }
.btn-menu { gap: 8px; }
.btn-menu-chev { width: 10px; height: 10px; color: var(--dim); transition: transform 120ms ease-out; }
.btn-menu[aria-expanded="true"] { background: var(--panel-2); border-color: var(--dim); }
.btn-menu[aria-expanded="true"] .btn-menu-chev { transform: rotate(180deg); }
.menu-pop { min-width: 220px; padding: 4px; }
.menu-pop .menu-item { padding: 7px 10px; font-size: var(--t-13); }
.menu-pop .menu-item:focus-visible { outline: none; background: var(--hover); box-shadow: inset 2px 0 0 var(--ink); }
.menu-item-text { display: grid; gap: 1px; min-width: 0; }
.menu-item-hint { color: var(--dim); font-size: var(--t-12); }
.menu-item-danger { color: var(--bad); }
.menu-item-danger:hover { background: var(--bad-bg); color: var(--bad); }
.menu-pop .menu-item-danger:focus-visible { background: var(--bad-bg); box-shadow: inset 2px 0 0 var(--bad-mark); }
.menu-item[aria-disabled="true"] { color: var(--dim); cursor: not-allowed; }
.menu-item[aria-disabled="true"]:hover { background: transparent; color: var(--dim); }
.menu-rule { height: 1px; margin: 4px 6px; background: var(--line); }

/* ================================================================== tooltip (js/tooltip.js) */

/* Ink, white words, 12px, no arrow (A2 .tip). Fades in with a 3px rise; never takes the pointer. */
.tooltip {
  position: fixed; inset: auto; margin: 0; left: 0; top: 0; z-index: 300;
  max-width: min(320px, calc(100vw - 16px)); padding: 6px 9px 7px; border: 0; border-radius: var(--radius-sm);
  background: #15171A; color: #FFFFFF; font: 400 var(--t-12) / 1.45 var(--sans);
  box-shadow: var(--shadow-float); pointer-events: none; overflow: visible;
  opacity: 0; transform: translateY(3px); transition: opacity 120ms ease-out, transform 120ms ease-out;
}
.tooltip[data-side="bottom"] { transform: translateY(-3px); }
.tooltip.tooltip-in { opacity: 1; transform: none; }
:root[data-theme="dark"] .tooltip { background: #2B2F34; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tooltip { background: #2B2F34; } }

/* A key/value hint shown as an info mark with a tooltip (kv(..., { hints: 'tip' })). */
.kv-tip {
  display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; padding: 0;
  color: var(--faint); background: transparent; border: 0; border-radius: var(--radius); cursor: help;
}
.kv-tip:hover, .kv-tip:focus-visible { color: var(--ink); background: var(--panel-2); }
.kv-tip .icon { width: 13px; height: 13px; }

/* ================================================================== forms */

.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field-label { font-weight: 400; font-size: var(--t-12); color: var(--ink-2); }
.req { color: var(--bad); }
.field-hint { color: var(--dim); font-size: var(--fs-xs); }
.field-error, .field-reason { display: flex; align-items: flex-start; gap: 5px; font-size: var(--fs-xs); }
.field-error { color: var(--bad); font-weight: 600; }
.field-reason { color: var(--dim); }
.field-error .icon, .field-reason .icon { width: 13px; height: 13px; margin-top: 1px; }
.field-invalid .input { border-color: var(--bad-mark); }
.field-invalid .input:focus-visible { box-shadow: 0 0 0 1px var(--bad-mark); }
.field-disabled .field-label { color: var(--dim); }
.field-check { gap: 3px; }
.field-check-row { display: flex; align-items: center; gap: 8px; }
.field-check-row .field-label { font-weight: 400; font-size: var(--t-13); color: var(--ink); cursor: pointer; }
.field-check .field-hint, .field-check .field-reason, .field-check .field-error { padding-left: 23px; }
.field-switch .field-hint, .field-switch .field-reason, .field-switch .field-error { padding-left: 40px; }
.field-row { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }

.fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; min-width: 0; }
.fieldset > legend { padding: 0; margin-bottom: 8px; }

.radio-cards { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 8px; }
.radio-cards > legend { padding: 0; margin-bottom: 8px; }
.rc-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.rc {
  position: relative; display: grid; gap: 4px; align-content: start;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); cursor: pointer; transition: border-color 120ms ease-out, box-shadow 120ms ease-out;
}
.rc:hover { border-color: var(--line-strong); }
.rc-input { position: absolute; opacity: 0; pointer-events: none; }
.rc:has(.rc-input:focus-visible) { outline: var(--focus); outline-offset: 2px; }
.rc-head { display: flex; align-items: center; gap: 8px; }
.rc-head > .icon { color: var(--dim); width: 15px; height: 15px; }
.rc-title { font-weight: 600; flex: 1; }
.rc-check {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 1px; border: 1px solid var(--input-line); color: transparent;
}
.rc-check .icon { width: 10px; height: 10px; }
.rc-body { color: var(--dim); font-size: var(--fs-xs); }
.rc-on { border-color: var(--ink); background: var(--panel); box-shadow: inset 0 0 0 1px var(--ink); }
.rc-on .rc-head > .icon { color: var(--ink); }
.rc-on .rc-check { background: var(--ink); border-color: var(--ink); color: var(--accent-ink); }
.rc-disabled { cursor: not-allowed; opacity: 0.55; }
.rc-disabled:hover { border-color: var(--line); }
/* A2: a single choice is a radio pair on ruled rows, not two bordered cards with a checkbox. */
.radio-cards .rc-grid { grid-template-columns: minmax(0, 1fr); gap: 0; border-top: 1px solid var(--line); }
.radio-cards .rc { padding: 10px 0 10px 26px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; box-shadow: none; }
.radio-cards .rc:hover { border-color: var(--line); background: var(--hover); }
.radio-cards .rc-input { left: 2px; top: 12px; opacity: 1; pointer-events: none; }
.radio-cards .rc:has(.rc-input:focus-visible) { outline-offset: -2px; }
.radio-cards .rc-check, .radio-cards .rc-head > .icon { display: none; }
.radio-cards .rc-on { border-color: var(--line); box-shadow: none; background: transparent; }
.radio-cards .rc-disabled:hover { background: transparent; }

.disclosure {
  display: grid; gap: 10px; padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--bad-mark) 28%, transparent); background: var(--warn-bg);
}
.disclosure-info { border-color: var(--line); background: var(--panel-2); }
.disclosure-title { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.disclosure-title .icon { width: 15px; height: 15px; }
.disclosure-warn .disclosure-title .icon { color: var(--bad); }
.disclosure-info .disclosure-title .icon { color: var(--ink-2); }
.disclosure-intro { color: var(--ink-2); }
.disclosure-list { display: grid; gap: 8px; padding-left: 18px; }
.disclosure-list li { padding-left: 2px; }
.ack {
  display: flex; align-items: center; gap: 8px; padding-top: 8px;
  border-top: 1px solid color-mix(in srgb, var(--ink) 12%, transparent); font-weight: 600; cursor: pointer;
}
.secret-once .ack { border-top-color: var(--line); }

/* ================================================================== secret once */

.secret-once { display: grid; gap: 14px; }
.secret-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius);
  background: var(--warn-bg); border: 1px solid color-mix(in srgb, var(--bad-mark) 28%, transparent);
}
.secret-head .icon { color: var(--bad); }
.secret-heading { font-weight: 600; }
.secret-intro { color: var(--ink-2); }
.secret-fields { display: grid; gap: 16px; padding-top: 6px; }
.secret-field-secret .code { border-color: var(--ink); background: var(--panel); }
.secret-field-secret .code > .code-label { color: var(--ink); }
.secret-example { padding-top: 6px; }

/* ================================================================== responsive */

@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .int-id-label { display: none; }
}

@media (max-width: 900px) {
  :root { --gutter: 16px; }
  .menu-btn { display: inline-flex; }
  .topbar { gap: 10px; padding: 0 10px; }
  .topbar-picker, .topbar-sep, .brand-sub { display: none; }
  .ctxbar .picker { display: none; }
  .int-id { display: none; }
  .acct-sub { display: none; }
  .body { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 60;
    width: min(300px, 86vw); height: 100vh;
    transform: translateX(-102%);
    /* Closed: hidden from the tab order and assistive tech once the slide-out finishes. */
    visibility: hidden; transition: transform 0.2s ease-out, visibility 0s linear 0.2s;
    box-shadow: var(--shadow-float); padding-top: 12px;
  }
  .sidebar-open .sidebar { transform: none; visibility: visible; transition: transform 0.2s ease-out, visibility 0s; }
  .sidebar-close { display: inline-flex; align-self: flex-end; flex: none; margin: -4px 10px 6px 0; }
  .sidebar-picker { display: block; padding: 0 22px 14px; margin: 14px 0 0; border-bottom: 1px solid var(--side-rule); }
  .sidebar-picker .picker { display: flex; width: 100%; }
  .sidebar-picker .picker-select { max-width: none; min-width: 0; width: 100%; }
  .sidebar-open .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: var(--scrim); }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .kv-2 { grid-template-columns: minmax(0, 1fr); }
  .ctxbar { padding-top: 12px; }
}

@media (max-width: 640px) {
  :root { --card-pad: 16px; }
  .main { padding: 18px var(--gutter) 56px; }
  .shell-side .main { padding-top: 6px; }
  .page-title { font-size: 21px; }
  .page-subtitle { font-size: var(--t-13); }
  .brand-name { display: none; }
  .side-brand .brand-name { display: inline; }
  .acct-btn { padding: 0 8px; }
  .acct-text { display: none; }
  .topbar { gap: 8px; }
  .int-name { font-size: var(--t-12); }
  .field-row { grid-template-columns: minmax(0, 1fr); }
  .tb-search { max-width: none; flex-basis: 100%; }
  .tb-select { flex: 1 1 140px; min-width: 0; }
  .tb-end { margin-left: 0; }
  .kv-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .dialog-foot .btn { flex: 1 1 auto; }
  .dialog { max-height: calc(100dvh - 32px); }
  .dialog-head { margin: 0 16px; padding: 16px 0 12px; }
  .dialog-body { padding: 14px 16px; }
  .dialog-foot { padding: 12px 16px; }
  :is(.dialog, .drawer) > .toasts { margin: 0 16px; }
  .tile { padding: 14px 16px 16px; }
  .login-card { padding: 20px 18px; }
  .tile-value { font-size: var(--t-24); }

  /* Tables become stacked rows: each row a block between rules, each cell "label: value". */
  .table-wrap { padding: 0; margin: 0; overflow: visible; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tbody { display: grid; gap: 0; border-top: 1px solid var(--line); }
  .table tr { padding: 10px 0; background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
  /* A stacked row in a card keeps the card's side padding; its cells start at the row's edge. */
  :is(.card-flush, .list-card, .card:not(.card-flush) > .card-body > .table-wrap) .table tr { padding-left: var(--card-pad); padding-right: var(--card-pad); }
  :is(.card, .dialog, .drawer) .card .table tr { padding-left: 0; padding-right: 0; }
  .table tbody tr:last-child { border-bottom: 0; }
  :is(#main, .dialog, .drawer) .table :is(th, td) { padding-left: 0; padding-right: 0; }
  .table td {
    display: grid; grid-template-columns: minmax(96px, 38%) minmax(0, 1fr); gap: 2px 10px;
    height: auto; padding: 3px 0; border: 0; text-align: left;
  }
  .table td::before { content: attr(data-label); color: var(--dim); font-size: var(--fs-xs); font-family: var(--sans); font-weight: 400; }
  .table td > * { grid-column: 2; justify-self: start; min-width: 0; max-width: 100%; }
  /* The desktop cap (240px) is wider than the value column on a 400px phone: follow the column. */
  .table td .clip { max-width: 100%; }
  .table td .pill { white-space: normal; }
  .table td .pill-text { overflow-wrap: anywhere; }
  .table td.td-primary { display: block; padding-bottom: 6px; font-size: var(--t-14); }
  .table td.td-primary::before { content: none; }
  .table td.hide-card, .table td.go-c { display: none; }
  .table td.al-num, .table td.al-end { text-align: left; }
  .row-warn td:first-child, .row-selected td:first-child { box-shadow: none; }
  .table tr.row-warn { box-shadow: inset 2px 0 0 var(--bad-mark); padding-left: 10px; }
  .table tr.row-bad { background: var(--bad-bg); padding-left: 10px; }
  .row-bad td { background: transparent; }
  .table tr.row-selected { background: var(--panel-2); }
  .row-click:hover td { background: transparent; }
  .row-selected td { background: transparent; }
}

/* ================================================================== real data (signed-in screens) */

/* The data-source indicator, live variant: the green square. */
.live-chip::before { background: var(--ok); }
.acct-btn.acct-warn { border-color: var(--bad-mark); }
.acct-btn.acct-warn .acct-sub { color: var(--bad); font-weight: 600; }
.acct-btn .acct-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.acct-kind { color: var(--ink-2); }
.banner-host:empty { display: none; }
.banner-host { max-width: calc(1232px + 2 * var(--gutter)); padding: 16px var(--gutter) 0; }
.banner-host .expiry-banner { margin: 0; }

/* Loading placeholders: the size of what they stand in for, so nothing jumps. A flat block that
   breathes, no gradient. */
.skel {
  display: block; border-radius: 4px;
  background: var(--panel-2); animation: skel-pulse 1.4s ease-in-out infinite;
}
@keyframes skel-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
.skel-line { height: 12px; margin: 6px 0; }
.skel-lines { display: grid; padding: 4px 0; }
.skel-title { height: 16px; width: 34%; }
.skel-title-lg { height: 26px; width: 40%; margin: 8px 0 6px; }
.skel-value { height: 26px; width: 38%; margin: 4px 0; }
.skel-tile { box-shadow: none; }
.skel-table { display: grid; gap: 0; }
.skel-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.card-flush .card-body > .skel-table { margin-bottom: 8px; }
.skel-head { padding-top: 0; }
.skel-head .skel-cell { width: 40%; height: 9px; opacity: 0.7; }
.skel-cell { height: 12px; }

.error-state { border-left-color: var(--bad-mark); background: var(--bad-bg); }
.error-state .empty-icon { color: var(--bad); border-color: transparent; }

/* The key-expiry warning above every page. */
.expiry-banner { max-width: 1232px; margin: 0 0 18px; }

/* Sign-in: one way in, an API key. */
.login-section { display: grid; gap: 10px; }
.login-h2 { font-size: var(--t-14); font-weight: 600; }
.login-sub { color: var(--ink-2); max-width: 62ch; }
.login-key-form { display: grid; gap: 6px; }
.login-key-row { display: flex; gap: 8px; align-items: stretch; }
.login-key-input { flex: 1 1 auto; min-width: 0; font-size: var(--t-13); letter-spacing: 0.01em; }
.login-reveal { flex: none; }
.login-key-form .login-actions { margin-top: 8px; }
.login-submit[aria-busy="true"] { cursor: progress; }
.boot-card { gap: 10px; }
.boot-text { color: var(--dim); }

@media (max-width: 640px) {
  .login-key-row { flex-wrap: wrap; }
  .skel-row { gap: 10px; padding: 10px 0; }
  .skel-row .skel-cell:nth-child(n+4) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ================================================================== bar chart (js/bar-chart.js)
   One series of per-day values, used by both UIs' usage screens. */

.bc { margin: 0; display: grid; gap: 8px; min-width: 0; }
.bc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.bc-head-text { display: grid; gap: 2px; min-width: 0; flex: 1 1 220px; }
.bc-title { font-size: var(--t-14); font-weight: 600; }
.bc-mini .bc-title { font-size: var(--t-13); }
.bc-summary { color: var(--dim); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.bc-skel-summary { width: 55%; max-width: 280px; }
.bc-toggle { flex: none; }
.bc-plot { position: relative; height: 200px; min-width: 0; }
.bc-plot-mini { height: 72px; }
.bc-svg, .bc-svg-el { display: block; }
.bc-svg-el { overflow: visible; }
.bc-grid { stroke: var(--grid); stroke-width: 1; }
.bc-base { stroke: var(--line-strong); stroke-width: 1; }
.bc-axis { fill: var(--faint); font: 400 10.5px / 1 var(--mono); font-variant-numeric: tabular-nums; }
.bc-bar { fill: var(--chart-1); }
.bc-bar-live { fill: var(--chart-1-live); }
.bc-zero { fill: var(--line-strong); }
.bc-settle { stroke: var(--ink-2); stroke-width: 2; stroke-dasharray: 2 3; stroke-linecap: square; }
.bc-bar-pending { fill: none; stroke: var(--dim); stroke-width: 1; stroke-dasharray: 4 3; }
.bc-sofar { fill: var(--dim); font: 600 10px / 1 var(--sans); }
.bc-hits { position: absolute; inset: 0; pointer-events: none; }
.bc-hit {
  position: absolute; padding: 0; margin: 0; border: 0; background: transparent; cursor: default;
  pointer-events: auto; border-radius: 0;
}
.bc-hit:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.bc-hit:focus-visible { outline: var(--focus); outline-offset: 1px; background: color-mix(in srgb, var(--ink) 6%, transparent); }
.bc-tip {
  position: absolute; z-index: 5; display: grid; gap: 1px; padding: 7px 10px 8px; min-width: 110px;
  background: #15171A; color: #FFFFFF; border: 0; border-radius: var(--radius);
  box-shadow: var(--shadow-float); font-size: var(--fs-xs); white-space: nowrap; pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.bc-tip[hidden] { display: none; }
.bc-tip-state { color: #B4B9BF; }
.bc-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--dim); font-size: var(--fs-xs); }
.bc-legend li { display: inline-flex; align-items: center; gap: 6px; }
.bc-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 0; background: var(--chart-1); }
.bc-swatch-live { background: var(--chart-1-live); }
.bc-swatch-settling { box-shadow: 0 -3px 0 -1px var(--panel), 0 -4px 0 -1px var(--ink-2); border-top: 2px dotted var(--ink-2); }
.bc-swatch-not_counted { background: transparent; border: 1.5px dashed var(--dim); border-radius: 0; }
.bc-state-live, .bc-state-settling, .bc-state-not_counted { font-weight: 600; }
.bc-state-not_counted { color: var(--dim); }
@media (forced-colors: active) {
  .bc-bar { fill: CanvasText; }
  .bc-bar-live { fill: GrayText; }
  .bc-bar-pending, .bc-settle { stroke: CanvasText; }
}

/* ================================================================== lean pass (critique 2026-11-28) */

/* A fold for settings most people leave alone ("Advanced: lifetime and IP allow-list"). */
details.advanced { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 8px 0; }
details.advanced > summary { cursor: pointer; width: max-content; color: var(--ink-2); font-size: var(--t-13); list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid var(--dim); border-bottom: 1.5px solid var(--dim); transform: rotate(-45deg); transition: transform 120ms ease-out; }
details.advanced[open] > summary::before { transform: rotate(45deg); }
details.advanced[open] > summary { margin-bottom: 12px; }
.about-wrap { display: inline-flex; align-items: center; }

/* A ruled key/value list of counts with a chevron ("Devices  6  >"), in place of a button wall. */
.link-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.link-list li { border-bottom: 1px solid var(--line); }
.link-list a {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 16px; align-items: center; gap: 12px;
  min-height: var(--row); padding: 0; color: var(--ink); text-decoration: none;
}
.link-list a:hover { background: var(--hover); box-shadow: -12px 0 0 var(--hover), 12px 0 0 var(--hover); }
.link-list .ll-n { font-family: var(--mono); font-size: var(--t-12); color: var(--ink-2); }
.card .link-list li:last-child { border-bottom: 0; }
.link-list .icon { width: 14px; height: 14px; color: var(--faint); }
.link-list a:hover .icon { color: var(--ink); }
.page-header-detail .page-title-row .pills { font-size: var(--t-12); }

/* ================================================================== charts (js/chart.js, uPlot)
   A2: graphite lines on a light grid, muted monospace axes, the kit's ink tooltip, the demo's
   monospace range buttons. Colours of the canvas come from the tokens at draw time (chart.js
   reads them), so only the DOM around the canvas is styled here. */

.ch { margin: 0; display: grid; gap: 10px; min-width: 0; }
.ch-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px 18px; flex-wrap: wrap; }
.ch-head-text { display: grid; gap: 2px; min-width: 0; flex: 1 1 220px; }
.ch-title { font-size: var(--t-14); font-weight: 600; }
.ch-caption { color: var(--dim); font-size: var(--t-12); font-variant-numeric: tabular-nums; }
.ch-head-slot:empty { display: none; }
.ch-key { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; color: var(--dim); font-size: var(--t-12); }
.ch-key li { display: inline-flex; align-items: center; gap: 6px; }
.ch-key-mark { display: inline-block; flex: none; width: 18px; height: 0; border-top: 1.5px solid var(--ch-key, var(--chart-1)); }
.ch-key-dash { border-top-style: dashed; border-top-width: 1.25px; }

.ch-plot { position: relative; min-width: 0; border-radius: var(--radius); }
.ch-plot:focus { outline: none; }
.ch-plot:focus-visible { outline: var(--focus); outline-offset: 4px; }
.ch-canvas { position: absolute; inset: 0; transition: opacity 140ms ease-out; }
.ch-canvas.ch-out { opacity: 0; transition-duration: 100ms; }
.ch-busy .ch-canvas, .ch-busy .ch-stack-bar { opacity: 0.45; }
/* Three classes deep, so these win over uPlot.min.css whichever order the two are linked in. */
.ch .uplot { font-family: var(--sans); width: 100%; }
.ch .uplot .u-cursor-x { border-right: 1px solid var(--line-strong); }
.ch .uplot .u-cursor-pt { border-radius: 0; }
.ch .uplot .u-select { background: transparent; }

.ch-hover { position: absolute; pointer-events: none; background: color-mix(in srgb, var(--ink) 5%, transparent); }

/* The tooltip: the kit's ink look (.tooltip), the date in monospace grey, value first. */
.ch-tip {
  position: absolute; z-index: 5; left: 0; top: 0; display: grid; gap: 3px; padding: 7px 10px 8px;
  background: #15171A; color: #FFFFFF; border-radius: var(--radius); box-shadow: var(--shadow-float);
  font: 400 var(--t-12) / 1.45 var(--sans); white-space: nowrap; pointer-events: none;
  font-variant-numeric: tabular-nums; opacity: 0; transform: translateY(3px);
  transition: opacity 120ms ease-out, transform 120ms ease-out;
}
.ch-tip.ch-tip-in { opacity: 1; transform: none; }
:root[data-theme="dark"] .ch-tip { background: #2B2F34; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ch-tip { background: #2B2F34; } }
.ch-tip-date { font-family: var(--mono); font-size: var(--t-11); color: #B4B9BF; }
.ch-tip-row { display: flex; align-items: center; gap: 7px; }
.ch-tip-row b { font-family: var(--mono); font-weight: 600; }
.ch-tip-row span { color: #B4B9BF; }
.ch-tip .ch-key-mark { width: 12px; }

.ch-state { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.ch-state-empty { background: transparent; }
.ch-state-text { color: var(--dim); font-size: var(--t-12); background: var(--panel); padding: 2px 8px; }
.ch-state-loading { place-items: stretch; padding: 12px 0 28px 44px; }
.ch-skel { width: 100%; height: 100%; }

/* The range buttons: monospace, the chosen one outlined in ink (A2 demo .range). */
.ch-range { display: inline-flex; gap: 2px; font-family: var(--mono); font-size: var(--t-11); }
.ch-range-btn {
  padding: 3px 10px; color: var(--dim); background: transparent; border: 1px solid transparent;
  border-radius: var(--radius); font: inherit; cursor: pointer;
  transition: color 120ms ease-out, background-color 120ms ease-out, border-color 120ms ease-out;
}
.ch-range-btn:hover { color: var(--ink); background: var(--panel-2); }
.ch-range-btn[aria-pressed="true"] { color: var(--ink); border-color: var(--ink); font-weight: 600; background: var(--panel); }
.ch-range-btn:focus-visible { outline: var(--focus); outline-offset: 1px; }

/* One-row share bar (stackedBar): 6px tall, 2px surface gaps, a ruled key below. */
.ch-stack-bar { display: flex; gap: 2px; height: 6px; transition: opacity 140ms ease-out; }
.ch-stack-bar.ch-stack-empty { background: var(--panel-2); }
.ch-seg { display: block; min-width: 2px; height: 100%; }
.ch-seg:hover { outline: 1px solid var(--ink); outline-offset: 1px; }
.ch-shade-0 { background: var(--chart-1); }
.ch-shade-1 { background: var(--dim); }
.ch-shade-2 { background: var(--faint); }
.ch-shade-3 { background: var(--line-strong); }
.ch-tone-ok { background: var(--ok); }
.ch-tone-bad { background: var(--bad-mark); }
.ch-tone-muted { background: var(--chart-1-live); }
.ch-stack-state .ch-stack-skel { height: 6px; }
.ch-stack-key { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); font-size: var(--t-13); }
.ch-stack-key li { display: grid; grid-template-columns: 6px minmax(0, 1fr) auto 44px; align-items: center; gap: 10px; padding: 7px 0 8px; border-bottom: 1px solid var(--line); }
.ch-stack-key li.ch-stack-none { display: block; color: var(--dim); font-size: var(--t-12); }
.ch-sw { width: 6px; height: 6px; }
.ch-stack-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-stack-key b { font-family: var(--mono); font-weight: 400; font-variant-numeric: tabular-nums; text-align: right; }
.ch-stack-pct { font-family: var(--mono); color: var(--dim); font-size: var(--t-12); text-align: right; font-variant-numeric: tabular-nums; }

.ch-spark { gap: 0; }
.ch-spark .ch-tip { z-index: 20; }

@media (forced-colors: active) {
  .ch-seg, .ch-sw { forced-color-adjust: none; }
  .ch-range-btn[aria-pressed="true"] { border-color: Highlight; }
}
@media (prefers-reduced-motion: reduce) {
  .ch-canvas, .ch-tip, .ch-range-btn, .ch-stack-bar { transition: none !important; }
}

/* ---------------------------------------------------------------- pager and filter chips
   One pager on every cursor-paged list (table.js pager): the range on the left, Previous and
   Next on the right; no page numbers. Filter chips (table.js filterChips) sit under the toolbar. */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px var(--card-pad); border-top: 1px solid var(--card-line); }
.pager-text { color: var(--dim); font-size: var(--t-12); font-family: var(--mono); font-variant-numeric: tabular-nums; }
.pager-btns { display: inline-flex; gap: 6px; }
.pager .btn .icon { width: 13px; height: 13px; }
.card > .pager, .card-body > .pager { padding-left: 0; padding-right: 0; }
.fchips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 10px var(--card-pad); border-bottom: 1px solid var(--card-line); }
.card-body .fchips { padding: 0 0 12px; border-bottom: 0; }
.fchip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 2px 0 9px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); font-size: var(--t-12); max-width: 100%; }
.fchip-k { color: var(--dim); }
.fchip-v { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 28ch; }
.fchip-x { display: inline-grid; place-items: center; width: 20px; height: 20px; border: 0; border-radius: 4px; background: transparent; color: var(--dim); cursor: pointer; padding: 0; }
.fchip-x:hover { background: var(--hover); color: var(--ink); }
.fchip-x .icon { width: 12px; height: 12px; }
.fchip-clear { border: 0; background: none; color: var(--ink-2); font: inherit; font-size: var(--t-12); text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; cursor: pointer; padding: 0 4px; }
.fchip-clear:hover { color: var(--ink); text-decoration-color: var(--ink); }

/* ================================================================== searchable select (js/search-select.js)

   A select with 8 options or more opens as a list with a search box (lane d-extras, 2026-11-29).
   The select stays in the form, out of sight; this button takes its place with the select's own
   classes (.input, .picker-select, .tb-select .input), so it sits and sizes where the select did.
   The list is a popover: white card, the one float shadow, a search row, rows of 32px. */
.ss { display: contents; }
/* The select out of sight: .input and .picker-select would size it to 100% or 150px over .sr-only,
   and an absolutely placed 100%-wide select widens a phone page (Register device's model select
   too). One pixel, whatever its classes. */
select.ss-native, select.sr-only { width: 1px !important; min-width: 0 !important; max-width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; border: 0 !important; }
.ss-trigger {
  display: flex; align-items: center; gap: 8px; text-align: left; cursor: pointer;
  -webkit-user-select: none; user-select: none;
}
.ss-trigger .ss-value { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-trigger .icon { flex: none; width: 12px; height: 12px; color: var(--dim); transition: transform 120ms ease-out; }
.ss-trigger[aria-expanded="true"] .icon { transform: rotate(180deg); }
.ss-trigger:disabled { cursor: not-allowed; }
.ss-trigger.ss-invalid { border-color: var(--bad-mark); }
/* A select sizes to its longest option, the button to the chosen one: a floor keeps it from shrinking to a word. */
.tb-select .ss-trigger { min-width: 120px; }

.popover.ss-pop { padding: 0; max-width: min(420px, calc(100vw - 16px)); overflow: hidden; }
.ss-search-row { position: relative; padding: 8px; border-bottom: 1px solid var(--line); }
.ss-search-row .icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); width: 13px; height: 13px; color: var(--faint); pointer-events: none; }
.ss-search-row .ss-search { min-height: var(--control-h); height: var(--control-h); padding-left: 30px; padding-right: 32px; }
.ss-search-row .ss-search::-webkit-search-cancel-button { display: none; }
.ss-clear { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); display: inline-grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--faint); cursor: pointer; }
.ss-clear:hover { background: var(--hover); color: var(--ink); }
.ss-clear .icon { position: static; transform: none; width: 12px; height: 12px; pointer-events: none; }
.ss-clear[hidden] { display: none; }
.ss-list { position: relative; max-height: min(320px, 50vh); overflow-y: auto; padding: 4px; overscroll-behavior: contain; }
.ss-group-head {
  padding: 8px 10px 4px; color: var(--dim);
  font-size: var(--t-11); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
}
.ss-opt {
  display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 6px 10px;
  border-radius: var(--radius); color: var(--ink); font-size: var(--t-13); cursor: pointer;
}
.ss-opt-label { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.ss-opt .icon { flex: none; width: 13px; height: 13px; color: var(--ink); visibility: hidden; }
.ss-opt.is-active { background: var(--panel-2); }
.ss-opt.is-on { font-weight: 600; }
.ss-opt.is-on .icon { visibility: visible; }
.ss-opt[aria-disabled="true"] { color: var(--dim); cursor: not-allowed; }
.ss-hit { background: transparent; color: inherit; font-weight: 700; text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; }
.ss-empty { margin: 0; padding: 12px 14px; color: var(--dim); font-size: var(--t-13); }
.ss-count { margin: 0; padding: 6px 14px; border-top: 1px solid var(--line); color: var(--dim); font-size: var(--t-12); font-variant-numeric: tabular-nums; }
.ss-count:empty { display: none; }
/* Long or growing lists (lane searchable-pickers): a picture, a second line, the server's paging. */
.ss-thumb { flex: none; display: inline-grid; place-items: center; }
.ss-opt-text { flex: 1 1 auto; min-width: 0; display: grid; gap: 1px; }
.ss-opt-text .ss-opt-label { flex: none; }
.ss-opt-sub { color: var(--dim); font-size: var(--t-12); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-opt .ss-thumb .icon, .ss-thumb svg { visibility: visible; }
.ss-more {
  display: block; width: 100%; margin: 0; padding: 8px 14px; text-align: left; cursor: pointer;
  font: 500 var(--t-13) / 1.3 var(--sans); color: var(--ink); background: transparent; border: 0; border-top: 1px solid var(--line);
}
.ss-more:hover { background: var(--panel-2); }
.ss-more:disabled { color: var(--dim); cursor: default; }
.ss-loading .ss-count::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 8px;
  background: var(--faint); animation: ss-pulse 900ms ease-in-out infinite alternate;
}
@keyframes ss-pulse { from { opacity: 0.25; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ss-loading .ss-count::before { animation: none; } }
@media (pointer: coarse) { .ss-opt { min-height: 44px; } }
.ss-trigger .ss-value:has(.ss-chip) { display: flex; flex-wrap: wrap; gap: 4px; white-space: normal; }
.ss-chip { display: inline-flex; align-items: center; gap: 2px; max-width: 200px; height: 22px; padding: 0 2px 0 8px; font-size: var(--t-12); font-weight: 400; color: var(--ink); background: var(--chip); border: 1px solid var(--line); border-radius: 6px; }
.ss-chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-chip-x { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; color: var(--dim); cursor: pointer; }
.ss-chip-x:hover { color: var(--ink); background: var(--panel-2); }
.ss-trigger .ss-chip-x .icon { width: 10px; height: 10px; transform: none; }
.ss-none { color: var(--dim); }
