/* ============================================================
   FinanzHub — Revolut-Redesign-Layer
   Zuletzt geladen → überschreibt. Vanilla-Umsetzung der User-Spec.
   Das Farbsystem (bg-0…4, accent=weiß, positiv/negativ/neutral) ist
   bereits in navy.css spec-exakt → hier nur Aliase, Fonts & die noch
   fehlenden Primitives (Fonts, FAB, Sheet, Empty, Skeleton, Transition).
   ============================================================ */

/* ───── 1 · Spec-Token-Aliase (auf bestehende navy.css-Werte gemappt) ───── */
:root {
  --bg-0: #060606;  --bg-1: #0F0F0F;  --bg-2: #181818;  --bg-3: #222222;  --bg-4: #2C2C2C;
  --accent: #FFFFFF;
  --accent-dim:  rgba(255,255,255,0.07);
  --accent-line: rgba(255,255,255,0.12);
  --text-1: #FFFFFF;  --text-2: #E8E8E8;  --text-3: #999999;  --text-4: #555555;
  --line:   rgba(255,255,255,0.07);
  --line-b: rgba(255,255,255,0.13);
  --positiv: #4ADE80;  --negativ: #F87171;  --neutral: #FBBF24;

  /* Fonts — Revolut-Stil: DM Sans (Body), DM Mono (Geld), Bricolage (Display) */
  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-head:    'Bricolage Grotesque', system-ui, sans-serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-ui:      'DM Sans', system-ui, sans-serif;
  --font-mono:    'DM Mono', 'JetBrains Mono', 'Courier New', monospace;

  --radius: 10px;  --radius-sm: 7px;
}

/* ───── 2 · Body-Font auf DM Sans (alle Themes/Views) ───── */
body,
body.theme-navy {
  font-family: 'DM Sans', system-ui, sans-serif;
}

/* ───── 2b · Mobile = knackiges Desktop-Schwarz (kein foggy Grau) ─────
   Früher auf #141414/#242424 aufgehellt (OLED-zu-dunkel-Sorge) → wirkte aber
   grau/verwaschen ggü. dem tiefschwarzen Desktop. Jetzt identisch zum Desktop
   (#060606 Seite, #181818 Karten); Karten heben sich über die mobilen
   Card-Borders ab (screens.css @≤768). */
@media (max-width: 768px) {
  html { background: #060606 !important; }
  body, body.theme-navy { background: #060606; }
  body.theme-navy {
    --page-bg:         #060606;
    --heat-bg-base:    #060606;
    --heat-bg-2:       #0F0F0F;
    --heat-bg-card:    #181818;
    --heat-bg-card-hi: #222222;
    --heat-bg-card-x:  #2C2C2C;
    --heat-bg-input:   #0F0F0F;
    --heat-line:       rgba(255, 255, 255, 0.09);
    --heat-line-hi:    rgba(255, 255, 255, 0.15);
    --bg:   #060606;  --bg2: #181818;  --bg3: #222222;
    --border: rgba(255, 255, 255, 0.09);
    --bg-0: #060606;  --bg-1: #0F0F0F;  --bg-2: #181818;  --bg-3: #222222;
    --line: rgba(255, 255, 255, 0.09);  --line-b: rgba(255, 255, 255, 0.15);
  }
  /* Header + Bottom-Nav an die Seite angleichen */
  body.theme-navy .mobile-bottom-nav,
  body.theme-navy .mobile-header { background: rgba(10, 10, 10, 0.94); }
  body.theme-navy .dashboard-shader { opacity: 0.34; }
}

/* ───── 3 · Geld immer in DM Mono (Revolut-Prinzip) ─────
   Bekannte Geld-Klassen quer durch Dashboard / Budget / Vermögen / Tx. */
body.theme-navy .networth-num,
body.theme-navy .heat-hero-num,
body.theme-navy .dash-hero-num,
body.theme-navy .heat-kpi-value,
body.theme-navy .prognose-num,
body.theme-navy .networth-delta-pill,
body.theme-navy .hb-amount,
body.theme-navy .cf-end-amt,
body.theme-navy .ms-amt-spent,
body.theme-navy .account-card .num,
body.theme-navy .tx-amount,
body.theme-navy .budget-row-spent,
body.theme-navy .card-amount,
body.theme-navy [data-money] {
  font-family: var(--font-mono);
  font-feature-settings: 'tnum' 1;
  letter-spacing: -0.02em;
}

/* ───── 4 · FAB-Gating (Basis-Style kommt aus navy.css) ─────
   navy.css stylt .fab bereits (weiß, 56px, schwebend). Hier nur:
   nur auf Mobile zeigen (Desktop hat Sidebar), nicht in Settings/Landing. */
body.theme-navy .fab svg { width: 24px; height: 24px; stroke: currentColor; }
body.theme-navy .fab:active { transform: scale(0.96); }
@media (min-width: 769px) {
  body.theme-navy .fab { display: none; }
}
body.theme-navy.view-settings .fab,
body.theme-navy.view-landing  .fab { display: none; }

/* ───── 5 · Bottom-Sheet — Politur des bestehenden Mehr-Drawers ─────
   (Modal-System bleibt; hier nur konsistente Sheet-Optik & Handle.) */
.sheet-handle,
.mobile-drawer::before {
  content: '';
  display: block;
  width: 32px; height: 3px;
  background: var(--bg-4, #2C2C2C);
  border-radius: 2px;
  margin: 0 auto 14px;
}

/* ───── 6 · Empty-State (sachlich, kein Emoji, kein Hype) ───── */
.empty {
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
  padding: 52px 28px; gap: 10px;
}
.empty-icon {
  width: 64px; height: 64px; border-radius: 16px;
  background: var(--bg-3); display: grid; place-items: center;
  color: var(--text-4); margin-bottom: 4px;
}
.empty-icon svg { width: 32px; height: 32px; }
.empty-title {
  font-family: var(--font-display);
  font-size: var(--text-title); font-weight: 700; color: var(--text-1);
}
.empty-desc {
  font-size: var(--text-body); color: var(--text-3);
  max-width: 270px; line-height: 1.55;
}

/* ───── 7 · Skeleton-Loading (Zustandswechsel, transportiert Information) ───── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-2) 25%, var(--bg-3) 50%, var(--bg-2) 75%);
  background-size: 200% 100%;
  animation: rev-shimmer 1.6s linear infinite;
  border-radius: 6px;
}
@keyframes rev-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ───── 8 · Seiten-Übergang (Fade + minimal TranslateY — kein Hüpfen) ─────
   Shader-Canvas ausgenommen, sonst überschreibt die Animation seine opacity:0.22. */
.heat-main-host > *:not(.dashboard-shader) { animation: rev-page 0.24s ease both; }
@keyframes rev-page {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .heat-main-host > *:not(.dashboard-shader) { animation: none; }
}

/* ───── 9 · Generische Primitives (additiv, für künftige Spec-Markup) ───── */
.card {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--card-padding, 16px);
  position: relative; overflow: hidden;
}
.card-label {
  font-size: var(--text-micro); font-weight: 600; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--text-4); margin-bottom: 6px;
}
.card-amount {
  font-family: var(--font-mono); font-size: var(--text-hero); font-weight: 500;
  letter-spacing: -0.03em; color: var(--text-1); line-height: 1;
}
.card-amount.positiv { color: var(--positiv); }
.card-amount.negativ { color: var(--negativ); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: var(--text-small); font-weight: 500;
  cursor: pointer; border: none; transition: all 0.15s ease; min-height: 36px;
}
.btn-primary { background: var(--text-1); color: var(--bg-0); font-weight: 600; }
.btn-primary:hover { background: #E5E5E5; transform: translateY(-1px); }
.btn-ghost { background: var(--bg-3); color: var(--text-2); border: 1px solid var(--line-b); }
.btn-ghost:hover { border-color: rgba(255,255,255,0.25); color: var(--text-1); }
.btn-danger { background: rgba(248,113,113,0.1); color: var(--negativ); border: 1px solid rgba(248,113,113,0.2); }

/* ───── 10 · MonthClose — Monatsabschluss (still, premium, kein Konfetti) ───── */
.monthclose {
  position: fixed; inset: 0;
  background: #060606;
  z-index: 300;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.5s ease;
}
.monthclose.is-visible { opacity: 1; }
body.mc-open { overflow: hidden; }
.mc-content { text-align: center; padding: 40px; max-width: 460px; }
.mc-label {
  font-family: var(--font-mono);
  font-size: var(--text-micro); letter-spacing: 0.12em;
  color: var(--text-4); margin: 0 0 20px;
}
.mc-title {
  font-family: var(--font-display);
  font-size: 3rem; font-weight: 800; letter-spacing: -0.04em;
  line-height: 1.0; color: var(--text-1); margin: 0 0 28px;
  word-break: keep-all; overflow-wrap: normal; hyphens: none;
}
@media (max-width: 440px) { .mc-title { font-size: 2.4rem; } }
.mc-line { width: 40px; height: 1px; background: var(--line-b); margin: 0 auto 28px; }
.mc-stats {
  display: flex; align-items: center; gap: 18px; justify-content: center;
  margin-bottom: 40px;
}
.mc-stat { display: flex; flex-direction: column; gap: 4px; }
.mc-stat-val {
  font-family: var(--font-mono); font-size: var(--text-body);
  font-weight: 500; color: var(--text-2);
}
.mc-stat-val.positiv { color: var(--positiv); }
.mc-stat-key { font-size: var(--text-micro); color: var(--text-4); letter-spacing: 0.06em; }
.mc-divider { width: 1px; height: 28px; background: var(--line); }
.mc-btn {
  background: none; border: 1px solid var(--line-b); color: var(--text-3);
  border-radius: var(--radius-sm); padding: 10px 28px;
  font-family: var(--font-body); font-size: var(--text-small); cursor: pointer;
  transition: all 0.2s;
}
.mc-btn:hover { border-color: var(--text-3); color: var(--text-1); }
/* dezentes Fade-Up (kein Hüpfen) */
.monthclose.is-visible .mc-title { animation: mcrise 0.8s cubic-bezier(0.16,1,0.3,1) both; animation-delay: 0.15s; }
.monthclose.is-visible .mc-stats { animation: mcrise 0.8s cubic-bezier(0.16,1,0.3,1) both; animation-delay: 0.35s; }
@keyframes mcrise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  .monthclose.is-visible .mc-title, .monthclose.is-visible .mc-stats { animation: none; }
}

/* ───── 11 · Cash-Flow-Chart (Berichte) — Einnahmen vs. Ausgaben, 12 Monate ───── */
.cf-section {
  background: var(--bg-2, #181818);
  border: 1px solid var(--line, rgba(255,255,255,0.07));
  border-radius: var(--radius, 12px);
  padding: 16px 14px 12px;
  margin-bottom: 14px;
}
.cf-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.cf-title { font-size: var(--text-body, 0.9375rem); font-weight: 600; color: var(--text-2, #E8E8E8); }
.cf-sub   { font-size: var(--text-micro, 0.6875rem); color: var(--text-4, #555); letter-spacing: 0.04em; }
.cf-chart-wrap { position: relative; width: 100%; }
.cf-chart { width: 100%; height: 168px; display: block; overflow: visible; }
.cf-grid  { stroke: rgba(255,255,255,0.07); stroke-width: 1; }
.cf-ytick { fill: var(--text-4, #555); font-family: var(--font-mono); font-size: 8px; }
.cf-xtick { fill: var(--text-4, #555); font-family: var(--font-body); font-size: 8.5px; }
.cf-xtick.is-now { fill: var(--text-1, #fff); font-weight: 600; }
.cf-bar-in { fill: var(--positiv, #4ADE80); opacity: 0.85; }
.cf-bar-ex { fill: var(--negativ, #F87171); }
.cf-bar-empty { fill: var(--bg-4, #2C2C2C); opacity: 1; }
.cf-hit { cursor: pointer; }
.cf-hit:hover ~ .cf-bar { } /* no-op, hover handled per group via JS */
.cf-legend { display: flex; gap: 16px; margin-top: 10px; padding-left: 2px; }
.cf-legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-micro, 0.6875rem); color: var(--text-3, #999); }
.cf-legend-dot { width: 9px; height: 9px; border-radius: 2px; }
.cf-dot-in { background: var(--positiv, #4ADE80); }
.cf-dot-ex { background: var(--negativ, #F87171); }
.cf-tooltip {
  position: absolute; z-index: 5; pointer-events: none;
  min-width: 120px; padding: 8px 10px;
  background: var(--bg-3, #222); border: 1px solid var(--line-b, rgba(255,255,255,0.13));
  border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  font-size: var(--text-small, 0.8125rem);
}
.cf-tooltip strong { display: block; margin-bottom: 5px; font-size: var(--text-small); color: var(--text-1, #fff); font-weight: 600; }
.cf-tt-row { display: flex; justify-content: space-between; gap: 12px; color: var(--text-3, #999); font-size: var(--text-micro, 0.6875rem); padding: 1px 0; }
.cf-tt-row span:last-child { font-family: var(--font-mono); }
.cf-tt-net { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line, rgba(255,255,255,0.07)); }
.cf-pos { color: var(--positiv, #4ADE80); }
.cf-neg { color: var(--negativ, #F87171); }

/* ───── 12 · Toggle-Switch (Revolut: weiß = aktiv) ───── */
.toggle {
  width: 44px; height: 24px; background: var(--bg-4, #2C2C2C);
  border-radius: 12px; position: relative; cursor: pointer;
  transition: background 0.2s; border: none; flex-shrink: 0;
}
.toggle.active { background: var(--text-1, #fff); }
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; background: var(--bg-0, #060606);
  border-radius: 50%; transition: transform 0.2s;
}
.toggle.active::after { transform: translateX(20px); }

/* ───── 13 · Dashboard Violet-Dithering-Shader (nur Dashboard) ───── */
body.view-dashboard .heat-main-host { position: relative; }
.dashboard-shader {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 280px;
  pointer-events: none; opacity: 0.22; z-index: 0;
  -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 30%, transparent 100%);
}
/* Echter Inhalt liegt über dem Shader */
body.view-dashboard .heat-main-host > *:not(.dashboard-shader) { position: relative; z-index: 1; }

/* ───── 14 · Mobile-Feinschliff (nur Handy) ───── */
@media (max-width: 768px) {
  /* Erklär-Texte unter Features ausblenden (Clutter/Layout) */
  body.theme-navy .budget-assign-warn-sub,
  body.theme-navy .settings-tool-sub { display: none; }

  /* Toolbar Auto-Kategorisieren / Import / Export: kleinere Schrift, kompakter */
  body.theme-navy .tx-header-bar .fh-btn {
    font-size: 0.72rem;
    padding: 7px 10px;
    min-height: 34px;
  }
  /* Werkzeuge-Labels in Einstellungen kleiner */
  body.theme-navy .settings-tool-lbl { font-size: 0.8125rem; }
}
