/* Same look as the Trip Expense app: dark, flat, amber accent. */
:root {
  --bg: #000; --card: #161616; --line: #3a3a3a; --text: #fff; --muted: #b5b5b5;
  --accent: #ffb000; --on-accent: #241800; --over: #ff5252; --radius: 6px; --top-clear: 0px;
  color-scheme: dark;
}
@supports (-webkit-touch-callout: none) {
  @media (display-mode: standalone) and (orientation: portrait) and (min-height: 700px) { :root { --top-clear: 40px; } }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; background: var(--bg); }
body { color: var(--text); font: 16px/1.35 system-ui, -apple-system, sans-serif; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: 0.3; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
#app { position: fixed; inset: 0; display: flex; flex-direction: column; padding: calc(env(safe-area-inset-top) + var(--top-clear)) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
main { flex: 1; min-height: 0; max-width: 520px; width: 100%; margin: 0 auto; }
.screen { height: 100%; padding: 0 12px; }
.scroll { overflow-y: auto; padding-bottom: 24px; }
.scroll > *, .sheet-body > *, form > *, .view > *, .card > * { margin-top: 8px; }
.scroll > h2, .view > h2 { margin-top: 20px; }
h1 { font-size: 24px; margin-top: 12px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; color: var(--muted); }
.muted { color: var(--muted); }
.warning { border-left: 3px solid var(--accent); padding-left: 10px; }
.icon { width: 24px; height: 24px; flex: none; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; min-width: 44px; padding: 8px 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--text); }
.btn:active { background: var(--line); }
.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.primary .icon { stroke: var(--on-accent); }
.primary:active { background: var(--accent); opacity: 0.8; }
.danger { color: var(--over); }
.wide { display: flex; width: 100%; }
.grow { flex: 1; }
.square { padding: 0; width: 48px; }

input, select, textarea { display: block; width: 100%; min-height: 48px; padding: 8px 10px; font-size: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); -webkit-appearance: none; appearance: none; }
textarea { min-height: 0; padding: 10px; resize: none; line-height: 1.4; }
.field > span { display: block; margin: 4px 0; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pair > * { min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.card input, .card select, .card .btn { background: var(--bg); }
.card .primary { background: var(--accent); }
.card.dim .what { opacity: 0.5; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.empty { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 12px; text-align: center; }
.login { padding-top: 12vh; }

/* Add */
.kids { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; margin-top: 12px; }
.kids .btn { min-height: 56px; font-size: 18px; border-bottom: 5px solid var(--accent); }
.display { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 8px 0; }
.display small { font-size: 32px; color: var(--accent); }
.display .amount { width: auto; flex: 1; min-width: 0; border: 0; background: none; text-align: right; color: var(--accent); font-size: 52px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; padding: 0; }
.display .amount::placeholder { color: var(--line); }
.hint { text-align: center; font-size: 14px; }
.categories { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.category { min-height: 64px; font-size: 17px; font-weight: 600; text-align: center; }

/* Summary */
.month { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.month h1 { margin: 0; font-size: 20px; text-align: center; }
.stat.main b { display: block; font-size: 44px; color: var(--accent); }
.kid-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.kid-head b { font-size: 22px; color: var(--accent); }
.bar { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; }
.bar > div { grid-column: 1 / -1; height: 8px; background: var(--bg); border-radius: var(--radius); }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: var(--radius); }

/* History */
.list > * { margin-top: 8px; }
.group { display: flex; justify-content: space-between; align-items: baseline; margin-top: 20px !important; }
.row { display: flex; width: 100%; min-height: 56px; justify-content: space-between; text-align: left; }
.row .what { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.row small { display: block; }
.row .money { white-space: nowrap; }
.item { display: flex; flex-direction: column; }

/* Tabs, sheets, toast */
.tabbar { flex: none; display: flex; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar .btn { flex: 1; flex-direction: column; gap: 0; height: 54px; padding: 5px; background: none; border: 0; border-radius: 0; color: var(--muted); font-size: 12px; }
.tabbar .icon { stroke: var(--muted); }
.tabbar .on { color: var(--accent); font-weight: 700; }
.tabbar .on .icon { stroke: var(--accent); }
.sheet { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; background: var(--bg); padding: calc(env(safe-area-inset-top) + var(--top-clear)) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
.sheet-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border-bottom: 4px solid var(--accent); width: 100%; max-width: 520px; margin: 0 auto; }
.sheet-head h2 { color: var(--accent); }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; width: 100%; max-width: 520px; margin: 0 auto; padding: 4px 12px calc(24px + env(safe-area-inset-bottom)); }
.toast { position: fixed; z-index: 20; bottom: calc(env(safe-area-inset-bottom) + 62px); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; width: calc(100% - 16px); max-width: 504px; padding: 6px 6px 6px 12px; background: var(--card); border: 2px solid var(--accent); border-radius: var(--radius); }
.toast span { flex: 1; min-width: 0; font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.toast.error { border-color: var(--over); }

/* Colour theme picker */
.swatches { display: grid; grid-template-columns: repeat(auto-fit, minmax(44px, 1fr)); gap: 8px; }
.btn.swatch { height: 48px; padding: 0; border: 2px solid transparent; font-size: 22px; font-weight: 700; }
.btn.swatch.selected { border-color: var(--text); }
