/* Phone-first, one column. Taxi yellow marks the action; banknote green marks money; QR codes always sit on white. */
:root {
  --paper: #F1F4F2; --surface: #FFFFFF; --ink: #14211D; --muted: #56645F; --line: #D2DAD7;
  --taxi: #F5C400; --taxi-ink: #14211D; --taxi-soft: #FFF4C2;
  --bill: #2C6A4D; --bill-ink: #FFFFFF; --warn: #A24E17; --good: #1E7A4A; --qr-bg: #FFFFFF;
  /* one colour per business, so the account in use is obvious */
  --b0: #FFF4C2; --b0-line: #E0B400; --b1: #DDF1E6; --b1-line: #2C6A4D; --b2: #DCEBFA; --b2-line: #2F6FB3;
  --b3: #F6E0F2; --b3-line: #A63D8F; --b4: #FBE3D3; --b4-line: #C2581C; --b5: #E7E3FA; --b5-line: #5B4BC4;
  --display: "Archivo", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0E1412; --surface: #17201C; --ink: #E6EDEA; --muted: #9AA8A3; --line: #2B3632;
    --taxi: #F5C400; --taxi-ink: #14211D; --taxi-soft: #3B3413;
    --bill: #7CC39E; --bill-ink: #0E1412; --warn: #F0A066; --good: #6CD299;
    --b0: #3B3413; --b0-line: #F5C400; --b1: #16352A; --b1-line: #7CC39E; --b2: #172B42; --b2-line: #7FB2E8;
    --b3: #3A1A35; --b3-line: #E08ACF; --b4: #3D2414; --b4-line: #F0A066; --b5: #24203F; --b5-line: #A79BF0;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); }
body { color: var(--ink); font-family: var(--body); font-size: 17px; line-height: 1.5; -webkit-text-size-adjust: 100%; min-height: 100vh; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--bill); outline-offset: 2px; }
[hidden] { display: none !important; }

.bar { position: sticky; top: 0; z-index: 5; background: var(--paper); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.bar-in { max-width: 560px; margin: 0 auto; display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap;
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); }
.mark { display: flex; align-items: center; gap: 9px; font-family: var(--display); font-weight: 800; font-stretch: 82%; font-size: 21px; white-space: nowrap; margin-right: auto; }
.coin { width: 28px; height: 28px; border-radius: 50%; background: var(--taxi); color: var(--taxi-ink); display: grid; place-items: center; font-size: 15px; font-weight: 800; box-shadow: inset 0 0 0 2.5px var(--taxi-ink); }
.biz { font-weight: 700; color: var(--muted); font-size: 15px; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 999px; padding: 2px; gap: 2px; }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 5px 12px; font-size: 14px; font-weight: 700; cursor: pointer; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.seg.full { display: flex; }
.seg.full button { flex: 1; padding: 9px 12px; font-size: 16px; }

.wrap { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px;
  padding: 22px max(16px, env(safe-area-inset-right, 0px)) calc(40px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
h1, h2, h3 { font-family: var(--display); font-stretch: 88%; line-height: 1.12; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(28px, 7.5vw, 38px); font-weight: 800; }
h2 { font-size: clamp(23px, 6vw, 29px); font-weight: 700; }
h3 { font-size: 19px; font-weight: 700; }
p { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.center { text-align: center; }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 15px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-weight: 700; }
.field input { width: 100%; padding: 13px 14px; border: 2px solid var(--line); border-radius: var(--r); background: var(--surface); font-size: 18px; }
.field input:focus { outline: none; border-color: var(--taxi); }
.money { display: flex; align-items: center; gap: 8px; border: 2px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 4px 14px; }
.money:focus-within { border-color: var(--taxi); }
.money span { font-family: var(--display); font-weight: 800; font-size: 28px; color: var(--muted); }
.money input { flex: 1; min-width: 0; border: 0; background: transparent; font-family: var(--display); font-weight: 800; font-size: 32px; padding: 6px 0; font-variant-numeric: tabular-nums; }
.money input:focus { outline: none; }
.pin { letter-spacing: .4em; font-family: var(--display); font-weight: 800; font-size: 26px !important; text-align: center; }

.btn { min-height: 52px; padding: 0 20px; border-radius: var(--r); font-weight: 700; font-size: 17px; border: 2px solid var(--line); background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; color: var(--ink); }
.btn.primary { background: var(--taxi); border-color: var(--taxi); color: var(--taxi-ink); }
.btn.primary:disabled { opacity: .45; cursor: not-allowed; }
.btn.quiet { border-color: transparent; color: var(--muted); }
.btn.danger { color: var(--warn); border-color: var(--warn); }
.btn.block { width: 100%; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > .btn { flex: 1; }

.owed { display: flex; flex-direction: column; gap: 2px; }
.owed b { font-family: var(--display); font-stretch: 88%; font-size: 40px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.tools { display: grid; gap: 10px; }
.tool { text-align: left; border: 2px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 16px 18px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.tool .tool-name { font-family: var(--display); font-stretch: 88%; font-weight: 800; font-size: 24px; }
.tool .tool-desc { color: var(--muted); font-size: 15px; }
.tool.k-change { border-color: var(--taxi); background: var(--taxi-soft); }
.tool.minor { padding: 12px 18px; }
.tool.minor .tool-name { font-size: 19px; }

.notes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.note-btn { min-height: 58px; border: 2.5px solid var(--bill); border-radius: 8px; background: var(--surface); color: var(--bill); font-family: var(--display); font-weight: 800; font-size: 24px; cursor: pointer; position: relative; }
.note-btn::before { content: ""; position: absolute; inset: 5px; border: 1px dashed var(--bill); border-radius: 4px; opacity: .5; pointer-events: none; }
.note-btn[aria-pressed="true"] { background: var(--bill); color: var(--bill-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 2px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 14px; font-weight: 700; cursor: pointer; min-height: 44px; }
.chip[aria-pressed="true"] { background: var(--taxi-soft); border-color: var(--taxi); }

.calc { border-radius: var(--r); background: var(--surface); border: 1.5px solid var(--line); padding: 12px 14px; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.calc b { font-family: var(--display); font-weight: 800; font-size: 28px; font-variant-numeric: tabular-nums; }
.alert { border: 1.5px solid var(--warn); color: var(--warn); border-radius: var(--r); padding: 10px 14px; font-weight: 700; }
.ok { border: 1.5px solid var(--good); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.ok b { font-family: var(--display); font-weight: 800; font-size: 26px; }

.qr { background: var(--qr-bg); border-radius: var(--r); padding: 14px; align-self: center; width: min(100%, 360px); border: 1.5px solid var(--line); }
.qr svg { display: block; width: 100%; height: auto; }
.qr-sum { text-align: center; font-family: var(--display); font-stretch: 88%; font-weight: 800; font-size: 26px; }
.status { text-align: center; color: var(--muted); font-weight: 700; }
.status::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--taxi); margin-right: 8px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }

.list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: transparent; border-left: 0; border-right: 0; border-top: 0; text-align: left; width: 100%; cursor: pointer; }
.item:last-child { border-bottom: 0; }
.item div { min-width: 0; }
.item .amt { font-family: var(--display); font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.item .amt.plus { color: var(--good); }
.item .amt.minus { color: var(--warn); }
div.item { cursor: default; }
.empty { border: 2px dashed var(--line); border-radius: var(--r); padding: 24px 18px; text-align: center; color: var(--muted); }

.switch { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px; border: 1.5px solid var(--line); border-radius: var(--r); background: var(--surface); cursor: pointer; text-align: left; width: 100%; }
.switch .knob { flex: none; width: 52px; height: 30px; border-radius: 999px; background: var(--line); position: relative; transition: background .15s; }
.switch .knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); transition: transform .15s; }
.switch[aria-checked="true"] .knob { background: var(--good); }
.switch[aria-checked="true"] .knob::after { transform: translateX(22px); }
.asbar { border-bottom: 3px solid var(--band-line); background: var(--band); }
.asbar-in { max-width: 560px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px)); }
.asbar-in > div { min-width: 0; }
.asbar b { font-family: var(--display); font-stretch: 88%; font-size: 19px; }
.item.pick { border-left: 6px solid var(--band-line); }
.band-0 { --band: var(--b0); --band-line: var(--b0-line); }
.band-1 { --band: var(--b1); --band-line: var(--b1-line); }
.band-2 { --band: var(--b2); --band-line: var(--b2-line); }
.band-3 { --band: var(--b3); --band-line: var(--b3-line); }
.band-4 { --band: var(--b4); --band-line: var(--b4-line); }
.band-5 { --band: var(--b5); --band-line: var(--b5-line); }
.btn.small { min-height: 38px; padding: 0 12px; font-size: 14px; border-width: 1.5px; }
.pill { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 8px; background: var(--taxi-soft); border: 1px solid var(--taxi); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.balances { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.balances .owed b { font-size: 32px; }
.navgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tool.k-tab { border-color: var(--bill); }
.owed b.owe, .owed b.name-b { font-size: 28px; }
.owed b.owe { color: var(--warn); }
.item.total { background: var(--taxi-soft); }
.item.member { cursor: default; flex-wrap: wrap; }
.item.member.off { opacity: .6; }
.item.member .row { flex-wrap: wrap; justify-content: flex-end; }
.roles { display: grid; gap: 8px; }
.role-opt { text-align: left; border: 2px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 10px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.role-opt[aria-pressed="true"] { border-color: var(--taxi); background: var(--taxi-soft); }
.access { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.access > div { display: flex; flex-direction: column; }
.linkbox { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 13px; color: var(--muted); }
.code-box { font-family: var(--display); font-weight: 800; font-size: 30px; letter-spacing: .12em; }

.asbar-btns { display: flex; gap: 6px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.pill.viewing { display: inline-block; margin-top: 4px; background: var(--surface); border-color: var(--warn); color: var(--warn); }
.field textarea { width: 100%; padding: 12px 14px; border: 2px solid var(--line); border-radius: var(--r); background: var(--surface); font-size: 17px; resize: vertical; }
.field textarea:focus { outline: none; border-color: var(--taxi); }
.qr.small-qr { width: min(100%, 240px); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 700; cursor: pointer; }
.check input { width: 24px; height: 24px; flex: none; margin-top: 2px; accent-color: var(--good); }
.access.big > div { background: var(--surface); border: 2px solid var(--taxi); border-radius: var(--r); padding: 12px 14px; }
.access.big .code-box { font-size: 38px; }
.notice { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; border: 2px solid var(--taxi); border-radius: var(--r); background: var(--taxi-soft); cursor: pointer; text-align: left; font-size: 17px; }
.handover { display: flex; flex-direction: column; gap: 10px; border: 2px solid var(--warn); }
.handover .item { cursor: default; }
.handover > .btn { align-self: flex-start; }
.limit-chips { width: 100%; justify-content: flex-end; }

.map { position: relative; z-index: 0; height: 55vh; min-height: 280px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.map.small-map { height: 320px; min-height: 0; }
/* The map library loads its stylesheet after ours, so these rules need .map in front to win. */
.map.leaflet-container { font-family: var(--body); font-size: 15px; }
.map .leaflet-popup-content-wrapper, .map .leaflet-popup-tip { background: var(--surface); color: var(--ink); }
.map .leaflet-popup-content { font-size: 15px; line-height: 1.4; }
.map .leaflet-popup-content a, .place-item a { color: var(--bill); font-weight: 700; }
.map a.leaflet-popup-close-button { color: var(--muted); }
.pills { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 2px; }
.place-item { flex-direction: column; align-items: stretch; cursor: default; }
.place-go { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.item.static { cursor: default; }
.pair-code { font-family: var(--display); font-weight: 800; font-size: 56px; line-height: 1; text-align: center; letter-spacing: .12em; }
.steps { margin: 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 6px; }
@media (prefers-reduced-motion: reduce) {
  .status::before { animation: none; }
  .switch .knob, .switch .knob::after { transition: none; }
}
