/* =========================================================
   FinPlan — Redesigned UI System
   Font: DM Sans (display) + DM Mono (numbers)
   Palette: White · Antique White · Air Force Blue · Sky Blue
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Mono:wght@400;500&display=swap');

/* ─── CSS Variables ─────────────────────────────────────── */
:root {
  /* Brand palette */
  --palette-white:   #ffffff;
  --palette-antique: #ffe8d1;   /* warm peach */
  --palette-air:     #568ea3;   /* air force blue */
  --palette-sky:     #68c3d4;   /* sky blue light */

  /* Accent system — air force blue as primary */
  --accent:        #568ea3;
  --accent-light:  rgba(86,142,163,.12);
  --accent-dark:   #3d6e82;
  --accent-2:      #68c3d4;   /* sky blue — secondary highlights */
  --accent-2-light:rgba(104,195,212,.12);

  --success:       #2d8653;
  --success-light: #d1f0e0;
  --danger:        #c94040;
  --danger-light:  #fde8e8;
  --warning:       #c47c1a;
  --warning-light: #fef0d6;
  --info:          #2563eb;
  --info-light:    #dbeafe;

  /* Surfaces — antique white tones */
  --bg:            #fff9f4;   /* antique-white tinted page bg */
  --surface:       #ffffff;
  --surface-2:     #ffe8d1;   /* antique white panels */
  --border:        rgba(86,142,163,.18);
  --border-strong: rgba(86,142,163,.32);

  --text-1:        #1a2f3a;   /* deep blue-grey */
  --text-2:        #4a6272;
  --text-3:        #8baabb;

  --radius-sm:     8px;
  --radius:        14px;
  --radius-lg:     20px;
  --radius-xl:     28px;

  --shadow-sm:     0 1px 3px rgba(86,142,163,.1), 0 1px 2px rgba(86,142,163,.06);
  --shadow:        0 4px 16px rgba(86,142,163,.12), 0 1px 4px rgba(86,142,163,.06);
  --shadow-lg:     0 12px 40px rgba(86,142,163,.18), 0 4px 12px rgba(86,142,163,.08);

  --dock-h:        72px;
  --topbar-h:      60px;
  --content-max:   1140px;
}

/* ─── Dark Mode ─────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:            #0f1e28;
  --surface:       #162534;
  --surface-2:     #1e3245;
  --border:        rgba(104,195,212,.15);
  --border-strong: rgba(104,195,212,.28);
  --text-1:        #e8f4f8;
  --text-2:        #93b8c8;
  --text-3:        #567a8a;
  --accent-light:  rgba(104,195,212,.15);
  --accent-2-light:rgba(104,195,212,.12);
  --shadow-sm:     0 1px 3px rgba(0,0,0,.3);
  --shadow:        0 4px 16px rgba(0,0,0,.35);
  --shadow-lg:     0 12px 40px rgba(0,0,0,.45);
}

/* ─── Reset & Base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* ─── Typography ────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-1);
}
.mono { font-family: 'DM Mono', monospace; letter-spacing: -0.02em; }
.text-muted { color: var(--text-2) !important; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.fw-500 { font-weight: 500; }

/* ─── Links ─────────────────────────────────────────────── */
a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-dark); }

/* ─── Layout ─────────────────────────────────────────────── */
.main-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 1.5rem 1rem 6rem;
  animation: fadeUp .25s ease both;
}

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

/* ─── Top Bar (mobile) ───────────────────────────────────── */
.mobile-top-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 200;
  backdrop-filter: blur(12px);
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent) !important;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.02em;
}
.navbar-brand i { font-size: 1.2rem; }

/* ─── Desktop Top Bar ────────────────────────────────────── */
.desktop-top-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: var(--topbar-h);
  position: sticky;
  top: 0;
  z-index: 200;
}
.desktop-top-bar .user-menu {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: 14px;
  color: var(--text-2);
}
.desktop-top-bar .user-menu a {
  color: var(--text-2);
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  transition: all .15s;
}
.desktop-top-bar .user-menu a:hover {
  background: var(--surface-2);
  color: var(--text-1);
}

/* ─── Mobile Floating Nav ────────────────────────────────── */
/* fab-toggle, fab-backdrop, fab-sheet are direct body children */
/* Hidden on desktop via media query below */

.fab-toggle {
  position: fixed;
  bottom: 24px; right: 24px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  box-shadow: 0 4px 20px rgba(13,148,136,.45), 0 2px 6px rgba(0,0,0,.12);
  font-size: 1.25rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 500;
  transition: background .2s, transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
}
.fab-toggle:hover { background: var(--accent-dark); }
.fab-toggle.open {
  background: var(--text-1);
  transform: rotate(90deg);
}

.fab-backdrop {
  position: fixed; inset: 0;
  background: rgba(28,25,23,.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 490;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.fab-backdrop.open { opacity: 1; pointer-events: all; }

.fab-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -8px 40px rgba(0,0,0,.14);
  z-index: 495;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.32,.72,0,1);
  padding: 0 1rem env(safe-area-inset-bottom, 1.5rem);
  max-height: 82vh;
  overflow-y: auto;
}
.fab-sheet.open { transform: translateY(0); }

.fab-sheet__handle {
  width: 40px; height: 5px;
  background: var(--border-strong);
  border-radius: 100px;
  margin: 12px auto 18px;
}

.fab-sheet__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .25rem 0;
  padding-bottom: .5rem;
}

.fab-sheet__item {
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
  padding: .75rem .5rem;
  text-decoration: none;
  color: var(--text-2);
  border-radius: var(--radius-sm);
  transition: background .15s;
  -webkit-tap-highlight-color: transparent;
}
.fab-sheet__item:active { background: var(--bg); }
.fab-sheet__item.active { color: var(--accent); }
.fab-sheet__item.active .fab-sheet__icon { background: var(--accent-light); color: var(--accent); }

.fab-sheet__icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  transition: background .15s, color .15s;
}
.fab-sheet__icon--accent {
  background: var(--accent); color: white;
  box-shadow: 0 3px 10px rgba(13,148,136,.35);
}
.fab-sheet__item span {
  font-size: 11px; font-weight: 600;
  text-align: center; letter-spacing: .01em; line-height: 1.2;
}

@media (max-width: 991px) {
  .main-content { padding-bottom: 5rem; }
}

/* ─── macOS Dock (desktop) ───────────────────────────────── */
.macos-dock {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: var(--radius-xl);
  box-shadow: 0 8px 40px rgba(0,0,0,.18), 0 2px 8px rgba(0,0,0,.08), inset 0 1px 0 rgba(255,255,255,.8);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 300;
}

.dock-item {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  font-size: 1.2rem;
  transition: all .2s cubic-bezier(.34,1.56,.64,1);
  text-decoration: none;
  background: transparent;
  cursor: pointer;
}
.dock-item:hover {
  transform: translateY(-6px) scale(1.15);
  color: var(--accent);
  background: var(--accent-light);
}
.dock-item.active {
  color: var(--accent);
  background: linear-gradient(135deg, var(--accent-light), #f0fdf9);
  box-shadow: 0 2px 8px rgba(13,148,136,.2);
}
.dock-item.active::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* Tooltip */
.dock-item::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: var(--text-1);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all .15s;
  letter-spacing: .03em;
}
.dock-item:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.dock-separator {
  width: 1px;
  height: 32px;
  background: var(--border-strong);
  margin: 0 4px;
  border-radius: 1px;
}

/* Desktop adjustments */
@media (min-width: 992px) {
  .main-content { padding: 2rem 2.5rem 120px; }
  .mobile-top-bar { display: none !important; }
  .mobile-fab-nav { display: none !important; }
  .desktop-top-bar { display: flex !important; }
  .macos-dock { display: flex !important; }
  /* Hide FAB elements on desktop */
  .fab-toggle, .fab-backdrop, .fab-sheet { display: none !important; }
}
@media (max-width: 991px) {
  .macos-dock { display: none !important; }
  .desktop-top-bar { display: none !important; }
}

/* ─── Page Header ────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  gap: 1rem;
}
.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.page-header p {
  color: var(--text-2);
  margin-top: 2px;
  font-size: 14px;
}

/* ─── Stat Cards ─────────────────────────────────────────── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
  position: relative;
  overflow: hidden;
}
.stat-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.stat-card__label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  margin-bottom: .5rem;
}
.stat-card__value {
  font-family: 'DM Mono', monospace;
  font-size: 1.6rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  color: var(--text-1);
  line-height: 1;
  margin-bottom: .35rem;
}
.stat-card__sub {
  font-size: 12px;
  color: var(--text-2);
}
.stat-card__icon {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

/* Hero balance card */
.balance-hero {
  background: linear-gradient(135deg, #2d5a72 0%, #568ea3 55%, #68c3d4 100%);
  border-radius: var(--radius-xl);
  padding: 2rem;
  color: white;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(86,142,163,.35);
}
.balance-hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
}
.balance-hero::after {
  content: '';
  position: absolute;
  bottom: -80px; left: -40px;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
}
.balance-hero__label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.7);
  margin-bottom: .75rem;
}
.balance-hero__amount {
  font-family: 'DM Mono', monospace;
  font-size: 2.6rem;
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
  color: white;
  margin-bottom: 1.5rem;
}
.balance-hero__chips {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}
.balance-chip {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px;
  padding: .5rem .9rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  backdrop-filter: blur(8px);
}
.balance-chip i { font-size: .85rem; }
.balance-chip__label {
  font-size: 11px;
  color: rgba(255,255,255,.7);
  font-weight: 500;
  display: block;
  line-height: 1;
}
.balance-chip__val {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  color: white;
  display: block;
  letter-spacing: -0.02em;
}

/* ─── Panel / Card ───────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.panel-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
}
.panel-body {
  padding: 1.5rem;
}
.panel-body--flush {
  padding: 0;
}

/* ─── Transaction Row ────────────────────────────────────── */
.tx-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .875rem 1.5rem;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
  cursor: default;
}
.tx-row:last-child { border-bottom: none; }
.tx-row:hover { background: var(--bg); }

.tx-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
  flex-shrink: 0;
}
.tx-info { flex: 1; min-width: 0; }
.tx-desc {
  font-weight: 500;
  font-size: 14px;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tx-meta {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 1px;
}
.tx-amount {
  font-family: 'DM Mono', monospace;
  font-weight: 500;
  font-size: 15px;
  text-align: right;
  flex-shrink: 0;
}
.tx-amount.income { color: var(--success); }
.tx-amount.expense { color: var(--danger); }
.tx-date {
  font-size: 11px;
  color: var(--text-3);
  text-align: right;
  margin-top: 2px;
}

/* date group separator */
.tx-date-group {
  padding: .5rem 1.5rem;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

/* ─── Wallet Cards ───────────────────────────────────────── */
.wallet-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
  position: relative;
  overflow: hidden;
}
.wallet-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.wallet-card__stripe {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--accent);
}
.wallet-card__icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  margin-bottom: .625rem;
}
.wallet-card__name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-1);
  margin-bottom: .2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wallet-card__balance {
  font-family: 'DM Mono', monospace;
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: .625rem;
}
.wallet-card__stats {
  display: flex;
  gap: .5rem;
  padding-top: .625rem;
  border-top: 1px solid var(--border);
}
.wallet-stat { flex: 1; min-width: 0; }
.wallet-stat__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
  font-weight: 600;
}
.wallet-stat__val {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Budget Progress ────────────────────────────────────── */
.budget-row {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.budget-row:last-child { border-bottom: none; }
.budget-row:hover { background: var(--bg); }
.budget-row__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem;
}
.budget-row__name { font-weight: 500; font-size: 14px; }
.budget-row__badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 100px;
  font-weight: 600;
}
.badge-ok     { background: var(--success-light); color: var(--success); }
.badge-warn   { background: var(--warning-light); color: var(--warning); }
.badge-over   { background: var(--danger-light);  color: var(--danger); }

.budget-bar {
  height: 7px;
  background: var(--surface-2);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: .6rem;
}
.budget-bar__fill {
  height: 100%;
  border-radius: 100px;
  transition: width .5s ease;
  background: var(--accent);
}
.budget-bar__fill.warn { background: var(--warning); }
.budget-bar__fill.over { background: var(--danger); }
.budget-row__numbers {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-2);
}
.budget-row__numbers .mono { font-size: 12px; font-weight: 500; color: var(--text-1); }

/* ─── Category Tag ───────────────────────────────────────── */
.cat-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
}

/* ─── Buttons ─────────────────────────────────────────────── */
.btn {
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all .15s;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}
.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(13,148,136,.25);
}
.btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: white;
  box-shadow: 0 4px 14px rgba(13,148,136,.35);
  transform: translateY(-1px);
}
.btn-outline-primary {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}
.btn-outline-primary:hover {
  background: var(--accent-light);
  color: var(--accent-dark);
}
.btn-outline-secondary {
  background: transparent;
  color: var(--text-2);
  border-color: var(--border-strong);
}
.btn-outline-secondary:hover {
  background: var(--surface-2);
  color: var(--text-1);
}
.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text-1);
}
.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}
.btn-danger:hover { background: #b91c1c; color: white; }
.btn-success {
  background: var(--success);
  color: white;
  border-color: var(--success);
}
.btn-success:hover { background: #15803d; color: white; }

/* ─── Form Elements ──────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: .4rem;
  letter-spacing: .01em;
}
.form-control, .form-select {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text-1);
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: .65rem .9rem;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13,148,136,.12);
  outline: none;
  background: var(--surface);
}
.form-control::placeholder { color: var(--text-3); }
.form-text { font-size: 12px; color: var(--text-3); margin-top: .3rem; }

.input-group {
  display: flex;
  align-items: stretch;
}
.input-group-text {
  background: var(--surface-2);
  border: 1.5px solid var(--border-strong);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  padding: .65rem .9rem;
  font-size: 14px;
  color: var(--text-2);
  font-weight: 500;
  display: flex;
  align-items: center;
}
.input-group .form-control {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Type selector (income/expense toggle) */
.type-selector { display: flex; gap: .75rem; }
.type-option { flex: 1; }
.type-option input[type=radio] { display: none; }
.type-option label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .75rem;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all .15s;
  color: var(--text-2);
}
.type-option input:checked + label.income-lbl {
  border-color: var(--success);
  background: var(--success-light);
  color: var(--success);
}
.type-option input:checked + label.expense-lbl {
  border-color: var(--danger);
  background: var(--danger-light);
  color: var(--danger);
}
.type-option label:hover { border-color: var(--accent); }

/* ─── Table ──────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  background: var(--bg);
}
.data-table td {
  padding: .875rem 1rem;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg); }

/* ─── Badge ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
}
.badge-primary { background: var(--accent-light); color: var(--accent-dark); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-neutral { background: var(--surface-2); color: var(--text-2); }

/* ─── Empty State ────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-2);
}
.empty-state__icon {
  width: 64px; height: 64px;
  background: var(--surface-2);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--text-3);
  margin: 0 auto 1rem;
}
.empty-state h5 { font-size: 16px; font-weight: 600; margin-bottom: .5rem; }
.empty-state p { font-size: 14px; color: var(--text-3); margin-bottom: 1.25rem; }

/* ─── Auth Pages ─────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f0fdf9 0%, #f7f7f5 60%, #ecfdf5 100%);
  padding: 2rem;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
}
.auth-brand {
  text-align: center;
  margin-bottom: 2rem;
}
.auth-brand__logo {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: white;
  margin: 0 auto 1rem;
  box-shadow: 0 6px 20px rgba(13,148,136,.3);
}
.auth-brand h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-1);
  margin-bottom: .25rem;
}
.auth-brand p { font-size: 14px; color: var(--text-2); }

/* ─── Alert Flashes ──────────────────────────────────────── */
.flash-message {
  border-radius: var(--radius-sm);
  padding: .875rem 1.25rem;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
  border: 1px solid;
}
.flash-success { background: var(--success-light); color: var(--success); border-color: #86efac; }
.flash-danger  { background: var(--danger-light);  color: var(--danger);  border-color: #fca5a5; }
.flash-warning { background: var(--warning-light); color: var(--warning); border-color: #fcd34d; }
.flash-info    { background: var(--info-light);    color: var(--info);    border-color: #93c5fd; }

/* ─── Quick Actions Sidebar row ─────────────────────────── */
.quick-action-btn {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-1);
  text-decoration: none;
  transition: all .15s;
  border: 1px solid transparent;
}
.quick-action-btn:hover {
  background: var(--accent-light);
  color: var(--accent-dark);
  border-color: var(--accent-light);
}
.quick-action-btn i {
  width: 32px; height: 32px;
  background: var(--surface-2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  flex-shrink: 0;
}

/* ─── Section Divider ────────────────────────────────────── */
.section-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── FAB ────────────────────────────────────────────────── */
.fab {
  position: fixed;
  bottom: 88px;
  right: 1.25rem;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  box-shadow: 0 4px 20px rgba(13,148,136,.4);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .2s;
  z-index: 250;
}
.fab:hover { background: var(--accent-dark); transform: scale(1.08); }

/* ─── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ─── Utilities ──────────────────────────────────────────── */
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger)  !important; }
.text-accent  { color: var(--accent)  !important; }
.text-warning { color: var(--warning) !important; }
.text-info    { color: var(--info)    !important; }
.bg-success-light { background: var(--success-light) !important; }
.bg-danger-light  { background: var(--danger-light)  !important; }
.bg-accent-light  { background: var(--accent-light)  !important; }
.bg-surface-2     { background: var(--surface-2)     !important; }

.rounded-xl { border-radius: var(--radius-xl) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.gap-sm { gap: .5rem; }
.gap-md { gap: 1rem; }

/* ─── Analytics charts ───────────────────────────────────── */
.chart-wrapper {
  position: relative;
  width: 100%;
}

/* Category pill in list */
.category-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .875rem 1.5rem;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.category-row:last-child { border-bottom: none; }
.category-row:hover { background: var(--bg); }
.category-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.category-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  flex-shrink: 0;
}

/* Member cards */
.member-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  text-align: center;
  transition: box-shadow .2s, transform .2s;
}
.member-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.member-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin: 0 auto 1rem;
}

/* ─── Transfer arrow ─────────────────────────────────────── */
.transfer-arrow {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 13px;
}
.transfer-arrow .from { color: var(--text-2); }
.transfer-arrow .arrow { color: var(--accent); font-size: .85rem; }
.transfer-arrow .to { color: var(--text-1); font-weight: 600; }

/* ─── Spending bar (dashboard) ───────────────────────────── */
.spend-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .75rem;
}
.spend-row:last-child { margin-bottom: 0; }
.spend-row__dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.spend-row__name {
  font-size: 13px;
  color: var(--text-2);
  flex: 1;
}
.spend-row__bar {
  flex: 2;
  height: 5px;
  background: var(--surface-2);
  border-radius: 100px;
  overflow: hidden;
}
.spend-row__bar-fill {
  height: 100%;
  border-radius: 100px;
  transition: width .6s ease;
}
.spend-row__amount {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  min-width: 100px;
  text-align: right;
}

/* ─── Report specific ────────────────────────────────────── */
.report-kpi {
  text-align: center;
  padding: 1.5rem;
  border-right: 1px solid var(--border);
}
.report-kpi:last-child { border-right: none; }
.report-kpi__val {
  font-family: 'DM Mono', monospace;
  font-size: 1.6rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: .25rem;
}
.report-kpi__label { font-size: 12px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.report-kpi__sub { font-size: 12px; color: var(--text-3); margin-top: .25rem; }

/* ─── Responsive tweaks ──────────────────────────────────── */
@media (max-width: 576px) {
  .balance-hero__amount { font-size: 2rem; }
  .stat-card__value { font-size: 1.35rem; }
  .page-header h1 { font-size: 1.25rem; }
  .panel-header, .panel-body { padding: 1rem; }
  .tx-row { padding: .75rem 1rem; }
  .budget-row { padding: 1rem; }
}

/* ─── Privacy Mode ───────────────────────────────────────── */
body.privacy-mode .blur-amount {
  filter: blur(7px);
  user-select: none;
  transition: filter .2s;
}
body.privacy-mode .blur-amount:hover { filter: blur(0); }
.privacy-toggle {
  background: none;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  color: var(--text-2);
  cursor: pointer;
  font-size: 13px;
  display: flex; align-items: center; gap: 6px;
  transition: all .15s;
}
.privacy-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Smart Alert Banner ─────────────────────────────────── */
.smart-alert {
  display: flex; align-items: center; gap: .875rem;
  padding: .875rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  animation: slideDown .3s ease;
}
.smart-alert--danger  { background: var(--danger-light); border: 1px solid rgba(215,0,0,.25); }
.smart-alert--warning { background: var(--warning-light); border: 1px solid rgba(196,124,26,.25); }
.smart-alert--success { background: var(--success-light); border: 1px solid rgba(45,134,83,.25); }
.smart-alert__icon { font-size: 1.1rem; flex-shrink: 0; }
.smart-alert__text { flex: 1; font-size: 14px; font-weight: 500; }
.smart-alert__close { background: none; border: none; cursor: pointer; color: var(--text-3); font-size: 16px; padding: 0 4px; }
@keyframes slideDown { from { opacity:0; transform: translateY(-8px); } to { opacity:1; transform:none; } }

/* ─── Anomaly badge ──────────────────────────────────────── */
.anomaly-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 100px;
  background: var(--warning-light); color: var(--warning);
  border: 1px solid rgba(196,124,26,.3);
  text-transform: uppercase; letter-spacing: .04em;
  vertical-align: middle; margin-left: 4px;
}

/* ─── MoM comparison card ───────────────────────────────── */
.mom-card {
  display: flex; flex-direction: column; gap: .5rem;
}
.mom-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: .625rem .875rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.mom-row__label { font-size: 13px; color: var(--text-2); }
.mom-row__values { display: flex; align-items: center; gap: .75rem; }
.mom-row__current { font-weight: 600; font-size: 13px; font-family:'DM Mono',monospace; }
.mom-row__change { font-size: 12px; font-weight: 600; }
.mom-row__change.up   { color: var(--success); }
.mom-row__change.down { color: var(--danger); }
.mom-row__change.flat { color: var(--text-3); }

/* ─── Quick-add slide-up sheet ──────────────────────────── */
.quick-add-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,30,40,.5);
  backdrop-filter: blur(4px);
  z-index: 600; opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.quick-add-backdrop.open { opacity: 1; pointer-events: all; }
.quick-add-sheet {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  padding: 1.5rem 1.5rem env(safe-area-inset-bottom,1.5rem);
  z-index: 605;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.32,.72,0,1);
  box-shadow: 0 -12px 40px rgba(86,142,163,.18);
  max-width: 520px; margin: 0 auto;
}
.quick-add-sheet.open { transform: translateY(0); }
.quick-add-handle {
  width: 40px; height: 5px;
  background: var(--border-strong); border-radius: 100px;
  margin: 0 auto 1.25rem;
}
.quick-add-fab {
  position: fixed; bottom: 88px; right: 24px;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--accent-2);
  color: white; border: none; cursor: pointer;
  font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(104,195,212,.45);
  z-index: 499;
  transition: transform .2s, box-shadow .2s;
}
.quick-add-fab:hover { transform: scale(1.08); box-shadow: 0 6px 20px rgba(104,195,212,.55); }
@media (min-width: 992px) { .quick-add-fab { bottom: 100px; right: 32px; } }

/* ─── Dark mode toggle button ───────────────────────────── */
.dark-toggle {
  background: none; border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 5px 10px;
  color: var(--text-2); cursor: pointer; font-size: 13px;
  display: flex; align-items: center; gap: 6px;
  transition: all .15s;
}
.dark-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Filter persistence indicator ─────────────────────── */
.filter-active-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-2); display: inline-block;
  margin-left: 5px; vertical-align: middle;
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; } 50% { opacity: .4; }
}

/* ─── CSV Export button ──────────────────────────────────── */
.btn-export {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .45rem 1rem; font-size: 13px; font-weight: 500;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-2);
  cursor: pointer; transition: all .15s;
  text-decoration: none;
}
.btn-export:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
