/* ═══════════════════════════════════════════════════════════════
   SÉRAPH MONACO — Luxury Finance Dashboard
   Design System: Warm Ivory + Beige + Champagne Gold
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Design Tokens ─────────────────────────────────────────────── */
:root {
  /* Core backgrounds — warm ivory */
  --bg-void:       #f0ece4;
  --bg-surface:    #f6f2eb;
  --bg-elevated:   #fdfbf7;
  --bg-input:      #eeeadf;
  --bg-hover:      #e8e2d6;

  /* Gold palette — champagne spectrum */
  --gold-deep:     #5a3d0e;
  --gold-mid:      #8b6218;
  --gold-bright:   #a87c28;
  --gold-pale:     #c9a84c;
  --gold-glow:     rgba(139,98,24,0.12);
  --gold-glow-lg:  rgba(139,98,24,0.06);
  --gold-glow-xl:  rgba(139,98,24,0.03);

  /* Text tones */
  --platinum:      #1c1814;
  --platinum-sub:  #4a3f34;
  --platinum-muted:#8a7d72;
  --platinum-faint:#ddd5c8;

  /* Semantic colors */
  --green:         #2d7a56;
  --green-bg:      rgba(45,122,86,0.09);
  --red:           #b83232;
  --red-bg:        rgba(184,50,50,0.09);
  --blue:          #2970a8;
  --purple:        #6b42ad;
  --orange:        #c4733a;

  /* Glass system */
  --glass-bg:      rgba(253,251,247,0.92);
  --glass-border:  rgba(139,98,24,0.14);
  --glass-border-hover: rgba(139,98,24,0.34);
  --glass-blur:    blur(32px);
  --glass-blur-sm: blur(16px);

  /* Typography */
  --font-display:  'Cormorant Garamond', 'Playfair Display', Georgia, serif;
  --font-body:     'Inter', system-ui, sans-serif;
  --font-mono:     'JetBrains Mono', monospace;

  /* Radii */
  --radius-sm:  6px;
  --radius-md:  14px;
  --radius-lg:  22px;
  --radius-xl:  36px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-card:       0 2px 16px rgba(80,55,20,0.08), 0 0 0 1px var(--glass-border);
  --shadow-card-hover: 0 8px 36px rgba(80,55,20,0.14), 0 0 0 1px var(--glass-border-hover);
  --shadow-modal:      0 24px 80px rgba(80,55,20,0.22), 0 0 0 1px rgba(139,98,24,0.12);
  --shadow-glow:       0 0 40px rgba(139,98,24,0.20);
  --shadow-glow-sm:    0 0 20px rgba(139,98,24,0.14);
  --shadow-btn:        0 4px 14px rgba(80,55,20,0.30);
  --shadow-inset:      inset 0 1px 0 rgba(255,255,255,0.7);

  /* Motion */
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast:  140ms;
  --duration-mid:   320ms;
  --duration-slow:  600ms;
  --duration-xl:    900ms;
}

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; font-size: 15px; }
body {
  height: 100%;
  background: var(--bg-void);
  color: var(--platinum);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img, svg { display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }
a { color: var(--gold-mid); text-decoration: none; }

/* ── Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(201,168,76,0.2);
  border-radius: 2px;
  transition: background var(--duration-fast);
}
::-webkit-scrollbar-thumb:hover { background: rgba(201,168,76,0.45); }

/* ── Background texture for main app ───────────────────────────── */
body::after {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none; z-index: -1;
  background:
    radial-gradient(ellipse 70% 50% at 50% 100%, rgba(201,168,76,0.03) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 0% 50%, rgba(100,80,200,0.02) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 100% 20%, rgba(201,168,76,0.02) 0%, transparent 60%);
}

/* ═══════════════════════════════════════════════════════════════
   AUTH SCREEN — Cinematic first impression
   ═══════════════════════════════════════════════════════════════ */
#auth-screen {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-void);
  overflow: hidden;
}

/* Deep ambient light — static base */
#auth-screen::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 90% 70% at 50% 110%, rgba(201,168,76,0.11) 0%, transparent 65%),
    radial-gradient(ellipse 50% 40% at 15% 15%,  rgba(201,168,76,0.05) 0%, transparent 55%),
    radial-gradient(ellipse 40% 35% at 85% 85%,  rgba(180,140,50,0.04) 0%, transparent 50%);
  pointer-events: none;
}

/* Animated conic orbs */
.auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  mix-blend-mode: multiply;
}
.auth-orb-1 {
  width: 700px; height: 700px;
  bottom: -280px; left: 50%;
  transform: translateX(-50%);
  background: conic-gradient(
    from 0deg,
    rgba(201,168,76,0.0)  0deg,
    rgba(201,168,76,0.12) 60deg,
    rgba(232,196,106,0.18) 120deg,
    rgba(201,168,76,0.08) 180deg,
    rgba(150,110,30,0.10) 240deg,
    rgba(201,168,76,0.0)  360deg
  );
  animation: orbRotate 28s linear infinite;
}
.auth-orb-2 {
  width: 500px; height: 500px;
  top: -150px; left: -100px;
  background: radial-gradient(circle, rgba(201,168,76,0.09) 0%, rgba(201,168,76,0.03) 50%, transparent 70%);
  animation: orbDrift1 20s ease-in-out infinite alternate;
}
.auth-orb-3 {
  width: 400px; height: 400px;
  top: -100px; right: -80px;
  background: radial-gradient(circle, rgba(232,196,106,0.06) 0%, transparent 65%);
  animation: orbDrift2 25s ease-in-out infinite alternate;
}
.auth-orb-4 {
  width: 600px; height: 300px;
  top: 40%; left: 50%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse, rgba(201,168,76,0.05) 0%, transparent 70%);
  filter: blur(60px);
  animation: orbPulse 8s ease-in-out infinite;
}

@keyframes orbRotate {
  to { transform: translateX(-50%) rotate(360deg); }
}
@keyframes orbDrift1 {
  from { transform: translate(0, 0) scale(1); opacity: 0.7; }
  to   { transform: translate(60px, 80px) scale(1.15); opacity: 1; }
}
@keyframes orbDrift2 {
  from { transform: translate(0, 0) scale(1.1); opacity: 0.8; }
  to   { transform: translate(-50px, 60px) scale(0.9); opacity: 0.5; }
}
@keyframes orbPulse {
  0%, 100% { opacity: 0.4; transform: translateX(-50%) scaleY(1); }
  50%       { opacity: 1;   transform: translateX(-50%) scaleY(1.3); }
}

/* Particles */
.auth-particles { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.particle {
  position: absolute;
  width: 2px; height: 2px;
  border-radius: 50%;
  background: var(--gold-bright);
  opacity: 0;
  animation: floatParticle var(--dur, 8s) var(--delay, 0s) infinite ease-in-out;
  box-shadow: 0 0 4px 1px rgba(232,196,106,0.4);
}
@keyframes floatParticle {
  0%   { opacity: 0; transform: translateY(0) scale(1); }
  15%  { opacity: 0.8; }
  80%  { opacity: 0.15; }
  100% { opacity: 0; transform: translateY(-130vh) scale(0.4); }
}

/* Brand mark above panel */
.auth-brand {
  position: absolute;
  top: 52px; left: 50%; transform: translateX(-50%);
  text-align: center;
  z-index: 2;
}
.auth-logo-text {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 300;
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: var(--gold-bright);
  text-shadow: 0 0 40px rgba(201,168,76,0.5), 0 0 80px rgba(201,168,76,0.2);
}
.auth-tagline {
  font-size: 0.68rem;
  letter-spacing: 0.28em;
  color: var(--platinum-muted);
  text-transform: uppercase;
  margin-top: 6px;
}

/* Panel itself */
.auth-panel {
  position: relative; z-index: 2;
  width: min(460px, calc(100vw - 40px));
  background: rgba(253,251,247,0.96);
  backdrop-filter: blur(48px) saturate(1.2);
  -webkit-backdrop-filter: blur(48px) saturate(1.2);
  border: 1px solid rgba(139,98,24,0.18);
  border-top: 1px solid rgba(201,168,76,0.40);
  border-radius: var(--radius-lg);
  box-shadow:
    0 24px 80px rgba(80,55,20,0.18),
    0 0 60px rgba(139,98,24,0.06),
    inset 0 1px 0 rgba(255,255,255,0.9),
    inset 0 -1px 0 rgba(139,98,24,0.06);
  padding: 52px 44px 44px;
  margin-top: 88px;
}

/* Shimmer accent line at top */
.auth-panel::before {
  content: '';
  position: absolute;
  top: -1px; left: 50%; transform: translateX(-50%);
  width: 160px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-pale), var(--gold-bright), var(--gold-pale), transparent);
  animation: shimmerLine 4s ease-in-out infinite;
}
/* Inner ambient glow */
.auth-panel::after {
  content: '';
  position: absolute;
  top: 0; left: 50%; transform: translateX(-50%);
  width: 200px; height: 80px;
  background: radial-gradient(ellipse, rgba(201,168,76,0.07) 0%, transparent 70%);
  pointer-events: none;
}

@keyframes shimmerLine {
  0%, 100% { opacity: 0.6; width: 120px; }
  50%       { opacity: 1;   width: 200px; }
}

.auth-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 300;
  color: var(--gold-pale);
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
  text-shadow: 0 0 60px rgba(201,168,76,0.25);
}
.auth-subtitle {
  font-size: 0.78rem;
  color: var(--platinum-muted);
  text-align: center;
  margin-bottom: 40px;
  letter-spacing: 0.08em;
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--platinum-faint);
  margin-bottom: 36px;
  position: relative;
}
.auth-tab {
  flex: 1; padding: 10px; text-align: center;
  font-size: 0.78rem; font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--platinum-muted);
  cursor: pointer;
  border: none; border-bottom: 2px solid transparent;
  background: transparent;
  margin-bottom: -1px;
  font-family: var(--font-body);
  transition: all var(--duration-fast) var(--ease-in-out);
}
.auth-tab.active {
  color: var(--gold-bright);
  border-bottom-color: var(--gold-mid);
  text-shadow: 0 0 20px rgba(232,196,106,0.4);
}

.auth-form { display: flex; flex-direction: column; gap: 18px; }
.auth-switch {
  text-align: center;
  font-size: 0.75rem;
  color: var(--platinum-muted);
  margin-top: 4px;
}
.auth-switch span {
  color: var(--gold-mid);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.auth-switch span:hover { color: var(--gold-bright); }
.form-group { display: flex; flex-direction: column; gap: 7px; }
.form-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--platinum-muted);
}
.form-input {
  background: var(--bg-input);
  border: 1px solid rgba(139,98,24,0.15);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  color: var(--platinum);
  font-size: 0.9rem;
  transition:
    border-color var(--duration-fast) var(--ease-in-out),
    box-shadow   var(--duration-fast) var(--ease-in-out),
    background   var(--duration-fast);
  outline: none;
}
.form-input:hover {
  border-color: rgba(139,98,24,0.28);
  background: var(--bg-elevated);
}
.form-input:focus {
  border-color: var(--gold-mid);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 3px rgba(139,98,24,0.10), 0 0 12px rgba(139,98,24,0.06);
}
.form-input::placeholder { color: var(--platinum-muted); }

.auth-error {
  background: rgba(217,112,112,0.08);
  border: 1px solid rgba(217,112,112,0.28);
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  font-size: 0.82rem;
  color: var(--red);
  display: none;
}
.auth-error.show { display: block; }

/* ═══════════════════════════════════════════════════════════════
   BUTTONS — Jewel-quality interactions
   ═══════════════════════════════════════════════════════════════ */
.btn-primary {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #d4a84c 0%, #c9a84c 40%, #8b6914 100%);
  color: #050505;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 15px 28px;
  border-radius: var(--radius-sm);
  box-shadow:
    var(--shadow-btn),
    0 0 40px rgba(201,168,76,0.25),
    inset 0 1px 0 rgba(255,255,255,0.25),
    inset 0 -1px 0 rgba(0,0,0,0.2);
  transition:
    transform var(--duration-fast) var(--ease-spring),
    box-shadow var(--duration-mid);
}
/* Shimmer sweep */
.btn-primary::before {
  content: '';
  position: absolute; top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(255,255,255,0.32) 50%,
    transparent 70%
  );
  transition: left 0.7s var(--ease-out);
}
/* Subtle top highlight */
.btn-primary::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, transparent 50%);
  pointer-events: none;
}
.btn-primary:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow:
    0 10px 36px rgba(80,55,20,0.30),
    var(--shadow-glow),
    inset 0 1px 0 rgba(255,255,255,0.3),
    inset 0 -1px 0 rgba(0,0,0,0.15);
}
.btn-primary:hover::before { left: 150%; }
.btn-primary:active { transform: translateY(0) scale(0.99); }

.btn-ghost {
  background: transparent;
  color: var(--gold-mid);
  border: 1px solid rgba(201,168,76,0.3);
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  transition: all var(--duration-mid) var(--ease-out);
}
.btn-ghost:hover {
  background: var(--gold-glow);
  border-color: var(--gold-mid);
  color: var(--gold-bright);
  box-shadow: 0 0 20px rgba(201,168,76,0.12);
}

.btn-danger {
  background: rgba(217,112,112,0.08);
  color: var(--red);
  border: 1px solid rgba(217,112,112,0.25);
  font-size: 0.78rem;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast);
}
.btn-danger:hover {
  background: rgba(217,112,112,0.18);
  border-color: rgba(217,112,112,0.45);
  box-shadow: 0 0 15px rgba(217,112,112,0.12);
}

.btn-icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--platinum-muted);
  transition: all var(--duration-fast);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--gold-mid); }
.btn-icon.danger:hover { background: var(--red-bg); color: var(--red); }

/* ═══════════════════════════════════════════════════════════════
   MAIN APP LAYOUT
   ═══════════════════════════════════════════════════════════════ */
#app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
#app.hidden { display: none; }

/* ── Header ─────────────────────────────────────────────────────── */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 36px;
  height: 66px;
  background: rgba(253,251,247,0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(139,98,24,0.14);
  flex-shrink: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(139,98,24,0.08), 0 2px 16px rgba(80,55,20,0.08);
}
.header-brand {
  display: flex; align-items: center; gap: 14px;
}
.header-logo {
  width: 36px; height: 36px;
  background: linear-gradient(145deg, var(--gold-bright), var(--gold-mid), var(--gold-deep));
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: #030303;
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(201,168,76,0.35), inset 0 1px 0 rgba(255,255,255,0.2);
}
.header-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 300;
  letter-spacing: 0.18em;
  color: var(--gold-mid);
  text-shadow: none;
}
.header-subtitle {
  font-size: 0.62rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--platinum-muted);
  margin-top: 1px;
}

.header-right {
  display: flex; align-items: center; gap: 18px;
}
.header-date {
  font-size: 0.73rem;
  color: var(--platinum-muted);
  letter-spacing: 0.06em;
}
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.82rem;
  color: #030303;
  cursor: pointer;
  border: 2px solid var(--gold-deep);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}
.user-avatar:hover {
  border-color: var(--gold-mid);
  box-shadow: 0 0 16px rgba(201,168,76,0.3);
}

/* ── Navigation — pill indicator system ────────────────────────── */
.app-nav {
  display: flex; align-items: center; gap: 3px;
  padding: 10px 36px;
  background: rgba(246,242,235,0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(139,98,24,0.10);
  flex-shrink: 0;
  overflow-x: auto;
  box-shadow: 0 1px 8px rgba(80,55,20,0.06);
}
.app-nav::-webkit-scrollbar { height: 0; }

.nav-tab {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 0.78rem; font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--platinum-muted);
  white-space: nowrap;
  transition:
    color var(--duration-fast),
    background var(--duration-mid) var(--ease-out),
    box-shadow var(--duration-mid),
    transform var(--duration-fast) var(--ease-spring);
  border: 1px solid transparent;
  position: relative;
}
.nav-tab:hover {
  color: var(--platinum-sub);
  background: rgba(0,0,0,0.05);
  transform: translateY(-1px);
}
.nav-tab.active {
  background: rgba(139,98,24,0.10);
  border-color: rgba(139,98,24,0.28);
  color: var(--gold-mid);
  box-shadow: 0 0 12px rgba(139,98,24,0.10), inset 0 0 8px rgba(139,98,24,0.05);
  text-shadow: none;
}
.nav-tab svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ── Main Content ───────────────────────────────────────────────── */
.app-main {
  flex: 1; overflow-y: auto;
  padding: 36px;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(139,98,24,0.04) 0%, transparent 60%),
    var(--bg-void);
}

.view {
  display: none;
  animation: fadeIn 0.35s var(--ease-out);
}
.view.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ── Page Headers ───────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 32px;
}
.page-title {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 300;
  color: var(--gold-pale);
  line-height: 1.1;
  letter-spacing: 0.01em;
  text-shadow: 0 0 80px rgba(201,168,76,0.15);
}
.page-subtitle {
  font-size: 0.75rem;
  color: var(--platinum-muted);
  margin-top: 5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── Cards — deep glassmorphism ─────────────────────────────────── */
.card {
  background: linear-gradient(
    145deg,
    rgba(253,251,247,0.97) 0%,
    rgba(248,244,238,0.99) 100%
  );
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 26px;
  position: relative;
  overflow: hidden;
  transition:
    box-shadow var(--duration-mid),
    border-color var(--duration-mid),
    transform var(--duration-mid) var(--ease-out);
}
/* Subtle noise texture overlay */
.card::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: var(--radius-md);
  background: 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='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  opacity: 0.4;
}
/* Animated gold shimmer border on hover */
.card:hover {
  border-color: rgba(201,168,76,0.32);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.card-title {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--platinum-muted);
  margin-bottom: 18px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px;
}

/* ── KPI Cards — high-end display ───────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}
.kpi-card {
  background: linear-gradient(
    155deg,
    rgba(253,251,247,0.98) 0%,
    rgba(248,244,238,1) 60%,
    rgba(244,239,231,1) 100%
  );
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 26px;
  position: relative;
  overflow: hidden;
  transition:
    transform var(--duration-mid) var(--ease-spring),
    box-shadow var(--duration-mid),
    border-color var(--duration-mid);
}
/* Top accent stripe */
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--kpi-color, var(--gold-mid)) 30%,
    var(--gold-bright) 50%,
    var(--kpi-color, var(--gold-mid)) 70%,
    transparent 100%
  );
  opacity: 0.7;
}
/* Inner ambient light from top stripe */
.kpi-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 60px;
  background: linear-gradient(180deg, rgba(201,168,76,0.04) 0%, transparent 100%);
  pointer-events: none;
}
.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
  border-color: rgba(139,98,24,0.26);
}

.kpi-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--platinum-muted);
  margin-bottom: 14px;
}
.kpi-value {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 300;
  color: var(--gold-mid);
  line-height: 1;
  letter-spacing: -0.02em;
}
.kpi-value.positive { color: var(--green); }
.kpi-value.negative { color: var(--red); }
@keyframes kpiPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.85; }
}

.kpi-sub {
  font-size: 0.73rem;
  color: var(--platinum-muted);
  margin-top: 10px;
  letter-spacing: 0.02em;
}
.kpi-icon {
  position: absolute;
  bottom: 20px; right: 20px;
  opacity: 0.08;
}
.kpi-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--green-bg);
  color: var(--green);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  margin-top: 10px;
  letter-spacing: 0.04em;
}
.kpi-badge.neg { background: var(--red-bg); color: var(--red); }

/* ── Grid Layouts ───────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 22px; }
.grid-3-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 22px; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 22px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }

/* ── Charts ─────────────────────────────────────────────────────── */
.chart-container { position: relative; }
.chart-container canvas { width: 100% !important; }

/* ── Sankey ─────────────────────────────────────────────────────── */
#sankey-svg { width: 100%; overflow: visible; }
.sankey-node rect { rx: 4; }
.sankey-link { fill: none; }

/* ── Heatmap ────────────────────────────────────────────────────── */
.heatmap-container { overflow-x: auto; padding-bottom: 8px; }
.heatmap-month-labels {
  display: flex; gap: 2px;
  font-size: 0.63rem; color: var(--platinum-muted);
  margin-bottom: 4px;
  margin-left: 28px;
  letter-spacing: 0.06em;
}
.heatmap-grid { display: flex; gap: 3px; align-items: flex-start; }
.heatmap-day-labels {
  display: flex; flex-direction: column; gap: 3px;
  font-size: 0.6rem; color: var(--platinum-muted);
  margin-right: 4px;
  margin-top: 2px;
}
.heatmap-day-label { height: 13px; line-height: 13px; }
.heatmap-week { display: flex; flex-direction: column; gap: 3px; }
.heatmap-cell {
  width: 13px; height: 13px;
  border-radius: 2px;
  background: rgba(0,0,0,0.07);
  cursor: pointer;
  transition: transform var(--duration-fast), box-shadow var(--duration-fast);
  position: relative;
}
.heatmap-cell:hover {
  transform: scale(1.5);
  z-index: 10;
  box-shadow: 0 0 8px rgba(201,168,76,0.4);
}

/* ── Tables — refined elegance ──────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--platinum-muted);
  padding: 11px 18px;
  border-bottom: 1px solid rgba(139,98,24,0.12);
  white-space: nowrap;
  background: rgba(139,98,24,0.03);
}
.data-table td {
  padding: 13px 18px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  font-size: 0.84rem;
  color: var(--platinum);
  vertical-align: middle;
  transition: background var(--duration-fast), color var(--duration-fast);
}
/* Very subtle zebra */
.data-table tbody tr:nth-child(even) td {
  background: rgba(0,0,0,0.02);
}
.data-table tr:hover td {
  background: rgba(139,98,24,0.04);
  color: var(--platinum-sub);
}
.data-table tr:hover td:first-child {
  border-left: 2px solid var(--gold-mid);
  padding-left: 16px;
  box-shadow: inset 4px 0 12px rgba(201,168,76,0.06);
}
.data-table .mono { font-family: var(--font-mono); font-size: 0.8rem; }
.data-table .positive { color: var(--green); }
.data-table .negative { color: var(--red); }

/* ── Category & Badge components ───────────────────────────────── */
.cat-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; flex-shrink: 0;
}
.cat-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,0.05);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: var(--radius-full);
  padding: 3px 10px;
  font-size: 0.74rem;
  transition: background var(--duration-fast);
}
.cat-chip:hover { background: rgba(0,0,0,0.08); }
.type-badge {
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: var(--radius-full);
}
.type-badge.income { background: var(--green-bg); color: var(--green); }
.type-badge.expense { background: var(--red-bg); color: var(--red); }

/* ── Filters ────────────────────────────────────────────────────── */
.filter-bar {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.filter-select {
  background: var(--bg-elevated);
  border: 1px solid rgba(139,98,24,0.18);
  border-radius: var(--radius-sm);
  color: var(--platinum);
  padding: 9px 14px;
  font-size: 0.8rem;
  outline: none;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}
.filter-select:focus {
  border-color: var(--gold-mid);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.1);
}
.search-input {
  background: var(--bg-elevated);
  border: 1px solid rgba(139,98,24,0.18);
  border-radius: var(--radius-sm);
  color: var(--platinum);
  padding: 9px 16px;
  font-size: 0.8rem;
  outline: none;
  width: 230px;
  transition:
    border-color var(--duration-fast),
    box-shadow var(--duration-fast),
    background var(--duration-fast);
}
.search-input:hover { border-color: rgba(201,168,76,0.28); }
.search-input:focus {
  border-color: var(--gold-mid);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 3px rgba(139,98,24,0.10);
}
.search-input::placeholder { color: var(--platinum-muted); }

/* ── Budget Bars ────────────────────────────────────────────────── */
.budget-list { display: flex; flex-direction: column; gap: 18px; }
.budget-item { }
.budget-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; }
.budget-name { font-size: 0.85rem; font-weight: 500; }
.budget-amounts { font-size: 0.74rem; color: var(--platinum-muted); font-family: var(--font-mono); }
.budget-track {
  height: 5px;
  background: rgba(0,0,0,0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.budget-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--gold-deep), var(--gold-mid), var(--gold-bright));
  transition: width 1s var(--ease-out);
  box-shadow: 0 0 8px rgba(201,168,76,0.4);
}
.budget-fill.over { background: linear-gradient(90deg, #6b1a1a, var(--red)); box-shadow: 0 0 8px rgba(217,112,112,0.4); }
.budget-pct { font-size: 0.68rem; color: var(--platinum-muted); margin-top: 5px; text-align: right; }
.budget-pct.over { color: var(--red); }

/* ── Goals / Progress Rings ─────────────────────────────────────── */
.goals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.goal-card {
  background: linear-gradient(145deg, rgba(253,251,247,0.97), rgba(246,242,235,1));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 26px;
  display: flex; flex-direction: column; align-items: center;
  gap: 16px;
  text-align: center;
  transition:
    transform var(--duration-mid) var(--ease-spring),
    box-shadow var(--duration-mid),
    border-color var(--duration-mid);
  cursor: pointer;
}
.goal-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
  border-color: rgba(201,168,76,0.3);
}
.goal-card.completed { opacity: 0.6; }

.goal-ring { position: relative; width: 120px; height: 120px; }
.goal-ring svg { transform: rotate(-90deg); }
.goal-ring-track { fill: none; stroke: rgba(0,0,0,0.08); stroke-width: 8; }
.goal-ring-fill {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 339.3;
  stroke-dashoffset: 339.3;
  transition: stroke-dashoffset 1.4s var(--ease-out);
  filter: drop-shadow(0 0 4px currentColor);
}
.goal-ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
}
.goal-ring-pct {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 300;
  color: var(--gold-pale);
  line-height: 1;
}
.goal-ring-label { font-size: 0.58rem; color: var(--platinum-muted); letter-spacing: 0.14em; text-transform: uppercase; }
.goal-name { font-size: 0.9rem; font-weight: 500; color: var(--platinum); }
.goal-amounts { font-size: 0.74rem; color: var(--platinum-muted); font-family: var(--font-mono); }
.goal-deadline { font-size: 0.7rem; color: var(--platinum-muted); }
.goal-deadline.urgent { color: var(--orange); }
.goal-contrib { display: flex; gap: 8px; margin-bottom: 10px; }
.goal-actions { display: flex; gap: 8px; }

/* ── Forecast ───────────────────────────────────────────────────── */
.scenario-cards { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; margin-bottom: 26px; }
.scenario-card {
  background: linear-gradient(145deg, rgba(17,17,28,0.95), rgba(12,12,20,0.98));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 26px;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: transform var(--duration-mid), box-shadow var(--duration-mid);
}
.scenario-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); }
.scenario-card.realistic  { border-top: 2px solid var(--gold-mid); }
.scenario-card.pessimistic { border-top: 2px solid var(--red); }
.scenario-card.optimistic  { border-top: 2px solid var(--green); }
.scenario-label {
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.scenario-card.realistic .scenario-label  { color: var(--gold-mid); }
.scenario-card.pessimistic .scenario-label { color: var(--red); }
.scenario-card.optimistic .scenario-label  { color: var(--green); }
.scenario-value {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 300;
  color: var(--gold-pale);
}

/* ── Net Worth — hero display ───────────────────────────────────── */
.nw-hero {
  text-align: center; padding: 56px 28px;
  background: linear-gradient(
    160deg,
    var(--bg-elevated) 0%,
    var(--bg-surface) 100%
  );
  border: 1px solid rgba(139,98,24,0.16);
  border-radius: var(--radius-md);
  margin-bottom: 22px;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255,255,255,0.9);
}
.nw-hero::before {
  content: '';
  position: absolute; bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 400px; height: 200px;
  background: radial-gradient(ellipse at bottom, rgba(201,168,76,0.1), transparent 70%);
  pointer-events: none;
}
.nw-hero::after {
  content: '';
  position: absolute; top: 0; left: 50%;
  transform: translateX(-50%);
  width: 300px; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(201,168,76,0.5), transparent);
  pointer-events: none;
}
.nw-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--platinum-muted);
  margin-bottom: 18px;
}
.nw-value {
  font-family: var(--font-display);
  font-size: 4.2rem;
  font-weight: 300;
  color: var(--gold-pale);
  letter-spacing: -0.02em;
  text-shadow: 0 0 100px rgba(201,168,76,0.2), 0 0 40px rgba(201,168,76,0.1);
  animation: kpiPulse 8s ease-in-out infinite;
}
.nw-breakdown { display: flex; justify-content: center; gap: 56px; margin-top: 28px; }
.nw-item { text-align: center; }
.nw-item-value {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 300;
}
.nw-item-value.pos { color: var(--green); }
.nw-item-value.neg { color: var(--red); }
.nw-item-label {
  font-size: 0.66rem;
  color: var(--platinum-muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-top: 5px;
}

/* ── Investments ────────────────────────────────────────────────── */
.inv-summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.inv-summary-card {
  background: linear-gradient(145deg, var(--bg-elevated), var(--bg-surface));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 18px;
  transition: transform var(--duration-fast), border-color var(--duration-mid);
}
.inv-summary-card:hover { transform: translateY(-2px); border-color: rgba(201,168,76,0.28); }
.inv-summary-label { font-size: 0.65rem; color: var(--platinum-muted); text-transform: uppercase; letter-spacing: 0.14em; margin-bottom: 8px; }
.inv-summary-value { font-family: var(--font-display); font-size: 1.55rem; font-weight: 300; color: var(--gold-pale); }

/* ── Modals ─────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(60,45,25,0.55);
  backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity var(--duration-mid);
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }

.modal-panel {
  width: min(620px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: linear-gradient(160deg, #fdfbf7, #f8f4ee);
  border: 1px solid rgba(139,98,24,0.18);
  border-top: 2px solid rgba(139,98,24,0.35);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow:
    0 -8px 48px rgba(80,55,20,0.18),
    inset 0 1px 0 rgba(255,255,255,0.8);
  padding: 36px;
  transform: translateY(50px);
  transition: transform var(--duration-slow) var(--ease-out);
}
.modal-backdrop.open .modal-panel { transform: translateY(0); }

.modal-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 300;
  color: var(--gold-mid);
  margin-bottom: 28px;
  letter-spacing: 0.02em;
}
.modal-form { display: flex; flex-direction: column; gap: 18px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 10px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-select {
  background: var(--bg-elevated);
  border: 1px solid rgba(139,98,24,0.18);
  border-radius: var(--radius-sm);
  color: var(--platinum);
  padding: 13px 16px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236e6d6a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 38px;
}
.form-select:focus {
  border-color: var(--gold-mid);
  box-shadow: 0 0 0 3px rgba(139,98,24,0.10);
}
.form-select option { background: var(--bg-elevated); }

/* ── Pagination ─────────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 22px 0;
}
.page-btn {
  min-width: 36px; height: 36px;
  padding: 0 12px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--platinum-muted);
  transition: all var(--duration-fast);
  border: 1px solid transparent;
}
.page-btn:hover {
  background: var(--bg-hover);
  color: var(--platinum);
  border-color: rgba(201,168,76,0.15);
}
.page-btn.active {
  background: rgba(201,168,76,0.1);
  color: var(--gold-bright);
  border: 1px solid rgba(201,168,76,0.3);
  box-shadow: 0 0 16px rgba(201,168,76,0.1);
}
.page-btn:disabled { opacity: 0.35; pointer-events: none; }

/* ── Settings ───────────────────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.settings-section { }
.settings-title {
  font-size: 0.67rem; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gold-mid);
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(201,168,76,0.15);
}
.cat-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(255,255,255,0.025);
  transition: background var(--duration-fast);
}
.cat-row:hover { background: rgba(255,255,255,0.02); }
.cat-color-swatch {
  width: 24px; height: 24px;
  border-radius: 5px;
  flex-shrink: 0;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.12);
  transition: transform var(--duration-fast), box-shadow var(--duration-fast);
}
.cat-color-swatch:hover { transform: scale(1.15); box-shadow: 0 0 8px currentColor; }
.cat-name { flex: 1; font-size: 0.85rem; }

/* ── Loader ─────────────────────────────────────────────────────── */
.loader {
  display: flex; align-items: center; justify-content: center;
  height: 120px; gap: 8px;
}
.loader-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold-mid);
  animation: loaderBounce 1.4s ease-in-out infinite;
  box-shadow: 0 0 8px rgba(201,168,76,0.5);
}
.loader-dot:nth-child(2) { animation-delay: 0.2s; }
.loader-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes loaderBounce {
  0%, 80%, 100% { transform: scale(0.5); opacity: 0.35; }
  40%            { transform: scale(1); opacity: 1; }
}

/* ── Toast ──────────────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 36px; right: 36px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 9999;
}
.toast {
  background: linear-gradient(135deg, var(--bg-elevated), var(--bg-surface));
  border: 1px solid rgba(139,98,24,0.16);
  border-left: 3px solid var(--gold-mid);
  border-radius: var(--radius-md);
  padding: 15px 22px;
  font-size: 0.83rem;
  color: var(--platinum);
  box-shadow: 0 8px 32px rgba(80,55,20,0.14), 0 0 0 1px var(--glass-border);
  animation: toastIn 0.35s var(--ease-out), toastOut 0.35s var(--ease-out) 2.65s forwards;
  min-width: 260px;
  backdrop-filter: blur(20px);
}
.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }
@keyframes toastIn  { from { opacity: 0; transform: translateX(50px) scale(0.97); } }
@keyframes toastOut { to   { opacity: 0; transform: translateX(50px) scale(0.97); } }

/* ── Empty States ───────────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  padding: 72px 20px; text-align: center; gap: 14px;
}
.empty-icon { opacity: 0.18; }
.empty-title { font-size: 1rem; color: var(--platinum-sub); font-weight: 500; letter-spacing: 0.02em; }
.empty-text  { font-size: 0.82rem; color: var(--platinum-muted); }

/* ── Tooltip ────────────────────────────────────────────────────── */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  color: var(--platinum-sub);
  font-size: 0.7rem;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity var(--duration-fast);
  box-shadow: 0 4px 16px rgba(80,55,20,0.12);
  backdrop-filter: blur(8px);
}
[data-tooltip]:hover::after { opacity: 1; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .inv-summary-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .app-main { padding: 22px; }
  .grid-2, .grid-3, .grid-3-1, .grid-1-2 { grid-template-columns: 1fr; }
  .scenario-cards { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .nw-breakdown { gap: 28px; flex-wrap: wrap; }
  .nw-value { font-size: 3rem; }
  .page-title { font-size: 2rem; }
}
@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .goals-grid { grid-template-columns: 1fr 1fr; }
  .app-header { padding: 0 18px; }
  .app-nav { padding: 10px 18px; }
  .page-title { font-size: 1.7rem; }
  .auth-panel { padding: 36px 26px; }
  .auth-orb-1 { width: 400px; height: 400px; }
  .auth-orb-2, .auth-orb-3 { display: none; }
}

/* ── Utility classes ────────────────────────────────────────────── */
.hidden { display: none !important; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.ml-auto { margin-left: auto; }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.gold   { color: var(--gold-mid); }
.green  { color: var(--green); }
.red    { color: var(--red); }
.muted  { color: var(--platinum-muted); }
.mono   { font-family: var(--font-mono); }
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201,168,76,0.15), transparent);
  margin: 22px 0;
}

/* ── Global color transitions ───────────────────────────────────── */
* {
  transition-property: color, background-color, border-color, box-shadow, opacity;
  transition-duration: var(--duration-fast);
  transition-timing-function: var(--ease-in-out);
}
/* Override for elements that already have their own transitions */
.card, .kpi-card, .goal-card, .nav-tab, .btn-primary, .btn-ghost,
.btn-danger, .form-input, .form-select, .filter-select, .search-input,
.modal-panel, .modal-backdrop, .auth-panel {
  transition-property: transform, box-shadow, border-color, background, color, opacity, backdrop-filter;
}

/* ── Bilan du mois ──────────────────────────────────────────────── */
.bilan-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 768px) {
  .bilan-grid { grid-template-columns: 1fr; }
}
.bilan-record {
  padding: 12px 0;
  border-bottom: 1px solid rgba(201,168,76,0.08);
}
.bilan-record:last-child { border-bottom: none; }
.bilan-record-label {
  font-size: 11px;
  color: var(--platinum-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}
.bilan-record-value {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--platinum);
  margin-bottom: 2px;
}
.bilan-record-desc {
  font-size: 12px;
  color: var(--platinum-sub);
}

/* ── Vision Board ───────────────────────────────────────────────── */
.vision-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.vision-card {
  background: var(--bg-elevated);
  border: 1px solid rgba(201,168,76,0.12);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  display: flex;
  gap: 16px;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.vision-card:hover {
  border-color: rgba(139,98,24,0.30);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}
.vision-card.vision-done {
  opacity: 0.65;
  border-color: rgba(116,198,157,0.2);
}
.vision-card.vision-urgent {
  border-color: rgba(245,158,11,0.35);
}
.vision-emoji {
  font-size: 36px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}
.vision-body { flex: 1; min-width: 0; }
.vision-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--gold-pale);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vision-cat {
  font-size: 11px;
  color: var(--platinum-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.vision-desc {
  font-size: 12px;
  color: var(--platinum-sub);
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.vision-date {
  font-size: 12px;
  margin-bottom: 8px;
}
.vision-amounts {
  font-size: 13px;
  margin-bottom: 8px;
  font-family: var(--font-mono);
}
.vision-progress-wrap {
  height: 5px;
  background: rgba(0,0,0,0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.vision-progress-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 1s cubic-bezier(0.16,1,0.3,1);
  min-width: 3px;
}
.vision-monthly {
  font-size: 11px;
  color: var(--platinum-muted);
}
@media (max-width: 600px) {
  .vision-grid { grid-template-columns: 1fr; }
}

/* ── Trading View ───────────────────────────────────────────────── */
.trading-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid rgba(201,168,76,0.12);
  padding-bottom: 0;
}
.trading-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--platinum-muted);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 8px 16px;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.2s, border-color 0.2s;
}
.trading-tab:hover { color: var(--platinum); }
.trading-tab.active { color: var(--gold-mid); border-bottom-color: var(--gold-mid); }

.trading-card {
  background: var(--bg-elevated);
  border: 1px solid rgba(201,168,76,0.1);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
}
.trading-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 20px 12px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  flex-wrap: wrap;
  gap: 12px;
}
.trading-card-body { padding: 16px 20px 20px; }
.trading-card-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--gold-pale);
}
.trading-card-sub { font-size: 12px; color: var(--platinum-muted); margin-top: 2px; }
.trading-stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px,1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.trading-stat { }
.trading-stat-label { font-size: 11px; color: var(--platinum-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 3px; }
.trading-stat-val { font-family: var(--font-mono); font-size: 16px; color: var(--platinum); font-weight: 500; }

.trading-payout-row {
  background: var(--bg-elevated);
  border: 1px solid rgba(116,198,157,0.15);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}
.trading-alloc-tag {
  display: inline-block;
  background: rgba(201,168,76,0.1);
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
  color: var(--platinum-sub);
}

.trading-type-btn {
  background: var(--bg-input);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: var(--radius-sm);
  color: var(--platinum-muted);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.trading-type-btn:hover { border-color: rgba(201,168,76,0.3); color: var(--platinum); }
.trading-type-btn.active { background: rgba(201,168,76,0.12); border-color: rgba(201,168,76,0.4); color: var(--gold-mid); }

.ttab-content { animation: fadeIn 0.2s ease; }

/* ═══════════════════════════════════════════════════════════════
   ANIMATIONS & MICRO-INTERACTIONS
   ═══════════════════════════════════════════════════════════════ */

/* ── Skeleton loading shimmer ───────────────────────────────────── */
@keyframes shimmerSkeleton {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg,
    rgba(0,0,0,0.04) 0%,
    rgba(0,0,0,0.08) 40%,
    rgba(0,0,0,0.04) 80%
  );
  background-size: 800px 100%;
  animation: shimmerSkeleton 1.6s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
.skeleton-text { height: 14px; margin: 6px 0; border-radius: 4px; }
.skeleton-value { height: 32px; width: 60%; margin: 8px 0; border-radius: 6px; }
.skeleton-chart { height: 200px; border-radius: var(--radius-md); }
.skeleton-row { height: 48px; margin: 6px 0; border-radius: var(--radius-sm); }

/* ── Staggered view entry ───────────────────────────────────────── */
@keyframes cardReveal {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
.view.active .card,
.view.active .kpi-card,
.view.active .vision-card,
.view.active .trading-card,
.view.active .bilan-record {
  animation: cardReveal 0.45s var(--ease-out) both;
}
.view.active .card:nth-child(1),  .view.active .kpi-card:nth-child(1)  { animation-delay: 0.04s; }
.view.active .card:nth-child(2),  .view.active .kpi-card:nth-child(2)  { animation-delay: 0.08s; }
.view.active .card:nth-child(3),  .view.active .kpi-card:nth-child(3)  { animation-delay: 0.12s; }
.view.active .card:nth-child(4),  .view.active .kpi-card:nth-child(4)  { animation-delay: 0.16s; }
.view.active .card:nth-child(5),  .view.active .kpi-card:nth-child(5)  { animation-delay: 0.20s; }
.view.active .card:nth-child(n+6)                                        { animation-delay: 0.24s; }

/* ── Progress bar fill animation ────────────────────────────────── */
@keyframes progressFill {
  from { width: 0 !important; }
}
.progress-bar-anim { animation: progressFill 0.9s var(--ease-out) both; }

/* ── Number count-up ────────────────────────────────────────────── */
@keyframes numberReveal {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.num-animate { animation: numberReveal 0.5s var(--ease-out) both; }

/* ── Ripple on primary buttons ──────────────────────────────────── */
.btn-primary { position: relative; overflow: hidden; }
.btn-primary::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.12);
  border-radius: inherit;
  opacity: 0;
  transition: opacity var(--duration-fast);
}
.btn-primary:active::after { opacity: 1; }

/* ── Data table row hover ───────────────────────────────────────── */
.data-table tbody tr {
  transition: background var(--duration-fast), transform var(--duration-fast);
}
.data-table tbody tr:hover {
  transform: translateX(2px);
}

/* ── Floating gold pulse for key metrics ───────────────────────── */
@keyframes goldPulseRing {
  0%   { box-shadow: 0 0 0 0 rgba(201,168,76,0.25); }
  70%  { box-shadow: 0 0 0 10px rgba(201,168,76,0); }
  100% { box-shadow: 0 0 0 0 rgba(201,168,76,0); }
}
.kpi-pulse { animation: goldPulseRing 2.5s ease-out infinite; }

/* ── Modal entrance ─────────────────────────────────────────────── */
@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(28px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}
.modal-backdrop.open .modal-panel {
  animation: modalSlideUp 0.38s var(--ease-spring) both;
}

/* ── Toast improvements ─────────────────────────────────────────── */
@keyframes toastBounce {
  0%   { transform: translateX(60px) scale(0.9); opacity: 0; }
  60%  { transform: translateX(-6px) scale(1.02); opacity: 1; }
  100% { transform: none; opacity: 1; }
}
.toast-item { animation: toastBounce 0.42s var(--ease-spring) both; }

/* ── Shine sweep on card hover ──────────────────────────────────── */
@keyframes shineSweep {
  from { left: -60%; }
  to   { left: 120%; }
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.025), transparent);
  transform: skewX(-20deg);
  pointer-events: none;
  transition: none;
  opacity: 0;
}
.card:hover::before {
  animation: shineSweep 0.7s var(--ease-out);
  opacity: 1;
}

/* ── Stat value counter flash ───────────────────────────────────── */
@keyframes statFlash {
  0%   { color: var(--gold-bright); text-shadow: 0 0 20px rgba(201,168,76,0.6); }
  100% { color: inherit; text-shadow: none; }
}
.stat-updated { animation: statFlash 0.8s var(--ease-out); }

/* ── Vision card entrance ────────────────────────────────────────── */
.vision-card { transition: transform var(--duration-mid) var(--ease-out), box-shadow var(--duration-mid); }
.vision-card:hover { transform: translateY(-4px); box-shadow: 0 16px 48px rgba(80,55,20,0.18), 0 0 0 1px rgba(139,98,24,0.28); }

/* ── Trading card ───────────────────────────────────────────────── */
.trading-card { transition: transform var(--duration-mid) var(--ease-out), box-shadow var(--duration-mid); }
.trading-card:hover { transform: translateY(-3px); box-shadow: 0 14px 44px rgba(80,55,20,0.16), 0 0 0 1px rgba(139,98,24,0.24); }

/* ═══════════════════════════════════════════════════════════════
   THEME TOGGLE BUTTON
   ═══════════════════════════════════════════════════════════════ */
.theme-toggle {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--glass-border);
  background: transparent;
  color: var(--platinum-muted);
  cursor: pointer;
  font-size: 17px;
  transition: all var(--duration-fast) var(--ease-out);
  flex-shrink: 0;
}
.theme-toggle:hover {
  border-color: var(--gold-mid);
  color: var(--gold-mid);
  background: var(--gold-glow);
  transform: rotate(20deg) scale(1.08);
}

/* ═══════════════════════════════════════════════════════════════
   DARK THEME — Mode Nuit
   ═══════════════════════════════════════════════════════════════ */
[data-theme="dark"] {
  /* Backgrounds — deep space */
  --bg-void:       #0a0a11;
  --bg-surface:    #111118;
  --bg-elevated:   #16161f;
  --bg-input:      #1a1a26;
  --bg-hover:      #1e1e2c;

  /* Gold — brighter to pop on dark */
  --gold-mid:      #c9a84c;
  --gold-bright:   #e0b84a;
  --gold-pale:     #f0d48a;
  --gold-glow:     rgba(201,168,76,0.15);
  --gold-glow-lg:  rgba(201,168,76,0.08);
  --gold-glow-xl:  rgba(201,168,76,0.04);

  /* Text — light on dark */
  --platinum:      #e5e4e2;
  --platinum-sub:  #b8b4ae;
  --platinum-muted:#7a7975;
  --platinum-faint:rgba(255,255,255,0.06);

  /* Glass */
  --glass-bg:           rgba(16,16,26,0.92);
  --glass-border:       rgba(201,168,76,0.12);
  --glass-border-hover: rgba(201,168,76,0.32);

  /* Shadows */
  --shadow-card:       0 2px 24px rgba(0,0,0,0.50), 0 0 0 1px var(--glass-border);
  --shadow-card-hover: 0 8px 48px rgba(0,0,0,0.70), 0 0 0 1px var(--glass-border-hover);
  --shadow-modal:      0 24px 80px rgba(0,0,0,0.90), 0 0 0 1px rgba(201,168,76,0.12);
  --shadow-btn:        0 4px 14px rgba(0,0,0,0.50);
  --shadow-inset:      inset 0 1px 0 rgba(255,255,255,0.06);
}

/* Header & nav */
[data-theme="dark"] .app-header {
  background: rgba(10,10,17,0.96);
  border-bottom-color: rgba(201,168,76,0.10);
  box-shadow: 0 1px 0 rgba(201,168,76,0.06), 0 2px 24px rgba(0,0,0,0.40);
}
[data-theme="dark"] .app-nav {
  background: rgba(11,11,18,0.98);
  border-bottom-color: rgba(201,168,76,0.08);
  box-shadow: 0 1px 12px rgba(0,0,0,0.30);
}
[data-theme="dark"] .nav-tab:hover {
  background: rgba(255,255,255,0.04);
}
[data-theme="dark"] .nav-tab.active {
  background: rgba(201,168,76,0.08);
  border-color: rgba(201,168,76,0.22);
}

/* Cards */
[data-theme="dark"] .card {
  background: linear-gradient(145deg, rgba(18,18,28,0.97) 0%, rgba(12,12,20,0.99) 100%);
}
[data-theme="dark"] .kpi-card {
  background: linear-gradient(155deg, rgba(18,18,28,0.98) 0%, rgba(14,14,22,0.99) 60%, rgba(12,12,20,1) 100%);
}
[data-theme="dark"] .goal-card {
  background: linear-gradient(145deg, rgba(18,18,28,0.97), rgba(12,12,20,1));
}
[data-theme="dark"] .inv-summary-card {
  background: linear-gradient(145deg, rgba(17,17,28,0.95), rgba(12,12,20,0.98));
}

/* Auth screen */
[data-theme="dark"] .auth-panel {
  background: rgba(9,9,16,0.88);
  border-color: rgba(201,168,76,0.22);
  border-top-color: rgba(232,196,106,0.45);
  box-shadow:
    0 48px 140px rgba(0,0,0,0.97),
    0 0 120px rgba(201,168,76,0.09),
    inset 0 1px 0 rgba(255,255,255,0.06),
    inset 0 -1px 0 rgba(0,0,0,0.30);
}
[data-theme="dark"] .auth-orb { mix-blend-mode: screen; }

/* Form inputs */
[data-theme="dark"] .form-input {
  background: rgba(255,255,255,0.04);
  border-color: rgba(201,168,76,0.15);
}
[data-theme="dark"] .form-input:hover {
  background: rgba(255,255,255,0.055);
  border-color: rgba(201,168,76,0.28);
}
[data-theme="dark"] .form-input:focus {
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.12), 0 0 20px rgba(201,168,76,0.08);
}

/* Modal */
[data-theme="dark"] .modal-panel {
  background: linear-gradient(160deg, rgba(17,17,26,0.99), rgba(12,12,20,1));
  border-color: rgba(201,168,76,0.18);
  border-top-color: rgba(201,168,76,0.35);
  box-shadow: 0 -8px 48px rgba(0,0,0,0.60), inset 0 1px 0 rgba(255,255,255,0.04);
}
[data-theme="dark"] .modal-backdrop { background: rgba(0,0,0,0.75); }

/* Toast */
[data-theme="dark"] .toast {
  background: linear-gradient(135deg, rgba(17,17,28,0.97), rgba(12,12,20,0.99));
  border-color: rgba(201,168,76,0.20);
  box-shadow: 0 12px 48px rgba(0,0,0,0.65), 0 0 20px rgba(201,168,76,0.06);
}

/* Tooltip */
[data-theme="dark"] [data-tooltip]::after {
  background: rgba(16,16,26,0.97);
  border-color: rgba(201,168,76,0.20);
  box-shadow: 0 4px 20px rgba(0,0,0,0.50);
}

/* Skeleton */
[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg,
    rgba(255,255,255,0.04) 0%,
    rgba(255,255,255,0.09) 40%,
    rgba(255,255,255,0.04) 80%
  );
  background-size: 800px 100%;
}

/* Trading card internals */
[data-theme="dark"] .trading-card-head { border-bottom-color: rgba(255,255,255,0.04); }
[data-theme="dark"] .trading-type-btn {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.08);
}

/* Vision progress */
[data-theme="dark"] .vision-progress-wrap { background: rgba(255,255,255,0.06); }

/* Card & button hover shadows */
[data-theme="dark"] .btn-primary:hover {
  box-shadow:
    0 10px 40px rgba(0,0,0,0.65),
    var(--shadow-glow),
    inset 0 1px 0 rgba(255,255,255,0.30),
    inset 0 -1px 0 rgba(0,0,0,0.25);
}
[data-theme="dark"] .vision-card:hover {
  box-shadow: 0 16px 48px rgba(0,0,0,0.65), 0 0 0 1px rgba(201,168,76,0.28);
}
[data-theme="dark"] .trading-card:hover {
  box-shadow: 0 14px 44px rgba(0,0,0,0.60), 0 0 0 1px rgba(201,168,76,0.24);
}
[data-theme="dark"] .kpi-card:hover {
  box-shadow: 0 16px 60px rgba(0,0,0,0.80), 0 0 40px rgba(201,168,76,0.10), 0 0 0 1px rgba(201,168,76,0.25);
}
