/* The console, set like a reconciliation ledger: what the control plane intends against what each
   gateway holds, figures in ruled columns, a sidebar of grouped sections. Cool neutrals, one cobalt
   accent (selection and "act here"), state colours apart from it, IBM Plex for type. A healthy
   thing wears no mark; state is a tinted word. No inline styles: the CSP forbids them. */

@font-face { font-family: "IBM Plex Sans"; src: url("/assets/fonts/plex-sans-latin.woff2") format("woff2"); font-weight: 100 700; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/assets/fonts/plex-mono-400-latin.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/assets/fonts/plex-mono-500-latin.woff2") format("woff2"); font-weight: 500 700; font-style: normal; font-display: swap; }

:root {
  color-scheme: light dark;
  /* substrate and ink */
  --sheet: #fafafb;        /* the page */
  --paper: #f1f2f4;        /* the sidebar */
  --field: #ffffff;        /* inputs, menus, raised parts */
  --well: #f1f3f5;         /* code and captured bodies */
  --ink: #14171b;
  --dim: #5a626c;          /* 5.9:1 on --sheet */
  --line: #e0e3e7;         /* hairlines between rows */
  --rule: #14171b;         /* header rules and ruled-off totals */
  --edge: #858c96;         /* control boundaries, 3.2:1 */
  --hover: rgb(20 23 27 / 0.04);
  --shade: rgb(20 23 27 / 0.14);
  /* the one accent: the main action, the thing selected, links */
  --go: #2747c9; --go-hi: #1d38a8; --go-ink: #ffffff; --go-text: #2747c9; --go-wash: #e8ecfb;
  /* states, apart from the accent */
  --ok: #17734a; --ok-wash: #e3f2ea;
  --caution-text: #8a5300; --caution-wash: #f8eed9;
  --stop: #b3261e; --stop-text: #b3261e; --stop-wash: #fbe6e4;
  --info-text: #2747c9; --info-wash: #e8ecfb;
  /* chart series: identity only, never state */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --so: #9aa5b8;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 6px; --r-sm: 4px;
  --gut: clamp(1rem, 4vw, 2.5rem);
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --sheet: #111316; --paper: #0c0e10; --field: #16191d; --well: #181b20;
    --ink: #e6e8eb; --dim: #98a1ab; --line: #23272d; --rule: #c9ced5; --edge: #6b737d;
    --hover: rgb(230 232 235 / 0.05); --shade: rgb(0 0 0 / 0.5);
    --go: #8aa4ff; --go-hi: #a9bcff; --go-ink: #0a1433; --go-text: #8aa4ff; --go-wash: #17213f;
    --ok: #5cc28d; --ok-wash: #12291d;
    --caution-text: #e0a84a; --caution-wash: #2e2410;
    --stop: #ff8b80; --stop-text: #ff8b80; --stop-wash: #33171a;
    --info-text: #8aa4ff; --info-wash: #17213f;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #0ca30c; --s7: #9085e9; --so: #5d6878;
  }
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--sheet); color: var(--ink); font: 400 0.9375rem/1.55 var(--sans); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
a { color: var(--go-text); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { margin: 0; font-weight: 600; text-wrap: balance; overflow-wrap: anywhere; }
h1 { font-size: 1.625rem; line-height: 1.15; letter-spacing: -0.018em; }
h2 { font-size: 1.0625rem; line-height: 1.3; letter-spacing: -0.006em; }
h3 { font-size: 0.9375rem; line-height: 1.35; margin: 1.5rem 0 0.5rem; }
p { margin: 0 0 1rem; max-width: 68ch; text-wrap: pretty; }
dl { margin: 0; }
small { font-size: 0.8125rem; line-height: 1.4; color: var(--dim); }
strong { font-weight: 600; }
code, pre, kbd, .mono { font-family: var(--mono); font-size: 0.875em; }
:not(pre) > code { overflow-wrap: anywhere; }
.dim { color: var(--dim); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[hidden] { display: none !important; }
.skip { position: absolute; left: 0.75rem; top: -5rem; z-index: 5; padding: 0.75rem 1rem; background: var(--field); color: var(--ink); border: 2px solid var(--go-text); border-radius: var(--r); }
.skip:focus { top: 0.75rem; }
:focus-visible { outline: 2px solid var(--go-text); outline-offset: 2px; }
main:focus { outline: none; }

/* ---------------------------------------------------------------- shell: a sidebar of grouped sections */
.app { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; }
.side { background: var(--paper); border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1rem; padding: 0.5rem var(--gut) 0.25rem; }
.brand { display: inline-flex; align-items: center; gap: 0.45em; min-height: 44px; text-decoration: none; color: var(--ink); font: 500 1rem/1 var(--mono); letter-spacing: -0.02em; white-space: nowrap; }
.brand-n { font-weight: 500; }
.brand-s { font-weight: 400; color: var(--dim); }
/* Phone: every section is one item of one wrapping row (a group is not a line of its own), the search a line below. */
.side nav { order: 3; flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: 0 0.125rem; margin-inline: -0.5rem; }
.nav-group { display: contents; }
.nav-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; margin: 0; }
.side ul { list-style: none; margin: 0; padding: 0; display: contents; }
.side nav a { display: flex; align-items: center; min-height: 44px; padding: 0 0.5rem; border-radius: var(--r); color: var(--ink); text-decoration: none; white-space: nowrap; }
.side nav a[aria-current="page"] { color: var(--go-text); background: var(--go-wash); font-weight: 600; }
.jump { order: 4; flex: 1 0 100%; margin: 0 0 0.25rem; }
.who { margin-left: auto; display: flex; align-items: center; gap: 0.25rem; }
.who form { margin: 0; }
.who-name { display: flex; flex-direction: column; justify-content: center; min-height: 44px; margin: 0; padding: 0 0.625rem; max-width: none; color: var(--ink); line-height: 1.25; }
.who-name strong { font-weight: 600; font-size: 0.875rem; overflow-wrap: anywhere; }
.who-name small { font-size: 0.75rem; }
/* Narrow screens: brand, name and Sign out share the first line; the role waits for the sidebar. */
@media (max-width: 63.99rem) {
  .who-name small { display: none; }
  .who button.quiet { padding-inline: 0.375rem; }
}
@media (hover: hover) and (pointer: fine) {
  .side nav a:hover { background: var(--hover); }
  .side nav a[aria-current="page"]:hover { background: var(--go-wash); }
}
@media (min-width: 64rem) {
  .app { grid-template-columns: 15rem minmax(0, 1fr); }
  .side { position: sticky; top: 0; height: 100dvh; overflow-y: auto; flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 1.25rem; border-bottom: 0; border-right: 1px solid var(--line); padding: 1.25rem 0.75rem 1rem; }
  .side .brand { padding: 0 0.625rem; }
  .jump { order: 0; flex: none; margin: 0; }
  .jump input[type="search"] { font-size: 0.75rem; min-height: 2.125rem; padding: 0.25rem 0.625rem; }
  .side nav { order: 0; flex: 1 1 auto; flex-direction: column; gap: 1.5rem; overflow: visible; margin: 0; }
  .nav-group { display: block; }
  .nav-name { position: static; width: auto; height: auto; overflow: visible; clip-path: none; color: var(--dim); font: 500 0.75rem/1 var(--mono); letter-spacing: 0.02em; padding: 0 0.625rem 0.625rem; }
  .side ul { display: flex; flex-direction: column; gap: 0.125rem; }
  .side nav a { min-height: 2.25rem; padding: 0 0.625rem; }
  .who { margin: 0; flex-direction: column; align-items: stretch; gap: 0.125rem; border-top: 1px solid var(--line); padding-top: 0.75rem; }
  .who form button { width: 100%; justify-content: flex-start; padding-inline: 0.625rem; }
  main { padding: 2.25rem 3rem 6rem; }
}
/* The public page and the sign-in page have no sidebar. */
.pub { display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: var(--paper); border-bottom: 1px solid var(--line); padding: 0.5rem var(--gut); }

/* ---------------------------------------------------------------- page frame */
main { padding: 1.5rem var(--gut) 5rem; min-width: 0; width: 100%; max-width: 84rem; }
main > :not(:first-child) { margin-top: 1.25rem; }
main.doc { margin-inline: auto; max-width: 62rem; }
main.solo { max-width: 24rem; margin: 0 auto; padding-top: max(3rem, 14svh); }
.solo-b { margin: 0 0 2.5rem; }
main.solo h1 { font-size: 1.375rem; }
.way ol { display: flex; flex-wrap: wrap; gap: 0 0.375rem; margin: 0; padding: 0; list-style: none; font-size: 0.8125rem; color: var(--dim); }
.way li + li::before { content: "›"; margin-right: 0.375rem; color: var(--edge); }
.way [aria-current] { color: var(--ink); font-weight: 600; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0.75rem 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--rule); }
main > .way + .head { margin-top: 0.5rem; }
main > .head + * { margin-top: 1.75rem; }
.head > div:first-child { min-width: 0; }
.lede { margin: 0.375rem 0 0; color: var(--dim); }
.acts { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.tabs { border-bottom: 1px solid var(--line); }
.tabs ul { display: flex; flex-wrap: wrap; gap: 0 0.25rem; margin: 0; padding: 0; list-style: none; }
.tabs a { display: flex; align-items: center; min-height: 44px; padding: 0 0.75rem; margin-bottom: -1px; color: var(--ink); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs li:first-child a { padding-left: 0; }
.tabs a[aria-current="page"] { font-weight: 600; border-bottom-color: var(--go-text); }
@media (pointer: fine) { .tabs a { min-height: 2.5rem; } }
@media (hover: hover) and (pointer: fine) { .tabs a:not([aria-current]):hover { border-bottom-color: var(--edge); } }
main > .sec:not(:first-child) { margin-top: 2.5rem; }
main > .head + .sec { margin-top: 1.75rem; }
.sec > :not(:first-child) { margin-top: 0.875rem; }
.sec-h { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; }
.sec-a { font-size: 0.875rem; color: var(--dim); }
.cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 3rem; }
@media (min-width: 62rem) { .cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols.side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
.cols > * { min-width: 0; }

/* ---------------------------------------------------------------- state: a tinted word, never a lamp */
.sign { display: inline-block; padding: 0.125rem 0.4375rem; border-radius: var(--r-sm); font: 600 0.75rem/1.35 var(--sans); letter-spacing: 0.01em; white-space: nowrap; vertical-align: 0.06em; }
.sign.go { color: var(--ok); background: var(--ok-wash); }
.sign.caution { color: var(--caution-text); background: var(--caution-wash); }
.sign.stop { color: var(--stop-text); background: var(--stop-wash); }
.sign.info { color: var(--info-text); background: var(--info-wash); }
.code { font-family: var(--mono); }
.sign + .sign, .plain + .sign, .sign + .plain { margin-left: 0.375rem; }

/* ---------------------------------------------------------------- the route strip: one chip per stop, tiers joined by arrows */
.route { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem 0; margin: 0; padding: 0; list-style: none; }
.tier { display: flex; align-items: stretch; }
.tier + .tier::before { content: "→"; align-self: center; margin: 0 0.5rem; color: var(--dim); }
.exit { display: flex; align-items: center; padding: 0 0.4375rem; color: var(--dim); background: var(--well); border: 1px solid var(--line); border-right: 0; font: 500 0.75rem/1 var(--mono); border-radius: var(--r-sm) 0 0 var(--r-sm); }
.tier ul { display: flex; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: 0 var(--r-sm) var(--r-sm) 0; background: var(--field); }
.hop { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.375rem; padding: 0.125rem 0.5rem; font-size: 0.75rem; line-height: 1.5; }
.hop + .hop { border-left: 1px solid var(--line); }
.hop-w { font: 500 0.75rem/1.5 var(--mono); }
.hop-d { font-family: var(--mono); color: var(--dim); overflow-wrap: anywhere; }
.hop-n { color: var(--dim); white-space: nowrap; font-weight: 500; }
.hop.stop { background: var(--stop-wash); }
.hop.stop .hop-n { color: var(--stop-text); font-weight: 600; }
.hop.caution { background: var(--caution-wash); }
.hop.caution .hop-n { color: var(--caution-text); font-weight: 600; }

/* ---------------------------------------------------------------- ledgers (tables) */
.scroll {
  position: relative; overflow-x: auto; max-width: 100%;
  /* scroll shadows: show there is more to the side, only when there is */
  background:
    linear-gradient(to right, var(--sheet) 30%, transparent) left / 2rem 100% no-repeat local,
    linear-gradient(to left, var(--sheet) 30%, transparent) right / 2rem 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, var(--shade), transparent) left / 0.625rem 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, var(--shade), transparent) right / 0.625rem 100% no-repeat scroll;
}
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; line-height: 1.45; font-variant-numeric: tabular-nums; }
/* A cell wraps only when the table runs out of width (a table at its natural size has one line per entry); figures and row names never break, a time breaks between date and time, identifiers break anywhere as a last resort. */
th, td { padding: 0.625rem 0.5rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); overflow-wrap: break-word; }
td.n, th.n, th[scope="row"] { white-space: nowrap; }
td code, td a { overflow-wrap: break-word; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
thead th { padding-top: 0; font: 500 0.75rem/1.3 var(--mono); letter-spacing: 0.01em; color: var(--dim); vertical-align: bottom; border-bottom-color: var(--rule); }
tbody th { font-weight: 600; }
tbody a { text-decoration: none; }
td.n, th.n { text-align: right; }
td.act { text-align: right; }
td .dim, th .dim { font-weight: 400; }
td code, th code { font-size: 0.8125rem; }
.wrap { white-space: normal; overflow-wrap: anywhere; min-width: 16rem; max-width: 44ch; }
.sub { display: block; margin-top: 0.125rem; font-weight: 400; font-size: 0.8125rem; color: var(--dim); white-space: normal; }
tr.below td { white-space: normal; padding-left: 0.75rem; font-size: 0.8125rem; }
tr.below.stop td { background: var(--stop-wash); color: var(--stop-text); }
tr.below.caution td { background: var(--caution-wash); color: var(--caution-text); }
@media (hover: hover) and (pointer: fine) { tbody a:hover { text-decoration: underline; text-decoration-thickness: 1px; } tbody tr:not(.below):hover > * { background: var(--hover); } }
@media (max-width: 40rem) {
  table, tbody, tr, th, td { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tbody tr { padding: 0.75rem 0 0.875rem; border-bottom: 1px solid var(--line); }
  th, td, td.n, td.act { padding: 0.125rem 0; border: 0; text-align: left; white-space: normal; overflow-wrap: anywhere; }
  tbody th { font-size: 1rem; padding-bottom: 0.375rem; }
  th[scope="row"] { white-space: normal; }
  td[data-label]:not([data-label=""]) { display: grid; grid-template-columns: 7.25rem minmax(0, 1fr); gap: 0 0.75rem; }
  td[data-label]:not([data-label=""])::before { content: attr(data-label); grid-column: 1; grid-row: 1; font: 500 0.75rem/1.6 var(--mono); color: var(--dim); }
  /* every part of a cell (a name and the lines under it) stacks in the value column */
  td[data-label]:not([data-label=""]) > * { grid-column: 2; }
  td[data-label] > .sign, td[data-label] > .plain { justify-self: start; }
  .wrap { min-width: 0; max-width: none; }
  tr.below { padding: 0; border: 0; }
  tr.below td { padding: 0.5rem 0.75rem; }
}
.facts { display: grid; grid-template-columns: minmax(0, 1fr); border-top: 1px solid var(--rule); }
.facts > div { display: grid; grid-template-columns: minmax(9rem, 13rem) minmax(0, 1fr); gap: 0 1rem; padding: 0.625rem 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--dim); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 36rem) { .facts > div { grid-template-columns: minmax(0, 1fr); } .facts dt { font-size: 0.8125rem; } }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--rule); }
@media (min-width: 48rem) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { min-width: 0; padding: 0.75rem 1rem 0.875rem 0; border-bottom: 1px solid var(--line); }
.stat:nth-child(2n) { padding-left: 1rem; border-left: 1px solid var(--line); }
@media (min-width: 48rem) { .stat:nth-child(2n) { padding-left: 0; border-left: 0; } .stat:not(:nth-child(4n+1)) { padding-left: 1rem; border-left: 1px solid var(--line); } }
.stat dt { font: 500 0.75rem/1.3 var(--mono); color: var(--dim); }
.stat dd { margin: 0; }
.stat-v { font-size: 1.625rem; font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; }
.stat-u { min-height: 1.4em; font-size: 0.8125rem; color: var(--dim); }
.up { color: var(--stop-text); } .down { color: var(--ok); }

/* ---------------------------------------------------------------- messages */
.note { max-width: 72ch; padding: 0.75rem 1rem; background: var(--well); border: 1px solid var(--line); border-radius: var(--r); }
.note > :last-child { margin-bottom: 0; }
.note.go { background: var(--ok-wash); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.note.caution { background: var(--caution-wash); border-color: color-mix(in srgb, var(--caution-text) 35%, transparent); }
.note.stop { background: var(--stop-wash); border-color: color-mix(in srgb, var(--stop) 35%, transparent); }
.errs { margin: 0.5rem 0 0; padding-left: 1.25rem; font: 400 0.8125rem/1.6 var(--mono); }
.empty { padding: 1.25rem 1rem; border: 1px dashed var(--edge); border-radius: var(--r); }
.empty p { margin: 0; }
.empty p + p { margin-top: 0.25rem; color: var(--dim); }
.well { margin: 0; padding: 1rem 1.125rem; max-height: 32rem; overflow: auto; background: var(--well); border: 1px solid var(--line); border-radius: var(--r); font-size: 0.8125rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 4; }
/* A secret shown once reads like a tear-off stub: dashed edge, nothing else around it. */
.once { max-width: 48rem; padding: 1rem 1.25rem; background: var(--go-wash); border: 1px dashed var(--go-text); border-radius: var(--r); }
.once > :last-child { margin-bottom: 0; }
.once-v { display: block; margin: 0.5rem 0; padding: 0.625rem 0.75rem; background: var(--field); border: 1px solid var(--edge); border-radius: var(--r-sm); font: 500 0.875rem/1.6 var(--mono); overflow-wrap: anywhere; user-select: all; }
/* A collapsible part: a ledger row that shows its title, opens to its fields. */
.fold { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.fold + .fold { border-top: 0; }
.fold > summary { display: flex; align-items: center; min-height: 44px; font-weight: 600; cursor: pointer; list-style: none; }
.fold > summary::-webkit-details-marker { display: none; }
/* The section's state ("none", "defaults") sits at the row's end, apart from its title. */
.fold > summary .dim { margin-left: auto; padding-left: 1rem; font-weight: 400; font-size: 0.875rem; }
.fold > summary::before { content: ""; flex: none; width: 0.5rem; height: 0.5rem; margin: 0 0.75rem 0 0.125rem; border-right: 2px solid var(--dim); border-bottom: 2px solid var(--dim); transform: rotate(-45deg); }
.fold[open] > summary::before { transform: rotate(45deg); }
.fold-b { padding: 0.25rem 0 1.5rem 1.375rem; }
.fold-b > :not(:first-child) { margin-top: 1rem; }
@media (hover: hover) and (pointer: fine) { .fold > summary:hover { background: var(--hover); } }
.pager { display: flex; gap: 0.5rem; }

/* ---------------------------------------------------------------- controls */
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 44px; padding: 0 1rem; font: 500 0.9375rem/1 var(--sans); color: var(--ink); background: var(--field); border: 1px solid var(--edge); border-radius: var(--r); text-decoration: none; white-space: nowrap; cursor: pointer; }
button:active, .btn:active { transform: translateY(1px); }
button.go, .btn.go { background: var(--go); border-color: var(--go); color: var(--go-ink); font-weight: 600; }
button.stop, .btn.stop { color: var(--stop-text); border-color: var(--stop-text); }
button.quiet, .btn.quiet { background: transparent; border-color: transparent; color: var(--go-text); padding-inline: 0.5rem; }
button.quiet.stop { color: var(--stop-text); }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
@media (pointer: fine) { button, .btn { min-height: 2.25rem; padding-inline: 0.875rem; font-size: 0.875rem; } td button, td .btn { min-height: 2rem; } }
@media (hover: hover) and (pointer: fine) {
  button:hover, .btn:hover { border-color: var(--ink); }
  button.go:hover, .btn.go:hover { background: var(--go-hi); border-color: var(--go-hi); }
  button.stop:hover, .btn.stop:hover { background: var(--stop-wash); border-color: var(--stop-text); }
  button.quiet:hover, .btn.quiet:hover { border-color: transparent; text-decoration: underline; text-underline-offset: 0.2em; }
}
form { margin-bottom: 0; }
form.inline { display: inline-flex; }
form.stack, .stack { display: flex; flex-direction: column; gap: 1.125rem; max-width: 40rem; }
form.stack > button, .stack > button, .stack > .btn { align-self: flex-start; }
.solo form.stack > button, .solo .stack > button { align-self: stretch; }
form.bar { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.75rem 1rem; }
form.bar .field { flex: 1 1 13rem; max-width: 24rem; }
.filter form.bar .field { flex: 0 1 12rem; }
form.bar .field.grow { flex: 1 1 14rem; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.field { display: flex; flex-direction: column; gap: 0.375rem; min-width: 0; max-width: 44rem; }
.field label { font-size: 0.875rem; font-weight: 600; }
.field.wide { max-width: none; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea { width: 100%; min-height: 44px; padding: 0.5rem 0.75rem; font: 400 1rem/1.4 var(--sans); color: var(--ink); background: var(--field); border: 1px solid var(--edge); border-radius: var(--r); }
@media (pointer: fine) { input:not([type="checkbox"]):not([type="radio"]), select { min-height: 2.375rem; font-size: 0.9375rem; } textarea { font-size: 0.9375rem; } }
textarea { resize: vertical; line-height: 1.55; }
textarea.mono { font-family: var(--mono); white-space: pre; overflow: auto; tab-size: 4; }
@media (pointer: fine) { textarea.mono { font-size: 0.875rem; } }
input::placeholder, textarea::placeholder { color: var(--dim); opacity: 1; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--go-text); outline-offset: 0; border-color: var(--go-text); }
[aria-invalid="true"] { border-color: var(--stop-text) !important; }
small.err { color: var(--stop-text); font-weight: 600; }
.check { display: flex; flex-direction: column; gap: 0.125rem; padding: 0.375rem 0; }
.check label { display: inline-flex; align-items: flex-start; gap: 0.5rem; min-height: 2rem; font-weight: 600; cursor: pointer; }
.check input { flex: none; width: 1.125rem; height: 1.125rem; margin: 0.15em 0 0; accent-color: var(--go); }
.check small { margin-left: 1.625rem; max-width: 62ch; }
@media (pointer: coarse) { .check label { min-height: 2.75rem; align-items: center; } .check input { margin-top: 0; } }
.or { display: flex; align-items: center; gap: 0.75rem; margin: 1.25rem 0; color: var(--dim); font-size: 0.8125rem; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
@media (prefers-reduced-motion: no-preference) {
  a, button, .btn, input, select, textarea { transition: background-color 120ms var(--ease), border-color 120ms var(--ease), color 120ms var(--ease); }
  .fold > summary::before { transition: transform 120ms var(--ease); }
}

/* ---------------------------------------------------------------- filters, choices, charts */
.filter { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.75rem 0 1rem; border-bottom: 1px solid var(--line); }
.ranges { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; margin: 0; font-size: 0.875rem; }
.ranges a { display: inline-flex; align-items: center; min-height: 1.75rem; }
.filter .fold { flex: 1 0 100%; border: 0; }
.filter .fold > summary { min-height: 2.25rem; font-size: 0.875rem; }
.filter .fold-b { padding: 0.25rem 0 0; }
.bar { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.75rem 1rem; }
/* A button in a bar sits on the inputs' line: one label line and its gap above it. */
.bar > button, .bar > .btn { margin-top: 1.75rem; }
form.stack .bar .field { flex: 1 1 12rem; }
.bar .field { flex: 0 1 12rem; }
/* A choice among a few readings of the page: a bordered strip, the current one tinted. */
.seg { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem; font-size: 0.875rem; }
.seg-l { margin-right: 0.625rem; color: var(--dim); }
.seg a { display: inline-flex; align-items: center; min-height: 2.25rem; padding: 0 0.875rem; color: var(--ink); text-decoration: none; background: var(--field); border: 1px solid var(--edge); border-radius: var(--r); }
.seg a[aria-current] { background: var(--go-wash); color: var(--go-text); font-weight: 600; position: relative; }
.seg a:focus-visible { outline-offset: -3px; }
@media (hover: hover) and (pointer: fine) { .seg a:not([aria-current]):hover { background: var(--hover); } }
@media (pointer: coarse) { .seg a, .ranges a { min-height: 2.75rem; } }
fieldset { margin: 0; padding: 0.75rem 1.25rem 1.25rem; min-width: 0; border: 1px solid var(--line); border-radius: var(--r); }
legend { padding: 0 0.375rem; margin-left: -0.375rem; font-size: 0.875rem; font-weight: 600; }
fieldset > * + * { margin-top: 0.875rem; }
fieldset > legend + * { margin-top: 0; }
form.stack.wide { max-width: none; }
form.stack.full, form.stack:has(.scroll) { max-width: none; } /* a form with a table gives it the width; its fields cap themselves */
.pickhead, .picklist li { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr) minmax(0, 1.6fr); gap: 0.25rem 0.75rem; align-items: center; padding: 0.25rem 0.75rem; }
.pickhead { font: 500 0.75rem/1.3 var(--mono); color: var(--dim); }
.picklist { margin: 0; padding: 0; list-style: none; max-height: 34rem; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--field); }
.picklist li + li { border-top: 1px solid var(--line); }
.picklist label { display: flex; align-items: center; gap: 0.5rem; min-height: 2.25rem; min-width: 0; cursor: pointer; }
.picklist label code { overflow-wrap: anywhere; }
.picklist input[type="checkbox"] { flex: none; width: 1.125rem; height: 1.125rem; accent-color: var(--go); }
@media (max-width: 47.99rem) { .pickhead { display: none; } .picklist li { grid-template-columns: minmax(0, 1fr); } }
.snip { margin: 0; }
.snip + .snip { margin-top: 1rem; }
.snip figcaption { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; min-height: 2rem; font: 500 0.75rem/1.4 var(--mono); color: var(--dim); }
.steps { margin: 0; padding-left: 1.25rem; max-width: 76ch; }
.steps li + li { margin-top: 0.375rem; }
.steps .done { color: var(--dim); }
.points { margin: 0; padding-left: 1.25rem; max-width: 76ch; }
.points li + li { margin-top: 0.375rem; }
.facts.tall > div { align-items: start; }
.cols2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr)); gap: 1rem 0.75rem; }
.pair { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 0.5rem 0.75rem; align-items: start; }
.target { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.6fr) 4.75rem 4.75rem minmax(0, 0.9fr); gap: 0.5rem 0.625rem; align-items: start; padding: 0.625rem 0.875rem 0.875rem; background: var(--field); border: 1px solid var(--line); border-radius: var(--r); }
.target-h { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.25rem 1rem; }
.target-h .check { padding: 0; }
.target-h .check label { min-height: 1.75rem; font-weight: 500; font-size: 0.875rem; color: var(--stop-text); }
.target-h .check input { accent-color: var(--stop); }
.target:has(input[name$="_drop"]:checked) { background: var(--stop-wash); border-color: var(--stop-text); }
.target:has(input[name$="_drop"]:checked) .target-h strong { text-decoration: line-through; }
fieldset > .target + .target, fieldset > p + .target { margin-top: 0.75rem; }
@media (max-width: 47.99rem) {
  .pair { grid-template-columns: minmax(0, 1fr); }
  .target { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .target > :nth-child(-n+3) { grid-column: 1 / -1; }
}
.diff { margin: 0; padding: 0.5rem 0; max-height: 36rem; overflow: auto; background: var(--well); border-radius: var(--r-sm); font-size: 0.75rem; line-height: 1.65; tab-size: 4; }
.diff span { display: block; min-width: max-content; padding: 0 0.875rem; white-space: pre; }
.diff .gone { background: var(--stop-wash); color: var(--stop-text); }
.diff .new { background: var(--ok-wash); color: var(--ok); }
.diff .same { color: var(--dim); font-family: var(--sans); }
.picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0 1rem; }
.print { letter-spacing: 0.04em; font-weight: 500; }
.plot { position: relative; overflow-x: auto; }
.chart { display: block; width: 100%; min-width: 34rem; height: auto; border-bottom: 1px solid var(--rule); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .base { stroke: var(--rule); stroke-width: 1; }
.chart .ax { fill: var(--dim); font: 12px var(--mono); }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: var(--hover); }
.s1 { fill: var(--s1); } .s2 { fill: var(--so); } .s3 { fill: var(--s3); } .s4 { fill: var(--s4); } .s5 { fill: var(--s5); } .s6 { fill: var(--s6); } .s7 { fill: var(--s7); }
.l1, .l2, .l3 { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.l1 { stroke: var(--ink); } .l2 { stroke: var(--go-text); stroke-dasharray: 6 3; } .l3 { stroke: var(--stop-text); stroke-dasharray: 2 3; }
.d1 { fill: var(--ink); } .d2 { fill: var(--go-text); } .d3 { fill: var(--stop-text); }
.legend { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin: 0.75rem 0 0; padding: 0; list-style: none; font-size: 0.8125rem; }
.key { display: inline-block; width: 0.75rem; height: 0.75rem; margin-right: 0.375rem; border-radius: 2px; vertical-align: -0.1em; }
.key.s1 { background: var(--s1); } .key.s2 { background: var(--so); } .key.s3 { background: var(--s3); }
.key.l1, .key.l2, .key.l3 { height: 2px; vertical-align: 0.25em; }
.key.l1 { background: var(--ink); } .key.l2 { background: var(--go-text); } .key.l3 { background: var(--stop-text); }
.share { display: inline-block; width: 4.5rem; height: 0.375rem; margin-left: 0.5rem; vertical-align: 0.15em; }
.share-t { fill: var(--line); } .share-v { fill: var(--go-text); }

/* ---------------------------------------------------------------- the order of a route's targets */
.order-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.order-row { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; align-items: center; gap: 0.25rem 0.75rem; padding: 0.375rem 0; border-bottom: 1px solid var(--line); background: var(--sheet); }
/* The first row of a tier carries a heavier rule above it, so tiers read as blocks. */
.order-row.first:not(:first-child) { border-top: 2px solid var(--edge); margin-top: -1px; }
.order-who { min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.5rem; }
.order-who .hop-d { font-size: 0.8125rem; }
.order-t { display: inline-flex; align-items: center; gap: 0.375rem; font: 500 0.75rem/1 var(--mono); color: var(--dim); }
.order-t input[type="number"] { width: 4rem; min-height: 2.25rem; padding-inline: 0.5rem; font-size: 0.9375rem; text-align: center; }
@media (pointer: coarse) { .order-t input[type="number"] { min-height: 2.75rem; } }
.order-w { font: 500 0.75rem/1 var(--mono); color: var(--dim); white-space: nowrap; }
.order-mv { display: inline-flex; gap: 0.25rem; }
.order-mv button { padding-inline: 0.625rem; }
.grip { display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.75rem; margin-left: -0.375rem; color: var(--dim); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; border-radius: var(--r-sm); }
.grip::before { content: ""; width: 0.625rem; height: 1rem; background: radial-gradient(circle, currentColor 1.1px, transparent 1.5px) 0 0 / 0.3125rem 0.3125rem; }
.grip:focus-visible { outline-offset: -2px; }
@media (hover: hover) and (pointer: fine) { .grip:hover { color: var(--ink); background: var(--hover); } }
.order-row.drag { opacity: 0.45; }
.order-row.into { background: var(--go-wash); outline: 2px solid var(--go-text); outline-offset: -2px; }
.order-row.above::before, .order-row.under::after { content: ""; position: absolute; left: 0; right: 0; height: 3px; background: var(--go-text); border-radius: 2px; pointer-events: none; }
.order-row.above::before { top: -2px; }
.order-row.under::after { bottom: -2px; }
.order-prev { padding: 0.25rem 0; }
[data-order-say] { min-height: 1.5em; margin: 0; }
.order-list.dragging { cursor: grabbing; }
@media (max-width: 47.99rem) {
  .order-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .order-t { grid-column: 2; justify-self: start; }
  .order-w { grid-column: 3; justify-self: end; }
  .order-mv { grid-column: 2 / -1; }
}
@media (prefers-reduced-motion: no-preference) { .order-row { transition: background-color 120ms var(--ease); } }

/* ---------------------------------------------------------------- editing pages: the save bar, removals */
/* The save bar stays at the foot of the window while a long form scrolls, so saving is never far. */
.savebar { position: sticky; bottom: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin-top: 1.25rem; padding: 0.75rem 0 calc(0.75rem + env(safe-area-inset-bottom, 0px)); background: var(--sheet); border-top: 1px solid var(--line); }
/* A removal sits apart, in a red-edged box, folded until asked for. */
.danger { max-width: 40rem; padding: 0 1rem; border: 1px solid color-mix(in srgb, var(--stop) 40%, transparent); border-radius: var(--r); }
.danger .fold { border: 0; }
.danger .fold > summary { color: var(--stop-text); }
.danger .fold-b { padding-left: 0; }
.btn.quiet.stop { color: var(--stop-text); }
.order-x { display: inline-flex; align-items: center; gap: 0.375rem; margin-left: 0.5rem; font-size: 0.8125rem; color: var(--stop-text); cursor: pointer; }
.order-x input { accent-color: var(--stop); width: 1.125rem; height: 1.125rem; }
.order-row:has(.order-x input:checked) { background: var(--stop-wash); }
.order-row:has(.order-x input:checked) .order-who { text-decoration: line-through; }
main > #remove { margin-top: 2.5rem; }
@media print { .side, .pub, .skip, .acts, .tabs { display: none; } .app { display: block; } main { padding: 0; max-width: none; } }
/* hx-tpl: a difference to decide (two radio words), the folded order editor */
.choose { display: flex; flex-direction: column; gap: 0.25rem; margin: 0; padding: 0; border: 0; min-width: 0; }
.choose label { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2rem; font-weight: 400; cursor: pointer; }
.choose input { flex: none; width: 1.125rem; height: 1.125rem; margin: 0; accent-color: var(--go); }
.choose label:has(input:checked) { font-weight: 600; }
.sec:has(details.fold[open]) .order-static { display: none; }

/* ---------------------------------------------------------------- gateway pages: route editor, safety check, add a gateway */
/* The route form groups its providers by tier; a card alone in its tier has no weight to set. */
.tier-h { margin: 1rem 0 0.375rem; font-size: 0.8125rem; font-weight: 600; color: var(--dim); }
.tier-h:first-of-type { margin-top: 0.5rem; }
.target.solo { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.6fr) 7.5rem minmax(0, 0.9fr); }
.target-mv { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0.5rem; }
@media (max-width: 47.99rem) { .target.solo { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* The safety check shows the group of the chosen mode and says so when it is off. */
.safety:has(select[name="mode"] option[value="off"]:checked) .only-judge,
.safety:has(select[name="mode"] option[value="off"]:checked) .only-list,
.safety:has(select[name="mode"] option[value="list"]:checked) .only-judge,
.safety:has(select[name="mode"] option[value="judge"]:checked) .only-list { display: none; }
.safety:not(:has(select[name="mode"] option[value="off"]:checked)) .only-off { display: none; }
/* The name of a new customer is asked only when a new customer is chosen. */
form:not(:has(select[name="enterprise"] option[value="new"]:checked)) .if-new { display: none; }
.target-note { grid-column: 1 / -1; margin: 0; }

/* ---------------------------------------------------------------- traffic: the filters fold, range links, charts on a phone */
/* The range links are buttons, the one for the window in force tinted; the sentence below says which. */
.filter .ranges a { padding: 0 0.75rem; min-height: 2rem; color: var(--ink); text-decoration: none; background: var(--field); border: 1px solid var(--edge); border-radius: var(--r); }
.filter .ranges a[aria-current] { background: var(--go-wash); color: var(--go-text); font-weight: 600; }
@media (hover: hover) and (pointer: fine) { .filter .ranges a:not([aria-current]):hover { background: var(--hover); } }
.filter .shown { margin: 0; font-size: 0.875rem; }
/* "Filters": a checkbox toggle, so it works without script. On a phone it is a 44px row that opens
   the form; wider, the label is gone and the form always shows. Open when a filter is set (server). */
.fl-t { display: none; }
.fl-h { display: none; }
.reqs td:nth-child(2), .reqs td:nth-child(3) { white-space: nowrap; }
@media (max-width: 40rem) { .reqs td:nth-child(2), .reqs td:nth-child(3) { white-space: normal; } }
.picks-h { margin: 0.75rem 0 0.25rem; font-size: 0.8125rem; }
@media (max-width: 47.99rem) {
  .fl-t { display: block; position: absolute; opacity: 0; pointer-events: none; }
  .fl-h { display: flex; align-items: center; min-height: 2.75rem; font-weight: 600; cursor: pointer; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .fl-h::before { content: ""; flex: none; width: 0.5rem; height: 0.5rem; margin: 0 0.75rem 0 0.125rem; border-right: 2px solid var(--dim); border-bottom: 2px solid var(--dim); transform: rotate(-45deg); }
  .fl-t:checked + .fl-h::before { transform: rotate(45deg); }
  .fl-h .dim { margin-left: auto; padding-left: 1rem; font-weight: 400; font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .fl-t:not(:checked) ~ .fl-b { display: none; }
  .fl-t:focus-visible + .fl-h { outline: 2px solid var(--go-text); outline-offset: 2px; }
  .filter form.bar .field { flex: 1 1 100%; max-width: none; }
  /* The charts scale to the screen: scrolling hid the newest days, the ones read first. */
  .chart { min-width: 0; }
  .chart .ax { font-size: 22px; }
}
