/* ============ Tokens ============ */
:root {
  --bg: #eef0f6;
  --surface: #ffffff;
  --surface-2: #f2f4f9;
  --text: #161a26;
  --muted: #8a8fa3;
  --border: #e6e8f0;
  --primary: #6c3ce0;
  --primary-2: #9b5cf6;
  --primary-soft: #f0e9ff;
  --primary-grad: linear-gradient(135deg, #7c4dff 0%, #5b2bd9 60%, #4a1fc4 100%);
  --danger: #e5484d;
  --danger-soft: #fdecec;
  --warn: #e8930c;
  --warn-soft: #fef4e0;
  --success: #18a058;
  --success-soft: #e6f7ec;
  --shadow: 0 8px 28px rgba(35, 25, 90, .10);
  --shadow-sm: 0 3px 12px rgba(35, 25, 90, .08);
  --radius: 22px;
  --nav-h: 72px;
  --phone-w: 430px;
}
[data-theme="dark"] {
  --bg: #101319;
  --surface: #1a1f2b;
  --surface-2: #232a3b;
  --text: #eef1f8;
  --muted: #98a0b6;
  --border: #2b3448;
  --primary: #9b7bff;
  --primary-2: #b794ff;
  --primary-soft: #2a2350;
  --primary-grad: linear-gradient(135deg, #7c4dff 0%, #5b2bd9 60%, #4a1fc4 100%);
  --danger: #f87171;
  --danger-soft: #3a1f24;
  --warn: #fbbf24;
  --warn-soft: #3a2c14;
  --success: #4ade80;
  --success-soft: #14301f;
  --shadow: 0 8px 28px rgba(0, 0, 0, .45);
  --shadow-sm: 0 3px 12px rgba(0, 0, 0, .35);
}

/* ============ Base ============ */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #dfe2ec;
  color: var(--text);
  line-height: 1.5;
}
[data-theme="dark"] body { background: #0a0d13; }
.phone {
  max-width: var(--phone-w);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
  box-shadow: 0 0 60px rgba(20, 15, 60, .18);
}
h2 { font-size: 1.5rem; margin: 0; letter-spacing: -.01em; }
h3 { font-size: 1.02rem; margin: 1.5rem 0 .7rem; letter-spacing: -.01em; }
.muted { color: var(--muted); font-size: .9rem; }
.error { color: var(--danger); font-size: .85rem; min-height: 1.2em; margin: .4rem 0 0; }
.link { background: none; border: none; color: var(--primary); cursor: pointer; font-size: .85rem; font-weight: 600; padding: .2rem 0; }
.danger-text { color: var(--danger); }
.success-text { color: var(--success); }
.bottom-space { height: calc(var(--nav-h) + 36px); }
[hidden] { display: none !important; }
.pressable { transition: transform .12s ease; }
.pressable:active { transform: scale(.96); }

/* ============ Views transition ============ */
#views { min-height: 100vh; min-height: 100dvh; }
.view { animation: view-in .28s ease; padding-bottom: 1rem; }
@keyframes view-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ============ Auth ============ */
.auth-screen {
  min-height: 100vh; min-height: 100dvh;
  background: linear-gradient(160deg, #7c4dff 0%, #5b2bd9 55%, #3d17a8 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 1.4rem; position: relative; overflow: hidden;
}
.auth-deco { position: absolute; border-radius: 50%; background: rgba(255,255,255,.09); }
.auth-deco.d1 { width: 280px; height: 280px; top: -90px; right: -70px; }
.auth-deco.d2 { width: 180px; height: 180px; bottom: 8%; left: -60px; }
.auth-deco.d3 { width: 110px; height: 110px; top: 22%; left: 12%; background: rgba(255,255,255,.06); }
.auth-card {
  width: 100%; max-width: 380px; position: relative; z-index: 1;
  background: var(--surface); border-radius: 28px;
  box-shadow: 0 24px 60px rgba(20, 8, 70, .35);
  padding: 2rem 1.6rem; text-align: center;
  animation: view-in .35s ease;
}
.auth-logo {
  width: 72px; height: 72px; margin: 0 auto;
  font-size: 2.2rem; display: flex; align-items: center; justify-content: center;
  border-radius: 22px; background: var(--primary-grad); color: #fff;
  box-shadow: 0 10px 24px rgba(108, 60, 224, .4);
}
.auth-card h1 { margin: .9rem 0 0; font-size: 1.35rem; letter-spacing: -.02em; }
.auth-card .muted { margin: .25rem 0 1.2rem; }
.auth-tabs { display: flex; gap: .4rem; margin-bottom: 1.1rem; background: var(--surface-2); border-radius: 14px; padding: .3rem; }
.auth-tabs button {
  flex: 1; padding: .6rem; border-radius: 10px; border: none;
  background: transparent; color: var(--muted); cursor: pointer; font-size: .92rem; font-weight: 600;
  transition: all .18s ease;
}
.auth-tabs button.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.auth-card form { text-align: left; }
.demo-box {
  margin-top: 1.1rem; font-size: .82rem; color: var(--muted);
  background: var(--surface-2); border-radius: 14px; padding: .7rem .9rem; line-height: 1.7;
}
.demo-box b { color: var(--text); }

/* ============ Forms ============ */
label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .75rem; color: var(--text); }
input, select {
  width: 100%; margin-top: .35rem; padding: .78rem .9rem;
  border: 1.5px solid var(--border); border-radius: 14px;
  background: var(--surface); color: var(--text); font-size: .98rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input[type="color"] { height: 48px; padding: .3rem; cursor: pointer; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }

/* ============ Buttons ============ */
.btn {
  border: none; border-radius: 16px; padding: .85rem 1.1rem;
  font-size: .95rem; font-weight: 700; cursor: pointer;
  transition: transform .08s ease, opacity .15s ease, box-shadow .15s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary-grad); color: #fff; box-shadow: 0 8px 20px rgba(108, 60, 224, .35); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-block { width: 100%; margin-top: .5rem; }
.icon-btn {
  background: var(--surface); border: 1px solid var(--border); border-radius: 50%;
  width: 42px; height: 42px; font-size: 1.15rem; cursor: pointer; color: var(--text);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm); position: relative; transition: transform .1s ease;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn.primary { background: var(--primary-grad); color: #fff; border: none; font-size: 1.5rem; }
.icon-btn .dot {
  position: absolute; top: 8px; right: 9px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--danger); border: 2px solid var(--surface);
}

/* ============ Home header ============ */
.home-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.1rem 1.2rem .4rem;
}
.greet { display: flex; align-items: center; gap: .7rem; }
.avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--primary-grad); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.2rem; flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(108, 60, 224, .35);
}
.avatar.big { width: 58px; height: 58px; font-size: 1.5rem; }
.greet-text small { display: block; color: var(--muted); font-size: .78rem; }
.greet-text b { font-size: 1.05rem; letter-spacing: -.01em; }
.head-actions { display: flex; gap: .55rem; }

/* ============ Hero ============ */
.hero {
  margin: 1rem 1.2rem 0; padding: 1.3rem 1.3rem 1.2rem;
  border-radius: var(--radius); color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #7c4dff 0%, #5b2bd9 55%, #4318b8 100%);
  box-shadow: 0 14px 34px rgba(92, 45, 220, .4);
}
.hero-deco { position: absolute; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.1); top: -80px; right: -50px; }
.hero-deco::after { content: ""; position: absolute; width: 130px; height: 130px; border-radius: 50%; background: rgba(255,255,255,.08); bottom: -40px; left: -70px; }
.hero small { opacity: .82; font-size: .78rem; position: relative; }
.hero-amount { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; margin: .15rem 0 .8rem; position: relative; }
.hero-row { display: flex; justify-content: space-between; position: relative; }
.hero-row .tr { text-align: right; }
.hero-row small { display: block; font-size: .72rem; opacity: .8; }
.hero-row b { font-size: 1.02rem; }
.hero-bar { height: 8px; border-radius: 5px; background: rgba(255,255,255,.25); margin-top: .9rem; overflow: hidden; position: relative; }
.hero-bar > div { height: 100%; border-radius: 5px; background: #fff; transition: width .5s ease; box-shadow: 0 0 8px rgba(255,255,255,.7); }

/* ============ Section heads ============ */
.sec-head { display: flex; justify-content: space-between; align-items: center; padding: 0 1.2rem; }
.sec-head h3, #view-home > h3 { padding: 0 1.2rem; }
#view-home > h3 { margin-bottom: .7rem; }

/* ============ Bank card (credit-card look) ============ */
.bank-card {
  border-radius: 20px; padding: 1.05rem 1.2rem; color: #fff;
  aspect-ratio: 1.586; display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: 0 14px 32px rgba(10, 8, 40, .32); cursor: pointer;
  position: relative; overflow: hidden; flex-shrink: 0;
  transition: transform .12s ease;
}
.bank-card:active { transform: scale(.97); }
.bank-card::before { /* shine */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, rgba(255,255,255,.25) 0%, transparent 42%);
}
.bank-card::after { /* decorative circle */
  content: ""; position: absolute; width: 190px; height: 190px; border-radius: 50%;
  background: rgba(255,255,255,.09); right: -55px; bottom: -70px; pointer-events: none;
}
.bc-top { display: flex; justify-content: space-between; align-items: flex-start; position: relative; z-index: 1; }
.bc-bank { font-size: .82rem; font-weight: 600; opacity: .95; letter-spacing: .02em; }
.bc-bank small { display: block; font-weight: 400; opacity: .75; font-size: .68rem; }
.bc-brand { display: flex; align-items: center; }
.brand-visa { font-style: italic; font-weight: 800; font-size: 1.15rem; letter-spacing: .12em; }
.brand-mc { display: inline-flex; }
.brand-mc i { width: 26px; height: 26px; border-radius: 50%; display: block; }
.brand-mc i:first-child { background: #eb001b; }
.brand-mc i:last-child { background: #f79e1b; opacity: .9; margin-left: -11px; }
.brand-jcb { font-weight: 800; font-size: 1rem; letter-spacing: .08em; }
.brand-emoji { font-size: 1.4rem; }
.bc-mid { display: flex; align-items: center; gap: .8rem; position: relative; z-index: 1; }
.chip {
  width: 46px; height: 34px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg, #f7dd8a 0%, #dfa94e 55%, #f3c968 100%);
  box-shadow: inset 0 0 0 1.5px rgba(120, 70, 10, .35);
  position: relative;
}
.chip::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1.5px; background: rgba(120,70,10,.4); }
.chip::after { content: ""; position: absolute; top: 0; bottom: 0; left: 32%; width: 1.5px; background: rgba(120,70,10,.4); box-shadow: 15px 0 0 rgba(120,70,10,.4); }
.bc-number { font-size: 1.28rem; letter-spacing: .16em; font-family: "SF Mono", ui-monospace, Consolas, monospace; font-weight: 500; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.bc-bottom { display: flex; justify-content: space-between; align-items: flex-end; position: relative; z-index: 1; }
.bc-holder { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; opacity: .92; max-width: 45%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-meta { display: flex; gap: 1rem; text-align: right; }
.bc-meta small { display: block; font-size: .58rem; opacity: .7; letter-spacing: .12em; }
.bc-meta span { font-size: .82rem; font-weight: 600; letter-spacing: .05em; }
.bc-wave { position: absolute; top: 4.4rem; right: 1.15rem; opacity: .8; z-index: 1; }

/* ============ Carousel ============ */
.carousel {
  display: flex; gap: .9rem; overflow-x: auto;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
  padding: .4rem 1.2rem 1rem; scrollbar-width: none;
}
.carousel::-webkit-scrollbar { display: none; }
.carousel .bank-card { width: 78%; scroll-snap-align: center; }
.carousel-empty { width: 100%; }
.dots { display: flex; gap: .4rem; justify-content: center; margin: -.3rem 0 .4rem; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--border); transition: all .2s ease; }
.dots i.on { width: 22px; border-radius: 4px; background: var(--primary); }

/* ============ Quick actions ============ */
.quick-actions { display: flex; gap: .7rem; padding: 0 1.2rem; }
.quick-actions button {
  flex: 1; border: none; cursor: pointer; background: var(--surface);
  border-radius: 18px; padding: .9rem .4rem; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; align-items: center; gap: .45rem;
  font-size: .8rem; font-weight: 600; color: var(--text);
}
.qa-icon {
  width: 46px; height: 46px; border-radius: 16px; font-size: 1.4rem;
  display: flex; align-items: center; justify-content: center;
}
.qa-icon.spend { background: var(--danger-soft); }
.qa-icon.payment { background: var(--success-soft); }
.qa-icon.add { background: var(--primary-soft); }

/* ============ Reminders ============ */
.reminders { display: flex; flex-direction: column; gap: .6rem; padding: 0 1.2rem; }
.reminder {
  display: flex; gap: .75rem; align-items: center;
  background: var(--surface); border-radius: 16px; padding: .8rem .95rem;
  box-shadow: var(--shadow-sm); font-size: .88rem; border: 1px solid var(--border);
}
.reminder .r-icon {
  width: 40px; height: 40px; border-radius: 13px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 1.25rem;
  background: var(--warn-soft);
}
.reminder.urgent .r-icon { background: var(--danger-soft); }
.reminder b { display: block; font-size: .9rem; }
.reminder small { color: var(--muted); font-size: .78rem; }
.empty {
  color: var(--muted); font-size: .88rem; background: var(--surface);
  border-radius: 16px; padding: 1.2rem; text-align: center; border: 1px dashed var(--border);
}

/* ============ Transactions ============ */
.tx-list { display: flex; flex-direction: column; gap: .55rem; padding: 0 1.2rem; }
.tx {
  display: flex; align-items: center; gap: .75rem;
  background: var(--surface); border-radius: 16px; padding: .7rem .8rem;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  animation: view-in .25s ease;
}
.tx-icon {
  font-size: 1.3rem; width: 44px; height: 44px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px; background: var(--surface-2);
}
.tx-body { flex: 1; min-width: 0; }
.tx-note { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-sub { font-size: .75rem; color: var(--muted); }
.tx-right { text-align: right; }
.tx-amount { font-weight: 700; white-space: nowrap; font-size: .92rem; display: block; }
.tx-amount.spend { color: var(--danger); }
.tx-amount.payment { color: var(--success); }
.tx-ops { display: flex; gap: .1rem; justify-content: flex-end; }
.tx-ops button { background: none; border: none; cursor: pointer; font-size: .95rem; padding: .25rem; opacity: .7; }
.tx-ops button:active { opacity: 1; transform: scale(1.15); }

/* ============ Cards page ============ */
.page-head { display: flex; justify-content: space-between; align-items: center; padding: 1.1rem 1.2rem .6rem; }
.total-strip {
  margin: 0 1.2rem .9rem; padding: 1rem 1.2rem;
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-sm);
  display: flex; justify-content: space-between; border: 1px solid var(--border);
}
.total-strip small { display: block; color: var(--muted); font-size: .75rem; }
.total-strip b { font-size: 1.15rem; letter-spacing: -.01em; }
.total-strip .tr { text-align: right; }
.cards-list { display: flex; flex-direction: column; gap: 1rem; padding: 0 1.2rem; }
.card-item { animation: view-in .3s ease; }
.card-item .bank-card { width: 100%; }
.card-item-meta { display: flex; justify-content: space-between; align-items: center; margin-top: .55rem; padding: 0 .2rem; font-size: .82rem; }
.card-item-meta .pct { font-weight: 700; color: var(--primary); }
.mini-bar { height: 7px; border-radius: 4px; background: var(--surface-2); margin: .45rem .2rem 0; overflow: hidden; border: 1px solid var(--border); }
.mini-bar > div { height: 100%; border-radius: 4px; background: var(--primary-grad); transition: width .5s ease; }
.mini-bar > div.warn { background: linear-gradient(90deg, #f5a623, #e8930c); }
.mini-bar > div.danger { background: linear-gradient(90deg, #f0564f, #d92d20); }
.due-pill { font-size: .75rem; color: var(--muted); background: var(--surface-2); padding: .2rem .6rem; border-radius: 20px; }
.due-pill.urgent { color: var(--danger); background: var(--danger-soft); font-weight: 700; }

/* ============ Card detail ============ */
.detail-hero { position: relative; padding: 1rem 1.2rem 1.4rem; color: #fff; overflow: hidden; transition: background .3s ease; }
.detail-hero::before { content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%; background: rgba(255,255,255,.1); top: -90px; right: -70px; }
.back-btn {
  width: 40px; height: 40px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,.18); color: #fff; font-size: 1.5rem; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; backdrop-filter: blur(4px);
}
.detail-hero-actions { position: absolute; top: 1rem; right: 1.2rem; display: flex; gap: .5rem; }
.chip-btn {
  width: 40px; height: 40px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,.18); font-size: 1.05rem; backdrop-filter: blur(4px);
  display: inline-flex; align-items: center; justify-content: center;
}
.chip-btn.danger { background: rgba(229, 72, 77, .35); }
.detail-card-slot { margin-top: .8rem; position: relative; z-index: 1; }
.detail-card-slot .bank-card { width: 100%; cursor: default; }
.detail-nums { display: flex; gap: .7rem; margin-top: 1rem; position: relative; z-index: 1; }
.detail-nums > div {
  flex: 1; background: rgba(255,255,255,.14); border-radius: 16px; padding: .7rem .8rem;
  backdrop-filter: blur(6px);
}
.detail-nums small { display: block; font-size: .7rem; opacity: .85; }
.detail-nums b { font-size: .98rem; }
.ring-card {
  margin: -1.1rem 1.2rem 0; padding: 1.1rem 1.2rem;
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 1.1rem; position: relative; z-index: 2;
}
.ring-wrap { position: relative; width: 104px; height: 104px; flex-shrink: 0; }
.ring { width: 104px; height: 104px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 11; }
.ring-fg { fill: none; stroke: url(#ringGrad); stroke: var(--primary); stroke-width: 11; stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-center b { font-size: 1.25rem; letter-spacing: -.02em; }
.ring-center small { color: var(--muted); font-size: .68rem; }
.ring-stats { flex: 1; display: flex; flex-direction: column; gap: .55rem; }
.ring-stats small { display: block; color: var(--muted); font-size: .72rem; }
.ring-stats b { font-size: 1rem; }
.detail-qa { display: flex; gap: .7rem; padding: 1rem 1.2rem 0; }
.detail-qa .btn { flex: 1; }
.month-row { display: flex; justify-content: space-between; align-items: center; padding: 0 1.2rem; }
.month-row h3 { margin: 1.3rem 0 .6rem; padding: 0; }
.month-row input { width: auto; margin: 0; padding: .55rem .7rem; font-size: .85rem; }
.tx-tabs { display: flex; gap: .45rem; padding: .2rem 1.2rem .7rem; }
.tx-tabs button {
  flex: 1; padding: .55rem; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); font-size: .83rem; font-weight: 600; cursor: pointer;
  transition: all .15s ease;
}
.tx-tabs button.active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(108,60,224,.3); }

/* ============ Settings ============ */
.profile-card {
  margin: .4rem 1.2rem 0; padding: 1.1rem 1.2rem;
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: .9rem; border: 1px solid var(--border);
}
.profile-card b { display: block; font-size: 1.05rem; }
.setting-rows { display: flex; flex-direction: column; gap: .6rem; padding: .9rem 1.2rem 0; }
.setting-row {
  display: flex; align-items: center; gap: .85rem; width: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  padding: .95rem 1.1rem; cursor: pointer; box-shadow: var(--shadow-sm); text-align: left;
  color: var(--text); transition: transform .1s ease;
}
.setting-row:active { transform: scale(.98); }
.sr-icon { width: 42px; height: 42px; border-radius: 14px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.sr-text { flex: 1; }
.sr-text b { display: block; font-size: .94rem; }
.sr-text small { color: var(--muted); font-size: .76rem; }
.sr-arrow { color: var(--muted); font-size: 1.4rem; }
.switch { width: 50px; height: 30px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); position: relative; transition: background .2s ease; flex-shrink: 0; }
.switch i { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25); transition: left .2s ease; }
.switch.on { background: var(--primary); border-color: var(--primary); }
.switch.on i { left: 23px; }
.app-info { text-align: center; margin-top: 1.6rem; line-height: 1.7; font-size: .8rem; }

/* ============ Bottom nav ============ */
.bottomnav {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 30;
  width: 100%; max-width: var(--phone-w);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding: 0 1.4rem env(safe-area-inset-bottom);
  display: flex; align-items: stretch;
  background: var(--surface); border-top: 1px solid var(--border);
  box-shadow: 0 -8px 30px rgba(20, 15, 60, .08);
}
.bottomnav button {
  flex: 1; border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: .68rem; font-weight: 600;
  transition: color .15s ease;
}
.bottomnav button .nav-icon { font-size: 1.45rem; line-height: 1; transition: transform .15s ease; }
.bottomnav button.active { color: var(--primary); }
.bottomnav button.active .nav-icon { transform: translateY(-1px); }
.nav-add { flex: .9 !important; }
.nav-plus {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--primary-grad); color: #fff; font-size: 1.9rem; font-weight: 300;
  display: flex; align-items: center; justify-content: center;
  margin-top: -26px; box-shadow: 0 10px 24px rgba(108, 60, 224, .45);
  transition: transform .12s ease;
}
.nav-add:active .nav-plus { transform: scale(.9) rotate(90deg); }

/* ============ Modals ============ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(12, 10, 28, .55); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-grip { width: 44px; height: 5px; border-radius: 3px; background: var(--border); margin: 0 auto .9rem; }
.modal {
  background: var(--surface); width: 100%; max-width: var(--phone-w);
  border-radius: 26px 26px 0 0; padding: .8rem 1.3rem calc(1.4rem + env(safe-area-inset-bottom));
  max-height: 92vh; max-height: 92dvh; overflow-y: auto;
  animation: sheet-up .25s cubic-bezier(.32,.72,.35,1);
}
.modal-sm { padding-bottom: calc(1.4rem + env(safe-area-inset-bottom)); }
.modal h3 { margin: 0 0 1rem; font-size: 1.15rem; text-align: center; }
.modal-actions { display: flex; gap: .6rem; margin-top: 1.1rem; }
.modal-actions .btn { flex: 1; }
@keyframes sheet-up { from { transform: translateY(60px); opacity: .4; } to { transform: none; opacity: 1; } }
.tx-type-toggle { display: flex; gap: .5rem; margin-bottom: .9rem; background: var(--surface-2); border-radius: 16px; padding: .3rem; }
.tx-type-toggle button {
  flex: 1; padding: .7rem; border-radius: 12px; border: none;
  background: transparent; color: var(--muted); font-size: .92rem; font-weight: 700; cursor: pointer;
  transition: all .18s ease;
}
.tx-type-toggle button.active[data-t="spend"] { background: var(--surface); color: var(--danger); box-shadow: var(--shadow-sm); }
.tx-type-toggle button.active[data-t="payment"] { background: var(--surface); color: var(--success); box-shadow: var(--shadow-sm); }

/* ============ Toasts ============ */
.toasts {
  position: fixed; top: 1rem; left: 50%; transform: translateX(-50%); z-index: 100;
  display: flex; flex-direction: column; gap: .5rem; width: min(92vw, 400px);
}
.toast {
  background: #1c2130; color: #fff;
  padding: .85rem 1.1rem; border-radius: 16px; font-size: .88rem; font-weight: 600;
  box-shadow: 0 12px 30px rgba(0,0,0,.25); animation: toast-in .25s ease; text-align: center;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes toast-in { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ============ Skeleton ============ */
.skeleton { border-radius: 16px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.sk-hero { height: 168px; margin: 1rem 1.2rem 0; border-radius: var(--radius); }
.sk-card { height: 190px; margin: .4rem 1.2rem; border-radius: 20px; }
.sk-row { height: 64px; margin: 0 1.2rem .55rem; }
.loading { text-align: center; color: var(--muted); padding: 2rem 0; }

/* ============ Desktop tweak ============ */
@media (min-width: 480px) {
  .modal-overlay { align-items: center; padding: 1.5rem; }
  .modal { border-radius: 26px; }
  .modal-grip { display: none; }
}
