/* =======================================================================
   FinVault Pro — Dribbble Finance Dashboard Match
   Shot: https://dribbble.com/shots/27746339-Finance-Dashboard-Design
   Palette: Lavender-blue canvas · Violet/Indigo accents · Crisp white cards
   Fonts: Sora (headings) + Inter (body)
======================================================================= */

/* ---- Google Fonts (fallback if link fails) -------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=DM+Sans:wght@400;500;600;700;800&display=swap');

/* ---- Design Tokens -------------------------------------------------- */
:root {
  /* Canvas & Surfaces */
  --bg-canvas:          #eef0fb;          /* lavender-blue tinted bg */
  --bg-sidebar:         #1e2d4e;          /* medium navy — readable, not pitch-black */
  --bg-surface:         #ffffff;          /* pure white cards */
  --bg-surface-alt:     #f4f6ff;          /* soft lavender alt */
  --bg-glass:           rgba(255,255,255,0.82);

  /* Borders */
  --border-subtle:      #e4e6f5;
  --border-strong:      #cdd0e8;

  /* Text */
  --text-primary:       #12142b;          /* near-black with blue tint */
  --text-secondary:     #5c5f80;
  --text-muted:         #9497b8;

  /* Accent — Violet / Indigo (primary brand) */
  --accent-primary:         #6c5dd3;
  --accent-primary-soft:    rgba(108,93,211,0.10);
  --accent-primary-hover:   #5a4ab8;

  /* Accent — Emerald / Green (positive/growth) */
  --accent-emerald:         #00b97a;
  --accent-emerald-soft:    rgba(0,185,122,0.10);

  /* Accent — Amber / Gold (warning/loan) */
  --accent-amber:           #f4a22d;
  --accent-amber-soft:      rgba(244,162,45,0.12);

  /* Accent — Rose / Red (negative/danger) */
  --accent-rose:            #f0456a;
  --accent-rose-soft:       rgba(240,69,106,0.10);

  /* Accent — Cyan / Blue (info) */
  --accent-cyan:            #3dc8f0;
  --accent-cyan-soft:       rgba(61,200,240,0.10);

  /* Accent — Purple (secondary metric) */
  --accent-purple:          #9b5de5;
  --accent-purple-soft:     rgba(155,93,229,0.10);

  /* Shadows */
  --shadow-bento:   0 2px 16px -2px rgba(90,80,200,0.07), 0 1px 4px rgba(90,80,200,0.04);
  --shadow-hover:   0 12px 36px -6px rgba(90,80,200,0.18);
  --shadow-card:    0 4px 24px -4px rgba(18,20,43,0.08);

  /* Radii */
  --radius-xl:  22px;
  --radius-lg:  16px;
  --radius-md:  12px;
  --radius-sm:  8px;

  /* Safe area */
  --safe-top:    env(safe-area-inset-top,    0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---- Dark Theme ----------------------------------------------------- */
html.dark {
  --bg-canvas:          #0d0f1c;
  --bg-sidebar:         #080a15;
  --bg-surface:         #141727;
  --bg-surface-alt:     #1c2035;
  --bg-glass:           rgba(20,23,39,0.88);
  --border-subtle:      rgba(255,255,255,0.07);
  --border-strong:      rgba(255,255,255,0.13);
  --text-primary:       #eef0ff;
  --text-secondary:     #8386aa;
  --text-muted:         #565878;
  --shadow-bento:       0 8px 28px -4px rgba(0,0,0,0.5);
  --shadow-hover:       0 16px 40px -6px rgba(0,0,0,0.7);
  --shadow-card:        0 6px 30px -4px rgba(0,0,0,0.55);
}

/* ---- Reset ---------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

/* ---- Base Typography ------------------------------------------------ */
body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-canvas);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  padding-top: var(--safe-top);
  padding-bottom: calc(84px + var(--safe-bottom));
  transition: background 0.25s ease, color 0.25s ease;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Plus Jakarta Sans', 'DM Sans', sans-serif;
  letter-spacing: -0.4px;
  line-height: 1.25;
}

/* ---- App Shell ------------------------------------------------------ */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ================================================================
   SIDEBAR — Floating dark pill with violet active state
================================================================ */
.sidebar {
  width: 256px;
  background: linear-gradient(175deg, #243660 0%, #1e2d4e 60%, #1a2545 100%);
  color: #e8ecf8;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 14px;
  bottom: 14px;
  left: 14px;
  border-radius: 20px;
  z-index: 40;
  padding: 20px 12px;
  box-shadow: 0 20px 48px rgba(10,18,45,0.28), inset 0 0 0 1px rgba(255,255,255,0.08);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
}

.brand-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 10px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  margin-bottom: 12px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #6c5dd3, #9b5de5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 16px;
  color: #fff;
  box-shadow: 0 6px 18px rgba(108,93,211,0.45);
  flex-shrink: 0;
}

.brand-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: #e8ecf8;
}

.brand-sub {
  font-size: 10.5px;
  font-weight: 500;
  color: #7a8fb5;
  display: block;
  letter-spacing: 0.2px;
}

/* Nav list */
.nav-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  overflow-y: auto;
  scrollbar-width: none;
}
.nav-list::-webkit-scrollbar { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  border-radius: 13px;
  color: #8fa5cc;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: all 0.17s ease;
  letter-spacing: 0;
}

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: #dce6f5;
}

.nav-item.active {
  background: linear-gradient(110deg, #6c5dd3, #9058e8);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(108,93,211,0.38);
}

.nav-icon {
  font-size: 15px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  color: #b0c4e8;
  letter-spacing: 0;
}

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

/* Sidebar footer / tenant */
.tenant-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.10);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tenant-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  overflow: hidden;
}

.tenant-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #9b5de5, #6c5dd3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Sora', sans-serif;
  font-weight: 800;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(108,93,211,0.35);
}

/* ================================================================
   MAIN AREA
================================================================ */
.main-area {
  flex: 1;
  margin-left: 284px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ---- Top Header ---------------------------------------------------- */
.top-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.page-title-wrap h1 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.page-title-wrap p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

/* ================================================================
   SEGMENTED TOGGLE (All | Self | Others)
================================================================ */
.seg-toggle {
  display: inline-flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 3px;
  border-radius: 999px;
  gap: 2px;
  box-shadow: var(--shadow-bento);
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.17s ease;
  font-family: 'DM Sans', sans-serif;
}

.seg-btn.active {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 2px 10px rgba(108,93,211,0.32);
}

/* ================================================================
   NOTIFICATION BELL
================================================================ */
.notif-btn {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 17px;
  box-shadow: var(--shadow-bento);
  transition: all 0.2s;
}

.notif-btn:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 4px 16px rgba(108,93,211,0.18);
  transform: translateY(-1px);
}

.notif-count {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--accent-rose);
  color: #fff;
  font-size: 9.5px;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 0 10px rgba(240,69,106,0.55);
  border: 2px solid var(--bg-canvas);
}

.notif-popover {
  position: fixed;
  top: 72px;
  right: 24px;
  width: 400px;
  max-width: calc(100vw - 24px);
  max-height: 78vh;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-hover);
  z-index: 100;
  padding: 18px;
  display: none;
  scrollbar-width: thin;
}

.notif-popover.open { display: block; }

.notif-item {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--accent-amber);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 10px;
  font-size: 13px;
}

/* ================================================================
   CONTENT AREA
================================================================ */
.content-wrap {
  padding: 24px 28px;
  max-width: 1520px;
  width: 100%;
  margin: 0 auto;
}

/* ================================================================
   GRID LAYOUTS (Bento Style)
================================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.bento-grid-3 {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

/* ================================================================
   CARDS — The core Bento UI element
================================================================ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 22px;
  box-shadow: var(--shadow-card);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.card.clickable-card {
  cursor: pointer;
}

.card.clickable-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(108,93,211,0.35);
}

.card.clickable-card.active {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-primary), 0 12px 32px -4px rgba(108,93,211,0.25);
  background: linear-gradient(165deg, var(--bg-surface) 0%, var(--bg-surface-alt) 100%);
}

.entity-card-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.entity-amount-banner {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

/* Dark hero card for net-worth / big stats */
.card-hero-dark {
  background: linear-gradient(135deg, #1a1d2e 0%, #242845 100%);
  color: #eef0ff;
  border: none;
  box-shadow: 0 12px 36px rgba(10,12,28,0.4);
}

.card-hero-dark .kpi-label,
.card-hero-dark .kpi-sub {
  color: #7779a8;
}

/* Violet accent card */
.card-violet {
  background: linear-gradient(135deg, #6c5dd3 0%, #9058e8 100%);
  color: #fff;
  border: none;
  box-shadow: 0 12px 36px rgba(108,93,211,0.35);
}

.card-violet .kpi-label,
.card-violet .kpi-sub {
  color: rgba(255,255,255,0.65);
}

/* ================================================================
   KPI TYPOGRAPHY INSIDE CARDS
================================================================ */
.kpi-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.kpi-value {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 26px;
  font-weight: 800;
  margin: 10px 0 6px;
  letter-spacing: -0.8px;
  line-height: 1.1;
}

.kpi-value.large {
  font-size: 32px;
  letter-spacing: -1px;
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-weight: 500;
}

/* ================================================================
   SECTION HEADERS
================================================================ */
.section-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.section-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 16px;
}

/* ================================================================
   CREDIT CARD VISUAL
================================================================ */
.cc-visual {
  background: linear-gradient(135deg, #1a1d2e 0%, #242760 50%, #3a2e8c 100%);
  color: #fff;
  border-radius: 18px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 16px 36px rgba(26,29,46,0.3);
}

.cc-visual.violet {
  background: linear-gradient(135deg, #3d2fa0 0%, #6c5dd3 55%, #9058e8 100%);
}

.cc-visual.emerald {
  background: linear-gradient(135deg, #064e3b 0%, #00836e 55%, #007b8a 100%);
}

.cc-visual.rose {
  background: linear-gradient(135deg, #5b0d2a 0%, #a0184e 55%, #7c1d80 100%);
}

.cc-visual.amber {
  background: linear-gradient(135deg, #78350f 0%, #d97706 55%, #ea580c 100%);
}

.cc-visual::after {
  content: '';
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  top: -70px;
  right: -60px;
  pointer-events: none;
}

.cc-visual::before {
  content: '';
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  bottom: -50px;
  left: -30px;
  pointer-events: none;
}

.cc-number {
  font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 15.5px;
  letter-spacing: 3px;
  margin: 16px 0 12px;
  color: rgba(255,255,255,0.95);
  font-weight: 600;
}

/* ================================================================
   BADGES
================================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.1px;
}

.badge-indigo  { background: var(--accent-primary-soft); color: var(--accent-primary); }
.badge-emerald { background: var(--accent-emerald-soft); color: #007a52; }
.badge-amber   { background: var(--accent-amber-soft);   color: #b85e00; }
.badge-rose    { background: var(--accent-rose-soft);    color: #c42050; }
.badge-cyan    { background: var(--accent-cyan-soft);    color: #0288a7; }
.badge-purple  { background: var(--accent-purple-soft);  color: var(--accent-purple); }

html.dark .badge-indigo  { color: #a89fff; background: rgba(108,93,211,0.18); }
html.dark .badge-emerald { color: #4de0a4; background: rgba(0,185,122,0.15); }
html.dark .badge-amber   { color: #fbbf24; background: rgba(244,162,45,0.15); }
html.dark .badge-rose    { color: #fb7185; background: rgba(240,69,106,0.15); }
html.dark .badge-cyan    { color: #67e8f9; background: rgba(61,200,240,0.15); }
html.dark .badge-purple  { color: #d8b4fe; background: rgba(155,93,229,0.15); }

/* ================================================================
   PROGRESS BARS
================================================================ */
.progress-track {
  width: 100%;
  height: 7px;
  background: var(--border-subtle);
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.4,0,0.2,1);
}

/* ================================================================
   BUTTONS
================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 11px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  transition: all 0.17s ease;
  color: var(--text-primary);
  background: var(--bg-surface);
  letter-spacing: 0.1px;
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-surface-alt);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.btn:active { transform: translateY(0); }

/* Primary — violet */
.btn-primary {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
  box-shadow: 0 4px 14px rgba(108,93,211,0.32);
}

.btn-primary:hover {
  background: var(--accent-primary-hover);
  border-color: var(--accent-primary-hover);
  color: #fff;
}

/* Dark */
.btn-dark {
  background: #12142b;
  color: #eef0ff;
  border-color: #12142b;
  box-shadow: 0 4px 14px rgba(10,12,28,0.2);
}

html.dark .btn-dark {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.btn-dark:hover {
  background: #1e2142;
  color: #fff;
}

/* Emerald */
.btn-emerald {
  background: var(--accent-emerald);
  color: #fff;
  border-color: var(--accent-emerald);
  box-shadow: 0 4px 14px rgba(0,185,122,0.28);
}
.btn-emerald:hover { background: #009962; color: #fff; }

/* Amber */
.btn-amber {
  background: var(--accent-amber-soft);
  color: #b85e00;
  border-color: rgba(244,162,45,0.28);
}
html.dark .btn-amber { color: #fbbf24; }

/* Rose */
.btn-rose {
  background: var(--accent-rose-soft);
  color: #c42050;
  border-color: rgba(240,69,106,0.25);
}
html.dark .btn-rose { color: #fb7185; }

/* Small */
.btn-sm {
  padding: 5px 10px;
  font-size: 11px;
  border-radius: 9px;
}

/* ================================================================
   TABLE
================================================================ */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
}

th {
  background: var(--bg-surface-alt);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  color: var(--text-primary);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-surface-alt); }

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-family: 'Sora', sans-serif;
}

/* ================================================================
   FORM ELEMENTS
================================================================ */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-family: 'DM Sans', sans-serif;
}

input, select, textarea {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(108,93,211,0.12);
  background: var(--bg-surface);
}

/* ================================================================
   MODAL
================================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10,12,28,0.60);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

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

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  width: 100%;
  max-width: 840px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 26px;
  box-shadow: 0 30px 70px rgba(10,12,28,0.45);
  scrollbar-width: thin;
}

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

.modal-header h3 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.4px;
}

.modal-table-scroll {
  max-height: 420px;
  overflow-y: auto;
  scrollbar-width: thin;
}

/* ================================================================
   LOCK SCREEN — PIN Entry
================================================================ */
.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: radial-gradient(ellipse at 60% 10%, rgba(108,93,211,0.35), transparent 55%),
              radial-gradient(ellipse at 20% 90%, rgba(0,185,122,0.12), transparent 50%),
              #0d0f1c;
  color: #eef0ff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lock-screen.hidden { display: none; }

.pin-dots {
  display: flex;
  gap: 14px;
  margin: 22px 0;
}

.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(108,93,211,0.4);
  transition: all 0.18s ease;
}

.pin-dot.filled {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  box-shadow: 0 0 14px rgba(108,93,211,0.65);
  transform: scale(1.12);
}

.numpad {
  display: grid;
  grid-template-columns: repeat(3, 70px);
  gap: 13px;
}

.num-key {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #eef0ff;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.num-key:hover {
  background: rgba(108,93,211,0.28);
  border-color: rgba(108,93,211,0.5);
  transform: scale(1.06);
}

.num-key:active {
  transform: scale(0.95);
}

/* ================================================================
   TABS
================================================================ */
.tabs-bar {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.tab-pill {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  transition: all 0.17s ease;
}

.tab-pill:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.tab-pill.active {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
  box-shadow: 0 3px 12px rgba(108,93,211,0.3);
}

html.dark .tab-pill.active {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}

/* ================================================================
   MOBILE BOTTOM NAV
================================================================ */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding: 6px 8px calc(8px + var(--safe-bottom));
  z-index: 50;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -4px 20px rgba(108,93,211,0.06);
}

.mob-nav-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 9.5px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  padding: 5px 7px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.17s;
}

.mob-nav-btn .icon {
  font-size: 18px;
  line-height: 1;
}

.mob-nav-btn.active {
  color: var(--accent-primary);
}

.mob-nav-btn.active .icon {
  filter: drop-shadow(0 2px 6px rgba(108,93,211,0.4));
}

/* ================================================================
   UTILITY HELPERS
================================================================ */
.text-emerald  { color: var(--accent-emerald) !important; }
.text-rose     { color: var(--accent-rose) !important; }
.text-amber    { color: var(--accent-amber) !important; }
.text-violet   { color: var(--accent-primary) !important; }
.text-muted    { color: var(--text-muted) !important; }
.text-secondary{ color: var(--text-secondary) !important; }

.fw-800 { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; }
.fw-700 { font-weight: 700; }

.divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 16px 0;
}

/* Chart placeholder bar (mini spark bars) */
.spark-bar-wrap {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 40px;
}
.spark-bar {
  flex: 1;
  border-radius: 4px 4px 0 0;
  background: var(--accent-primary-soft);
  transition: height 0.4s ease;
  min-height: 6px;
}
.spark-bar.active-bar {
  background: var(--accent-primary);
}

/* Status dot */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.dot-green  { background: var(--accent-emerald); box-shadow: 0 0 6px rgba(0,185,122,0.5); }
.dot-amber  { background: var(--accent-amber);   box-shadow: 0 0 6px rgba(244,162,45,0.5); }
.dot-red    { background: var(--accent-rose);    box-shadow: 0 0 6px rgba(240,69,106,0.5); }
.dot-violet { background: var(--accent-primary); box-shadow: 0 0 6px rgba(108,93,211,0.5); }
.dot-gray   { background: var(--text-muted); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ================================================================
   RESPONSIVE BREAKPOINTS
================================================================ */
@media (max-width: 1200px) {
  .bento-grid-3 {
    grid-template-columns: 1.2fr 1fr;
  }
}

@media (max-width: 1100px) {
  .bento-grid-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .sidebar {
    top: 0;
    bottom: 0;
    left: 0;
    border-radius: 0;
    transform: translateX(-108%);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .main-area {
    margin-left: 0;
  }
  .mobile-bottom-nav {
    display: flex;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .top-header {
    padding: 11px 16px;
  }
  .content-wrap {
    padding: 14px 14px;
  }
  .kpi-value { font-size: 22px; }
  .kpi-value.large { font-size: 26px; }
}

@media (max-width: 600px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .grid-3 {
    grid-template-columns: 1fr;
  }
  .modal-card {
    padding: 18px;
  }
  .card {
    padding: 16px;
  }
}

/* ================================================================
   VAULT MINIMAL EDITORIAL DESIGN (MATCHING REFERENCE SPEC)
================================================================ */
.vault-hero-card {
  background: #08101e;
  border-radius: 24px;
  padding: 32px 40px;
  margin-bottom: 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.vault-hero-title {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #7f8ea3;
  font-weight: 600;
  margin-bottom: 20px;
}

.vault-hero-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.vault-hero-num {
  font-family: var(--font-family);
  font-size: 26px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.vault-hero-lbl {
  font-size: 12.5px;
  color: #8191a6;
  margin-top: 6px;
  font-weight: 500;
}

.vault-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.vault-bento-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 22px 24px;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 140px;
}

.vault-bento-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px -4px rgba(15, 23, 42, 0.08);
  border-color: rgba(108, 93, 211, 0.3);
}

.vault-bento-card.active {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-primary), 0 14px 32px -4px rgba(108, 93, 211, 0.20);
}

.vault-card-title {
  font-family: var(--font-family);
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.3px;
}

.vault-card-badge {
  background: rgba(100, 116, 139, 0.12);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
}

.vault-card-amount {
  font-family: var(--font-family);
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  margin: 12px 0 6px 0;
}

.vault-card-desc {
  font-size: 12.5px;
  color: #94a3b8;
}

@media (max-width: 960px) {
  .vault-hero-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }
  .vault-cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

@media (max-width: 600px) {
  .vault-hero-card {
    padding: 22px 20px;
  }
  .vault-hero-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .vault-cards-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}
