:root{--bg:#faf6ef;--card:#fffdf8;--ink:#232a22;--muted:#7c7565;--line:#e9e0cf;--acc:#1f6f54;--acc-ink:#123b2f;--acc2:#c97a1f;--gold:#e8c26a;--danger:#b4432a;--radius:16px}
[data-theme=dark]{--bg:#141310;--card:#1f1c16;--ink:#f2ede1;--muted:#a79e8a;--line:#322c22;--acc:#58bd8d;--acc-ink:#0e2b21;--acc2:#e09a3c;--gold:#e8c26a}
*{box-sizing:border-box}html{scrollbar-width:none;-ms-overflow-style:none}
html::-webkit-scrollbar,body::-webkit-scrollbar{display:none;width:0;height:0}
body{margin:0;overflow-x:hidden;touch-action:pan-x pan-y;background:var(--bg);color:var(--ink);font:15px/1.45 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Inter,Arial,sans-serif}
button,a,input,select,textarea{touch-action:manipulation}
#app{max-width:480px;margin:0 auto;min-height:100dvh}
.view{padding:12px 14px 92px}
.auth-wrap{padding:36px 16px}.brand{display:flex;gap:12px;align-items:center;margin-bottom:18px}.brand h1{font-size:22px;margin:0}.brand p{margin:2px 0 0;color:var(--muted)}.brand-mark{width:44px;height:44px;border-radius:14px;background:linear-gradient(135deg,var(--acc-ink),var(--acc) 60%,var(--acc2));color:#fdf8ec;display:grid;place-items:center}
.brand-mark.sm{width:32px;height:32px;border-radius:10px}
.brand-img{width:44px;height:44px;border-radius:14px;object-fit:cover;flex:none}
.brand-img.sm{width:32px;height:32px;border-radius:10px}
.splash-card .brand-img{width:56px;height:56px;border-radius:16px}
.ic{width:20px;height:20px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex:none}
.ic.lg{width:24px;height:24px}
.icon-btn{display:inline-grid;place-items:center;border:1px solid var(--line);background:var(--card);color:var(--ink);border-radius:10px;padding:7px;cursor:pointer}
.with-icon{display:inline-flex;align-items:center;gap:6px}
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);padding:14px;margin:10px 0;box-shadow:0 1px 2px rgba(0,0,0,.04)}
.topbar{position:sticky;top:0;z-index:5;display:flex;align-items:center;gap:10px;padding:12px 14px;background:var(--bg);border-bottom:1px solid var(--line)}
.topbar strong{flex:1}.month-hidden{position:fixed;top:0;left:0;width:4px;height:4px;opacity:0;pointer-events:none;border:0;padding:0}
.tabs{display:flex;background:var(--bg);border-radius:12px;padding:4px;margin-bottom:12px}.tab{flex:1;border:0;background:transparent;padding:9px;border-radius:9px;font-weight:600;color:var(--muted);cursor:pointer}.tab.active{background:var(--card);color:var(--ink);box-shadow:0 1px 2px rgba(0,0,0,.08)}
label{display:block;font-size:13px;color:var(--muted);margin:8px 0}input,select{width:100%;margin-top:4px;padding:11px 12px;border:1px solid var(--line);border-radius:12px;background:var(--card);color:var(--ink);font-size:15px}
/* iOS Safari sizes native date/month inputs to their intrinsic content width,
   ignoring width:100%; with grid/flex min-width:auto that forces the cell
   wider than the card. min-width:0 on the input AND its grid cell fixes it. */
.grid-form>*,.grid-form input,.grid-form select{min-width:0}
input[type=date],input[type=month]{min-width:0;max-width:100%}
@supports (-webkit-touch-callout:none){input[type=date],input[type=month]{-webkit-appearance:none;appearance:none}}
.btn{border:0;border-radius:12px;padding:12px;width:100%;font-weight:700;font-size:15px;cursor:pointer;margin-top:10px}.btn.primary{background:var(--acc);color:#fff}.btn.ghost{background:transparent;border:1px solid var(--line);color:var(--ink);width:auto;padding:8px 12px}.btn.danger{background:#f7ddd2;color:var(--danger)}
.err{color:var(--danger);font-size:13px}.muted{color:var(--muted);font-size:13px}
.summary{background:linear-gradient(140deg,#0e2b21 0%,#1f6f54 58%,#8a5a17 130%);color:#fdf8ec;border:0;cursor:pointer}.summary .lbl{opacity:.8;font-size:12px}.summary .light-muted{color:#f3e7cd;opacity:.85;font-size:12px}.sum-head{display:flex;justify-content:space-between;align-items:baseline;margin-bottom:6px}.sum-head #sum-month{font-weight:700;font-size:14px;letter-spacing:.02em}.sum-row{display:flex;justify-content:space-between;gap:10px}.sum-row .right{text-align:right}.amt.big{font-size:26px;display:block}.amt{display:block;font-size:18px}
body.hide-amounts .amt{filter:blur(7px);user-select:none}
h3{font-size:13px;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);margin:16px 2px 6px}
.carousel{display:flex;gap:12px;overflow-x:auto;scroll-snap-type:x mandatory;scroll-padding:0 20px;padding:6px 20px 12px;margin:0 -14px;scrollbar-width:none;-ms-overflow-style:none;cursor:grab}
.carousel::-webkit-scrollbar{display:none}
.carousel.dragging{cursor:grabbing;scroll-snap-type:none}
.cc{flex:0 0 78%;min-width:0;scroll-snap-align:center;scroll-snap-stop:always;border-radius:18px;padding:14px;color:#fdf8ec;background:linear-gradient(140deg,#0e2b21,#1f6f54);border:1px solid rgba(255,255,255,.14);transition:transform .28s cubic-bezier(.2,.9,.3,1.2),box-shadow .28s ease;box-shadow:0 6px 18px rgba(18,59,47,.25)}
.cc:nth-child(4n+2){background:linear-gradient(140deg,#7c2f16,#c97a1f);box-shadow:0 6px 18px rgba(180,67,42,.28)}
.cc:nth-child(4n+3){background:linear-gradient(140deg,#26241c,#5c5540);box-shadow:0 6px 18px rgba(38,36,28,.3)}
.cc:nth-child(4n+4){background:linear-gradient(140deg,#3d4a1e,#7a8b3f);box-shadow:0 6px 18px rgba(77,91,47,.3)}
.cc .chip{width:34px;height:24px;border-radius:6px;background:linear-gradient(90deg,var(--gold),#c9973f);margin:6px 0}.cc small{opacity:.78}.cc strong.amt{font-size:20px}.cc{cursor:pointer}
.cc-num{font-size:15px;letter-spacing:.14em;opacity:.92;margin:2px 0}
.cc.new{background:transparent;border:2px dashed var(--acc2);color:var(--acc2);display:grid;place-items:center;min-height:118px;box-shadow:none}
.cc.new span{font-weight:800;letter-spacing:.18em}
#exp-newcard-fields[hidden]{display:none}
#exp-cards{margin-bottom:2px}
.dots{display:flex;justify-content:center;gap:6px;padding:2px 0 4px}.dots i{width:6px;height:6px;border-radius:50%;background:var(--line);transition:all .25s ease}.dots i.on{width:20px;border-radius:4px;background:var(--acc)}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:10px}.tile{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:12px;cursor:pointer;transition:border-color .15s ease,box-shadow .15s ease}.tile b{display:block}.tile .amt{font-size:16px}.tile small{color:var(--muted)}.tile.sel{border-color:var(--acc);box-shadow:0 0 0 2px var(--acc) inset}
.cc.sel{box-shadow:0 0 0 2px var(--gold),0 6px 18px rgba(18,59,47,.25)}
.txn-filter{display:flex;align-items:center;justify-content:space-between;gap:10px;background:var(--card);border:1px solid var(--line);border-radius:12px;padding:8px 8px 8px 12px;font-size:13px;color:var(--muted)}.txn-filter b{color:var(--ink)}.txn-filter .btn{margin-top:0}
.list{display:flex;flex-direction:column;gap:8px}.txn{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:10px 12px;display:flex;gap:10px;align-items:center}.txn .grow{flex:1;min-width:0}.txn b{font-size:14px}.txn small{color:var(--muted);display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.txn .del{display:inline-grid;place-items:center;border:0;background:transparent;color:var(--muted);cursor:pointer;padding:6px;border-radius:8px}.txn .del:hover{color:var(--danger);background:rgba(180,67,42,.08)}.txn .del .ic{width:16px;height:16px}
.row-between{display:flex;align-items:center;justify-content:space-between;gap:10px}.row-between input{width:auto}
.grid-form{display:grid;grid-template-columns:1fr 1fr;gap:0 10px}
.legend{display:flex;gap:14px;color:var(--muted);font-size:12px;margin-top:6px}.dot{display:inline-block;width:10px;height:10px;border-radius:50%;margin-right:5px}.dot.spend{background:#1f6f54}.dot.invest{background:#c97a1f}
canvas{width:100%}
.tabbar{position:fixed;bottom:0;left:50%;transform:translateX(-50%);width:100%;max-width:480px;display:flex;background:var(--card);border-top:1px solid var(--line);padding:8px 4px calc(8px + env(safe-area-inset-bottom))}
.tabbar button{flex:1;border:0;background:transparent;color:var(--muted);display:flex;flex-direction:column;align-items:center;gap:3px;cursor:pointer;padding:6px 0}.tabbar button span{font-size:11px}.tabbar button.active{color:var(--acc)}
.check{display:flex;align-items:center;gap:10px}.check input{width:auto}
.empty{color:var(--muted);text-align:center;padding:18px;border:1px dashed var(--line);border-radius:14px}
.forecast .lbl{font-size:12px;color:var(--muted)}.forecast .chips{display:flex;gap:8px;margin:8px 0 4px}.chip2{font-size:12px;font-weight:700;padding:4px 10px;border-radius:20px;background:var(--bg);border:1px solid var(--line);color:var(--muted)}.chip2.hot{color:var(--acc2);border-color:var(--acc2)}.chip2.calm{color:var(--acc);border-color:var(--acc)}
.frow{display:flex;justify-content:space-between;align-items:center;padding:9px 0;border-top:1px solid var(--line);font-size:14px}.frow .amt{font-size:15px}
.insight{background:var(--card);border:1px solid var(--line);border-left:4px solid var(--acc);border-radius:12px;padding:10px 12px;font-size:13.5px}.insight.warn{border-left-color:var(--acc2)}.insight.good{border-left-color:var(--acc)}
.bars{display:flex;flex-direction:column;gap:10px}.brow{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:10px 12px}.brow .top{display:flex;justify-content:space-between;font-size:13.5px;margin-bottom:6px}.brow .track{height:8px;border-radius:5px;background:var(--bg);border:1px solid var(--line);overflow:hidden}.brow .fill{height:100%;border-radius:5px;background:linear-gradient(90deg,var(--acc),var(--acc2));transition:width .5s ease}
.week{display:flex;align-items:flex-end;gap:6px;height:120px;padding-top:8px}.week .day{flex:1;display:flex;flex-direction:column;align-items:center;gap:4px;min-width:0}.week .col{width:100%;display:flex;align-items:flex-end;flex:1;min-height:4px}.week .vbar{width:70%;margin:0 auto;border-radius:5px 5px 2px 2px;background:var(--acc);opacity:.75;min-height:4px}.week .day.max .vbar{background:var(--acc2);opacity:1}.week small{font-size:10px;color:var(--muted)}
.empty-hero{text-align:center;padding:24px 18px}.empty-ring{width:58px;height:58px;margin:0 auto;border-radius:50%;display:grid;place-items:center;background:var(--bg);border:1.5px dashed var(--acc);color:var(--acc)}
.empty-hero .track{height:8px;border-radius:5px;background:var(--bg);border:1px solid var(--line);overflow:hidden}.empty-hero .fill{height:100%;border-radius:5px;background:linear-gradient(90deg,var(--acc),var(--acc2));transition:width .5s ease}
@media(min-width:520px){body{background:#e7dfcf}}
#splash{position:fixed;inset:0;z-index:50;display:grid;place-items:center;background:color-mix(in srgb,var(--bg) 82%,transparent);backdrop-filter:blur(3px)}
#splash[hidden]{display:none}
.splash-card{display:flex;flex-direction:column;align-items:center;gap:10px;background:var(--card);border:1px solid var(--line);border-radius:20px;padding:26px 32px;box-shadow:0 12px 32px rgba(0,0,0,.14);min-width:220px;max-width:280px;text-align:center}
.splash-card h2{margin:2px 0 0;font-size:19px}
.splash-card .muted{margin:0;min-height:20px}
.spinner{width:28px;height:28px;border-radius:50%;border:3px solid var(--line);border-top-color:var(--acc);animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
