:root {
  --bg: #f6f7f9; --card: #fff; --ink: #1b1f24; --muted: #6b7380; --line: #e3e6eb;
  --accent: #0b6b57; --accent-ink: #fff; --neg: #b3261e; --pos: #0b6b57;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
header { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 10px 14px 6px;
  padding-top: calc(10px + env(safe-area-inset-top)); border-bottom: 1px solid var(--line); }
.month-nav { display: flex; align-items: center; justify-content: space-between; }
.month-nav h1 { font-size: 18px; margin: 0; text-transform: capitalize; }
.month-nav button { font-size: 26px; width: 44px; height: 40px; border: 0; background: none; color: var(--accent); }
.who { font-size: 13px; color: var(--muted); text-align: center; padding-bottom: 4px; }
.who select { font-size: 13px; padding: 2px 6px; }
main { max-width: 640px; margin: 0 auto; padding: 12px; }
.tab { display: none; } .tab.active { display: block; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
h2 { font-size: 15px; margin: 0 0 10px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
input, select { width: 100%; margin-top: 4px; padding: 11px 12px; font-size: 16px; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 10px; }
select[multiple] { padding: 4px; }
button { font: inherit; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.danger { color: var(--neg); }
form > button.primary { width: 100%; }
.row { display: flex; gap: 8px; align-items: stretch; margin-bottom: 10px; }
.row input { margin-top: 0; }
.row button { flex: none; }
.seg { display: flex; gap: 8px; margin-bottom: 12px; }
.seg label { flex: 1; margin: 0; }
.seg input { display: none; }
.seg span { display: block; text-align: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.msg { min-height: 1.2em; margin: 8px 0 0; font-size: 14px; color: var(--accent); }
.msg.err { color: var(--neg); }
.hint { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.totals span { display: block; font-size: 12px; color: var(--muted); }
.totals strong { font-size: 16px; }
.neg { color: var(--neg); } .pos { color: var(--pos); }
.cat { margin-bottom: 10px; }
.cat .top { display: flex; justify-content: space-between; font-size: 14px; }
.bar { height: 8px; background: #edf0f3; border-radius: 99px; overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .main { min-width: 0; }
.list .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .s { font-size: 12px; color: var(--muted); }
.list .amt { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
.list.tx li { cursor: pointer; }
.empty { color: var(--muted); font-size: 14px; }
.preview-wrap { overflow-x: auto; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 12px; }
td, th { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
nav { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
nav button { flex: 1; border: 0; border-radius: 0; background: none; padding: 16px 4px; font-size: 13px; color: var(--muted); }
nav button.active { color: var(--accent); font-weight: 700; }
dialog { border: 0; border-radius: 16px; padding: 16px; width: min(92vw, 420px); }
dialog::backdrop { background: rgba(0, 0, 0, .35); }
