[hidden] { display: none !important; }
:root {
  --bg: #f4f5f7; --card: #fff; --fg: #15171c; --muted: #6b7280; --line: #e5e7eb;
  --accent: #2f6df6; --out: #15171c; --in: #13a35a; --warn: #e5484d; --chip: #eef0f3;
  --r: 14px; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.04);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1115; --card: #181b21; --fg: #eef0f3; --muted: #8b93a1; --line: #262a33;
          --accent: #5b8cff; --out: #eef0f3; --in: #3ccf7f; --chip: #222630; --shadow: none; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); font-size: 15px; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, .amt { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.error { color: var(--warn); min-height: 1.2em; font-size: 14px; }
.center { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; margin: 0 12px 12px; }
.login { width: min(360px, 100%); margin: 0; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.login h1 { margin: 4px 0 0; font-size: 26px; }
input, select, textarea { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.btn { border: 0; border-radius: 10px; padding: 12px 16px; background: var(--chip); cursor: pointer; font-weight: 600; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.danger { color: var(--warn); }
.btn.small { padding: 7px 12px; font-size: 14px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }

/* header */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
       padding: calc(10px + env(safe-area-inset-top)) 12px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent);
       backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.month { font-weight: 700; font-size: 17px; text-transform: capitalize; }
.icon { border: 0; background: var(--chip); width: 36px; height: 36px; border-radius: 50%; font-size: 22px; line-height: 1; cursor: pointer; }

/* hero */
.hero { padding: 18px 16px; }
.hero .label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.hero .value { font-size: 38px; font-weight: 750; letter-spacing: -.02em; margin: 2px 0 10px; }
.hero .value small { font-size: 20px; color: var(--muted); font-weight: 600; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpi { background: var(--chip); border-radius: 10px; padding: 8px 10px; }
.kpi b { display: block; font-size: 15px; }
.kpi span { font-size: 12px; color: var(--muted); }
.other-cur { margin-top: 8px; font-size: 13px; color: var(--muted); }
.alert { background: color-mix(in srgb, var(--accent) 12%, var(--card)); color: var(--fg); cursor: pointer; }

/* chart */
.chart { display: flex; align-items: flex-end; gap: 2px; height: 110px; padding-top: 8px; }
.chart .bar { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; position: relative; }
.chart .bar.empty { background: var(--line); }
.chart .bar.today { opacity: 1; outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.chart-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 24px 8px; font-weight: 600; }

/* lists */
.list { padding: 4px 0; }
.item { display: flex; align-items: center; gap: 12px; padding: 10px 16px; cursor: pointer; }
.item + .item { border-top: 1px solid var(--line); }
.item .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--chip); flex: none; font-size: 18px; }
.item .main { flex: 1; min-width: 0; }
.item .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .s { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .amt { font-weight: 650; white-space: nowrap; text-align: right; }
.item .amt.in { color: var(--in); }
.item .amt small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.meter { height: 4px; background: var(--line); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 2px; }
.day { display: flex; justify-content: space-between; margin: 16px 24px 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.raw { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; white-space: pre-wrap; background: var(--chip); padding: 8px 10px; border-radius: 8px; margin-top: 6px; color: var(--fg); }
.empty-state { text-align: center; color: var(--muted); padding: 40px 20px; }
.search { margin: 0 12px 4px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 4px 12px 8px; scrollbar-width: none; }
.chip { flex: none; border: 0; background: var(--chip); padding: 6px 12px; border-radius: 999px; font-size: 13px; cursor: pointer; }
.chip.on { background: var(--accent); color: #fff; }

/* tabs */
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: color-mix(in srgb, var(--card) 92%, transparent);
        backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line);
        padding-bottom: env(safe-area-inset-bottom); z-index: 6; }
.tabs button { flex: 1; border: 0; background: none; padding: 8px 0 8px; font-size: 11px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; position: relative; cursor: pointer; }
.tabs button span { height: 22px; display: grid; place-items: center; }
.tabs button.on { color: var(--accent); }
.badge { position: absolute; top: 4px; left: 54%; background: var(--warn); color: #fff; font-style: normal; font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px; padding: 0 4px; line-height: 16px; }
.fab { position: fixed; right: 18px; bottom: calc(86px + env(safe-area-inset-bottom)); width: 54px; height: 54px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-size: 30px; line-height: 1; box-shadow: 0 6px 18px rgba(47,109,246,.35); cursor: pointer; z-index: 6; }

/* sheet */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 9; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow-y: auto; background: var(--card); z-index: 10;
         border-radius: 18px 18px 0 0; padding: 10px 16px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px;
         animation: up .18s ease-out; }
@media (min-width: 640px) { .sheet { left: 50%; width: 520px; transform: translateX(-50%); bottom: 20px; border-radius: 18px; } }
@keyframes up { from { transform: translateY(30px); opacity: .5 } }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 4px; }
.sheet h3 { margin: 0; font-size: 18px; }
.sheet label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.sheet label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--fg); font-size: 14px; }
.sheet label.check input { width: auto; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.cat-grid button { border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 8px 4px; font-size: 12px; cursor: pointer; }
.cat-grid button.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--bg)); }
.cat-grid button b { display: block; font-size: 18px; font-weight: 400; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(150px + env(safe-area-inset-bottom)); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 20; font-size: 14px; }
.setup ol { padding-left: 20px; margin: 6px 0; line-height: 1.5; }
.setup code { background: var(--chip); padding: 1px 5px; border-radius: 5px; font-size: 13px; }
