:root {
  --bg: #f4f5f8; --card: #fff; --text: #1d1f24; --mute: #8a8f99; --line: #e6e8ee;
  --brand: #4f7cff; --pos: #1f9d55; --neg: #e5484d; --bar: #4f7cff;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111317; --card: #1b1e24; --text: #eceef2; --mute: #8d93a0; --line: #2a2e36; --brand: #6f95ff; --pos: #3ccf7a; --neg: #ff6b6f; --bar: #6f95ff; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 system-ui, -apple-system, "Noto Sans SC", sans-serif; }
main { max-width: 560px; margin: 0 auto; padding: 12px 16px 96px; }
h2, h3 { margin: 18px 0 8px; } h3 { font-size: 15px; color: var(--mute); } h4 { margin: 12px 0 4px; color: var(--mute); font-size: 13px; }
small { display: block; color: var(--mute); font-size: 12px; }
button, .btn { font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 10px; padding: 9px 12px; cursor: pointer; text-decoration: none; text-align: center; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
button.link { border: 0; background: none; padding: 4px; }
.danger { color: var(--neg) !important; }
.wide { display: block; width: 100%; margin: 12px 0; }
.mini { padding: 4px 8px; font-size: 13px; margin-left: 6px; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.btns button { flex: 1 1 auto; }
input, select, textarea { font: inherit; width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); }
textarea { font-size: 12px; }
label { display: block; margin: 10px 0; color: var(--mute); font-size: 13px; }
label input, label select { margin-top: 4px; }
label.check { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 15px; }
label.check input { width: auto; margin: 0; }
.hint { color: var(--mute); font-size: 13px; margin: 6px 0; }
.empty { text-align: center; color: var(--mute); padding: 32px 0; }

.month { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.month button { border: 0; background: none; font-size: 22px; padding: 4px 14px; }
.head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.head a { color: var(--brand); text-decoration: none; }
.banner { display: block; width: 100%; background: #fff4e5; color: #8a5300; border-color: #f5d5a0; margin-bottom: 10px; }
@media (prefers-color-scheme: dark) { .banner { background: #3a2a10; color: #ffc46b; border-color: #5a4220; } }

.card { background: var(--card); border-radius: 14px; padding: 12px 14px; margin: 10px 0; display: block; color: inherit; text-decoration: none; }
.card.total b { font-size: 22px; display: block; margin: 2px 0; }
.cards.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.cards.three > div { background: var(--card); border-radius: 14px; padding: 10px 8px; min-width: 0; }
.cards.three .amt { display: block; font-size: 13px; font-weight: 600; text-align: left; overflow: hidden; text-overflow: ellipsis; }
.amt { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.amt small { text-align: right; }
.pos { color: var(--pos); } .neg { color: var(--neg); } .mute { color: var(--mute); }

.day { display: flex; justify-content: space-between; color: var(--mute); font-size: 13px; margin: 16px 2px 6px; }
.list { background: var(--card); border-radius: 14px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .grow b { font-weight: 500; }
.row .grow small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.rule { flex-wrap: wrap; } .row.rule b { flex: 1 1 100%; } .row.rule select { flex: 1 1 30%; padding: 6px; font-size: 13px; }
.row input { padding: 6px 8px; } .row input.pct { width: 70px; }
.row select { width: auto; max-width: 40%; padding: 6px; font-size: 13px; }
.ico { width: 32px; height: 32px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; color: var(--mute); flex: none; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }

.tabs { display: flex; background: var(--card); border-radius: 12px; padding: 4px; margin-bottom: 10px; }
.tabs a { flex: 1; text-align: center; padding: 8px 4px; border-radius: 9px; color: var(--mute); text-decoration: none; cursor: pointer; font-size: 14px; }
.tabs a.on { background: var(--brand); color: #fff; }
.quick { font-size: 17px; padding: 14px; border: 2px solid var(--brand); margin-bottom: 4px; }
.line { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px; margin: 8px 0; background: var(--card); border-radius: 12px; position: relative; }
.line .big, .line input:first-child:not(.big) { grid-column: 1 / -1; }
.line .mini { position: absolute; top: 6px; right: 6px; }
input.big { font-size: 24px; font-weight: 600; text-align: right; }
.sp { background: var(--card); border-radius: 12px; padding: 4px 12px; margin: 10px 0; }

.bar { height: 6px; background: var(--line); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--bar); border-radius: 3px; }
.plan b { display: block; }
.donut { display: flex; gap: 14px; align-items: center; background: var(--card); border-radius: 14px; padding: 12px; margin: 10px 0; }
.donut svg { width: 130px; flex: none; }
.donut text { fill: var(--text); font-size: 10px; font-weight: 600; }
.legend { display: flex; flex-direction: column; gap: 4px; font-size: 12px; min-width: 0; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.chart { width: 100%; background: var(--card); border-radius: 14px; padding: 8px; }
.chart rect { fill: var(--bar); } .chart text { fill: var(--mute); font-size: 8px; }
details { background: var(--card); border-radius: 14px; padding: 10px 14px; margin: 10px 0; }
details summary { font-weight: 600; cursor: pointer; padding: 4px 0; }
details .list { background: var(--bg); }

nav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: space-around; align-items: center; background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
nav a { color: var(--mute); text-decoration: none; font-size: 13px; padding: 8px 10px; }
nav a.on { color: var(--brand); font-weight: 600; }
nav a.plus { background: var(--brand); color: #fff; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; padding: 0; margin-top: -18px; box-shadow: 0 4px 12px rgb(0 0 0 / 0.2); }
