/* Theme tokens (#153). Dark is the default palette. The light palette exists twice on purpose —
   browser auto-detect and explicit user choice — keep those two blocks in sync. Components
   consume these tokens: the colors that used to hardcode dark assumptions are tokenized as
   --overlay-rgb / --accent-rgb / --well / --cmd-fg / --warn / --scrim / --sh-*. */
:root {
  color-scheme: dark;
  --bg: #0f1115;
  --fg: #e6e6e6;
  --muted: #9aa0a6;
  --card: #171a21;
  --border: #2a2f3a;
  --accent: #4f8cff;
  --error: #ff6b6b;
  --success: #4ecb71;
  --info: #4f8cff;
  --accent-rgb: 79,140,255;    /* rgba tints derived from --accent */
  --warn: #ffb347;             /* degraded text */
  --well: #0b0d11;             /* input/code wells: darker than the card */
  --cmd-fg: #d7e0ff;           /* mono text inside the wells */
  --overlay-rgb: 255,255,255;  /* hover/chip fills on top of surfaces */
  --scrim: rgba(0,0,0,0.45);   /* drawer dimmer */
  --sh-bar: rgba(0,0,0,0.35);  /* fixed save bar */
  --sh-pop: rgba(0,0,0,0.4);   /* tooltip popover */
  --sh-lift: rgba(0,0,0,0.25); /* button hover lift */
  --sh-card: rgba(0,0,0,0.22); /* card hover lift */
}

/* Auto-detect: a light-OS browser gets the light palette unless the user explicitly chose
   dark; an explicit choice is carried on <html data-theme> by base.html's head bootstrap.
   Token values mirror :root[data-theme="light"] below — keep the two light blocks in sync. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f4f6f8;
    --fg: #171d26;
    --muted: #5b6472;
    --card: #ffffff;
    --border: #d6dbe4;
    --accent: #2456b3;
    --error: #c23b3b;
    --success: #17713d;
    --info: #2456b3;
    --accent-rgb: 36,86,179;
    --warn: #8a5a09;
    --well: #eef1f5;
    --cmd-fg: #24405f;
    --overlay-rgb: 23,29,38;
    --scrim: rgba(0,0,0,0.35);
    --sh-bar: rgba(23,29,38,0.16);
    --sh-pop: rgba(23,29,38,0.22);
    --sh-lift: rgba(23,29,38,0.14);
    --sh-card: rgba(23,29,38,0.12);
  }
}

/* Explicit user choice overrides the browser setting; dark simply keeps the :root defaults. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6f8;
  --fg: #171d26;
  --muted: #5b6472;
  --card: #ffffff;
  --border: #d6dbe4;
  --accent: #2456b3;
  --error: #c23b3b;
  --success: #17713d;
  --info: #2456b3;
  --accent-rgb: 36,86,179;
  --warn: #8a5a09;
  --well: #eef1f5;
  --cmd-fg: #24405f;
  --overlay-rgb: 23,29,38;
  --scrim: rgba(0,0,0,0.35);
  --sh-bar: rgba(23,29,38,0.16);
  --sh-pop: rgba(23,29,38,0.22);
  --sh-lift: rgba(23,29,38,0.14);
  --sh-card: rgba(23,29,38,0.12);
}
:root[data-theme="dark"] { color-scheme: dark; }
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
}
/* Top bar + collapsible side drawer (burger menu) — mobile-first. */
.topbar {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
}
.brand { font-weight: 700; letter-spacing: 0.02em; color: var(--fg); text-decoration: none; }
.brand:hover { color: var(--accent); }

/* Theme control in the top bar (#153): hidden unless the head bootstrap script ran and marked
   the document html.js — with JS off no dead control is offered and the auto-detect media
   query stands on its own. */
.theme-toggle {
  display: none; margin-left: auto; font-size: 0.85rem; padding: 0.3rem 0.7rem;
  border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
  background: rgba(var(--overlay-rgb), 0.04); color: var(--muted);
}
html.js .theme-toggle { display: inline-block; }

/* Language switch in the top bar (#353's follow-up, comment 10979): chrome for every visitor, not a
   page a signed-in account has to reach first, so it sits beside the theme control and the pair is
   pushed to the right edge as one group. `<details>` is what makes it work with no JavaScript — the
   same reason the sign-out button beside it is a form post. The panel leaves the flow so opening it
   cannot shove the page down under a sticky header, and it is anchored to the right so it stays
   inside the viewport on a narrow screen. */
.topbar-controls { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
.locale-switch { position: relative; }
.locale-switch summary {
  display: inline-flex; align-items: center; gap: 0.45rem; cursor: pointer; list-style: none;
  font-size: 0.85rem; padding: 0.3rem 0.7rem;
  border: 1px solid var(--border); border-radius: 8px;
  background: rgba(var(--overlay-rgb), 0.04); color: var(--muted);
}
.locale-switch summary::-webkit-details-marker { display: none; }
.locale-switch summary .locale-current { color: var(--fg); font-weight: 600; }
.locale-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
  display: grid; gap: 0.5rem; min-width: 15rem; max-width: calc(100vw - 1.5rem); padding: 0.7rem;
  background: var(--card); color: var(--fg);
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 22px var(--sh-pop); text-align: left;
}
.locale-panel label { display: grid; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); }
.locale-panel button { justify-self: start; }

/* Hidden checkbox drives the drawer so it works without JavaScript. */
.nav-toggle { position: absolute; opacity: 0; width: 1px; height: 1px; }

.nav-burger {
  display: inline-flex; flex-direction: column; justify-content: center; gap: 4px;
  width: 40px; height: 40px; padding: 9px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 8px; background: var(--card);
}
.nav-burger-bar {
  display: block; width: 100%; height: 2px; border-radius: 2px; background: var(--fg);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.sidenav {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 30;
  width: min(78vw, 300px);
  padding: 4.5rem 1rem 1.5rem;
  background: var(--card); border-right: 1px solid var(--border);
  overflow-y: auto;
  transform: translateX(-100%); transition: transform 0.22s ease;
}
.sidenav nav { display: flex; flex-direction: column; gap: 0.2rem; }
.sidenav a {
  display: block; padding: 0.6rem 0.75rem; border-radius: 8px;
  color: var(--fg); text-decoration: none; font-weight: 500;
}
.sidenav a:hover { background: rgba(var(--overlay-rgb), 0.06); color: var(--accent); }
.sidenav .inline { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.sidenav button.link { color: var(--error); font-weight: 500; }

/* Dim overlay behind the drawer; clicking it closes the menu. */
.nav-overlay {
  position: fixed; inset: 0; z-index: 25; cursor: pointer;
  background: var(--scrim);
  opacity: 0; visibility: hidden; transition: opacity 0.2s ease;
}

/* Open state: slide the drawer in, dim the page, morph the burger into an X. */
.nav-toggle:checked ~ .sidenav { transform: translateX(0); }
.nav-toggle:checked ~ .nav-overlay { opacity: 1; visibility: visible; }
.nav-toggle:checked ~ .topbar .nav-burger-bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle:checked ~ .topbar .nav-burger-bar:nth-child(2) { opacity: 0; }
.nav-toggle:checked ~ .topbar .nav-burger-bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.nav-toggle:focus-visible ~ .topbar .nav-burger { outline: 2px solid var(--accent); outline-offset: 2px; }
main { max-width: 720px; margin: 1.5rem auto; padding: 0 1.25rem; }
/* #219: pages whose content is a wide table opt out of the 720px reading measure with
   `class="wide"` (see `base.html`'s `main_class` block). An iPad in landscape is 768–1024 px and
   got exactly the same content column as a 27-inch monitor, so the shared 12-column per-server
   table had nowhere to go and squeezed every column instead of scrolling. The wider cap is a
   ceiling rather than no cap: 1100 px keeps a long numeric row from running edge to edge on a
   large display, and the create-server and mint-key `.card`s are still capped at 420 px, so a form
   does not stretch to the new column. Forms, Settings and the landing page stay at 720 px so their
   inputs and paragraphs keep a readable measure. */
main.wide { max-width: 1100px; }
h1 { font-size: 1.5rem; margin-top: 0; }
.muted { color: var(--muted); }
.card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  max-width: 420px;
}
label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.9rem; }
.hint { color: var(--muted); font-size: 0.78rem; }
/* Inline per-field validation message (signup #28): shown under the field it belongs to. */
.field-error { color: var(--error); font-size: 0.78rem; }
input[aria-invalid="true"] { border-color: var(--error); }
input {
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--well);
  color: var(--fg);
}
button {
  padding: 0.5rem 0.9rem;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}
button:hover { filter: brightness(1.08); }
button.link { background: none; color: var(--fg); padding: 0; font-weight: 400; }
.inline { display: inline; margin: 0; }
.flash { padding: 0.6rem 0.9rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid var(--border); }
.flash-error { background: rgba(255,107,107,0.12); color: var(--error); }
.flash-success { background: rgba(78,203,113,0.12); color: var(--success); }
.flash-info { background: rgba(var(--accent-rgb), 0.12); color: var(--info); }
.tag {
  display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 0.75rem;
}
/* #247: the key-distribution table on the Settings page marks a key id whose rows this router
   can no longer read — the one status an operator has to act on, not only notice. */
.tag-danger { background: rgba(255, 107, 107, 0.16); color: var(--error); }
/* #284: an acceptable configuration that is not optimal — plain HTTP to a public engine. Amber, the
   degraded-state colour, not red: the row works, and marking it as a fault would read as a refusal
   to operators who deliberately terminate TLS on their own leg. */
.tag-warn { background: rgba(255, 179, 71, 0.15); color: var(--warn); }
/* #197: the route matrix's badges. Supported takes the same green as a priced model — it is a
   confirmed fact, not a state of the server. A refusal is deliberately not red: an engine that does
   not mount /v1/audio/speech is working perfectly and stays a fine server for everything else, and the
   red family means something is broken or being refused. */
.tag-supported { background: rgba(78, 203, 113, 0.16); color: var(--success); }
.tag-refused { background: rgba(160, 160, 170, 0.16); color: var(--muted); }
/* An undecided route gets grey, not either verdict. `not measured` is an admission that the probe could
   not decide, and colouring it like a refusal is exactly the lie #239 removed for protocols. */
.tag-muted { background: rgba(160, 160, 170, 0.12); color: var(--muted); }
/* #292: a suspended account's servers stay visible and dimmed, badged with whose account stopped
   them. Hiding them would make a grantee's vanished route undiagnosable — the row is the evidence
   that the machine exists and is parked, not gone. Amber rather than red: the row is intact and a
   reactivation brings it back on its own. A `data-` attribute rather than a class, because the
   card's class list is what the tests slice on to find one card's markup. */
.flash-warn { background: rgba(255, 179, 71, 0.14); color: var(--warn); }
.server-row[data-owner-parked] { opacity: 0.6; }
ul.flash { list-style: none; padding-left: 0; }
pre.cmd {
  background: var(--well); border: 1px solid var(--border); border-radius: 8px;
  padding: 0.9rem 1rem; overflow-x: auto; white-space: pre; font-size: 0.85rem;
  color: var(--cmd-fg);
}
table.servers { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
table.servers th, table.servers td {
  text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
table.servers th { color: var(--muted); font-weight: 600; }
code { background: var(--well); padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.85rem; }

/* Dashboard + analytics (§11) */
.stats { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1rem 0 1.5rem; }
.stat {
  display: flex; flex-direction: column; gap: 0.2rem;
  padding: 0.75rem 1rem; background: var(--card);
  border: 1px solid var(--border); border-radius: 10px; min-width: 120px;
}
.stat-value { font-size: 1.4rem; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 0.8rem; }
/* #219: the tablet band, 641–1100 px. Below 641 px the phone rules take over (`.stat` goes to
   two-up from their own 45% min-width); above it the desktop layout has room. In between, tiles
   with a 120 px min-width crammed up to five tight columns across 720 px and their values wrapped,
   so here each tile takes half the row and grows into it — the gap is 0.75rem, so half the row
   minus half a gap is what actually fits two. An odd last tile stretches across the row, which is
   the same shape the phone layout already produces. */
/* #219: the tablet keep-list, the maintainer's decision on this ticket (comment 7480) — eight of the
   thirteen per-server columns are what an operator glances at, and the five timing, token and rate
   columns are figures you read deliberately. Hiding them is a rule of this band only: desktop has the
   room for all thirteen, and the phone band's table shows all thirteen and scrolls. The hidden values
   stay in the DOM and are repeated inside each row's expand row, which is hidden outside this band —
   so the table markup one page serves is the same at every width, and an expansion cannot disagree
   with the column it is repeating (both come from the same template macro). `min-width: 0` on the
   grid items is deliberate: a `<dl>` inside a `<td>` would otherwise push its own width onto a table
   that is already wider than the viewport, and the scroll would then belong to the numbers too. */
.tablet-more { display: none; }
.stats-more > summary {
  cursor: pointer; color: var(--accent); font-size: 0.85rem; font-weight: 600; list-style: none;
}
.stats-more > summary::-webkit-details-marker { display: none; }
.stats-more > summary::before { content: "▸ "; color: var(--accent); }
.stats-more[open] > summary::before { content: "▾ "; }
.stats-more-hint { color: var(--muted); font-size: 0.78rem; margin: 0.35rem 0 0; }
.stats-more dl {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 0.4rem 1rem; margin: 0.45rem 0 0;
}
.stats-more dl > div { min-width: 0; }
.stats-more dt { color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.stats-more dd { margin: 0; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
@media (min-width: 641px) and (max-width: 1100px) {
  .stat { flex: 1 1 calc(50% - 0.375rem); min-width: calc(50% - 0.375rem); }
  .tablet-hide { display: none; }
  .tablet-more { display: table-row; }
}
table.data { width: 100%; border-collapse: collapse; margin: 0.5rem 0 1.5rem; }
table.data th, table.data td {
  text-align: left; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
table.data th { color: var(--muted); font-weight: 600; }
/* #408: a detail page shows one record as a run of label/value pairs rather than a grid — the request
   detail page's "queue wait", "load window", "admission note" rows. `table.data` already gives the
   borders and the type size; these two rules only make the label column a fixed measure so the values
   form a column down the page, and let a long value (an admission note's `id:reason` list, a
   conversation hash) wrap inside its cell instead of driving the whole table sideways. `kv` is the
   usual key/value shorthand; it rides on `table.data` rather than replacing it, so a detail table keeps
   every other table's look for free. */
table.data.kv th { width: 11rem; vertical-align: top; }
table.data.kv td { overflow-wrap: anywhere; }
/* #203: numeric columns read right-aligned so prices and counts line up on the decimal point,
   and a label that belongs to a control stays accessible without taking table space. */
table.data th.num, table.data td.num { text-align: right; }
td.num input.num { width: 7.5rem; text-align: right; }
.cost-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
/* #217: a price column must read as money, not as floats. Tabular figures keep the decimal points
   aligned down the column, and the cached-in cell carries the discount the pair implies (#162) so
   the two in-prices have a visible relationship. Editing sits behind a row summary — fields inside a
   closed <details> still submit (ui.js notes the same on the params page), so collapsing a row never
   drops a price, and the row's open state survives a reload. */
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cost-discount { display: block; white-space: nowrap; }
.tag-priced { background: rgba(78,203,113,0.16); color: var(--success); }
.cost-filter { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0 0 1.2rem; }
.cost-filter label {
  display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: var(--muted);
}
.cost-filter input[type="search"] {
  flex: 1 1 12rem; max-width: 22rem; padding: 0.4rem 0.6rem; border: 1px solid var(--border);
  border-radius: 8px; background: var(--well); color: var(--fg); font: inherit;
}
.cost-edit > summary {
  cursor: pointer; font-weight: 600; font-size: 0.85rem; list-style: none; white-space: nowrap;
}
.cost-edit > summary::-webkit-details-marker { display: none; }
.cost-edit > summary::before { content: "▸ "; color: var(--accent); }
.cost-edit[open] > summary::before { content: "▾ "; }
.cost-edit form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: flex-end; margin-top: 0.5rem; }
.cost-edit label {
  display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.78rem; color: var(--muted);
}
.cost-edit input.num { width: 8.5rem; }
.cost-edit .form-actions { margin-top: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.status {
  display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px;
  font-size: 0.75rem; border: 1px solid var(--border);
}
.status-online, .status-ok { background: rgba(78,203,113,0.15); color: var(--success); }
.status-degraded { background: rgba(255,179,71,0.15); color: var(--warn); }
.status-offline, .status-err { background: rgba(255,107,107,0.15); color: var(--error); }
a.active { color: var(--accent); font-weight: 700; }
.chart {
  display: flex; align-items: flex-end; gap: 3px; height: 170px;
  padding: 0.5rem; background: var(--card); border: 1px solid var(--border); border-radius: 10px;
}
.bar-col {
  flex: 1 1 0; min-width: 4px; height: 100%; display: flex; flex-direction: column;
  justify-content: flex-end;
}
/* #351: the bars became links to their own bucket, so they have to read as one — an outline on
   hover and on keyboard focus, with no underline (there is no text here to underline). */
a.bar-col { text-decoration: none; }
a.bar-col:hover, a.bar-col:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.bar-ok { width: 100%; background: var(--success); border-radius: 2px 2px 0 0; }
.bar-err { width: 100%; background: var(--error); border-radius: 2px 2px 0 0; }
/* #234: route gaps get their own band (amber, above the faults) rather than a share of the red one. */
.bar-gap { width: 100%; background: var(--warn); border-radius: 2px 2px 0 0; }
.chart-legend { margin-top: 0.4rem; font-size: 0.8rem; }

/* Admin CRUD pages (§10.1) */
select, textarea {
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--well);
  color: var(--fg);
  font: inherit;
}
textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
label.checkbox { flex-direction: row; align-items: center; gap: 0.4rem; }
button.link.danger { color: var(--error); }
.card.wide, .server-card { max-width: 720px; }
.server-card { gap: 1rem; margin-bottom: 1.25rem; }
.server-head { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.server-head .muted { font-size: 0.85rem; }
.server-card h3 { margin: 0.25rem 0 0; font-size: 1rem; }
.inline-form { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: flex-end; }
.inline-form label { flex: 1 1 140px; }
/* #140: one deliberate action row — secondary buttons on the left, the destructive action
   separated to the right; every card action is a real button with a consistent hierarchy
   (primary = default button styling, secondary = outlined, destructive = red outline). */
.server-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0 0 1rem; }
.server-delete { margin-left: auto; }
.btn-secondary {
  background: rgba(var(--overlay-rgb), 0.07); color: var(--fg);
  border: 1px solid var(--border); font-weight: 500;
}
.btn-danger {
  background: rgba(255,107,107,0.15); color: var(--error);
  border: 1px solid var(--error); font-weight: 600;
}
.btn-danger:hover { background: rgba(255,107,107,0.3); color: var(--error); }
/* #150: an anchor styled as a secondary card action (the Model params link). */
a.btn-secondary {
  display: inline-block; padding: 0.5rem 0.9rem; border-radius: 6px; text-decoration: none;
}
/* #152: the Model params page per model — an expandable card (same shape as a server-card
   subsection) holding a grid of labelled knobs. Blank inputs show a grey "Default" placeholder:
   blank means "inject nothing", so the placeholder is the state, not a hint. Engine extras
   (custom fields) stay mono JSON like every other JSON surface in the admin UI. */
.params-model {
  margin: 0 0 0.75rem; border: 1px solid var(--border); border-radius: 10px;
  background: rgba(var(--overlay-rgb), 0.02);
}
.params-model > summary {
  cursor: pointer; padding: 0.55rem 0.8rem; list-style: none; font-weight: 600;
}
.params-model > summary::-webkit-details-marker { display: none; }
.params-model > summary::before { content: "▸ "; color: var(--accent); }
.params-model[open] > summary::before { content: "▾ "; }
.params-model[open] > summary { border-bottom: 1px solid var(--border); }
.params-model > summary .substate { font-weight: 400; }
.params-model form { padding: 0.7rem 0.8rem 0.8rem; }
.params-model .params-actions { padding: 0 0.8rem 0.8rem; margin-top: -0.35rem; }
/* #171: inputs fill their grid cell (the intrinsic ~170px width varied by input type,
   so neighbouring boxes touched), the column gap gives them room, and the focus ring is
   pulled inside the box so it can never spill over a neighbour. */
.params-fields {
  border: none; padding: 0; margin: 0 0 0.75rem;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.65rem 1.1rem;
}
.params-fields label { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.params-fields input { width: 100%; }
.params-fields input:focus-visible { outline-offset: -2px; }
.params-label {
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--muted);
}
.params-fields input::placeholder { color: var(--muted); }
/* #171: the "?" sits inline beside the field name (settings-page pattern, #76) and is
   sized to the small-caps line. */
.params-label .tip { width: 1rem; height: 1rem; font-size: 0.62rem; margin-left: 0.35rem; }
.params-advanced { margin: 0 0 0.75rem; }
.params-json { min-width: 14rem; width: 100%; max-width: 28rem; }
.params-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.params-actions select { max-width: 14rem; }
/* #160/#161: collapsed-by-default create forms (Users, Keys) — the same click-to-reveal
   details pattern as the server page (#140): summary carries the accent chevron. */
details.admin-create { margin: 0 0 1rem; }
details.admin-create > summary { cursor: pointer; font-weight: 600; list-style: none; padding: 0.15rem 0; }
details.admin-create > summary::-webkit-details-marker { display: none; }
details.admin-create > summary::before { content: "▸ "; color: var(--accent); }
details.admin-create[open] > summary::before { content: "▾ "; }
details.admin-create[open] > summary { margin-bottom: 0.4rem; }
.form-actions { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.15rem; }
.row-actions { display: flex; flex-direction: column; gap: 0.25rem; }
/* #79: live servers collapse to a single scannable row; settings/models hide behind a details. */
.server-row { gap: 0.5rem; }
.server-quick { margin-left: auto; }
/* #140: the enable/disable operator gate as a slider switch — knob right + green reads
   "enabled", knob left + red reads "disabled"; clicking submits the flip form. */
button.switch {
  display: inline-flex; align-items: center; gap: 0.45rem;
  background: none; padding: 0; border: none; font-weight: 400;
}
button.switch:hover { filter: none; }
.switch-track {
  position: relative; width: 2.5rem; height: 1.3rem; border-radius: 999px;
  background: rgba(255,107,107,0.22); border: 1px solid var(--border);
  transition: background 0.15s ease;
}
.switch-thumb {
  position: absolute; top: 0.15rem; left: 0.15rem; width: 0.9rem; height: 0.9rem;
  border-radius: 50%; background: var(--error);
  transition: transform 0.15s ease, background 0.15s ease;
}
.switch-on .switch-track { background: rgba(78,203,113,0.22); }
.switch-on .switch-thumb { background: var(--success); transform: translateX(1.2rem); }
button.switch:hover .switch-track { filter: brightness(1.2); }
.switch-state { font-size: 0.8rem; color: var(--muted); }
.server-settings { margin-top: 0.25rem; }
.server-settings > summary { cursor: pointer; color: var(--accent); font-size: 0.9rem; }
.server-settings[open] > summary { margin-bottom: 0.6rem; }

/* #243 D: "someone else changed this server" is the one card line an owner must not miss, so it is
   amber rather than the muted prose of the other hints. */
.admin-edit-note { color: var(--warn); font-size: 0.8rem; margin: 0.35rem 0 0; }
.admin-edit-note strong { color: var(--warn); }

/* #102: the expanded server card groups its settings into labelled fieldsets (grid rows, so a
   phone-width card wraps cleanly) instead of one long inline dump. */
.server-form { display: flex; flex-direction: column; }
.settings-group {
  border: 1px solid var(--border); border-radius: 10px; margin: 0 0 0.75rem;
  padding: 0.65rem 0.8rem 0.8rem;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.6rem;
}
.settings-group legend {
  padding: 0 0.35rem; font-size: 0.78rem; font-weight: 600; color: var(--muted);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.settings-group .span-all { grid-column: 1 / -1; }
/* #220: the Regenerate dice beside a name box and the public-id warning it reveals. Both arrive
   `hidden` from the template — the dice because only ui.js can answer its click, the warning
   because it describes a change that has not been made yet — so `hidden` wins over the grid. */
.roll-name[hidden], .roll-name-warning[hidden] { display: none; }
.roll-name-error { color: var(--error); }
.user-candidates-more { font-size: 0.8rem; padding: 0.2rem 0; }

/* #140: Connection / Sharing / Model availability collapse behind their own summaries, so the
   expanded card is a stack of one-line sections instead of one long dump. The summary carries
   the setting's current value (.substate) so collapsed sections stay readable; ui.js remembers
   open/closed state, and fields inside a closed <details> still submit. */
.settings-subsection {
  margin: 0 0 0.75rem; border: 1px solid var(--border); border-radius: 10px;
  background: rgba(var(--overlay-rgb), 0.02);
}
.settings-subsection > summary {
  cursor: pointer; padding: 0.55rem 0.8rem; list-style: none;
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted);
}
.settings-subsection > summary::-webkit-details-marker { display: none; }
.settings-subsection > summary::before { content: "▸ "; color: var(--accent); }
.settings-subsection[open] > summary::before { content: "▾ "; }
.settings-subsection[open] > summary { border-bottom: 1px solid var(--border); }
.settings-subsection .substate { text-transform: none; letter-spacing: 0; font-weight: 400; }
.settings-subsection .settings-group { border: none; margin: 0; border-radius: 0 0 10px 10px; }
/* #251: the Advanced card's contents sit inside one collapsed block, with a sub-heading per group
   that moved there so a demoted knob still says where it came from. The body carries the padding
   the block itself does not have. */
.settings-advanced-body { padding: 0.1rem 0.8rem 0.8rem; }
.settings-subhead { margin: 0.9rem 0 0.15rem; font-size: 0.95rem; }
.settings-advanced-body > :first-child { margin-top: 0.2rem; }
.subcheck-row { display: flex; align-items: center; gap: 0.3rem; }
/* #149: engine key fields ride inside the Connection section, stacked under its grid. */
.engine-key-fields { display: flex; flex-direction: column; gap: 0.6rem; }

/* #95: register form and deleted-servers list start collapsed; details works without JS. */
/* #168 gap 2: deleted profiles share the same collapsed-section treatment. */
.register-server > summary, .deleted-servers > summary, .deleted-profiles > summary {
  cursor: pointer; font-weight: 600; font-size: 1.15rem; margin-top: 1.25rem;
}
.register-server[open] > summary, .deleted-servers[open] > summary,
.deleted-profiles[open] > summary { margin-bottom: 0.6rem; }
.register-server[open] > .muted { margin-bottom: 0.5rem; }
/* #346: the register summary names the name generator while the section is still shut (#95 keeps it
   collapsed), and that is the only place an operator who never opens it can read it. The pointer is
   the body's size and weight, not the heading's, so it reads as a note on the control. */
.register-server > summary .substate { font-size: 0.85rem; font-weight: 400; }

/* Tombstoned models (#88): kept for analytics, dimmed and marked "may be available later". */
.model-tombstone { opacity: 0.55; }
.model-tombstone td:first-child { text-decoration: line-through; }

/* Model availability control (#99): blocked rows are dimmed (the model stays on the
   engine — only the router hides it), and the picker sits under the mode select. */
.model-blocked { opacity: 0.6; }
.model-blocked td:first-child { font-style: italic; }
.model-access-picker { margin-top: 0.5rem; }
/* #140: model selection is a plain checkbox list, not boxy "checkbox buttons" (even #102's
   compact pill tiles still read as buttons). Long engine ids wrap inside the row; a deep list
   scrolls instead of ballooning the card. */
.model-select {
  list-style: none; margin: 0.35rem 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.25rem 1.25rem; max-height: 14rem; overflow-y: auto;
}
.model-select label {
  display: flex; align-items: baseline; gap: 0.45rem;
  font-size: 0.85rem; cursor: pointer; overflow-wrap: anywhere;
}
.model-select input[type="checkbox"] { accent-color: var(--accent); }

/* Models header + cadence note (#81; #140 moved the refresh button into the action row) */
.models-head { display: flex; align-items: center; gap: 0.75rem; }
.models-head h3 { margin: 0; }
.models-cadence { font-size: 0.8rem; margin: 0.15rem 0 0.5rem; }
/* #413: the measured column holds a figure line and the one press that produced it. Stacked rather
   than side by side, because a model table that already scrolls sideways must not get wider still, and
   the press is secondary to the figures: it is refused whenever the machine is busy, so it is never the
   thing a reader is scanning the row for. Compact padding for the same reason — this button appears once
   per model, not once per page. */
.measured-cell { white-space: nowrap; }
.measured-cell form { margin-top: 0.25rem; }
.measured-cell .btn-secondary { padding: 0.15rem 0.45rem; font-size: 0.75rem; font-weight: 400; }

/* Soft-delete tombstones + list filters (§16.8) */
.filterbar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0 0 1rem; }
.chip {
  padding: 0.25rem 0.7rem; border-radius: 999px; text-decoration: none;
  background: rgba(var(--overlay-rgb), 0.06); color: var(--muted); font-size: 0.85rem;
}
.chip-active { background: rgba(78,203,113,0.18); color: var(--success); }

.share-users { margin: 0.5rem 0; }
.share-users[hidden] { display: none; }
.share-users-label { display: block; font-size: 0.85rem; margin-bottom: 0.35rem; }
.chip-select { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip-check {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.7rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: rgba(var(--overlay-rgb), 0.04); font-size: 0.85rem;
}
.chip-check input { accent-color: var(--accent); }

/* Selective-sharing picker (#65): search box + removable chips. The server-rendered
   checkbox fallback (.user-picker-fallback) is removed by JS once the picker builds. */
.user-picker { display: flex; flex-direction: column; gap: 0.5rem; }
.user-search {
  padding: 0.5rem 0.7rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--well); color: var(--fg); font: inherit; width: 100%; max-width: 24rem;
}
.user-search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.user-selected, .user-candidates { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.user-selected:empty { display: none; }
.user-chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.5rem 0.3rem 0.7rem; border-radius: 999px;
  border: 1px solid var(--accent); background: rgba(var(--accent-rgb), 0.12); font-size: 0.85rem;
}
.user-chip-name { color: var(--fg); }
.user-chip-remove {
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 0.9rem; line-height: 1; padding: 0.15rem 0.4rem; border-radius: 6px;
}
.user-chip-remove:hover { color: var(--error); background: rgba(255,107,107,0.12); }
.user-candidate { display: inline-flex; }
.user-add {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.7rem; border-radius: 999px; cursor: pointer;
  border: 1px dashed var(--border); background: rgba(var(--overlay-rgb), 0.04);
  color: var(--fg); font: inherit; font-size: 0.85rem;
}
.user-add:hover { border-color: var(--accent); color: var(--accent); border-style: solid; }
.user-candidates-empty { font-size: 0.85rem; padding: 0.2rem 0; }

/* #102 scale fix: the fallback shows grantees + a shortlist only; these mark the collapse and
   carry the no-JS search (GET ?share_q=) that re-renders a ≤5 match shortlist server-side. */
.picker-more { flex: 1 1 100%; font-size: 0.8rem; }
.picker-noscript {
  flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-top: 0.3rem;
}
.picker-noscript input[type="search"] {
  flex: 1 1 12rem; max-width: 20rem; padding: 0.4rem 0.6rem; border: 1px solid var(--border);
  border-radius: 8px; background: var(--well); color: var(--fg); font: inherit;
}

.model-picker { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.5rem 0; }
.model-picker select { min-width: 15rem; }
.btn-add-model {
  padding: 0.4rem 0.8rem; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--card); color: var(--fg);
}
.btn-add-model:hover { border-color: var(--accent); color: var(--accent); }
.model-picker input.model-add-custom {
  padding: 0.5rem 0.6rem; border: 1px solid var(--border); border-radius: 6px;
  background: var(--well); color: var(--fg); font: inherit; min-width: 12rem;
}

/* Virtual-model pool editor (#36): per-model items, drag-reorder, offline highlight */
.pool { margin: 0.5rem 0; }
.pool-list { list-style: none; margin: 0 0 0.35rem; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.pool-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0.6rem; border: 1px solid var(--border); border-radius: 8px;
  background: rgba(var(--overlay-rgb), 0.03);
}
.pool-item[draggable="true"] { cursor: grab; }
.pool-item.pool-dragging { opacity: 0.4; }
.pool-handle { color: var(--muted); cursor: grab; user-select: none; touch-action: none; }
.pool-model { flex: 1 1 auto; overflow-wrap: anywhere; }
.pool-remove {
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 0.9rem; line-height: 1; padding: 0.15rem 0.4rem; border-radius: 6px;
}
.pool-remove:hover { color: var(--error); background: rgba(255,107,107,0.12); }
/* Move up/down buttons (#70): the touch/keyboard-safe reorder path, always available. */
.pool-move-group { display: inline-flex; gap: 0.15rem; flex: 0 0 auto; }
.pool-move {
  border: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer;
  font-size: 0.95rem; line-height: 1; padding: 0.2rem 0.5rem; border-radius: 6px;
}
.pool-move:hover { color: var(--accent); border-color: var(--accent); }
.pool-move:disabled { opacity: 0.35; cursor: default; }
.pool-item .status { flex: 0 0 auto; }
.pool-item.is-offline { border-color: rgba(255,107,107,0.5); background: rgba(255,107,107,0.06); }
.pool-item.is-unknown { border-color: rgba(255,179,71,0.45); background: rgba(255,179,71,0.05); }
.pool-readonly .pool-item { background: transparent; }
.pool-data[hidden] { display: none; }

.model-browser code, .copyable {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.copyable { user-select: all; }
.server-deleted, .row-deleted { opacity: 0.6; }
.server-deleted { border-style: dashed; }

/* IP allow list + request log (§11) */
.allowlist-card { display: flex; flex-direction: column; gap: 0.4rem; }
.allowlist-card textarea { width: 100%; resize: vertical; }

/* Settings page (#68): grouped section cards, tidy field footers, responsive tables. */
.settings-form { display: flex; flex-direction: column; gap: 1rem; max-width: 760px; }
.settings-section {
  display: flex; flex-direction: column; gap: 0.6rem;
  padding: 1rem 1.1rem; background: var(--card); border: 1px solid var(--border); border-radius: 10px;
}
.settings-section h2 { margin: 0; font-size: 1.05rem; }
.settings-section textarea { width: 100%; resize: vertical; }
.field-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
/* #205: a field's display name with its "?" badge beside it, outside the <label> so pressing the
   badge never focuses the control the label points at. */
.field-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.settings-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.settings-reset-all { color: var(--error); }
.settings-table input, .settings-table select { width: 100%; min-width: 7rem; }

/* Floating Save bar (#74): pinned to the bottom of the viewport and revealed by JS only after
   a setting changes, so an unsaved edit is obvious and always reachable. Hidden by default —
   and without JS the inline Save button is the only path. The body gains bottom padding while
   it is shown so the bar never covers the last row of content. */
.save-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 1rem;
  padding: 0.75rem 1.1rem; background: var(--card);
  border-top: 1px solid var(--border); box-shadow: 0 -4px 18px var(--sh-bar);
}
.save-bar[hidden] { display: none; }
.save-bar-msg { color: var(--muted); font-weight: 600; margin-right: auto; }
body.has-save-bar { padding-bottom: 4.5rem; }
@keyframes save-bar-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: no-preference) {
  .save-bar { animation: save-bar-in 0.2s ease both; }
}

/* Routing & system setting tooltips (#76): a small "?" badge beside each setting name signals
   (to touch users especially) that a description is available. A shared fixed-position tooltip
   reveals it on hover / focus / tap without being clipped by the scrolling table. */
.tip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.15rem; height: 1.15rem; margin-left: 0.45rem; padding: 0;
  border: 1px solid var(--border); border-radius: 50%;
  background: rgba(var(--overlay-rgb), 0.04); color: var(--muted);
  font-size: 0.75rem; font-weight: 700; line-height: 1; cursor: help; vertical-align: middle;
}
.tip:hover, .tip:focus { color: var(--accent); border-color: var(--accent); outline: none; }
.tooltip {
  position: fixed; z-index: 60; max-width: 18rem; padding: 0.55rem 0.7rem;
  background: var(--card); color: var(--fg); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 22px var(--sh-pop); font-size: 0.82rem; line-height: 1.4; text-align: left;
}
.tooltip[hidden] { display: none; }
/* #205: the tooltip's first line is the identifier — the settings key and the env variable that
   seeds it — so the prose below can be matched to .env or an API payload. */
.tooltip-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem; color: var(--accent); margin-bottom: 0.35rem;
  word-break: break-all;
}
@media (prefers-reduced-motion: no-preference) {
  .tip { transition: color 0.15s ease, border-color 0.15s ease; }
}

/* Tunnel command & deployment settings card */
.deployment-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; margin: 0.4rem 0 0; }
.deployment-field { display: flex; flex-direction: column; gap: 0.3rem; }
.deployment-field input, .deployment-field select { width: 100%; }
.deployment-field .tag { margin-left: 0.4rem; }
@media (max-width: 640px) { .deployment-grid { grid-template-columns: 1fr; } }
.badge-ok, .badge-err {
  display: inline-block; padding: 0.1rem 0.45rem; border-radius: 999px; font-size: 0.75rem;
}
.badge-ok { background: rgba(78,203,113,0.15); color: var(--success); }
.badge-err { background: rgba(255,107,107,0.15); color: var(--error); }
.table-scroll { overflow-x: auto; }
/* #219: the wrapper existed (#68 auto-applies it to every `table.data`) but did nothing, because
   `table.data` is `width: 100%` and so never exceeded its container — it squeezed instead of
   scrolling. Inside the wrapper a table now takes its intrinsic width, and at least the container's
   width, so a wide table scrolls horizontally and a narrow one still fills the card. Scoped to the
   wide pages: the Settings tables and the form cards are prose-heavy and stay at the 720 px
   measure with `width: 100%`, exactly as before. */
main.wide .table-scroll > table.data { width: auto; min-width: 100%; }
.request-log { font-size: 0.8rem; }
.request-log th, .request-log td { padding: 0.35rem 0.5rem; white-space: nowrap; }

/* Branding + public landing page (#45) */
.brand-sep { color: var(--muted); font-weight: 400; }
.btn {
  display: inline-block; padding: 0.55rem 1.1rem; border-radius: 8px; text-decoration: none;
  font-weight: 600; border: 1px solid var(--border); background: var(--card); color: var(--fg);
  transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover {
  border-color: var(--accent); color: var(--accent);
  transform: translateY(-2px); box-shadow: 0 6px 18px var(--sh-lift);
}
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); color: #fff; }
.landing-hero { max-width: 760px; margin-bottom: 2rem; }
.landing-title { font-size: 2rem; margin: 0 0 0.25rem; }
.landing-tagline { color: var(--accent); font-weight: 600; margin: 0 0 1rem; }
.landing-lede { color: var(--fg); line-height: 1.6; }
.landing-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-top: 1.25rem; }
.landing-repo { color: var(--muted); }
.landing-repo:hover { color: var(--accent); }
.landing-features { max-width: 760px; margin-bottom: 2rem; }
.feature-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.75rem; }
@media (min-width: 640px) { .feature-grid { grid-template-columns: 1fr 1fr; } }
.feature-grid li {
  padding: 0.75rem 1rem; background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.feature-grid li:hover {
  transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 6px 18px var(--sh-card);
}
.landing-shot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.img-placeholder {
  margin: 0; min-height: 150px; display: flex; align-items: center; justify-content: center;
  padding: 1rem; text-align: center; border: 1px dashed var(--border); border-radius: 10px;
  background: rgba(var(--overlay-rgb), 0.03); color: var(--muted);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.img-placeholder:hover { transform: translateY(-2px); border-color: var(--accent); }
.img-placeholder figcaption { font-size: 0.85rem; }

/* Landing entrance animation (#69): fade/slide the sections in, staggered. Gated behind
   prefers-reduced-motion so users who opt out see the page fully rendered immediately. */
@keyframes landing-fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: no-preference) {
  .landing-hero, .landing-features, .landing-shots { animation: landing-fade-up 0.5s ease both; }
  .landing-features { animation-delay: 0.12s; }
  .landing-shots { animation-delay: 0.24s; }
  .feature-grid li { animation: landing-fade-up 0.45s ease both; }
  .feature-grid li:nth-child(2) { animation-delay: 0.06s; }
  .feature-grid li:nth-child(3) { animation-delay: 0.12s; }
  .feature-grid li:nth-child(4) { animation-delay: 0.18s; }
  .feature-grid li:nth-child(5) { animation-delay: 0.24s; }
  .feature-grid li:nth-child(6) { animation-delay: 0.30s; }
}

/* Landing animated background (#77): a landing-only, behind-content layer with a dense node-link
   network motif (on-theme for a router), drifting filled geometric shapes, soft radial-gradient
   glows, and data-flow orbs (a bright head dot) tracing along a subset of the wires. It reuses the
   app's blue accent (--accent) rather than a separate theme. For performance the glows and node
   halos use radial-gradient fills instead of blur filters (blur re-rasterises every frame and was
   the main cost). Motion is GPU transform/opacity/dash only, kept low-opacity, and every animation
   is gated behind prefers-reduced-motion so the shapes stay put (and the flow orbs disappear) for
   users who opt out. The layer is aria-hidden and pointer-events:none, and the content sections are
   raised above it so text contrast is preserved. */
.landing-bg {
  position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
}
.landing-glow {
  position: absolute; width: 52vmax; height: 52vmax; border-radius: 50%; opacity: 0.22;
}
.landing-glow-a { top: -16vmax; left: -14vmax;
  background: radial-gradient(circle at center, rgba(var(--accent-rgb), 0.20), transparent 72%); }
.landing-glow-b { bottom: -18vmax; right: -16vmax;
  background: radial-gradient(circle at center, rgba(126,86,255,0.15), transparent 72%); }
.landing-geo { position: absolute; inset: 0; width: 100%; height: 100%; }
.landing-geo .geo-edges line { stroke: var(--accent); stroke-width: 1; opacity: 0.1; }
/* Filled geometric shapes (triangles + hexagon), not wireframe boxes. */
.landing-geo .geo polygon { fill: var(--accent); opacity: 0.08; stroke: none; }
/* Nodes: a solid, slightly blurred core (which hides the wires behind it) ringed by a larger soft
   halo that carries the pulse. Cores vary in size — hubs to minor nodes. */
.landing-geo .node-cores circle { fill: var(--accent); opacity: 0.72; filter: blur(1.2px); }
/* The halo is a radial-gradient disc (#haloGrad) rather than a blurred circle: the same soft glow,
   but no per-frame filter re-rasterisation, so the pulse animation is cheap. */
.landing-geo .node-halos circle { fill: url(#haloGrad); opacity: 0.4; }
#haloGrad stop { stop-color: var(--accent); }
#haloGrad .halo-core { stop-opacity: 0.55; }
#haloGrad .halo-mid { stop-opacity: 0.25; }
#haloGrad .halo-edge { stop-opacity: 0; }
/* Data-flow orbs: a bright round head dot tracing along each wire. Hidden until animated (so
   reduced-motion users see only the faint wires). pathLength=100 on each line normalises the dash
   so one orb crosses per cycle. */
.landing-geo .geo-flow line {
  fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; opacity: 0;
}
.landing-geo .geo { transform-box: fill-box; transform-origin: center; }
/* Content sits above the animated layer so text stays readable. */
.landing-hero, .landing-features, .landing-shots { position: relative; z-index: 1; }

@keyframes landing-glow-drift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, -28px) scale(1.12); }
  100% { transform: translate(0, 0) scale(1); }
}
@keyframes landing-geo-drift {
  0% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(16px, -12px) rotate(2deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}
@keyframes landing-geo-drift-alt {
  0% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(-20px, 14px) rotate(-3deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}
@keyframes landing-node-pulse {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 0.55; }
}
@keyframes landing-flow {
  from { stroke-dashoffset: 100; }
  to { stroke-dashoffset: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  .landing-glow-a { animation: landing-glow-drift 24s ease-in-out infinite; }
  .landing-glow-b { animation: landing-glow-drift 30s ease-in-out infinite reverse; }
  .geo-net { animation: landing-geo-drift 26s ease-in-out infinite; }
  .geo-tri { animation: landing-geo-drift-alt 22s ease-in-out infinite; }
  .geo-hex { animation: landing-geo-drift 30s ease-in-out infinite reverse; }
  .geo-tri-b { animation: landing-geo-drift 18s ease-in-out infinite; }
  .geo-tri-c { animation: landing-geo-drift-alt 24s ease-in-out infinite reverse; }
  .node-halos circle { animation: landing-node-pulse 6s ease-in-out infinite; }
  .node-halos circle:nth-of-type(2n) { animation-delay: 1.2s; }
  .node-halos circle:nth-of-type(3n) { animation-delay: 2.4s; }
  .node-halos circle:nth-of-type(5n) { animation-delay: 3.6s; }
  /* Data-flow orbs: a bright round head dot per wire. Four synchronized waves, offset from each
     other, so the traffic reads as coordinated pulses rather than random static. */
  .landing-geo .geo-flow line {
    opacity: 0.75; stroke-dasharray: 3 97; animation: landing-flow 3.4s linear infinite;
  }
  .landing-geo .geo-flow line:nth-of-type(4n+1) { animation-delay: 0s; }
  .landing-geo .geo-flow line:nth-of-type(4n+2) { animation-delay: 0.85s; }
  .landing-geo .geo-flow line:nth-of-type(4n+3) { animation-delay: 1.7s; }
  .landing-geo .geo-flow line:nth-of-type(4n+4) { animation-delay: 2.55s; }
}

/* Live dashboard graph (#120): server-rendered SVG, redrawn by dashboard.js from
   GET /admin/api/v1/analytics/dashboard every poll. */
.graph {
  margin: 0.25rem 0 0.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
}
.graph svg { display: block; width: 100%; height: auto; max-height: 210px; }
/* #219: the figure scales its height from its width (`height: auto` over a 600x170 viewBox), so the
   210 px cap only binds while the column is narrow. Widening the dashboard's column to 1100 px made
   the box ~1036 px wide, whose natural height is ~293 px: the old cap bound, and because the SVG
   scales with the default `xMidYMid meet` the drawing stopped at ~740 px and was centred inside a
   wider empty box — a graph that no longer spans its figure. Raising the cap on the wide pages keeps
   it spanning; 300 px is the natural height at the widest column, so the cap never binds there and
   still bounds the graph if the column ever grows. */
main.wide .graph svg { max-height: 300px; }
.graph-legend { margin-top: 0.35rem; font-size: 0.82rem; }
.graph-count { fill: var(--accent); }
.graph-error { fill: var(--error); }
/* #234: an engine's "no such route" answer, drawn in the degraded amber rather than the fault red,
   stacked above the fault slice. Its own colour is the point: a chat-only host asked for speech must
   not read as an outage, and it must not vanish from the graph either. */
.graph-gap { fill: var(--warn); }
.graph-latency { stroke: var(--success); stroke-width: 1.5; stroke-dasharray: 4 3; }
.graph-latency-dot { fill: var(--success); }
.graph-peak { fill: var(--muted); font-size: 11px; }
.graph-peak-latency { fill: var(--success); }
.graph-axis { fill: var(--muted); font-size: 11px; }

/* Mobile formatting (#68): tighten spacing and let wide tables scroll instead of overflow. */
.table-scroll { -webkit-overflow-scrolling: touch; }
@media (max-width: 640px) {
  main { padding: 0 0.85rem; margin: 1rem auto; }
  .card { padding: 1rem; }
  .settings-section { padding: 0.85rem 0.9rem; }
  table.data { font-size: 0.82rem; }
  table.data th, table.data td { padding: 0.4rem 0.5rem; }
  .landing-title { font-size: 1.6rem; }
  .stat { min-width: 45%; }
}

