/* ── Design Tokens ─────────────────────────────────────────────────────────── */
:root {
  --surface:          #f3f4f5;
  --surface-card:     #ffffff;
  --surface-low:      #eaebec;
  --primary:          #003b43;
  --primary-light:    #005f6e;
  --on-primary:       #ffffff;
  --income-color:     #1a6b3c;
  --income-bg:        #d6f5e3;
  --expense-color:    #b3261e;
  --expense-bg:       #ffdad6;
  --savings-color:    #1a3a6b;
  --savings-bg:       #dde8ff;
  --insight-bg:       #eef0ff;
  --insight-color:    #003b8e;
  --text-primary:     #1a1c1e;
  --text-secondary:   #50595a;
  --text-muted:       #8a9192;
  --font-display:     'Manrope', sans-serif;
  --font-body:        'Inter', sans-serif;
  --radius-sm:        0.5rem;
  --radius-lg:        1rem;
  --radius-xl:        1.5rem;
  --radius-full:      9999px;
  --shadow-card:      0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-nav:       0 -1px 0 rgba(0, 0, 0, 0.06);
  --nav-height:       72px;
  --header-height:    60px;
  --page-pad:         1rem;
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; overflow: hidden; }
body {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  font-family: var(--font-body);
  background: var(--surface);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input { font-family: inherit; outline: none; border: none; background: none; }

/* ── Auth Gate ─────────────────────────────────────────────────────────────── */
.auth-gate {
  position: fixed; inset: 0;
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem; z-index: 1000;
}
.auth-card {
  background: var(--surface-card);
  border-radius: var(--radius-xl);
  padding: 2rem 1.75rem;
  width: 100%; max-width: 360px;
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; gap: 1.25rem;
}
.auth-logo { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }
.auth-avatar {
  width: 56px; height: 56px; border-radius: var(--radius-full);
  background: var(--primary); color: var(--on-primary);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1.1rem;
}
.auth-title { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.auth-subtitle { font-size: 0.875rem; color: var(--text-secondary); }
.auth-error {
  background: var(--expense-bg); color: var(--expense-color);
  border-radius: var(--radius-sm); padding: 0.75rem 1rem;
  font-size: 0.875rem; font-weight: 500;
}
.field-group { display: flex; flex-direction: column; gap: 0.375rem; }
.field-label {
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em;
  color: var(--text-secondary); text-transform: uppercase;
}
.field-input {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  color: var(--text-primary);
  width: 100%;
}
.field-input::placeholder { color: var(--text-muted); }
.field-input:focus { background: var(--surface-low); }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  border-radius: var(--radius-xl);
  padding: 0.875rem 1.5rem;
  font-family: var(--font-body);
  font-size: 1rem; font-weight: 600;
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  transition: opacity 0.15s;
}
.btn-primary:active { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.5; pointer-events: none; }

/* ── App Shell ─────────────────────────────────────────────────────────────── */
.app {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  background: var(--surface);
}
.main-content {
  flex: 1; overflow: hidden;
  position: relative;
  overflow-x: hidden;
}
.screen {
  position: absolute; inset: 0;
  overflow-y: auto;
  padding-bottom: calc(var(--nav-height) + 1rem);
  overscroll-behavior: none;
}
.screen.hidden { display: none; }

/* ── Bottom Nav ────────────────────────────────────────────────────────────── */
.bottom-nav {
  height: var(--nav-height);
  background: var(--surface-card);
  box-shadow: var(--shadow-nav);
  display: flex; align-items: center;
  padding: 0 0.25rem;
  padding-bottom: env(safe-area-inset-bottom);
  flex-shrink: 0;
}
.nav-item {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 0.25rem;
  padding: 0.5rem 0;
  color: var(--text-muted);
  border-radius: var(--radius-lg);
  transition: color 0.15s;
  position: relative;
}
.nav-item.active { color: var(--primary); }
.nav-item.active .nav-label { color: var(--primary); font-weight: 600; }
.nav-icon { width: 22px; height: 22px; }
.nav-label { font-size: 0.6875rem; font-weight: 500; }

.nav-fab {
  width: 52px; height: 52px; min-width: 52px; flex: none;
  background: var(--primary);
  color: var(--on-primary);
  border-radius: var(--radius-full);
  margin: 0 auto;
  box-shadow: 0 4px 16px rgba(0, 59, 67, 0.4);
  transition: transform 0.15s;
}
.nav-fab:active { transform: scale(0.93); }
.nav-fab .nav-icon { width: 26px; height: 26px; }

/* ── Page Header ───────────────────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem var(--page-pad) 0.75rem;
}
.header-left { display: flex; align-items: center; gap: 0.75rem; min-width: 0; overflow: hidden; }
.header-right { display: flex; align-items: center; gap: 0.25rem; flex-shrink: 0; }
.header-avatar {
  width: 36px; height: 36px; border-radius: var(--radius-full);
  background: var(--primary); color: var(--on-primary);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 0.75rem;
  flex-shrink: 0;
}
.header-title {
  font-family: var(--font-display);
  font-size: 1.0625rem; font-weight: 700;
  color: var(--primary);
}
.icon-btn-sm { width: 28px !important; height: 28px !important; }
.icon-btn-sm svg { width: 14px; height: 14px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: background 0.15s;
}
.icon-btn:active { background: var(--surface-low); }
.icon-btn svg { width: 20px; height: 20px; }

/* Month Picker */
.month-picker {
  display: flex; align-items: center; gap: 0.25rem;
}
.month-label {
  font-size: 0.8125rem; font-weight: 600; color: var(--text-primary);
  min-width: 82px; text-align: center;
  background: none; border: none; cursor: pointer; padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.month-label:active { background: var(--surface-low); }
.month-btn {
  width: 28px; height: 28px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
}
.month-btn:active { background: var(--surface-low); }
.month-btn svg { width: 16px; height: 16px; }

/* Month picker popup */
.mp-overlay {
  position: fixed; inset: 0; z-index: 800;
  display: flex; align-items: flex-start; justify-content: flex-end;
  padding: 3.75rem 1rem 0;
  background: transparent;
}
.mp-overlay.hidden { display: none; }
.mp-popup {
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.16), 0 2px 8px rgba(0,0,0,0.08);
  padding: 0.75rem;
  width: 220px;
  position: relative; z-index: 1;
}
.mp-year-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.5rem;
}
.mp-year-label {
  font-family: var(--font-display); font-size: 0.9rem; font-weight: 700;
  color: var(--text-primary);
}
.mp-year-btn {
  width: 28px; height: 28px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
}
.mp-year-btn:active { background: var(--surface-low); }
.mp-year-btn svg { width: 14px; height: 14px; }
.mp-year-btn:disabled { opacity: 0.3; pointer-events: none; }
.mp-months {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.25rem;
}
.mp-month-btn {
  padding: 0.4rem 0; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 0.8rem; font-weight: 500;
  color: var(--text-primary); text-align: center;
  transition: background 0.1s;
}
.mp-month-btn:hover { background: var(--surface); }
.mp-month-btn:active { background: var(--surface-low); }
.mp-month-btn.active {
  background: var(--primary); color: var(--on-primary); font-weight: 700;
}
.mp-month-btn:disabled { opacity: 0.3; pointer-events: none; }

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface-card);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
}
.card-sm { padding: 1rem; border-radius: var(--radius-lg); }

/* ── Overline / Headline ───────────────────────────────────────────────────── */
.overline {
  font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-secondary);
}
.headline {
  font-family: var(--font-display);
  font-size: 1.75rem; font-weight: 800;
  color: var(--text-primary); line-height: 1.15;
}
.display-lg {
  font-family: var(--font-display);
  font-size: 2.75rem; font-weight: 800;
  color: var(--text-primary); line-height: 1;
}
.display-sm {
  font-family: var(--font-display);
  font-size: 1.75rem; font-weight: 700;
  color: var(--text-primary);
}

/* ── Chips ─────────────────────────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.6875rem; font-weight: 600;
  letter-spacing: 0.04em;
}
.chip-income { background: var(--income-bg); color: var(--income-color); }
.chip-expense { background: var(--expense-bg); color: var(--expense-color); }
.chip-savings { background: var(--savings-bg); color: var(--savings-color); }
.chip-primary { background: var(--primary); color: var(--on-primary); }
.chip-neutral { background: var(--surface-low); color: var(--text-secondary); }
.chip-green { background: #d6f5e3; color: #1a6b3c; }
.chip-red   { background: #ffdad6; color: #b3261e; }

/* ── Dashboard Screen ──────────────────────────────────────────────────────── */
.dashboard-page { padding: 0 var(--page-pad); }

.balance-section { padding: 0.5rem 0 1rem; }
.balance-label { margin-bottom: 0.25rem; }
.balance-amount {
  font-family: var(--font-display);
  font-size: 2.75rem; font-weight: 800;
  color: var(--text-primary); line-height: 1;
}

.summary-cards { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 0.75rem; }

.summary-card { position: relative; }
.summary-card .card-chip {
  position: absolute; top: 1rem; right: 1rem;
}
.summary-card .card-icon { font-size: 1.25rem; margin-bottom: 0.5rem; }
.summary-card .card-amount { font-family: var(--font-display); font-size: 1.625rem; font-weight: 700; margin-bottom: 0.125rem; }
.summary-card .card-sub { font-size: 0.8125rem; color: var(--text-secondary); }
.card-proj { margin-top: 0.5rem; font-size: 0.8125rem; color: var(--text-secondary); border-top: 1px solid var(--surface-low); padding-top: 0.5rem; }
.card-proj strong { color: var(--text); }
.card-proj-detail { display: block; font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem; }
.card-proj-details { margin-top: 0.35rem; }
.card-proj-details[open] .card-proj-summary { color: var(--text-muted); }
.card-proj-summary { font-size: 0.7rem; color: var(--primary); cursor: pointer; list-style: none; display: inline-block; }
.card-proj-summary::-webkit-details-marker { display: none; }
.card-proj-section-label { font-size: 0.65rem; font-weight: 700; letter-spacing: 0.06em; color: var(--text-muted); margin-top: 0.5rem; margin-bottom: 0.15rem; }
.card-proj-item-method { font-size: 0.6rem; color: var(--text-muted); background: var(--surface-low); border-radius: 3px; padding: 0 3px; margin-left: 0.3rem; vertical-align: middle; }
.card-proj-list { margin-top: 0.35rem; display: flex; flex-direction: column; gap: 0.2rem; border-top: 1px solid var(--surface-low); padding-top: 0.35rem; }
.card-proj-item { display: flex; justify-content: space-between; align-items: center; font-size: 0.7375rem; }
.card-proj-item-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-secondary); }
.card-proj-item-amt { flex-shrink: 0; font-weight: 600; color: var(--text); margin-left: 0.5rem; }
.card-proj-item-over .card-proj-item-name { color: var(--expense-color); opacity: 0.85; }
.card-proj-item-amt-over { color: var(--expense-color) !important; }
.card-proj-section-warn { color: var(--expense-color) !important; }

.summary-card.savings-card {
  background: var(--primary); color: var(--on-primary);
}
.summary-card.savings-card .card-sub { color: rgba(255,255,255,0.7); }
.summary-card.savings-card .card-chip { background: rgba(255,255,255,0.15); color: #fff; }
.summary-card.savings-card .card-amount { color: #fff; }

.arrow-up { color: var(--expense-color); font-size: 1.25rem; }
.arrow-down { color: var(--income-color); font-size: 1.25rem; }

/* Cashflow Chart */
.chart-card { margin-bottom: 0.75rem; }
.chart-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1rem; }
.chart-legend { display: flex; gap: 0.75rem; align-items: center; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 0.25rem; }
.legend-item { display: flex; align-items: center; font-size: 0.75rem; color: var(--text-secondary); font-weight: 500; }
.chart-wrap { height: 160px; position: relative; }

/* Insight Card */
.insight-card {
  background: var(--insight-bg);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  margin-bottom: 0.75rem;
}
.insight-icon { font-size: 1.375rem; margin-bottom: 0.5rem; }
.insight-title { font-family: var(--font-display); font-size: 1rem; font-weight: 700; color: var(--primary); margin-bottom: 0.375rem; }
.insight-text { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.5; margin-bottom: 0.75rem; }
.insight-link {
  font-size: 0.75rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--primary); text-decoration: none;
  display: inline-flex; align-items: center; gap: 0.25rem;
}

/* Recent Activity */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.75rem;
}
.section-title { font-family: var(--font-display); font-size: 1.0625rem; font-weight: 700; }
.section-link { font-size: 0.8125rem; font-weight: 600; color: var(--primary); }

/* ── Transaction Row ───────────────────────────────────────────────────────── */
.tx-list { display: flex; flex-direction: column; gap: 0; }

/* Swipe-to-delete wrapper */
.swipe-wrap {
  position: relative;
  overflow: hidden;
  background: var(--surface-card);
}
.swipe-wrap + .swipe-wrap { border-top: 1px solid var(--surface); }
.swipe-delete-bg {
  position: absolute; right: 0; top: 0; bottom: 0; width: 80px;
  background: var(--expense-color);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.375rem; color: #fff; cursor: pointer;
}
.swipe-row {
  background: var(--surface-card);
  will-change: transform;
  touch-action: pan-y;
  cursor: pointer;
}

.tx-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.875rem 0;
  background: var(--surface-card);
}

.tx-icon-wrap {
  width: 44px; height: 44px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.tx-center { min-width: 0; }
.tx-merchant { font-weight: 600; font-size: 0.9375rem; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-meta { font-size: 0.75rem; color: var(--text-secondary); margin-top: 0.125rem; }
.tx-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; }
.tx-amount { font-family: var(--font-display); font-size: 0.9375rem; font-weight: 700; }
.tx-amount.negative { color: var(--expense-color); }
.tx-amount.positive { color: var(--income-color); }

/* Dashboard recent activity card */
.recent-card { padding: 0 1.25rem; }

/* ── Activity Screen ───────────────────────────────────────────────────────── */
.activity-page { padding: 0 var(--page-pad); }

.spending-summary-card { margin-bottom: 1rem; }
.spending-summary-card .summary-row { display: flex; align-items: center; gap: 0.75rem; }
.spending-summary-card .amount-lg { font-family: var(--font-display); font-size: 1.75rem; font-weight: 700; }

/* Filter chips */
.filter-bar {
  display: flex; gap: 0.5rem; overflow-x: auto; padding-bottom: 0.5rem;
  margin-bottom: 1rem; scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }
.filter-chip {
  flex-shrink: 0;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.8125rem; font-weight: 600;
  background: var(--surface-card); color: var(--text-secondary);
  transition: all 0.15s;
}
.filter-chip.active { background: var(--primary); color: #fff; }

/* Date group */
.date-group-header {
  font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.5rem 0 0.25rem;
  margin-top: 0.5rem;
}
.date-group-card {
  background: var(--surface-card);
  border-radius: var(--radius-xl);
  padding: 0 1rem;
  overflow: hidden;
}
.date-group-card .swipe-wrap:first-child .tx-row { padding-top: 1rem; }
.date-group-card .swipe-wrap:last-child .tx-row { padding-bottom: 1rem; }

/* ── Trends Screen ─────────────────────────────────────────────────────────── */
.trends-page { padding: 0 var(--page-pad); }

.period-toggle {
  display: flex; gap: 0.25rem;
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  padding: 0.25rem;
  margin-bottom: 1rem;
}
.period-btn {
  flex: 1; padding: 0.5rem;
  border-radius: calc(var(--radius-lg) - 2px);
  font-size: 0.8125rem; font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.period-btn.active {
  background: var(--primary); color: #fff;
  box-shadow: 0 2px 8px rgba(0,59,67,0.25);
}

.chart-card-lg { margin-bottom: 0.75rem; }
.chart-wrap-lg { height: 200px; position: relative; }
.chart-wrap-donut { height: 220px; position: relative; }

/* Donut legend */
.donut-legend { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1rem; }
.donut-legend-item { display: flex; align-items: center; justify-content: space-between; }
.donut-legend-left { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: var(--text-primary); }
.donut-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.donut-pct { font-size: 0.875rem; font-weight: 600; color: var(--text-secondary); }

/* Highest spend card */
.highest-card {
  background: var(--primary); color: var(--on-primary);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  margin-bottom: 0.75rem;
  position: relative; overflow: hidden;
}
.highest-card::after {
  content: '↗';
  position: absolute; bottom: -0.5rem; right: 1rem;
  font-size: 5rem; opacity: 0.08; line-height: 1;
}
.highest-label { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.7; margin-bottom: 0.25rem; }
.highest-name { font-family: var(--font-display); font-size: 1.625rem; font-weight: 800; margin-bottom: 0.25rem; }
.highest-sub { font-size: 0.8125rem; opacity: 0.75; }

/* Rate / Goal cards */
.metric-card { margin-bottom: 0.75rem; }
.metric-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.625rem; }
.metric-value { font-family: var(--font-display); font-size: 1.625rem; font-weight: 700; }
.progress-bar-wrap { height: 6px; background: var(--surface); border-radius: var(--radius-full); overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: var(--radius-full); transition: width 0.6s ease; }
.fill-green  { background: var(--income-color); }
.fill-blue   { background: #1a56db; }
.fill-amber  { background: #b45309; }
.fill-red    { background: var(--expense-color); }

/* ── Add / Log Entry Screen ────────────────────────────────────────────────── */
.add-page { padding: 0 var(--page-pad); }

.amount-display-wrap {
  display: flex; align-items: center; justify-content: center;
  gap: 0.5rem;
  padding: 1.5rem 0 1rem;
}
.amount-currency {
  font-family: var(--font-display); font-size: 2rem; font-weight: 700;
  color: var(--text-muted);
}
.amount-input {
  font-family: var(--font-display); font-size: 3rem; font-weight: 800;
  color: var(--text-primary);
  width: 100%; text-align: center;
  caret-color: var(--primary);
}
.amount-input::placeholder { color: var(--text-muted); }

/* Type toggle */
.type-toggle {
  display: flex; gap: 0;
  background: var(--surface-low);
  border-radius: var(--radius-lg);
  padding: 0.25rem;
  margin-bottom: 1.25rem;
}
.type-btn {
  flex: 1; padding: 0.625rem;
  border-radius: calc(var(--radius-lg) - 2px);
  font-size: 0.9375rem; font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.type-btn.active {
  background: var(--surface-card); color: var(--text-primary);
  box-shadow: 0 1px 6px rgba(0,0,0,0.1);
}

/* Category grid */
.category-section { margin-bottom: 1.25rem; }
.category-label { margin-bottom: 0.625rem; }
.category-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}
.cat-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0.75rem 0.25rem;
  border-radius: var(--radius-xl);
  background: var(--surface-card);
  gap: 0.375rem;
  cursor: pointer;
  transition: all 0.15s;
}
.cat-tile.selected { background: var(--primary); }
.cat-tile.selected .cat-label { color: #fff; }
.cat-emoji { font-size: 1.375rem; line-height: 1; }
.cat-label { font-size: 0.625rem; font-weight: 600; text-align: center; color: var(--text-secondary); line-height: 1.2; }

/* Form fields */
.form-field {
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  padding: 0.875rem 1rem;
  margin-bottom: 0.5rem;
}
.form-field-inner { display: flex; align-items: center; gap: 0.75rem; }
.form-field-icon { font-size: 1.125rem; flex-shrink: 0; }
.form-field input, .form-field select {
  flex: 1; font-size: 0.9375rem; color: var(--text-primary);
  background: none;
  -webkit-appearance: none;
}
.form-field input::placeholder { color: var(--text-muted); }
.form-field select { color: var(--text-muted); }
.form-field select.has-value { color: var(--text-primary); }

/* ── Toast ─────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: calc(var(--nav-height) + 1rem); left: 50%;
  transform: translateX(-50%);
  background: #1a1c1e; color: #fff;
  border-radius: var(--radius-full);
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem; font-weight: 500;
  z-index: 2000;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  transition: opacity 0.3s;
}
.toast.hidden { display: none; }

/* ── Utility ───────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.mt-xs { margin-top: 0.375rem; }
.mt-sm { margin-top: 0.5rem; }
.mt-md { margin-top: 0.75rem; }
.mb-sm { margin-bottom: 0.5rem; }
.mb-md { margin-bottom: 0.75rem; }
.mb-lg { margin-bottom: 1rem; }
.text-income  { color: var(--income-color); }
.text-expense { color: var(--expense-color); }
.text-muted   { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.font-display { font-family: var(--font-display); }

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-low) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* Empty state */
.empty-state {
  text-align: center; padding: 3rem 1rem;
  color: var(--text-muted); font-size: 0.9375rem;
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }

/* ── Gear Menu ─────────────────────────────────────────────────────────────── */
/* Inbox badge on gear button */
.gear-btn-wrap { position: relative; display: inline-flex; }
.inbox-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--expense-color);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.65rem; font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
  border: 2px solid var(--surface-card);
  pointer-events: none;
}
.inbox-badge.hidden { display: none; }

/* Action Items count badge in gear menu */
.gear-inbox-count {
  margin-left: auto;
  background: var(--expense-color);
  color: #fff;
  font-size: 0.65rem; font-weight: 700;
  min-width: 18px; height: 18px;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}
.gear-inbox-count.hidden { display: none; }

.gear-menu { position: fixed; inset: 0; z-index: 900; }
.gear-menu.hidden { display: none; }
.gear-backdrop { position: fixed; inset: 0; }
.gear-panel {
  position: absolute; top: 3.25rem; right: 1rem;
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.08);
  overflow: hidden; min-width: 180px;
}
.gear-option {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  font-size: 0.9375rem; font-weight: 500;
  color: var(--text-primary); width: 100%; text-align: left;
  transition: background 0.1s;
}
.gear-option:active { background: var(--surface); }
.gear-option svg { width: 18px; height: 18px; color: var(--text-secondary); flex-shrink: 0; }
.gear-option + .gear-option { border-top: 1px solid var(--surface); }
.gear-option.danger { color: var(--expense-color); }
.gear-option.danger svg { color: var(--expense-color); }

/* ── Budgets Screen ────────────────────────────────────────────────────────── */
.budgets-page { padding: 0 var(--page-pad); }
.budgets-content { padding: 0; }
/* PIN Modal */
.pin-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 1000;
}
.pin-modal-overlay.hidden { display: none; }
.pin-modal-sheet {
  background: var(--surface-card); border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 1.5rem 1.5rem 2rem; width: 100%; max-width: 400px;
  text-align: center;
}
.pin-modal-title { font-size: 1.125rem; font-weight: 700; margin-bottom: 0.25rem; }
.pin-modal-subtitle { font-size: 0.8125rem; color: var(--text-muted); margin-bottom: 1.25rem; }
.pin-dots { display: flex; justify-content: center; gap: 0.875rem; margin-bottom: 0.75rem; }
.pin-dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--text-muted); background: transparent; transition: background 0.1s;
}
.pin-dot.filled { background: var(--primary); border-color: var(--primary); }
.pin-error { font-size: 0.8125rem; color: var(--expense-color); min-height: 1.2em; margin-bottom: 0.75rem; }
.pin-numpad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; max-width: 280px; margin: 0 auto;
}
.pin-key {
  padding: 1rem; font-size: 1.25rem; font-weight: 600; border-radius: var(--radius-sm);
  background: var(--surface); border: none; cursor: pointer; transition: background 0.1s;
}
.pin-key:active { background: var(--surface-low); }
.pin-cancel { font-size: 0.8125rem; color: var(--text-muted); }
.pin-back { font-size: 1rem; }

.budget-summary-card {}
.budget-summary-row { display: flex; justify-content: space-between; align-items: flex-start; }
.budget-summary-amt {
  font-family: var(--font-display); font-size: 1.625rem; font-weight: 700;
  margin-top: 0.25rem;
}
.budget-bar {
  height: 6px; background: var(--surface-low);
  border-radius: var(--radius-full); overflow: hidden;
}
.budget-bar-fill {
  height: 100%; background: var(--primary);
  border-radius: var(--radius-full); transition: width 0.4s ease;
}
.budget-bar-fill.over { background: var(--expense-color); }
.budget-bar-labels {
  display: flex; justify-content: space-between;
  font-size: 0.75rem; color: var(--text-muted); margin-top: 0.375rem;
}
.budget-lock-row {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  padding-top: 0.75rem; border-top: 1px solid var(--surface-low); margin-top: 0.75rem;
}
.budget-lock-btn {
  flex: 1; padding: 0.5rem 0.75rem; border-radius: var(--radius-sm);
  font-size: 0.8125rem; font-weight: 600; cursor: pointer;
  border: 1.5px solid var(--surface-low); background: var(--surface);
  color: var(--text-muted); transition: all 0.15s;
}
.budget-lock-btn.locked {
  background: #dcfce7; border-color: #86efac; color: #15803d;
}
.budget-locked-badge {
  font-size: 0.75rem; font-weight: 700; color: #15803d;
  background: #dcfce7; border: 1px solid #86efac;
  padding: 0.25rem 0.625rem; border-radius: var(--radius-full);
}
.budget-row { padding: 1rem; }
.budget-row-top { display: flex; justify-content: space-between; align-items: center; }
.budget-row-left { display: flex; align-items: center; gap: 0.75rem; }
.budget-cat-icon {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  background: var(--surface); display: flex; align-items: center;
  justify-content: center; font-size: 1.25rem; flex-shrink: 0;
}
.budget-cat-name { font-weight: 600; font-size: 0.9375rem; }
.budget-cat-spent { font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.125rem; }
.budget-row-right { display: flex; flex-direction: column; align-items: flex-end; gap: 0.375rem; }
.budget-row-amt { font-family: var(--font-display); font-size: 1rem; font-weight: 700; }
.budget-edit-toggle {
  font-size: 0.75rem; font-weight: 600; color: var(--primary);
  padding: 0.25rem 0.625rem;
  background: var(--surface); border-radius: var(--radius-full);
}
.budget-set-lbl { color: var(--expense-color); }
.budget-form-row {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 0.625rem 0.875rem;
}
.budget-form-prefix { font-weight: 600; color: var(--text-secondary); }
.budget-form-input {
  flex: 1; font-size: 1rem; font-weight: 600;
  color: var(--text-primary); min-width: 0;
}
.budget-form-save {
  background: var(--primary); color: #fff;
  border-radius: var(--radius-full);
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem; font-weight: 600; white-space: nowrap;
}
.budget-form-save:disabled { opacity: 0.6; }
.budget-form-del {
  background: var(--expense-bg); color: var(--expense-color);
  border-radius: var(--radius-full);
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem; font-weight: 600; white-space: nowrap;
}

/* ── Edit Sheet ─────────────────────────────────────────────────────────────── */
.edit-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 800;
  opacity: 0; transition: opacity 0.2s;
  pointer-events: none;
}
.edit-overlay.visible { opacity: 1; pointer-events: auto; }

.edit-sheet {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 0 var(--page-pad);
  padding-bottom: max(env(safe-area-inset-bottom, 0px), 1.5rem);
  z-index: 810;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 92vh; overflow-y: auto;
}
.edit-sheet.open { transform: translateY(0); }

.edit-handle {
  width: 36px; height: 4px;
  background: var(--surface-low); border-radius: var(--radius-full);
  margin: 0.875rem auto 1.25rem;
}
.edit-title {
  font-family: var(--font-display); font-size: 1.125rem; font-weight: 700;
  text-align: center; margin-bottom: 1.25rem;
}
.edit-actions {
  display: flex; gap: 0.75rem;
  margin-top: 1rem; margin-bottom: 0.5rem;
}
.btn-cancel {
  flex: 1;
  background: var(--surface-low); color: var(--text-secondary);
  border-radius: var(--radius-xl);
  padding: 0.875rem 1rem;
  font-size: 0.9375rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.edit-delete-link {
  display: block; width: 100%; text-align: center;
  padding: 0.75rem; margin-top: 0.25rem; margin-bottom: 0.5rem;
  font-size: 0.875rem; font-weight: 600;
  color: var(--expense-color);
}
.btn-save {
  flex: 2;
  background: var(--primary); color: var(--on-primary);
  border-radius: var(--radius-xl);
  padding: 0.875rem 1rem;
  font-size: 0.9375rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.btn-save:disabled, .btn-danger:disabled { opacity: 0.5; pointer-events: none; }

/* ── Inbox / Action Items ───────────────────────────────────────────────────── */
.inbox-empty {
  text-align: center; padding: 2.5rem 1rem;
  color: var(--text-muted); font-size: 0.9375rem;
}
.inbox-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.875rem 0; gap: 0.75rem;
}
.inbox-row + .inbox-row { border-top: 1px solid var(--surface); }
.inbox-row-main { display: flex; align-items: center; gap: 0.75rem; flex: 1; min-width: 0; }
.inbox-row-info { flex: 1; min-width: 0; }
.inbox-row-merchant { font-weight: 600; font-size: 0.9375rem; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-row-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.125rem; }
.inbox-row-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }
.inbox-keep-btn {
  background: var(--surface-low); color: var(--text-muted);
  border-radius: var(--radius-full); padding: 0.35rem 0.75rem;
  font-size: 0.8125rem; font-weight: 600;
}
.inbox-fix-btn {
  background: var(--surface-low); color: var(--text-secondary);
  border-radius: var(--radius-full); padding: 0.35rem 0.75rem;
  font-size: 0.8125rem; font-weight: 600;
}
.inbox-split-btn {
  background: var(--primary); color: #fff;
  border-radius: var(--radius-full); padding: 0.35rem 0.75rem;
  font-size: 0.8125rem; font-weight: 600;
}

/* Split sheet */
.split-remaining {
  text-align: center; font-family: var(--font-display);
  font-size: 1rem; font-weight: 700;
  color: var(--text-secondary); margin-bottom: 0.25rem;
}
.split-remaining.split-done { color: var(--income-color); }
.split-remaining.split-over { color: var(--expense-color); }
.split-row { padding: 0.625rem 0; }
.split-row + .split-row { border-top: 1px solid var(--surface); }
.split-row-top { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.375rem; }
.split-cat-select {
  flex: 1; font-size: 0.875rem; font-weight: 600; color: var(--text-primary);
  background: var(--surface); border-radius: var(--radius-sm);
  padding: 0.375rem 0.5rem; border: none; outline: none;
  -webkit-appearance: none; min-width: 0;
}
.split-note-wrap { padding-left: 0.25rem; }
.split-note-input {
  width: 100%; font-size: 0.8125rem; color: var(--text-secondary);
  background: var(--surface); border-radius: var(--radius-sm);
  padding: 0.375rem 0.625rem;
}
.split-note-input::placeholder { color: var(--text-muted); }

/* ── Planner Screen ─────────────────────────────────────────────────────────── */
.planner-screen {
  position: fixed; inset: 0;
  background: var(--surface);
  z-index: 600;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.planner-screen.open { transform: translateX(0); }
.planner-page { padding: 0 var(--page-pad) 2rem; }
.planner-section { margin-bottom: 1rem; }

.plan-field-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 0;
}
.plan-field-row + .plan-field-row { border-top: 1px solid var(--surface); }
.plan-label { font-size: 0.9375rem; font-weight: 500; color: var(--text-primary); }
.plan-input-wrap {
  display: flex; align-items: center; gap: 0.25rem;
  background: var(--surface); border-radius: var(--radius-sm);
  padding: 0.375rem 0.625rem;
  font-weight: 600; color: var(--text-secondary); font-size: 0.9375rem;
}
.plan-input {
  width: 90px; text-align: right;
  font-size: 1rem; font-weight: 700; color: var(--text-primary);
}
.plan-derived-val {
  font-family: var(--font-display); font-size: 1rem; font-weight: 700;
}
.plan-hint { font-size: 0.75rem; color: var(--text-muted); padding: 0 0 0.5rem; }
.plan-add-btn {
  font-size: 0.8125rem; font-weight: 700; color: var(--primary);
  background: var(--surface-low); border-radius: var(--radius-full);
  padding: 0.3rem 0.875rem;
}
.plan-empty-hint {
  text-align: center; color: var(--text-muted);
  font-size: 0.875rem; padding: 0.75rem 0;
}
.plan-saved-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 0;
}
.plan-saved-row + .plan-saved-row { border-top: 1px solid var(--surface); }
.plan-saved-name { font-weight: 600; font-size: 0.9375rem; color: var(--text-primary); }
.plan-saved-date { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.125rem; }
.plan-saved-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.plan-load-btn {
  background: var(--primary); color: #fff;
  border-radius: var(--radius-full);
  padding: 0.35rem 0.875rem;
  font-size: 0.8125rem; font-weight: 600;
}
.plan-del-btn {
  width: 28px; height: 28px; border-radius: var(--radius-full);
  background: var(--expense-bg); color: var(--expense-color);
  font-size: 0.75rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* One-time rows */
.plan-onetime-row {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0;
}
.plan-onetime-row + .plan-onetime-row { border-top: 1px solid var(--surface); }
.plan-onetime-month {
  flex: 0 0 88px; font-size: 0.8125rem; font-weight: 600;
  color: var(--text-primary);
  background: var(--surface); border-radius: var(--radius-sm);
  padding: 0.375rem 0.375rem;
  -webkit-appearance: none; border: none; outline: none;
}
.plan-onetime-label {
  flex: 1; font-size: 0.875rem; color: var(--text-primary);
  background: var(--surface); border-radius: var(--radius-sm);
  padding: 0.375rem 0.5rem; min-width: 0;
}
.plan-onetime-amt-wrap {
  flex: 0 0 76px; display: flex; align-items: center; gap: 0.2rem;
  background: var(--surface); border-radius: var(--radius-sm);
  padding: 0.375rem 0.5rem;
  font-weight: 600; color: var(--text-secondary); font-size: 0.875rem;
}
.plan-onetime-amt {
  width: 50px; text-align: right;
  font-size: 0.875rem; font-weight: 700; color: var(--text-primary);
}
.plan-onetime-del {
  width: 28px; height: 28px; border-radius: var(--radius-full);
  color: var(--expense-color); font-size: 0.75rem; font-weight: 700;
  background: var(--expense-bg); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}

/* Results */
.plan-result-row { display: flex; gap: 1.5rem; }
.plan-result-block { flex: 1; }
.plan-result-val {
  font-family: var(--font-display); font-size: 1.625rem; font-weight: 800;
  color: var(--text-primary); margin-top: 0.25rem;
}
.plan-chart-legend {
  display: flex; gap: 1.25rem; justify-content: center;
  font-size: 0.75rem; color: var(--text-secondary); margin-top: 0.75rem;
}
.plan-chart-legend span { display: flex; align-items: center; gap: 0.375rem; }

/* Refund toggle */
.edit-type-btn {
  flex: 1; padding: 0.5rem 0; border-radius: var(--radius-lg);
  background: var(--surface-low); color: var(--text-secondary);
  font-size: 0.875rem; font-weight: 600; transition: all 0.15s;
}
.edit-type-btn.active {
  background: var(--accent); color: #fff;
}

.refund-toggle-btn {
  width: 100%; padding: 0.625rem 1rem;
  border-radius: var(--radius-lg);
  background: var(--surface-low); color: var(--text-secondary);
  font-size: 0.875rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  transition: all 0.15s;
}
.refund-toggle-btn.active { background: var(--income-bg); color: var(--income-color); }


/* ── Monthly Insights ──────────────────────────────────────────────────────── */
.insights-card { margin-bottom: 0.75rem; padding: 1rem; }
.insights-section-label {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.75rem;
}

/* Pace bars */
.ins-pace-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.5rem; }
.ins-pace-num { font-weight: 600; font-size: 0.875rem; }
.ins-pace-pct { font-size: 0.75rem; color: var(--text-secondary); }
.ins-bar-wrap { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.375rem; }
.ins-bar-track { flex: 1; height: 6px; background: var(--surface-low); border-radius: 99px; overflow: hidden; }
.ins-bar-fill { height: 100%; border-radius: 99px; transition: width 0.4s ease; }
.ins-bar-time { background: var(--text-muted); }
.ins-bar-spend { background: var(--primary); }
.ins-bar-label { font-size: 0.7rem; color: var(--text-muted); width: 36px; text-align: right; flex-shrink: 0; }
.ins-projection { display: flex; justify-content: space-between; align-items: center; margin-top: 0.75rem; font-size: 0.8125rem; color: var(--text-secondary); }

/* Savings */
.ins-savings-row { display: flex; gap: 1.5rem; align-items: flex-end; margin-bottom: 0.5rem; }
.ins-savings-main, .ins-savings-avg { display: flex; flex-direction: column; }
.ins-savings-val { font-family: var(--font-display); font-size: 1.75rem; font-weight: 800; line-height: 1; }
.ins-savings-avg-val { font-size: 1.1rem; font-weight: 700; color: var(--text-secondary); }
.ins-savings-sub { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.125rem; }
.ins-income-row { font-size: 0.75rem; color: var(--text-secondary); }

/* Traffic lights */
.ins-light-group { margin-bottom: 0.5rem; }
.ins-light-row { margin-bottom: 0.5rem; }
.ins-light-info { display: flex; align-items: center; gap: 0.375rem; margin-bottom: 0.25rem; }
.ins-light-emoji { font-size: 0.875rem; flex-shrink: 0; }
.ins-light-cat { flex: 1; font-size: 0.8125rem; font-weight: 600; color: var(--text-primary); }
.ins-light-num { font-size: 0.75rem; color: var(--text-secondary); flex-shrink: 0; }
.ins-light-bar-track { height: 4px; background: var(--surface-low); border-radius: 99px; overflow: hidden; }
.ins-light-bar-fill { height: 100%; border-radius: 99px; transition: width 0.4s ease; }
.ins-green-summary { font-size: 0.8125rem; color: var(--income-color); padding: 0.25rem 0; }

/* Action items */
.ins-action-card { cursor: pointer; }
.ins-action-card:active { background: var(--surface-low); }
.ins-action-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.875rem; }
.ins-action-link { color: var(--primary); font-weight: 600; font-size: 0.8125rem; }
.ins-empty-hint { font-size: 0.875rem; color: var(--income-color); }

/* Events */
.ins-event-row { display: flex; justify-content: space-between; padding: 0.375rem 0; border-bottom: 1px solid var(--surface); }
.ins-event-row:last-child { border-bottom: none; }
.ins-event-label { font-size: 0.875rem; color: var(--text-primary); }
.ins-event-amount { font-size: 0.875rem; font-weight: 600; color: var(--expense-color); }

/* AI insight */
.ins-ai-text { font-size: 0.875rem; line-height: 1.5; color: var(--text-primary); margin-bottom: 0.75rem; min-height: 2rem; }
.ins-ai-placeholder { color: var(--text-muted); font-style: italic; }
.ins-ai-btn {
  width: 100%; padding: 0.625rem 1rem;
  background: var(--primary); color: var(--on-primary);
  border-radius: var(--radius-lg); font-weight: 600; font-size: 0.875rem;
}
.ins-ai-btn:active { opacity: 0.85; }
.ins-ai-btn:disabled { opacity: 0.5; }

/* Goal card */
.ins-goal-name { font-size: 1rem; font-weight: 700; margin: 0.5rem 0 0.25rem; }
.ins-goal-amounts { display: flex; align-items: baseline; gap: 0.4rem; margin-bottom: 0.25rem; }
.ins-goal-saved { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; }
.ins-goal-target { font-size: 0.8125rem; color: var(--text-muted); }
.ins-goal-meta {
  display: flex; justify-content: space-between; flex-wrap: wrap;
  font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.375rem; gap: 0.25rem;
}
.ins-goal-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }
.ins-goal-edit-link {
  font-size: 0.8rem; color: var(--primary); background: none; border: none;
  cursor: pointer; padding: 0; font-weight: 600;
}
.ins-goal-form-row { display: flex; flex-direction: column; gap: 0.25rem; margin-bottom: 0.5rem; }
.ins-goal-form-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }
.ins-goal-input {
  padding: 0.5rem 0.625rem; border-radius: var(--radius-sm);
  border: 1.5px solid var(--surface-low); background: var(--surface);
  font-size: 0.875rem; color: var(--text-primary); width: 100%;
}
.ins-goal-form-error { font-size: 0.8rem; color: var(--expense-color); margin-top: 0.25rem; min-height: 1em; }
/* MoM delta */
.ins-mom-row { display: grid; grid-template-columns: 1fr auto auto; gap: 0.5rem; align-items: center; padding: 0.3rem 0; }
.ins-mom-cat { font-size: 0.875rem; font-weight: 500; }
.ins-mom-sub { font-size: 0.75rem; color: var(--text-muted); text-align: right; }
/* Subscriptions */
.ins-sub-row { display: flex; justify-content: space-between; align-items: center; padding: 0.35rem 0; border-bottom: 1px solid var(--surface-low); }
.ins-sub-row:last-of-type { border-bottom: none; }
.ins-sub-info { display: flex; flex-direction: column; gap: 0.1rem; }
.ins-sub-merchant { font-size: 0.875rem; font-weight: 500; }
.ins-sub-amt { font-size: 0.875rem; font-weight: 700; white-space: nowrap; }
.ins-sg-row { padding: 0.25rem 0; }
.ins-sg-info { display: flex; justify-content: space-between; align-items: center; }
.ins-sg-cat { font-weight: 600; font-size: 0.875rem; }
.ins-sg-nums { font-size: 0.8125rem; color: var(--text-secondary); }
.ins-sg-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.15rem; }

/* Account filter chips (legacy) */
.filter-bar-accounts { margin-top: -0.25rem; }
.account-chip { white-space: nowrap; }

/* Activity dropdown pills */
.act-pill-row {
  display: flex;
  gap: 0.5rem;
  padding: 0 var(--page-pad) 0.75rem;
}
.act-pill-wrap {
  position: relative;
}
.act-pill {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border: 1.5px solid var(--outline);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.act-pill svg { flex-shrink: 0; opacity: 0.6; }
.act-pill-active {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--primary);
}
.act-pill-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 200px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 200;
  padding: 0.25rem 0;
}
.act-pill-menu.hidden { display: none; }
.act-pill-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-primary);
  gap: 0.5rem;
  transition: background 0.1s;
}
.act-pill-option:hover { background: var(--surface-low); }
.act-pill-option.active {
  color: var(--primary);
  font-weight: 600;
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}
.act-pill-option-amt {
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* ── CSV Import Overlay ───────────────────────────────────────────────────── */
.csv-import-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 900;
}
.csv-import-overlay.hidden { display: none; }
.csv-import-sheet {
  background: var(--surface-card); border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%; max-width: 520px; max-height: 88vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.csv-import-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.25rem 0.75rem; border-bottom: 1px solid var(--surface-low);
  font-weight: 700; font-size: 1rem; flex-shrink: 0;
}
.csv-import-close {
  background: none; border: none; font-size: 1.125rem;
  color: var(--text-muted); cursor: pointer; padding: 0.25rem;
}
.csv-step { padding: 1.25rem; overflow-y: auto; flex: 1; }
.csv-drop-zone {
  border: 2px dashed var(--surface-low); border-radius: var(--radius-lg);
  padding: 2.5rem 1rem; text-align: center; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.csv-drop-zone:hover, .csv-drop-active {
  border-color: var(--primary); background: color-mix(in srgb, var(--primary) 5%, transparent);
}
.csv-drop-label { font-weight: 600; margin: 0.75rem 0 0.25rem; font-size: 0.9375rem; }
.csv-drop-sub { font-size: 0.8rem; color: var(--text-muted); }
.csv-step-error { font-size: 0.8125rem; color: var(--expense-color); margin-top: 0.5rem; min-height: 1em; }
.csv-bank-badge {
  display: inline-block; padding: 0.2rem 0.6rem;
  background: #dcfce7; color: #15803d; border-radius: var(--radius-full);
  font-size: 0.8125rem; font-weight: 600;
}
.csv-bank-detected { margin-bottom: 0.4rem; font-size: 0.875rem; }
.csv-preview-meta { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.csv-preview-table-wrap { max-height: 40vh; overflow-y: auto; border-radius: var(--radius-sm); border: 1px solid var(--surface-low); }
.csv-preview-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.csv-preview-table th {
  background: var(--surface); padding: 0.5rem 0.625rem;
  text-align: left; font-size: 0.75rem; color: var(--text-muted);
  position: sticky; top: 0; z-index: 1;
}
.csv-preview-table td { padding: 0.45rem 0.625rem; border-top: 1px solid var(--surface-low); }
.csv-preview-table tr.csv-row-credit td { color: var(--text-muted); }
.csv-cell-merchant { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.csv-cell-amt { font-weight: 600; white-space: nowrap; }
.csv-preview-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }
.import-del-btn {
  background: none; border: none; color: var(--text-muted); font-size: 0.85rem;
  cursor: pointer; padding: 0.2rem 0.4rem; border-radius: var(--radius-sm);
  line-height: 1;
}
.import-del-btn:hover { background: var(--danger-soft, #fee2e2); color: var(--danger, #ef4444); }
.import-type-sel {
  background: var(--surface-low); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); font-size: 0.75rem; padding: 0.15rem 0.3rem; cursor: pointer;
}
.csv-btn-primary {
  flex: 1; padding: 0.7rem; background: var(--primary); color: var(--on-primary);
  border-radius: var(--radius-lg); font-weight: 600; font-size: 0.9rem; border: none; cursor: pointer;
}
.csv-btn-primary:disabled { opacity: 0.5; }
.csv-btn-secondary {
  padding: 0.7rem 1rem; background: var(--surface); color: var(--text-secondary);
  border-radius: var(--radius-lg); font-weight: 600; font-size: 0.9rem;
  border: 1.5px solid var(--surface-low); cursor: pointer;
}
.csv-result-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0; font-size: 0.9375rem; }
.csv-result-icon { font-size: 1.25rem; }

/* ── Plan Screen ────────────────────────────────────────────────────────────── */
.plan-page { padding: 0 var(--page-pad) var(--page-pad); }
.plan-section { margin-bottom: 1.25rem; }
.plan-section-title {
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em;
  color: var(--text-muted); text-transform: uppercase;
  margin-bottom: 0.5rem; padding-left: 0.25rem;
}

/* Commitment summary card */
.plan-commit-totals {
  display: flex; justify-content: space-between; padding: 0.75rem 1rem;
}
.plan-commit-total-item { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; }
.plan-commit-total-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.plan-commit-total-amt { font-size: 1.1rem; font-weight: 700; }
.plan-excluded-note {
  font-size: 0.75rem; color: var(--text-muted); text-align: center;
  padding: 0 1rem 0.75rem; margin: 0;
}

/* Charge groups */
.plan-group { margin-bottom: 0.5rem; }
.plan-group:last-child { margin-bottom: 0; }
.plan-group-label {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em;
  color: var(--text-muted); text-transform: uppercase;
  padding: 0.5rem 0 0.25rem;
  border-top: 1px solid var(--surface-low);
}
.plan-group:first-child .plan-group-label { border-top: none; padding-top: 0; }

/* Individual charge row */
.plan-charge-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.5rem 0; border-bottom: 1px solid var(--surface-low);
  transition: opacity 0.15s;
}
.plan-charge-row:last-child { border-bottom: none; }
.plan-charge-excluded { opacity: 0.35; }
.plan-charge-left { display: flex; align-items: center; gap: 0.5rem; flex: 1; min-width: 0; }
.plan-charge-toggle {
  background: none; border: none; font-size: 1rem; cursor: pointer;
  padding: 0.15rem; color: var(--primary); flex-shrink: 0; line-height: 1;
}
.plan-charge-info { display: flex; flex-direction: column; min-width: 0; }
.plan-charge-name { font-size: 0.875rem; font-weight: 600; truncate; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-charge-cat { font-size: 0.72rem; color: var(--text-muted); }
.plan-charge-right { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.plan-charge-amt { font-size: 0.9rem; font-weight: 600; }
.plan-charge-status { font-size: 0.85rem; width: 1.4rem; text-align: center; }
.plan-status-paid { color: var(--income-color); }
.plan-status-pending { color: var(--expense-color); }

/* Need vs Want rows */
.plan-nw-row { margin-bottom: 0.25rem; }
.plan-nw-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.3rem; }
.plan-nw-label { font-size: 0.875rem; font-weight: 600; }
.plan-nw-amt { font-size: 0.875rem; font-weight: 700; }

/* Plan — need/want tags on budget rows */
.plan-cat-tag {
  display: inline-block; font-size: 0.6rem; font-weight: 700;
  padding: 0.1rem 0.35rem; border-radius: var(--radius-full);
  vertical-align: middle; margin-left: 0.3rem; letter-spacing: 0.04em;
}
.plan-cat-tag-need { background: #d6f5e3; color: #1a6b3c; }
.plan-cat-tag-want { background: #ffdad6; color: #b3261e; }

/* Plan — collapsible section headers */
.plan-section-header {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; padding: 0.25rem 0.25rem 0.4rem;
  user-select: none;
}
.plan-section-header .plan-section-title { margin-bottom: 0; }
.plan-section-chevron {
  width: 18px; height: 18px; color: var(--text-muted);
  transition: transform 0.2s ease; flex-shrink: 0;
}
.plan-section-chevron.collapsed { transform: rotate(-90deg); }

/* Plan — variable needs scratchpad */
.plan-var-row { align-items: center; }
.plan-var-amt-wrap {
  display: flex; align-items: center; gap: 0.15rem;
  background: var(--surface); border-radius: var(--radius-sm);
  padding: 0.2rem 0.5rem; border: 1.5px solid var(--surface-low);
}
.plan-var-prefix { font-size: 0.875rem; font-weight: 600; color: var(--text-secondary); }
.plan-var-input {
  width: 70px; background: none; border: none; outline: none;
  font-size: 0.9rem; font-weight: 700; text-align: right;
  color: var(--text-primary); font-family: var(--font-body);
}
.plan-group-hint {
  font-size: 0.65rem; font-weight: 400; color: var(--text-muted);
  text-transform: none; letter-spacing: 0; margin-left: 0.35rem;
}
.plan-status-partial { color: #b45309; }
.plan-charge-cat.plan-status-paid { color: var(--income-color); }
.plan-charge-cat.plan-status-partial { color: #b45309; }
.plan-charge-cat.plan-status-pending { color: var(--expense-color); }
