:root {
  --bg: #F4F5FA;
  --bg-2: #ECEEF6;
  --surface: #FFFFFF;
  --surface-2: #F6F7FB;
  --line: rgba(15, 23, 42, .08);
  --text: #0E1224;
  --muted: #6B7287;
  --track: #E7E9F2;
  --accent: #5B5BF0;
  --accent-2: #8B5CF6;
  --pos: #12A66B;
  --neg: #E5484D;
  --warn: #D98A06;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
  --glass: rgba(255, 255, 255, .78);
  --scrim: rgba(10, 12, 24, .45);
  --hero-a: #5B5BF0;
  --hero-b: #8B5CF6;
  --hero-c: #C084FC;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --r: 20px;
  --nav-gap: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A0B10;
    --bg-2: #0F1118;
    --surface: #14161F;
    --surface-2: #1A1D29;
    --line: rgba(255, 255, 255, .08);
    --text: #F2F3F8;
    --muted: #8D93A8;
    --track: #232636;
    --accent: #7C7CFF;
    --accent-2: #A78BFA;
    --pos: #3DDC97;
    --neg: #FF6B78;
    --warn: #F5B544;
    --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 10px 30px rgba(0, 0, 0, .35);
    --glass: rgba(20, 22, 31, .78);
    --scrim: rgba(0, 0, 0, .6);
    --hero-a: #4338CA;
    --hero-b: #6D28D9;
    --hero-c: #9333EA;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0A0B10;
  --bg-2: #0F1118;
  --surface: #14161F;
  --surface-2: #1A1D29;
  --line: rgba(255, 255, 255, .08);
  --text: #F2F3F8;
  --muted: #8D93A8;
  --track: #232636;
  --accent: #7C7CFF;
  --accent-2: #A78BFA;
  --pos: #3DDC97;
  --neg: #FF6B78;
  --warn: #F5B544;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 10px 30px rgba(0, 0, 0, .35);
  --glass: rgba(20, 22, 31, .78);
  --scrim: rgba(0, 0, 0, .6);
  --hero-a: #4338CA;
  --hero-b: #6D28D9;
  --hero-c: #9333EA;
  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-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  font-size: 16px; line-height: 1.35; -webkit-font-smoothing: antialiased; overscroll-behavior: none;
  font-variant-numeric: tabular-nums;
}
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .5; }
input { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
.ic { display: block; flex: none; }

/* The page itself stays a plain, unclipped document (iOS only repaints the status bar live for that):
   body is the positioned parent and #app fills it like an ordinary absolutely-positioned block. */
body { position: relative; }
#app { position: absolute; top: 0; bottom: 0; left: 0; right: 0; margin: 0 auto; max-width: 560px; background: var(--bg); overflow: clip; --p: 0; }
#stage { position: absolute; inset: 0; display: flex; flex-direction: column; overflow: hidden; transform-origin: 50% 0;
  background: var(--bg);
  transform: none;
  border-radius: 0;
  transition: transform .5s cubic-bezier(.32, .72, 0, 1), border-radius .5s cubic-bezier(.32, .72, 0, 1); }
#app.dim #stage { transform: translateY(calc(var(--p) * 12px)) scale(calc(1 - var(--p) * .075)); border-radius: calc(var(--p) * 30px); }
#app.dragging #stage, #app.dragging .scrim { transition: none !important; }

/* ---------- top bar ---------- */
#topbar { position: absolute; top: 0; left: 0; right: 0; z-index: 6; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(var(--safe-t) + 10px) 18px 10px; min-height: 58px;
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  backdrop-filter: blur(22px) saturate(1.7); -webkit-backdrop-filter: blur(22px) saturate(1.7);
  border-bottom: 1px solid transparent; transition: border-color .2s; }
#topbar.scrolled { border-bottom-color: var(--line); }
body.onboard #topbar { display: none; }
.title { font-size: 26px; font-weight: 750; letter-spacing: -.02em; }
.month-pill { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  font-weight: 650; font-size: 15px; transition: transform .15s; }
.month-pill:active { transform: scale(.97); }
.sync { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 999px; font-size: 12.5px;
  font-weight: 650; color: var(--muted); background: var(--surface); border: 1px solid var(--line); }
.sync i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.sync.synced i { background: var(--pos); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pos) 22%, transparent); }
.sync.syncing i { background: var(--accent); animation: pulse 1s ease-in-out infinite; }
.sync.offline i, .sync.pending i { background: var(--warn); }
.sync.error i { background: var(--neg); }
.sync.idle { visibility: hidden; }
.sync:empty { display: none; }
.sync span:empty { display: none; }
.sync:not(:has(span:not(:empty))) { padding: 8px; }
@keyframes pulse { 50% { transform: scale(1.6); opacity: .45; } }

/* ---------- view ---------- */
#view { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  padding: calc(var(--top-h, 58px) + 6px) 16px calc(68px + var(--nav-gap) + 30px); scrollbar-width: none; }
#view::-webkit-scrollbar { display: none; }
.page.enter > * { animation: rise .5s cubic-bezier(.2, .8, .2, 1) both; }
.page.enter > *:nth-child(2) { animation-delay: .05s; }
.page.enter > *:nth-child(3) { animation-delay: .1s; }
.page.enter > *:nth-child(4) { animation-delay: .15s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.muted { color: var(--muted); } .sm { font-size: 13px; } .center { text-align: center; } .pad { padding: 8px 4px 4px; }
.pos { color: var(--pos); } .neg { color: var(--neg); }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; border-radius: 28px; padding: 24px 22px 20px; color: #fff; margin-bottom: 14px;
  background:
    radial-gradient(420px 220px at 105% -10%, color-mix(in srgb, var(--hero-c) 80%, transparent), transparent 70%),
    radial-gradient(300px 200px at -10% 120%, color-mix(in srgb, var(--hero-a) 90%, #000), transparent 70%),
    linear-gradient(135deg, var(--hero-a), var(--hero-b));
  box-shadow: 0 18px 40px -12px color-mix(in srgb, var(--hero-b) 55%, transparent), inset 0 1px 0 rgba(255, 255, 255, .22); }
.hero > * { position: relative; z-index: 1; }
.hero-label { font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; opacity: .78; }
.hero-amt { font-size: 44px; font-weight: 760; letter-spacing: -.035em; line-height: 1.1; margin: 6px 0 4px; white-space: nowrap; }
.hero-amt small { font-size: 22px; font-weight: 600; opacity: .72; letter-spacing: -.01em; }
.hero-amt .cur { font-size: 22px; font-weight: 600; opacity: .8; margin-right: 6px; vertical-align: 6px; }
.hero-sub { font-size: 13px; opacity: .75; }
.hero-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.mini { position: relative; text-align: left; color: inherit; font: inherit; width: 100%; cursor: pointer; transition: transform .15s; padding: 12px 14px; border-radius: 16px; background: rgba(255, 255, 255, .14); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, .16); }
.mini span { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; opacity: .85; }
.mini b { display: block; font-size: 18px; font-weight: 700; margin-top: 3px; letter-spacing: -.01em; }
.mini .ic.up { color: #7CF0BF; transform: rotate(180deg); } .mini .ic.down { color: #FFB4BC; }
.meter { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .18); margin-top: 16px; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #fff, rgba(255, 255, 255, .7)); transition: width .8s cubic-bezier(.2, .8, .2, 1); }
.meter-cap { font-size: 12px; opacity: .72; margin-top: 8px; }

/* ---------- cards & rows ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card.flush { padding: 4px 8px; }
.card-h { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.card-h h3 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.link { color: var(--accent); font-weight: 650; font-size: 14px; }

.row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 6px; text-align: left; border-radius: 14px; transition: background .15s, transform .12s; }
.row:active { background: var(--surface-2); transform: scale(.992); }
.row + .row { border-top: 1px solid var(--line); border-radius: 0; }
.bubble { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; flex: none;
  color: hsl(var(--h, 250) 75% 52%); background: hsl(var(--h, 250) 80% 55% / .14); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bubble { color: hsl(var(--h, 250) 85% 72%); background: hsl(var(--h, 250) 80% 60% / .16); } }
:root[data-theme="dark"] .bubble { color: hsl(var(--h, 250) 85% 72%); background: hsl(var(--h, 250) 80% 60% / .16); }
.bubble.sm { width: 32px; height: 32px; border-radius: 11px; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-t { font-weight: 620; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-s { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-amt { font-weight: 700; font-size: 15.5px; white-space: nowrap; letter-spacing: -.01em; }
.row.inc .row-amt { color: var(--pos); }
.pend { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); flex: none; }

.day { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 6px 8px; font-size: 13px; font-weight: 650; color: var(--muted); }
.day .neg, .day .pos { font-weight: 700; }

.bar-row { display: flex; gap: 12px; align-items: center; padding: 7px 0; }
.bar-main { flex: 1; min-width: 0; }
.bar-top { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; }
.bar-top b { font-weight: 700; }
.bar { height: 7px; border-radius: 7px; background: var(--track); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 7px; background: linear-gradient(90deg, hsl(var(--h, 250) 75% 62%), hsl(calc(var(--h, 250) + 20) 80% 66%)); }

/* ---------- search / chips ---------- */
.search { display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 48px; border-radius: 16px; background: var(--surface);
  border: 1px solid var(--line); color: var(--muted); margin-bottom: 12px; }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; font-size: 16px; color: var(--text); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted); transition: all .15s; }
.chip:active { transform: scale(.96); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }

.chip.cat.on { background: hsl(var(--h, 250) 75% 55%); border-color: transparent; color: #fff; }

/* ---------- insights ---------- */
.donut-wrap { display: flex; align-items: center; gap: 16px; }
.donut-box { position: relative; width: 150px; height: 150px; flex: none; }
.donut { width: 100%; height: 100%; }
.donut-c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-c small { color: var(--muted); font-size: 12px; font-weight: 600; }
.donut-c b { font-size: 20px; font-weight: 740; letter-spacing: -.02em; }
.legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 9px; }
.legend div { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.legend i { width: 10px; height: 10px; border-radius: 4px; background: hsl(var(--h, 250) 70% 58%); flex: none; }
.legend span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend b { font-weight: 700; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px; box-shadow: var(--shadow); }
.stat span { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat b { display: block; font-size: 22px; font-weight: 740; letter-spacing: -.02em; margin-top: 4px; }
.trend { display: flex; gap: 8px; align-items: flex-end; height: 168px; }
.tcol { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; }
.tcol b { font-size: 11px; font-weight: 650; color: var(--muted); }
.tcol span { font-size: 12px; font-weight: 600; color: var(--muted); }
.tbar { flex: 1; width: 100%; max-width: 34px; display: flex; align-items: flex-end; border-radius: 10px; background: var(--track); overflow: hidden; }
.tbar i { width: 100%; border-radius: 10px; background: color-mix(in srgb, var(--accent) 45%, var(--track)); transition: height .6s cubic-bezier(.2, .8, .2, 1); }
.tcol.on .tbar i { background: linear-gradient(180deg, var(--accent-2), var(--accent)); }
.tcol.on span, .tcol.on b { color: var(--text); }

/* ---------- settings / forms ---------- */
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.kv span { color: var(--muted); } .kv b { font-weight: 650; text-align: right; word-break: break-all; }
.warn { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--neg) 12%, transparent); color: var(--neg); font-size: 13px; }
.badge { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; text-transform: capitalize; background: var(--surface-2); color: var(--muted); }
.badge.synced { background: color-mix(in srgb, var(--pos) 16%, transparent); color: var(--pos); }
.badge.error { background: color-mix(in srgb, var(--neg) 16%, transparent); color: var(--neg); }
.badge.offline, .badge.syncing { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.field { display: block; margin: 8px 0; }
.field span { display: block; font-size: 12.5px; font-weight: 650; color: var(--muted); margin-bottom: 6px; }
.field input { width: 100%; height: 50px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); font-size: 16px; outline: 0; }
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.switch { display: flex; align-items: center; gap: 10px; margin: 12px 0 4px; font-size: 14.5px; }
.switch input { width: 20px; height: 20px; accent-color: var(--accent); }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 50px; margin-top: 12px; border-radius: 16px;
  font-weight: 680; font-size: 16px; background: var(--surface-2); border: 1px solid var(--line); transition: transform .12s, filter .15s; }
.btn:active { transform: scale(.98); }
.btn.primary { color: #fff; border: 0; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn.big { height: 56px; font-size: 17px; }
.btn.ghost { background: none; }
.btn.danger { color: var(--neg); background: color-mix(in srgb, var(--neg) 9%, transparent); border-color: color-mix(in srgb, var(--neg) 22%, transparent); }

/* ---------- tab bar ---------- */
#tabbar { position: absolute; left: var(--nav-gap); right: var(--nav-gap); bottom: var(--nav-gap); height: 68px; z-index: 5;
  display: grid; grid-template-columns: 1fr 1fr 74px 1fr 1fr; align-items: center; padding: 0 8px; border-radius: 26px;
  background: var(--glass); backdrop-filter: blur(22px) saturate(1.6); -webkit-backdrop-filter: blur(22px) saturate(1.6);
  border: 1px solid var(--line); box-shadow: 0 18px 40px -10px rgba(0, 0, 0, .35); }
body.onboard #tabbar { display: none; }
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 650; padding: 8px 0; transition: color .15s; }
.tab.on { color: var(--accent); }
.tab.on .ic { transform: translateY(-1px) scale(1.06); }
.fab { width: 58px; height: 58px; border-radius: 20px; margin: -22px auto 0; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 14px 28px -8px color-mix(in srgb, var(--accent) 80%, transparent), inset 0 1px 0 rgba(255, 255, 255, .3);
  transition: transform .15s; }
.fab:active { transform: scale(.92) rotate(90deg); }

/* ---------- layer / sheet (iOS-style) ---------- */
#layer { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
#layer.open { pointer-events: auto; }
.scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .42); opacity: 0; transition: opacity .5s cubic-bezier(.32, .72, 0, 1); }
.sheet { position: absolute; left: 8px; right: 8px; bottom: max(8px, calc(var(--safe-b) - 22px)); display: flex; flex-direction: column;
  max-height: calc(100% - var(--safe-t) - 22px - max(8px, calc(var(--safe-b) - 22px))); background: var(--bg-2); border-radius: 34px;
  border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); will-change: transform; overscroll-behavior: contain; overflow: hidden; }
.sheet.animating { transition: transform .5s cubic-bezier(.32, .72, 0, 1); }
.sheet.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.sheet-top { flex: none; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.grab-zone { width: 100%; height: 34px; display: grid; place-items: center; }
.grab { width: 38px; height: 5px; border-radius: 5px; background: color-mix(in srgb, var(--muted) 45%, transparent); transition: width .15s, background .15s; }
.grab-zone:active .grab { width: 46px; background: color-mix(in srgb, var(--muted) 70%, transparent); }
.sheet-h { flex: none; display: grid; grid-template-columns: 46px 1fr 46px; align-items: center; gap: 8px; margin: 0 16px 10px; min-height: 46px; }
.sheet-h h2 { font-size: 17px; font-weight: 720; letter-spacing: -.01em; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbtns { display: flex; justify-content: flex-end; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; padding: 0 18px 18px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.sheet-body::-webkit-scrollbar { display: none; }
.close { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform .12s; }
.close:active { transform: scale(.92); }
.icon-btn { min-width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; padding: 0 10px; font-weight: 650; font-size: 14px; }
.icon-btn.danger { color: var(--neg); background: color-mix(in srgb, var(--neg) 12%, transparent); }
.icon-btn.danger.armed { background: var(--neg); color: #fff; }
.sheet.small .sheet-body { padding-bottom: 22px; }

.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 8px; }
.seg button { height: 38px; border-radius: 12px; font-weight: 680; color: var(--muted); transition: all .2s; }
.seg button.on.expense { background: color-mix(in srgb, var(--neg) 15%, transparent); color: var(--neg); }
.seg button.on.income { background: color-mix(in srgb, var(--pos) 15%, transparent); color: var(--pos); }
.amt { display: flex; align-items: baseline; justify-content: center; gap: 8px; padding: 2px 0 6px; font-size: 42px; font-weight: 760; letter-spacing: -.04em; min-height: 56px; }
.amt .cur { font-size: 20px; font-weight: 600; color: var(--muted); }
.amt.empty span:last-child { color: var(--track); }
.amt.expense { color: var(--text); } .amt.income { color: var(--pos); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
.keypad button { height: 46px; border-radius: 14px; font-size: 22px; font-weight: 600; background: var(--surface); border: 1px solid var(--line);
  display: grid; place-items: center; transition: transform .1s, background .15s; }
.keypad button:active { transform: scale(.94); background: var(--surface-2); }
.lbl { font-size: 12px; font-weight: 650; color: var(--muted); margin: 8px 2px 6px; }
.two { display: grid; grid-template-columns: auto 1fr; gap: 8px; margin: 12px 0 2px; }
.date-pill { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 16px; border-radius: 16px; background: var(--surface);
  border: 1px solid var(--line); font-weight: 650; font-size: 15px; overflow: hidden; }
.date-pill input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.note { display: block; } .note input { width: 100%; height: 46px; padding: 0 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); outline: 0; font-size: 16px; }
.note input:focus { border-color: var(--accent); }
.mlist { display: flex; flex-direction: column; gap: 6px; padding-bottom: 6px; }
.mrow { display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); font-weight: 650; }
.mrow span { flex: 1; text-align: left; } .mrow b { color: var(--muted); font-weight: 600; font-size: 14px; }
.mrow.on { border-color: var(--accent); color: var(--accent); } .mrow.on b { color: var(--accent); }

/* ---------- empty + onboarding ---------- */
.empty-big { text-align: center; color: var(--muted); padding: 70px 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-big h2 { color: var(--text); font-size: 20px; }
.empty-big.small { padding: 40px 20px; }
.onb { max-width: 420px; margin: 0 auto; padding: calc(var(--safe-t) + 40px) 6px 24px; display: flex; flex-direction: column; gap: 12px; min-height: 100%; justify-content: center; }
.logo { width: 72px; height: 72px; border-radius: 22px; display: block; margin-bottom: 8px; box-shadow: 0 14px 30px -12px rgba(30, 30, 90, .45); }
.onb h1 { font-size: 36px; line-height: 1.08; font-weight: 780; letter-spacing: -.035em; }
.onb p { color: var(--muted); font-size: 16px; line-height: 1.5; margin-bottom: 8px; }
body.onboard #view { padding: 0 16px 24px; }

/* ---------- toast ---------- */
#toast { position: absolute; left: 50%; bottom: calc(68px + var(--nav-gap) + 16px); transform: translate(-50%, 20px); z-index: 40; max-width: 88%;
  padding: 12px 18px; border-radius: 16px; background: var(--text); color: var(--bg); font-weight: 620; font-size: 14.5px; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .3s cubic-bezier(.2, .9, .2, 1); box-shadow: 0 14px 30px rgba(0, 0, 0, .3); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--neg); color: #fff; }
#toast.ok { background: var(--text); }

@media (min-width: 600px) {
  #app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* fixed footer + single-row chips so the whole add sheet fits one screen */
.sheet-foot { flex: none; padding: 10px 18px calc(14px + var(--safe-b)); border-top: 1px solid var(--line); background: var(--bg-2); }
.sheet-foot .btn { margin-top: 0; }
.chips.hs { flex-wrap: nowrap; overflow-x: auto; margin: 0 -18px; padding: 0 18px 2px; scroll-padding: 0 18px; -webkit-overflow-scrolling: touch; }
.chips.hs .chip { flex: none; padding: 8px 13px; }
.hint { color: var(--muted); font-size: 13.5px; padding: 9px 2px; }
.sheet.compact .sheet-body { padding-bottom: 8px; }
.muted.xs { font-size: 11px; opacity: .7; margin-top: 4px; }

/* toast with an action (Undo) */
#toast { display: flex; align-items: center; gap: 14px; }
#toast.has-action { pointer-events: auto; padding-right: 10px; }
#toast button { font-weight: 800; padding: 6px 12px; border-radius: 10px; background: color-mix(in srgb, var(--bg) 18%, transparent); color: inherit; }

/* small controls, import preview, recently deleted */
.ic.flip { transform: rotate(180deg); }
.mini-btn { padding: 8px 14px; border-radius: 12px; font-weight: 700; font-size: 14px; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.trashrow { cursor: default; }
.imp-file { font-weight: 650; word-break: break-all; margin: 2px 0 12px; color: var(--muted); }
.imp-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 6px; }
.imp-stats div { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px; text-align: center; }
.imp-stats b { display: block; font-size: 24px; font-weight: 760; letter-spacing: -.02em; }
.imp-stats span { font-size: 12px; color: var(--muted); font-weight: 600; }
.warn.sm { margin-top: 6px; padding: 8px 10px; }

/* "+ New" chip and inline name field in the add sheet */
.chip.add { color: var(--accent); border-style: dashed; background: transparent; gap: 4px; }
.chip-input { flex: 1 1 100%; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 3px 4px 3px 12px; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--accent); }
.chip-input input { flex: 1; min-width: 0; width: auto; border: 0; outline: 0; background: none; padding: 5px 0; font-size: 16px; color: var(--text); }
.chip-input button { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); background: color-mix(in srgb, var(--muted) 16%, transparent); }
.chip-input button.ok { color: #fff; background: var(--accent); }

/* month dropdown */
#menu { position: absolute; inset: 0; z-index: 30; pointer-events: none; }
#menu.open { pointer-events: auto; }
.menu-backdrop { position: absolute; inset: 0; }
.menu { position: absolute; overflow-y: auto; padding: 6px; border-radius: 22px; scrollbar-width: none;
  background: var(--glass); backdrop-filter: blur(26px) saturate(1.7); -webkit-backdrop-filter: blur(26px) saturate(1.7);
  border: 1px solid var(--line); box-shadow: 0 28px 60px -14px rgba(0, 0, 0, .4), 0 2px 8px rgba(0, 0, 0, .08);
  opacity: 0; transform: scale(.82) translateY(-10px); transition: transform .34s cubic-bezier(.3, 1.3, .5, 1), opacity .16s ease; }
.menu::-webkit-scrollbar { display: none; }
.menu.in { opacity: 1; transform: none; }
.menu.out { opacity: 0; transform: scale(.94) translateY(-6px); transition: transform .18s ease, opacity .16s ease; }
.menu-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 13px 14px; border-radius: 16px; text-align: left; font-size: 16px;
  opacity: 0; transform: translateY(-6px); transition: background .15s; }
.menu.in .menu-row { opacity: 1; transform: none; transition: opacity .28s ease, transform .34s cubic-bezier(.3, 1.2, .5, 1), background .15s; transition-delay: calc(var(--i) * 30ms + 70ms), calc(var(--i) * 30ms + 70ms), 0s; }
.menu-row .m { flex: 1; font-weight: 660; }
.menu-row b { color: var(--muted); font-weight: 600; font-size: 13.5px; }
.menu-row .ph { width: 18px; height: 18px; flex: none; }
.menu-row:active { background: var(--surface-2); }
.menu-row.on { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.menu-row.on b { color: var(--accent); }
.month-pill .ic { transition: transform .34s cubic-bezier(.3, 1.3, .5, 1); }
.month-pill.open .ic { transform: rotate(180deg); }

/* press-and-slide selection in the month menu */
.month-pill { touch-action: none; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.menu { touch-action: none; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.menu.scroll { touch-action: pan-y; }
.menu-row { position: relative; z-index: 1; }
.menu-row:active { background: none; }
.menu-hl { position: absolute; left: 6px; right: 6px; top: 0; height: 52px; border-radius: 16px; z-index: 0; pointer-events: none; opacity: 0;
  background: color-mix(in srgb, var(--text) 10%, transparent); transform: translateY(0);
  transition: transform .24s cubic-bezier(.3, 1.25, .5, 1), height .2s ease, opacity .14s ease; }
.menu-hl.show { opacity: 1; }

/* date row + in-app calendar */
.datechips { margin-bottom: 8px; }
.datechips .chip { flex: 1; justify-content: center; padding: 11px 8px; }
.datechips .chip.pick { flex: 1.25; gap: 6px; }
.datechips .chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.sheet #calWrap { display: none; }
.sheet.picking #formMain { display: none; }
.sheet.picking #calWrap { display: block; animation: rise .32s cubic-bezier(.2, .8, .2, 1) both; }
.sheet.picking .sheet-foot { display: none; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin: 2px 0 10px; }
.cal-head b { font-size: 18px; font-weight: 740; letter-spacing: -.01em; }
.cal-nav { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--text); transition: transform .12s; }
.cal-nav:active { transform: scale(.92); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-grid > i { display: block; }
.cal-dow { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 6px 0 8px; }
.cal-day { position: relative; height: 48px; border-radius: 16px; font-size: 17px; font-weight: 600; background: var(--surface); border: 1px solid transparent; transition: transform .1s, background .15s; }
.cal-day:active { transform: scale(.92); }
.cal-day.today { box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--accent); }
.cal-day.dot::after { content: ""; position: absolute; left: 50%; bottom: 6px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--muted); }
.cal-day.sel { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 8px 18px -8px color-mix(in srgb, var(--accent) 80%, transparent); }
.cal-day.sel::after { background: #fff; }
.cal-quick { display: flex; justify-content: center; margin-top: 14px; }
.cal-quick .chip { color: var(--accent); }

/* appearance switcher + CSV bits */
.seg.three { grid-template-columns: repeat(3, 1fr); margin-bottom: 0; }
.seg.three button { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 14.5px; }
.seg.three button.on { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.switch.block { margin: 14px 0 4px; align-items: flex-start; line-height: 1.35; }
.switch.block input { margin-top: 2px; flex: none; }

.note-line { margin: 8px 0; padding: 8px 10px; border-radius: 12px; color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }

.badge.retrying { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }

/* brief fade while the page reloads so the status bar can re-read the theme */
body.reloading #app { opacity: 0; transition: opacity .2s ease; }

/* optional: turn the blur off (solid bars) if it ever interferes with the status bar */
html.no-glass #topbar { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
html.no-glass #tabbar { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }

/* hero tiles open the flip card */
.mini:active { transform: scale(.96); }
.mini::after { content: ""; position: absolute; right: 14px; top: 16px; width: 7px; height: 7px; border-right: 2px solid currentColor; border-top: 2px solid currentColor; transform: rotate(45deg); opacity: .55; }
#app[data-flip="income"] .mini[data-kind="income"], #app[data-flip="spent"] .mini[data-kind="spent"] { visibility: hidden; }

/* flip card (Income / Spent breakdown) */
#flip { position: absolute; inset: 0; z-index: 35; pointer-events: none; perspective: 1500px; display: grid; place-items: center; }
#flip.open { pointer-events: auto; }
.flip-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .42); opacity: 0; transition: opacity .45s ease; }
#flip.shown .flip-scrim { opacity: 1; }
.flip-card { position: relative; display: flex; flex-direction: column; width: min(372px, calc(100% - 28px)); max-height: calc(100% - 96px); transform-style: preserve-3d; will-change: transform; }
.flip-face { -webkit-backface-visibility: hidden; backface-visibility: hidden; border-radius: 30px; }
.flip-front { position: relative; flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; background: var(--bg-2); border: 1px solid var(--line); padding: 18px 18px 20px; box-shadow: 0 34px 80px -24px rgba(0, 0, 0, .55); }
.flip-front::-webkit-scrollbar { display: none; }
.flip-back { position: absolute; inset: 0; transform: rotateY(180deg); border: 1px solid rgba(255, 255, 255, .25);
  /* same look as the glass tile on the hero card, so it lands without a colour change */
  background: linear-gradient(rgba(255, 255, 255, .14), rgba(255, 255, 255, .14)), linear-gradient(135deg, var(--hero-a), var(--hero-b)); border-color: rgba(255, 255, 255, .16); }
.flip-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.flip-head h3 { font-size: 24px; font-weight: 760; letter-spacing: -.02em; }
.flip-head small { color: var(--muted); font-size: 13px; font-weight: 600; }
.flip-donut { margin: 10px auto 14px; }
.flip-list { display: flex; flex-direction: column; }
.flip-row { display: flex; align-items: center; gap: 10px; padding: 11px 2px; border-top: 1px solid var(--line); font-size: 15px; }
.flip-row i { width: 12px; height: 12px; border-radius: 4px; background: var(--c); flex: none; }
.flip-row .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.flip-row b { font-weight: 720; font-variant-numeric: tabular-nums; }
.flip-row em { font-style: normal; color: var(--muted); font-weight: 650; min-width: 38px; text-align: right; font-size: 13.5px; }

/* ---------- app lock ---------- */
#lock { display: none; position: absolute; inset: 0; z-index: 1000; background: var(--bg); align-items: center; justify-content: center; padding: 24px;
  text-align: center; overscroll-behavior: none; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
html.locked #lock, html.cover #lock { display: flex; }
html.locked #app, html.cover #app { visibility: hidden; }
html.cover:not(.locked) #lock .lock-in > :not(.lock-logo) { visibility: hidden; }
.lock-in { width: min(320px, 100%); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.lock-logo { width: 84px; height: 84px; border-radius: 26px; margin-bottom: 12px; box-shadow: 0 16px 34px -14px rgba(30, 30, 90, .5); }
#lock h2 { font-size: 24px; font-weight: 760; letter-spacing: -.02em; margin: 0; }
#lock p { color: var(--muted); margin: 0 0 8px; min-height: 22px; }
.lock-bio { color: var(--accent); margin: 22px 0 10px; animation: pulse-soft 2.2s ease-in-out infinite; }
@keyframes pulse-soft { 50% { opacity: .55; transform: scale(.94); } }
.lock-reset { margin-top: 26px; color: var(--muted); font-size: 14px; font-weight: 600; padding: 10px 14px; border-radius: 12px; }
.pin-dots { display: flex; gap: 16px; justify-content: center; margin: 14px 0 22px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); transition: background .12s, transform .12s; }
.pin-dots i.on { background: var(--text); border-color: var(--text); transform: scale(1.1); }
.pin-dots.shake { animation: shake .35s; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 78px); gap: 14px; justify-content: center; }
.pin-pad button { width: 78px; height: 78px; border-radius: 50%; font-size: 28px; font-weight: 500; background: var(--surface); border: 1px solid var(--line); transition: transform .08s, background .12s; }
.pin-pad button:active { transform: scale(.92); background: var(--surface-2); }
.seg.four { grid-template-columns: repeat(4, 1fr); margin-bottom: 0; }
.seg.four button { font-size: 13.5px; }
.seg.four button.on { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.row-btns { display: flex; gap: 8px; }
.row-btns .btn { flex: 1; margin-top: 12px; }

/* ---- smart insights ---- */
.insights { padding-bottom: 6px; }
.ins { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; color: inherit; font: inherit; padding: 11px 0; border: 0; border-top: 1px solid var(--line); background: none; border-radius: 0; }
.ins-t { align-self: center; }
.card-h + .ins { border-top: 0; }
button.ins { cursor: pointer; } button.ins:active { opacity: .6; }
.ins .bubble { flex: none; }
.ins-t { flex: 1; min-width: 0; }
.ins-t b { display: block; font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.ins-t small { display: block; margin-top: 2px; font-size: 13px; line-height: 1.35; color: var(--muted); }
.ins em { flex: none; font-style: normal; font-size: 12.5px; font-weight: 700; padding: 4px 9px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent); }
.ins.good em { background: color-mix(in srgb, var(--pos) 15%, transparent); color: var(--pos); }
.ins.warn em { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }

.seg.two { grid-template-columns: repeat(2, 1fr); margin: 0 0 6px; }
.seg.two button { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg.two button.on { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.ins-seg + .ins { border-top: 0; }

.ins-bar { display: block; height: 6px; margin-top: 8px; border-radius: 99px; background: color-mix(in srgb, var(--muted) 22%, transparent); overflow: hidden; }
.ins-bar i { display: block; height: 100%; border-radius: 99px; background: var(--pos); }
.ins.warn .ins-bar i { background: var(--warn); }

/* ---- spending accounts ---- */
.acc-chips { margin: 2px 0 12px; }
.acc-chips .chip { gap: 6px; }
.acc-row { width: 100%; text-align: left; color: inherit; font: inherit; background: none; border: 0; cursor: pointer; }
.acc-row:active { opacity: .6; }
.acc-row .bar-main { display: block; }
.acc-row .bar-top { display: flex; }
.acc-row .bar-top small { font-weight: 500; color: var(--muted); }
.acc-row.near .bar i { background: var(--warn); }
.acc-row.over .bar i { background: var(--neg); }
.acc-pick { margin-top: 10px; }
.acc-pick .chip { gap: 6px; }
.acc-set { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.acc-set:first-of-type { border-top: 0; }
.acc-set.off { opacity: .55; }
.acc-name { flex: 1; min-width: 0; }
.acc-name b { display: block; font-size: 15px; }
.acc-name small { color: var(--muted); font-size: 12.5px; }
.acc-limit { width: 104px; height: 40px; padding: 0 10px; text-align: right; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font-size: 15px; outline: 0; }
.acc-limit:focus { border-color: var(--accent); }
.acc-new { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.acc-new .field { margin: 8px 0; }
.acc-row .bar { display: block; }
.acc-row .bar i { display: block; }
.seg.two button { display: flex; align-items: center; justify-content: center; gap: 6px; }
.acc-set .chip { padding: 7px 12px; font-size: 13px; }

/* ---- quick add ---- */
.sheet #quickWrap { display: none; }
.sheet.quickmode #formMain { display: none; }
.sheet.quickmode #quickWrap { display: block; animation: rise .32s cubic-bezier(.2, .8, .2, 1) both; }
.sheet.quickmode #saveBtn { display: none; }
.sheet:not(.quickmode) #quickBtn { display: none; }
.sheet.quickmode.picking #quickBtn { display: none; }
#qText { width: 100%; min-height: 84px; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); font: inherit; font-size: 16px; line-height: 1.4; outline: 0; resize: none; color: inherit; }
#qText:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
.q-tools { display: flex; gap: 8px; align-items: center; margin: 10px 0 2px; flex-wrap: wrap; }
.q-tools .chip { gap: 6px; }
.q-tools .chip.on { background: var(--accent); color: #fff; border-color: transparent; }
.q-lang { display: inline-flex; gap: 6px; margin-left: auto; }
.q-hint { margin: 8px 2px 4px; min-height: 1.2em; }
.q-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); }
.q-row:first-child { border-top: 0; }
.q-check { flex: none; width: 22px; height: 22px; accent-color: var(--accent); }
.q-main { flex: 1; min-width: 0; text-align: left; color: inherit; font: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.q-main b { display: block; font-size: 15px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-main small { display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.q-amt { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.q-amt.inc { color: var(--pos); }
.q-badge { font-style: normal; font-weight: 700; font-size: 11.5px; padding: 2px 8px; border-radius: 999px; margin-left: 4px; background: color-mix(in srgb, var(--muted) 18%, transparent); color: var(--muted); white-space: nowrap; }
.q-badge.t-warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.q-badge.t-check { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.q-row.t-dup { opacity: .7; }

/* ---- hide balance, streak, weekly chart ---- */
.streak { padding: 14px 16px 12px; }
.streak-h { display: flex; align-items: center; gap: 12px; }
.flame { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; color: var(--muted); background: color-mix(in srgb, var(--muted) 14%, transparent); }
.flame.lit { color: #F97316; background: color-mix(in srgb, #F97316 16%, transparent); }
.streak-t b { display: block; font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.streak-t small { color: var(--muted); font-size: 13px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 12px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.wd i { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--muted) 14%, transparent); color: #fff; }
.wd.on i { background: #F97316; }
.wd.today i { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.wd.future i { opacity: .45; }
.wd em { font-style: normal; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.trend.week7 { gap: 6px; }
.trend.week7 .tcol { cursor: default; }
.trend.week7 .tcol b { font-size: 10.5px; min-height: 13px; }

.sheet-foot { display: flex; gap: 10px; align-items: stretch; }
.sheet-foot .btn.primary { flex: 1; min-width: 0; }
.sheet-foot .btn.sq { flex: none; width: 58px; padding: 0; display: grid; place-items: center; }
.sheet.picking .sheet-foot { display: none; }
.sheet-foot .btn.sq { height: 56px; }

#heroAmt { cursor: pointer; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; width: fit-content; }
#heroAmt:active { opacity: .8; }

/* privacy mode: soft blur over the masking dots */
.pv { display: inline-block; filter: blur(4px); user-select: none; -webkit-user-select: none; pointer-events: none; }
.hero-amt .pv { filter: blur(11px); }
html.privacy input[readonly].acc-limit, html.privacy #budgetInput[readonly] { filter: blur(4px); }
#heroAmt { min-width: 120px; min-height: 1.1em; }

/* ---- passphrase screen ---- */
#lockPass { width: min(320px, 86vw); margin-top: 22px; display: flex; flex-direction: column; gap: 12px; }
#lockPass[hidden] { display: none; }
#lockPass input { height: 54px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); padding: 0 16px; font-size: 17px; color: inherit; text-align: center; outline: 0; }
#lockPass input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
#lockPass .btn { margin-top: 0; }
#lockPass.shake { animation: shake .4s; }

/* ---- settings: grouped rows and sub-pages ---- */
.set-h { margin: 18px 6px 8px; font-size: 12.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.slist { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); }
.srow { display: flex; align-items: center; gap: 13px; width: 100%; text-align: left; color: inherit; font: inherit; padding: 12px 14px; background: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; cursor: pointer; }
.srow:first-child { border-top: 0; }
.srow:active { background: color-mix(in srgb, var(--muted) 10%, transparent); }
.srow-t { flex: 1; min-width: 0; }
.srow-t b { display: block; font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.srow-t small { display: block; margin-top: 1px; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow-go { flex: none; color: var(--muted); opacity: .7; transform: rotate(-90deg); display: grid; place-items: center; }
.page-title { font-size: 28px; font-weight: 800; letter-spacing: -.03em; margin: 4px 4px 14px; }
.month-pill.back { gap: 6px; }
.sync-card { margin-bottom: 0; }

/* ---- the bars and the page stay put; only the content scrolls ----
   iOS applies "no bounce" to the page only when it is set on the root element, and a scroller that doesn't contain its
   own overscroll hands the pull on to the page. */
html { overscroll-behavior: none; }
#view { overscroll-behavior-y: contain; }
#topbar, #tabbar { touch-action: none; }
.linkbtn { display: block; width: 100%; margin-top: 12px; padding: 8px; text-align: center; color: var(--accent); font-weight: 650; font-size: 14px; }

/* ---------- sliding highlight for pill groups (js/slide.js) ---------- */
.slide-ready { position: relative; isolation: isolate; }
.slide-ind { position: absolute; left: 0; top: 0; z-index: -1; pointer-events: none; box-sizing: border-box; border: 1px solid transparent;
  will-change: transform; transition: transform .42s cubic-bezier(.3, 1.2, .4, 1), width .42s cubic-bezier(.3, 1.2, .4, 1), height .3s ease, background-color .3s ease, border-color .3s ease; }
.slide-ready > .on { background: transparent !important; border-color: transparent !important; }
.slide-ready > .chip { position: relative; background: transparent; border-color: transparent; }
.slide-ready > .chip::before { content: ''; position: absolute; inset: 0; z-index: -2; border-radius: inherit; background: var(--surface); border: 1px solid var(--line); transition: opacity .25s; }
.slide-ready > .chip.on::before { opacity: 0; }

/* switching wallet: the content under the pills fades in softly */
.page.swap > *:not(.acc-chips):not(#accChips) { animation: swapin .32s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes swapin { from { opacity: .3; transform: translateY(8px); } }

/* ---------- subscriptions (js/subs.js) ---------- */
.bl { display: inline-block; width: 1em; height: 1em; background: currentColor; -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; vertical-align: -.12em; }
.mark { width: 30px; height: 30px; border-radius: 8px; background: rgba(255, 255, 255, .95); color: var(--c); display: inline-grid; place-items: center; font-weight: 900; font-size: 15px; flex: none; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.mark .bl { width: 18px; height: 18px; }
.card .mark, .spot .mark { background: var(--c); color: #fff; }
.mark.big { width: 40px; height: 40px; border-radius: 11px; font-size: 19px; } .mark.big .bl { width: 22px; height: 22px; }
.subs-strip { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; }
.subs-strip .ring { width: 36px; height: 36px; flex: none; }
.subs-strip-t { flex: 1; min-width: 0; } .subs-strip-t b { display: block; } .subs-strip-t small { color: var(--muted); }
.subs-strip-a { font-variant-numeric: tabular-nums; }
.strip7 { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 10px; }
.strip7::-webkit-scrollbar { display: none; }
.sd { flex: none; width: 40px; border-radius: 12px; padding: 5px 0 6px; text-align: center; font-size: 11px; color: var(--muted); background: color-mix(in srgb, var(--text) 5%, transparent); }
.sd b { display: block; font-size: 14px; color: var(--text); }
.sd.today { background: var(--accent); color: #fff; } .sd.today b { color: #fff; }
.sd .dot { width: 16px; height: 16px; border-radius: 50%; margin: 4px auto 0; background: var(--c); color: #fff; font-size: 9px; font-weight: 800; display: grid; place-items: center; }
.sd .dot .bl { width: 10px; height: 10px; } .sd .dot.none { background: transparent; }
.wtotal { display: flex; justify-content: space-between; align-items: flex-end; margin: 4px 0 12px; }
.wtotal .big { font-size: 30px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.wtotal .next { font-size: 13px; text-align: right; }
.wallet { position: relative; transition: height .55s cubic-bezier(.2, 1.15, .3, 1); }
.wcard { position: absolute; left: 0; right: 0; aspect-ratio: 1.586; border-radius: 16px; color: #fff; cursor: pointer; perspective: 1200px;
  transition: transform .55s cubic-bezier(.2, 1.15, .3, 1), top .55s cubic-bezier(.2, 1.15, .3, 1), filter .3s; -webkit-user-select: none; user-select: none; }
.wcard.done .front .grid b:first-child, .wcard.sleepy { filter: saturate(.75); }
.wcard .face { position: absolute; inset: 0; border-radius: 16px; padding: 14px 16px; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  transition: transform .7s cubic-bezier(.2, 1, .3, 1);
  background: radial-gradient(120% 90% at 0% 0%, color-mix(in srgb, var(--c) 70%, #fff 30%) 0%, transparent 55%), linear-gradient(160deg, var(--c), color-mix(in srgb, var(--c) 55%, #000 45%));
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .28), inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .18), 0 14px 28px -14px rgba(0, 0, 0, .55); }
.wcard .face::before { content: ''; position: absolute; inset: 0; opacity: .13; mix-blend-mode: overlay; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.wcard .face::after { content: ''; position: absolute; inset: -40% -10% auto -10%; height: 80%; pointer-events: none; background: linear-gradient(175deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0) 60%); transform: rotate(-8deg); }
.wcard .back { transform: rotateY(180deg); background: linear-gradient(160deg, color-mix(in srgb, var(--c) 60%, #000 40%), color-mix(in srgb, var(--c) 35%, #000 65%)); }
.wcard.flip .front { transform: rotateY(-180deg); } .wcard.flip .back { transform: rotateY(0); }
.wcard .top { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; height: 30px; }
.wcard .name { font-size: 16px; font-weight: 700; letter-spacing: -.01em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wcard .fld { text-align: right; }
.wcard .fld i, .wcard .grid i { display: block; font-style: normal; font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .7; }
.wcard .fld b { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.wcard .grid { position: absolute; z-index: 1; left: 16px; right: 16px; bottom: 14px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.wcard .grid b { font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.wcard .grid div:last-child { text-align: right; }
.wcard .back .grid { bottom: auto; top: 98px; } .wcard .back .grid.g2 { top: 54px; }
.wcard .back .btns { position: absolute; z-index: 1; left: 16px; right: 16px; bottom: 14px; display: flex; gap: 8px; }
.wcard .back button { flex: 1; border: 0; border-radius: 10px; padding: 10px 6px; font-weight: 700; font-size: 13.5px; white-space: nowrap; background: rgba(255, 255, 255, .16); color: #fff; }
.wcard .back button.main { background: #fff; color: color-mix(in srgb, var(--c) 80%, #000); flex: 1.4; }
.wcard .back button.more { flex: .6; }
.wcard .back button[disabled] { opacity: .9; }
.wcard .r7 { position: absolute; z-index: 2; left: 16px; top: 56px; display: flex; gap: 6px; }
.wcard .r7 button { border: 0; border-radius: 99px; padding: 3px 9px; background: rgba(255, 255, 255, .14); font-size: 13px; box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .3); }
.wcard .r7 button.on { background: rgba(255, 255, 255, .9); }
.wcard.focus { position: fixed !important; z-index: 810 !important; transition: transform .62s cubic-bezier(.2, 1.05, .3, 1) !important; }
.wcard.focus .face { box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .28), inset 0 1px 0 rgba(255, 255, 255, .25), 0 30px 60px -20px rgba(0, 0, 0, .65); }
.wdim { position: fixed; inset: 0; z-index: 800; background: rgba(8, 10, 20, .38); -webkit-backdrop-filter: blur(16px) saturate(1.2); backdrop-filter: blur(16px) saturate(1.2); opacity: 0; pointer-events: none; transition: opacity .45s ease; }
.wdim.on { opacity: 1; pointer-events: auto; }
.whint { position: fixed; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom) + 28px); text-align: center; color: #fff; font-size: 13px; font-weight: 600; opacity: 0; transition: opacity .4s .3s; z-index: 805; pointer-events: none; }
.wdim.on + .whint { opacity: .85; }
.savebox { margin: 0 0 12px; padding: 12px 14px; border-radius: 16px; background: color-mix(in srgb, var(--pos) 12%, transparent); color: var(--pos); font-weight: 650; font-size: 14px; }
.spot { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.spot:first-of-type { border-top: 0; }
.spot-t { flex: 1; min-width: 0; } .spot-t b { display: block; } .spot-t small { color: var(--muted); }
.subs-form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.subs-form select { width: 100%; height: 50px; padding: 0 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); font-size: 16px; color: var(--text); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 12px; }
.swatches .sw { width: 30px; height: 30px; border-radius: 50%; background: var(--c); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
.swatches .sw.on { box-shadow: 0 0 0 2px var(--text); }
.center { text-align: center; } .xs { font-size: 12px; }
.chip.danger { background: var(--neg); color: #fff; border-color: transparent; }
.acc-set { flex-wrap: wrap; }
.acc-acts { flex-basis: 100%; display: flex; gap: 8px; padding-left: 50px; }
.acc-acts .chip { gap: 5px; }
.del-acc .seg { margin: 4px 0 12px; }
.da-head { display: flex; justify-content: space-between; align-items: center; margin: 4px 2px 6px; }
.da-list { max-height: 42vh; overflow-y: auto; margin-bottom: 10px; }
.da-row { width: 100%; text-align: left; gap: 10px; }
.da-box { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line); display: grid; place-items: center; flex: none; color: #fff; }
.da-row.on .da-box { background: var(--accent); border-color: var(--accent); }
.da-row:not(.on) .row-t { color: var(--muted); text-decoration: line-through; }
