/* Petty cash & stock — a cash book you can carry in your pocket. */
@import url('https://fonts.googleapis.com/css2?family=Public+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
  --ink: #19231f;
  --ink-2: #4a5550;
  --ink-3: #5f6a64;        /* secondary text: 4.9:1 on paper, 5.6:1 on sheet */
  --on-green: #fff; --on-purple: #fff; --on-amber: #fff; --on-red: #fff; --on-ink: #fff;
  --paper: #eef1ec;
  --sheet: #ffffff;
  --rule: #d6dbd4;
  --rule-strong: #b8c0b8;
  --green: #1b5e4b;        /* primary action: money going where it should */
  --sand: #e4b85c;         /* the Petti full stop */
  --green-ink: #0f4a3a;
  --green-tint: #e2efe9;
  --purple: #5a3d85;       /* the N$200 note: anything that needs the approver */
  --purple-tint: #ece6f4;
  --amber: #a7541a;        /* needs attention from the reader */
  --amber-tint: #fbead9;
  --red: #9b2c2c;
  --red-tint: #f8e1e1;
  --blue: #2b5a86;
  --blue-tint: #e1ebf5;
  --focus: #1b5e4b;
  --radius: 6px;
  --shadow: 0 1px 0 rgba(25,35,31,.06), 0 8px 24px -16px rgba(25,35,31,.25);
  --font: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --chart-1: #1b5e4b;
  --chart-2: #b8713a;
  --chart-muted: #9aa49e;
}

/* Dark: the same ledger, printed on slate instead of paper */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e8ece8; --ink-2: #b5bdb7; --ink-3: #93a099;
    --paper: #161d1a; --sheet: #1f2823; --rule: #2f3a34; --rule-strong: #43504a;
    --green: #25735c; --green-ink: #7fcfb3; --green-tint: #1d3a31;
    --on-green: #fff; --on-purple: #1c1428; --on-amber: #2a1708; --on-red: #2a0f0f; --on-ink: #161d1a;
    --purple: #b79ad9; --purple-tint: #33294a;
    --amber: #e0955a; --amber-tint: #40301f;
    --red: #e08484; --red-tint: #442626;
    --blue: #8fb6dd; --blue-tint: #243444;
    --focus: #7fcfb3; --chart-1: #5fb898; --chart-2: #d9a06a; --chart-muted: #6b7772;
    --shadow: 0 1px 0 rgba(0,0,0,.3), 0 8px 24px -16px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  --ink: #e8ece8; --ink-2: #b5bdb7; --ink-3: #93a099;
  --paper: #161d1a; --sheet: #1f2823; --rule: #2f3a34; --rule-strong: #43504a;
  --green: #25735c; --green-ink: #7fcfb3; --green-tint: #1d3a31;
    --on-green: #fff; --on-purple: #1c1428; --on-amber: #2a1708; --on-red: #2a0f0f; --on-ink: #161d1a;
  --purple: #b79ad9; --purple-tint: #33294a;
  --amber: #e0955a; --amber-tint: #40301f;
  --red: #e08484; --red-tint: #442626;
  --blue: #8fb6dd; --blue-tint: #243444;
  --focus: #7fcfb3; --chart-1: #5fb898; --chart-2: #d9a06a; --chart-muted: #6b7772;
  --shadow: 0 1px 0 rgba(0,0,0,.3), 0 8px 24px -16px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
html { font-size: clamp(16px, 0.95rem + 0.2vw, 17.5px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); background: var(--paper);
  line-height: 1.45; font-feature-settings: 'tnum' 1, 'kern' 1;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
a { color: var(--green-ink); }
button { font: inherit; }
input, select, textarea { font: inherit; color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w, 232px) 1fr; min-height: 100vh; min-height: 100dvh; }
.side {
  background: var(--sheet); border-right: 1px solid var(--rule); padding: 20px 14px; position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: 6px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-mark .dot, .brand-name .dot { color: var(--sand); }
.brand-mark { width: 1.75em; height: 1.75em; border-radius: .4em; background: var(--green); color: var(--on-green); display: grid; place-items: center; font-weight: 700; font-size: .95rem; flex: 0 0 auto; }
.brand-name { font-weight: 600; line-height: 1.15; }
.brand-name small { display: block; font-weight: 400; color: var(--ink-3); font-size: .78rem; }
.nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px; border-radius: var(--radius);
  color: var(--ink-2); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--paper); color: var(--ink); }
.nav a.active { background: var(--green-tint); color: var(--green-ink); }
.nav .count { font-size: 12px; background: var(--amber); color: var(--on-amber); border-radius: 10px; padding: 1px 7px; font-weight: 600; min-width: 20px; text-align: center; }
.side .me { margin-top: auto; padding: 10px; border-top: 1px solid var(--rule); font-size: .9rem; }
.side .me strong { display: block; }
.side .me span { color: var(--ink-3); font-size: .8rem; }
.main { padding: clamp(16px, 2.2vw, 36px) clamp(16px, 3vw, 48px) 80px; max-width: min(1180px, 100%); width: 100%; container-type: inline-size; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { color: var(--ink-2); margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.tabbar { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 16px 16px 92px; }
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--sheet); border-top: 1px solid var(--rule);
    z-index: 20; padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a { flex: 1; text-align: center; padding: 10px 4px 8px; font-size: 12px; color: var(--ink-2); text-decoration: none; font-weight: 500; position: relative; }
  .tabbar a.active { color: var(--green-ink); }
  .tabbar a.active::before { content: ''; position: absolute; top: 0; left: 20%; right: 20%; height: 2px; background: var(--green); }
  .tabbar .count { position: absolute; top: 4px; right: calc(50% - 22px); font-size: 12px; background: var(--amber); color: var(--on-amber); border-radius: 10px; padding: 0 5px; font-weight: 600; }
}

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: .5em .9em; min-height: 2.25em; border-radius: var(--radius); border: 1px solid var(--rule-strong);
  background: var(--sheet); color: var(--ink); cursor: pointer; font-weight: 500; text-decoration: none; line-height: 1.2; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--green); border-color: var(--green); color: var(--on-green); }
.btn-primary:hover { background: var(--green-ink); border-color: var(--green-ink); }
.btn-danger { color: var(--red); border-color: var(--rule-strong); }
.btn-danger:hover { background: var(--red-tint); }
.btn-purple { background: var(--purple); border-color: var(--purple); color: var(--on-purple); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--paper); border-color: transparent; color: var(--ink); }
.btn-quiet.btn-danger { color: var(--red); }
.btn-quiet.btn-danger:hover { background: var(--red-tint); color: var(--red); }
.btn-sm { padding: .35em .7em; font-size: .85rem; min-height: 2.1em; }
.btn-block { width: 100%; justify-content: center; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.field > label, .field > .label { font-weight: 500; font-size: .9rem; }
.field .hint { color: var(--ink-3); font-size: .8rem; }
.input, select.input, textarea.input {
  padding: .55em .7em; min-height: 2.4em; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--sheet); width: 100%;
}
.input:focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 3px rgba(27,94,75,.15); }
.input-sm { padding: 6px 8px; }
.input.num { text-align: right; }
textarea.input { min-height: 72px; resize: vertical; }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--green); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
.error { color: var(--red); font-size: .9rem; margin: 6px 0; }

/* ---------- sheets (panels) ---------- */
.sheet { background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; padding: clamp(14px, 1.6vw, 20px) clamp(14px, 1.8vw, 22px); margin-bottom: 18px; container-type: inline-size; min-width: 0; }
.sheet-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.sheet-head h2, .sheet-head h3 { margin: 0; }
.sheet-head .sub { color: var(--ink-3); font-size: .85rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 18px; }
.grid-2 > *, .grid-3 > * { min-width: 0; }
.empty { color: var(--ink-3); padding: 18px 0; }
.empty strong { color: var(--ink-2); display: block; margin-bottom: 2px; }

/* ---------- the cash book: ruled lists ---------- */
.ledger { width: 100%; border-collapse: collapse; font-size: .93rem; }
.ledger th { text-align: left; font-weight: 500; color: var(--ink-3); font-size: .8rem; padding: 0 8px 8px; border-bottom: 1px solid var(--rule-strong); }
.ledger td { padding: 10px 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.ledger tr:last-child td { border-bottom: 0; }
.ledger .num, .ledger th.num { text-align: right; white-space: nowrap; }
.ledger .amt { font-weight: 600; }
.ledger .muted { color: var(--ink-3); }
.ledger tr.click { cursor: pointer; }
.ledger tr.click:hover td { background: var(--paper); }
.ledger td:first-child, .ledger th:first-child { padding-left: 0; }
.ledger td:last-child, .ledger th:last-child { padding-right: 0; }
.ledger tfoot td { border-top: 2px solid var(--ink); border-bottom: 0; font-weight: 600; }
.ledger .input { padding: 6px 8px; }
.ledger .low td:nth-child(1) { box-shadow: inset 3px 0 0 var(--amber); padding-left: 8px; }
.table-wrap { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.table-wrap .ledger { width: 100%; }
.ledger td { overflow-wrap: break-word; }
.ledger-list { list-style: none; margin: 0; padding: 0; }
.ledger-list li { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--rule); text-decoration: none; color: inherit; }
.ledger-list li:last-child { border-bottom: 0; }
.ledger-list li.click { cursor: pointer; }
.ledger-list li.click:hover { background: var(--paper); margin: 0 -8px; padding-left: 8px; padding-right: 8px; }
.ledger-list .what { flex: 1 1 13rem; min-width: 0; }
.ledger-list .what strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: break-word; }
.ledger-list .what span:not(.pill) { color: var(--ink-3); font-size: .85rem; }
.ledger-list .amt { font-weight: 600; white-space: nowrap; margin-left: auto; }
.ref { color: var(--ink-3); font-size: .85rem; }

/* ---------- status pills ---------- */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; line-height: 1.5; }
.pill-grey { background: var(--paper); color: var(--ink-2); }
.pill-green { background: var(--green-tint); color: var(--green-ink); }
.pill-purple { background: var(--purple-tint); color: var(--purple); }
.pill-amber { background: var(--amber-tint); color: var(--amber); }
.pill-red { background: var(--red-tint); color: var(--red); }
.pill-blue { background: var(--blue-tint); color: var(--blue); }
.pill-ink { background: var(--ink); color: var(--on-ink); }
.type-tag { font-size: .78rem; color: var(--ink-3); }
.threshold { color: var(--purple); font-weight: 600; }

/* ---------- float strip ---------- */
.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule-strong); }
.strip div { padding: 12px 12px 12px 0; border-right: 1px solid var(--rule); }
.strip div:last-child { border-right: 0; }
.strip .k { font-size: .8rem; color: var(--ink-3); display: block; }
.strip .v { font-size: 1.25rem; font-weight: 600; }
.strip .v.neg { color: var(--red); }
.strip .v.hero { color: var(--green-ink); font-size: 1.6rem; }
@container (max-width: 640px) { .strip { grid-template-columns: repeat(2, 1fr); } .strip div:nth-child(2n) { border-right: 0; } }

/* ---------- banners ---------- */
.banner { padding: 12px 14px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid; font-size: .93rem; }
.banner-amber { background: var(--amber-tint); border-color: var(--rule-strong); color: var(--amber); }
.banner-purple { background: var(--purple-tint); border-color: var(--rule-strong); color: var(--purple); }
.banner-green { background: var(--green-tint); border-color: var(--rule-strong); color: var(--green-ink); }
.banner-red { background: var(--red-tint); border-color: var(--rule-strong); color: var(--red); }
.banner strong { display: block; }

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--rule-strong); margin-left: 6px; }
.timeline li { position: relative; padding: 0 0 14px 16px; font-size: .9rem; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--sheet); border: 2px solid var(--ink-3); }
.timeline li.now::before { border-color: var(--green); background: var(--green); }
.timeline .when { color: var(--ink-3); font-size: .8rem; display: block; }
.timeline .note { color: var(--ink-2); display: block; margin-top: 2px; white-space: pre-wrap; }

/* ---------- proofs ---------- */
.proofs { display: flex; flex-wrap: wrap; gap: 10px; }
.proof { width: 120px; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; background: var(--paper); font-size: .78rem; }
.proof a { display: block; color: inherit; text-decoration: none; }
.proof .thumb { height: 90px; display: grid; place-items: center; background: var(--paper); color: var(--ink-3); overflow: hidden; }
.proof .thumb img { width: 100%; height: 100%; object-fit: cover; }
.proof .name { padding: 6px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proof button { width: 100%; border: 0; border-top: 1px solid var(--rule); background: var(--sheet); padding: 5px; cursor: pointer; color: var(--red); font-size: .78rem; }
.upload { border: 1.5px dashed var(--rule-strong); border-radius: var(--radius); padding: 16px; text-align: center; color: var(--ink-2); cursor: pointer; }
.upload:hover { border-color: var(--green); color: var(--green-ink); }
.upload input { display: none; }

/* ---------- misc ---------- */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: .93rem; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }
.tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--rule-strong); margin-bottom: 16px; }
.tabs button { background: none; border: 0; padding: 8px 12px; cursor: pointer; color: var(--ink-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.active { color: var(--green-ink); border-bottom-color: var(--green); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .input { width: auto; min-width: 180px; }
.toolbar .spacer { flex: 1; }
.stat { padding: 6px 0; }
.stat .k { color: var(--ink-3); font-size: .8rem; display: block; }
.stat .v { font-size: 1.4rem; font-weight: 600; }
.stat .v small { font-size: .85rem; font-weight: 400; color: var(--ink-3); margin-left: 4px; }
.lines-edit .ledger td { padding: 6px 4px; }
.lines-edit .ledger td:first-child { padding-left: 0; }
.chart { width: 100%; height: 220px; }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.chart .axis text { fill: var(--ink-3); font-size: 12px; }
.chart .axis line, .chart .grid line { stroke: var(--rule); }
.chart .bar { fill: var(--chart-1); }
.chart .bar:hover { fill: var(--green-ink); }
.chart .line { fill: none; stroke: var(--chart-1); stroke-width: 2; }
.chart .line2 { fill: none; stroke: var(--chart-2); stroke-width: 2; stroke-dasharray: 4 3; }
.chart .dot { fill: var(--chart-1); stroke: var(--sheet); stroke-width: 2; }
.chart .dot2 { fill: var(--chart-2); stroke: var(--sheet); stroke-width: 2; }
.chart .label { font-size: 12px; fill: var(--ink-2); }
.legend { display: flex; gap: 14px; font-size: .82rem; color: var(--ink-2); margin-top: 6px; }
.legend i { display: inline-block; width: 12px; height: 3px; vertical-align: middle; margin-right: 6px; background: var(--chart-1); }
.legend i.two { background: var(--chart-2); }
.tip { position: fixed; pointer-events: none; background: var(--ink); color: var(--on-ink); padding: 5px 8px; border-radius: 4px; font-size: .78rem; z-index: 50; display: none; }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(25,35,31,.45); display: grid; place-items: center; padding: 16px; z-index: 40; }
.modal { background: var(--sheet); border-radius: 10px; padding: clamp(16px, 2vw, 24px); width: 100%; max-width: 520px; max-height: 92vh; max-height: 92dvh; overflow: auto; box-shadow: var(--shadow); }
.modal h2 { margin-bottom: 14px; }
.modal-wide { max-width: 760px; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--on-ink); padding: 10px 16px; border-radius: 8px; z-index: 60; font-size: .93rem; max-width: 90vw; box-shadow: var(--shadow); }
.toast.err { background: var(--red); color: var(--on-red); }
@media (max-width: 860px) { .toast { bottom: 76px; } }

/* ---------- auth ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.auth .card { width: 100%; max-width: 400px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 10px; padding: 28px; }
.auth .brand { padding-bottom: 20px; }
.auth h1 { font-size: 1.3rem; margin-bottom: 4px; }
.auth p.lead { color: var(--ink-2); margin-bottom: 18px; }
.auth .links { margin-top: 14px; font-size: .88rem; display: flex; justify-content: space-between; }
.loading { color: var(--ink-3); padding: 24px 0; }

/* ---------- budgets, scorecards ---------- */
.meter { height: 8px; background: var(--paper); border-radius: 999px; overflow: hidden; border: 1px solid var(--rule); }
.meter-fill { height: 100%; background: var(--green); border-radius: 999px; transition: width .3s; }
.banner-blue { background: var(--blue-tint); border-color: var(--rule-strong); color: var(--blue); }
.banner-grey { background: var(--paper); border-color: var(--rule); color: var(--ink-2); }
.score { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.score .box { border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px; }
.score .box .k { font-size: .8rem; color: var(--ink-3); display: block; }
.score .box .v { font-size: 1.3rem; font-weight: 600; }
.score .box .d { font-size: .8rem; color: var(--ink-3); }
.score .box .d.up { color: var(--red); }
.score .box .d.down { color: var(--green-ink); }
.install-hint { display: none; }
@media (display-mode: browser) and (max-width: 860px) { .install-hint { display: block; } }

/* ---------- snap a receipt ---------- */
.snap-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 28px 16px; border: 2px dashed var(--rule-strong); border-radius: 10px; cursor: pointer; text-align: center; color: var(--ink-2); font-weight: 500; }
.snap-btn:hover { border-color: var(--green); color: var(--green-ink); }
.snap-btn input { display: none; }
.snap-btn .big { font-size: 2.2rem; line-height: 1; }
.snap-row { display: flex; gap: 14px; align-items: flex-start; }
.snap-thumb { width: 96px; height: 120px; flex: 0 0 auto; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; background: var(--paper); display: grid; place-items: center; color: var(--ink-3); }
.snap-thumb img { width: 100%; height: 100%; object-fit: cover; }
.snap-read { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px 14px; margin-top: 6px; }
.snap-read .k { display: block; font-size: .8rem; color: var(--ink-3); }
.snap-read .v { font-weight: 600; }
.snap-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: 8px; }
.snap-card.primary { border-color: var(--green); background: var(--green-tint); }
.snap-card .what { flex: 1; min-width: 0; }
.snap-card .what strong { display: block; }
.snap-card .what span { display: block; font-size: .82rem; color: var(--ink-2); white-space: normal; }
.snap-options { margin-top: 14px; }
@container (max-width: 560px) { .snap-card { flex-direction: column; align-items: stretch; } }

/* ---------- install ---------- */
.steps { padding-left: 22px; display: grid; gap: 10px; }
.steps li strong { display: block; }
.ios-share { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 1.5px solid currentColor; border-radius: 5px; font-size: .8rem; vertical-align: middle; }
.kbd { display: inline-block; padding: 0 6px; border: 1px solid var(--rule-strong); border-radius: 4px; font-weight: 600; }
.install-banner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn-block { width: 100%; }

/* ---------- act from the list ---------- */
.ledger-list li { flex-wrap: wrap; }
.row-actions { flex-basis: 100%; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 4px 0 2px 0; }
.row-actions .note { font-size: .82rem; color: var(--ink-3); flex: 1; min-width: 160px; }
.row-actions .note.warn { color: var(--amber); }
.row-actions .note.bad { color: var(--red); }
.check-pill { font-size: .78rem; padding: 1px 7px; }

/* ---------- messages on a request ---------- */
.msgs { display: grid; gap: 8px; margin-bottom: 10px; }
.msg { padding: 8px 10px; border-radius: 8px; background: var(--paper); max-width: 85%; }
.msg.mine { background: var(--green-tint); margin-left: auto; }
.msg .who { font-size: .8rem; color: var(--ink-2); display: block; margin-bottom: 2px; }
.msg-form { display: flex; gap: 8px; }
.msg-form .input { flex: 1; }

/* ---------- consolidation ---------- */
.linkish { background: none; border: 0; padding: 0; color: var(--green-ink); font-weight: 600; cursor: pointer; text-decoration: underline; font-size: inherit; }
.once-hint { background: var(--paper); border-radius: var(--radius); padding: 8px 10px; }
details.more { margin-top: 10px; }
details.more > summary { cursor: pointer; color: var(--ink-2); font-size: .88rem; font-weight: 500; list-style: none; padding: 4px 0; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: '▸'; display: inline-block; width: 1em; transition: transform .15s; }
details.more[open] > summary::before { transform: rotate(90deg); }
details.more .more-body { padding-top: 8px; }
.sheet.flat { padding: 14px 18px; }
.elsewhere { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .88rem; color: var(--ink-2); padding: 2px 0 18px; }
.elsewhere a { color: var(--ink-2); text-decoration: none; border-bottom: 1px dotted var(--rule-strong); }
.elsewhere a:hover { color: var(--green-ink); }
.elsewhere strong { color: var(--ink); }
.float-card { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 4px 18px; align-items: end; }
.float-card .k { display: block; font-size: .8rem; color: var(--ink-3); }
.float-card .v { font-size: 1.15rem; font-weight: 600; }
.float-card .v.hero { color: var(--green-ink); font-size: 1.35rem; }
.float-card .v.neg { color: var(--red); }
@container (max-width: 640px) { .float-card { grid-template-columns: repeat(2, minmax(0, 1fr)); } .float-card .verdict { grid-column: 1 / -1; } }
.duty-empty { text-align: center; padding: 26px 10px; color: var(--ink-2); }
.duty-empty strong { display: block; font-size: 1.05rem; color: var(--ink); margin-bottom: 2px; }
.topbar { display: none; }
@media (max-width: 860px) {
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -4px 0 12px; }
  .topbar .brand { padding: 0; }
  .topbar .bell { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--ink-2); text-decoration: none; font-size: 1.15rem; }
  .topbar .bell.active { background: var(--green-tint); }
  .topbar .bell .count { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; display: grid; place-items: center; font-size: 12px; background: var(--amber); color: var(--on-amber); border-radius: 10px; padding: 0 5px; font-weight: 700; }
}
.item-row { cursor: pointer; }
.item-row:hover td { background: var(--paper); }
.chev { color: var(--ink-3); font-size: .85rem; }


/* =====================================================================
   Adaptive layer: the stylesheet reacts to what adapt.js senses on <html>
   (data-pointer, data-input, data-device, data-orient, data-short).
   ===================================================================== */

/* ---- touch: thumbs need room ---- */
html[data-pointer="coarse"] .btn { min-height: 44px; padding: .6em 1em; }
html[data-pointer="coarse"] .btn-sm { min-height: 40px; }
html[data-pointer="coarse"] .input, html[data-pointer="coarse"] select.input { min-height: 44px; font-size: max(1rem, 16px); }
html[data-pointer="coarse"] .ledger-list li { min-height: 52px; padding: 12px 0; }
html[data-pointer="coarse"] .ledger td { padding: 12px 8px; }
html[data-pointer="coarse"] tr.click td, html[data-pointer="coarse"] tr.item-row td { padding-top: 14px; padding-bottom: 14px; }
html[data-pointer="coarse"] .tabs button { min-height: 44px; padding: 10px 14px; }
html[data-pointer="coarse"] .nav a, html[data-pointer="coarse"] .tabbar a { min-height: 48px; }
html[data-pointer="coarse"] details.more > summary { min-height: 40px; display: flex; align-items: center; }
html[data-pointer="coarse"] .linkish { padding: 8px 4px; }
html[data-pointer="coarse"] .check input { width: 22px; height: 22px; }
html[data-pointer="coarse"] .check { min-height: 40px; }
html[data-pointer="coarse"] .proof button { padding: 10px; }
html[data-pointer="coarse"] .elsewhere a { padding: 6px 0; display: inline-block; }
html[data-pointer="coarse"] .topbar .bell { width: 44px; height: 44px; }
html[data-pointer="coarse"] .row-actions { gap: 10px; }
/* no hover on a touch screen: the states that depend on it go */
html:not([data-hover]) .ledger-list li.click:hover { background: transparent; margin: 0; padding-left: 0; padding-right: 0; }
html:not([data-hover]) .ledger tr.click:hover td, html:not([data-hover]) .item-row:hover td { background: transparent; }
html:not([data-hover]) .tip { display: none !important; }

/* ---- pen: precise but still a tip, not a cursor ---- */
html[data-input="pen"] .btn { min-height: 40px; }
html[data-input="pen"] .btn-sm { min-height: 36px; }
html[data-input="pen"] .input, html[data-input="pen"] select.input { min-height: 40px; }
html[data-input="pen"] .ledger-list li { min-height: 46px; }
html[data-input="pen"] .table-wrap { touch-action: pan-x pan-y; }
html[data-input="pen"] input[type="text"], html[data-input="pen"] input[type="number"], html[data-input="pen"] textarea { touch-action: manipulation; }

/* ---- keyboard or remote: where you are must be obvious ---- */
html[data-input="keyboard"] :focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
html[data-input="keyboard"] .ledger-list li:focus-visible, html[data-input="keyboard"] tr.click:focus-visible, html[data-input="keyboard"] tr.item-row:focus-visible { background: var(--green-tint); outline-offset: -3px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--ink); color: var(--on-ink); padding: 10px 14px; border-radius: 6px; text-decoration: none; }
.skip:focus { left: 12px; }

/* ---- short landscape screens (a phone on its side): the tab bar becomes a rail ---- */
@media (max-width: 1023px) and (orientation: landscape) and (max-height: 520px) {
  .tabbar { top: 0; right: auto; bottom: 0; width: 76px; flex-direction: column; justify-content: flex-start; border-top: 0; border-right: 1px solid var(--rule); padding: 6px 0 0; padding-left: env(safe-area-inset-left); }
  .tabbar a { flex: 0 0 auto; padding: 12px 4px; }
  .tabbar a.active::before { top: 10%; bottom: 10%; left: 0; right: auto; width: 3px; height: auto; }
  .main { padding: 10px 14px 24px calc(76px + 14px + env(safe-area-inset-left)); }
  .topbar { margin: 0 0 6px; }
  .topbar .brand-name { display: none; }
  .page-head { margin-bottom: 10px; }
  .page-head h1 { font-size: 1.2rem; }
  .sheet { padding: 12px 14px; margin-bottom: 12px; }
  .modal-back { padding: 0; align-items: stretch; }
  .modal { max-width: none; max-height: 100dvh; border-radius: 0; }
  .toast { bottom: 10px; }
  .page-head p { display: none; }
  .page-head .btn { min-height: 40px; padding: .4em .8em; }
  .float-card { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px 10px; }
  .float-card .v { font-size: 1rem; }
  .float-card .v.hero { font-size: 1.1rem; }
  .float-card .verdict { grid-column: auto; justify-self: end; }
  .sheet.flat details.more { margin-top: 4px; }
  .once-hint { display: none; }
}

/* ---- tablets: the sidebar at a width that leaves the page room ---- */
@media (min-width: 861px) and (max-width: 1100px) { .shell { --side-w: 200px; } }

/* ---- ten-foot: a TV, or any big screen with no hover (driven by a remote) ---- */
html[data-device="tv"] { font-size: clamp(20px, 1.05vw + 6px, 26px); }
html[data-device="tv"] .shell { --side-w: 320px; }
html[data-device="tv"] .main { max-width: none; padding: 2.2vw 3vw 4vw; }
html[data-device="tv"] .side { padding: 28px 18px; }
html[data-device="tv"] .nav a { padding: 14px 16px; font-size: 1.05rem; }
html[data-device="tv"] .btn { min-height: 2.6em; padding: .6em 1.1em; }
html[data-device="tv"] .ledger-list li { padding: 14px 0; }
html[data-device="tv"] .chart { height: 320px; }
html[data-device="tv"] :focus-visible { outline: 4px solid var(--focus); outline-offset: 4px; border-radius: 6px; }
html[data-device="tv"] .ledger-list li:focus-visible, html[data-device="tv"] tr:focus-visible { background: var(--green-tint); outline-offset: -4px; }
html[data-device="tv"] .nav a.active { outline: 2px solid var(--green); }
html[data-device="tv"] .install-banner, html[data-device="tv"] .once-hint { display: none; }
html[data-device="tv"] .modal { max-width: 900px; }
html[data-device="tv"] .toast { font-size: 1.1rem; padding: 14px 22px; }

/* inline links and small controls get a thumb-sized hit area on touch */
html[data-pointer="coarse"] .sheet-head a, html[data-pointer="coarse"] .hint a, html[data-pointer="coarse"] p a, html[data-pointer="coarse"] a.pill, html[data-pointer="coarse"] .elsewhere a { display: inline-flex; align-items: center; min-height: 40px; }
html[data-pointer="coarse"] .linkish { min-height: 40px; display: inline-flex; align-items: center; }
html[data-pointer="coarse"] input[type="checkbox"] { width: 24px; height: 24px; }
label.tap { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; cursor: pointer; }
html[data-pointer="coarse"] .more-body a, html[data-pointer="coarse"] .banner a { display: inline-flex; align-items: center; min-height: 40px; }

/* ---------- pull to refresh (installed app only) ---------- */
.ptr { position: fixed; top: 0; left: 50%; transform: translateY(-52px); opacity: 0; z-index: 70; margin-left: -80px; width: 160px; text-align: center;
  padding: 8px 12px; border-radius: 999px; background: var(--sheet); color: var(--ink-2); font-size: .85rem; box-shadow: var(--shadow); border: 1px solid var(--rule);
  transition: opacity .12s; pointer-events: none; top: max(8px, env(safe-area-inset-top)); }
.ptr.armed { color: var(--ink); font-weight: 600; }
@media (display-mode: standalone) { html, body { overscroll-behavior-y: contain; } }
.snap-btn.over { border-color: var(--green); background: var(--green-tint); }

/* ---------- learning: set-up checklist, welcome strip, how it works ---------- */
.setup .steps { padding-left: 0; list-style: none; gap: 0; }
.setup .steps li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--rule); }
.setup .steps li:first-child { border-top: 0; }
.setup .steps li::before { content: attr(data-n); flex: 0 0 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 600; background: var(--paper); color: var(--ink-2); }
.setup .steps li.done::before { content: '✓'; background: var(--green-tint); color: var(--green-ink); }
.setup .steps li .what { flex: 1; min-width: 0; }
.setup .steps li .what strong { display: block; }
.setup .steps li .what span { color: var(--ink-2); font-size: .9rem; }
.setup .steps li.done .what { color: var(--ink-3); }
.setup .done-line { margin: 0 0 6px; }
.setup .steps .row-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.welcome { border-color: var(--green); }
.welcome ol { margin: 0 0 4px; padding-left: 22px; display: grid; gap: 6px; color: var(--ink-2); }
.welcome ol li::marker { color: var(--green); font-weight: 600; }
ol.how { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
ol.how li::marker { color: var(--ink-3); font-weight: 600; }
@media (max-width: 560px) { .setup .steps li { display: grid; grid-template-columns: 26px 1fr; align-items: start; } .setup .steps li .row-actions { grid-column: 2; margin-top: 6px; } }

/* ---------- visual audit fixes ---------- */
/* phones: tabs and filter chips as wrapping pill buttons, so nothing hides off the edge */
@media (max-width: 600px) {
  .tabs { gap: 6px; border-bottom: 0; }
  .tabs button { border: 1px solid var(--rule-strong); border-radius: 999px; margin: 0; padding: 6px 12px; font-size: .92rem; }
  .tabs button.active { background: var(--green-tint); border-color: var(--green); color: var(--green-ink); }
}
/* one height for every single-line field, so side-by-side fields line up (incl. the iPhone date picker) */
input.input:not([type=checkbox]):not([type=radio]):not([type=file]), select.input { height: 2.75em; min-height: 0; padding-top: 0; padding-bottom: 0; line-height: 1.2; }
html[data-pointer="coarse"] input.input:not([type=checkbox]):not([type=radio]):not([type=file]), html[data-pointer="coarse"] select.input { height: 46px; min-height: 46px; }
html[data-input="pen"] input.input:not([type=checkbox]):not([type=radio]):not([type=file]), html[data-input="pen"] select.input { height: 42px; min-height: 42px; }
.ledger input.input:not([type=checkbox]):not([type=radio]), .ledger select.input { height: 2.4em; }
html[data-pointer="coarse"] .ledger input.input:not([type=checkbox]):not([type=radio]), html[data-pointer="coarse"] .ledger select.input { height: 44px; min-height: 44px; }
input.input[type=date], input.input[type=month], input.input[type=time] { -webkit-appearance: none; appearance: none; display: flex; align-items: center; text-align: left; }
input.input[type=date]::-webkit-date-and-time-value, input.input[type=month]::-webkit-date-and-time-value { text-align: left; margin: 0; }
select.input { -webkit-appearance: none; appearance: none; padding-right: 2em;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 1.1em) 50%, calc(100% - .75em) 50%; background-size: .35em .35em, .35em .35em; background-repeat: no-repeat; }
/* rows that are switched off: grey text, not a faded (unreadable) row */
tr.inactive td, tr.inactive td strong { color: var(--ink-3); }
/* phones: a table that does not fit becomes one labelled card per row */
@media (max-width: 600px) {
  .ledger td, .ledger th { padding-left: 6px; padding-right: 6px; }
  table.ledger.stacked thead { display: none; }
  table.ledger.stacked, table.ledger.stacked tbody, table.ledger.stacked tfoot, table.ledger.stacked tr { display: block; width: 100%; }
  table.ledger.stacked tbody tr { padding: 10px 0; border-bottom: 1px solid var(--rule); }
  table.ledger.stacked tbody tr:last-child { border-bottom: 0; }
  table.ledger.stacked td { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 12px; border: 0; padding: 3px 0; text-align: right; white-space: normal !important; min-width: 0; overflow-wrap: anywhere; }
  table.ledger.stacked td[data-label=""] { justify-content: flex-start; }
  table.ledger.stacked td::before { content: attr(data-label); color: var(--ink-3); font-size: .85rem; font-weight: 500; text-align: left; flex: 0 0 auto; max-width: 45%; }
  table.ledger.stacked td[data-label=""]::before { content: none; }
  table.ledger.stacked td:first-child { font-weight: 600; text-align: left; justify-content: flex-start; }
  table.ledger.stacked td:first-child::before { content: none; }
  table.ledger.stacked td > .input, table.ledger.stacked td > select { max-width: 60%; }
  table.ledger.stacked tfoot tr { display: flex; justify-content: space-between; gap: 12px; border-top: 2px solid var(--ink); padding-top: 8px; }
  table.ledger.stacked tfoot td { display: block; border: 0; padding: 0; }
  table.ledger.stacked tfoot td::before { content: none; }
  table.ledger.stacked .low td:nth-child(1) { box-shadow: none; padding-left: 0; }
  table.ledger.stacked tr.low { box-shadow: inset 3px 0 0 var(--amber); padding-left: 10px; }
}
/* phones: line editors (request lines, expense lines, stock review) – one small form per line, labelled */
@media (max-width: 600px) {
  .lines-edit table.ledger thead { display: none; }
  .lines-edit table.ledger, .lines-edit table.ledger tbody, .lines-edit table.ledger tfoot { display: block; width: 100%; }
  .lines-edit table.ledger tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
  .lines-edit table.ledger tbody td { display: flex; flex-direction: column; gap: 4px; padding: 0; border: 0; min-width: 0; text-align: left; white-space: normal; }
  .lines-edit table.ledger tbody td::before { content: attr(data-label); font-size: .8rem; font-weight: 500; color: var(--ink-3); }
  .lines-edit table.ledger tbody td[data-label=""]::before { content: none; }
  .lines-edit table.ledger tbody td:first-child { grid-column: 1 / -1; font-weight: 600; }
  .lines-edit table.ledger tbody tr { position: relative; }
  .lines-edit table.ledger tbody td { width: auto !important; }
  .lines-edit table.ledger tbody td:has(select) { grid-column: 1 / -1; }
  .lines-edit table.ledger tbody td:first-child { padding-right: 48px; }
  .lines-edit table.ledger tbody td[data-label=""]:last-child { position: absolute; top: 6px; right: 0; }
  .lines-edit table.ledger tbody td .input, .lines-edit table.ledger tbody td select { width: 100% !important; max-width: none; min-width: 0; }
  .lines-edit table.ledger tfoot tr { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding-top: 10px; border-top: 2px solid var(--ink); }
  .lines-edit table.ledger tfoot td { display: block; border: 0; padding: 0; }
}
/* even vertical rhythm: fields carry their own spacing, so rows of fields add no extra gap */
.row:has(> .field) { row-gap: 0; }
/* phones: compact tables stay tables – the arrow column goes (the whole row is tappable) and figures may wrap */
@media (max-width: 600px) {
  .ledger.compact th:last-child:empty, .ledger.compact td.chev { display: none; }
  .ledger.compact td:nth-last-child(2), .ledger.compact th:nth-last-child(2) { padding-right: 0; }
  .ledger.compact .num, .ledger.compact th.num { white-space: normal; }
  .ledger.compact td.num.amt { white-space: nowrap; }
  .ledger.compact tfoot { display: block; }
  .ledger.compact tfoot tr { display: flex; justify-content: space-between; gap: 12px; border-top: 2px solid var(--ink); padding-top: 8px; }
  .ledger.compact tfoot td { display: block; border: 0; padding: 0; }
  .ledger.compact tfoot td:empty { display: none; }
}
@media (max-width: 360px) { .ledger.compact .hide-xs { display: none; } }

/* ---------- devices ---------- */
.devices .ledger-list li .what span { white-space: normal; }
.devices .ledger-list li.this-device .what strong { color: var(--ink); }
.btn.armed { background: var(--red); border-color: var(--red); color: var(--on-red); }
.plain-list { list-style: none; margin: 4px 0 0; padding: 0; }
.plain-list li { padding: 5px 0; border-bottom: 1px solid var(--rule); font-size: .9rem; line-height: 1.4; }
.plain-list li:last-child { border-bottom: 0; }
.dev-count { white-space: nowrap; }
/* authority schedule */
.head-title { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; }
.sched-grid { display: grid; gap: 4px 20px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.sched-grid .field { margin-bottom: 10px; }
.sched-kv { grid-template-columns: minmax(0, max-content) minmax(0, 1fr); }
.sched-kv dd { font-weight: 500; overflow-wrap: anywhere; }
.pending-val { display: inline-block; margin-top: 2px; font-size: .8rem; font-weight: 600; color: var(--purple); }
.changes li s { color: var(--ink-3); }
.changes li .pill { margin-left: 4px; }
.sched-save { justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
@media (min-width: 861px) { .sched-save { position: sticky; bottom: 0; background: var(--paper); padding: 10px 0; z-index: 2; } }
.sched-version > summary { color: var(--ink); font-weight: 400; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.ledger-list li > details.sched-version { flex: 1 1 100%; margin-top: 0; min-width: 0; }
@media (max-width: 860px) { .sched-kv { grid-template-columns: 1fr; gap: 2px 0; } .sched-kv dd { margin-bottom: 8px; } }

/* ---- the MD's overview: live indicator and recommendations ---- */
.overview { display: flex; flex-direction: column; gap: 18px; margin-top: 8px; }
.overview-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.overview-head h2 { margin: 0; }
.live-ind { font-size: .8rem; color: var(--ink-3); display: inline-flex; align-items: center; gap: 6px; }
.live-ind i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); display: inline-block; }
.live-ind[data-live="on"] i { background: var(--green); animation: live-pulse 2.4s ease-out infinite; }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 rgba(27, 94, 75, .45); } 70%, 100% { box-shadow: 0 0 0 7px rgba(27, 94, 75, 0); } }
@media (prefers-reduced-motion: reduce) { .live-ind[data-live="on"] i { animation: none; } }
.recs { display: flex; flex-direction: column; gap: 8px; }
.rec { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--rule); border-left-width: 4px; border-radius: var(--radius); padding: 10px 12px; text-decoration: none; color: inherit; }
a.rec:hover { background: var(--paper); }
.rec strong { display: block; }
.rec p { margin: 2px 0 0; color: var(--ink-3); font-size: .88rem; }
.rec .dot { line-height: 1.4; }
.rec.red { border-left-color: var(--red); } .rec.red .dot { color: var(--red); }
.rec.amber { border-left-color: var(--amber); } .rec.amber .dot { color: var(--amber); }
.rec.info { border-left-color: var(--ink-3); } .rec.info .dot { color: var(--ink-3); }
.rec.green { border-left-color: var(--green); } .rec.green .dot { color: var(--green); }
.score .box { display: flex; flex-direction: column; }

/* ---- branches: the switcher for people who cover more than one ---- */
.branch-switch { font: inherit; font-size: .9rem; min-height: 40px; padding: 6px 28px 6px 10px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); color: inherit; max-width: 100%; }
html[data-pointer="coarse"] .branch-switch { min-height: 44px; }
.topbar .brand { flex: 1 1 auto; min-width: 0; }
.side .side-branch { margin: 0 0 12px; width: 100%; }
.topbar .top-branch { margin-left: auto; margin-right: 8px; max-width: 46vw; }
.topbar .top-branch + .bell { margin-left: 0; }
@media (min-width: 900px) { .topbar .top-branch { display: none; } }
@media (max-width: 899px) { .side .side-branch { display: none; } }
.branch-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.branch-pick .box { cursor: pointer; }
.branch-pick .box:hover { background: var(--paper); }
.branch-tag { font-size: .75rem; color: var(--ink-3); border: 1px solid var(--rule); border-radius: 999px; padding: 1px 8px; margin-left: 6px; white-space: nowrap; }

/* ---- KPI tiles ---- */
.score.kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.kpi { border-left-width: 4px; }
.kpi-green { border-left-color: var(--green); } .kpi-amber { border-left-color: var(--amber); } .kpi-red { border-left-color: var(--red); } .kpi-grey { border-left-color: var(--rule); }
.kpi .d { display: block; margin-top: 4px; }

/* =============================================================== loading: the Petti full stop
   The mark is the brand: a green tile with a "P" and a sand full stop. While something loads, the full stop drops
   in and lands like a stamp, the way a voucher gets settled. Used for the splash, page loads and dialogs. */
.petti-loader { display: grid; justify-items: center; gap: 14px; padding: 48px 16px; color: var(--ink-3);
  opacity: 0; animation: pl-appear .25s ease-out .18s forwards; }   /* waits a moment, so quick pages never flash it */
.petti-loader.now { animation-delay: 0s; }
.pl-mark { --s: 56px; width: var(--s); height: var(--s); border-radius: calc(var(--s) * .24); background: var(--green);
  display: grid; place-items: center; position: relative; box-shadow: 0 6px 18px -8px rgb(0 0 0 / .45); overflow: hidden; }
.pl-mark::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgb(255 255 255 / .16) 50%, transparent 70%);
  transform: translateX(-100%); animation: pl-sheen 2.4s ease-in-out infinite; }
.pl-glyph { display: inline-flex; align-items: baseline; color: #fff; font: 800 calc(var(--s) * .56) / 1 var(--font); letter-spacing: -.04em; transform: translateX(-4%); }
.pl-dot { display: inline-block; width: .2em; height: .2em; margin-left: .04em; border-radius: 50%; background: var(--sand);
  transform-origin: 50% 100%; animation: pl-stamp 1.5s cubic-bezier(.3, .7, .4, 1) infinite; }
.pl-text { font-size: .95rem; min-height: 1.4em; text-align: center; transition: opacity .25s; }
.pl-text.fade { opacity: 0; }
.petti-loader.small { padding: 24px 8px; gap: 10px; }
.petti-loader.small .pl-mark { --s: 40px; }
@keyframes pl-appear { to { opacity: 1; } }
@keyframes pl-stamp {
  0%   { transform: translateY(-1.6em) scale(.7); opacity: 0; }
  22%  { opacity: 1; }
  38%  { transform: translateY(0) scale(1.12, .88); }      /* lands */
  50%  { transform: translateY(-.12em) scale(.92, 1.08); }  /* settles */
  60%, 82% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 0; }
}
@keyframes pl-sheen { 0%, 55% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* the splash while the app itself starts */
.splash { min-height: 100vh; min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 18px; padding: 24px;
  background: var(--paper); color: var(--ink-3); text-align: center; }
.splash .pl-mark { --s: 88px; }
.splash .petti-loader { padding: 0; opacity: 1; animation: none; }
.splash-name { display: grid; gap: 2px; }
.splash-name strong { font: 800 1.6rem/1.1 var(--font); color: var(--ink); letter-spacing: -.02em; }
.splash-name strong i { font-style: normal; color: var(--sand); }
.splash-name span { font-size: .8rem; letter-spacing: .04em; }
#boot { font-size: .95rem; min-height: 1.4em; }

/* the thin line across the top while a page loads */
#nav-progress { position: fixed; top: 0; left: 0; right: 0; height: calc(3px + env(safe-area-inset-top, 0px)); padding-top: env(safe-area-inset-top, 0px);
  z-index: 60; pointer-events: none; opacity: 0; transition: opacity .3s ease .1s; }
#nav-progress::before { content: ""; display: block; height: 3px; width: var(--p, 0%); background: linear-gradient(90deg, var(--green), var(--green) 85%, var(--sand));
  border-radius: 0 3px 3px 0; box-shadow: 0 0 8px rgb(228 184 92 / .6); transition: width .35s ease; }
#nav-progress.on { opacity: 1; transition-delay: .12s; }

@media (prefers-reduced-motion: reduce) {
  .pl-dot { animation: none; } .pl-mark::after { animation: none; }
  .pl-mark { animation: pl-breathe 2s ease-in-out infinite alternate; }
  #nav-progress::before { transition: none; }
}
@keyframes pl-breathe { from { opacity: .7; } to { opacity: 1; } }

/* =============================================================== what's new */
.update-note { scroll-margin-top: 80px; }
.update-note.fresh { box-shadow: inset 3px 0 0 var(--sand); }
.update-note.focus { outline: 2px solid var(--green); outline-offset: 2px; }
.update-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 6px; }
.update-head h2 { margin: 0 0 2px; text-wrap: balance; }
.update-head .sub { color: var(--ink-3); font-size: .85rem; }
.update-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 14px 0 4px; font-weight: 600; }
.update-steps { margin: 0; padding-left: 1.3em; display: grid; gap: 6px; }
.update-steps li { padding-left: 2px; }
.update-pop h3 { margin: 0 0 4px; }
.update-pop .form-actions { flex-wrap: wrap; }

/* =============================================================== guided walk-through */
.tour { position: fixed; inset: 0; z-index: 45; pointer-events: none; }
.tour-shade { position: absolute; inset: 0; background: rgba(25,35,31,.45); }
.tour-spot { position: absolute; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(25,35,31,.5), 0 0 0 3px var(--sand); transition: left .25s, top .25s, width .25s, height .25s; }
.tour-bubble { position: absolute; pointer-events: auto; background: var(--sheet); color: var(--ink); border-radius: 10px; padding: 14px 16px; box-shadow: var(--shadow); max-width: calc(100vw - 24px); }
.tour-bubble::before { content: ""; position: absolute; top: -8px; left: 22px; border: 8px solid transparent; border-top: 0; border-bottom-color: var(--sheet); }
.tour-bubble.above::before { top: auto; bottom: -8px; border: 8px solid transparent; border-bottom: 0; border-top-color: var(--sheet); }
.tour-bubble p { margin: 4px 0 10px; font-size: .98rem; }
.tour-step { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 600; }
.tour-actions { display: flex; justify-content: flex-end; gap: 8px; }
.tour-wait .tour-bubble { left: 50%; top: 40%; transform: translateX(-50%); }
.update-pic { width: 100%; max-width: 360px; border-radius: 10px; border: 1px solid var(--rule); display: block; margin: 8px 0 4px; }
.update-pop .update-pic { max-width: 100%; }
.check-list { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 6px 0; }
.clear-ask { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--rule); }
.clear-ask textarea { flex: 1 1 100%; }

/* proof of payment */
.paper-q .paper-opt { align-items: flex-start; margin: 6px 0; font-weight: 400; }
.paper-q .paper-opt span { display: grid; gap: 1px; }
.proof-choice .row { gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .proof-choice .row { grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(180px, 1.4fr); } }
.scan-tips { margin: 12px 0; font-size: .92rem; }
.scan-tips ul { margin: 4px 0 0; padding-left: 1.2em; }
/* "Continue where you left off": forms kept on the phone */
.continue-card { border-color: var(--sand); }
.continue-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--rule); }
.continue-row:first-of-type { border-top: 0; }
.continue-link { flex: 1 1 200px; min-width: 0; color: inherit; text-decoration: none; }
/* searchable pickers: tap, type two letters, tap – the most-used first */
.picker { position: relative; }
.picker-native { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.picker-face { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; cursor: pointer; background: var(--sheet); color: var(--ink); }
.picker-face .picker-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-face .picker-label.muted { color: var(--ink-3); }
.picker-face .picker-chev { color: var(--ink-3); transition: transform .15s; }
.picker.open .picker-chev { transform: rotate(180deg); }
.picker-panel { margin-top: 6px; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--sheet); padding: 6px; box-shadow: var(--shadow); }
.picker-search { width: 100%; margin-bottom: 6px; }
.picker-list { max-height: 280px; overflow-y: auto; overscroll-behavior: contain; }
.picker-group { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); padding: 8px 8px 4px; }
.picker-opt { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 4px; padding: 10px 8px; min-height: 40px; color: var(--ink); font: inherit; cursor: pointer; }
.picker-opt.active { background: var(--green-tint); }
.picker-opt.chosen { font-weight: 600; }
.picker-empty { padding: 10px 8px; color: var(--ink-3); }
/* one tap: earlier requests to repeat, suggestions while typing, and what was filled in */
.again { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: -4px 0 14px; }
.again .k { font-size: .82rem; color: var(--ink-3); width: 100%; }
.again-chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--rule-strong); background: var(--sheet); color: var(--ink); border-radius: 999px; padding: 8px 14px; font: inherit; font-size: .9rem; cursor: pointer; min-height: 40px; max-width: 100%; white-space: nowrap; }
.again-chip .p { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.again-chip .amt { color: var(--ink-3); flex: none; }
.again-chip:hover { border-color: var(--green); }
.suggest { border: 1px solid var(--rule); border-radius: var(--radius); margin-top: 4px; overflow: hidden; }
.suggest-opt { display: flex; gap: 8px; justify-content: space-between; align-items: baseline; width: 100%; text-align: left; background: var(--sheet); border: 0; border-top: 1px solid var(--rule); padding: 10px 12px; min-height: 40px; font: inherit; color: var(--ink); cursor: pointer; }
.suggest-opt:first-child { border-top: 0; }
.suggest-opt:hover, .suggest-opt:focus-visible { background: var(--green-tint); }
.suggest-opt .muted { font-size: .82rem; white-space: nowrap; }
.filled-from { font-size: .88rem; color: var(--green-ink); margin-top: 4px; }
/* the old address says where Petti lives now */
.moved-bar { position: sticky; top: 0; z-index: 80; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: center; padding: 10px 16px; background: var(--sand); color: #19231f; font-size: .92rem; text-align: center; }
.moved-bar .btn { white-space: nowrap; }
