/* Relayster cabinet, round 5: the one stylesheet. Every value comes from DESIGN.md; add a token there first.
   avoid-ai-design-ignore: T1 (no Inter here; the owner asked for an OpenRouter-like neutral sans: Golos Text, chosen
   for its Cyrillic, see DESIGN.md «Typography») */

@font-face {
  font-family: "Golos Text";
  src: url("fonts/golos-text-vf.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-vf.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

:root {
  --paper: #ffffff;
  --fill: #f5f6f8;
  --ink: #17191e;
  --ink-2: #5a606b;
  --ink-3: #8a909b;
  --line: #e3e6ea;
  --line-2: #cdd2d8;
  --accent: #2b2f36;
  --accent-hover: #15171b;
  --accent-wash: #eceef1;
  --danger: #b42318;
  --danger-hover: #8f1c13;
  --danger-wash: #fdeeec;
  --danger-line: #f1c4be;
  --sans: "Golos Text", "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", Menlo, Consolas, monospace;
  --r-control: 6px;
  --r-panel: 8px;
  --h-control: 40px;
  --top: 56px;
  --pad: 40px;
  --shadow: 0 12px 32px rgb(23 25 30 / .14);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.5 var(--sans);
  font-variant-numeric: tabular-nums;
}
h1, h2, h3, p, ol, ul, dl, dd, figure, fieldset { margin: 0; }
ol, ul { padding: 0; list-style: none; }
fieldset { border: 0; padding: 0; min-width: 0; }
legend { padding: 0; }
img, svg { display: block; }
button, input, select { font: inherit; color: inherit; }
code, pre, .mono { font-family: var(--mono); font-size: .9em; font-variant-ligatures: none; }
b, strong { font-weight: 600; }

h1 { font-size: 24px; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 18px; line-height: 1.3; font-weight: 600; }
h3 { font-size: 15px; line-height: 1.4; font-weight: 600; }
.lead { color: var(--ink-2); margin-top: 4px; max-width: 64ch; }
.note { color: var(--ink-2); font-size: 14px; }
.m-only { display: none; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- buttons, fields */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h-control); padding: 0 16px; border: 1px solid var(--accent); border-radius: var(--r-control);
  background: var(--accent); color: var(--paper); font-weight: 500; line-height: 1; white-space: nowrap;
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--paper); }
.btn:disabled { background: var(--line-2); border-color: var(--line-2); color: var(--ink-2); cursor: not-allowed; }
.btn-quiet { background: var(--paper); border-color: var(--line-2); color: var(--ink); }
.btn-quiet:hover { background: var(--fill); border-color: var(--line-2); color: var(--ink); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn-s { height: 34px; padding: 0 12px; font-size: 14px; }
.btn-wide { width: 100%; }
.btn.is-done { background: var(--accent-wash); border-color: var(--accent-wash); color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 16px; }

.label { display: block; font-weight: 500; margin-bottom: 6px; }
.input, .select {
  width: 100%; height: var(--h-control); padding: 0 12px; border: 1px solid var(--ink-3); border-radius: var(--r-control);
  background: var(--paper);
}
.select { width: auto; padding-right: 32px; appearance: none; cursor: pointer;
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%235a606b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E") no-repeat right 8px center; }
.input::placeholder { color: var(--ink-2); }
.input:focus, .select:focus, .cell:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.input.is-bad, .cells.is-bad .cell { border-color: var(--danger); }
.hint { color: var(--ink-2); font-size: 14px; margin-top: 6px; }
.err { color: var(--danger); font-size: 14px; margin-top: 6px; display: flex; gap: 6px; align-items: flex-start; }
.err[hidden] { display: none; }
.err .i { width: 16px; height: 16px; margin-top: 2px; }
.nowrap { white-space: nowrap; } /* s3: a hyphenated word stays on one line (the filter "unbroken") */
.row-form { display: flex; gap: 8px; }
.row-form .input { flex: 1; min-width: 0; }

/* ---------------------------------------------------------------- frame: top bar, sidebar, page */

.top {
  position: sticky; top: 0; z-index: 10; height: var(--top); display: flex; align-items: center; gap: 16px;
  padding: 0 24px; background: var(--paper); border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-size: 18px; font-weight: 600; letter-spacing: -.01em; min-height: 44px; }
.brand:hover { color: var(--ink); }
.mark { width: 24px; height: 24px; }
.mark path, .mark rect { fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.mark .mk-leg { stroke: var(--accent); }
.top-end { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.bal { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.bal-k { color: var(--ink-2); font-size: 14px; }
.bal-v { font-weight: 600; }
.bal.is-low .bal-v { color: var(--danger); }

.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: calc(100vh - var(--top)); }
.side { border-right: 1px solid var(--line); padding: 16px 12px; }
.side-in { position: sticky; top: calc(var(--top) + 16px); display: grid; gap: 2px; }
.nav-a {
  display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border-radius: var(--r-control);
  color: var(--ink-2); font-weight: 500; text-decoration: none;
}
.nav-a:hover { background: var(--fill); color: var(--ink); }
.nav-a[aria-current="page"] { background: var(--accent-wash); color: var(--accent); }
.side hr { border: 0; border-top: 1px solid var(--line); margin: 8px 12px; }

.page { padding: 32px var(--pad) 72px; max-width: 1200px; min-width: 0; }
.page-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.page-h-split h1 { margin-right: auto; }
.back { display: inline-flex; align-items: center; gap: 4px; margin: -8px 0 8px -4px; padding: 0 4px; min-height: 36px; color: var(--ink-2); text-decoration: none; font-size: 14px; }
.back:hover { color: var(--ink); }
.back .i { width: 16px; height: 16px; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin-top: 6px; color: var(--ink-2); font-size: 14px; }
.sec { margin-top: 32px; }
.sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.sec-h a { font-size: 14px; }

.panel { border: 1px solid var(--line); border-radius: var(--r-panel); padding: 20px; background: var(--paper); }
.panel-k { color: var(--ink-2); font-size: 14px; }
.figure { font-size: 32px; line-height: 1.2; font-weight: 600; letter-spacing: -.01em; margin-top: 4px; }
.figure.is-low { color: var(--danger); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

/* account and phone menu: one <details>; its panel carries the sections only where the sidebar is hidden */
.menu { position: relative; }
.menu > summary {
  list-style: none; display: flex; align-items: center; gap: 6px; height: var(--h-control); padding: 0 10px;
  border-radius: var(--r-control); cursor: pointer; color: var(--ink);
}
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:hover, .menu[open] > summary { background: var(--fill); }
.menu > summary .i-burger { display: none; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 300px; padding: 8px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-panel); box-shadow: var(--shadow);
}
.menu-nav { display: none; }
.menu-who { padding: 8px 10px 10px; font-size: 14px; color: var(--ink-2); border-bottom: 1px solid var(--line); margin-bottom: 8px; overflow-wrap: anywhere; }
.menu-who b { display: block; color: var(--ink); font-weight: 500; font-size: 15px; }
.menu-k { display: block; padding: 0 10px 6px; font-size: 14px; color: var(--ink-2); }
.seg { display: inline-flex; padding: 2px; border: 1px solid var(--line-2); border-radius: var(--r-control); background: var(--paper); }
.seg a {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 4px; color: var(--ink-2);
  text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap;
}
.seg a:hover { color: var(--ink); background: var(--fill); }
.seg a[aria-current] { background: var(--accent-wash); color: var(--accent); }
.seg a span { color: var(--ink-2); font-weight: 400; }
.seg a[aria-current] span { color: var(--accent); }
.menu .seg { display: flex; margin: 0 10px 8px; }
.menu .seg a { flex: 1; justify-content: center; }
.menu-items { border-top: 1px solid var(--line); padding-top: 8px; display: grid; gap: 2px; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 8px 10px; border: 0; border-radius: var(--r-control);
  background: none; text-align: left; cursor: pointer; color: var(--ink); text-decoration: none;
}
.menu-item:hover { background: var(--fill); color: var(--ink); }
.menu-item small { display: block; color: var(--ink-2); font-size: 14px; }

/* ---------------------------------------------------------------- tables */

.table-box { border: 1px solid var(--line); border-radius: var(--r-panel); overflow-x: auto; overflow-y: hidden; position: relative; } /* s3: a table that still cannot fit scrolls inside its box, never clips a column; relative keeps its hidden labels inside */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.table thead th { padding-top: 10px; padding-bottom: 10px; background: var(--fill); color: var(--ink-2); font-size: 14px; font-weight: 500; white-space: nowrap; }
.table tbody:last-child tr:last-child > *, .table tfoot tr:last-child > * { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table .day th { background: var(--fill); font-weight: 500; padding-top: 8px; padding-bottom: 8px; }
.table .day span { float: right; color: var(--ink-2); font-weight: 400; font-size: 14px; }
.table tfoot td, .table tfoot th { background: var(--fill); border-bottom-color: var(--paper); padding-top: 8px; padding-bottom: 8px; }
.table .sub { display: block; color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.table .id { display: block; color: var(--ink-2); margin-top: 2px; overflow-wrap: anywhere; } /* s3: a long id wraps instead of pushing the money out */
/* s3: people's own values (addresses, key names) wrap rather than widen the page */
h1, h2, .lead, .dl dd, .facts dd, .c-name { overflow-wrap: anywhere; }
.c-key .key-name { display: inline-block; max-width: 12em; overflow-wrap: break-word; } /* a long key name wraps in its column, a short one keeps its width */
/* s3 (look3, look4): a runs table 650-880 px wide (windows of 700-930 px, 1024-1194 px beside the side menu) is tight. There a
   status cell asks for its status on one line (icon, gap and words: «Ответ отправлен» 9.832em, «Ответа нет» 6.827em, "Answer sent"
   7.447em, "No answer" 6.572em, plus 32 px, of which 28 are padding: 4 px to spare where an engine lays glyphs out at whole
   pixels), which the table gives before its ids grow and takes back only where it cannot hold whole key words; a key name keeps
   its longest word's width (it wraps between its words; a word breaks only when it alone is wider than the name's 12em cap); the
   line under a status takes only the width the other columns leave. So the table gives its spare width to the model ids. Where
   even so its columns cannot fit, the model column's head and names wrap rather than the table scroll. Narrower, the table wraps
   as it is; wider, it holds them all. */
.table-box:has(> .runs) { container-type: inline-size; }
@container (min-width: 650px) and (max-width: 880px) {
  .runs .c-how:has(> .st-ok) { width: calc(9.84em + 32px); }
  .runs .c-how:has(> .st-fail) { width: calc(6.83em + 32px); }
  .runs:lang(en) .c-how:has(> .st-ok) { width: calc(7.45em + 32px); }
  .runs:lang(en) .c-how:has(> .st-fail) { width: calc(6.58em + 32px); }
  .runs .c-how { padding-right: 12px; }
  .runs .sub { contain: inline-size; }
  .runs .c-key { width: 1px; }
  .runs thead th:nth-child(2) { white-space: normal; }
  .runs .c-what a { overflow-wrap: anywhere; }
}
/* s3 (look4): in the narrowest of them (650-700 px) a viewer whose browser sent no time zone sees «UTC» under the time */
@container (min-width: 650px) and (max-width: 700px) { .runs .c-time { white-space: normal; } }
.people thead th, .people thead .num { white-space: normal; }
.people .c-what { min-width: 18em; overflow-wrap: anywhere; } /* an address of up to about 30 characters stays whole, a longer one wraps */
.table tr.is-off td { color: var(--ink-2); }
.c-time { width: 72px; white-space: nowrap; color: var(--ink-2); }
.c-what a { font-weight: 500; text-decoration: none; }
.c-what a:hover { text-decoration: underline; }
.c-what .m { font-weight: 500; }
.c-act { text-align: right; width: 1%; white-space: nowrap; }
.step-no {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; margin-right: 8px;
  border-radius: 50%; background: var(--accent-wash); color: var(--accent); font-size: 14px; font-weight: 600; vertical-align: 1px;
}
.hold { margin-top: 12px; display: grid; gap: 4px; font-size: 14px; }
.hold div { display: flex; justify-content: space-between; gap: 16px; }
.hold dt { color: var(--ink-2); }

/* status words: icon plus word; colour only where something went wrong, the live run in the accent */
.st { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.st .i { width: 16px; height: 16px; }
.st-ok .i { color: var(--ink-2); }
.st-fail { color: var(--danger); }
.st-cancel { color: var(--ink-2); }
.st-live { color: var(--accent); }

/* facts: a row of small boxes */
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 24px; }
.facts > div { border: 1px solid var(--line); border-radius: var(--r-panel); padding: 12px 16px; }
.facts dt { color: var(--ink-2); font-size: 14px; }
.facts dd { font-size: 18px; font-weight: 600; margin-top: 2px; }

/* definition list in two columns */
.dl { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 10px 24px; }
.dl dt { color: var(--ink-2); }
.dl dd { min-width: 0; }

/* code */
.code-box { border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden; }
.code-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 8px 6px 16px; background: var(--fill); border-bottom: 1px solid var(--line); color: var(--ink-2); font-size: 14px; }
.code { margin: 0; padding: 16px; overflow-x: auto; font-size: 13.5px; line-height: 1.6; background: var(--paper); }
.copy-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.copy-row code { overflow-wrap: anywhere; }
.copy .i { width: 16px; height: 16px; }

/* notices */
.notice {
  display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 4px 12px; padding: 16px; margin-bottom: 24px;
  border: 1px solid var(--danger-line); border-radius: var(--r-panel); background: var(--danger-wash);
}
.notice > .i { color: var(--danger); width: 20px; height: 20px; margin-top: 1px; }
.notice-h { font-size: 15px; font-weight: 600; }
.notice p + p { margin-top: 2px; }
.notice .actions { margin-top: 12px; }
.notice.is-info { border-color: var(--line); background: var(--fill); }
.notice.is-info > .i { color: var(--ink-2); }
.notice.is-ok { border-color: var(--line); background: var(--accent-wash); }
.notice.is-ok > .i { color: var(--accent); }

/* dialog: native <dialog>, shown modal by ui.js */
.dialog {
  width: calc(100% - 32px); max-width: 440px; padding: 24px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--paper); color: var(--ink); box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgb(23 25 30 / .4); }
.dialog p { margin-top: 8px; color: var(--ink-2); }
.dialog .actions { margin-top: 20px; }

/* ---------------------------------------------------------------- the scheme */

.scheme-box { border: 1px solid var(--line); border-radius: var(--r-panel); padding: 16px; overflow-x: auto; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-bottom: 12px; color: var(--ink-2); font-size: 14px; }
.legend li { display: inline-flex; align-items: center; gap: 8px; }
.legend svg { flex: none; }
.lg-path { stroke: var(--accent); stroke-width: 2.5; fill: none; }
.lg-skip { stroke: var(--ink-3); stroke-width: 1.2; fill: var(--paper); }
.lg-fail { stroke: var(--ink-3); stroke-width: 1.5; fill: none; stroke-dasharray: 2 4; stroke-linecap: round; }
.mm { min-height: 120px; }
.scroll-hint { display: none; margin: -4px 0 8px; }
.hold { margin-top: 12px; padding: 0 16px; }
.mm svg { max-width: none; }
.mm-wait { color: var(--ink-2); font-size: 14px; }
.mm-words { color: var(--ink-2); font-size: 14px; max-width: 72ch; }
.mm-words-h { color: var(--ink); font-weight: 600; }
.is-drawn .mm-wait, .is-drawn .mm-words { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.is-failed .mm-wait { display: none; }

.cols { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 24px; align-items: start; }

/* ---------------------------------------------------------------- page parts */

/* first run: a real sequence of three steps */
.steps { margin-top: 24px; max-width: 720px; }
.steps > li { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 16px; padding-bottom: 32px; }
.steps > li:last-child { padding-bottom: 0; }
.steps > li:not(:last-child)::after { content: ""; position: absolute; left: 13.5px; top: 36px; bottom: 6px; width: 1px; background: var(--line-2); }
.steps-n {
  display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--line-2); font-size: 14px; font-weight: 600; color: var(--ink-2);
}
.steps > li.is-now .steps-n { border-color: var(--accent); background: var(--accent); color: var(--paper); }
.steps p { color: var(--ink-2); margin-top: 2px; }
.steps .row-form, .steps .code-box, .steps .actions { margin-top: 12px; }
.steps .row-form { max-width: 480px; }

/* top-up */
.topup { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 32px; align-items: start; margin-top: 24px; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 8px; }
.tile { position: relative; display: block; padding: 14px 16px; border: 1px solid var(--line-2); border-radius: var(--r-panel); cursor: pointer; }
.tile:hover { background: var(--fill); }
.tile input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.tile b { display: block; font-size: 18px; }
.tile small { display: block; color: var(--ink-2); font-size: 14px; }
.tile:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-wash); }
.tile:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.other { display: flex; align-items: center; gap: 8px; max-width: 280px; margin-top: 8px; }
.terms { margin-top: 24px; color: var(--ink-2); font-size: 14px; display: grid; gap: 4px; }
.sum-rows { display: grid; gap: 10px; margin-top: 12px; }
.sum-rows div { display: flex; justify-content: space-between; gap: 16px; }
.sum-rows dt small { display: block; color: var(--ink-2); font-size: 14px; }
.sum-rows .total { border-top: 1px solid var(--line); padding-top: 10px; font-weight: 600; }
.after { color: var(--ink-2); font-size: 14px; margin-top: 12px; }
.panel .btn-wide { margin-top: 16px; }
.result { max-width: 560px; }
.result-i { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--fill); color: var(--ink-2); margin-bottom: 16px; }
.result-i.is-ok { background: var(--accent-wash); color: var(--accent); }
.result-i .i { width: 22px; height: 22px; }
.result .figure { margin-top: 12px; }
.result .panel { margin-top: 24px; }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--accent-wash); border-top-color: var(--accent); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* runs */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 0 16px; }
.toolbar label { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 14px; }
.toolbar form { display: flex; align-items: center; gap: 8px; } /* s3: the key filter is a GET form, its button beside the select */
.toolbar form, .toolbar label, .toolbar .select { min-width: 0; } /* s3: a long key name shrinks the select, never the screen */
.toolbar .select { overflow: hidden; } /* s3: WebKit would let the chosen name widen the page from inside the select */
.empty { border: 1px dashed var(--line-2); border-radius: var(--r-panel); padding: 40px 24px; text-align: center; }
.empty .result-i { margin: 0 auto 12px; }
.empty p { color: var(--ink-2); margin-top: 4px; }
.empty .actions { justify-content: center; }
.more { margin-top: 16px; }

/* keys */
.key-once { margin: 24px 0 0; }
.panel h2 + .gap-l { margin-top: 12px; }
.keys td { vertical-align: middle; }
.the-key { display: block; margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: var(--r-control); background: var(--paper); font-size: 14px; overflow-wrap: anywhere; }

/* relay */
.ends li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.ends li:first-child { padding-top: 0; }
.ends li:last-child { border-bottom: 0; padding-bottom: 0; }
.ends .row { display: flex; justify-content: space-between; gap: 16px; font-weight: 500; }
.ends .row span:last-child { white-space: nowrap; }
.ends p { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.explain { display: grid; gap: 16px; max-width: 760px; }
.explain h3 span { color: var(--ink-2); font-weight: 400; }
.explain p { color: var(--ink-2); margin-top: 2px; }

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

.top-signin .seg a { min-width: 44px; justify-content: center; }
.signin { max-width: 400px; margin: 0 auto; padding: 72px 16px 64px; }
.signin h1 { margin-top: 4px; }
.signin form { margin-top: 24px; }
.signin .btn-wide { margin-top: 16px; }
.signin .notice { margin-bottom: 24px; }
.signin-foot { margin-top: 24px; color: var(--ink-2); font-size: 14px; }
.signin-foot p + p { margin-top: 6px; }
.cells { display: flex; gap: 8px; }
.cells .gap { width: 8px; flex: none; }
.cell {
  width: 52px; height: 56px; padding: 0; border: 1px solid var(--ink-3); border-radius: var(--r-control);
  text-align: center; font-size: 24px; font-weight: 600; background: var(--paper);
}
.resend { margin-top: 16px; }
.signin form.resend { margin-top: 16px; } /* the resend button is a form of its own (s3), not v5's p */
.signin .cf-turnstile { margin-top: 16px; } /* the robot check's frame (s3): off the field above it */
.resend button { min-height: 40px; padding: 0; border: 0; background: none; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.resend button:disabled { color: var(--ink-2); text-decoration: none; cursor: default; }

/* small spacing helpers, the only ones */
.gap { margin-top: 8px; }
.gap-l { margin-top: 16px; }
.sec-s { margin-top: 20px; }
.narrow { max-width: 520px; }
.burger-t { display: none; }

/* a run's charges: the step's facts sit under its name; the footer adds the total and the hold */
.charges .sub { padding-left: 30px; }
.charges tfoot th { font-weight: 400; color: var(--ink-2); }
.charges tfoot td { font-weight: 400; }
.charges tfoot .is-total th, .charges tfoot .is-total td { font-weight: 600; color: var(--ink); }
.explain-m { font-size: 14px; }

/* ---------------------------------------------------------------- narrower windows */

@media (max-width: 1199px) {
  .cols { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1023px) {
  :root { --pad: 24px; }
  .shell { display: block; }
  .side { display: none; }
  .top { padding: 0 12px 0 16px; gap: 8px; }
  .menu > summary { width: 44px; height: 44px; padding: 0; justify-content: center; }
  .menu > summary .who, .menu > summary .i-chev { display: none; }
  .menu > summary .i-burger { display: block; width: 22px; height: 22px; }
  .burger-t { display: block; position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .menu[open] > summary::before {  /* a veil over the page: a press on it closes the menu, even without script */
    content: ""; position: fixed; inset: var(--top) 0 0 0; z-index: 15; background: rgb(23 25 30 / .3); cursor: default;
  }
  .menu-panel {
    position: fixed; left: 0; right: 0; top: var(--top); width: auto; max-height: calc(100dvh - var(--top)); overflow-y: auto;
    padding: 8px 16px 16px; border-width: 1px 0; border-radius: 0;
  }
  .menu-nav { display: grid; gap: 2px; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
  .menu-nav .nav-a { height: 48px; }
  .menu-who { border-bottom: 0; margin-bottom: 0; }
  .topup { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 639px) {
  :root { --pad: 16px; --h-control: 44px; }
  .page { padding-top: 20px; padding-bottom: 48px; }
  .top-end .btn { display: none; }
  .btn-s { height: 44px; padding: 0 14px; }
  .input, .select, .cell { font-size: 16px; }  /* 16 px: phones do not zoom into the field */
  .cell { font-size: 22px; }
  .seg a { height: 44px; }
  .back { min-height: 44px; margin-top: -12px; }
  .menu-item { min-height: 48px; }
  .sec-h a, .resend button { display: inline-flex; align-items: center; min-height: 44px; }
  .grid-2, .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scroll-hint { display: block; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .facts dd { font-size: 16px; }
  .figure { font-size: 28px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row-form { flex-direction: column; }
  .row-form .input { flex: none; }
  .amounts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dl { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .dl dd + dt { margin-top: 10px; }
  .panel { padding: 16px; }
  .signin { padding-top: 24px; }
  .cells { gap: 6px; }
  .cells .gap { width: 4px; }
  .cell { width: auto; flex: 1 1 0; min-width: 44px; height: 52px; }
  .toolbar { align-items: stretch; flex-direction: column; flex-wrap: nowrap; } /* s3: one column as wide as the screen, not as its widest item */
  .toolbar .seg { display: flex; }
  .toolbar .seg a { flex: 1; justify-content: center; padding: 0 8px; }
  .toolbar label { justify-content: space-between; }
  .toolbar .select { flex: 1; }
  .toolbar form label { flex: 1; }
  .people td.num, .credits td.num { text-align: left; } /* s3 admin tables: each value under its column's name */
  .people td[data-k]::before, .credits td[data-k]::before { content: attr(data-k) ": "; color: var(--ink-2); }
  .empty { padding: 32px 16px; }
  .empty .actions { flex-direction: column; align-items: stretch; }
  .empty .actions a:not(.btn) { display: inline-flex; justify-content: center; align-items: center; min-height: 44px; }

  /* tables become stacked rows: each row a small block, the money on the right of its first line */
  .m-only { display: inline; }
  .table, .table tbody, .table tfoot, .table tr, .table td, .table th { display: block; }
  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table tr { display: grid; gap: 2px 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .table tbody:last-child tr:last-child, .table tfoot tr:last-child { border-bottom: 0; }
  .table th, .table td { padding: 0; border: 0; width: auto; }
  .table tr.day { display: block; padding: 0; }
  .table .day th { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 12px; padding: 8px 16px; }
  .table .day span { float: none; }
  .table .num { text-align: right; }
  .c-what a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; padding: 9px 0; margin: -10px 0 -8px; } /* s3: a short name such as «ok» is still a 44 px target; a name on two lines pushes its id down */
  .c-key .key-name { display: inline; }
  .table .id { margin-top: 0; }

  .runs tr { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "what what sum" "how how how" "time key key"; column-gap: 4px; container-type: inline-size; }
  .runs.no-key tr { grid-template-areas: "what what sum" "how how how" "time time time"; }
  .runs .c-what { grid-area: what; }
  .runs .id { width: max-content; max-width: 100cqw; } /* s3: nothing sits under the charge, so an id takes its row's whole width before it wraps */
  .runs .c-sum { grid-area: sum; font-weight: 500; }
  .runs .c-how { grid-area: how; }
  .runs .c-time { grid-area: time; font-size: 14px; }
  .runs .c-key { grid-area: key; color: var(--ink-2); font-size: 14px; }
  .runs .c-time::after { content: ","; }
  .runs.no-key .c-time::after { content: none; }

  .keys tr { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name act" "last last" "spent spent"; }
  .keys .c-name { grid-area: name; font-weight: 500; }
  .keys .c-last { grid-area: last; margin-top: 6px; }
  .keys .c-spent { grid-area: spent; text-align: left; }
  .keys .c-act { grid-area: act; align-self: start; }
  .keys .c-last, .keys .c-spent { font-size: 14px; color: var(--ink-2); }


  .charges tr { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "step sum"; }
  .charges .c-step { grid-area: step; }
  .charges .c-sum { grid-area: sum; }
  .charges tfoot tr { padding-top: 8px; padding-bottom: 8px; background: var(--fill); border-bottom: 0; }

  .ends-t tr { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "when price" "how how"; }
  .ends-t .c-when { grid-area: when; font-weight: 500; }
  .ends-t .c-how { grid-area: how; color: var(--ink-2); font-size: 14px; }
  .ends-t .c-price { grid-area: price; }
}

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