/* ══════════════════════════════════════════════════════
   FinanceBuilder — Mobile-First, No GSAP
══════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0c0e16;
  --surface:    #131620;
  --surface2:   #1c1f2e;
  --surface3:   #252840;
  --border:     #2a2d45;
  --accent:     #6366f1;
  --accent-dim: rgba(99,102,241,.15);
  --green:      #22c55e;
  --green-dim:  rgba(34,197,94,.15);
  --red:        #ef4444;
  --red-dim:    rgba(239,68,68,.15);
  --yellow:     #f59e0b;
  --yellow-dim: rgba(245,158,11,.15);
  --text:       #e2e8f0;
  --text2:      #94a3b8;
  --text3:      #475569;
  --r:          12px;
  --r-sm:       8px;
  --bnav-h:     62px;
}

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 9px; }

/* ══════════════════════════════════════════
   AUTH
══════════════════════════════════════════ */
.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  background: radial-gradient(ellipse at 20% 20%, rgba(99,102,241,.12) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 80%, rgba(139,92,246,.1) 0%, transparent 60%),
              var(--bg);
}
.auth-box {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem;
}
.auth-logo { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.5rem; font-weight: 700; font-size: 1.1rem; }
.auth-logo-icon { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg,var(--accent),#8b5cf6); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .85rem; color: #fff; }
.auth-tabs { display: flex; background: var(--surface2); border-radius: 10px; padding: 3px; gap: 3px; margin-bottom: 1.5rem; }
.auth-tab { flex: 1; text-align: center; padding: .5rem; border-radius: 8px; text-decoration: none; font-weight: 600; font-size: .875rem; color: var(--text2); transition: all .2s; }
.auth-tab.active { background: var(--accent); color: #fff; }

/* ══════════════════════════════════════════
   FORMS
══════════════════════════════════════════ */
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .85rem; }
.field label { font-size: .75rem; font-weight: 600; color: var(--text2); }
.field label small { font-weight: 400; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

input, select, textarea {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: .7rem .85rem;
  color: var(--text);
  font-size: .875rem;
  font-family: inherit;
  width: 100%;
  min-height: 46px;
  -webkit-appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

.big-input { font-size: 1.35rem; font-weight: 700; padding: .8rem 1rem; }
.input-sm  { max-width: 160px; min-height: 38px; padding: .45rem .7rem; }
.month-pick { min-height: 38px; padding: .4rem .7rem; width: auto; cursor: pointer; min-width: 140px; }
.filter-row { display: flex; gap: .5rem; margin-bottom: .85rem; flex-wrap: wrap; }

/* ══════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════ */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .65rem 1.15rem;
  background: var(--accent); color: #fff;
  border: none; border-radius: var(--r-sm);
  font-weight: 600; font-size: .875rem; font-family: inherit;
  cursor: pointer; min-height: 44px;
  transition: background .15s, transform .1s;
  -webkit-appearance: none;
}
.btn-primary:active { background: #4f46e5; transform: scale(.98); }
.btn-primary.full { width: 100%; }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .5rem .9rem;
  background: var(--surface2); color: var(--text);
  border: 1.5px solid var(--border); border-radius: var(--r-sm);
  font-weight: 600; font-size: .82rem; font-family: inherit;
  cursor: pointer; min-height: 38px;
  transition: border-color .15s;
}
.btn-ghost:hover { border-color: var(--accent); }

.btn-danger {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .4rem .7rem;
  background: transparent; color: var(--red);
  border: 1.5px solid rgba(239,68,68,.35); border-radius: var(--r-sm);
  font-weight: 600; font-size: .78rem; font-family: inherit;
  cursor: pointer; min-height: 34px;
  transition: background .15s, color .15s;
}
.btn-danger:hover { background: var(--red); color: #fff; border-color: var(--red); }

.btn-ok {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .4rem .75rem;
  background: var(--green-dim); color: var(--green);
  border: 1.5px solid rgba(34,197,94,.3); border-radius: var(--r-sm);
  font-weight: 700; font-size: .78rem; font-family: inherit;
  cursor: pointer; min-height: 34px;
  transition: background .15s;
}
.btn-ok:hover { background: var(--green); color: #fff; border-color: var(--green); }

.icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; flex-shrink: 0;
  background: none; border: 1.5px solid var(--border); border-radius: var(--r-sm);
  color: var(--text2); cursor: pointer;
  transition: border-color .15s, color .15s;
}
.icon-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ══════════════════════════════════════════
   ALERTS
══════════════════════════════════════════ */
.alert { padding: .7rem 1rem; border-radius: var(--r-sm); margin-bottom: 1rem; font-size: .875rem; }
.alert-err { background: var(--red-dim); border: 1px solid rgba(239,68,68,.25); color: #fca5a5; }
.alert-ok  { background: var(--green-dim); border: 1px solid rgba(34,197,94,.25); color: #86efac; }

/* ══════════════════════════════════════════
   APP LAYOUT — MOBILE FIRST
══════════════════════════════════════════ */

/* Sidebar — off-screen by default (mobile) */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: 260px; z-index: 400;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform .28s ease;
  overflow-y: auto;
}
.sidebar.open { transform: translateX(0); }
.sidebar-bd {
  display: none; position: fixed; inset: 0; z-index: 399;
  background: rgba(0,0,0,.55); backdrop-filter: blur(3px);
}
.sidebar-bd.on { display: block; }

.sidebar-head { padding: 1.25rem 1.1rem; border-bottom: 1px solid var(--border); }
.logo { display: flex; align-items: center; gap: .65rem; font-weight: 700; font-size: .95rem; }
.logo-icon { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg,var(--accent),#8b5cf6); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .75rem; color: #fff; flex-shrink: 0; }

.sidenav { flex: 1; padding: .6rem .65rem; display: flex; flex-direction: column; gap: 2px; }
.sidenav-item {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem .75rem; border-radius: var(--r-sm);
  color: var(--text2); text-decoration: none; font-weight: 500; font-size: .875rem;
  cursor: pointer; border: none; background: none; font-family: inherit; width: 100%; text-align: left;
  transition: background .15s, color .15s;
}
.sidenav-item svg { width: 17px; height: 17px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidenav-item:hover  { background: var(--surface2); color: var(--text); }
.sidenav-item.active { background: var(--accent-dim); color: var(--accent); font-weight: 600; }

.sidebar-foot { padding: .85rem .65rem; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; overflow: hidden; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg,var(--accent),#8b5cf6); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .82rem; color: #fff; flex-shrink: 0; }
.user-info { min-width: 0; }
.user-info strong { display: block; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info small { font-size: .68rem; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.sidebar-foot-actions { display: flex; gap: .4rem; }

/* App wrapper */
.app-wrap { min-height: 100vh; }

/* Mobile topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .7rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.topbar-title { font-weight: 700; font-size: 1rem; flex: 1; text-align: center; }
.hamburger {
  background: none; border: none; color: var(--text); cursor: pointer; padding: 4px;
  display: flex; align-items: center; justify-content: center; width: 36px; height: 36px;
}
.hamburger svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; display: block; }

/* Content area */
.content { padding: 1rem 1rem calc(var(--bnav-h) + 72px); }

/* ══════════════════════════════════════════
   TABS
══════════════════════════════════════════ */
.tab { display: none; }
.tab.active {
  display: block;
  animation: tabEnter .22s ease forwards;
}
@keyframes tabEnter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.pg-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.1rem; flex-wrap: wrap; gap: .6rem; }
.pg-head h1 { font-size: 1.3rem; font-weight: 700; }

/* ══════════════════════════════════════════
   CARDS
══════════════════════════════════════════ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 1rem; }
.card-label { font-size: .68rem; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .08em; margin-bottom: .85rem; }

/* ══════════════════════════════════════════
   STAT CARDS
══════════════════════════════════════════ */
.stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; margin-bottom: 1rem; }

.stat-card {
  border-radius: var(--r); padding: 1rem;
  display: flex; flex-direction: column; gap: .25rem;
}
.stat-label { font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: rgba(255,255,255,.5); }
.stat-val   { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; color: #fff; }
.stat-sub   { font-size: .65rem; color: rgba(255,255,255,.4); }

.balance-card  { background: linear-gradient(135deg, #1d3461, #1a2952); border: 1px solid #2a4080; }
.income-card   { background: linear-gradient(135deg, #14532d, #0f3a1f); border: 1px solid #166534; }
.expense-card  { background: linear-gradient(135deg, #4c0519, #3b0c15); border: 1px solid #7f1d1d; }
.networth-card { background: linear-gradient(135deg, #2e1065, #1e1048); border: 1px solid #4c1d95; }

/* ══════════════════════════════════════════
   TWO-COL GRID
══════════════════════════════════════════ */
.two-col { display: grid; grid-template-columns: 1fr; gap: .85rem; margin-bottom: 1rem; }
.cards-grid { display: grid; grid-template-columns: 1fr; gap: .85rem; }

/* ══════════════════════════════════════════
   HEALTH SCORE
══════════════════════════════════════════ */
.health-wrap { display: flex; align-items: flex-start; gap: 1.1rem; flex-wrap: wrap; }
.health-ring-wrap { flex-shrink: 0; }
.health-ring {
  width: 96px; height: 96px; border-radius: 50%;
  background: conic-gradient(var(--accent) 0deg, var(--surface2) 0deg);
  padding: 9px; display: grid; place-items: center;
  transition: background .8s ease;
}
.health-core {
  background: var(--surface);
  border-radius: 50%; width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
.health-core strong { font-size: 1.4rem; font-weight: 800; line-height: 1; }
.health-core small  { font-size: .58rem; color: var(--text2); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.health-breakdown { flex: 1; min-width: 130px; display: flex; flex-direction: column; gap: .45rem; }
.hb-row { display: flex; align-items: center; gap: .5rem; font-size: .78rem; }
.hb-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.hb-name { flex: 1; color: var(--text2); }
.hb-pts  { font-weight: 700; }

/* ══════════════════════════════════════════
   FORECAST
══════════════════════════════════════════ */
.forecast-stack { display: flex; flex-direction: column; gap: .5rem; }
.forecast-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: .6rem .75rem;
  background: var(--surface2); border-radius: var(--r-sm);
  font-size: .82rem;
}
.forecast-row span { color: var(--text2); }
.forecast-row strong { font-weight: 700; }

/* ══════════════════════════════════════════
   RECENT TRANSACTIONS (mini)
══════════════════════════════════════════ */
.mini-txn { display: flex; align-items: center; gap: .55rem; padding: .5rem .1rem; border-bottom: 1px solid var(--surface3); font-size: .82rem; }
.mini-txn:last-child { border-bottom: none; }
.mini-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.mini-cat  { flex: 1; font-weight: 500; }
.mini-date { font-size: .68rem; color: var(--text2); }
.mini-amt  { font-weight: 700; }

/* ══════════════════════════════════════════
   PROGRESS BARS
══════════════════════════════════════════ */
.prog-track { background: var(--surface3); border-radius: 99px; height: 7px; overflow: hidden; }
.prog-fill  { height: 100%; border-radius: 99px; width: 0%; transition: width .8s cubic-bezier(.4,0,.2,1); }
.fill-green  { background: linear-gradient(90deg, #16a34a, var(--green)); }
.fill-yellow { background: linear-gradient(90deg, #d97706, var(--yellow)); }
.fill-red    { background: linear-gradient(90deg, #b91c1c, var(--red)); }
.fill-accent { background: linear-gradient(90deg, #4f46e5, var(--accent)); }

/* Budget items */
.budget-item { margin-bottom: 1rem; }
.budget-item:last-child { margin-bottom: 0; }
.budget-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: .35rem; font-size: .82rem; }
.budget-row strong { font-weight: 600; }
.budget-meta { display: flex; justify-content: space-between; margin-top: .25rem; font-size: .7rem; color: var(--text2); align-items: center; }

/* ══════════════════════════════════════════
   TRANSACTION CARDS
══════════════════════════════════════════ */
.txn-item {
  display: flex; align-items: center; gap: .7rem;
  padding: .75rem; background: var(--surface2);
  border-radius: var(--r-sm); margin-bottom: .4rem;
  border: 1px solid transparent; transition: border-color .12s;
}
.txn-item:last-child { margin-bottom: 0; }
.txn-item:hover { border-color: var(--border); }
.txn-avatar {
  width: 38px; height: 38px; border-radius: var(--r-sm); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .82rem;
}
.txn-avatar.inc { background: var(--green-dim); color: var(--green); }
.txn-avatar.exp { background: var(--red-dim); color: var(--red); }
.txn-body { flex: 1; min-width: 0; }
.txn-cat  { font-weight: 600; font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txn-meta { font-size: .68rem; color: var(--text2); margin-top: 1px; }
.txn-val  { font-weight: 700; font-size: .9rem; white-space: nowrap; }
.c-green { color: var(--green); }
.c-red   { color: var(--red); }
.c-yellow { color: var(--yellow); }
.c-accent { color: var(--accent); }

/* ══════════════════════════════════════════
   GOAL CARDS
══════════════════════════════════════════ */
.goal-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 1rem; }
.goal-title  { font-weight: 700; margin-bottom: .2rem; }
.goal-row    { display: flex; justify-content: space-between; font-size: .75rem; color: var(--text2); margin-bottom: .6rem; }
.goal-pct    { display: flex; justify-content: space-between; margin-top: .25rem; font-size: .75rem; }
.goal-actions { display: flex; gap: .4rem; margin-top: .75rem; }
.goal-actions input { flex: 1; }

/* ══════════════════════════════════════════
   DEBT CARDS
══════════════════════════════════════════ */
.debt-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 1rem; margin-bottom: .75rem; }
.debt-card:last-child { margin-bottom: 0; }
.debt-top   { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .5rem; }
.debt-name  { font-weight: 700; font-size: .95rem; }
.debt-owed  { font-size: 1.1rem; font-weight: 800; color: var(--red); }
.debt-tags  { display: flex; gap: .5rem; flex-wrap: wrap; font-size: .68rem; color: var(--text2); margin-bottom: .6rem; }
.debt-tag   { background: var(--surface2); border-radius: 4px; padding: 2px 6px; }
.debt-pay   { display: flex; gap: .4rem; margin-top: .75rem; }
.debt-pay input { flex: 1; }

.snowball-row { display: flex; align-items: center; gap: .75rem; padding: .55rem .65rem; background: var(--surface2); border-radius: var(--r-sm); margin-bottom: .35rem; font-size: .82rem; }
.snowball-row:last-child { margin-bottom: 0; }
.sball-num { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: .65rem; font-weight: 700; flex-shrink: 0; }

/* ══════════════════════════════════════════
   INVESTMENT CARDS
══════════════════════════════════════════ */
.inv-item {
  display: flex; align-items: center; gap: .7rem;
  padding: .75rem; background: var(--surface2);
  border-radius: var(--r-sm); margin-bottom: .4rem;
}
.inv-item:last-child { margin-bottom: 0; }
.inv-badge { width: 40px; height: 40px; border-radius: var(--r-sm); background: var(--accent-dim); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700; flex-shrink: 0; }
.inv-body  { flex: 1; min-width: 0; }
.inv-name  { font-weight: 700; font-size: .875rem; }
.inv-sub   { font-size: .68rem; color: var(--text2); }
.inv-right { text-align: right; }
.inv-pl    { font-weight: 700; font-size: .875rem; }
.inv-pct   { font-size: .7rem; font-weight: 600; }
.inv-price-wrap { display: flex; gap: .4rem; align-items: center; margin-top: .3rem; }
.inv-price-wrap input { width: 90px; min-height: 32px; padding: .25rem .4rem; font-size: .78rem; }

/* ══════════════════════════════════════════
   BILL CARDS
══════════════════════════════════════════ */
.bill-card {
  display: flex; align-items: center; gap: .75rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: .9rem;
  margin-bottom: .6rem; flex-wrap: wrap;
}
.bill-card:last-child { margin-bottom: 0; }
.bill-dot  { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.bill-body { flex: 1; min-width: 140px; }
.bill-name { font-weight: 700; font-size: .9rem; }
.bill-meta { font-size: .7rem; color: var(--text2); margin-top: 1px; }
.bill-amount { font-weight: 800; font-size: .95rem; white-space: nowrap; }
.bill-actions { display: flex; gap: .35rem; }

.dot-paid    { background: var(--green); }
.dot-soon    { background: var(--yellow); }
.dot-overdue { background: var(--red); }
.dot-upcoming { background: var(--text3); }

/* ══════════════════════════════════════════
   INSIGHTS
══════════════════════════════════════════ */
.cat-item   { margin-bottom: .8rem; }
.cat-item:last-child { margin-bottom: 0; }
.cat-row    { display: flex; justify-content: space-between; margin-bottom: .3rem; font-size: .82rem; }
.cat-row strong { font-weight: 600; }

.mom-row    { display: flex; align-items: center; gap: .65rem; margin-bottom: .65rem; }
.mom-label  { width: 85px; font-size: .75rem; color: var(--text2); flex-shrink: 0; }
.mom-bar-wrap { flex: 1; }
.mom-val    { width: 75px; text-align: right; font-weight: 700; font-size: .78rem; flex-shrink: 0; }

.tip-card   { display: flex; gap: .65rem; padding: .7rem; background: var(--surface2); border-radius: var(--r-sm); margin-bottom: .4rem; font-size: .82rem; line-height: 1.5; }
.tip-card:last-child { margin-bottom: 0; }
.tip-icon   { flex-shrink: 0; font-size: 1rem; }

/* ══════════════════════════════════════════
   BADGE
══════════════════════════════════════════ */
.badge { display: inline-block; padding: .12rem .45rem; border-radius: 99px; font-size: .65rem; font-weight: 700; }
.badge-green  { background: var(--green-dim); color: var(--green); }
.badge-red    { background: var(--red-dim); color: var(--red); }
.badge-yellow { background: var(--yellow-dim); color: var(--yellow); }
.badge-accent { background: var(--accent-dim); color: var(--accent); }

/* ══════════════════════════════════════════
   EMPTY STATE
══════════════════════════════════════════ */
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--text2); font-size: .875rem; }
.empty-icon { font-size: 2.25rem; margin-bottom: .5rem; opacity: .5; }

/* ══════════════════════════════════════════
   MODAL
══════════════════════════════════════════ */
.modal-wrap {
  display: none; position: fixed; inset: 0; z-index: 600;
  background: rgba(0,0,0,.65); backdrop-filter: blur(4px);
  align-items: flex-end; justify-content: center;
  padding: 0;
}
.modal-wrap.on { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  width: 100%; max-width: 100%;
  max-height: 90vh; overflow-y: auto;
  animation: modalUp .25s ease;
}
@keyframes modalUp {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.modal-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
  font-weight: 700; position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal-x { background: none; border: none; color: var(--text2); font-size: 1rem; cursor: pointer; padding: .25rem; }
.modal-body { padding: 1.25rem; }

/* Type switch */
.type-switch { display: flex; background: var(--surface2); border-radius: var(--r-sm); padding: 3px; gap: 3px; margin-bottom: .85rem; }
.type-opt { flex: 1; text-align: center; padding: .55rem; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: .875rem; color: var(--text2); transition: all .15s; }
.type-opt input { display: none; }
.type-opt.active { color: #fff; }
.type-opt.inc-active { background: var(--green); }
.type-opt.exp-active { background: var(--red); }

/* ══════════════════════════════════════════
   FAB — MOBILE ONLY (hidden on desktop via media query below)
══════════════════════════════════════════ */
.fab {
  display: flex; align-items: center; justify-content: center;
  position: fixed;
  bottom: calc(var(--bnav-h) + 10px);
  left: 50%; transform: translateX(-50%);
  width: 54px; height: 54px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff; border: none; cursor: pointer; z-index: 300;
  box-shadow: 0 4px 18px rgba(99,102,241,.5);
  transition: transform .15s, box-shadow .15s;
}
.fab svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 2.5; stroke-linecap: round; }
.fab:active { transform: translateX(-50%) scale(.93); }

/* ══════════════════════════════════════════
   BOTTOM NAV — MOBILE ONLY
══════════════════════════════════════════ */
.bnav {
  display: flex; align-items: center;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--bnav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0 .25rem; z-index: 300;
}
.bnav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .18rem; padding: .3rem .2rem;
  background: none; border: none; color: var(--text2);
  font-size: .6rem; font-weight: 600; letter-spacing: .02em;
  cursor: pointer; font-family: inherit;
  transition: color .15s; min-height: var(--bnav-h);
}
.bnav-btn svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.bnav-btn.active { color: var(--accent); }
.bnav-gap { width: 54px; flex-shrink: 0; }

/* ══════════════════════════════════════════
   MORE DRAWER — MOBILE ONLY
══════════════════════════════════════════ */
.drawer-bd {
  display: none; position: fixed; inset: 0; z-index: 450;
  background: rgba(0,0,0,.5); backdrop-filter: blur(2px);
}
.drawer-bd.on { display: block; }
.drawer {
  position: fixed; bottom: var(--bnav-h); left: 0; right: 0; z-index: 460;
  background: var(--surface); border-top: 1px solid var(--border);
  border-radius: 18px 18px 0 0; padding: .4rem 1.25rem 1.25rem;
  transform: translateY(100%); transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.drawer.on { transform: translateY(0); }
.drawer-bar { width: 38px; height: 4px; background: var(--border); border-radius: 99px; margin: .5rem auto .9rem; }
.drawer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .65rem; }
.drawer-item {
  display: flex; flex-direction: column; align-items: center; gap: .4rem;
  padding: .75rem .5rem; background: var(--surface2); border-radius: var(--r);
  text-decoration: none; color: var(--text); font-size: .75rem; font-weight: 600;
  cursor: pointer; border: none; font-family: inherit;
  transition: background .12s;
}
.drawer-item:active { background: var(--surface3); }
.drawer-item svg { width: 20px; height: 20px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ══════════════════════════════════════════
   DESKTOP OVERRIDES (min-width: 769px)
══════════════════════════════════════════ */
@media (min-width: 769px) {
  /* Show sidebar, hide mobile nav elements */
  .sidebar { transform: none !important; position: fixed; }
  .topbar  { display: none !important; }
  .app-wrap { margin-left: 260px; }
  .content  { padding: 1.75rem 2rem; }

  /* HARD-HIDE all mobile-only elements */
  .bnav, .fab, .drawer, .drawer-bd { display: none !important; }
  .sidebar-bd { display: none !important; }

  /* Two-col grids on wider screens */
  .two-col { grid-template-columns: 1fr 1fr; }
  .cards-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

  /* Larger stat values */
  .stat-val { font-size: 1.6rem; }

  /* Modal centered on desktop */
  .modal-wrap { align-items: center; padding: 1.5rem; }
  .modal { border-radius: 18px; max-width: 520px; }
}

@media (min-width: 1100px) {
  .stats-row { grid-template-columns: repeat(4, 1fr); }
}
