/* PayLink — "Precision Terminal".
   A payment terminal drawn with Swiss typographic discipline.
   Signal colour: laterite orange, the red earth of Madagascar (the Red Island).
   One cultural mark: a woven lamba band on the printed counter card.
   Type: Archivo (variable width + weight) for words and instrument numerals,
   Martian Mono for engraved labels, ids and addresses. Both SIL OFL, self-hosted. */

@font-face { font-family: "Archivo"; src: url("fonts/archivo-var-latin.woff2") format("woff2"); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }
@font-face { font-family: "Martian Mono"; src: url("fonts/martian-mono-400-latin.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Martian Mono"; src: url("fonts/martian-mono-600-latin.woff2") format("woff2"); font-weight: 600; font-display: swap; }

/* ---------- Tokens: light = paper + graphite ---------- */
:root {
  color-scheme: light;
  --bg: #EEECE6;          /* paper */
  --panel: #FAF9F6;       /* device face */
  --sunk: #E5E2DA;        /* recessed tracks */
  --well: #F1EFE9;        /* input wells */
  --raise: #FFFFFF;       /* raised keys */
  --ink: #161615;         /* graphite */
  --ink-2: #3F3D39;
  --muted: #64615A;       /* 5.9:1 on panel, 5.3:1 in wells */
  --rule: #DAD6CD;        /* hairlines */
  --rule-2: #8F8A80;      /* field edges, 3.3:1 */
  --screen: #171716;      /* display windows stay dark in both themes */
  --screen-ink: #F2F0EA;
  --screen-dim: #9A968D;  /* 6.1:1 on the screen */
  --screen-rule: #2E2D2A;
  --bezel: #E6E3DB;       /* the frame a display window sits in */
  --bezel-edge: #D3CFC5;
  --lcd-ok: #5BE394;      /* green segments on the dark screen, 11:1 */
  --signal: #FF5A1F;      /* laterite */
  --signal-edge: #C2410C;
  --on-signal: #140803;   /* 6.3:1 on signal */
  --signal-ink: #AD3709;  /* signal as text on paper, 6:1 */
  --ok: #0F7A3E;          /* 5.3:1 on panel */
  --err: #BC2A1C;
  --led-ok: #22C866;
  --led-wait: #FFB000;
  --led-err: #FF3B2E;
  --focus: #AD3709;
  --slip: #FFFFFF;        /* printed paper: counter card and receipt */
  --slip-ink: #161615;
  --slip-muted: #5E5B55;
  --slip-rule: #B9B4AA;
  --shadow: 0 1px 0 rgba(22,22,21,.05), 0 30px 60px -36px rgba(40,30,20,.45);
  --glow: .55;
  --mono: "Martian Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --gutter: 16px;
}

/* ---------- Tokens: dark = graphite instrument ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0E0E0D; --panel: #181816; --sunk: #0C0C0B; --well: #10100F; --raise: #232321;
    --ink: #ECE9E2; --ink-2: #C9C5BC; --muted: #9A968D;
    --rule: #2A2926; --rule-2: #6F6B63;
    --screen: #080807; --screen-ink: #F2F0EA; --screen-dim: #9A968D; --screen-rule: #24231F;
    --bezel: #252421; --bezel-edge: #3A3934;
    --signal: #FF5A1F; --signal-edge: #A8360B; --on-signal: #140803; --signal-ink: #FF7A45;
    --ok: #4FD98A; --err: #FF6B5E; --focus: #FF7A45;
    --slip: #F3F1EA; --slip-ink: #161615; --slip-muted: #5E5B55; --slip-rule: #B3AEA3;
    --shadow: 0 0 0 1px rgba(0,0,0,.5), 0 40px 80px -40px rgba(0,0,0,.9);
    --glow: .9;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0E0E0D; --panel: #181816; --sunk: #0C0C0B; --well: #10100F; --raise: #232321;
  --ink: #ECE9E2; --ink-2: #C9C5BC; --muted: #9A968D;
  --rule: #2A2926; --rule-2: #6F6B63;
  --screen: #080807; --screen-ink: #F2F0EA; --screen-dim: #9A968D; --screen-rule: #24231F;
  --bezel: #252421; --bezel-edge: #3A3934;
  --signal: #FF5A1F; --signal-edge: #A8360B; --on-signal: #140803; --signal-ink: #FF7A45;
  --ok: #4FD98A; --err: #FF6B5E; --focus: #FF7A45;
  --slip: #F3F1EA; --slip-ink: #161615; --slip-muted: #5E5B55; --slip-rule: #B3AEA3;
  --shadow: 0 0 0 1px rgba(0,0,0,.5), 0 40px 80px -40px rgba(0,0,0,.9);
  --glow: .9;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  display: flex; flex-direction: column;
  font: 400 16px/1.5 var(--sans); font-stretch: 100%;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-kerning: normal; overflow-wrap: break-word; word-spacing: .08em;
}
button, input { word-spacing: inherit; }
::selection { background: var(--signal); color: var(--on-signal); }
a { color: var(--signal-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
code, .mono { font-family: var(--mono); font-size: .8em; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Running text: no one-word last lines */
.lede, .steps p, .note-list li, .legend dd, .proc-text, .field-hint, .assure, .readout-hint, .state-note, .scan-cap span, .foot-item { text-wrap: pretty; }

/* Engraved label: the house micro-type */
.label, .kicker, .view-meta, .readout-top, .field label, .lookup label, .facts dt, .specs dt, .screen-label,
.plate, .ticket-top, .receipt-top, .foot-label, .row-id, .tally-label, .step-n, .unit, .loading, .eyebrow,
.ledger-head, .footing-label {
  font-family: var(--mono); font-weight: 400; font-size: 10.5px; line-height: 1.4;
  letter-spacing: .09em; text-transform: uppercase; word-spacing: 0;
}
code, .addr, .status, .pill, .lamp, .share input, .coords, #connect.is-on, .tabs button::before { word-spacing: 0; }

/* External-link arrow (drawn, not a font glyph) */
.ext::after {
  content: ""; display: inline-block; width: .7em; height: .7em; margin-left: .3em; vertical-align: .05em;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 2h7v7M10 2 2 10' fill='none' stroke='%23000' stroke-width='1.6'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 2h7v7M10 2 2 10' fill='none' stroke='%23000' stroke-width='1.6'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------- Top bar ---------- */
.top { border-bottom: 1px solid var(--rule); }
.bar { max-width: 1240px; margin: 0 auto; padding: 0 var(--gutter); }
.top .bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; min-height: 44px; }
.mark { width: 30px; height: 30px; flex: none; display: block; }
.mark .tile { fill: var(--ink); }
.mark .arc { stroke: var(--bg); }
.mark .origin { fill: var(--ink); stroke: var(--bg); }
.mark .dot { fill: var(--signal); }
.word { font-weight: 720; font-stretch: 112%; font-size: 19px; letter-spacing: -.02em; line-height: 1; }
.on-arc { font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  border: 1px solid var(--rule-2); border-radius: 3px; padding: 3px 5px 2px; line-height: 1; white-space: nowrap; }

/* ---------- Keys (buttons) ---------- */
.key {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 44px; padding: 0 16px; border-radius: 8px;
  font: 600 15px/1 var(--sans); letter-spacing: -.005em; text-decoration: none; white-space: nowrap;
  color: var(--ink); background: transparent; border: 1px solid var(--rule-2);
  transition: transform .08s ease, box-shadow .08s ease, background-color .15s ease, border-color .15s ease, color .15s ease;
}
.key:hover { border-color: var(--ink); }
.key:active { transform: translateY(1px); }
.key:disabled { cursor: progress; opacity: .6; transform: none; }
.key-primary {
  width: 100%; min-height: 58px; padding: 0 20px; justify-content: space-between;
  font-size: 17px; font-weight: 640; letter-spacing: -.01em;
  background: var(--signal); color: var(--on-signal); border: 1px solid var(--signal-edge);
  box-shadow: 0 3px 0 0 var(--signal-edge), inset 0 1px 0 rgba(255,255,255,.35);
  margin-bottom: 3px;
}
.key-primary::after {
  content: ""; width: 20px; height: 20px; flex: none; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M2 10h15M11.5 4.5 17 10l-5.5 5.5' fill='none' stroke='%23000' stroke-width='1.9'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M2 10h15M11.5 4.5 17 10l-5.5 5.5' fill='none' stroke='%23000' stroke-width='1.9'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform .2s ease;
}
.key-primary:hover { border-color: var(--signal-edge); background-color: #FF6630; }
.key-primary:hover::after { transform: translateX(3px); }
.key-primary:active { transform: translateY(3px); box-shadow: 0 0 0 0 var(--signal-edge), inset 0 2px 6px rgba(0,0,0,.25); }
.key-primary:disabled {
  opacity: 1; transform: translateY(3px); box-shadow: 0 0 0 0 var(--signal-edge), inset 0 2px 6px rgba(0,0,0,.18);
  background-image: repeating-linear-gradient(-45deg, rgba(20,8,3,.12) 0 8px, transparent 8px 16px);
  background-size: 200% 100%; animation: feed 1.2s linear infinite;
}
.key-primary:disabled::after { opacity: .35; }
.key-line { background: var(--panel); }
.key-danger:hover { color: var(--err); border-color: var(--err); }
.key.is-done { border-color: var(--ok); color: var(--ok); }
/* Text keys: soft keys in a row, full 44px targets without boxes */
.key-text { border: 0; background: transparent; padding: 0 10px; font-size: 14.5px; font-weight: 600;
  text-decoration: underline; text-decoration-color: var(--rule-2); text-decoration-thickness: 1px; text-underline-offset: 5px; border-radius: 6px; }
.key-text:hover { background: var(--sunk); text-decoration-color: currentColor; }
.key-text.key-danger { color: var(--err); }
.key-text.is-done { color: var(--ok); text-decoration-color: currentColor; }
/* The pay key's label is one plain text node ("Pay 25.5 USDC"); a very long amount wraps instead of overflowing. */
.payform .key-primary { white-space: normal; text-align: left; line-height: 1.15; padding-top: 8px; padding-bottom: 8px; font-variant-numeric: tabular-nums; }

/* Header connect key: becomes an account readout with a green LED once connected */
/* Scoped to the header: the deploy page's #connect is a full primary key and keeps its 17px label. */
.top #connect { font-size: 14px; }
.top #connect.is-on { font-family: var(--mono); font-weight: 400; font-size: 12px; letter-spacing: .02em; gap: 8px; }
.top #connect.is-on::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--led-ok);
  box-shadow: 0 0 6px rgba(34,200,102,var(--glow)); }

/* ---------- Page frame ---------- */
.frame {
  flex: 1 0 auto; width: 100%; align-content: start;
  max-width: 1240px; margin: 0 auto; padding: 24px var(--gutter) 40px;
  display: grid; grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "intro" "device" "about";
}
.lead { display: contents; }
.intro { grid-area: intro; padding: 4px 0 28px; }
.device { grid-area: device; }
.about, .lead-aside { grid-area: about; }

/* The lead column speaks to whoever is at the terminal. */
.lead [data-for] { display: none; }
[data-view="create"] .lead [data-for="create"],
[data-view="pay"] .lead [data-for="pay"],
[data-view="mine"] .lead [data-for="mine"] { display: block; }
/* The payer's lead follows the terminal: a bill (default), a tip jar, a receipt, a settled link, an error. */
.voice[data-voice], :root[data-state] .voice:not([data-voice]) { display: none; }
:root[data-state="open-amount"] .voice[data-voice="open-amount"], :root[data-state="paid"] .voice[data-voice="paid"],
:root[data-state="settled"] .voice[data-voice="settled"], :root[data-state="error"] .voice[data-voice="error"],
:root[data-state="offline"] .voice[data-voice="offline"] { display: block; }
/* On a phone the pitch only greets the link creator; payers go straight to the bill. */
@media (max-width: 999px) {
  [data-view="pay"] .lead, [data-view="mine"] .lead { display: none; }
  [data-view="pay"] .frame, [data-view="mine"] .frame { padding-top: 16px; }
}

.kicker { color: var(--muted); display: flex; align-items: center; gap: 10px; margin: 0; }
.kicker::before { content: ""; width: 10px; height: 10px; background: var(--signal); flex: none; }
h1 {
  margin: 14px 0 16px; font-weight: 660; font-stretch: 96%;
  font-size: clamp(36px, 10.4vw, 46px); line-height: .98; letter-spacing: -.036em; word-spacing: .06em;
}
h1 .stop { color: var(--signal); }
.lede { font-size: 17px; line-height: 1.5; color: var(--ink-2); max-width: 46ch; }
.lede strong { color: var(--ink); font-weight: 620; }

/* Spec sheet: four facts on a ruled strip */
.specs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 24px 0 0; border-top: 1.5px solid var(--ink); border-bottom: 1px solid var(--rule); }
.specs > div { padding: 10px 8px 12px; border-left: 1px solid var(--rule); min-width: 0; }
.specs > div:first-child { border-left: 0; padding-left: 0; }
.specs dt { color: var(--muted); font-size: 9.5px; letter-spacing: .08em; }
.specs dd { margin: 6px 0 0; font-weight: 520; font-stretch: 80%; font-size: 24px; line-height: 1; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.specs dd small { font-size: .6em; font-weight: 500; margin-left: 1px; }

/* ---------- The device ---------- */
.device {
  background: var(--panel); border: 1px solid var(--rule); border-radius: 16px;
  box-shadow: var(--shadow); position: relative; min-width: 0;
}
.plate {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px 10px; color: var(--muted); border-bottom: 1px solid var(--rule);
}
.plate > span { display: inline-flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; }
.plate .led { width: 7px; height: 7px; border-radius: 50%; background: var(--led-ok); box-shadow: 0 0 6px rgba(34,200,102,var(--glow)); flex: none; }
[data-contract="off"] .plate .led { background: var(--led-wait); box-shadow: 0 0 6px rgba(255,176,0,var(--glow)); }

#banner:empty { display: none; }
.banner { display: flex; gap: 12px; align-items: flex-start; margin: 14px 14px 0; padding: 12px 14px;
  border: 1px solid var(--led-wait); border-left-width: 4px; border-radius: 8px; font-size: 14.5px; line-height: 1.45; background: var(--raise); }
.banner b { font-weight: 640; }
.banner code { font-size: .82em; }

/* Mode switch: three keys in a recessed track. The selected key is raised; no light on it,
   so lights only ever mean link states. */
.tabs {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px;
  margin: 12px 14px 0; padding: 4px; background: var(--sunk); border-radius: 11px; counter-reset: tab;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.08);
}
.tabs button {
  counter-increment: tab; position: relative; -webkit-appearance: none; appearance: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 6px;
  min-height: 52px; padding: 8px 10px 10px; border: 0; border-radius: 8px; background: transparent;
  color: var(--muted); font: 560 14px/1.15 var(--sans); letter-spacing: -.01em; text-align: left;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.tabs button::before { content: counter(tab, decimal-leading-zero); font: 400 9.5px/1 var(--mono); letter-spacing: .08em; }
.tabs button:hover { color: var(--ink); }
.tabs button.active { background: var(--raise); color: var(--ink); font-weight: 620; box-shadow: 0 1px 0 rgba(0,0,0,.06), 0 0 0 1px var(--rule), 0 2px 6px -2px rgba(0,0,0,.18); }
.tabs button.active::before { color: var(--signal-ink); }

/* ---------- Views ---------- */
#main > section { padding: 20px 18px 24px; }
.view-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1.5px solid var(--ink); }
h2 { margin: 0; font-size: 24px; line-height: 1.1; font-weight: 650; letter-spacing: -.025em; }
.view-meta { color: var(--muted); white-space: nowrap; text-transform: none; letter-spacing: .02em; font-size: 11px; }

/* Display window: where money lives. Dark glass, LCD dot texture, set in a bezel. */
.readout, .screen {
  background-color: var(--screen); color: var(--screen-ink); border-radius: 10px;
  background-image: radial-gradient(rgba(255,255,255,.05) .7px, transparent 1px); background-size: 3px 3px;
  box-shadow: inset 0 0 0 1px var(--screen-rule), inset 0 2px 10px rgba(0,0,0,.55), 0 0 0 4px var(--bezel), 0 0 0 5px var(--bezel-edge);
}
.readout { margin-top: 22px; padding: 12px 16px 12px; transition: box-shadow .15s ease; }
.readout:focus-within { box-shadow: inset 0 0 0 1px var(--screen-rule), inset 0 2px 10px rgba(0,0,0,.55), 0 0 0 4px var(--bezel), 0 0 0 6px var(--focus); }
.readout-top { display: flex; justify-content: space-between; gap: 12px; color: var(--screen-dim); }
.readout-top label { font: inherit; color: inherit; }
.readout-input {
  display: block; width: 100%; min-width: 0; margin: 4px 0 0; padding: 0; border: 0; background: transparent; outline: none;
  color: var(--screen-ink); caret-color: var(--signal);
  font: 480 58px/1.1 var(--sans); font-stretch: 78%; letter-spacing: -.01em; font-variant-numeric: tabular-nums;
  min-height: 68px;
}
.readout-input:focus-visible { outline: none; }
.readout-input::placeholder { color: #6E6A62; opacity: 1; }
/* Only an input window has an entry rule (and says "Enter" while empty): a display window never does. */
.readout-input { padding-bottom: 4px; border-bottom: 1.5px solid #4A4740; transition: border-color .15s ease; }
.readout:hover .readout-input { border-bottom-color: #6E6A62; }
.readout:focus-within .readout-input { border-bottom-color: var(--signal); }
.readout:has(.readout-input:placeholder-shown) .readout-top > span::before { content: "Enter "; }
/* Forced colours drop box-shadows: a transparent outline becomes the visible focus ring there. */
.readout:focus-within { outline: 2px solid transparent; outline-offset: 6px; }
.readout-hint { margin-top: 6px; font-size: 13px; line-height: 1.4; color: var(--screen-dim); }

/* Form fields: labelled wells, so an example never passes for a value */
.field { display: block; margin-top: 18px; min-width: 0; }
.field label { display: flex; align-items: baseline; gap: 8px; color: var(--muted); margin-bottom: 8px; }
.field label .opt { color: var(--muted); text-transform: none; letter-spacing: 0; font-family: var(--sans); font-size: 12.5px; }
.field > input, .well {
  display: block; width: 100%; min-width: 0; min-height: 50px; padding: 0 14px;
  border: 1px solid var(--rule-2); border-radius: 8px; background: var(--well);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.07);
  color: var(--ink); font: 450 17px/1.3 var(--sans); letter-spacing: -.005em;
  transition: border-color .15s ease;
}
.field > input:hover, .well:hover { border-color: var(--ink-2); }
.field > input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--focus); border-radius: 8px; }
.well:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
.field input::placeholder { color: var(--muted); opacity: 1; }
.with-unit { display: flex; align-items: center; gap: 8px; }
.with-unit input { flex: 1; min-width: 0; height: 48px; padding: 0; border: 0; background: transparent; outline: none; color: inherit; font: inherit; font-variant-numeric: tabular-nums; }
.with-unit input:focus-visible { outline: none; }
.with-unit span { font-family: var(--mono); font-size: 11.5px; color: var(--muted); letter-spacing: .04em; }
.field-hint { margin-top: 6px; font-size: 13px; color: var(--muted); }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 16px; }
.view-create .key-primary { margin-top: 26px; }
.payform .key-primary { margin-top: 20px; }
.payform .field { margin-top: 16px; }

/* Status line: a single LED and a mono message */
.status { position: relative; margin: 16px 0 0; padding-left: 20px; font: 400 12px/1.6 var(--mono); color: var(--ink-2); word-break: break-word; }
.status:empty { display: none; }
.status::before { content: ""; position: absolute; left: 2px; top: 5px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--led-wait); box-shadow: 0 0 8px rgba(255,176,0,var(--glow)); animation: blink 1s steps(2, jump-none) infinite; }
.status.ok { color: var(--ok); }
.status.ok::before { background: var(--led-ok); box-shadow: 0 0 8px rgba(34,200,102,var(--glow)); animation: none; }
.status.err { color: var(--err); }
.status.err::before { background: var(--led-err); box-shadow: 0 0 8px rgba(255,59,46,var(--glow)); animation: none; }
.status a { color: inherit; }
.status .code { display: block; color: var(--muted); font-size: 10.5px; letter-spacing: .04em; }
.loading { margin: 18px 0 0; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.loading::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--led-wait); animation: blink 1s steps(2, jump-none) infinite; }

/* ---------- Counter card: printed on paper in both themes ---------- */
.out:empty { display: none; }
.issued { margin-top: 18px; animation: rise .35s cubic-bezier(.2,.8,.2,1); }
.ticket {
  --ink: var(--slip-ink); --ink-2: #3F3D39; --muted: var(--slip-muted); --rule-2: var(--slip-rule);
  position: relative; overflow: hidden;
  padding: 0 18px 20px; border-radius: 4px; background: var(--slip); color: var(--slip-ink);
  box-shadow: 0 0 0 1px rgba(22,22,21,.10), 0 18px 30px -20px rgba(0,0,0,.5);
}
/* Lamba band: a woven Malagasy cloth stripe in laterite, ochre, indigo and graphite. The only cultural mark. */
.lamba {
  height: 14px; margin: 0 -18px 14px;
  background:
    repeating-linear-gradient(135deg, rgba(0,0,0,.18) 0 1px, transparent 1px 3px),
    linear-gradient(90deg,
      #E0531C 0 14px, #1E1C1A 14px 16px, #E3A32B 16px 20px, #F4ECDD 20px 22px, #26346B 22px 32px,
      #F4ECDD 32px 34px, #E3A32B 34px 38px, #1E1C1A 38px 40px, #A8360B 40px 52px, #1E1C1A 52px 54px,
      #F4ECDD 54px 55px, #E0531C 55px 59px, #F4ECDD 59px 60px, #1E1C1A 60px 62px, #A8360B 62px 74px,
      #1E1C1A 74px 76px, #E3A32B 76px 80px, #F4ECDD 80px 82px, #26346B 82px 92px, #F4ECDD 92px 94px,
      #E3A32B 94px 98px, #1E1C1A 98px 100px) 0 0 / 100px 100% repeat-x;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.18);
}
.ticket-top { display: flex; justify-content: space-between; align-items: center; color: var(--slip-muted); }
.ticket-brand { font: 720 14px/1 var(--sans); font-stretch: 112%; letter-spacing: -.01em; text-transform: none; color: var(--slip-ink); }
.ticket, .receipt { container-type: inline-size; }
.ticket-amt { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin-top: 16px; }
.ticket-amt .num { font-weight: 480; font-stretch: 78%; font-size: min(56px, calc(190cqw / var(--n, 6))); line-height: .95; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.ticket-amt .num.any { font-size: 40px; font-stretch: 85%; }
.ticket-amt .unit { color: var(--slip-muted); }
.ticket-memo { margin-top: 8px; font-size: 16px; color: var(--ink-2); }
.perf { position: relative; margin: 18px -18px; border-top: 1.5px dashed var(--slip-rule); }
/* Notches are holes: they show the device face the ticket lies on, edged like the ticket itself. */
.perf::before, .perf::after { content: ""; position: absolute; top: -11px; width: 20px; height: 20px; border-radius: 50%; background: var(--panel); box-shadow: inset 0 0 0 1px rgba(22,22,21,.10); }
.perf::before { left: -11px; } .perf::after { right: -11px; }
.ticket-scan { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.scan-cap { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.scan-cap b { display: block; font-weight: 680; font-size: 17px; letter-spacing: -.01em; }
.scan-cap span { display: block; font-size: 14px; color: var(--slip-muted); max-width: 28ch; }
.printed-url { margin-top: 8px; font-size: 11px; color: var(--slip-ink); word-break: break-all; letter-spacing: 0; }
/* QR: always black on white, framed by crop marks so it reads as "scan here" */
.qr-frame {
  --c: var(--slip-ink); --l: 16px; --w: 2px; padding: 9px; flex: none; max-width: 100%;
  background:
    linear-gradient(var(--c), var(--c)) 0 0 / var(--l) var(--w), linear-gradient(var(--c), var(--c)) 0 0 / var(--w) var(--l),
    linear-gradient(var(--c), var(--c)) 100% 0 / var(--l) var(--w), linear-gradient(var(--c), var(--c)) 100% 0 / var(--w) var(--l),
    linear-gradient(var(--c), var(--c)) 0 100% / var(--l) var(--w), linear-gradient(var(--c), var(--c)) 0 100% / var(--w) var(--l),
    linear-gradient(var(--c), var(--c)) 100% 100% / var(--l) var(--w), linear-gradient(var(--c), var(--c)) 100% 100% / var(--w) var(--l);
  background-repeat: no-repeat;
}
.qr { width: 232px; max-width: 100%; background: #fff; padding: 8px; border-radius: 2px; }
.qr svg { display: block; width: 100%; height: auto; }
/* The copyable link stays on the terminal, under the card */
.share { position: relative; display: flex; gap: 8px; margin-top: 18px; }
.share input {
  flex: 1; min-width: 0; min-height: 46px; padding: 0 12px; border: 1px solid var(--rule-2); border-radius: 8px;
  background: var(--well); color: var(--ink); font: 400 12px/1 var(--mono); letter-spacing: 0;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.07);
}
.share input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.share .key { min-height: 46px; }
.ticket-links { display: flex; flex-wrap: wrap; gap: 0 20px; margin-top: 6px; font-size: 14.5px; }
.ticket-links a { display: inline-flex; align-items: center; min-height: 44px; }

/* ---------- Pay view ---------- */
.lookup {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0 10px;
  margin-top: 14px; padding: 0 0 0 12px; border: 1px solid var(--rule-2); border-radius: 9px; background: var(--well);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.07);
}
.lookup label { color: var(--muted); white-space: nowrap; }
.lookup input { min-width: 0; min-height: 44px; border: 0; background: transparent; outline: none; color: var(--ink);
  font: 500 18px/1 var(--sans); font-variant-numeric: tabular-nums; padding: 0; }
.lookup input:focus-visible { outline: none; }
.lookup input::placeholder { color: var(--muted); opacity: 1; }
.lookup:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.lookup .key { border: 0; border-left: 1px solid var(--rule-2); border-radius: 0 8px 8px 0; min-height: 46px; background: var(--panel); }
.lookup .key:hover { background: var(--sunk); }

.bill { margin-top: 18px; }
.screen { position: relative; container-type: inline-size; padding: 14px 16px 16px; overflow: hidden; }
.screen-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--screen-dim); font-family: var(--mono); font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; }
.screen-label { margin-top: 12px; color: var(--screen-dim); }
.amount { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; }
.amount .num {
  font-weight: 470; font-stretch: 76%; letter-spacing: -.015em; line-height: .9; font-variant-numeric: tabular-nums;
  font-size: min(88px, calc(172cqw / var(--n, 6)));
}
.amount .num.any { font-size: min(58px, 16cqw); font-stretch: 82%; letter-spacing: -.02em; }
.amount .unit { color: var(--screen-dim); font-size: 12px; }
.screen-memo { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--screen-rule); font-size: 17px; line-height: 1.4; color: var(--screen-ink); }

/* The verdict: the display flips to APPROVED the way a card terminal does */
.verdict {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 14px;
  margin: 14px -16px -16px; padding: 14px 16px 15px;
  border-top: 1px solid rgba(34,200,102,.32);
  background: linear-gradient(rgba(34,200,102,.15), rgba(34,200,102,.07));
  color: var(--lcd-ok); font-family: var(--mono); text-transform: uppercase; word-spacing: 0;
  animation: lcd .28s steps(7, end) 1 both;
}
.verdict b { display: inline-flex; align-items: center; gap: 12px; font-weight: 600; font-size: 16px; letter-spacing: .18em; line-height: 1; }
.verdict b::before {
  content: ""; width: 22px; height: 22px; flex: none; border-radius: 50%;
  background: var(--led-ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Cpath d='M6.5 11.5l3 3 6-7' fill='none' stroke='%23071A0E' stroke-width='2.4' stroke-linecap='square'/%3E%3C/svg%3E") center / 22px no-repeat;
  box-shadow: 0 0 12px rgba(34,200,102,.55);
}
.verdict span { font-size: 10.5px; letter-spacing: .1em; color: #9FE8BC; }
.bill.is-done .screen { animation: approve .9s ease-out 1;
  box-shadow: inset 0 0 0 1px var(--screen-rule), inset 0 2px 10px rgba(0,0,0,.55), 0 0 0 4px var(--bezel), 0 0 0 5px rgba(34,200,102,.55); }

.facts { margin: 6px 0 0; }
.facts > div { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; padding: 11px 0 10px; border-bottom: 1px solid var(--rule); align-items: baseline; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-size: 15px; min-width: 0; }
.addr { font-family: var(--mono); font-size: 12px; line-height: 1.7; letter-spacing: -.01em; display: grid; grid-template-columns: repeat(5, max-content); justify-content: start; column-gap: .55em; color: var(--ink-2); }
.addr .end { color: var(--ink); font-weight: 600; }
/* Two rows of five, with the hex columns lined up: the second row sits under 90F8, not under 0x. */
.addr > span:nth-child(5n+1) { justify-self: end; }
.state-note { margin-top: 16px; font-size: 15px; color: var(--ink-2); }
/* The next step under a load error, aligned with the error's text (past its LED). */
.load-note { margin-top: 8px; padding-left: 20px; font-size: 14px; line-height: 1.5; }
.payform .readout { margin-top: 22px; }
.assure { margin-top: 14px; font-size: 13px; line-height: 1.5; color: var(--muted); display: flex; gap: 10px; }
.assure::before { content: ""; flex: none; width: 14px; height: 14px; margin-top: 2px; background: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Crect x='2' y='6' width='10' height='7' rx='1' fill='%23000'/%3E%3Cpath d='M4.5 6V4.5a2.5 2.5 0 0 1 5 0V6' fill='none' stroke='%23000' stroke-width='1.5'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Crect x='2' y='6' width='10' height='7' rx='1' fill='%23000'/%3E%3Cpath d='M4.5 6V4.5a2.5 2.5 0 0 1 5 0V6' fill='none' stroke='%23000' stroke-width='1.5'/%3E%3C/svg%3E") center / contain no-repeat; }
.bill.is-done .payform { display: none; }
.bill .status.ok { font-size: 12px; }

/* State lights (the ledger, the bill and the legend share them) */
.pill, .lamp { display: inline-flex; align-items: center; gap: 8px; color: inherit; font: 600 10.5px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
.pill::before, .lamp::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.pill.open::before, .lamp.open::before { background: var(--signal); box-shadow: 0 0 8px rgba(255,90,31,var(--glow)); }
.pill.open::before { animation: breathe 2.4s ease-in-out 2; }
.pill.paid::before, .lamp.paid::before { background: var(--led-ok); box-shadow: 0 0 8px rgba(34,200,102,var(--glow)); }
.pill.closed::before, .lamp.closed::before { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; opacity: .7; }

/* ---------- Receipt: prints out of the terminal ---------- */
.receipt {
  --z: 7px; padding: 18px 18px calc(18px + var(--z)); background: var(--slip); color: var(--slip-ink);
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / calc(2 * var(--z)) 100%;
          mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / calc(2 * var(--z)) 100%;
  animation: print .32s steps(8, end) 1 both;
  margin: -4px 12px 0; position: relative;
}
.receipt-wrap { margin-top: 20px; filter: drop-shadow(0 12px 16px rgba(0,0,0,.16)); }
/* the printer slot the slip comes out of */
.receipt-wrap::before { content: ""; display: block; height: 8px; border-radius: 4px; position: relative; z-index: 1;
  background: var(--screen); box-shadow: inset 0 0 0 1px var(--screen-rule), inset 0 2px 3px rgba(0,0,0,.7); }
.receipt-top { display: flex; justify-content: space-between; gap: 12px; color: var(--slip-muted); padding-bottom: 12px; border-bottom: 1.5px dashed var(--slip-rule); }
.receipt-top b { color: #0F7A3E; font-weight: 600; }
.receipt-amt { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; padding: 16px 0 6px; }
.receipt-amt .num { font-weight: 480; font-stretch: 78%; font-size: min(48px, calc(170cqw / var(--n, 6))); line-height: .95; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.receipt-amt .unit { color: var(--slip-muted); }
.receipt dl { margin: 6px 0 0; font-family: var(--mono); font-size: 11.5px; line-height: 1.5; word-spacing: 0; }
.receipt dl > div { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 10px; padding: 5px 0; }
.receipt dt { color: var(--slip-muted); text-transform: uppercase; letter-spacing: .08em; font-size: 10px; padding-top: 1px; }
.receipt dd { margin: 0; min-width: 0; word-break: break-word; }
.receipt a { color: var(--slip-ink); }
.receipt dd a { position: relative; }
.receipt dd a::before { content: ""; position: absolute; inset: -14px -6px; }
.receipt-foot { margin-top: 12px; padding-top: 12px; border-top: 1.5px dashed var(--slip-rule); font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--slip-muted); text-align: center; }
.thanks { margin: 22px 0 2px; text-align: center; font-size: 15px; line-height: 1.45; color: var(--ink-2); text-wrap: balance; }
.thanks .gloss { display: block; margin-bottom: 8px; font: 400 10.5px/1.4 var(--mono); letter-spacing: .09em; text-transform: uppercase; word-spacing: 0; color: var(--muted); }
.thanks b { display: block; margin-bottom: 6px; font-weight: 600; font-stretch: 80%; font-size: 30px; line-height: 1; letter-spacing: -.01em; color: var(--ink); }

/* ---------- My links: a ledger ---------- */
.tally { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 4px 16px; margin-top: 22px; padding: 14px 16px 16px; }
.tally-label { color: var(--screen-dim); grid-column: 1 / -1; }
.tally-sum { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; min-width: 0; }
.tally-sum .num { font-weight: 470; font-stretch: 76%; font-size: min(52px, calc(150cqw / var(--n, 6))); line-height: .95; letter-spacing: -.015em; font-variant-numeric: tabular-nums; }
.tally-sum .unit { color: var(--screen-dim); }
.tally-sub { justify-self: end; font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--screen-dim); text-align: left; line-height: 1.7; white-space: nowrap; }
.tally-sub > span { display: block; }
.tally-sub b { color: var(--screen-ink); font-weight: 600; }

.ledger-head { display: grid; grid-template-columns: var(--idw) minmax(96px, 1fr) auto; gap: 12px; margin-top: 22px; padding-bottom: 7px; border-bottom: 1.5px solid var(--ink); color: var(--muted); }
.ledger-head span:last-child { text-align: right; }
ul.links { list-style: none; margin: 0; padding: 0; container-type: inline-size; }
ul.links li {
  display: grid; grid-template-columns: var(--idw) minmax(96px, 1fr) auto; grid-template-areas: "id main amt" "id foot foot";
  gap: 0 12px; padding: 14px 0 2px; border-bottom: 1px solid var(--rule);
}
ul.links li.loading, ul.links li.empty, ul.links li.load-error { display: flex; border: 0; }
ul.links li.empty { display: block; padding: 18px 0; color: var(--muted); }
/* A load error drops the row grid and its 14px top padding, so the LED sits on the message's first line. */
ul.links li.load-error { display: block; padding: 0; }
.row-id { grid-area: id; color: var(--muted); padding-top: 4.8px; font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-main { grid-area: main; min-width: 0; }
.row-memo { margin-top: 7px; font-size: 16px; line-height: 1.35; font-weight: 520; letter-spacing: -.01em; color: var(--ink); }
.row-amt { grid-area: amt; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; white-space: nowrap; }
.row-amt .price { display: block; font-weight: 500; font-stretch: 78%; font-size: min(28px, calc(92cqw / var(--n, 6))); line-height: .9; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.row-amt .price.any { font-size: 15px; font-stretch: 85%; line-height: 1.2; padding-top: 4px; color: var(--ink-2); }
.credit { font-weight: 560; font-stretch: 80%; font-size: min(16px, calc(92cqw / var(--n, 8))); line-height: 1; color: var(--ok); font-variant-numeric: tabular-nums; }
.row-foot { grid-area: foot; display: flex; align-items: center; justify-content: flex-end; min-width: 0; margin-top: 2px; }
.row-meta { margin-top: 3px; font-size: 13px; line-height: 1.4; color: var(--muted); font-variant-numeric: tabular-nums; text-wrap: pretty; }
/* The expiry is the activity line's second line on every row that has one, at every width. */
.row-meta .when { display: block; }
.row-actions { display: flex; margin-right: -10px; margin-left: auto; }
.row-actions .key { min-height: 44px; }
/* Copy and View hold the right edge on every row; Close, when there is one, sits to their left. */
.row-actions .key-danger { order: -1; margin-right: 6px; }
li.is-closed .row-memo, li.is-closed .row-amt .price { color: var(--muted); }
li.is-closed .row-amt .price { text-decoration: line-through; text-decoration-thickness: 1.5px; }
ul.links li:last-child { border-bottom: 0; }
/* Number column sized from the longest "#id" (--idc, set by renderMine): Martian Mono 11px + .09em tracking advances 9px a character. */
.view-mine { container-type: inline-size; --idw: max(34px, calc(var(--idc, 3) * 9px + 3px)); }
.footing { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; padding-top: 12px; border-top: 4px double var(--ink); }
.footing-label { color: var(--ink); }
.footing-sum { display: inline-flex; align-items: baseline; gap: 8px; margin-left: auto; }
.footing-sum .num { font-weight: 560; font-stretch: 78%; font-size: min(30px, calc(170cqw / var(--n, 6))); line-height: 1; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.footing-sum .unit { color: var(--muted); }
.empty-state { margin-top: 18px; }
.empty-state p { color: var(--ink-2); margin-bottom: 4px; text-wrap: pretty; }
.empty-state .key-primary { margin-top: 16px; }

/* ---------- Lead-column notes, legend & footer ---------- */
.about { padding: 40px 0 8px; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-weight: 400; }
.steps { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--ink); }
.steps li { display: grid; align-content: start; grid-template-columns: 40px minmax(0, 1fr); gap: 2px 8px; padding: 14px 0 16px; border-bottom: 1px solid var(--rule); }
.step-n { color: var(--signal-ink); }
/* The index numeral sits on the baseline of the word it numbers. */
.steps .step-n, .steps b { align-self: baseline; }
.steps b { font-weight: 640; font-size: 18px; letter-spacing: -.015em; }
.steps p { grid-column: 2; font-size: 15px; color: var(--ink-2); line-height: 1.5; }
.legend { margin: 0; border-top: 1.5px solid var(--ink); }
.legend > div { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 12px; padding: 15px 0 16px; border-bottom: 1px solid var(--rule); align-items: baseline; }
.legend dt { color: var(--ink); }
.legend dd { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.about.notes { padding-top: 40px; }
.note-list { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--ink); }
.note-list li { padding: 14px 0 15px; border-bottom: 1px solid var(--rule); font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.note-list b { color: var(--ink); font-weight: 640; }

.foot { border-top: 1px solid var(--rule); margin-top: 8px; }
.foot .bar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding-top: 22px; padding-bottom: 32px; font-size: 13px; color: var(--ink-2); }
.foot-item { min-width: 0; }
.foot-item a { display: inline-flex; align-items: center; min-height: 44px; margin: -12px 0; }
.foot-label { display: block; color: var(--muted); margin-bottom: 4px; }
#contract a, #contract code { font-family: var(--mono); font-size: 11.5px; word-break: break-all; }
#contract a { color: var(--ink-2); text-decoration-color: var(--rule-2); }
/* Inline, so the arrow always follows the last character; the vertical padding keeps a 44px tap height without
   pushing the labels around it. Where the full address would wrap (phones, the tablet footer) its middle folds away:
   0xe78A…a8Ab, with the full address in the title, the href and the text. */
#contract a { display: inline; margin: 0; padding: 16px 0; }
#contract .addr-tail { white-space: nowrap; }
.foot-item:has(> #contract) { container-type: inline-size; }
@container (max-width: 359px) {
  #contract .addr-mid { display: none; }
  #contract .addr-tail::before { content: "\2026"; }
}
#contract a:hover { color: var(--signal-ink); text-decoration-color: currentColor; }
.coords { font-family: var(--mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* ---------- Motion ---------- */
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes blink { 0% { opacity: 1; } 100% { opacity: .2; } }
@keyframes feed { from { background-position: 0 0; } to { background-position: -45.25px 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes print { from { clip-path: inset(0 0 100% 0); transform: translateY(-14px); } to { clip-path: inset(0 0 0 0); transform: none; } }
@keyframes lcd { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes approve { 0% { box-shadow: inset 0 0 0 1px var(--screen-rule), inset 0 2px 10px rgba(0,0,0,.55), 0 0 0 4px var(--bezel), 0 0 0 5px var(--bezel-edge); }
  25% { box-shadow: inset 0 0 0 2px var(--led-ok), inset 0 2px 10px rgba(0,0,0,.55), 0 0 0 4px var(--bezel), 0 0 0 7px rgba(34,200,102,.45); }
  100% { box-shadow: inset 0 0 0 1px var(--screen-rule), inset 0 2px 10px rgba(0,0,0,.55), 0 0 0 4px var(--bezel), 0 0 0 5px rgba(34,200,102,.55); } }
@media (forced-colors: active) {
  .tabs button.active { outline: 2px solid CanvasText; outline-offset: -2px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Small phones: the brand drops its "on Arc" tag before the connect key would push off the edge
   (the plate under it still names the network) ---------- */
@media (max-width: 379px) {
  .on-arc { display: none; }
}

/* ---------- Phones: the tally's counter goes under the figure ---------- */
@media (max-width: 419px) {
  .tally { grid-template-columns: minmax(0, 1fr); }
  .tally-sub { justify-self: start; display: flex; gap: 18px; }
}

/* ---------- Narrow phones ---------- */
@media (max-width: 359px) {
  :root { --gutter: 12px; }
  #main > section { padding: 20px 14px; }
  .tabs { margin: 10px 10px 0; }
  .tabs button { font-size: 13px; padding: 8px 8px 10px; }
  .plate { padding: 11px 14px 9px; gap: 8px; font-size: 9.5px; letter-spacing: .05em; }
  .specs dd { font-size: 20px; }
  .word { font-size: 17px; }
  .facts > div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .ticket { padding: 0 14px 16px; }
  .lamba { margin: 0 -14px 12px; }
  .perf { margin: 16px -14px; }
  .receipt { padding: 16px 14px calc(16px + var(--z)); margin: -4px 8px 0; }
  .receipt dl > div { grid-template-columns: 44px minmax(0, 1fr); gap: 8px; }
  .bill .status.ok { font-size: 11.5px; }
  .verdict b { font-size: 14px; letter-spacing: .14em; }
  #contract a, #contract code { font-size: 11px; }
}

/* ---------- Tablet ---------- */
@media (min-width: 600px) {
  :root { --gutter: 32px; }
  .frame { max-width: 640px; padding-top: 40px; }
  .specs dt { font-size: 10.5px; }
  .specs dd { font-size: 30px; }
  .form-grid { grid-template-columns: minmax(0, 1fr) 140px; }
  #main > section { padding: 24px 24px 28px; }
  .steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--rule); }
  .steps li { grid-template-columns: minmax(0, 1fr); border-bottom: 0; padding: 14px 18px 18px 0; }
  .steps li + li { border-left: 1px solid var(--rule); padding-left: 16px; }
  .steps p { grid-column: 1; }
  .foot .bar { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; align-items: start; }
}

/* ---------- Desktop: the lead column on the left, the terminal on the right ---------- */
@media (min-width: 1000px) {
  :root { --gutter: 40px; --device-w: 468px; --col-gap: clamp(56px, 7vw, 112px); }
  .top .bar { min-height: 72px; }
  .frame {
    max-width: 1240px; padding: 48px var(--gutter) 72px;
    grid-template-columns: minmax(0, 1fr) var(--device-w); column-gap: var(--col-gap);
    grid-template-areas: "lead device"; grid-template-rows: auto;
  }
  /* The lead runs the full height of the terminal; its notes travel down beside a long ledger, card or receipt. */
  .lead { display: block; grid-area: lead; align-self: stretch; }
  .lead-aside { position: sticky; top: 32px; }
  /* The payer's terminal: the tab already says "Pay a link", and the Pay key must sit above a laptop's fold. */
  [data-view="pay"] .frame { padding-top: 32px; }
  .view-pay > .view-head { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; padding: 0; border: 0; }
  .view-pay .lookup { margin-top: 0; }
  .amount .num { font-size: min(72px, calc(172cqw / var(--n, 6))); }
  .amount .num.any { font-size: min(46px, 16cqw); }
  /* The footer keeps the page's two columns: Contract under the lead, the rest under the terminal. */
  .foot .bar {
    grid-template-columns: minmax(0, 1fr) var(--col-gap) calc((var(--device-w) - 24px) / 2) 24px calc((var(--device-w) - 24px) / 2);
    column-gap: 0;
  }
  .foot-item:nth-child(1) { grid-column: 1; }
  .foot-item:nth-child(2) { grid-column: 3; }
  .foot-item:nth-child(3) { grid-column: 5; }
  .intro { padding: 0; }
  .device { align-self: start; }
  h1 { font-size: clamp(56px, 5.3vw, 76px); margin: 22px 0 22px; }
  .lede { font-size: 19px; }
  .specs { margin-top: 36px; }
  .specs dd { font-size: 34px; }
  .about { padding: 64px 0 0; }
  .steps li { padding-right: 20px; }
  /* The rules run to the column edge on every tab; only the prose line is held to a readable measure. */
  .note-list li { padding-right: max(0px, 100% - 64ch); }
}
