/* Stokkie: shweshwe indigo + the treasurer's ledger. System fonts only, to keep data low. */
:root {
  --ink: #22337A; --ink-deep: #18245A; --ink-soft: #E7EAF6;
  --paper: #F3F4F1; --card: #FFFFFF; --fg: #171A2C; --muted: #5D6277; --line: #DEE0E8;
  --ochre: #C98F12; --ochre-soft: #FBF1DA;
  --paid: #1E7A4B; --paid-soft: #E1F2E8; --part: #A65F00; --part-soft: #FCEBD3; --owes: #B3261E; --owes-soft: #FBE3E1;
  --wa: #17914A; --on-ink: #FFFFFF; --scrim: rgba(10,12,25,.45);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root {
  --ink: #4A5FC0; --ink-deep: #1A2452; --ink-soft: #232B4D;
  --paper: #111321; --card: #1A1D2E; --fg: #ECEDF4; --muted: #A1A6BC; --line: #2C3047;
  --ochre: #E5B03F; --ochre-soft: #3A2F14;
  --paid: #5CCB8E; --paid-soft: #183527; --part: #F0A64A; --part-soft: #3B2A12; --owes: #F27A72; --owes-soft: #3D1A1A;
  --wa: #2FB865; --scrim: rgba(0,0,0,.6); color-scheme: dark;
} }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--fg); font: 16px/1.45 var(--font); -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--ochre); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

.shell { max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
main { flex: 1; padding-bottom: 84px; }

.head { background-color: var(--ink-deep); color: var(--on-ink); padding: 16px 16px 20px;
  background-image:
    radial-gradient(circle, rgba(255,255,255,.16) 1.4px, transparent 1.8px),
    radial-gradient(circle, rgba(255,255,255,.08) 3.5px, transparent 4px),
    linear-gradient(45deg, transparent 46%, rgba(255,255,255,.07) 47% 53%, transparent 54%),
    linear-gradient(-45deg, transparent 46%, rgba(255,255,255,.07) 47% 53%, transparent 54%);
  background-size: 18px 18px; background-position: 0 0, 9px 9px, 0 0, 0 0; }
.head .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; }
.head .top a, .head .top button { color: var(--on-ink); opacity: .85; text-decoration: none; background: none; border: 0; padding: 6px 0; }
.head h1 { font-size: 24px; font-weight: 800; margin: 6px 0 2px; letter-spacing: -.01em; line-height: 1.2; }
.head .sub { font-size: 14px; opacity: .8; }
.head .big { font-size: 34px; font-weight: 800; line-height: 1.05; }
.head .k { font-size: 12.5px; opacity: .78; }
.balance { margin-top: 14px; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.pill { background: rgba(255,255,255,.16); border-radius: 99px; padding: 2px 10px; font-size: 12px; font-weight: 600; }

.body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.pad { padding: 14px 16px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.label { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
h2 { font-size: 18px; margin: 0; }
p { margin: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 14px; padding: 12px 16px; font-weight: 700; background: var(--ink); color: var(--on-ink); min-height: 48px; text-decoration: none; text-align: center; }
.btn.ghost { background: var(--card); color: var(--fg); border: 1px solid var(--line); }
.btn.wa { background: var(--wa); color: #fff; }
.btn.ochre { background: var(--ochre); color: #1d1503; }
.btn.danger { background: var(--owes); color: #fff; }
.btn.small { min-height: 40px; padding: 8px 12px; font-size: 14px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.linkish { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; font-size: 14px; }

.period { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.period strong { font-size: 18px; }
.arrow { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 20px; }
.arrow:disabled { opacity: .3; cursor: default; }
.progress { height: 10px; border-radius: 99px; background: var(--ink-soft); overflow: hidden; margin-top: 10px; display: flex; }
.progress i { display: block; height: 100%; background: var(--paid); }
.progress i.p { background: var(--part); }
.pmeta { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); margin-top: 8px; }

.callout { display: flex; align-items: center; gap: 12px; background: var(--ochre-soft); border: 1px solid color-mix(in srgb, var(--ochre) 40%, transparent); }
.callout .ic { width: 40px; height: 40px; border-radius: 12px; background: var(--ochre); color: #1d1503; display: grid; place-items: center; font-weight: 800; flex: none; }
.callout > div { min-width: 0; }
.callout b { display: block; }

.list { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border: 0; border-top: 1px solid var(--line); width: 100%; background: none; text-align: left; min-height: 60px; }
.list > li:first-child > .row, .list > .row:first-child { border-top: 0; }
.av { width: 38px; height: 38px; border-radius: 50%; background: var(--ink-soft); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.who { flex: 1; min-width: 0; }
.who b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who span { display: block; font-size: 13px; color: var(--muted); }
.chip { font-size: 12.5px; font-weight: 700; padding: 4px 10px; border-radius: 99px; white-space: nowrap; }
.chip.paid { background: var(--paid-soft); color: var(--paid); }
.chip.part { background: var(--part-soft); color: var(--part); }
.chip.owes { background: var(--owes-soft); color: var(--owes); }
.chip.next { background: var(--ochre-soft); color: var(--ochre); }
.chip.upcoming, .chip.none, .chip.mute { background: var(--ink-soft); color: var(--muted); }
.section-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 14px 16px 6px; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
.tabs nav { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); }
.tabs a { padding: 9px 4px 8px; font-size: 12px; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 3px; text-decoration: none; }
.tabs svg { width: 22px; height: 22px; }
.tabs a[aria-current="page"] { color: var(--fg); }

.hist li { padding: 12px 16px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
.hist li:first-child { border-top: 0; }
.hist .t { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.hist .d { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.struck { text-decoration: line-through; text-decoration-color: var(--owes); color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 6px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--paper); color: var(--fg); min-height: 48px; }
textarea.input { min-height: 120px; resize: vertical; }
.money { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; background: var(--paper); }
.money span { font-weight: 700; color: var(--muted); }
.money input { border: 0; background: transparent; font-size: 20px; font-weight: 700; padding: 10px 6px; width: 100%; outline: none; min-height: 48px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 10px 14px; font-weight: 600; min-height: 44px; }
.seg button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink-soft); box-shadow: inset 0 0 0 1px var(--ink); }
.types { display: grid; grid-template-columns: 1fr; gap: 8px; }
.types button { text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 12px 14px; }
.types button b { display: block; }
.types button span { font-size: 14px; color: var(--muted); }
.types button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink-soft); box-shadow: inset 0 0 0 1px var(--ink); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; }
.err { background: var(--owes-soft); color: var(--owes); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.warn { background: var(--part-soft); color: var(--part); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.okbox { background: var(--paid-soft); color: var(--paid); border-radius: 12px; padding: 10px 12px; font-size: 14px; }

.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); width: 100%; max-width: 560px; border-radius: 22px 22px 0 0; padding: 8px 18px calc(22px + env(safe-area-inset-bottom, 0px)); max-height: 90vh; max-height: 90dvh; overflow-y: auto; }
.grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 4px auto 12px; }
.sheet h3 { font-size: 21px; margin: 0 0 2px; }
.sheet .lead { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.kv:first-child { border-top: 0; }
.kv > span:first-child { color: var(--muted); }
.kv > span:last-child { font-weight: 600; text-align: right; }
table.ledger { width: 100%; border-collapse: collapse; }
.ledger td, .ledger th { padding: 10px 16px; border-top: 1px solid var(--line); text-align: left; font-size: 15px; }
.ledger th { font-size: 12px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); border-top: 0; }
.ledger td:last-child, .ledger th:last-child { text-align: right; }

.toast { position: fixed; left: 16px; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); max-width: 528px; margin: 0 auto; background: var(--fg); color: var(--paper); border-radius: 14px; padding: 12px 14px; font-size: 15px; z-index: 30; }
.center { text-align: center; }
.brand { font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.owe-box { border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.owe-box.owes { background: var(--owes-soft); } .owe-box.paid { background: var(--paid-soft); } .owe-box.part { background: var(--part-soft); }
.owe-box .big { font-size: 30px; font-weight: 800; line-height: 1.1; }
.owe-box.owes .big { color: var(--owes); } .owe-box.paid .big { color: var(--paid); } .owe-box.part .big { color: var(--part); }
.subtabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--ink-soft); padding: 4px; border-radius: 12px; }
.subtabs button { border: 0; background: none; border-radius: 9px; padding: 10px; font-weight: 600; font-size: 14px; color: var(--muted); }
.subtabs button[aria-pressed="true"] { background: var(--card); color: var(--fg); }
.footer-ad { text-align: center; font-size: 14px; color: var(--muted); padding: 8px 0 24px; }
.mini-btns { display: flex; gap: 6px; flex: none; }
.mini-btns button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); }
