@font-face {
  font-family: 'InterVar';
  src: url('../fonts/inter-latin-wght.woff2') format('woff2');
  font-weight: 100 900; font-display: swap;
}
:root {
  --bg: #07080A;
  --bg-elev: #0E1012;
  --surface: #131518;
  --surface-2: #1A1D21;
  --surface-3: #23272C;
  --line: rgba(255,255,255,0.07);
  --line-strong: rgba(255,255,255,0.12);
  --text: #F4F6F5;
  --text-2: #A3A9A6;
  --text-3: #6C726F;
  --brand: #19D98B;
  --brand-2: #0FB574;
  --brand-deep: #0A5C3C;
  --brand-glow: rgba(25,217,139,0.35);
  --brand-soft: rgba(25,217,139,0.13);
  --income: #2BE296;
  --expense: #FF5C61;
  --expense-soft: rgba(255,92,97,0.13);
  --warn: #FFB547;
  --warn-soft: rgba(255,181,71,0.14);
  --radius: 22px;
  --radius-sm: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 64px;
  --ease: cubic-bezier(.2,.8,.2,1);
  --spring: cubic-bezier(.34,1.4,.5,1);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', 'InterVar', system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font-size: 16px; line-height: 1.35; letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none; user-select: none; -webkit-user-select: none;
}
input, textarea, select { user-select: text; -webkit-user-select: text; font: inherit; color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg.i { width: 22px; height: 22px; flex: none; stroke-width: 1.6; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }

/* ---------- Layout ---------- */
.app { min-height: 100%; }
.view {
  padding: calc(var(--safe-top) + 12px) 18px calc(var(--tabbar-h) + var(--safe-bottom) + 36px);
  max-width: 560px; margin: 0 auto;
  animation: viewIn .38s var(--ease);
}
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.app::before {
  content: ''; position: fixed; inset: 0 0 auto 0; height: 340px; pointer-events: none; z-index: -1;
  background: radial-gradient(120% 90% at 85% -10%, rgba(25,217,139,0.16), transparent 60%),
              radial-gradient(90% 70% at 0% 0%, rgba(25,217,139,0.07), transparent 70%);
}
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin-bottom: 6px; }
.hello { color: var(--text-2); font-size: 15px; font-weight: 500; }
.title { font-size: 34px; font-weight: 750; letter-spacing: -0.035em; margin: 2px 0 14px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep)); color: #04150D; font-weight: 750; font-size: 15px;
  box-shadow: 0 6px 20px -6px var(--brand-glow);
}
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); color: var(--text); transition: transform .15s var(--ease), background .2s;
}
.icon-btn:active { transform: scale(.92); background: var(--surface-3); }
.icon-btn svg.i { width: 20px; height: 20px; }

/* ---------- Month switcher ---------- */
.month-switch { display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.month-switch button { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); }
.month-switch button:active { background: var(--surface-3); }
.month-switch button:disabled { opacity: .3; }
.month-switch span { min-width: 112px; text-align: center; font-size: 14px; font-weight: 600; }
.month-switch svg.i { width: 18px; height: 18px; }

/* ---------- Hero balance card ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 28px; padding: 22px 22px 20px;
  background:
    radial-gradient(140% 120% at 100% 0%, rgba(43,226,150,0.30), transparent 55%),
    radial-gradient(100% 120% at 0% 100%, rgba(10,92,60,0.55), transparent 60%),
    linear-gradient(160deg, #10241B 0%, #0B1511 55%, #0A0F0D 100%);
  border: 1px solid rgba(43,226,150,0.18);
  box-shadow: 0 24px 60px -28px rgba(25,217,139,0.45), inset 0 1px 0 rgba(255,255,255,0.06);
}
.hero::after {
  content: ''; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.06); box-shadow: 0 0 0 30px rgba(255,255,255,0.015), 0 0 0 60px rgba(255,255,255,0.012);
}
.hero-label { font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.62); text-transform: uppercase; letter-spacing: .06em; }
.hero-amount { font-size: 42px; font-weight: 760; letter-spacing: -0.04em; margin: 6px 0 2px; }
.hero-amount .cents { font-size: 24px; opacity: .65; letter-spacing: -0.02em; }
.hero-sub { font-size: 13.5px; color: rgba(255,255,255,0.6); }
.hero-sub b { color: var(--income); font-weight: 650; }
.hero-sub b.neg { color: var(--expense); }
.hero-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.pill {
  background: rgba(0,0,0,0.28); border: 1px solid rgba(255,255,255,0.07); border-radius: 18px; padding: 12px 14px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.pill-top { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: rgba(255,255,255,0.65); font-weight: 550; }
.pill-dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.pill-dot svg.i { width: 14px; height: 14px; stroke-width: 2.2; }
.pill-dot.in { background: var(--brand-soft); color: var(--income); }
.pill-dot.out { background: var(--expense-soft); color: var(--expense); }
.pill-val { font-size: 19px; font-weight: 700; margin-top: 6px; letter-spacing: -0.02em; }
.ratio { margin-top: 16px; height: 6px; border-radius: 6px; background: rgba(255,92,97,0.55); overflow: hidden; display: flex; }
.ratio i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-2), var(--income)); border-radius: 6px; transition: width .8s var(--ease); }
.ratio.ratio-empty { background: rgba(255,255,255,0.08); }

/* ---------- Sections & cards ---------- */
.section { margin-top: 26px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 4px 10px; }
.section-head h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.link { color: var(--brand); font-size: 15px; font-weight: 600; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card.pad { padding: 16px; }

/* ---------- Transactions ---------- */
.tx-list { padding: 4px 0; }
.tx {
  display: flex; align-items: center; gap: 12px; padding: 11px 16px; width: 100%; text-align: left; position: relative;
  transition: background .15s;
}
.tx:active { background: var(--surface-2); }
.tx + .tx::before { content: ''; position: absolute; top: 0; left: 70px; right: 16px; height: 1px; background: var(--line); }
.cat-ic {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--c) 14%, #15181B); color: var(--c);
  border: 1px solid color-mix(in srgb, var(--c) 18%, transparent);
}
.cat-ic svg.i { width: 21px; height: 21px; stroke-width: 1.55; }
.tx-main { flex: 1; min-width: 0; }
.tx-title { font-size: 15.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-sub { font-size: 13px; color: var(--text-3); margin-top: 2px; display: flex; gap: 6px; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-sub svg.i { width: 13px; height: 13px; }
.tx-amt { font-size: 15.5px; font-weight: 650; text-align: right; white-space: nowrap; }
.tx-amt.in { color: var(--income); }
.tx-amt.out { color: var(--expense); }
.day-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-3); font-weight: 600; margin: 20px 6px 8px; text-transform: uppercase; letter-spacing: .04em; }
.day-head:first-child { margin-top: 6px; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 34px 24px; color: var(--text-2); }
.empty-ic { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 20px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.empty-ic svg.i { width: 30px; height: 30px; }
.empty h3 { color: var(--text); margin: 0 0 6px; font-size: 17px; }
.empty p { margin: 0 0 16px; font-size: 14.5px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 52px; padding: 0 22px; border-radius: 16px;
  font-weight: 650; font-size: 16.5px; transition: transform .15s var(--ease), filter .2s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(180deg, #2BE296, var(--brand-2)); color: #03140C; box-shadow: 0 10px 28px -10px var(--brand-glow); }
.btn.primary:disabled { opacity: .35; box-shadow: none; }
.btn.ghost { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--expense-soft); color: var(--expense); }
.btn.block { width: 100%; }
.btn.sm { height: 40px; font-size: 14.5px; padding: 0 16px; border-radius: 12px; }

/* ---------- Segmented & chips ---------- */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border-radius: 13px; padding: 3px; position: relative; }
.seg button { height: 36px; border-radius: 10px; font-size: 14.5px; font-weight: 600; color: var(--text-2); position: relative; z-index: 1; transition: color .2s; }
.seg button.on { color: var(--text); background: var(--surface-3); box-shadow: 0 2px 10px rgba(0,0,0,.35); }
.seg.type button.on[data-v="out"] { color: var(--expense); }
.seg.type button.on[data-v="in"] { color: var(--income); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; margin: 0 -18px; padding: 2px 18px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 34px; padding: 0 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  font-size: 14px; font-weight: 550; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; transition: all .2s var(--ease);
}
.chip svg.i { width: 16px; height: 16px; }
.chip.on { background: var(--brand-soft); border-color: rgba(25,217,139,0.4); color: var(--brand); }

/* ---------- Search ---------- */
.search { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; border-radius: 13px; background: var(--surface-2); color: var(--text-3); margin-bottom: 12px; }
.search input { flex: 1; background: none; border: 0; outline: none; font-size: 16px; color: var(--text); min-width: 0; }
.search input::placeholder { color: var(--text-3); }
.search svg.i { width: 18px; height: 18px; }
.summary-row { display: flex; gap: 10px; margin: 14px 0 4px; }
.summary-row .mini { flex: 1; padding: 12px 14px; }
.mini-l { font-size: 12.5px; color: var(--text-3); font-weight: 600; }
.mini-v { font-size: 17px; font-weight: 700; margin-top: 3px; letter-spacing: -0.02em; }

/* ---------- Charts ---------- */
.donut-wrap { display: grid; place-items: center; position: relative; padding: 8px 0 4px; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.donut-center .l { font-size: 13px; color: var(--text-3); font-weight: 600; }
.donut-center .v { font-size: 25px; font-weight: 760; letter-spacing: -0.03em; margin-top: 2px; }
.donut-seg { transition: stroke-dasharray .9s var(--ease), opacity .2s; }
.legend { margin-top: 10px; }
.leg { display: flex; align-items: center; gap: 12px; padding: 10px 2px; }
.leg + .leg { border-top: 1px solid var(--line); }
.leg .cat-ic { width: 36px; height: 36px; border-radius: 11px; }
.leg .cat-ic svg.i { width: 18px; height: 18px; }
.leg-main { flex: 1; min-width: 0; }
.leg-name { font-size: 15px; font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.leg-bar { height: 4px; border-radius: 4px; background: var(--surface-3); margin-top: 7px; overflow: hidden; }
.leg-bar i { display: block; height: 100%; border-radius: 4px; background: var(--c); }
.leg-pct { color: var(--text-3); font-size: 13px; font-weight: 600; min-width: 44px; text-align: right; }
.bars-legend { display: flex; gap: 16px; font-size: 13px; color: var(--text-2); margin: 2px 2px 8px; }
.bars-legend span { display: inline-flex; align-items: center; gap: 6px; }
.bars-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.chart-svg text { font-family: inherit; }
.delta { font-size: 13px; font-weight: 650; padding: 3px 8px; border-radius: 8px; white-space: nowrap; }
.delta.up { background: var(--expense-soft); color: var(--expense); }
.delta.down { background: var(--brand-soft); color: var(--income); }
.delta.flat { background: var(--surface-3); color: var(--text-2); }
.delta.in.up { background: var(--brand-soft); color: var(--income); }
.delta.in.down { background: var(--expense-soft); color: var(--expense); }
.cmp-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; }
.cmp-row + .cmp-row { border-top: 1px solid var(--line); }
.cmp-vals { text-align: right; font-size: 13px; color: var(--text-3); }
.cmp-vals b { display: block; color: var(--text); font-size: 15px; font-weight: 650; }

/* ---------- Budget ---------- */
.budget-hero { display: flex; align-items: center; gap: 18px; padding: 18px; }
.ring-wrap { position: relative; width: 112px; height: 112px; flex: none; }
.ring-wrap .pct { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; font-weight: 760; font-size: 22px; letter-spacing: -0.03em; }
.ring-wrap .pct small { display: block; font-size: 11.5px; color: var(--text-3); font-weight: 600; letter-spacing: 0; }
.budget-hero .meta .l { font-size: 13px; color: var(--text-3); font-weight: 600; }
.budget-hero .meta .v { font-size: 22px; font-weight: 740; letter-spacing: -0.03em; margin: 2px 0 10px; }
.budget-row { display: block; width: 100%; text-align: left; padding: 14px 16px; transition: background .15s; }
.budget-row:active { background: var(--surface-2); }
.budget-row + .budget-row { border-top: 1px solid var(--line); }
.b-top { display: flex; align-items: center; gap: 12px; }
.b-name { flex: 1; min-width: 0; font-size: 15.5px; font-weight: 600; }
.b-name small { display: block; color: var(--text-3); font-size: 13px; font-weight: 500; margin-top: 2px; }
.b-amt { text-align: right; font-size: 15px; font-weight: 650; }
.b-amt small { display: block; font-size: 12.5px; color: var(--text-3); font-weight: 550; }
.b-bar { height: 8px; border-radius: 8px; background: var(--surface-3); margin-top: 12px; overflow: hidden; }
.b-bar i { display: block; height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--brand-2), var(--income)); transition: width .9s var(--ease); }
.budget-row.warn .b-bar i { background: linear-gradient(90deg, #E8962A, var(--warn)); }
.budget-row.over .b-bar i { background: linear-gradient(90deg, #E5383F, var(--expense)); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 7px; margin-left: 6px; vertical-align: 1px; }
.badge svg.i { width: 12px; height: 12px; stroke-width: 2.4; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.over { background: var(--expense-soft); color: var(--expense); }
.alert {
  display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 18px; margin-top: 14px;
  background: var(--expense-soft); border: 1px solid rgba(255,92,97,0.25); color: #FFC9CB; font-size: 14.5px; width: 100%; text-align: left;
}
.alert.warn { background: var(--warn-soft); border-color: rgba(255,181,71,0.25); color: #FFE2B5; }
.alert svg.i { color: var(--expense); }
.alert.warn svg.i { color: var(--warn); }
.alert b { color: var(--text); }

/* ---------- Settings ---------- */
.group-title { font-size: 13px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; font-weight: 650; margin: 26px 6px 8px; }
.row { display: flex; align-items: center; gap: 14px; padding: 13px 16px; width: 100%; text-align: left; position: relative; transition: background .15s; }
.row:active { background: var(--surface-2); }
.row + .row::before { content: ''; position: absolute; top: 0; left: 62px; right: 0; height: 1px; background: var(--line); }
.row-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--brand-soft); color: var(--brand); }
.row-ic.red { background: var(--expense-soft); color: var(--expense); }
.row-ic.gray { background: var(--surface-3); color: var(--text-2); }
.row-ic svg.i { width: 18px; height: 18px; }
.row-main { flex: 1; min-width: 0; font-size: 16px; font-weight: 550; }
.row-main small { display: block; font-size: 13px; color: var(--text-3); font-weight: 450; margin-top: 2px; }
.row-end { color: var(--text-3); display: flex; align-items: center; gap: 6px; font-size: 14.5px; }
.row-end svg.i { width: 18px; height: 18px; }
.row.danger .row-main { color: var(--expense); }
.foot-note { text-align: center; color: var(--text-3); font-size: 12.5px; margin: 26px 20px 0; line-height: 1.5; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 6px 8px calc(var(--safe-bottom) + 6px);
  display: grid; grid-template-columns: repeat(2, 1fr) 76px repeat(3, 1fr); align-items: center;
  background: rgba(10,11,13,0.78); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-top: 1px solid var(--line);
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; height: 52px; justify-content: center; color: var(--text-3); font-size: 10.5px; font-weight: 600; transition: color .2s; }
.tab svg.i { width: 24px; height: 24px; transition: transform .25s var(--spring); }
.tab.on { color: var(--brand); }
.tab.on svg.i { transform: translateY(-1px) scale(1.06); }
.tab:active svg.i { transform: scale(.88); }
.fab {
  justify-self: center; width: 60px; height: 60px; border-radius: 22px; display: grid; place-items: center; margin-top: -26px;
  background: linear-gradient(160deg, #3FF0A6 0%, var(--brand) 45%, var(--brand-2) 100%); color: #03140C;
  box-shadow: 0 14px 30px -8px var(--brand-glow), 0 0 0 5px var(--bg), inset 0 1px 0 rgba(255,255,255,0.45);
  transition: transform .25s var(--spring);
}
.fab svg.i { width: 30px; height: 30px; stroke-width: 2.4; }
.fab:active { transform: scale(.9) rotate(90deg); }

/* ---------- Sheets ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 40; animation: fadeIn .25s ease forwards; backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.backdrop.closing { animation: fadeOut .25s ease forwards; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-width: 560px; margin: 0 auto;
  max-height: calc(100% - var(--safe-top) - 10px); display: flex; flex-direction: column;
  background: var(--bg-elev); border-radius: 28px 28px 0 0; border-top: 1px solid var(--line-strong);
  padding: 8px 18px calc(var(--safe-bottom) + 14px);
  animation: sheetUp .42s var(--ease) forwards; box-shadow: 0 -20px 60px rgba(0,0,0,.5);
}
.sheet.closing { animation: sheetDown .28s ease-in forwards; }
.sheet.full { height: calc(100% - var(--safe-top) - 10px); }
.grabber { width: 38px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 0 auto 10px; flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; flex: none; }
.sheet-head h3 { margin: 0; font-size: 18px; font-weight: 700; }
.sheet-body { overflow-y: auto; flex: 1; margin: 0 -18px; padding: 0 18px; -webkit-overflow-scrolling: touch; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheetDown { from { transform: none; } to { transform: translateY(100%); } }

/* ---------- Add / edit ---------- */
.amount-display { text-align: center; padding: 12px 0 6px; }
.amount-display .v { font-size: 50px; font-weight: 760; letter-spacing: -0.045em; line-height: 1.1; transition: color .2s; }
.amount-display .v.zero { color: var(--text-3); }
.amount-display.in .v:not(.zero) { color: var(--income); }
.amount-display.out .v:not(.zero) { color: var(--text); }
.amount-display .v .cur { font-size: 32px; opacity: .55; margin-left: 4px; }
.amount-display.shake { animation: shake .35s; }
@keyframes shake { 20%,60% { transform: translateX(-6px); } 40%,80% { transform: translateX(6px); } }
.field-label { font-size: 13px; color: var(--text-3); font-weight: 650; text-transform: uppercase; letter-spacing: .05em; margin: 14px 2px 8px; }
.cat-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(2, auto); grid-auto-columns: 74px; gap: 8px 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -18px; padding: 2px 18px 4px; scroll-snap-type: x proximity; }
.cat-grid::-webkit-scrollbar { display: none; }
.cat-opt { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 2px; border-radius: 16px; font-size: 11.5px; font-weight: 550; color: var(--text-2); text-align: center; line-height: 1.15; scroll-snap-align: start; border: 1px solid transparent; transition: all .2s var(--ease); }
.cat-opt .cat-ic { width: 46px; height: 46px; border-radius: 15px; transition: transform .25s var(--spring); }
.cat-opt span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.3em; }
.cat-opt.on { background: color-mix(in srgb, var(--c) 10%, transparent); border-color: color-mix(in srgb, var(--c) 45%, transparent); color: var(--text); }
.cat-opt.on .cat-ic { transform: scale(1.06); }
.inline-fields { display: grid; grid-template-columns: 1fr; gap: 8px; }
.field { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--text-2); }
.field input, .field select { flex: 1; background: none; border: 0; outline: none; color: var(--text); font-size: 16px; min-width: 0; height: 100%; }
.field input[type="date"] { color-scheme: dark; }
.field svg.i { width: 19px; height: 19px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 52px; padding: 0 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.toggle-row .l { display: flex; align-items: center; gap: 10px; font-size: 15.5px; font-weight: 550; }
.toggle-row .l svg.i { color: var(--brand); width: 19px; height: 19px; }
.switch { width: 51px; height: 31px; border-radius: 16px; background: var(--surface-3); position: relative; transition: background .25s; flex: none; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); transition: transform .3s var(--spring); }
.switch.on { background: var(--brand); }
.switch.on::after { transform: translateX(20px); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.key { height: 52px; border-radius: 15px; background: var(--surface); font-size: 24px; font-weight: 550; display: grid; place-items: center; transition: background .1s, transform .1s; }
.key:active { background: var(--surface-3); transform: scale(.96); }
.key svg.i { width: 24px; height: 24px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 14px; flex: none; }
.sheet-actions .btn { flex: 1; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; top: calc(var(--safe-top) + 10px); transform: translate(-50%, -140%); z-index: 60;
  background: rgba(30,33,37,0.92); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid var(--line-strong);
  padding: 11px 18px; border-radius: 999px; font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 8px;
  transition: transform .45s var(--spring); max-width: calc(100% - 40px); white-space: nowrap;
}
.toast.show { transform: translate(-50%, 0); }
.toast svg.i { width: 18px; height: 18px; color: var(--brand); }

/* ---------- Recurring ---------- */
.rec-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; width: 100%; text-align: left; position: relative; }
.rec-row + .rec-row::before { content: ''; position: absolute; top: 0; left: 70px; right: 16px; height: 1px; background: var(--line); }
.rec-row.paused { opacity: .5; }
.hint { color: var(--text-3); font-size: 13.5px; margin: 8px 4px 0; line-height: 1.45; }

@media (min-width: 600px) { .tabbar { max-width: 560px; margin: 0 auto; border-radius: 24px 24px 0 0; border: 1px solid var(--line); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------- v1.1: conti, trasferimenti, onboarding ---------- */
.acc-tiles { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; margin: 18px -22px 0; padding: 0 22px 2px; scroll-snap-type: x proximity; }
.acc-tiles::-webkit-scrollbar { display: none; }
.acc-tile {
  flex: 0 0 auto; min-width: 148px; text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 18px;
  background: rgba(0,0,0,0.28); border: 1px solid rgba(255,255,255,0.08); scroll-snap-align: start; transition: transform .15s var(--ease);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.acc-tile:active { transform: scale(.97); }
.acc-tile-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.acc-dot { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); }
.acc-dot svg.i { width: 16px; height: 16px; stroke-width: 1.8; }
.acc-star { color: var(--brand); opacity: .9; }
.acc-star svg.i { width: 14px; height: 14px; fill: currentColor; }
.acc-name { font-size: 13px; color: rgba(255,255,255,0.65); font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.acc-bal { font-size: 18px; font-weight: 720; letter-spacing: -0.02em; }
.acc-bal.neg { color: var(--expense); }
.acc-tile.add { min-width: 88px; align-items: center; justify-content: center; color: var(--brand); border-style: dashed; border-color: rgba(25,217,139,0.35); background: rgba(25,217,139,0.05); }
.acc-tile.add svg.i { width: 22px; height: 22px; }
.acc-tile.add .acc-name { color: var(--brand); }
.hero-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.hero-btn {
  height: 44px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: 14.5px; font-weight: 650;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.08); transition: transform .15s var(--ease), background .2s;
}
.hero-btn:first-child { background: linear-gradient(180deg, #2BE296, var(--brand-2)); color: #03140C; border: 0; box-shadow: 0 8px 22px -10px var(--brand-glow); }
.hero-btn:active { transform: scale(.97); }
.hero-btn svg.i { width: 18px; height: 18px; stroke-width: 2; }
.month-card { padding: 16px; }
.mc-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.mc-net { font-size: 28px; font-weight: 760; letter-spacing: -0.035em; margin-top: 2px; }
.mc-net.pos { color: var(--income); }
.mc-net.neg { color: var(--expense); }
.mc-sub { font-size: 13px; color: var(--text-3); text-align: right; }
.mc-sub b { color: var(--income); }
.mc-sub b.neg { color: var(--expense); }
.month-card .pill { background: var(--surface-2); }
.tx-amt.transfer { color: var(--text-2); }
.tx-amt.adjust { color: var(--text-2); font-style: normal; }
.seg.type button.on[data-v="transfer"] { color: #7FD8BE; }
.chip.dim { opacity: .35; pointer-events: none; }
.tr-arrow { display: flex; justify-content: center; color: var(--text-3); margin: 8px 0 -6px; }
.tr-arrow svg.i { transform: rotate(90deg); width: 20px; height: 20px; }
.acc-banner, .acc-sum { display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-top: 12px; }
.acc-sum { margin: 0 0 4px; }
.badge.def { background: var(--brand-soft); color: var(--brand); margin-left: 4px; }

.onb {
  position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; overflow-y: auto;
  padding: calc(var(--safe-top) + 40px) 24px calc(var(--safe-bottom) + 20px);
  background:
    radial-gradient(90% 55% at 50% 0%, rgba(25,217,139,0.22), transparent 70%),
    radial-gradient(60% 40% at 100% 100%, rgba(10,92,60,0.35), transparent 70%),
    var(--bg);
  animation: fadeIn .4s ease;
}
.onb.closing { animation: onbOut .38s var(--ease) forwards; }
@keyframes onbOut { to { opacity: 0; transform: scale(1.04); } }
.onb-inner { flex: 1; max-width: 460px; width: 100%; margin: 0 auto; text-align: center; }
.onb-icon { width: 84px; height: 84px; border-radius: 22px; box-shadow: 0 18px 40px -12px var(--brand-glow), 0 0 0 1px rgba(255,255,255,0.08); animation: pop .6s var(--spring); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.onb h1 { font-size: 30px; font-weight: 760; letter-spacing: -0.035em; margin: 22px 0 8px; }
.onb-p { color: var(--text-2); font-size: 16px; line-height: 1.45; margin: 0 auto 26px; max-width: 340px; }
.onb-fields { display: grid; gap: 12px; text-align: left; }
.onb-field {
  display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line);
  transition: border-color .2s, box-shadow .2s;
}
.onb-field:focus-within { border-color: color-mix(in srgb, var(--brand) 55%, transparent); box-shadow: 0 0 0 4px rgba(25,217,139,0.12); }
.onb-field .cat-ic { width: 48px; height: 48px; border-radius: 15px; }
.onb-l { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; color: var(--text-2); font-weight: 600; }
.onb-in { display: flex; align-items: baseline; gap: 6px; }
.onb-in input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 28px; font-weight: 720; letter-spacing: -0.03em; color: var(--text); padding: 0; }
.onb-in input::placeholder { color: var(--text-3); }
.onb-in b { font-size: 22px; color: var(--text-3); font-weight: 650; }
.onb-hint { display: flex; gap: 8px; align-items: flex-start; text-align: left; color: var(--text-3); font-size: 13.5px; line-height: 1.45; margin: 18px 4px 0; }
.onb-hint svg.i { color: var(--brand); width: 18px; height: 18px; flex: none; margin-top: 1px; }
.onb-actions { max-width: 460px; width: 100%; margin: 24px auto 0; display: grid; gap: 6px; }
.onb-skip { height: 44px; color: var(--text-2); font-weight: 600; }
.acc-tiles { scroll-padding-inline: 22px; }
.cat-grid { scroll-padding-inline: 18px; }
.onb-field, .onb-in { min-width: 0; }
.onb-in input { width: 100%; }
