/* ===================== Budget Book — UI v3 "Vibrant" (neo-bank) ===================== */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #f5f4f9;
  --bg2: #ffffff;
  --surface: #ffffff;
  --surface2: #faf9fd;
  --text: #15132a;
  --muted: #86839c;
  --faint: #a8a5bb;
  --line: #eceaf3;
  --line-strong: #e2e0ec;
  --violet: #7c3aed;
  --violet-deep: #6d28d9;
  --fuchsia: #db2777;
  --accent: #7c3aed;
  --accent-soft: #f1ecfe;
  --green: #16a34a;
  --green-soft: #e2f4ea;
  --red: #e11d48;
  --red-soft: #fde7ea;
  --amber: #d97706;
  --hero-grad: linear-gradient(150deg, #6d28d9 0%, #7c3aed 34%, #a21caf 72%, #db2777 100%);
  --logo-grad: linear-gradient(140deg, #8b46f0, #db2777);
  --shadow-card: 0 1px 0 rgba(22,20,39,.02), 0 14px 30px -22px rgba(22,20,39,.40);
  --shadow-hero: 0 22px 48px -18px rgba(124,58,237,.55), 0 4px 14px -8px rgba(219,39,119,.35);
  --shadow-sheet: 0 -10px 50px rgba(22,20,39,.22);
  --r-card: 24px;
  --r-hero: 30px;
  --r-chip: 15px;
  --r-sm: 14px;
  --tabbar-h: 76px;
}
[data-theme="dark"] {
  --bg: #0e0c16;
  --bg2: #161320;
  --surface: #17141f;
  --surface2: #1d1a28;
  --text: #f4f2fb;
  --muted: #9f9bb5;
  --faint: #6f6b86;
  --line: rgba(255,255,255,.07);
  --line-strong: rgba(255,255,255,.12);
  --accent-soft: rgba(124,58,237,.18);
  --green-soft: rgba(22,163,74,.18);
  --red-soft: rgba(225,29,72,.18);
  --shadow-card: 0 14px 34px -24px rgba(0,0,0,.8);
  --shadow-hero: 0 22px 48px -20px rgba(124,58,237,.6);
  --shadow-sheet: 0 -10px 50px rgba(0,0,0,.5);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px; line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
  overscroll-behavior-y: none;
}
button { font-family: inherit; cursor: pointer; color: inherit; }
input, button, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
input { -webkit-appearance: none; appearance: none; }
.tnum { font-variant-numeric: tabular-nums; }
.pos { color: var(--green); } .neg { color: var(--red); }
svg { display: block; }
::selection { background: var(--violet); color: #fff; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- shell + topbar ---------- */
.shell { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 11px;
  padding: calc(env(safe-area-inset-top) + 13px) 18px 12px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
}
.topbar .logo-mark { width: 34px; height: 34px; border-radius: 12px; background: var(--logo-grad); display: grid; place-items: center; box-shadow: 0 6px 16px -6px rgba(124,58,237,.6); flex: none; }
.topbar .logo-mark svg { width: 18px; height: 18px; color: #fff; }
.topbar .brand { line-height: 1.05; }
.topbar .brand .nm { font-size: 18px; font-weight: 800; letter-spacing: -0.5px; }
.topbar .brand .sub { font-size: 11.5px; font-weight: 600; color: var(--faint); }
.topbar .spacer { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line-strong); padding: 8px 13px; border-radius: 999px; font-weight: 700; font-size: 14px; box-shadow: var(--shadow-card); transition: transform .12s; }
.chip:active { transform: scale(0.95); }
.chip svg { width: 14px; height: 14px; }
.view { padding: 4px 17px 16px; max-width: 1100px; margin: 0 auto; }

/* ---------- hero ---------- */
.hero { position: relative; border-radius: var(--r-hero); padding: 21px 22px; color: #fff; overflow: hidden; background: var(--hero-grad); box-shadow: var(--shadow-hero); margin-top: 6px; }
.hero::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-hero); box-shadow: inset 0 1px 0 rgba(255,255,255,.28), inset 0 0 0 1px rgba(255,255,255,.07); pointer-events: none; }
.hero .glow { position: absolute; width: 230px; height: 230px; border-radius: 50%; top: -120px; right: -70px; background: radial-gradient(circle, rgba(255,255,255,.4), rgba(255,255,255,0) 68%); pointer-events: none; }
.hero .pattern { position: absolute; inset: 0; pointer-events: none; }
.hero .hero-top { position: relative; display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.hero .period { display: flex; align-items: center; gap: 8px; }
.hero .arrow { width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.15); display: grid; place-items: center; transition: background .15s, transform .12s; }
.hero .arrow:active { background: rgba(255,255,255,.3); transform: scale(0.92); }
.hero .arrow svg { width: 7px; height: 12px; color: #fff; }
.hero .period-lbl { font-size: 15px; font-weight: 800; letter-spacing: -0.3px; min-width: 104px; text-align: center; }
.hero .vbtoggle { display: flex; background: rgba(255,255,255,.14); border-radius: 999px; padding: 3px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.hero .vbtoggle button { border: none; background: transparent; font-size: 12px; font-weight: 700; padding: 7px 13px; border-radius: 999px; color: rgba(255,255,255,.78); transition: color .15s, background .15s; }
.hero .vbtoggle button.on { background: #fff; color: var(--violet); box-shadow: 0 2px 8px -2px rgba(0,0,0,.25); }
.hero .balance { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.hero .hero-lbl { font-size: 11.5px; font-weight: 700; color: rgba(255,255,255,.78); letter-spacing: 0.6px; text-transform: uppercase; }
.hero .hero-fig { font-size: 47px; font-weight: 800; letter-spacing: -2px; line-height: 1; margin: 8px 0; }
.hero .hero-sub { font-size: 13px; font-weight: 600; color: rgba(255,255,255,.82); display: flex; align-items: center; gap: 7px; }
.hero .hero-sub b { font-weight: 800; color: #fff; }
.hero .pill { display: inline-flex; align-items: center; gap: 4px; background: rgba(255,255,255,.18); padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.hero .pill svg { width: 9px; height: 9px; color: #fff; }
.hero .ring { position: relative; flex: none; width: 92px; height: 92px; }
.hero .ring .ctr { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.hero .ring .ctr .pct { font-size: 20px; font-weight: 800; letter-spacing: -0.8px; }
.hero .ring .ctr .cl { font-size: 9px; font-weight: 700; color: rgba(255,255,255,.78); letter-spacing: 0.5px; text-transform: uppercase; margin-top: 2px; }
.hero .stats { position: relative; display: flex; gap: 9px; margin-top: 20px; }
.hero .stat { flex: 1; background: rgba(255,255,255,.12); border-radius: 16px; padding: 11px 12px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.09); }
.hero .stat .l { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; color: rgba(255,255,255,.82); margin-bottom: 5px; }
.hero .stat .l .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.hero .stat .v { font-size: 16px; font-weight: 800; letter-spacing: -0.5px; }

/* ---------- groups + items ---------- */
.group { margin-top: 24px; }
.group-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 8px 11px; }
.group-head .name { font-size: 12.5px; font-weight: 800; letter-spacing: 0.4px; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.group-head .name .gdot { width: 8px; height: 8px; border-radius: 3px; }
.group-head .sub { font-size: 15px; font-weight: 800; letter-spacing: -0.4px; color: var(--text); }
.card { background: var(--surface); border-radius: var(--r-card); padding: 5px 9px; box-shadow: var(--shadow-card); border: 1px solid var(--line); }
.item { display: flex; align-items: center; gap: 13px; padding: 11px; }
.item + .item, .item + .additem { border-top: 1px solid var(--line); }
.item .ic { width: 43px; height: 43px; border-radius: var(--r-chip); display: grid; place-items: center; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.03); }
.item .ic svg { width: 20px; height: 20px; }
.item .body { flex: 1; min-width: 0; text-align: left; background: none; border: none; padding: 2px 0; }
.item .body .nm { font-size: 15px; font-weight: 700; letter-spacing: -0.3px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .body .meta { font-size: 11.5px; font-weight: 600; color: var(--faint); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .body:active .nm { color: var(--violet); }
.amtbox { display: inline-flex; align-items: center; gap: 1px; flex: none; border-radius: 12px; padding: 6px 9px; border: 1px solid transparent; transition: background .15s, border-color .15s; }
.amtbox:focus-within { background: var(--accent-soft); border-color: var(--violet); }
.amtbox .cur { color: var(--muted); font-weight: 700; font-size: 14px; }
.amtbox input { width: 64px; max-width: 22vw; background: none; border: none; outline: none; text-align: right; font-size: 15.5px; font-weight: 800; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; padding: 2px 0; color: var(--text); }
.amtbox input::placeholder { color: var(--faint); font-weight: 700; }
.amtbox.empty { border: 1px dashed var(--line-strong); }
.amtbox.income input { color: var(--green); }

/* inline add item */
.additem { display: flex; align-items: center; gap: 13px; padding: 11px; }
.additem .ic { width: 43px; height: 43px; border-radius: var(--r-chip); display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--violet); border: 1px dashed var(--violet); }
.additem .ic svg { width: 18px; height: 18px; }
.additem .ai-name { flex: 1; min-width: 0; background: none; border: none; outline: none; font-size: 15px; font-weight: 700; color: var(--text); padding: 4px 0; }
.additem .ai-name::placeholder { color: var(--violet); opacity: .85; }
.additem .ai-rest { display: flex; align-items: center; gap: 8px; }
.additem .ai-amtbox { display: inline-flex; align-items: center; gap: 1px; background: var(--surface2); border: 1px solid var(--line-strong); border-radius: 11px; padding: 6px 9px; }
.additem .ai-amtbox .cur { color: var(--muted); font-weight: 700; font-size: 14px; }
.additem .ai-amtbox input { width: 56px; background: none; border: none; outline: none; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; padding: 2px 0; }
.additem .ai-save { background: var(--violet); color: #fff; border: none; border-radius: 11px; width: 38px; height: 38px; display: grid; place-items: center; flex: none; }
.additem .ai-save svg { width: 18px; height: 18px; }
.fillrow { display: flex; gap: 7px; padding: 0 11px 11px 67px; }
.fillrow button { flex: 1; border: 1px solid var(--line-strong); background: var(--surface2); border-radius: 9px; padding: 7px; font-size: 12px; font-weight: 700; color: var(--muted); }
.fillrow button.on { background: var(--accent-soft); color: var(--violet); border-color: var(--violet); }

.add-group-btn { width: 100%; margin-top: 16px; display: flex; align-items: center; justify-content: center; gap: 8px; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r-card); color: var(--violet); font-weight: 800; padding: 16px; transition: border-color .15s; }
.add-group-btn svg { width: 18px; height: 18px; }
.add-group-btn:active { border-color: var(--violet); }
.addgroup-edit { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 13px; box-shadow: var(--shadow-card); }
.addgroup-edit input { flex: 1 1 140px; background: var(--surface2); border: 1px solid var(--violet); border-radius: 12px; padding: 12px; font-weight: 700; outline: none; }

/* ---------- segmented (year/insights/sheets) ---------- */
.seg { display: flex; background: var(--surface2); border: 1px solid var(--line); border-radius: 13px; padding: 4px; gap: 4px; }
.seg button { flex: 1; border: none; background: none; padding: 9px 10px; border-radius: 9px; font-weight: 700; font-size: 14px; color: var(--muted); transition: background .15s, color .15s; }
.seg button.on { background: var(--violet); color: #fff; }

/* ---------- year grid ---------- */
.grid-toolbar { display: flex; align-items: center; gap: 10px; margin: 6px 0 12px; }
.grid-toolbar .seg { flex: 0 0 auto; min-width: 190px; }
.gridwrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); -webkit-overflow-scrolling: touch; box-shadow: var(--shadow-card); }
table.grid { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 13.5px; }
table.grid th, table.grid td { padding: 0; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
table.grid thead th { position: sticky; top: 0; z-index: 5; background: var(--surface2); font-weight: 800; color: var(--muted); font-size: 11.5px; padding: 9px 10px; }
table.grid .rowname, table.grid th.rowname { position: sticky; left: 0; z-index: 4; background: var(--surface); text-align: left; min-width: 120px; box-shadow: 1px 0 0 var(--line); font-weight: 700; padding: 9px 12px; }
table.grid thead th.rowname { z-index: 6; background: var(--surface2); }
table.grid button.rowname { border: none; width: 100%; color: var(--text); }
table.grid .grouprow td { background: var(--surface2); font-weight: 800; padding: 8px 10px; }
table.grid .grouprow .rowname { background: var(--surface2); color: var(--violet); }
table.grid td.total { font-weight: 800; background: var(--accent-soft); padding: 8px 10px; }
table.grid tr.totalrow td { background: var(--surface2); font-weight: 800; border-top: 2px solid var(--line-strong); padding: 9px 10px; }
table.grid tr.totalrow .rowname { background: var(--surface2); }
table.grid td.cellwrap { padding: 0; }
table.grid td.cellwrap input { width: 100%; min-width: 56px; background: none; border: none; outline: none; text-align: right; padding: 11px 10px; font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
table.grid td.cellwrap input::placeholder { color: var(--faint); }
table.grid td.cellwrap input:focus { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--violet); border-radius: 6px; }
table.grid td.cellwrap.hasnote { box-shadow: inset 2px 0 0 var(--amber); }
.grid-legend { color: var(--muted); font-size: 12.5px; margin: 10px 4px 0; }

/* ---------- insights ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.kpi { padding: 16px; }
.kpi .v { font-size: 23px; font-weight: 800; letter-spacing: -0.5px; }
.kpi .l { color: var(--muted); font-size: 12.5px; font-weight: 600; margin-top: 3px; }
.chart-card { padding: 16px; margin-top: 16px; }
.chart-card h3 { margin: 0 0 12px; font-size: 15px; font-weight: 800; }
.chart-box { position: relative; height: 220px; }
.card.kpi, .card.chart-card { border-radius: var(--r-card); }

/* ---------- settings ---------- */
.section-title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 24px 8px 10px; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; box-shadow: var(--shadow-card); }
.li { display: flex; align-items: center; gap: 13px; padding: 14px 16px; border-bottom: 1px solid var(--line); transition: background .12s; }
.li:last-child { border-bottom: none; }
.li:active { background: var(--surface2); }
.li .li-ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--violet); flex: none; }
.li .li-ic svg { width: 18px; height: 18px; }
.li .li-l { flex: 1; font-weight: 700; }
.li .li-l small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 500; margin-top: 1px; }
.li .li-v { color: var(--muted); font-weight: 700; }
.li.danger .li-ic { background: var(--red-soft); color: var(--red); }
.li.danger .li-l { color: var(--red); }
.li .chev { color: var(--faint); }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--bg2) 86%, transparent);
  backdrop-filter: saturate(160%) blur(22px);
  -webkit-backdrop-filter: saturate(160%) blur(22px);
  border-top: 1px solid var(--line);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; background: none; border: none; color: var(--faint); font-size: 10.5px; font-weight: 700; position: relative; }
.tab svg { width: 23px; height: 23px; }
.tab.active { color: var(--violet); }
.tab.active::before { content: ""; position: absolute; top: 9px; width: 26px; height: 3px; border-radius: 0 0 3px 3px; background: linear-gradient(90deg, #7c3aed, #db2777); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 14px; padding: 13px 18px; font-weight: 800; font-size: 16px; background: var(--surface2); transition: transform .1s, background .15s; }
.btn.primary { background: var(--violet); color: #fff; border-color: var(--violet); box-shadow: 0 10px 22px -12px rgba(124,58,237,.8); }
.btn.primary:active { background: var(--violet-deep); }
.btn.danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; }
.btn svg { width: 18px; height: 18px; }

/* ---------- sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(20,16,40,.45); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .2s; }
.sheet-backdrop.show { opacity: 1; }
.sheet { width: 100%; max-width: 560px; background: var(--bg2); border-radius: 26px 26px 0 0; border: 1px solid var(--line); border-bottom: none; padding: 8px 18px calc(20px + env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .28s cubic-bezier(.2,.85,.25,1); max-height: 88vh; overflow: auto; box-shadow: var(--shadow-sheet); }
.sheet-backdrop.show .sheet { transform: translateY(0); }
.grabber { width: 38px; height: 5px; border-radius: 99px; background: var(--line-strong); margin: 8px auto 16px; }
.sheet h2 { margin: 0 0 4px; font-size: 20px; font-weight: 800; letter-spacing: -0.4px; }
.sheet .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 16px; font-weight: 500; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.input { width: 100%; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 13px; padding: 14px; font-size: 17px; font-weight: 600; outline: none; transition: border-color .15s; }
.input:focus { border-color: var(--violet); }
.input.amount { font-variant-numeric: tabular-nums; font-weight: 700; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 12px; }
.sheet-actions .btn { flex: 1; }
.check { display: flex; align-items: center; gap: 10px; padding: 10px 0; color: var(--muted); font-size: 14px; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--violet); }
.sheetlist .li { background: var(--surface); border-radius: 12px; border: 1px solid var(--line); margin-bottom: 8px; }

/* ---------- pin / setup ---------- */
.center-screen { min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; }
.logo { width: 80px; height: 80px; border-radius: 24px; display: grid; place-items: center; background: var(--logo-grad); box-shadow: 0 16px 40px -14px rgba(124,58,237,.7); margin-bottom: 18px; }
.logo svg { width: 40px; height: 40px; color: #fff; }
.center-screen h1 { font-size: 27px; font-weight: 800; letter-spacing: -0.5px; margin: 0 0 6px; }
.center-screen p.lead { color: var(--muted); margin: 0 0 26px; max-width: 330px; font-weight: 500; }
.pindots { display: flex; gap: 15px; margin: 8px 0 28px; }
.pindots i { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--line-strong); transition: background .12s, border-color .12s; }
.pindots i.on { background: var(--violet); border-color: var(--violet); }
.pindots.err i { border-color: var(--red); animation: shake .35s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-7px)} 75%{transform:translateX(7px)} }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 16px; }
.key { height: 76px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 27px; font-weight: 700; display: grid; place-items: center; box-shadow: var(--shadow-card); transition: transform .1s, background .12s; }
.key.fn { font-size: 15px; font-weight: 700; background: none; border: none; box-shadow: none; color: var(--violet); }
.key:active { background: var(--surface2); transform: scale(0.95); }
.starter-cards { display: grid; gap: 12px; width: 100%; max-width: 390px; }
.starter { text-align: left; padding: 16px; border-radius: 16px; border: 1.5px solid var(--line-strong); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.starter.on { border-color: var(--violet); box-shadow: 0 0 0 3px var(--accent-soft); }
.starter .t { font-weight: 800; }
.starter .d { color: var(--muted); font-size: 13px; margin-top: 3px; font-weight: 500; }

/* ---------- toast / empty ---------- */
#toast-root { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom)); z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 13px; font-weight: 700; font-size: 14px; box-shadow: var(--shadow-card); opacity: 0; transform: translateY(12px); transition: all .22s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.bad { background: var(--red); color: #fff; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); font-weight: 600; }
.empty svg { width: 46px; height: 46px; opacity: .5; margin-bottom: 12px; }

@media (min-width: 720px) {
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
}

/* ===================== UI v4 — single budget tab ===================== */
.shell { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.topbar .iconbtn { width: 38px; height: 38px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line-strong); display: grid; place-items: center; box-shadow: var(--shadow-card); color: var(--muted); transition: transform .12s; }
.topbar .iconbtn:active { transform: scale(0.92); }
.topbar .iconbtn svg { width: 19px; height: 19px; }

/* month navigator */
.monthnav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 2px 12px; }
.monthnav .arrow { width: 38px; height: 38px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line-strong); display: grid; place-items: center; box-shadow: var(--shadow-card); color: var(--violet); transition: transform .12s, background .15s; }
.monthnav .arrow:active { transform: scale(0.9); background: var(--accent-soft); }
.monthnav .arrow svg { width: 9px; height: 15px; }
.monthnav .mlabel { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; }
.monthnav .mlabel span { color: var(--faint); font-weight: 700; }

/* running-balance graph card */
.graph-card { padding: 14px 14px 8px; }
.graph-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; padding: 0 2px; }
.graph-head span { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.graph-head b { font-size: 16px; font-weight: 800; letter-spacing: -0.4px; }
.graph-card .chart-box { height: 150px; }

/* hero (simplified — no ring) */
.hero { margin-top: 14px; }
.hero .hero-fig.warn { color: #fecdd3; }
.hero .pill.bad { background: rgba(0,0,0,.16); }

/* section header right side + add button */
.group-head .ghright { display: flex; align-items: center; gap: 9px; }
.group-head .addbtn { width: 28px; height: 28px; border-radius: 9px; background: var(--accent-soft); color: var(--violet); border: none; display: grid; place-items: center; transition: transform .12s; }
.group-head .addbtn:active { transform: scale(0.9); }
.group-head .addbtn svg { width: 15px; height: 15px; }
.emptyrow { padding: 14px 12px; color: var(--faint); font-size: 13px; font-weight: 600; }

/* dimmed off-month rows + their inactive amount */
.item.off { opacity: .58; }
.item .amt-off { background: none; border: none; color: var(--faint); font-weight: 800; font-size: 16px; padding: 6px 10px; }
.item .amt-off:active { color: var(--violet); }

/* amount field with currency prefix inside sheets */
.amtfield { display: flex; align-items: center; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 13px; padding: 0 14px; transition: border-color .15s; }
.amtfield:focus-within { border-color: var(--violet); }
.amtfield span { color: var(--muted); font-weight: 700; font-size: 16px; }
.amtfield .input.amount { border: none; background: none; padding: 14px 0 14px 6px; border-radius: 0; }
.amtfield .input.amount:focus { border: none; }
.hintline { font-size: 12px; color: var(--muted); margin: -4px 2px 4px; line-height: 1.4; }

/* floating "log a spend" button */
.fab { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 50;
  display: inline-flex; align-items: center; gap: 8px; background: var(--violet); color: #fff; border: none;
  padding: 14px 22px; border-radius: 999px; font-weight: 800; font-size: 15px;
  box-shadow: 0 14px 30px -10px rgba(124,58,237,.75), 0 4px 12px -6px rgba(219,39,119,.4); transition: transform .12s; }
.fab:active { transform: translateX(-50%) scale(0.95); }
.fab svg { width: 19px; height: 19px; }
