/* Family Finance — the SSL v2 daylight palette (tokens.js), as CSS variables.
   Hairlines not shadows, 52px tap targets, 17px base type, one green primary
   per screen, monospace digits. Dark follows the phone. */
:root {
  --ground:#F7F5F0; --card:#FFFFFF; --sunken:#EFECE5; --ink:#191C19; --body:#3A3E38; --muted:#71756D;
  --line:#E2DFD7; --line2:#D6D3C9; --go:#0B6B4F; --goInk:#FFFFFF; --gold:#8A6A1F; --goldBg:#F4ECD8;
  --red:#B3261E; --redBg:#F9E5E2; --amb:#935F0C; --ambBg:#F7EDD6; --ok:#256E4A; --okBg:#E1EFE7;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --ground:#14171A; --card:#1C2024; --sunken:#101316; --ink:#ECEEE9; --body:#C9CCC5; --muted:#8C918A;
  --line:#2A2F33; --line2:#343A3F; --go:#3FBF95; --goInk:#0C1F19; --gold:#D8B45B; --goldBg:#2E2717;
  --red:#F08C82; --redBg:#3A211E; --amb:#E0AE5C; --ambBg:#332A18; --ok:#6CC49A; --okBg:#1C2F26;
} }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--body); font: 17px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px; }
#top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
#top .wrap { display: flex; justify-content: space-between; align-items: center; height: 52px; }
#title { font-weight: 700; color: var(--ink); }
#who { color: var(--muted); font-size: 14px; }
main { padding-top: 14px; }
h1 { font-size: 24px; color: var(--ink); margin: 6px 0 2px; font-weight: 700; }
h2 { font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 22px 0 8px; font-weight: 600; }
.sub { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 14px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.row:first-child { border-top: 0; }
.row.tap { cursor: pointer; }
.row.tap:hover { background: var(--sunken); }
.row .main { flex: 1; min-width: 0; }
.row .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .s { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { font-family: ui-monospace, 'Cascadia Mono', Consolas, 'Roboto Mono', Menlo, monospace; font-variant-numeric: tabular-nums; white-space: nowrap; }
.amt { font-weight: 600; text-align: right; }
.in { color: var(--ok); } .out { color: var(--ink); } .neg { color: var(--red); }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.kpi .n { font-size: 22px; font-weight: 700; color: var(--ink); }
.kpi .l { font-size: 13px; color: var(--muted); }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--sunken); color: var(--muted); }
.pill.ok { background: var(--okBg); color: var(--ok); } .pill.amb { background: var(--ambBg); color: var(--amb); } .pill.red { background: var(--redBg); color: var(--red); } .pill.gold { background: var(--goldBg); color: var(--gold); }
button, .btn { font: inherit; min-height: 52px; border-radius: 12px; border: 1px solid var(--line2); background: var(--card); color: var(--ink); padding: 0 18px; cursor: pointer; width: 100%; font-weight: 600; }
button.go { background: var(--go); color: var(--goInk); border-color: var(--go); }
button.small { min-height: 40px; width: auto; padding: 0 14px; font-size: 14px; }
button.danger { color: var(--red); }
button:disabled { opacity: .5; cursor: default; }
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 4px; }
input, select, textarea { font: inherit; width: 100%; min-height: 52px; border: 1px solid var(--line2); border-radius: 12px; padding: 10px 14px; background: var(--card); color: var(--ink); }
input[type=file] { padding: 12px; }
textarea { min-height: 72px; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--go); outline-offset: 1px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; width: auto; padding: 0 14px; border-radius: 999px; font-weight: 500; }
.chip.on { background: var(--go); color: var(--goInk); border-color: var(--go); }
.big { font-size: 28px; font-weight: 700; text-align: right; }
.err { background: var(--redBg); color: var(--red); border-radius: 12px; padding: 12px 14px; margin: 12px 0; }
.note { background: var(--goldBg); color: var(--gold); border-radius: 12px; padding: 12px 14px; margin: 12px 0; font-size: 14px; }
.aside { color: var(--muted); font-size: 13px; margin: 12px 2px; }
.stack > * + * { margin-top: 10px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; border-top: 0; }
td.num, th.num { text-align: right; }
.scroll { overflow-x: auto; }
#tabs[hidden] { display: none; }
#tabs { position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); border-top: 1px solid var(--line); display: flex; padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
#tabs a { flex: 1; text-align: center; padding: 14px 0; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; }
#tabs a.on { color: var(--go); }
#tabs a.add { color: var(--go); }
#toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--ground); padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 9; }
.login { max-width: 360px; margin: 60px auto; }
.photo { max-width: 100%; border-radius: 12px; border: 1px solid var(--line); }
details summary { cursor: pointer; color: var(--muted); font-size: 14px; padding: 8px 0; }
@media (min-width: 960px) { .wrap { max-width: 900px; } .kpis { grid-template-columns: repeat(4, 1fr); } }
