/* ── Design tokens ──────────────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg:           #F0F2F8;
  --surface:      #FFFFFF;
  --surface-2:    #F7F8FC;
  --surface-3:    #EEF0F7;

  /* Brand */
  --navy:         #1B2B4B;
  --navy-2:       #243459;
  --navy-3:       #2E4070;
  --navy-light:   rgba(27,43,75,.06);
  --navy-dim:     rgba(27,43,75,.04);

  /* Gold accent – wealth / rupee */
  --gold:         #C8963E;
  --gold-light:   #E0AE5A;
  --gold-dim:     rgba(200,150,62,.10);

  /* Semantic */
  --gain:         #0D9E60;
  --gain-bg:      rgba(13,158,96,.10);
  --loss:         #D94040;
  --loss-bg:      rgba(217,64,64,.09);
  --warn:         #C8963E;

  /* Text */
  --text:         #1B2B4B;
  --text-2:       #5A6A88;
  --text-3:       #9DAABB;
  --text-inv:     #FFFFFF;

  /* Borders */
  --border:       #E2E6F0;
  --border-2:     #CDD3E2;

  /* Misc */
  --radius:       14px;
  --radius-sm:    8px;
  --radius-lg:    20px;
  --sidebar-w:    230px;
  --header-h:     56px;
  --bottom-nav-h: 64px;
  --shadow-sm:    0 1px 4px rgba(27,43,75,.06), 0 2px 12px rgba(27,43,75,.04);
  --shadow:       0 2px 8px rgba(27,43,75,.08), 0 4px 24px rgba(27,43,75,.06);
  --shadow-lg:    0 8px 32px rgba(27,43,75,.12);
  --transition:   0.16s ease;
}

/* ── Reset ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }
svg { display: block; }

/* ── Layout ─────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  z-index: 100;
  padding: 0 12px;
}

.main-content {
  min-height: 100vh;
  padding: 28px 24px calc(var(--bottom-nav-h) + 20px);
}

.mobile-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 90;
}

.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 90;
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

@media (min-width: 768px) {
  .main-content {
    margin-left: var(--sidebar-w);
    padding: 32px 32px 40px;
  }
  .mobile-header { display: none; }
  .bottom-nav    { display: none; }
}

@media (max-width: 767px) {
  .sidebar { display: none; }
  .main-content { padding-top: calc(var(--header-h) + 20px); }
}

/* ── Sidebar (navy) ──────────────────────────────────────────────────── */
.sidebar-header {
  padding: 20px 4px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 34px; height: 34px;
  background: var(--gold);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #fff;
  font-weight: 800;
}

.brand-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-footer {
  padding: 12px 0 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.5);
  font-size: 0.84rem;
  font-weight: 500;
  transition: all var(--transition);
  width: 100%;
  text-align: left;
}

.nav-item svg {
  width: 16px; height: 16px;
  flex-shrink: 0;
  stroke: currentColor;
}

.nav-item:hover {
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.85);
}

.nav-item.active {
  background: rgba(255,255,255,.12);
  color: #fff;
}

.nav-item.active svg { stroke: var(--gold-light); }

.logout-btn { color: rgba(255,255,255,.35); }
.logout-btn:hover { color: var(--loss) !important; background: rgba(217,64,64,.15) !important; }

/* ── Mobile header ──────────────────────────────────────────────────── */
.user-avatar {
  width: 30px; height: 30px;
  background: var(--gold);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
}

/* brand on mobile header – white text */
.mobile-header .brand-name { color: #fff; }

/* ── Bottom nav ─────────────────────────────────────────────────────── */
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-3);
  font-size: 0.6rem;
  font-weight: 600;
  padding: 6px 0;
  transition: color var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.bottom-nav-item svg { width: 20px; height: 20px; stroke: currentColor; }
.bottom-nav-item.active { color: var(--navy); }
.bottom-nav-item.active svg { stroke: var(--navy); }

/* ── Page header ─────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 12px;
}

.page-eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.page-title {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

/* ── Dashboard hero card (statement header style) ───────────────────── */
.net-worth-card {
  background: var(--navy);
  border-radius: var(--radius-lg);
  padding: 28px 24px 24px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

/* Decorative rings */
.net-worth-card::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 260px; height: 260px;
  border-radius: 50%;
  border: 40px solid rgba(255,255,255,.03);
  pointer-events: none;
}

.net-worth-card::after {
  content: '';
  position: absolute;
  bottom: -50px; right: 40px;
  width: 160px; height: 160px;
  border-radius: 50%;
  border: 28px solid rgba(255,255,255,.025);
  pointer-events: none;
}

.net-worth-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(255,255,255,.5);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.net-worth-amount {
  font-size: 2.6rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin-bottom: 20px;
}

@media (min-width: 480px) { .net-worth-amount { font-size: 3.2rem; } }

.net-worth-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meta-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: rgba(255,255,255,.4);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.meta-val {
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.meta-val.gain { color: #4CD997; }
.meta-val.loss { color: #FF8080; }

.meta-divider {
  width: 1px;
  height: 32px;
  background: rgba(255,255,255,.12);
}

/* ── Wealth indicator ───────────────────────────────────────────────── */
.wealth-indicator {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1.5px solid var(--border);
  background: var(--surface);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.wealth-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  flex-shrink: 0;
}

.wealth-indicator.positive { border-color: var(--gain); }
.wealth-indicator.positive .wealth-dot { background: var(--gain); }
.wealth-indicator.positive .wealth-label { color: var(--gain); }
.wealth-indicator.negative { border-color: var(--loss); }
.wealth-indicator.negative .wealth-dot { background: var(--loss); }
.wealth-indicator.negative .wealth-label { color: var(--loss); }

/* ── Stats grid ─────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

@media (min-width: 540px) {
  .stats-grid[style*="--cols:3"] { grid-template-columns: repeat(3, 1fr); }
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 7px;
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.stat-sub {
  font-size: 0.7rem;
  color: var(--text-3);
  margin-top: 5px;
  font-weight: 500;
}

.gain { color: var(--gain); }
.loss { color: var(--loss); }

/* ── Card ────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.01em;
}

.card-link {
  font-size: 0.75rem;
  color: var(--gold);
  font-weight: 700;
  transition: opacity var(--transition);
}
.card-link:hover { opacity: 0.7; }

/* ── Savings rate ring ──────────────────────────────────────────────── */
.savings-rate-card { text-align: center; }

.savings-ring-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 4px 0;
}

.ring-center-text {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.ring-pct {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.ring-label {
  font-size: 0.62rem;
  color: var(--text-3);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 100px;
  letter-spacing: 0.03em;
}

.badge.good  { background: var(--gain-bg);  color: var(--gain); }
.badge.warn  { background: var(--gold-dim); color: var(--gold); }
.badge.bad   { background: var(--loss-bg);  color: var(--loss); }

.savings-target-text {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 6px;
  font-weight: 500;
}

/* ── Charts ─────────────────────────────────────────────────────────── */
.charts-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (min-width: 900px) {
  .charts-row { grid-template-columns: 3fr 2fr; }
}

.chart-card { margin-bottom: 0; }
.chart-wrap { height: 220px; position: relative; }

/* ── Goals (dashboard) ──────────────────────────────────────────────── */
.goals-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.goal-row-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 5px;
}

.goal-row-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--navy);
}

.goal-row-pct {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.goal-row-amounts {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-3);
  font-weight: 600;
  margin-top: 4px;
}

.progress-bar {
  width: 100%;
  height: 5px;
  background: var(--bg);
  border-radius: 100px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 100px;
  transition: width 0.7s cubic-bezier(.4,0,.2,1);
}

.progress-fill.complete { background: var(--gain); }

/* ── Transactions ───────────────────────────────────────────────────── */
.transactions-list { display: flex; flex-direction: column; }

.tx-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.tx-item:last-child { border-bottom: none; }

.tx-dot {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 800;
  flex-shrink: 0;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.tx-dot.income  { background: var(--gain-bg); color: var(--gain); }
.tx-dot.expense { background: var(--loss-bg); color: var(--loss); }

.tx-info { flex: 1; min-width: 0; }

.tx-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-meta {
  font-size: 0.68rem;
  color: var(--text-3);
  margin-top: 1px;
  font-weight: 500;
}

.tx-amount {
  font-size: 0.9rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.tx-amount.income  { color: var(--gain); }
.tx-amount.expense { color: var(--loss); }

/* ── Item list (CRUD pages) ─────────────────────────────────────────── */
.item-list { display: flex; flex-direction: column; }

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }

.list-item-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 800;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.list-item-info { flex: 1; min-width: 0; }

.list-item-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item-sub {
  font-size: 0.7rem;
  color: var(--text-3);
  margin-top: 2px;
  font-weight: 500;
}

.list-item-amount {
  font-size: 1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.list-item-actions { display: flex; gap: 4px; flex-shrink: 0; }

.action-btn {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  transition: all var(--transition);
}

.action-btn:hover { background: var(--surface-3); color: var(--text-2); }
.action-btn.delete:hover { background: var(--loss-bg); color: var(--loss); }
.action-btn svg { width: 14px; height: 14px; }

/* ── Goals grid (goals page) ────────────────────────────────────────── */
.goals-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 540px) {
  .goals-grid { grid-template-columns: repeat(2, 1fr); }
}

.goal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.goal-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.goal-card-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.01em;
}

.goal-card-deadline {
  font-size: 0.65rem;
  color: var(--text-3);
  margin-top: 2px;
  font-weight: 600;
}

.goal-card-pct {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.goal-card-bar {
  margin: 12px 0 8px;
  height: 6px;
  background: var(--bg);
  border-radius: 100px;
  overflow: hidden;
}

.goal-card-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 100px;
  transition: width 0.7s cubic-bezier(.4,0,.2,1);
}

.goal-card-fill.complete { background: var(--gain); }

.goal-card-amounts {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 700;
}

.goal-saved  { color: var(--gain); }
.goal-target { color: var(--text-3); }

.goal-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: all var(--transition);
  white-space: nowrap;
  cursor: pointer;
}

.btn-primary {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 1px 6px rgba(27,43,75,.25);
}
.btn-primary:hover {
  background: var(--navy-3);
  box-shadow: 0 3px 12px rgba(27,43,75,.3);
  transform: translateY(-1px);
}
.btn-primary:active { transform: none; }

.btn-secondary {
  background: var(--surface-3);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); color: var(--text); }

.btn-danger {
  background: var(--loss-bg);
  color: var(--loss);
  border: 1px solid transparent;
}
.btn-danger:hover { background: var(--loss); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }

.btn-gold {
  background: var(--gold);
  color: #fff;
}
.btn-gold:hover { background: var(--gold-light); transform: translateY(-1px); }

.btn-full { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 0.75rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ── Form fields ─────────────────────────────────────────────────────── */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}

.field-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field-input {
  width: 100%;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-size: 0.9rem;
  color: var(--text);
  transition: border-color var(--transition), background var(--transition);
  outline: none;
}

.field-input:focus {
  border-color: var(--navy);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(27,43,75,.07);
}

.field-input::placeholder { color: var(--text-3); }

select.field-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239DAABB' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 36px;
}

/* ── Modal ───────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(27,43,75,.4);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(3px);
}

.modal-overlay.open { display: flex; }

@media (min-width: 540px) { .modal-overlay { align-items: center; } }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.22s ease;
}

@media (min-width: 540px) {
  .modal {
    border-radius: var(--radius-lg);
    animation: popIn 0.18s ease;
  }
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

@keyframes popIn {
  from { transform: scale(0.96); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.02em;
}

.modal-close {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  transition: all var(--transition);
}
.modal-close:hover { background: var(--surface-3); color: var(--text); }
.modal-close svg { width: 15px; height: 15px; }

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.modal-actions .btn { flex: 1; }

/* ── Filter bar ─────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.filter-btn {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  font-weight: 700;
}
.filter-btn:hover { background: var(--navy-light); color: var(--navy); }

.filter-label {
  flex: 1;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--navy);
}

/* ── Chip scroll ─────────────────────────────────────────────────────── */
.chip-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 8px;
  scrollbar-width: none;
}
.chip-scroll::-webkit-scrollbar { display: none; }

.chip {
  padding: 5px 13px;
  border-radius: 100px;
  font-size: 0.74rem;
  font-weight: 700;
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text-2);
  white-space: nowrap;
  transition: all var(--transition);
}
.chip:hover { border-color: var(--navy); color: var(--navy); }
.chip.active { background: var(--navy-light); border-color: var(--navy); color: var(--navy); }

/* ── Empty state ─────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  gap: 10px;
  text-align: center;
}

.empty-icon { font-size: 2.4rem; margin-bottom: 4px; opacity: 0.6; }

.empty-state p {
  font-size: 0.84rem;
  color: var(--text-3);
  font-weight: 600;
}

/* ── Toast ───────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
  min-width: 240px;
  max-width: 340px;
}

@media (min-width: 768px) {
  #toast-container {
    bottom: 24px;
    left: auto; right: 24px;
    transform: none;
  }
}

.toast {
  padding: 11px 16px;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 700;
  animation: toastIn 0.2s ease;
  pointer-events: all;
  box-shadow: var(--shadow);
}

.toast.success { background: #fff; border: 1.5px solid var(--gain); color: var(--gain); }
.toast.error   { background: #fff; border: 1.5px solid var(--loss); color: var(--loss); }
.toast.info    { background: #fff; border: 1.5px solid var(--border-2); color: var(--text); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Login ───────────────────────────────────────────────────────────── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--bg);
}

.login-container {
  width: 100%;
  max-width: 360px;
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-brand-icon {
  width: 52px; height: 52px;
  background: var(--navy);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--gold-light);
  font-weight: 800;
  margin: 0 auto 14px;
  box-shadow: 0 4px 20px rgba(27,43,75,.3);
}

.login-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 0.8rem;
  color: var(--text-3);
  font-weight: 500;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}

.error-banner {
  background: var(--loss-bg);
  border: 1px solid var(--loss);
  border-radius: var(--radius-sm);
  color: var(--loss);
  padding: 10px 13px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 14px;
}

.login-hint {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-3);
  margin-top: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* ── Settings ────────────────────────────────────────────────────────── */
.settings-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .settings-grid { grid-template-columns: 1fr 1fr; }
}

.settings-card { margin-bottom: 0; }

.settings-section-title {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.settings-hint {
  font-size: 0.8rem;
  color: var(--text-3);
  margin-bottom: 14px;
  font-weight: 500;
}

.danger-card { border-color: var(--loss); }

.rules-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  counter-reset: rules;
}

.rules-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.82rem;
  color: var(--text-2);
  font-weight: 500;
  counter-increment: rules;
}

.rules-list li::before {
  content: counter(rules);
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--navy-light);
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── Loan items ─────────────────────────────────────────────────────── */
.loan-progress { margin-top: 6px; }

.loan-progress-bar {
  width: 100%;
  height: 3px;
  background: var(--bg);
  border-radius: 100px;
  overflow: hidden;
  margin-top: 4px;
}

.loan-progress-fill {
  height: 100%;
  background: var(--loss);
  border-radius: 100px;
  transition: width 0.6s ease;
}

/* ── Category colors ─────────────────────────────────────────────────── */
.cat-fuel          { background: rgba(245,158,11,.12);  color: #B45309; }
.cat-food          { background: rgba(239,68,68,.10);   color: #B91C1C; }
.cat-shopping      { background: rgba(139,92,246,.10);  color: #6D28D9; }
.cat-entertainment { background: rgba(59,130,246,.10);  color: #1D4ED8; }
.cat-utilities     { background: rgba(20,184,166,.10);  color: #0F766E; }
.cat-business      { background: rgba(34,197,94,.10);   color: #15803D; }
.cat-investment    { background: rgba(13,158,96,.12);   color: #0D9E60; }
.cat-family        { background: rgba(236,72,153,.10);  color: #BE185D; }
.cat-emi           { background: rgba(217,64,64,.10);   color: var(--loss); }
.cat-health        { background: rgba(251,146,60,.10);  color: #C2410C; }
.cat-education     { background: rgba(99,102,241,.10);  color: #4338CA; }
.cat-subscriptions { background: rgba(139,92,246,.10);  color: #6D28D9; }
.cat-miscellaneous { background: rgba(107,114,128,.10); color: #4B5563; }
.cat-income        { background: var(--gain-bg);         color: var(--gain); }
.cat-default       { background: var(--navy-light);      color: var(--navy); }

/* ── Expense category chip grid (modal) ─────────────────────────────── */
.cat-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cat-chip {
  padding: 7px 14px;
  border-radius: 100px;
  border: 1.5px solid var(--border);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--surface-2);
  color: var(--text-2);
  font-family: inherit;
}

.cat-chip:hover {
  border-color: var(--navy);
  color: var(--navy);
  background: var(--navy-light);
}

.cat-chip.selected {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.cat-chip-new {
  border-style: dashed;
  color: var(--text-3);
}

.cat-chip-new:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-dim);
}

/* ── Large amount input ─────────────────────────────────────────────── */
.field-input-xl {
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  padding: 14px;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--navy);
}

.field-input-xl::placeholder {
  color: var(--text-3);
  font-weight: 400;
  font-size: 1.5rem;
}
