:root {
  --bg: #f6f7f5; --card: #ffffff; --text: #17201d; --muted: #66716d; --line: #e3e7e4;
  --brand: #0f766e; --brand-soft: #e3f3f1; --ok: #15803d; --warn: #b45309; --bad: #b91c1c;
  --ok-soft: #e7f6ec; --warn-soft: #fdf2e2; --bad-soft: #fde8e8; --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1413; --card: #182120; --text: #e8eeec; --muted: #9aa7a3; --line: #27322f;
    --brand: #2dd4bf; --brand-soft: #123532; --ok: #4ade80; --warn: #fbbf24; --bad: #f87171;
    --ok-soft: #12301f; --warn-soft: #3a2a0f; --bad-soft: #3b1515;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
button, input, select { font: inherit; color: inherit; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 6px; padding-top: calc(14px + env(safe-area-inset-top)); max-width: 560px; margin: 0 auto; }
.brand { display: flex; gap: 8px; align-items: center; font-weight: 700; font-size: 19px; }
main { max-width: 560px; margin: 0 auto; padding: 8px 16px 24px; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
h2 { font-size: 15px; margin: 0 0 10px; color: var(--muted); font-weight: 600; }
.hero { text-align: center; padding: 22px 16px; }
.hero .label { font-size: 15px; color: var(--muted); }
.hero .big { font-size: 52px; font-weight: 800; letter-spacing: -1px; line-height: 1.1; margin: 6px 0; font-variant-numeric: tabular-nums; }
.hero.ok { background: var(--ok-soft); } .hero.ok .big { color: var(--ok); }
.hero.warn { background: var(--warn-soft); } .hero.warn .big { color: var(--warn); }
.hero.bad { background: var(--bad-soft); } .hero.bad .big { color: var(--bad); }
.bar { position: relative; height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 12px 0 6px; }
.bar > i { position: absolute; inset: 0 auto 0 0; background: var(--brand); border-radius: 99px; }
.bar > b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); opacity: .55; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .r { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.row .l { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.row.click { cursor: pointer; }
.pos { color: var(--ok); } .neg { color: var(--text); } .dim { opacity: .55; }
.btn { display: block; width: 100%; padding: 14px; border-radius: 14px; border: 0; background: var(--brand); color: #fff; font-weight: 700; font-size: 17px; cursor: pointer; }
@media (prefers-color-scheme: dark) { .btn { color: #062b27; } }
.btn.ghost { background: var(--brand-soft); color: var(--brand); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn + .btn { margin-top: 10px; }
.btn-row { display: flex; gap: 10px; } .btn-row .btn + .btn { margin-top: 0; }
.link { background: none; border: 0; color: var(--brand); font-weight: 600; cursor: pointer; padding: 6px 0; }
label { display: block; font-size: 14px; color: var(--muted); margin: 12px 0 4px; }
input, select { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
input.amount { font-size: 34px; font-weight: 800; text-align: center; padding: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip { padding: 8px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; font-size: 14px; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
@media (prefers-color-scheme: dark) { .chip.on { color: #062b27; } }
.seg { display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: none; padding: 9px; border-radius: 9px; cursor: pointer; font-size: 14px; }
.seg button.on { background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 600; }
.tabs { 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); z-index: 5; }
.tabs button { flex: 1; border: 0; background: none; padding: 9px 0 10px; font-size: 12px; color: var(--muted); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tabs button span { font-size: 18px; line-height: 1; }
.tabs button.on { color: var(--brand); font-weight: 700; }
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet-card { background: var(--card); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
.sheet-card h3 { margin: 0 0 6px; font-size: 19px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + env(safe-area-inset-bottom)); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; z-index: 20; font-size: 14px; max-width: calc(100% - 32px); }
.fab { position: fixed; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; font-size: 30px; box-shadow: 0 6px 18px rgba(0,0,0,.2); cursor: pointer; z-index: 4; }
@media (min-width: 600px) { .fab { right: calc(50% - 264px); } }
@media (prefers-color-scheme: dark) { .fab { color: #062b27; } }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.stat b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); margin-left: 6px; }
.empty { text-align: center; color: var(--muted); padding: 26px 8px; }
.steps { display: flex; gap: 6px; margin-bottom: 14px; } .steps i { flex: 1; height: 4px; border-radius: 9px; background: var(--line); } .steps i.on { background: var(--brand); }
.imp-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.imp-row select { padding: 6px; font-size: 13px; width: auto; }
.imp-row input[type=checkbox] { width: 20px; height: 20px; }
.nav-period { display: flex; justify-content: space-between; align-items: center; }
.nav-period button { background: var(--card); border: 1px solid var(--line); border-radius: 10px; width: 40px; height: 36px; cursor: pointer; }
.brand-sub { font-weight: 500; color: var(--muted); }
