/* Layout: one narrow column; each check = upload, details, a ticket-stub verdict, then "Claim it for me" */
:root {
  --paper: #f3f6f2;
  --surface: #ffffff;
  --ink: #14231b;
  --muted: #56665d;
  --line: #d6ddd5;
  --accent: #1d6b47;
  --accent-ink: #ffffff;
  --accent-soft: #e2efe7;
  --maybe: #93600f;
  --maybe-soft: #f8eedb;
  --no: #9b2c2c;
  --no-soft: #f6e3e1;
  --focus: #1d6b47;
  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "Public Sans", "Segoe UI", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1612; --surface: #16201a; --ink: #e5ede7; --muted: #9aa9a0; --line: #2b3a31;
    --accent: #5cbf8b; --accent-ink: #0d1a13; --accent-soft: #19321f;
    --maybe: #e3a74e; --maybe-soft: #32260f; --no: #e88d85; --no-soft: #3a1d1b; --focus: #5cbf8b;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f1612; --surface: #16201a; --ink: #e5ede7; --muted: #9aa9a0; --line: #2b3a31;
  --accent: #5cbf8b; --accent-ink: #0d1a13; --accent-soft: #19321f;
  --maybe: #e3a74e; --maybe-soft: #32260f; --no: #e88d85; --no-soft: #3a1d1b; --focus: #5cbf8b;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--f-body); font-size: 16px; line-height: 1.55;
  padding-inline: 16px; padding-block: 28px 48px;
}
.wrap { max-width: 720px; margin: 0 auto; display: grid; gap: 28px; }
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; margin: 0; line-height: 1.15; }
h1 { font-size: clamp(30px, 6vw, 42px); font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 20px; font-weight: 700; }
p { margin: 0; }
.lede { color: var(--muted); max-width: 58ch; margin-top: 8px; }
.label { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
header { display: grid; gap: 4px; }
.brand { display: inline-flex; align-items: center; gap: 8px; justify-self: start; margin-bottom: 14px; color: var(--ink); text-decoration: none; font: 700 23px/1 var(--f-display); letter-spacing: -0.01em; }
.brand .mark { width: 30px; height: 30px; flex: none; }
.brand b { color: var(--accent); font-weight: 700; }

.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; flex-wrap: wrap; }
.tab { flex: 1 1 140px; border: 0; background: transparent; color: var(--muted); font: 600 15px/1.2 var(--f-body); padding: 11px 12px; border-radius: 9px; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.tab:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.panel { display: grid; gap: 20px; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: grid; gap: 14px; min-width: 0; }
.step-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.note { font-size: 14px; color: var(--muted); }

textarea, input, select { width: 100%; font: 400 16px/1.4 var(--f-body); color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; }
textarea { min-height: 96px; resize: vertical; }
input[type="checkbox"] { width: 20px; height: 20px; flex: none; margin: 2px 0 0; accent-color: var(--accent); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn { border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font: 600 15px/1 var(--f-body); padding: 13px 18px; border-radius: 9px; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.big { font-size: 17px; padding: 15px 22px; }
.btn:disabled { opacity: 0.55; cursor: progress; }
.upload { display: inline-flex; align-items: center; gap: 8px; border: 1px dashed var(--accent); color: var(--accent); font: 600 15px/1 var(--f-body); padding: 12px 14px; border-radius: 9px; cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload:has(+ .sr:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.fname { font-size: 14px; color: var(--muted); display: inline-flex; gap: 8px; align-items: center; overflow-wrap: anywhere; }
.fname button { background: none; border: 0; color: var(--no); font: 600 14px var(--f-body); cursor: pointer; text-decoration: underline; padding: 0; }
.step.drag { border-color: var(--accent); background: var(--accent-soft); }

.status { font-size: 14px; color: var(--muted); }
.status:empty { display: none; }
.status.busy { color: var(--ink); background: var(--paper); border-left: 4px solid var(--line); padding: 10px 14px; border-radius: 8px; }
.status.err { color: var(--ink); background: var(--no-soft); border-left: 4px solid var(--no); padding: 10px 14px; border-radius: 8px; }
.status.ok { color: var(--ink); background: var(--accent-soft); border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 8px; }
.status.warn { color: var(--ink); background: var(--maybe-soft); border-left: 4px solid var(--maybe); padding: 10px 14px; border-radius: 8px; }
.status .code { display: block; font-family: var(--f-mono); font-size: 12px; color: var(--muted); margin-top: 4px; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 14px; }
.field { display: grid; gap: 5px; min-width: 0; align-content: start; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field.wide { grid-column: 1 / -1; }
.pair { display: flex; gap: 8px; }
.pair input { min-width: 0; }

.example { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--maybe-soft); color: var(--ink); border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.example b { color: var(--maybe); }
.linkbtn { background: none; border: 0; color: var(--accent); font: 600 14px var(--f-body); cursor: pointer; padding: 4px 0; text-decoration: underline; }

/* ticket stub verdict */
.stub { position: relative; display: grid; grid-template-columns: minmax(150px, 0.8fr) 1.6fr; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.stub-amt { padding: 20px 18px; display: grid; align-content: center; gap: 4px; border-right: 2px dashed var(--line); }
.stub[data-status="owed"] .stub-amt { background: var(--accent-soft); }
.stub[data-status="maybe"] .stub-amt { background: var(--maybe-soft); }
.stub[data-status="not"] .stub-amt { background: var(--no-soft); }
.amt { font-family: var(--f-mono); font-weight: 500; font-size: clamp(30px, 7vw, 40px); line-height: 1; font-variant-numeric: tabular-nums; }
.stub[data-status="owed"] .amt { color: var(--accent); }
.stub[data-status="maybe"] .amt { color: var(--maybe); }
.stub[data-status="not"] .amt { color: var(--no); }
.pill { justify-self: start; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; border: 1px solid currentColor; }
.stub[data-status="owed"] .pill { color: var(--accent); }
.stub[data-status="maybe"] .pill { color: var(--maybe); }
.stub[data-status="not"] .pill { color: var(--no); }
.stub-body { padding: 18px; display: grid; gap: 10px; min-width: 0; }
.stub-body h3 { font-size: 19px; font-weight: 700; }
.stub-body ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 15px; }
.stub::before, .stub::after { content: ""; position: absolute; left: calc(34% - 11px); width: 20px; height: 20px; border-radius: 50%; background: var(--paper); border: 1px solid var(--line); }
.stub::before { top: -11px; }
.stub::after { bottom: -11px; }

/* journeys */
.legs { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.legcard { position: relative; display: grid; gap: 3px; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--paper); cursor: pointer; min-width: 0; }
.legcard input { position: absolute; opacity: 0; pointer-events: none; }
.legcard:has(input:checked) { border: 2px solid var(--accent); padding: 11px 13px; }
.legcard:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.legcard .lk { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.legcard .lr { font-weight: 600; overflow-wrap: anywhere; }
.legcard .ld { font-family: var(--f-mono); font-size: 13px; color: var(--muted); }
.legcard .lst { font-size: 14px; font-weight: 600; margin-top: 4px; }
.legcard .lst[data-tone="late"] { color: var(--accent); }
.legcard .lst[data-tone="ok"] { color: var(--muted); }
.legcard .lst[data-tone="unknown"] { color: var(--maybe); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: 500 14px/1 var(--f-body); padding: 10px 14px; border-radius: 999px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ask { font-weight: 600; font-size: 15px; }
details.more summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14px; }
details.more[open] summary { margin-bottom: 12px; }

/* claim it for me */
.claim { background: var(--surface); border: 2px solid var(--accent); border-radius: 14px; padding: 18px; display: grid; gap: 14px; }
.split { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.split div { background: var(--paper); border-radius: 10px; padding: 10px 12px; display: grid; gap: 2px; }
.split span { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.split b { font-family: var(--f-mono); font-weight: 500; font-size: 20px; font-variant-numeric: tabular-nums; }
.split .you b { color: var(--accent); }
.agree { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.done { background: var(--accent-soft); border-radius: 12px; padding: 16px; display: grid; gap: 6px; }
.done .ref { font-family: var(--f-mono); font-size: 18px; }

.forward { background: var(--accent-soft); border-radius: 14px; padding: 14px 18px; display: grid; gap: 4px; }
.forward a { color: var(--accent); font-weight: 600; overflow-wrap: anywhere; }

.invite { background: var(--maybe-soft); border-radius: 14px; padding: 18px; display: grid; gap: 10px; }
.invite .row input { flex: 1 1 180px; width: auto; }

footer { font-size: 13px; color: var(--muted); display: grid; gap: 6px; border-top: 1px solid var(--line); padding-top: 16px; }
footer a { color: inherit; }

@media (max-width: 520px) {
  .stub { grid-template-columns: 1fr; }
  .stub-amt { border-right: 0; border-bottom: 2px dashed var(--line); }
  .stub::before, .stub::after { display: none; }
  .split b { font-size: 17px; }
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
