/* =====================================================================
   FinPal Dashboard — Design System
   "Stack & Pulse" layout · Dark Luxury / Light Premium
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. Tokens
   --------------------------------------------------------------------- */
.dashboard-app {
  --r-sm: 14px;
  --r-md: 20px;
  --r-lg: 26px;
  --r-xl: 32px;
  --r-pill: 999px;
  --ease: cubic-bezier(.2,.8,.2,1);
  --ease-bounce: cubic-bezier(.34,1.56,.64,1);
  --app-shell-width: 480px;
}

/* ---------------------------------------------------------------------
   Shared slide menu
   --------------------------------------------------------------------- */
.shell-menu {
  position: fixed;
  inset: 0 auto 0 0;
  width: min(86vw, 320px);
  z-index: 1001;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border-right: 1px solid var(--shell-menu-border, var(--border));
  background: var(--shell-menu-bg, var(--surface));
  box-shadow: var(--shell-menu-shadow, var(--shadow-pop));
  transform: translateX(calc(-100% - 16px));
  transition: transform .26s var(--ease);
  will-change: transform;
  color: var(--shell-menu-text, var(--text));
}

.shell-menu.active {
  transform: translateX(0);
}

.shell-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(0,0,0,0);
  opacity: 0;
  visibility: hidden;
  cursor: pointer;
  transition: opacity .22s var(--ease), visibility .22s var(--ease), background .22s var(--ease);
}

.shell-menu-overlay.active {
  visibility: visible;
  opacity: 1;
  background: var(--shell-menu-overlay, rgba(0,0,0,.36));
}

.shell-menu-head {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--shell-menu-divider, var(--border));
  background: var(--shell-menu-head-bg, transparent);
}

.shell-menu-user {
  display: flex;
  align-items: center;
  gap: 13px;
}

.shell-menu-user img,
.shell-menu-avatar {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  border-radius: 19px;
  object-fit: cover;
  border: 1px solid var(--border-strong);
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
}

.shell-menu-avatar {
  display: grid;
  place-items: center;
  color: #111827;
  font-weight: 900;
  font-size: 19px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}

.shell-menu-user-info {
  min-width: 0;
}

.shell-menu-user-info strong {
  display: block;
  color: var(--shell-menu-text, var(--text));
  font-size: 15px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell-menu-user-info span {
  display: block;
  margin-top: 3px;
  color: var(--shell-menu-muted, var(--text-muted));
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell-menu-body {
  overflow-y: auto;
  padding: 14px 12px;
}

.shell-menu-section + .shell-menu-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--shell-menu-divider, var(--border));
}

.shell-menu-label {
  display: block;
  padding: 0 10px 8px;
  color: var(--shell-menu-label, var(--text-dim));
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.shell-menu-item,
.shell-menu-logout {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 0 12px;
  border-radius: 16px;
  color: var(--shell-menu-muted, var(--text-muted));
  text-decoration: none;
  font-size: 14px;
  font-weight: 750;
  transition: background .18s var(--ease), color .18s var(--ease), transform .16s var(--ease);
}

.shell-menu-item:hover,
.shell-menu-logout:hover {
  color: var(--shell-menu-text, var(--text));
  background: var(--shell-menu-hover, var(--surface-2));
  transform: translateX(2px);
}

.shell-menu-item.active {
  color: var(--shell-menu-active-text, var(--text));
  background: var(--shell-menu-active-bg, linear-gradient(135deg, var(--primary-soft), var(--accent-soft)));
  box-shadow: inset 0 0 0 1px var(--shell-menu-active-border, var(--border));
}

.shell-menu-item i,
.shell-menu-logout i {
  width: 24px;
  color: var(--primary);
  text-align: center;
}

.shell-menu-foot {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 12px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--shell-menu-divider, var(--border));
}

.shell-menu-logout {
  color: var(--danger);
  background: var(--danger-soft);
}

.shell-menu-logout i {
  color: var(--danger);
}

.shell-menu-theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 0 12px;
}
.shell-menu-theme-label {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--shell-menu-muted, var(--text-muted));
  font-size: 14px;
  font-weight: 750;
}
.shell-menu-theme-label i {
  width: 24px;
  color: var(--primary);
  text-align: center;
}
.shell-menu-theme-control {
  display: flex;
  align-items: center;
  gap: 10px;
}
.shell-menu-theme-state {
  font-size: 12px;
  font-weight: 700;
  color: var(--shell-menu-muted, var(--text-muted));
  min-width: 26px;
  text-align: right;
}

/* iOS-style switch */
.app-switch {
  position: relative;
  box-sizing: border-box;
  width: 46px;
  height: 28px;
  flex: 0 0 auto;
  border: none;
  border-radius: 999px;
  background: rgba(255,255,255,.16);
  box-shadow: inset 0 0 0 1px var(--border, rgba(255,255,255,.14));
  cursor: pointer;
  padding: 0;
  margin: 0;
  line-height: 0;
  appearance: none;
  -webkit-appearance: none;
  transition: background .22s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.app-switch.on {
  background: linear-gradient(135deg, var(--primary-strong, #8B5CF6), var(--primary, #A78BFA));
}
.app-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.35);
  transition: transform .22s var(--ease);
}
.app-switch.on .app-switch-thumb {
  transform: translateX(18px);
}

[data-theme="dark"] {
  --bg: #08090E;
  --bg-2: #0C0E16;
  --surface: #13151D;
  --surface-2: #1B1E29;
  --surface-3: #242837;
  --border: rgba(255,255,255,.06);
  --border-strong: rgba(255,255,255,.12);

  --text: #F4F4F5;
  --text-muted: #9CA3AF;
  --text-dim: #6B7280;

  --primary: #A78BFA;
  --primary-strong: #8B5CF6;
  --primary-soft: rgba(167,139,250,.14);
  --accent: #FBBF24;
  --accent-soft: rgba(251,191,36,.14);
  --success: #34D399;
  --success-soft: rgba(52,211,153,.12);
  --danger: #FB7185;
  --danger-soft: rgba(251,113,133,.12);
  --info: #60A5FA;
  --info-soft: rgba(96,165,250,.12);

  --shadow-card: 0 1px 0 rgba(255,255,255,.04) inset, 0 12px 32px rgba(0,0,0,.35);
  --shadow-pop: 0 24px 48px -12px rgba(0,0,0,.55), 0 8px 16px rgba(0,0,0,.25);

  --glass-bg: rgba(15,17,24,.72);
  --glass-border: rgba(255,255,255,.08);
  --noise: .04;

  --shell-menu-bg:
    radial-gradient(circle at 16% 0%, rgba(167,139,250,.20), transparent 34%),
    linear-gradient(180deg, rgba(19,21,29,.98), rgba(12,14,22,.98));
  --shell-menu-head-bg: linear-gradient(135deg, rgba(167,139,250,.10), rgba(251,191,36,.06));
  --shell-menu-overlay: rgba(0,0,0,.38);
  --shell-menu-border: rgba(255,255,255,.10);
  --shell-menu-divider: rgba(255,255,255,.08);
  --shell-menu-text: #F8FAFC;
  --shell-menu-muted: #CBD5E1;
  --shell-menu-label: #94A3B8;
  --shell-menu-hover: rgba(255,255,255,.07);
  --shell-menu-active-bg: linear-gradient(135deg, rgba(167,139,250,.24), rgba(251,191,36,.12));
  --shell-menu-active-border: rgba(167,139,250,.32);
  --shell-menu-active-text: #FFFFFF;
  --shell-menu-shadow: 18px 0 50px rgba(0,0,0,.34);
}

[data-theme="light"] {
  --bg: #F5F4EE;
  --bg-2: #ECEAE2;
  --surface: #FFFFFF;
  --surface-2: #F8F7F1;
  --surface-3: #EFEDE5;
  --border: rgba(15,15,18,.06);
  --border-strong: rgba(15,15,18,.12);

  --text: #0F0F12;
  --text-muted: #525866;
  --text-dim: #8B92A0;

  --primary: #6D28D9;
  --primary-strong: #5B21B6;
  --primary-soft: rgba(109,40,217,.08);
  --accent: #B45309;
  --accent-soft: rgba(180,83,9,.10);
  --success: #059669;
  --success-soft: rgba(5,150,105,.10);
  --danger: #E11D48;
  --danger-soft: rgba(225,29,72,.08);
  --info: #2563EB;
  --info-soft: rgba(37,99,235,.10);

  --shadow-card: 0 1px 0 rgba(255,255,255,.65) inset, 0 6px 18px rgba(15,15,18,.04);
  --shadow-pop: 0 18px 36px -12px rgba(15,15,18,.18), 0 6px 12px rgba(15,15,18,.06);

  --glass-bg: rgba(255,255,255,.78);
  --glass-border: rgba(15,15,18,.06);
  --noise: .025;

  --shell-menu-bg:
    radial-gradient(circle at 14% -4%, rgba(109,40,217,.13), transparent 34%),
    linear-gradient(180deg, #FFFFFF 0%, #FBFAF5 58%, #F5F4EE 100%);
  --shell-menu-head-bg: linear-gradient(135deg, rgba(109,40,217,.08), rgba(180,83,9,.05));
  --shell-menu-overlay: rgba(15,23,42,.22);
  --shell-menu-border: rgba(15,15,18,.10);
  --shell-menu-divider: rgba(15,15,18,.08);
  --shell-menu-text: #111827;
  --shell-menu-muted: #4B5563;
  --shell-menu-label: #8A6B3F;
  --shell-menu-hover: rgba(109,40,217,.07);
  --shell-menu-active-bg: linear-gradient(135deg, rgba(109,40,217,.14), rgba(180,83,9,.08));
  --shell-menu-active-border: rgba(109,40,217,.18);
  --shell-menu-active-text: #111827;
  --shell-menu-shadow: 16px 0 42px rgba(15,23,42,.16);
}

/* ---------------------------------------------------------------------
   2. Page reset (scoped to .dashboard-app)
   --------------------------------------------------------------------- */
.dashboard-app, .dashboard-app *, .dashboard-app *::before, .dashboard-app *::after {
  box-sizing: border-box;
}
.dashboard-page {
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-feature-settings: "cv11","ss01","ss03";
  transition: background .35s var(--ease), color .25s var(--ease);
  overflow-x: hidden;
  min-height: 100vh;
  padding: 0 !important;
  margin: 0 !important;
}
.dashboard-page::before {
  content:''; position: fixed; inset: 0;
  pointer-events: none; z-index: 200;
  opacity: var(--noise);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

.dashboard-app {
  max-width: var(--app-shell-width);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  padding-bottom: 110px;
  overflow: hidden;
}

/* Ambient orbs */
.dashboard-ambient { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.dashboard-ambient .orb {
  position: absolute; border-radius: 50%;
  filter: blur(90px); opacity: .22;
  animation: db-drift 18s ease-in-out infinite alternate;
}
.dashboard-ambient .orb.a { width: 380px; height: 380px; top: -140px; left: -140px; background: var(--primary); }
.dashboard-ambient .orb.b { width: 320px; height: 320px; top: 480px; right: -160px; background: var(--accent); animation-delay: -6s; }
.dashboard-ambient .orb.c { width: 260px; height: 260px; top: 1100px; left: -100px; background: var(--info); opacity: .12; animation-delay: -12s; }
[data-theme="light"] .dashboard-ambient .orb { opacity: .14; }
[data-theme="light"] .dashboard-ambient .orb.c { opacity: .08; }
@keyframes db-drift {
  0% { transform: translate(0,0) scale(1); }
  100% { transform: translate(20px,30px) scale(1.08); }
}

/* ---------------------------------------------------------------------
   3. Top status bar
   --------------------------------------------------------------------- */
.db-topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center;
  padding: 16px 18px 8px;
  background: linear-gradient(to bottom, var(--bg) 70%, transparent);
  backdrop-filter: blur(8px);
}
.db-tb-date {
  font-size: 13px; color: var(--text-muted); font-weight: 500;
  letter-spacing: .01em;
  display: inline-flex; align-items: center; gap: 6px;
}
.db-tb-spacer { flex: 1; }
.db-tb-actions { display: flex; gap: 8px; align-items: center; }
.db-tb-btn {
  width: 40px; height: 40px; border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: grid; place-items: center;
  cursor: pointer; position: relative;
  transition: transform .15s var(--ease), background .2s, border-color .2s;
  text-decoration: none;
}
.db-tb-btn:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.db-tb-btn:active { transform: scale(.92); }
.db-tb-btn .dot {
  position: absolute; top: 9px; right: 9px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 2px var(--surface);
}
.db-tb-avatar {
  width: 40px; height: 40px; border-radius: 14px;
  background: transparent;
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 14px;
  letter-spacing: -.01em; cursor: pointer;
  box-shadow: none;
  border: none;
  outline: none;
  text-decoration: none;
  overflow: hidden;
  padding: 0;
}
.db-tb-avatar img { width: 100%; height: 100%; object-fit: cover; border: none; outline: none; }

/* ---------------------------------------------------------------------
   4. Greeting + AI insight pill
   --------------------------------------------------------------------- */
.db-greeting { padding: 14px 18px 4px; position: relative; z-index: 1; }
.db-greet-h {
  font-family: 'Inter Tight', 'Inter', sans-serif;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -.025em;
  margin: 0;
  line-height: 1.3;
  overflow-wrap: anywhere;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 .25em;
}
.db-greet-prefix { color: var(--text-muted); font-weight: 600; font-size: .8em; flex-shrink: 0; }
.db-greet-name {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-weight: 400;
  font-size: 1.08em;
  line-height: 1.1;
  padding: .05em .04em 0;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: linear-gradient(120deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.db-insight-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 12px;
  box-shadow: var(--shadow-card);
}
.db-insight-pill .spark {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid; place-items: center;
  flex-shrink: 0;
}
.db-insight-pill strong { color: var(--text); font-weight: 600; }

/* ---------------------------------------------------------------------
   5. Wallet stack
   --------------------------------------------------------------------- */
.db-wallets { padding: 18px 0 6px; position: relative; z-index: 1; }
.db-wallet-rail {
  display: flex; gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 6px 18px 14px;
  scroll-padding: 18px;
}
.db-wallet-rail::-webkit-scrollbar { display: none; }

.db-wallet-card {
  position: relative; flex-shrink: 0;
  width: 290px; aspect-ratio: 17/10;
  border-radius: 24px; padding: 22px;
  color: #fff;
  display: flex; flex-direction: column; justify-content: space-between;
  scroll-snap-align: center;
  overflow: hidden;
  box-shadow: var(--shadow-pop);
  transition: transform .3s var(--ease);
  cursor: pointer;
  isolation: isolate;
  text-decoration: none;
}
.db-wallet-card.add-new {
  background: var(--surface);
  border: 2px dashed var(--border-strong);
  color: var(--text-muted);
  align-items: center; justify-content: center;
  flex-direction: column; gap: 10px;
  box-shadow: none;
}
.db-wallet-card.add-new span { font-size: 13px; font-weight: 600; }

.db-wallet-card.theme-vcb {
  background:
    radial-gradient(circle at 85% 15%, rgba(255,255,255,.22), transparent 50%),
    radial-gradient(circle at 0% 100%, rgba(0,0,0,.3), transparent 60%),
    linear-gradient(135deg, #1E3A8A 0%, #312E81 50%, #1E1B4B 100%);
}
.db-wallet-card.theme-momo {
  background:
    radial-gradient(circle at 85% 15%, rgba(255,255,255,.28), transparent 50%),
    radial-gradient(circle at 0% 100%, rgba(0,0,0,.2), transparent 60%),
    linear-gradient(135deg, #DB2777 0%, #BE185D 50%, #831843 100%);
}
.db-wallet-card.theme-cash {
  background:
    radial-gradient(circle at 85% 15%, rgba(255,255,255,.22), transparent 50%),
    linear-gradient(135deg, #047857 0%, #064E3B 50%, #022C22 100%);
}
.db-wallet-card.theme-savings {
  background:
    radial-gradient(circle at 85% 15%, rgba(251,191,36,.4), transparent 50%),
    radial-gradient(circle at 0% 100%, rgba(0,0,0,.3), transparent 60%),
    linear-gradient(135deg, #6D28D9 0%, #5B21B6 50%, #4C1D95 100%);
}
.db-wallet-card.theme-warm {
  background:
    radial-gradient(circle at 85% 15%, rgba(255,255,255,.22), transparent 50%),
    linear-gradient(135deg, #B45309 0%, #92400E 50%, #451A03 100%);
}

.db-wallet-card::before {
  content:''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.12), transparent 45%);
  pointer-events: none; z-index: 1;
}
.db-wallet-card::after {
  content:''; position: absolute;
  width: 240px; height: 240px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 50%;
  bottom: -120px; right: -120px;
  z-index: 1; pointer-events: none;
}
.db-wallet-card > * { position: relative; z-index: 2; }

.db-w-top { display: flex; align-items: center; justify-content: space-between; }
.db-w-chip {
  width: 38px; height: 28px; border-radius: 6px;
  background: linear-gradient(135deg, #FCD34D, #B45309);
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 1px 2px rgba(0,0,0,.2);
}
.db-w-chip::before {
  content:''; position: absolute; inset: 5px;
  border: 1px solid rgba(0,0,0,.25);
  border-radius: 3px;
  background:
    linear-gradient(to right, transparent 30%, rgba(0,0,0,.2) 30% 32%, transparent 32% 64%, rgba(0,0,0,.2) 64% 66%, transparent 66%),
    linear-gradient(to bottom, transparent 30%, rgba(0,0,0,.2) 30% 32%, transparent 32% 64%, rgba(0,0,0,.2) 64% 66%, transparent 66%);
}
.db-w-tag {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em;
  padding: 4px 10px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--r-pill);
  backdrop-filter: blur(4px);
  white-space: nowrap;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.db-w-bank {
  font-family: 'Inter Tight'; font-weight: 600;
  font-size: 16px; letter-spacing: -.01em;
  margin-top: -4px;
}
.db-w-num {
  font-family: 'Inter Tight'; font-size: 13px;
  letter-spacing: .15em; font-weight: 500;
  opacity: .7; margin-top: 2px;
}
.db-w-bot { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.db-w-bal-label {
  display: block;
  font-size: 10px; text-transform: uppercase; letter-spacing: .12em;
  opacity: .65; font-weight: 600;
}
.db-w-bal {
  font-family: 'Inter Tight'; font-weight: 700;
  font-size: 22px; letter-spacing: -.02em;
  margin-top: 2px; font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.db-w-bal.hidden { letter-spacing: .15em; }
.db-w-spark { width: 64px; height: 26px; opacity: .85; flex-shrink: 0; }

.db-wallet-dots {
  display: flex; justify-content: center; gap: 6px;
  margin-top: 4px;
}
.db-wallet-dots .dt {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--border-strong);
  transition: width .3s var(--ease), background .3s;
  cursor: pointer;
  border: none;
  padding: 0;
}
.db-wallet-dots .dt.active {
  width: 22px; border-radius: 4px;
  background: var(--primary);
}

/* ---------------------------------------------------------------------
   6. Today pulse
   --------------------------------------------------------------------- */
.db-today-section { padding: 18px 18px 0; position: relative; z-index: 1; }
.db-today-card {
  display: flex; align-items: center; gap: 18px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}
.db-ring-wrap { position: relative; width: 110px; height: 110px; flex-shrink: 0; padding: 4px; }
.db-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.db-ring .track { fill: none; stroke: var(--surface-3); stroke-width: 8; }
.db-ring .bar {
  fill: none; stroke: url(#dbRingGrad);
  stroke-width: 8; stroke-linecap: round;
  stroke-dasharray: 264;
  stroke-dashoffset: 264;
  animation: db-ring-fill 1.4s var(--ease) .3s forwards;
}
@keyframes db-ring-fill { to { stroke-dashoffset: var(--ring-target, 92); } }
.db-ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
}
.db-ring-center .label {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-muted); font-weight: 600;
}
.db-ring-center .value {
  font-family: 'Inter Tight'; font-weight: 700;
  font-size: 20px; letter-spacing: -.02em;
  margin-top: 2px; font-variant-numeric: tabular-nums;
}
.db-ring-center .pct {
  font-size: 10px; color: var(--text-muted);
  margin-top: 2px; font-weight: 500;
}
.db-today-info { flex: 1; min-width: 0; }
.db-ti-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-muted); font-weight: 600;
}
.db-ti-rem {
  font-family: 'Inter Tight'; font-weight: 700;
  font-size: 22px; letter-spacing: -.02em;
  margin-top: 4px; font-variant-numeric: tabular-nums;
}
.db-ti-of {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--text-muted);
  margin-top: 2px;
}
.db-ti-meta {
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between;
  font-size: 11.5px; color: var(--text-muted);
  gap: 8px; flex-wrap: wrap;
}
.db-ti-meta strong { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------
   7. Bento grid
   --------------------------------------------------------------------- */
.db-bento {
  padding: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  position: relative; z-index: 1;
}
.db-b {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform .2s var(--ease), border-color .2s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}
.db-b:hover { border-color: var(--border-strong); transform: translateY(-2px); color: inherit; }
.db-b:active { transform: scale(.98); }

.db-b-month {
  grid-column: span 2;
  background:
    radial-gradient(800px 200px at 100% 0%, var(--primary-soft), transparent 60%),
    var(--surface);
}
.db-b-month .lbl {
  font-size: 11px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-muted); font-weight: 600;
}
.db-b-month .row { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.db-b-month .num {
  font-family: 'Inter Tight'; font-weight: 700;
  font-size: 28px; letter-spacing: -.025em;
  margin-top: 4px; font-variant-numeric: tabular-nums;
}
.db-b-month .badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}
.db-b-month .badge.good { background: var(--success-soft); color: var(--success); }
.db-b-month .badge.warn { background: var(--accent-soft); color: var(--accent); }
.db-b-month .badge.bad { background: var(--danger-soft); color: var(--danger); }

.db-progress {
  margin-top: 14px; height: 6px;
  background: var(--surface-3);
  border-radius: var(--r-pill);
  overflow: hidden;
  position: relative;
}
.db-progress > div {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: var(--r-pill);
  transition: width 1.4s var(--ease) .3s;
}
.db-b-month .meta {
  margin-top: 10px; display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text-muted);
  gap: 8px; flex-wrap: wrap;
}
.db-b-month .meta strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

.db-b-streak {
  background:
    radial-gradient(circle at 50% 0%, rgba(251,191,36,.18), transparent 60%),
    var(--surface);
  text-align: center;
}
.db-b-streak .flame {
  font-size: 32px; line-height: 1;
  color: #F97316;
  display: inline-block;
  filter: drop-shadow(0 4px 10px rgba(249,115,22,.5));
  animation: db-flicker 2.4s ease-in-out infinite;
}
@keyframes db-flicker {
  0%,100% { transform: scale(1) rotate(-2deg); }
  50% { transform: scale(1.08) rotate(2deg); }
}
.db-b-streak .num {
  font-family: 'Inter Tight'; font-weight: 700;
  font-size: 36px; letter-spacing: -.03em;
  margin-top: 6px; line-height: 1;
}
.db-b-streak .lbl {
  font-size: 11.5px; color: var(--text-muted);
  margin-top: 4px; font-weight: 500;
}

.db-b-top .ic {
  width: 36px; height: 36px;
  background: var(--danger-soft); color: var(--danger);
  border-radius: 12px;
  display: grid; place-items: center;
  margin-bottom: 12px;
}
.db-b-top .lbl {
  font-size: 11px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-muted); font-weight: 600;
}
.db-b-top .name {
  font-family: 'Inter Tight'; font-weight: 700;
  font-size: 17px; letter-spacing: -.01em;
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.db-b-top .amt {
  font-size: 13px; color: var(--text-muted);
  margin-top: 4px; font-variant-numeric: tabular-nums;
}
.db-b-top .amt strong { color: var(--text); font-weight: 600; }

.db-b-upcoming {
  grid-column: span 2;
  background:
    linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
}
.db-b-upcoming .head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}
.db-b-upcoming .head .ttl {
  font-family: 'Inter Tight'; font-weight: 700;
  font-size: 15px; letter-spacing: -.01em;
}
.db-b-upcoming .head .total {
  font-size: 12px; color: var(--text-muted); font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.db-b-upcoming .head .total strong { color: var(--text); font-weight: 700; }

.db-bill-list { display: flex; flex-direction: column; gap: 8px; }
.db-bill {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 14px;
}
.db-bill .ic {
  width: 32px; height: 32px;
  border-radius: 10px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.db-bill .nm { flex: 1; min-width: 0; }
.db-bill .nm .n { font-size: 13px; font-weight: 600; }
.db-bill .nm .d { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.db-bill .am { font-family: 'Inter Tight'; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.db-bill .due { font-size: 10px; padding: 2px 7px; border-radius: var(--r-pill); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; flex-shrink: 0; }
.db-bill .due.soon { background: var(--accent-soft); color: var(--accent); }
.db-bill .due.normal { background: var(--info-soft); color: var(--info); }

/* Empty state inside bento blocks */
.db-empty {
  text-align: center;
  padding: 24px 12px;
  color: var(--text-muted);
  font-size: 13px;
}
.db-empty i { font-size: 28px; margin-bottom: 8px; opacity: .6; display: block; }

/* ---------------------------------------------------------------------
   8. Section heads & breakdown
   --------------------------------------------------------------------- */
.db-section { padding: 8px 18px 0; position: relative; z-index: 1; }
.db-section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 14px;
  gap: 8px;
}
.db-section-head h2 {
  font-family: 'Inter Tight'; font-weight: 700;
  font-size: 18px; letter-spacing: -.015em; margin: 0;
}
.db-section-head .sub {
  font-size: 12px; color: var(--text-muted); font-weight: 500;
}
.db-section-link {
  font-size: 13px; color: var(--primary);
  font-weight: 600; text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
  flex-shrink: 0;
}
.db-section-link:hover { color: var(--primary-strong); }

.db-breakdown-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow-card);
}
.db-bd-summary {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 14px;
  gap: 8px;
}
.db-bd-total {
  font-family: 'Inter Tight'; font-weight: 700;
  font-size: 24px; letter-spacing: -.025em; font-variant-numeric: tabular-nums;
}
.db-bd-period {
  font-size: 11px; color: var(--text-muted); font-weight: 500;
  text-transform: uppercase; letter-spacing: .08em;
}
.db-stack-bar {
  display: flex; height: 12px;
  border-radius: var(--r-pill);
  overflow: hidden;
  background: var(--surface-3);
  margin-bottom: 16px;
}
.db-stack-bar > div {
  height: 100%;
  position: relative;
  width: 0;
  transition: width 1s var(--ease);
}
.db-stack-bar > div + div { margin-left: 2px; }

.db-cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.db-cat-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.db-cat-row .bullet {
  width: 10px; height: 10px; border-radius: 4px; flex-shrink: 0;
}
.db-cat-row .info { flex: 1; min-width: 0; }
.db-cat-row .nm {
  font-size: 12.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.db-cat-row .vl {
  font-size: 11px; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------------
   9. AI Insight rail
   --------------------------------------------------------------------- */
.db-insights-rail {
  display: flex; gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  margin: 0 -18px;
  padding: 0 18px 8px;
}
.db-insights-rail::-webkit-scrollbar { display: none; }

.db-in-card {
  flex-shrink: 0; width: 280px;
  border-radius: var(--r-lg);
  padding: 18px;
  scroll-snap-align: start;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform .2s var(--ease);
  isolation: isolate;
  background: var(--surface);
  border: 1px solid var(--border);
}
.db-in-card:active { transform: scale(.98); }
.db-in-card::after {
  content:''; position: absolute;
  width: 180px; height: 180px;
  border-radius: 50%;
  filter: blur(40px);
  opacity: .35;
  top: -60px; right: -60px;
  z-index: -1;
}
.db-in-card.savings::after { background: var(--success); }
.db-in-card.warning::after { background: var(--accent); }
.db-in-card.tip::after { background: var(--primary); }

.db-in-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
}
.db-in-tag.s { color: var(--success); border-color: var(--success-soft); }
.db-in-tag.w { color: var(--accent); border-color: var(--accent-soft); }
.db-in-tag.t { color: var(--primary); border-color: var(--primary-soft); }

.db-in-title {
  font-family: 'Inter Tight'; font-weight: 700;
  font-size: 17px; letter-spacing: -.015em;
  margin: 12px 0 6px;
  line-height: 1.3;
}
.db-in-text {
  font-size: 13px; color: var(--text-muted);
  line-height: 1.5;
}
.db-in-text strong { color: var(--text); font-weight: 600; }
.db-in-cta {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 12px;
  font-size: 13px; font-weight: 600;
  background: none; border: none; padding: 0;
  cursor: pointer; color: var(--primary);
  text-decoration: none;
}
.db-in-cta i { transition: transform .2s; }
.db-in-cta:hover { color: var(--primary-strong); }
.db-in-cta:hover i { transform: translateX(3px); }

/* ---------------------------------------------------------------------
   10. Timeline
   --------------------------------------------------------------------- */
.db-timeline-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 6px 18px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.db-tl-day {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 0 10px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-muted);
}
.db-tl-day::after {
  content:''; flex: 1; height: 1px;
  background: var(--border);
}
.db-tl-day .date {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 3px 8px; border-radius: 6px;
  color: var(--text-dim); font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
}
.db-tl-item {
  display: grid;
  grid-template-columns: 46px 40px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  position: relative;
  cursor: pointer;
  transition: background .15s;
  text-decoration: none;
  color: inherit;
}
.db-tl-item:hover .db-tl-icon { transform: scale(1.06); }
.db-tl-item::before {
  content:''; position: absolute;
  top: 0; bottom: 0; left: 76px;
  width: 2px;
  background: var(--border);
  z-index: 0;
}
.db-tl-item.first::before { top: 50%; }
.db-tl-item.last::before { bottom: 50%; }

.db-tl-time {
  font-size: 11px; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  text-align: right;
  position: relative; z-index: 1;
  background: var(--surface);
  padding: 2px 0;
}
.db-tl-icon {
  width: 36px; height: 36px;
  border-radius: 12px;
  display: grid; place-items: center;
  position: relative; z-index: 1;
  transition: transform .15s var(--ease);
  border: 2px solid var(--surface);
  box-sizing: border-box;
}
.db-tl-body { min-width: 0; }
.db-tl-title {
  font-size: 14px; font-weight: 600;
  margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--text);
}
.db-tl-sub {
  font-size: 11.5px; color: var(--text-muted);
  margin-top: 2px;
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
}
.db-tl-sub .badge-grp {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--accent-soft); color: var(--accent);
  padding: 1px 6px; border-radius: 5px;
  font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
}
.db-tl-amt {
  font-family: 'Inter Tight'; font-weight: 700;
  font-size: 14px; letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.db-tl-amt.income { color: var(--success); }
.db-tl-amt.expense { color: var(--text); }

.db-tl-foot {
  text-align: center;
  padding: 12px 0 6px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}
.db-tl-foot a {
  font-size: 13px; font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
}

.db-tl-empty {
  text-align: center;
  padding: 36px 12px;
  color: var(--text-muted);
}
.db-tl-empty i { font-size: 36px; opacity: .4; display: block; margin-bottom: 12px; }
.db-tl-empty p { font-size: 13px; margin: 0; }

/* ---------------------------------------------------------------------
   11. Bottom dock
   --------------------------------------------------------------------- */
.db-dock {
  position: fixed;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100vw - 32px), calc(var(--app-shell-width) - 32px));
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr 60px 1fr 1fr;
  align-items: center;
  z-index: 60;
  box-shadow: var(--shadow-pop), 0 1px 0 rgba(255,255,255,.05) inset;
  will-change: auto;
}
.db-dock.no-fab {
  grid-template-columns: 1fr 1fr 1fr 1fr;
}
.db-dock.db-reveal,
.db-dock.app-reveal {
  animation: none;
}
.db-dock-item {
  display: flex; flex-direction: column;
  align-items: center; gap: 4px;
  padding: 10px 4px;
  border-radius: 16px;
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color .2s;
  font-size: 10px; font-weight: 600;
  position: relative;
  text-decoration: none;
}
.db-dock-item.active { color: var(--text); }
.db-dock-item.active i { color: var(--primary); }
.db-dock-item.active::before {
  content:''; position: absolute;
  bottom: 4px; left: 50%; transform: translateX(-50%);
  width: 16px; height: 3px;
  background: var(--primary);
  border-radius: var(--r-pill);
}
.db-dock-item:hover { color: var(--text); }
.db-dock-fab {
  width: 56px; height: 56px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary-strong), var(--primary));
  color: #fff;
  border: none;
  display: grid; place-items: center;
  cursor: pointer;
  box-shadow: 0 12px 28px -6px rgba(109,40,217,.55), inset 0 1px 0 rgba(255,255,255,.25);
  transition: transform .15s var(--ease);
  margin-top: -6px;
  text-decoration: none;
}
.db-dock-fab:active { transform: scale(.92); }

.db-dock-fab-menu {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  width: min(100vw, var(--app-shell-width));
  transform: translateX(-50%);
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(8px);
  z-index: 70;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0 16px calc(100px + env(safe-area-inset-bottom));
}
.db-dock-fab-menu.active { display: flex; }
.db-dock-fab-menu .sheet {
  width: 100%;
  max-width: calc(var(--app-shell-width) - 32px);
  background: var(--surface);
  border-radius: 22px;
  padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow-pop);
  animation: db-rise .25s var(--ease);
}
.db-dock-fab-menu .sheet a {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  text-decoration: none;
  color: var(--text);
  font-size: 14px; font-weight: 600;
  transition: background .15s;
}
.db-dock-fab-menu .sheet a:hover { background: var(--surface-2); }
.db-dock-fab-menu .sheet a .ic {
  width: 36px; height: 36px; border-radius: 12px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.db-dock-fab-menu .sheet a.income .ic { background: var(--success-soft); color: var(--success); }
.db-dock-fab-menu .sheet a.expense .ic { background: var(--danger-soft); color: var(--danger); }
.db-dock-fab-menu .sheet a.transfer .ic { background: var(--info-soft); color: var(--info); }

/* ---------------------------------------------------------------------
   12. Reveal animations
   --------------------------------------------------------------------- */
@keyframes db-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
.db-reveal { animation: db-rise .6s var(--ease) backwards; }
.db-d1 { animation-delay: .04s; }
.db-d2 { animation-delay: .1s; }
.db-d3 { animation-delay: .16s; }
.db-d4 { animation-delay: .22s; }
.db-d5 { animation-delay: .28s; }
.db-d6 { animation-delay: .34s; }
.db-d7 { animation-delay: .4s; }

/* ---------------------------------------------------------------------
   13. Font Awesome icon sizing per context
   --------------------------------------------------------------------- */
.dashboard-app .fa-solid,
.dashboard-app .fa-regular,
.dashboard-app .fa-brands { line-height: 1; display: inline-block; }
.db-tb-date i { font-size: 13px; }
.db-tb-btn i { font-size: 16px; }
.db-insight-pill .spark i { font-size: 10px; color: #fff; }
.db-b-month .badge i { font-size: 10px; }
.db-b-top .ic i { font-size: 18px; }
.db-bill .ic i { font-size: 15px; }
.db-in-tag i { font-size: 11px; }
.db-in-cta i { font-size: 13px; }
.db-tl-icon i { font-size: 15px; }
.db-tl-sub .badge-grp i { font-size: 9px; }
.db-section-link i { font-size: 12px; }
.db-tl-foot i { font-size: 13px; }
.db-dock-item i { font-size: 20px; transition: transform .2s var(--ease); }
.db-dock-fab i { font-size: 22px; }
.db-wallet-card.add-new i { font-size: 28px; }
.db-empty i { font-size: 28px; }
.db-tl-empty i { font-size: 36px; }

/* ---------------------------------------------------------------------
   14. Reduced motion / safe-area
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .dashboard-app *, .dashboard-app *::before, .dashboard-app *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
@supports(padding: max(0px)) {
  .dashboard-app { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
}

@media (max-width: 360px) {
  .db-dock {
    width: calc(100vw - 20px);
    grid-template-columns: 1fr 1fr 56px 1fr 1fr;
    padding: 6px;
  }
  .db-dock-item span { display: none; }
  .db-dock-fab { width: 52px; height: 52px; }
}
