/* The JAQC look. Ink on receipt paper, one sans for words, one mono for every number. State is said in words and
   weight, never hue; the one colour is red, for real failures. */

:root {
  --paper: oklch(1 0 0);
  --slip: oklch(1 0 0);
  --paper-2: oklch(0.955 0.004 85);
  --ink: oklch(0.22 0.01 75);
  --ink-2: oklch(0.45 0.01 75);
  --rule: oklch(0.83 0.008 80);
  --danger: oklch(0.50 0.17 25);
  --danger-soft: oklch(0.94 0.03 25);
  --veil: oklch(0.22 0.01 75 / 0.5);

  /* names app.js writes into inline custom properties (money key swatches) */
  --accent: var(--ink);
  --waiting-mark: var(--ink-2);
  --line: var(--rule);
  --bg: var(--paper);

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --gutter: 16px;
  --r: 2px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: oklch(0.19 0.006 75);
  --slip: oklch(0.225 0.006 75);
  --paper-2: oklch(0.27 0.007 75);
  --ink: oklch(0.93 0.006 85);
  --ink-2: oklch(0.72 0.008 80);
  --rule: oklch(0.38 0.008 75);
  --danger: oklch(0.72 0.15 25);
  --danger-soft: oklch(0.29 0.05 25);
  --veil: oklch(0.1 0.006 75 / 0.65);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::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 1rem/1.5 var(--sans); -webkit-font-smoothing: antialiased; accent-color: var(--ink); }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1, h2, h3 { text-wrap: balance; font-weight: 600; }
p { text-wrap: pretty; }
a { color: var(--ink); text-underline-offset: 0.22em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
::selection { background: var(--ink); color: var(--paper); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sr-only:focus { position: fixed; left: 8px; top: 8px; z-index: 50; width: auto; height: auto; clip-path: none; padding: 8px 16px; background: var(--slip); border: 1px solid var(--ink); }

/* the wordmark is the logo file's own paths, drawn in currentColor */
.mark { height: 20px; width: auto; color: var(--ink); }
.wordmark { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); text-decoration: none; }

/* ---------- type ---------- */
.t-total { font-family: var(--mono); font-size: 1.75rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.t-h1 { font-size: 1.75rem; line-height: 1.2; letter-spacing: -0.015em; }
.t-h2 { font-size: 1.375rem; line-height: 1.25; }
.t-h3 { font-size: 1.125rem; line-height: 1.3; }
.t-data, .money, time, .num, .amt, .qty, .total, .digits { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.kv dd { font-variant-numeric: tabular-nums; }
.money, .t-data { font-weight: 500; }
.t-small { font-size: 0.8125rem; line-height: 1.45; }
.muted { color: var(--ink-2); }
.prose { max-width: 66ch; }
.prose p + p { margin-top: 0.75em; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 20px;
  border: 1px solid transparent; border-radius: var(--r); background: none; cursor: pointer;
  font-weight: 600; font-size: 1rem; line-height: 1.2; text-decoration: none; white-space: nowrap;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
/* white is the primary: a paper button with a heavy ink edge; quiet buttons get a hairline */
.btn-primary, .btn-wa { background: var(--slip); color: var(--ink); border: 2px solid var(--ink); font-weight: 700; }
.btn-primary:hover:not(:disabled), .btn-wa:hover { background: var(--paper-2); }
.btn-quiet { border-color: var(--rule); color: var(--ink); }
.btn-quiet:hover:not(:disabled) { background: var(--paper-2); }
.btn-danger { background: var(--danger); color: var(--slip); }
.btn-danger:hover:not(:disabled) { background: color-mix(in oklch, var(--danger), var(--ink) 18%); }
.btn-text { padding: 10px 4px; color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
.btn-text:hover { text-decoration-thickness: 2px; }
.btn-text.danger { color: var(--ink); }
.btn-sm { padding: 8px 14px; font-size: 0.9375rem; }
.btn .icon { width: 18px; height: 18px; flex: none; }
.btn[aria-busy="true"] { position: relative; color: transparent; }
.btn[aria-busy="true"]::after { content: "…"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink); font-family: var(--mono); }
@media (max-width: 719px) { .form .btn-primary, .form .btn-wa { width: 100%; } }

/* ---------- forms ---------- */
.field { display: grid; gap: 8px; }
.field + .field { margin-top: 24px; }
.label { font-weight: 600; font-size: 0.9375rem; }
.hint { font-size: 0.8125rem; color: var(--ink-2); }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 12px 14px; border: 1px solid var(--ink-2); border-radius: var(--r);
  background: var(--slip); color: var(--ink);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-2); opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: 2px solid var(--ink); outline-offset: 0; border-color: var(--ink); }
.input[aria-invalid="true"] { border-color: var(--danger); outline-color: var(--danger); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 40px; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(-45deg, transparent 50%, var(--ink) 50%); background-position: right 20px center, right 15px center; background-size: 5px 5px; background-repeat: no-repeat; }
.prefix { display: flex; align-items: stretch; }
.prefix > span { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--ink-2); border-right: 0; border-radius: var(--r) 0 0 var(--r); background: var(--paper-2); font-family: var(--mono); }
.prefix > .input { border-radius: 0 var(--r) var(--r) 0; font-family: var(--mono); }
input[type="number"], input[type="tel"] { font-family: var(--mono); }
.check { display: flex; gap: 12px; align-items: flex-start; min-height: 44px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; margin: 0; }
.chips legend { padding: 0; margin-bottom: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span { display: inline-flex; align-items: center; min-height: 44px; padding: 10px 16px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--slip); font-size: 0.9375rem; }
.chip input:hover + span { border-color: var(--ink); }
.chip input:checked + span { border: 2px solid var(--ink); padding: 9px 15px; font-weight: 700; }
.chip input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 3px; }

.otp { display: grid; grid-template-columns: repeat(6, minmax(0, 52px)); gap: 8px; }
.otp input { width: 100%; aspect-ratio: 5 / 6; min-height: 52px; text-align: center; font: 600 1.375rem var(--mono); border: 1px solid var(--ink-2); border-radius: var(--r); background: var(--slip); }
.otp input:focus-visible { outline: 2px solid var(--ink); outline-offset: 0; }
.otp[aria-invalid="true"] input { border-color: var(--danger); }
.range { width: 100%; height: 44px; accent-color: var(--ink); }

.status { min-height: 1.5em; font-size: 0.9375rem; color: var(--ink-2); }
.status[data-tone="error"] { color: var(--danger); }
.status[data-tone="ok"] { color: var(--ink); font-weight: 600; }

/* ---------- state: a lowercase word, the way a bill prints it ---------- */
.state { font: 500 0.8125rem/1.3 var(--mono); text-transform: lowercase; white-space: nowrap; color: var(--ink-2); }
.state[data-tone="active"], .state[data-tone="good"] { color: var(--ink); font-weight: 700; }
.state[data-tone="wait"] { color: var(--ink); }
.state[data-tone="bad"] { color: var(--danger); font-weight: 700; }

/* ---------- flow pages ---------- */
.flow { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; }
.flow-top .theme-toggle { margin-left: auto; }
.flow-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; max-width: 1120px; margin: 0 auto; padding: 8px var(--gutter); border-bottom: 1px solid var(--rule); }
.flow-main { width: 100%; max-width: 480px; margin: 0 auto; padding: 32px var(--gutter) 48px; }
.flow-main.wide { max-width: 640px; }
.flow-foot { padding: 24px var(--gutter) 32px; text-align: center; font-size: 0.8125rem; color: var(--ink-2); }
.flow-foot a { color: var(--ink-2); display: inline-block; padding: 12px 0; }
.steps { display: flex; gap: 4px; margin-bottom: 32px; font: 500 0.8125rem var(--mono); color: var(--ink-2); }
.steps span { height: 2px; flex: 1; background: var(--rule); }
.steps span[data-done] { background: var(--ink); }
.flow h1 { margin-bottom: 8px; }
.flow .lede { color: var(--ink-2); margin-bottom: 32px; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 32px; }
.assure { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border: 1px dashed var(--ink-2); font-size: 0.9375rem; }
.assure svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.list-plain { border-top: 1px dashed var(--rule); }
.list-plain > li { position: relative; padding: 12px 0 12px 28px; border-bottom: 1px dashed var(--rule); }
.list-plain > li::before { content: "—"; position: absolute; left: 0; top: 12px; font-family: var(--mono); color: var(--ink-2); }

/* ---------- app shell ---------- */
.app { min-height: 100dvh; }
.rail { display: none; }
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--paper); border-top: 1px solid var(--ink);
  padding: 0 max(8px, env(safe-area-inset-left)) env(safe-area-inset-bottom);
}
.tab { display: grid; place-items: center; min-height: 56px; color: var(--ink-2); text-decoration: none; font-size: 0.9375rem; }
.tab[aria-current="page"] { color: var(--ink); font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.4em; }
.main { padding: 0 var(--gutter) calc(96px + env(safe-area-inset-bottom)); }
.page { max-width: 720px; margin: 0 auto; padding-top: 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 8px 0 24px; }
.page-head p { color: var(--ink-2); margin-top: 4px; }
.back { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--ink-2); text-decoration: none; font-size: 0.9375rem; }
.back svg { width: 18px; height: 18px; }
.back:hover { color: var(--ink); }
.section { margin-top: 32px; }
.page > .notice { margin-bottom: 16px; }
.money.muted, .total.muted { color: var(--ink-2); font-weight: 400; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.section-head p { color: var(--ink-2); font-size: 0.9375rem; margin-top: 4px; }

@media (min-width: 720px) {
  .tabbar { display: none; }
  .rail { position: fixed; inset: 0 auto 0 0; width: 208px; z-index: 20; display: flex; flex-direction: column; gap: 0; padding: 16px; border-right: 1px solid var(--rule); background: var(--paper); }
  .rail .wordmark { margin-bottom: 24px; }
  .rail-link { display: flex; align-items: center; min-height: 44px; padding: 8px 12px; color: var(--ink-2); text-decoration: none; border-radius: var(--r); }
  .rail-link:hover { color: var(--ink); background: var(--paper-2); }
  .rail-link[aria-current="page"] { color: var(--ink); font-weight: 700; background: var(--paper-2); }
  .rail-foot { margin-top: auto; font-size: 0.875rem; }
  .main { margin-left: 208px; padding: 0 32px 64px; }
  .page { padding-top: 40px; }
}

/* ---------- rows and panels ---------- */
.panel { background: var(--slip); border: 1px solid var(--rule); border-radius: var(--r); }
.panel-pad { padding: 24px; }
.rows > * { border-bottom: 1px solid var(--rule); }
.rows > *:last-child { border-bottom: 0; }
.row { display: flex; align-items: center; gap: 16px; padding: 16px 20px; min-height: 64px; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; }
.row-sub { font-size: 0.8125rem; color: var(--ink-2); margin-top: 2px; }
.row-end { flex: none; display: flex; align-items: center; gap: 16px; text-align: right; }
a.row { color: inherit; text-decoration: none; }
a.row:hover { background: var(--paper-2); }
a.row:hover .row-title { text-decoration: underline; }
.chev { width: 16px; height: 16px; color: var(--ink-2); flex: none; }

.empty { padding: 40px 24px; text-align: center; }
.empty h3, .empty h1 { font-size: 1.125rem; }
.empty p { color: var(--ink-2); margin: 8px auto 16px; max-width: 42ch; }
.empty p:last-child { margin-bottom: 0; }
.say { display: inline-block; padding: 0 6px; background: var(--paper-2); font-family: var(--mono); font-size: 0.9375em; }

.notice { padding: 16px; border: 1px solid var(--ink); font-size: 0.9375rem; background: var(--slip); }
.notice[data-tone="wait"] { border-style: dashed; }
.notice[data-tone="bad"] { border-color: var(--danger); }
.notice .form-actions { margin-top: 16px; }

.skel { display: grid; gap: 12px; padding: 20px; }
.skel i { display: block; height: 12px; background: var(--paper-2); animation: pulse 1.4s var(--ease) infinite alternate; }
.skel i:nth-child(2) { width: 70%; } .skel i:nth-child(3) { width: 45%; }
/* view skeletons: each bar's height plus its margins equals the line box of the text it stands in for */
.sk { display: block; background: var(--paper-2); border-radius: var(--r); animation: pulse 1.4s var(--ease) infinite alternate; }
.sk-row { display: grid; justify-items: start; }
.page-head > .sk-row { flex: 1; }
.sk-h1 { width: min(40%, 220px); height: 26px; margin: 4px 0; }
.sk-sub { width: min(70%, 320px); height: 14px; margin: 9px 0 5px; }
.sk-label { width: 120px; height: 15px; margin: 4px 0; }
.sk-t { width: 180px; max-width: 60vw; height: 15px; margin: 4px 0; }
.sk-s { width: 110px; height: 12px; margin: 4px 0; }
.sk-back { width: 52px; height: 14px; }
.sk-btn { width: 180px; height: 44px; }
.sk-line { width: min(90%, 420px); height: 14px; margin: 5px 0; }
.sk-line + .sk-line { width: min(60%, 280px); }
.sk-row .sk-s { margin: 6px 0 5px; }
.sk-block { background: var(--paper-2); border-color: transparent; animation: pulse 1.4s var(--ease) infinite alternate; }
@keyframes pulse { from { opacity: 1; } to { opacity: 0.4; } }

/* ---------- the receipt: dotted item rules, a mono amount column, a double rule over the total ---------- */
.receipt { background: var(--slip); border: 1px solid var(--rule); border-radius: var(--r); padding: 20px 24px; color: var(--ink); }
.receipt-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-bottom: 12px; border-bottom: 1px dashed var(--ink-2); }
.receipt-store { font-weight: 700; font-size: 1.0625rem; }
.receipt-meta { font: 0.875rem var(--mono); color: var(--ink-2); white-space: nowrap; }
.receipt-items { padding: 4px 0; }
.receipt-line { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 8px 0; align-items: baseline; }
.receipt-line + .receipt-line { border-top: 1px dotted var(--rule); }
.receipt-line .qty { color: var(--ink-2); font-size: 0.875em; margin-right: 2px; }
.receipt-line .pack { color: var(--ink-2); }
.receipt-line .amt { text-align: right; }
.receipt-line .old { grid-column: 1 / -1; font: 0.8125rem var(--mono); color: var(--ink-2); }
.receipt-line .old::before { content: "* "; }
.receipt-fees { padding: 8px 0 12px; border-top: 1px dashed var(--ink-2); }
.receipt-fee { display: flex; justify-content: space-between; gap: 16px; padding: 2px 0; color: var(--ink-2); font-size: 0.9375rem; }
.receipt-fee[data-kind="saved"] { color: var(--ink); font-weight: 600; }
.receipt-total { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding-top: 12px; border-top: 3px double var(--ink); }
.receipt-total .label { font: 600 1rem var(--mono); text-transform: lowercase; }
.receipt-foot { margin-top: 12px; color: var(--ink-2); font: 0.8125rem/1.5 var(--mono); }
.receipt.compact { padding: 16px 20px; }
.receipt.compact .receipt-total .t-total { font-size: 1.5rem; }
button.receipt { display: block; width: 100%; text-align: left; cursor: zoom-in; font: inherit; }
button.receipt:hover { border-color: var(--ink); }

dialog.sheet { width: min(480px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 0; background: transparent; color: var(--ink); overflow: visible; }
dialog.sheet::backdrop { background: var(--veil); }
dialog.sheet .receipt { padding: 24px; max-height: calc(100dvh - 120px); overflow: auto; border-color: var(--ink); }
dialog.sheet .sheet-close { display: flex; justify-content: flex-end; margin-top: 12px; }
dialog.sheet .sheet-close .btn { background: var(--slip); }

/* ---------- thread ---------- */
.thread-wrap { display: grid; gap: 24px; }
.thread-side { display: none; }
@media (min-width: 1280px) {
  .page.thread-page { max-width: 1120px; }
  .thread-wrap { grid-template-columns: minmax(0, 720px) minmax(300px, 1fr); align-items: start; }
  .thread-side { display: block; position: sticky; top: 104px; margin-top: 24px; }
  .thread-page .inline-receipt, .thread-page .view-bill { display: none; }
}
.thread-head {
  position: sticky; top: 0; z-index: 10; margin: 0 calc(var(--gutter) * -1); padding: 12px var(--gutter);
  background: var(--paper); border-bottom: 1px solid var(--ink);
  display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; align-items: center;
}
.thread-head .store { font-weight: 700; font-size: 1.125rem; }
.thread-head .total { grid-row: span 2; font-size: 1.5rem; font-weight: 600; }
.thread-head .line { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 0.9375rem; flex-wrap: wrap; }
.thread-head .word { display: inline-flex; align-items: center; gap: 8px; font: 500 0.875rem var(--mono); text-transform: lowercase; color: var(--ink-2); }
.thread-head .word[data-tone="active"], .thread-head .word[data-tone="good"] { color: var(--ink); font-weight: 700; }
.thread-head .word[data-tone="wait"] { color: var(--ink); }
.thread-head .word[data-tone="bad"] { color: var(--danger); font-weight: 700; }
.live-dot { width: 7px; height: 7px; background: currentColor; flex: none; }
@media (prefers-reduced-motion: no-preference) { .live-dot[data-live] { animation: blink 1.6s steps(2, jump-none) infinite; } }
@keyframes blink { 50% { opacity: 0.2; } }
@media (max-width: 719px) {
  .thread-head.stuck .line { display: none; }
  .thread-head.stuck .total { grid-row: auto; font-size: 1.125rem; }
}
@media (min-width: 720px) { .thread-head { margin: 0 -32px; padding: 16px 32px; } }

.thread { display: flex; flex-direction: column; gap: 8px; padding: 24px 0 16px; }
.day { align-self: center; margin: 16px 0 8px; font: 500 0.8125rem var(--mono); color: var(--ink-2); text-transform: lowercase; }
.bubble { max-width: min(78%, 520px); padding: 8px 12px 6px; border-radius: 4px; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.bubble time { display: block; margin-top: 2px; font-size: 0.6875rem; color: var(--ink-2); text-align: right; }
.bubble.me { align-self: flex-end; background: var(--paper-2); }
.bubble.us { align-self: flex-start; background: var(--slip); border: 1px solid var(--rule); }
.bubble b { font-weight: 700; }
.bubble.code { font-size: 1rem; border-color: var(--ink); }
.bubble.code .digits { display: block; margin-top: 4px; font-size: 1.75rem; font-weight: 600; letter-spacing: 0.3em; }
.inline-receipt { align-self: flex-start; width: min(92%, 440px); margin: 4px 0; }
.fact { align-self: center; display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 0.8125rem; line-height: 1.4; color: var(--ink-2); text-align: center; }
.fact::before, .fact::after { content: ""; width: 20px; border-top: 1px solid var(--rule); flex: none; }
@media (max-width: 559px) { .fact::before, .fact::after { display: none; } }
.fact[data-kind="tap"] { color: var(--ink); }
.fact[data-kind="paid"], .fact[data-kind="delivered"] { color: var(--ink); font-weight: 600; }
.fact[data-kind="none"] { color: var(--danger); }
@media (prefers-reduced-motion: no-preference) { .thread > .new { animation: enter 200ms var(--ease) both; } }
@keyframes enter { from { opacity: 0; transform: translateY(4px); } }
.thread-cta { display: grid; gap: 12px; padding: 16px 0 8px; border-top: 1px dashed var(--ink-2); margin-top: 8px; }
.thread-cta p { color: var(--ink-2); font-size: 0.9375rem; }
.thread-cta .btns { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- now ---------- */
.bill-link { display: block; color: inherit; text-decoration: none; }
.bill-link:hover .receipt { border-color: var(--ink); }
.more-stores { margin-top: 16px; }
.more-stores summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; font-weight: 600; }
.more-stores[open] summary { margin-bottom: 8px; }
.more-stores summary::-webkit-details-marker { display: none; }
.more-stores summary::before { content: "+"; width: 2ch; font-family: var(--mono); }
.more-stores[open] summary::before { content: "−"; }
.live-card { display: grid; gap: 4px; padding: 16px 20px; }
.live-card .top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.checklist > li { display: flex; gap: 16px; align-items: flex-start; padding: 16px 20px; }
.checklist .num { flex: none; width: 28px; height: 28px; display: grid; place-items: center; font-size: 0.875rem; border: 1px solid var(--ink-2); color: var(--ink-2); }
.checklist .num svg { width: 16px; height: 16px; }
.checklist li[data-state="done"] .num { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.checklist li[data-state="current"] .num { border: 2px solid var(--ink); color: var(--ink); font-weight: 700; }
.checklist li[data-state="done"] .row-title { color: var(--ink-2); text-decoration: line-through; text-decoration-thickness: 1px; }
.checklist li[data-state="later"] { color: var(--ink-2); }
.glance { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.glance > a, .glance > div { display: grid; gap: 4px; align-content: start; padding: 16px 20px; color: inherit; text-decoration: none; }
.glance > a:hover { border-color: var(--ink); }

/* ---------- money ---------- */
.month { display: grid; gap: 4px; padding: 24px; }
.month .t-total { font-size: clamp(2rem, 1.6rem + 2vw, 2.75rem); }
.split { display: flex; height: 12px; margin: 16px 0 12px; gap: 2px; background: var(--paper-2); }
.split i { display: block; min-width: 3px; }
.split .items { background: var(--ink); }
.split .fees { background: repeating-linear-gradient(135deg, var(--ink) 0 1px, transparent 1px 4px); box-shadow: inset 0 0 0 1px var(--ink); }
.split .surge { background: var(--ink-2); }
.key { display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: 0.8125rem; color: var(--ink-2); }
.key > span { display: inline-flex; align-items: center; gap: 8px; }
.key > span::before { content: ""; width: 10px; height: 10px; background: var(--k); }
.key > span[data-k="fees"]::before { background: repeating-linear-gradient(135deg, var(--ink) 0 1px, transparent 1px 3px); box-shadow: inset 0 0 0 1px var(--ink); }
.key .money { color: var(--ink); }
.facts > li { padding: 16px 20px; font-size: 0.9375rem; }
.ledger { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.ledger th { text-align: left; font-size: 0.8125rem; font-weight: 600; color: var(--ink-2); padding: 12px 20px; border-bottom: 1px solid var(--ink); }
.ledger td { padding: 12px 20px; border-bottom: 1px dotted var(--rule); vertical-align: baseline; }
.ledger tr:last-child td { border-bottom: 0; }
.ledger .num { text-align: right; white-space: nowrap; }
.ledger th.num { font-family: var(--sans); }
.ledger a { color: inherit; font-weight: 600; text-decoration: none; display: inline-block; padding: 12px 0; margin: -12px 0; }
.ledger a:hover { text-decoration: underline; }
.ledger tbody tr:hover { background: var(--paper-2); }
@media (max-width: 559px) {
  .ledger thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .ledger tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 16px; border-bottom: 1px dotted var(--rule); }
  .ledger tr:last-child { border-bottom: 0; }
  .ledger td { padding: 0; border: 0; }
  .ledger td[data-col="date"] { grid-column: 1; grid-row: 2; font-size: 0.8125rem; color: var(--ink-2); }
  .ledger td[data-col="store"] { grid-column: 1; grid-row: 1; }
  .ledger td[data-col="fees"] { grid-column: 2; grid-row: 2; font-size: 0.8125rem; color: var(--ink-2); }
  .ledger td[data-col="fees"]::before { content: "fees "; }
  .ledger td[data-col="total"] { grid-column: 2; grid-row: 1; }
}

/* ---------- you ---------- */
.you-nav a.row { min-height: 72px; }
.card { padding: 24px; display: grid; gap: 16px; }
.card + .card { margin-top: 16px; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card-top .t-h3 { margin-bottom: 2px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; font-size: 0.9375rem; }
.kv dt { color: var(--ink-2); }
.items-list { font-size: 0.9375rem; }
.items-list li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px dotted var(--rule); }
.items-list li:last-child { border-bottom: 0; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 16px; border-top: 1px dashed var(--ink-2); }
.card-actions .spacer { flex: 1; }
.changed { font-size: 0.8125rem; color: var(--ink-2); }
.trust { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border: 1px dashed var(--ink-2); font-size: 0.9375rem; }
.trust .state { flex: none; }
.trust p { flex: 1; min-width: 200px; color: var(--ink-2); }

.rules-note { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border: 1px solid var(--ink); background: var(--slip); margin-bottom: 24px; font-size: 0.9375rem; }
.rules-note svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.rule { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: center; padding: 16px 20px; }
.rule .value { grid-column: 1; color: var(--ink-2); font-size: 0.9375rem; }
.rule .value strong { color: var(--ink); font-weight: 500; }
.rule > .btn { grid-column: 2; grid-row: 1 / span 2; }
.rule-edit { grid-column: 1 / -1; padding-top: 12px; display: grid; gap: 16px; }
.rule-edit .form-actions { margin-top: 0; }
.order-list li { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 4px 0; }
.order-list .n { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--ink-2); font: 600 0.875rem var(--mono); flex: none; }
.order-list .name { flex: 1; }
.order-list .moves { display: flex; gap: 4px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--rule); border-radius: var(--r); background: var(--slip); color: var(--ink); cursor: pointer; }
.icon-btn:hover:not(:disabled) { border-color: var(--ink); }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.icon-btn svg { width: 18px; height: 18px; }

.memory-group + .memory-group { margin-top: 32px; }
.memory-group h3 { font-size: 0.9375rem; color: var(--ink-2); margin-bottom: 8px; }
.mem { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 16px 20px; align-items: start; }
.mem .text { overflow-wrap: anywhere; }
.mem .src { grid-column: 1; font-size: 0.8125rem; color: var(--ink-2); }
.mem .acts { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 8px; }
.mem form { grid-column: 1 / -1; display: grid; gap: 12px; }
.mem.gone { align-items: center; background: var(--paper-2); }
.mem.gone .text { color: var(--ink-2); text-decoration: line-through; }

.store-row .row-end { gap: 12px; }
@media (max-width: 559px) {
  .store-row { flex-wrap: wrap; }
  .store-row .row-end { width: 100%; justify-content: space-between; }
}
.danger-zone { border-color: var(--danger); }
.danger-zone .card-top p { color: var(--ink-2); }

.toast {
  position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 40; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px); padding: 4px 8px 4px 16px;
  background: var(--ink); color: var(--paper); font-size: 0.9375rem; border-radius: var(--r);
}
.toast .btn-text { color: var(--paper); }
@media (min-width: 720px) { .toast { bottom: 32px; left: calc(50% + 104px); } }

/* ---------- landing ---------- */
.land { --gutter: clamp(16px, 4vw, 40px); }
.land-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 1120px; margin: 0 auto; padding: 12px var(--gutter); }
.land-top nav { display: flex; align-items: center; gap: 8px; }
.land-top nav a:not(.btn) { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 12px; color: var(--ink); }
@media (max-width: 559px) { .land-top nav a:not(.btn) { padding-inline: 8px; } }  /* Sign in stays: returning users on phones need it */
.land section { max-width: 1120px; margin: 0 auto; padding-inline: var(--gutter); }
.hero { display: grid; gap: 48px; align-items: start; padding-block: clamp(32px, 7vw, 88px) 64px; border-top: 1px solid var(--ink); }
@media (min-width: 900px) { .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 400px); gap: 80px; } }
.hero h1 { font-size: clamp(2.25rem, 1.5rem + 3vw, 3.5rem); line-height: 1.05; letter-spacing: -0.03em; font-weight: 600; max-width: 18ch; }
/* hero slot machine: two reels in ink windows; the script slides each reel's track and sets the window's width */
.hero h1.slot { font-size: clamp(1.875rem, 1.2rem + 3vw, 3.5rem); line-height: 1.2; max-width: none; position: relative; }
.slot-row { display: block; margin-bottom: 0.08em; white-space: nowrap; }
.reel { display: inline-block; vertical-align: top; height: calc(1.2em + 4px); overflow: hidden; padding: 0 0.2em;
  border: 2px solid var(--ink); border-radius: var(--r); background: var(--slip); transition: width 400ms var(--ease); }
.reel-store { background: var(--paper-2); }
.reel-track { display: flex; flex-direction: column; }
.reel-track span { display: block; height: 1.2em; line-height: 1.2em; white-space: nowrap; }
.reel.spinning .reel-track { filter: blur(1.5px); }
.reel-measure { position: absolute; visibility: hidden; white-space: nowrap; left: 0; top: 0; }
.hero .lede { font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem); color: var(--ink-2); margin-top: 24px; max-width: 40ch; }
.hero .ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hero .fine { margin-top: 16px; font-size: 0.8125rem; color: var(--ink-2); }

.hero .eyebrow { font: 500 0.8125rem/1.4 var(--mono); color: var(--ink-2); margin-bottom: 16px; }

/* the hero example is a chat: your messages on the right, the assistant's on the left, as in WhatsApp */
.chat { justify-self: center; width: min(100%, 400px); margin: 0; border: 1px solid var(--ink); background: var(--slip); }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--ink); }
.chat-avatar { display: grid; place-items: center; width: 32px; height: 32px; border: 2px solid var(--ink); border-radius: 50%; font-weight: 700; }
.chat-head b { display: block; font-weight: 600; line-height: 1.2; }
.chat-head small { font: 0.75rem var(--mono); color: var(--ink-2); }
.chat-log { list-style: none; margin: 0; padding: 16px; display: grid; gap: 8px; background: var(--paper-2); }
.chat-log li { max-width: 85%; padding: 8px 12px; border-radius: var(--r); font-size: 0.9375rem; line-height: 1.4; }
.chat-log .me { justify-self: end; background: var(--ink); color: var(--paper); }
.chat-log .bot { justify-self: start; background: var(--slip); border: 1px solid var(--rule); }
.chat-log .me + .bot { margin-bottom: 8px; }
.mini-bill { display: block; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 3px double var(--ink); font: 0.8125rem var(--mono); }
.mini-bill > span { display: flex; justify-content: space-between; gap: 16px; }
.mini-bill > span > span:last-child { font-weight: 700; }
.chat figcaption { padding: 8px 16px; border-top: 1px solid var(--rule); font: 0.75rem var(--mono); color: var(--ink-2); text-align: center; }
@media (prefers-reduced-motion: no-preference) {
  .chat-log li { animation: say 250ms var(--ease) both; }
  .chat-log li:nth-child(1) { animation-delay: 100ms; }
  .chat-log li:nth-child(2) { animation-delay: 210ms; }
  .chat-log li:nth-child(3) { animation-delay: 320ms; }
  .chat-log li:nth-child(4) { animation-delay: 430ms; }
  .chat-log li:nth-child(5) { animation-delay: 540ms; }
  .chat-log li:nth-child(6) { animation-delay: 650ms; }
  .chat-log li:nth-child(7) { animation-delay: 760ms; }
  .chat-log li:nth-child(8) { animation-delay: 870ms; }
}
@keyframes say { from { opacity: 0; transform: translateY(6px); } }

.band { padding-top: clamp(56px, 8vw, 96px); }
.band > h2 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.125rem); letter-spacing: -0.02em; line-height: 1.15; max-width: 24ch; }
.band > .sub { color: var(--ink-2); margin-top: 8px; max-width: 56ch; }
.how { display: grid; margin-top: 32px; border-top: 1px solid var(--ink); counter-reset: how; }
@media (min-width: 760px) { .how { grid-template-columns: repeat(3, 1fr); } }
.how li { display: grid; gap: 8px; align-content: start; padding: 24px 0; border-bottom: 1px dashed var(--rule); }
@media (min-width: 760px) { .how li { padding: 24px 32px 0 0; border-bottom: 0; } .how li + li { padding-left: 32px; border-left: 1px dashed var(--rule); } }
.how .step { font: 500 0.875rem var(--mono); color: var(--ink-2); }
.how h3 { font-size: 1.125rem; }
.how p { color: var(--ink-2); }
.rules { margin-top: 32px; display: grid; border-top: 1px solid var(--ink); counter-reset: rule; }
@media (min-width: 760px) { .rules { grid-template-columns: 1fr 1fr; column-gap: 48px; } .land .rules { grid-template-columns: repeat(3, 1fr); } }
.rules li { display: grid; grid-template-columns: 3ch 1fr; gap: 12px; padding: 20px 0; border-bottom: 1px dashed var(--rule); counter-increment: rule; }
.rules li::before { content: counter(rule, decimal-leading-zero); font: 500 0.875rem/1.7 var(--mono); color: var(--ink-2); }
.rules b { display: block; font-weight: 600; }
.why-note { margin-top: 24px; color: var(--ink-2); }
.rules span { color: var(--ink-2); }
.works { margin: 32px 0 0; display: grid; grid-template-columns: minmax(8rem, 12rem) 1fr; border-top: 1px solid var(--ink); }
.works dt, .works dd { margin: 0; padding: 16px 0; border-bottom: 1px dashed var(--rule); }
.works dt { font-weight: 600; }
.works dd { font-size: 1.0625rem; }
@media (max-width: 559px) { .works { grid-template-columns: 1fr; } .works dt { padding-bottom: 0; border-bottom: 0; } .works dd { padding-top: 4px; } }
.land .gate { margin-top: clamp(56px, 8vw, 96px); padding-block: 32px; display: grid; gap: 24px; align-items: center; border-block: 1px solid var(--ink); }
@media (min-width: 760px) { .gate { grid-template-columns: 1fr auto; } }
.gate h2 { font-size: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem); letter-spacing: -0.02em; }
.gate p { color: var(--ink-2); margin-top: 8px; max-width: 52ch; }
.land-foot { max-width: 1120px; margin: 64px auto 0; padding: 24px var(--gutter) 40px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 24px; font-size: 0.8125rem; color: var(--ink-2); }
.land-foot nav { display: flex; gap: 16px; flex-wrap: wrap; }
.land-foot a { color: var(--ink-2); display: inline-flex; align-items: center; min-height: 44px; }

/* legal */
.legal { max-width: 66ch; margin: 0 auto; padding: 32px var(--gutter) 64px; }
.legal h1 { margin-bottom: 8px; }
.legal h2 { font-size: 1.125rem; margin: 32px 0 8px; padding-top: 16px; border-top: 1px dashed var(--rule); }
.legal li { position: relative; padding-left: 24px; margin: 8px 0; }
.legal li::before { content: "—"; position: absolute; left: 0; font-family: var(--mono); color: var(--ink-2); }

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