/* =========================================================
   Wealthfolio — Static Edition
   Private-banking design system: ink/paper base, gold accent
   ========================================================= */

:root {
  --ink: #0A0F1E;
  --ink-surface: #10182B;
  --ink-raised: #161F38;
  --ink-border: #232D48;

  --paper: #F6F4EE;
  --paper-surface: #FFFFFF;
  --paper-raised: #EFEBE1;
  --paper-border: #E2DDCF;

  --gold: #C6A15B;
  --gold-light: #E4CD98;
  --gold-dark: #8F7534;

  --emerald: #2FAE7A;
  --emerald-light: #5FCB9C;
  --emerald-dark: #1F7D57;

  --crimson: #C4634F;
  --crimson-light: #DD9484;
  --crimson-dark: #8E4636;

  --violet: #7C6FEE;
  --violet-light: #A79FF5;

  --bg: var(--ink);
  --surface: var(--ink-surface);
  --raised: var(--ink-raised);
  --border: var(--ink-border);
  --text: var(--paper);
  --text-muted: rgba(246, 244, 238, 0.6);
  --text-faint: rgba(246, 244, 238, 0.4);
}

body.light {
  --bg: var(--paper);
  --surface: var(--paper-surface);
  --raised: var(--paper-raised);
  --border: var(--paper-border);
  --text: var(--ink);
  --text-muted: rgba(10, 15, 30, 0.6);
  --text-faint: rgba(10, 15, 30, 0.4);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Manrope', sans-serif;
  transition: background 0.3s ease, color 0.3s ease;
  min-height: 100vh;
}

h1, h2, h3, .display {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  margin: 0;
}

::selection { background: rgba(198, 161, 91, 0.3); }

a { color: inherit; text-decoration: none; }

button, input, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

.tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: 'JetBrains Mono', monospace; }

/* ---------- Layout ---------- */
.container { max-width: 1400px; margin: 0 auto; padding: 0 24px; }

/* ---------- Glass surface ---------- */
.glass {
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

.glass-hover { transition: transform 0.3s ease, border-color 0.3s ease; }
.glass-hover:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--gold) 40%, transparent); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #0A0F1E;
}
.btn-secondary {
  background: var(--raised);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-danger { background: color-mix(in srgb, var(--crimson) 15%, transparent); color: var(--crimson-light); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; text-align: left; }
.field label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}
.field input,
.field select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--raised);
  color: var(--text);
  outline: none;
}
.field input:focus, .field select:focus { border-color: var(--gold); }

/* ---------- Skeleton ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--raised) 25%, color-mix(in srgb, var(--gold) 10%, var(--raised)) 50%, var(--raised) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
  border-radius: 12px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- Aurora hero ---------- */
.aurora-wrap { position: relative; overflow: hidden; }
.aurora {
  position: absolute; inset: 0; pointer-events: none;
}
.aurora span {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  animation: drift 18s ease-in-out infinite;
}
.aurora .a1 { width: 340px; height: 340px; left: 0%; top: -20%; background: radial-gradient(circle, rgba(198,161,91,0.35), transparent 70%); }
.aurora .a2 { width: 300px; height: 300px; right: 5%; top: 10%; background: radial-gradient(circle, rgba(47,174,122,0.3), transparent 70%); animation-delay: -6s; }
.aurora .a3 { width: 320px; height: 320px; left: 30%; bottom: -30%; background: radial-gradient(circle, rgba(124,111,238,0.25), transparent 70%); animation-delay: -11s; }
@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(3%, -4%) scale(1.06); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- Fade up ---------- */
.fade-up { animation: fadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
}
.badge-up { background: color-mix(in srgb, var(--emerald) 15%, transparent); color: var(--emerald-light); }
.badge-down { background: color-mix(in srgb, var(--crimson) 15%, transparent); color: var(--crimson-light); }

.pill-dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; }

/* ---------- Responsive helpers ---------- */
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid-4, .grid-2 { grid-template-columns: 1fr; } }

/* =========================================================
   Landing page
   ========================================================= */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 0;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: 'Fraunces', serif; font-style: italic; font-size: 20px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--gold), var(--emerald));
  display: flex; align-items: center; justify-content: center;
  color: #0A0F1E; font-weight: 700; font-style: normal; font-family: 'Fraunces', serif;
}
.nav-links { display: flex; gap: 28px; align-items: center; }
.nav-links a { color: var(--text-muted); font-size: 14px; font-weight: 500; }
.nav-links a:hover { color: var(--text); }

.hero {
  position: relative;
  padding: 90px 0 60px;
  text-align: center;
  overflow: hidden;
}
.hero-eyebrow {
  font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--gold); font-weight: 700; margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(36px, 6vw, 68px);
  font-style: italic;
  line-height: 1.05;
  max-width: 820px;
  margin: 0 auto;
}
.hero h1 .accent { background: linear-gradient(135deg, var(--gold), var(--emerald-light)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p {
  max-width: 560px; margin: 24px auto 0; color: var(--text-muted); font-size: 17px; line-height: 1.6;
}
.hero-actions { display: flex; gap: 14px; justify-content: center; margin-top: 36px; flex-wrap: wrap; }

.features { padding: 60px 0 100px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 800px) { .features { grid-template-columns: 1fr; } }
.feature-card { padding: 28px; }
.feature-icon {
  width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px; font-size: 18px;
}
.feature-card h3 { font-size: 18px; font-style: italic; margin-bottom: 8px; }
.feature-card p { color: var(--text-muted); font-size: 14px; line-height: 1.6; margin: 0; }

.footer-note { text-align: center; padding: 30px 0 60px; color: var(--text-faint); font-size: 13px; }

/* =========================================================
   App shell (dashboard)
   ========================================================= */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px; flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  backdrop-filter: blur(20px);
  padding: 24px 16px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; margin-top: 32px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 10px;
  color: var(--text-muted); font-size: 14px; font-weight: 500;
  cursor: pointer; border: none; background: transparent; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--raised); }
.nav-item.active { background: color-mix(in srgb, var(--gold) 14%, transparent); color: var(--gold); font-weight: 700; }
.nav-item svg { flex-shrink: 0; }

@media (max-width: 860px) {
  .sidebar { position: fixed; left: -260px; z-index: 50; transition: left 0.3s ease; box-shadow: 20px 0 40px rgba(0,0,0,0.3); }
  .sidebar.open { left: 0; }
}

.main { flex: 1; min-width: 0; padding: 28px 32px 60px; max-width: 1400px; margin: 0 auto; width: 100%; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.topbar h2 { font-size: 26px; font-style: italic; }
.topbar-sub { color: var(--text-faint); font-size: 13px; margin-top: 4px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  position: relative;
}
.icon-btn:hover { border-color: var(--gold); }
.hamburger { display: none; }
@media (max-width: 860px) { .hamburger { display: flex; } }

/* ---------- Net worth hero ---------- */
.nw-hero { padding: 40px; margin-bottom: 24px; }
.nw-label { font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-faint); font-weight: 600; }
.nw-value { font-size: clamp(40px, 6vw, 64px); font-style: italic; margin-top: 12px; display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.nw-sub { color: var(--text-muted); font-size: 14px; margin-top: 8px; }

/* ---------- Stat cards ---------- */
.stat-card { padding: 20px; }
.stat-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.stat-label { font-size: 12px; color: var(--text-faint); font-weight: 600; }
.stat-value { font-family: 'Fraunces', serif; font-size: 24px; margin-top: 4px; }
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; }

/* ---------- Card generic ---------- */
.card { padding: 24px; }
.card-title { font-size: 17px; font-style: italic; margin-bottom: 18px; }

/* Fixed-height wrapper for every dashboard Chart.js canvas — without this,
   a responsive canvas inside a flex/grid card can grow unbounded (a classic
   Chart.js resize-loop bug), which is why charts looked oversized. */
.chart-canvas-wrap { position: relative; width: 100%; height: 260px; }

/* ---------- 3D: Assets vs Liabilities isometric scene ---------- */
.scene3d-wrap { perspective: 900px; height: 260px; display: flex; align-items: center; justify-content: center; margin-top: 10px; }
.scene3d {
  width: 100%; height: 100%; transform-style: preserve-3d;
  transform: rotateX(28deg) rotateZ(-32deg);
  transition: transform 0.15s ease-out;
  display: flex; align-items: flex-end; justify-content: center;
}
.bar3d-track { display: flex; gap: 70px; align-items: flex-end; height: 100%; transform-style: preserve-3d; }
.bar3d {
  position: relative; width: 64px; height: 0px; max-height: 170px;
  transform-style: preserve-3d;
  transition: height 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}
.bar3d-front, .bar3d-side, .bar3d-top {
  position: absolute; transform-style: preserve-3d;
}
.bar3d-front {
  width: 64px; height: 100%; left: 0; top: 0;
  transform: translateZ(16px);
  border-radius: 4px 4px 0 0;
}
.bar3d-side {
  width: 32px; height: 100%; left: 64px; top: 0;
  transform-origin: left; transform: rotateY(90deg) translateZ(0px);
  border-radius: 0 4px 0 0;
}
.bar3d-top {
  width: 64px; height: 32px; left: 0; top: 0;
  transform-origin: top; transform: rotateX(-90deg) translateZ(0px);
  border-radius: 4px;
}
.bar3d-asset .bar3d-front { background: linear-gradient(180deg, #3FCB92, #2FAE7A); }
.bar3d-asset .bar3d-side { background: #1F7D57; }
.bar3d-asset .bar3d-top { background: #5FE0AC; }
.bar3d-liab .bar3d-front { background: linear-gradient(180deg, #DD7F6B, #C4634F); }
.bar3d-liab .bar3d-side { background: #8F4536; }
.bar3d-liab .bar3d-top { background: #E89A88; }
.scene3d-legend { display: flex; gap: 20px; justify-content: center; margin-top: 6px; flex-wrap: wrap; }
.scene3d-legend-item { font-size: 12.5px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.scene3d-legend-item .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
@media (max-width: 640px) {
  .scene3d-wrap { height: 200px; }
  .bar3d-track { gap: 40px; }
}

/* ---------- Transactions: advanced filter panel ---------- */
.adv-filter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 900px) { .adv-filter-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .adv-filter-grid { grid-template-columns: 1fr; } }
.chart-canvas-wrap canvas { max-width: 100%; }
@media (max-width: 640px) {
  .chart-canvas-wrap { height: 220px; }
}

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; max-width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--text-faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; padding: 10px 12px; border-bottom: 1px solid var(--border); }
td { padding: 12px; border-bottom: 1px solid var(--border); }

/* ---------- Transactions: date filter bar ---------- */
.tx-filter-card { margin-bottom: 16px; padding: 14px 16px; overflow: hidden; max-width: 100%; box-sizing: border-box; }
.tx-filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; min-width: 0; }
.tx-filter-presets { display: flex; gap: 8px; flex-wrap: wrap; min-width: 0; }
.tx-pill { padding: 7px 14px; font-size: 13px; white-space: nowrap; }
.tx-custom-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-left: auto; min-width: 0; }
.tx-date-input { padding: 7px 10px; font-size: 13px; width: auto; max-width: 140px; box-sizing: border-box; }
.tx-to-label { color: var(--text-faint); font-size: 13px; }
.tx-filter-summary { font-size: 12px; color: var(--text-faint); margin-top: 10px; }

/* ---------- Transactions: pagination ---------- */
.tx-pagination {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 10px; margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--border); min-width: 0;
}
.tx-pagination-summary { font-size: 12.5px; color: var(--text-faint); white-space: nowrap; }
.tx-pagination-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tx-perpage-select { padding: 6px 10px; font-size: 12.5px; width: auto; }
.tx-page-count { font-size: 12.5px; color: var(--text-faint); white-space: nowrap; }
.tx-disabled { opacity: 0.4; pointer-events: none; }

@media (max-width: 640px) {
  .tx-filter-row { flex-direction: column; align-items: stretch; }
  .tx-filter-presets { justify-content: stretch; }
  .tx-filter-presets .tx-pill { flex: 1 1 calc(50% - 8px); text-align: center; }
  .tx-custom-form { margin-left: 0; width: 100%; }
  .tx-date-input { flex: 1 1 auto; max-width: none; min-width: 0; }
  .tx-custom-form .tx-pill { flex: 1 1 100%; }
  .tx-pagination { flex-direction: column; align-items: stretch; }
  .tx-pagination-controls { justify-content: center; }
}
tr:last-child td { border-bottom: none; }
.row-actions { display: flex; gap: 8px; }
.icon-action { cursor: pointer; color: var(--text-faint); background: none; border: none; padding: 4px; }
.icon-action:hover { color: var(--crimson-light); }

.amount-pos { color: var(--emerald-light); font-weight: 600; }
.amount-neg { color: var(--crimson-light); font-weight: 600; }

.empty-state { text-align: center; padding: 50px 20px; color: var(--text-faint); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal { width: 100%; max-width: 440px; padding: 28px; }
.modal-title { font-size: 20px; font-style: italic; margin-bottom: 20px; }
.hidden { display: none !important; }

/* ---------- Auth screen ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; position: relative; overflow: hidden; }
.auth-card { width: 100%; max-width: 400px; padding: 36px; text-align: center; position: relative; z-index: 1; }
.auth-card h1 { font-size: 26px; font-style: italic; margin-bottom: 6px; }
.auth-card .sub { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.auth-switch { margin-top: 18px; font-size: 13px; color: var(--text-muted); }
.auth-switch button { background: none; border: none; color: var(--gold); font-weight: 700; cursor: pointer; }
.auth-error { background: color-mix(in srgb, var(--crimson) 12%, transparent); color: var(--crimson-light); padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; text-align: left; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px;
}
.toast-item {
  padding: 14px 18px; border-radius: 12px; font-size: 14px; font-weight: 500;
  min-width: 220px;
}

/* =========================================================
   Landing page — extended sections (stats, steps, security, footer)
   ========================================================= */
.trust-bar {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 32px;
  padding: 20px 0 10px; color: var(--text-muted); font-size: 13px;
}
.trust-item { display: flex; align-items: center; gap: 8px; }
.trust-item .dot { width: 6px; height: 6px; border-radius: 999px; background: var(--gold); }

.section-heading { text-align: center; max-width: 620px; margin: 0 auto 44px; }
.section-eyebrow {
  font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--gold); font-weight: 700; margin-bottom: 12px;
}
.section-heading h2 { font-size: clamp(26px, 4vw, 38px); font-style: italic; }
.section-heading p { color: var(--text-muted); margin-top: 12px; font-size: 15px; line-height: 1.6; }

/* ---- Steps ---- */
.steps { padding: 70px 0; }
.steps-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; counter-reset: step; }
@media (max-width: 900px) { .steps-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .steps-grid { grid-template-columns: 1fr; } }
.step-card { padding: 26px; position: relative; }
.step-num {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #0A0F1E; display: flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', serif; font-weight: 600; font-size: 15px; margin-bottom: 16px;
}
.step-card h3 { font-size: 16px; font-style: italic; margin-bottom: 8px; }
.step-card p { color: var(--text-muted); font-size: 13.5px; line-height: 1.6; margin: 0; }
.step-connector {
  position: absolute; top: 34px; left: calc(100% - 4px); width: 24px; height: 1px;
  background: var(--border); display: none;
}
@media (min-width: 901px) { .step-connector.show { display: block; } }

/* ---- Security section ---- */
.security-section {
  padding: 60px 0; margin: 20px 0;
}
.security-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
@media (max-width: 800px) { .security-grid { grid-template-columns: 1fr; } }
.security-list { list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-direction: column; gap: 16px; }
.security-list li { display: flex; align-items: flex-start; gap: 12px; font-size: 14px; color: var(--text-muted); line-height: 1.5; }
.security-list .check {
  width: 22px; height: 22px; border-radius: 999px; flex-shrink: 0;
  background: color-mix(in srgb, var(--emerald) 18%, transparent); color: var(--emerald-light);
  display: flex; align-items: center; justify-content: center; font-size: 12px; margin-top: 1px;
}
.security-visual { padding: 30px; text-align: center; }
.security-visual .big-icon { font-size: 48px; margin-bottom: 12px; }

/* ---- CTA ---- */
.cta-section { padding: 70px 0; text-align: center; }
.cta-box { padding: 56px 40px; position: relative; overflow: hidden; }
.cta-box h2 { font-size: clamp(28px, 4vw, 40px); font-style: italic; position: relative; z-index: 1; }
.cta-box p { color: var(--text-muted); margin: 14px 0 28px; position: relative; z-index: 1; }
.cta-box .hero-actions { position: relative; z-index: 1; }

/* ---- Footer ---- */
.site-footer { border-top: 1px solid var(--border); padding: 40px 0 30px; margin-top: 20px; }
.footer-grid { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.footer-links { display: flex; gap: 24px; font-size: 13px; color: var(--text-muted); }
.footer-credit { font-size: 13px; color: var(--text-faint); text-align: center; margin-top: 24px; }
.footer-credit a { color: var(--gold); font-weight: 600; }

/* =========================================================
   Mobile polish
   ========================================================= */
@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .nw-hero { padding: 26px 20px; }
  .card, .stat-card { padding: 16px; }
  .topbar h2 { font-size: 21px; }
  .modal { padding: 22px; max-width: 100%; }
  .auth-card { padding: 26px; }
  .icon-btn { width: 36px; height: 36px; }
  table { font-size: 12.5px; }
  th, td { padding: 8px; }
  .topbar-actions { gap: 8px; }
  .hero { padding: 50px 0 30px; }
  .grid-4 > .stat-card .stat-value { font-size: 19px; }
}

@media (max-width: 400px) {
  .nw-value { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* Larger, easier-to-tap buttons on touch devices */
@media (hover: none) {
  .btn { padding: 13px 22px; }
  .nav-item { padding: 13px 14px; }
  .icon-action { padding: 8px; }
}

/* =========================================================
   Animated background + zoom hover effects
   ========================================================= */
body { position: relative; }
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1100px circle at 15% -5%, rgba(198,161,91,0.10), transparent 55%),
    radial-gradient(900px circle at 85% 105%, rgba(47,174,122,0.08), transparent 55%),
    radial-gradient(700px circle at 50% 50%, rgba(124,111,238,0.05), transparent 60%);
  animation: bgShift 22s ease-in-out infinite alternate;
}
@keyframes bgShift {
  0% { opacity: 0.7; transform: scale(1) translate(0,0); }
  100% { opacity: 1; transform: scale(1.08) translate(1%, -1%); }
}

/* Stronger, springier hover on all glass cards — the "zoom" effect */
.glass-hover {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.3s ease,
              box-shadow 0.35s ease;
}
.glass-hover:hover {
  transform: translateY(-5px) scale(1.018);
  border-color: color-mix(in srgb, var(--gold) 45%, transparent);
  box-shadow: 0 20px 44px rgba(0,0,0,0.28);
}
body.light .glass-hover:hover { box-shadow: 0 20px 44px rgba(20,24,31,0.14); }

/* Buttons get a lively press/hover too */
.btn { transition: transform 0.22s cubic-bezier(0.16,1,0.3,1), box-shadow 0.22s ease, opacity 0.2s ease; }
.btn-primary:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 10px 26px rgba(198,161,91,0.35); }
.btn-secondary:hover, .btn-danger:hover { transform: translateY(-2px) scale(1.02); }

/* Feature icons pop slightly on card hover */
.feature-card .feature-icon, .step-card .step-num { transition: transform 0.35s cubic-bezier(0.16,1,0.3,1); }
.feature-card:hover .feature-icon, .step-card:hover .step-num { transform: scale(1.15) rotate(-4deg); }

/* Nav items / icon buttons — subtle zoom */
.icon-btn, .icon-action { transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease; }
.icon-btn:hover { transform: scale(1.08); }
.icon-action:hover { transform: scale(1.15); }

/* Table rows — gentle highlight zoom */
tbody tr { transition: background 0.2s ease; }
tbody tr:hover { background: color-mix(in srgb, var(--gold) 6%, transparent); }

/* Stat values count-up gets a tiny entrance pop */
.stat-value, .nw-value { animation: popIn 0.5s cubic-bezier(0.16,1,0.3,1) both; }
@keyframes popIn { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
  .glass-hover:hover, .btn:hover, .feature-card:hover .feature-icon { transform: none; }
}

/* =========================================================
   PRO POLISH PASS — spotlight cursor glow, page transitions,
   ripple clicks, animated borders, sidebar indicator
   (Pure visual — no data/logic touched)
   ========================================================= */

/* ---- Page transition (fades between pages like a single app) ---- */
body { opacity: 1; transition: opacity 0.28s ease, transform 0.28s ease; }
body.page-enter { opacity: 0; transform: translateY(6px); }
body.page-exit { opacity: 0; transform: scale(0.985); }

/* ---- Spotlight cursor glow on cards (Linear/Stripe-style) ---- */
.glass-hover {
  position: relative;
  overflow: hidden;
}
.glass-hover::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 50%),
    rgba(198,161,91,0.14), transparent 60%);
  z-index: 0;
}
.glass-hover:hover::after { opacity: 1; }
.glass-hover > * { position: relative; z-index: 1; }

/* ---- Animated gradient border ring on the net worth hero ---- */
.nw-hero { position: relative; }
.nw-hero::before {
  content: "";
  position: absolute; inset: -1px; border-radius: inherit; z-index: -1;
  padding: 1px;
  background: conic-gradient(from var(--angle, 0deg), var(--gold), var(--emerald), var(--violet), var(--gold));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.55;
  animation: rotateBorder 6s linear infinite;
}
@property --angle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@keyframes rotateBorder { to { --angle: 360deg; } }

/* ---- Button ripple ---- */
.btn { position: relative; overflow: hidden; }
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  transform: scale(0);
  animation: rippleAnim 0.6s ease-out;
  pointer-events: none;
}
body.light .ripple { background: rgba(10,15,30,0.18); }
@keyframes rippleAnim { to { transform: scale(3); opacity: 0; } }

/* ---- Stat icon pulse glow ---- */
.stat-icon { position: relative; }
.stat-card:hover .stat-icon::before {
  content: "";
  position: absolute; inset: -6px; border-radius: 12px;
  background: inherit; filter: blur(10px); opacity: 0.6; z-index: -1;
  animation: iconPulse 1.6s ease-in-out infinite;
}
@keyframes iconPulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 0.75; } }

/* ---- Sidebar active item: sliding glow indicator ---- */
.nav-item { position: relative; }
.nav-item.active::before {
  content: "";
  position: absolute; left: -16px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 60%; border-radius: 0 4px 4px 0;
  background: linear-gradient(var(--gold), var(--emerald));
  box-shadow: 0 0 12px rgba(198,161,91,0.6);
}

/* ---- Toast: nicer slide-in with left accent ---- */
.toast-item {
  border-left: 3px solid var(--gold);
  animation: toastIn 0.35s cubic-bezier(0.16,1,0.3,1) both;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }

/* ---- Budget progress bar: animated fill-in ---- */
.budget-bar-track { background: var(--raised); border-radius: 999px; height: 10px; overflow: hidden; }
.budget-bar-fill {
  height: 100%; border-radius: 999px; width: 0;
  transition: width 1.1s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---- Over-budget cards: gentle attention-drawing glow ---- */
.budget-over-pulse {
  border: 1px solid color-mix(in srgb, var(--crimson) 45%, var(--border));
  animation: budgetOverGlow 2.4s ease-in-out infinite;
}
@keyframes budgetOverGlow {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--crimson) 22%, transparent); }
  50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--crimson) 0%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .budget-over-pulse { animation: none; }
}

/* ---- Modal entrance ---- */
.modal { animation: modalIn 0.3s cubic-bezier(0.16,1,0.3,1) both; }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-overlay { animation: overlayIn 0.25s ease both; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

/* ---- Brand mark: subtle shimmer sweep ---- */
.brand-mark { position: relative; overflow: hidden; }
.brand-mark::after {
  content: "";
  position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,0.5), transparent);
  animation: shimmerSweep 3.5s ease-in-out infinite;
}
@keyframes shimmerSweep { 0% { left: -60%; } 50%, 100% { left: 130%; } }

@media (prefers-reduced-motion: reduce) {
  .nw-hero::before, .brand-mark::after, .stat-card:hover .stat-icon::before { animation: none; }
  body.page-enter, body.page-exit { opacity: 1; transform: none; }
}

/* =========================================================
   ADVANCED INTERACTION SYSTEM (JS-driven, works on touch + mouse)
   ========================================================= */

/* ---- 3D tilt + zoom, driven by JS pointer tracking (reliable everywhere) ---- */
.glass-hover {
  --rx: 0deg; --ry: 0deg;
  transform: perspective(900px) rotateX(0) rotateY(0) translateY(0) scale(1);
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.3s ease, box-shadow 0.4s ease;
  will-change: transform;
}
.glass-hover.is-hovering {
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry)) translateY(-7px) scale(1.028);
  border-color: color-mix(in srgb, var(--gold) 50%, transparent);
  box-shadow: 0 24px 50px rgba(0,0,0,0.32);
}
body.light .glass-hover.is-hovering { box-shadow: 0 24px 50px rgba(20,24,31,0.16); }

/* ---- Touch/click press feedback — the "mobile feel" ---- */
.glass-hover.is-pressed, .btn.is-pressed, .icon-btn.is-pressed, .nav-item.is-pressed {
  transform: scale(0.965) !important;
  transition: transform 0.12s ease !important;
}

/* ---- Page-level cursor glow (desktop only, follows mouse anywhere) ---- */
#cursorGlow {
  position: fixed; top: 0; left: 0; width: 420px; height: 420px;
  border-radius: 50%; pointer-events: none; z-index: 9999;
  background: radial-gradient(circle, rgba(198,161,91,0.10), rgba(47,174,122,0.05) 45%, transparent 70%);
  transform: translate(-50%, -50%);
  opacity: 0; transition: opacity 0.4s ease;
  mix-blend-mode: screen;
}
body.light #cursorGlow { mix-blend-mode: multiply; background: radial-gradient(circle, rgba(198,161,91,0.14), rgba(47,174,122,0.07) 45%, transparent 70%); }
#cursorGlow.is-active { opacity: 1; }

/* ---- Buttons/icons/nav items also get tilt-free zoom via JS classes ---- */
.btn.is-hovering { transform: translateY(-2px) scale(1.035); }
.icon-btn.is-hovering, .icon-action.is-hovering { transform: scale(1.15); }
.nav-item.is-hovering:not(.active) { background: var(--raised); transform: translateX(3px); }

/* ---- Scroll-reveal entrance (cards animate in as you scroll — great on mobile) ---- */
.reveal-on-scroll { opacity: 0; transform: translateY(18px); transition: opacity 0.6s cubic-bezier(0.16,1,0.3,1), transform 0.6s cubic-bezier(0.16,1,0.3,1); }
.reveal-on-scroll.in-view { opacity: 1; transform: translateY(0); }

/* ---- Form submit loading state (prevents double-submit, feels premium) ---- */
.btn.is-loading { pointer-events: none; opacity: 0.75; }
.btn.is-loading::before {
  content: "";
  display: inline-block; width: 14px; height: 14px; margin-right: 8px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin 0.7s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Mobile: bigger, more forgiving tap targets + snappier feedback ---- */
@media (pointer: coarse) {
  .btn, .nav-item, .icon-action { touch-action: manipulation; }
  .glass-hover.is-hovering { transform: scale(1.015); } /* skip tilt on touch, just a gentle pop */
}

@media (prefers-reduced-motion: reduce) {
  .glass-hover, .glass-hover.is-hovering, .btn.is-hovering { transition: none; transform: none; }
  #cursorGlow { display: none; }
}
