/* finance-stack — styles split (Phase 46 Wave 4)
   Datei: charts-hero.css  •  Lade-Position: 5/6 — Phase 24/25/26/27/29/30/35 Hero + Charts + Geldfluss + Color-Editor
   Lade-Reihenfolge: base → layout-shell → components → pages → charts-hero → polish
*/

/* === Phase 24 Mobile-Sweep — Touch-Target-Harmonisierung === */
/* Plan 24-04 (Wave 3): Hebt alle primären Mobile-Touch-Targets auf ≥ 40 px
   (Apple HIG / WCAG 2.1 AA). Adressiert systematische Offender quer über
   16 Pages mit 6 CSS-Regeln statt N Per-Page-Workarounds. */
@media (max-width: 720px) {
  /* Inline-Text-Buttons (Form-Submits als Link-Look, Aktions-Links)
     z.B. „Löschen", „Bearbeiten", „Vorschläge", „Abmelden", „Test-Push" */
  button.link,
  .btn-link,
  a.link {
    min-height: 40px;
    padding: .4rem .5rem;
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
  }
  /* `.link small` als Inline-Mini-Link soll klein bleiben (Plan-Reset-Pattern
     aus 24-02 nutzt das). */
  .seg-toggle a.link.small {
    min-height: unset;
    padding: .35rem .5rem;
  }

  /* Icon-Buttons auf 2.5rem (~40 px) statt 2.2rem (~35 px) */
  .icon-btn-add,
  .icon-btn-edit,
  .icon-btn-delete {
    width: 2.5rem;
    height: 2.5rem;
  }

  /* Seg-Toggle-Links (Sort/Zeitraum-Switcher) */
  .seg-toggle a {
    padding: .5rem .65rem;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    font-size: .88rem;
  }

  /* Header-Action-Buttons */
  .theme-toggle,
  .privacy-toggle,
  .nav-burger {
    min-height: 40px;
    min-width: 40px;
    padding: .4rem .55rem;
  }

  /* Aufsplitten-Action-Button und ähnliche Icon+Text-Pills */
  .btn-icon-action {
    min-height: 40px;
    padding: .5rem .85rem;
  }

  /* Period-Nav Pfeile (Budget-Edit, Wallet-Detail) */
  .period-nav a,
  .period-nav .disabled {
    min-height: 36px;
    min-width: 36px;
    padding: .35rem .6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Settings: ganzes Radio-Label als Tap-Zone */
  .settings-radio {
    min-height: 44px;
    padding: .55rem .8rem;
  }

  /* Form-Inputs/Selects/Date-Picker auf einheitliche Höhe ≥ 40 px.
     Bestehende `.filters input/select { height: 2.35rem }` wäre 37.6 px → zu klein. */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="url"],
  input[type="number"],
  input[type="date"],
  input[type="search"],
  input[type="tel"],
  select,
  textarea {
    min-height: 40px;
    font-size: 16px; /* iOS Zoom-Prevention: ≥16px = kein Auto-Zoom on focus */
  }
  .filters input,
  .filters select {
    height: auto;
    min-height: 40px;
  }

  /* Submit-Buttons (Basis + .btn-primary) auf ≥ 40 px Mindesthöhe.
     Plus Anker-Tags mit .btn-primary („+ Neues Budget" etc.) */
  button,
  .btn-primary,
  a.btn-primary {
    min-height: 40px;
    padding: .55rem 1.1rem;
  }
  /* button.link / .btn-link werden bereits oben behandelt — overrides
     nicht versehentlich min-height via Basis-button-Regel. */
  button.link,
  a.btn-link {
    padding: .4rem .5rem;
  }
}

/* Buchung-Detail Inline-Forms: auf engstem Mobile (≤ 540) stapeln + groß genug
   für Single-Hand-Tap. Plan-Pattern D aus 24-04. */
@media (max-width: 540px) {
  .tx-edit-form {
    flex-direction: column;
    align-items: stretch;
    gap: .55rem;
  }
  .tx-edit-form select,
  .tx-edit-form button,
  .tx-edit-form .btn-secondary,
  .tx-edit-form a.btn-secondary {
    min-height: 40px;
    font-size: .95rem;
    padding: .5rem .7rem;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
  }
}

/* Horizontaler Scroll-Wrapper für mehrspaltige Settings-Tabellen
   (z.B. .kontenfilter-table mit 1 + N Spalten). Tabelle scrollt
   *innerhalb* ihres Containers, nicht der Body. */
.table-scroll-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
/* === /Phase 24 Mobile-Sweep === */

/* =================================================================
   === Phase 25 Hero === — Tokens + Layout-Skelett
   (Visual-Polish: organische Wellen / Glow / Tropfen kommen in Plan 25-05)
   ================================================================= */

/* --- Tokens (Hell: leiten von Brand-Palette ab) --- */
:root {
  --hero-frei:      var(--pos);             /* grün — Frei verfügbar */
  --hero-budgets:   var(--accent);          /* indigo — Budgets */
  --hero-sparen:    #ec4899;                /* magenta — neuer Phase-25-Token */
  --hero-puffer:    #38bdf8;                /* sky-blue — neuer Phase-25-Token */
  --hero-vertraege: var(--accent-2);        /* amber — Verträge */
  --hero-sonstige:  var(--text-muted);      /* slate — Sonstige */
  --hero-overflow:  var(--danger);          /* rot — Edge A overflow */
  --hero-warning:   #eab308;                /* gelb — Edge A tropfen-Warnung */
  --hero-funnel-bg: rgba(15, 23, 41, .05);  /* Trichter-Hintergrund Hell */
  --hero-drop-glow: rgba(21, 128, 61, .35); /* Tropfen-Glow Hell (grün-pos transparent) */
}
[data-theme="dark"] {
  --hero-frei:      var(--pos);             /* grün-light bleibt grün */
  --hero-budgets:   var(--accent);          /* indigo-light */
  --hero-sparen:    #f472b6;                /* etwas heller fürs Dark */
  --hero-puffer:    #7dd3fc;                /* etwas heller fürs Dark */
  --hero-vertraege: var(--accent-2);
  --hero-sonstige:  var(--text-muted);
  --hero-overflow:  var(--danger);
  --hero-warning:   #facc15;
  --hero-funnel-bg: rgba(255, 255, 255, .04);
  --hero-drop-glow: rgba(74, 222, 128, .45);
}

/* --- Wrapper + 3-Spalten-Layout --- */
.hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
/* 2026-06-06: Dashboard-v4 löst den Hero-Wrapper auf — Kind-Cards rendern
   direkt im Page-Layout. Wrapper bleibt im DOM nur als JS-Anker für
   hero-shared.js (`.hero`-Selector), wird aber visuell + layout-mäßig
   neutralisiert via display:contents. */
.hero--unwrapped {
  display: contents;
}
.hero__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.hero__period-label {
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 .2rem 0;
}
.hero__period-value {
  font-size: 2.25rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.05;
}
.hero__days-pill {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .7rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--hero-frei) 15%, transparent);
  color: var(--hero-frei);
  font-size: .85rem;
  font-weight: 500;
  white-space: nowrap;
}
.hero__days-pill::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--hero-frei);
}
.hero__body {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 1.1fr) minmax(260px, 1.3fr);
  gap: 1.5rem;
  align-items: start;
}
.hero__stats { display: flex; flex-direction: column; gap: .9rem; }
.hero__center {
  display: flex; flex-direction: column; align-items: center;
  gap: .15rem;
  padding-top: 0;
}
.hero__center .hero__income-label { margin: 0; }
.hero__center .hero__income-value { margin: 0 0 .2rem 0; line-height: 1.1; }
.hero__list-wrap { display: flex; flex-direction: column; gap: .5rem; }

/* --- Stat-Cards (linke Spalte) --- */
.hero-stat {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .85rem 1rem;
  background: var(--surface-3);
  border: 1px solid var(--border-3);
  border-radius: 10px;
}
.hero-stat__icon-box { padding-top: .15rem; color: var(--text-muted); }
.hero-stat__body { flex: 1; min-width: 0; }
.hero-stat__label { font-size: .8rem; color: var(--text-muted); margin: 0; }
.hero-stat__value { font-size: 1.4rem; font-weight: 700; margin: .15rem 0 .1rem 0; word-break: break-word; }
.hero-stat__value.pos { color: var(--hero-frei); }
.hero-stat__value.neg { color: var(--hero-overflow); }
.hero-stat__value.warn { color: var(--hero-warning); }
.hero-stat__sub { font-size: .75rem; color: var(--text-dim); }
.hero-stat__bar { height: 4px; background: var(--surface-4); border-radius: 999px; margin-top: .4rem; overflow: hidden; }
.hero-stat__bar-fill { height: 100%; background: var(--hero-frei); border-radius: 999px; }


/* --- Liste (rechte Spalte) --- */
.hero-list { display: flex; flex-direction: column; gap: .35rem; margin: 0; padding: 0; list-style: none; }
.hero-list__head { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 .4rem 0; }
.hero-list-item {
  display: grid;
  grid-template-columns: 1.4rem 1fr auto;
  grid-template-rows: auto auto;
  column-gap: .55rem;
  row-gap: .15rem;
  padding: .45rem .25rem;
  border-radius: 8px;
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-decoration: none;
}
.hero-list-item:hover { background: var(--surface-3); }
.hero-list-item__icon { grid-column: 1; grid-row: 1; color: var(--layer-color, var(--text-muted)); }
.hero-list-item__label { grid-column: 2; grid-row: 1; font-weight: 500; }
.hero-list-item__amount { grid-column: 3; grid-row: 1; font-variant-numeric: tabular-nums; font-weight: 600; }
.hero-list-item__bar { grid-column: 2 / 4; grid-row: 2; height: 3px; background: var(--surface-4); border-radius: 999px; overflow: hidden; }
.hero-list-item__bar-fill { height: 100%; background: var(--layer-color, var(--text-muted)); border-radius: 999px; transition: width .25s ease; }
.hero-list-item--zero .hero-list-item__amount { color: var(--text-dim); }
.hero-list-item--zero .hero-list-item__cta { grid-column: 2 / 4; grid-row: 2; font-size: .75rem; color: var(--accent); }
.hero-list__sum-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: .5rem;
  padding-top: .55rem;
  border-top: 1px solid var(--border-2);
  font-size: .9rem;
}
.hero-list__sum-row strong { font-variant-numeric: tabular-nums; }

/* --- Footer "Gesamt Überblick" --- */
.hero__footer {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(3, minmax(150px, 1fr));
  gap: 1rem;
  align-items: center;
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--surface-3);
  border: 1px solid var(--border-3);
  border-radius: 12px;
}
.hero__footer-label { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); display: flex; align-items: center; gap: .5rem; }
.hero__footer-stat { display: flex; flex-direction: column; }
.hero__footer-stat-label { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; }
.hero__footer-stat-value { font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.hero__footer-stat-value.neg { color: var(--hero-overflow); }
.hero__footer-stat-pct { font-size: .7rem; color: var(--text-dim); }

/* --- Edge-State-Modifier (CSS-only, kein JS) --- */
.hero--state-frei_negative .hero-stat__value.frei { color: var(--hero-overflow); }
.hero--state-konto_negative .hero-stat__value.konto-ueberschuss { color: var(--hero-overflow); }
.hero--state-both .hero-stat__value.frei,
.hero--state-both .hero-stat__value.konto-ueberschuss { color: var(--hero-overflow); }

/* --- Mobile (≤ 720px): Default Layout A (alles offen, gestackt) --- */
@media (max-width: 720px) {
  .hero { padding: 1rem; }
  .hero--unwrapped { padding: 0; }
  .hero__body {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .hero__center { order: 0; }
  .hero__stats { order: 1; }
  .hero__list-wrap { order: 2; }
  .hero__footer {
    grid-template-columns: 1fr 1fr;
    row-gap: .75rem;
  }
  .hero__footer-label { grid-column: 1 / -1; }
}

/* --- Mobile compact (≤ 720px UND .hero--compact gesetzt): Layout B --- */
@media (max-width: 720px) {
  .hero--compact .hero__stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem;
  }
  .hero--compact .hero__stats > .hero-stat:nth-child(3) {
    grid-column: 1 / -1;
  }
  .hero--compact .hero-list-collapsible summary {
    cursor: pointer;
    list-style: none;
    font-size: .85rem;
    color: var(--text-muted);
    padding: .5rem 0;
  }
  .hero--compact .hero-list-collapsible summary::after { content: "↓"; margin-left: .4rem; }
  .hero--compact .hero-list-collapsible[open] summary::after { content: "↑"; }
  .hero--compact .hero-list-collapsible summary::-webkit-details-marker { display: none; }
}

/* --- Tooltip + Highlight (Plan 25-04) --- */
.hero-tooltip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .35rem .65rem;
  font-size: .8rem;
  color: var(--text);
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  max-width: 260px;
  white-space: normal;
  line-height: 1.4;
}
/* Phase 30 follow-up: SVG-only scope. Der Filter-Effekt (brightness + drop-shadow)
   wurde in Phase 25 für SVG-Funnel-Layers designed. Phase 30 nutzt is-highlighted
   jetzt auch auf HTML-Tiles (Sankey-Row, Außen-Legende-Row für Cross-Highlight),
   wo der Filter Drop-Shadow als störenden Halo um die Tile und brightness als
   subpixel-AA-Killer auf der Schrift erzeugte ("Glas-Effekt"). HTML-Tiles haben
   eigene is-highlighted-Styles (Background-Tint, Border-Strip) — die brauchen
   den Filter nicht. */
svg [data-hero-layer].is-highlighted {
  filter: brightness(1.2) drop-shadow(0 0 5px currentColor);
  transition: filter .12s ease;
}
a.hero-list-item.is-highlighted {
  background: var(--surface-3);
  transform: translateX(2px);
  transition: background .12s ease, transform .12s ease;
}
svg [data-hero-layer]:hover,
svg [data-hero-layer]:focus {
  outline: none;
}
svg [data-hero-layer] {
  transition: filter .12s ease;
}
/* === /Phase 25 Hero === */

/* Phase 26 POLISH-HERO-03: Desktop-Layout-Feinschliff (1280/1440/1920).
   Parallele Hero-Achsen, gleiche Card-Hoehen.
   Phase-25 dash-grid setzt gap: 1rem (Zeile 1748). Auf >=1280px wird der
   Gap leicht erweitert (1.25rem) — visuelle Balance zwischen Atmung der
   Cards und genug Trennung der Spalten. Hero__body bekommt gap 1.5rem
   fuer gleichmaessige Stats-Center-List-Abstaende.
   Stats-Spalte links und List-Spalte rechts werden in CSS-Grid mit gleicher
   Hoehe wie der Funnel-Container in der Mitte rendered — via display:grid
   + grid-template-rows + align-items: stretch (RESEARCH §Pattern Card-Hoehe).
   Stat-Cards bekommen min-height ~6.5rem, dadurch Summe 3*6.5=19.5rem
   ~Funnel-Hoehe. */
@media (min-width: 1280px) {
  .dash-grid { gap: 1.25rem; }
  .hero__body { gap: 1.5rem; }

  /* Stats-Spalte: 3 Cards strecken sich gleichmaessig zur Funnel-Hoehe. */
  .hero__stats {
    display: grid;
    grid-template-rows: 1fr 1fr 1fr;
    align-items: stretch;
    gap: 1rem;
  }
  .hero__stats > .hero-stat {
    min-height: 6.5rem;
  }

  /* List-Spalte rechts: gleicht sich an Funnel-Hoehe via min-height an,
     damit die rechte Achse mit der mittleren parallel laeuft. */
  .hero__list-wrap {
    min-height: 19.5rem;
    justify-content: flex-start;
  }

}

/* Ultra-Wide 1920px: Dash-Grid auf max 1600px zentrieren statt Cards
   strecken — verhindert ueberbreite Cards mit zu viel Whitespace innen.
   Wenn Visual-Sweep 26-08 weitere Misalignments aufdeckt, kommen hier
   noch Achsen-spezifische Tweaks dazu. */
@media (min-width: 1920px) {
  .dash-grid {
    max-width: 1600px;
    margin: 0 auto;
  }
}

/* === /Phase 26 Visual-Polish === */

/* === Phase 27 — CSV-Import-Wizard === */
.breadcrumb { color: var(--text-muted); font-size: .85rem; margin: 0 0 1.2rem; }

.import-banner {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .7rem 1rem;
  border-radius: 7px;
  margin-bottom: 1rem;
  font-size: .92rem;
}
.import-banner .icon { flex: 0 0 1.1rem; height: 1.1rem; }
.import-banner-success {
  background: var(--flash-bg);
  border: 1px solid var(--flash-border);
  color: var(--flash-text);
}
.import-banner-info {
  background: var(--suggest-grad);
  border: 1px solid var(--suggest-border);
  color: var(--text);
}

.import-session-list { list-style: none; padding: 0; margin: 0; }
.import-session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .55rem 0;
  border-bottom: 1px solid var(--border);
}
.import-session-item:last-child { border-bottom: none; }
.import-session-meta {
  display: flex;
  align-items: center;
  gap: .8rem;
  flex-wrap: wrap;
}
.import-session-name { font-weight: 600; }
.import-session-status {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 999px;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: var(--surface-2, var(--bg));
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.import-session-status.status-uploaded {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: var(--accent);
}
.import-session-status.status-previewed {
  background: var(--flash-bg);
  color: var(--flash-text);
  border-color: var(--flash-border);
}

.import-stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}
.import-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .15rem;
  font-size: 1rem;
}
.import-stat strong { font-size: 1.4rem; line-height: 1; }
.import-stat.warn strong { color: var(--neg); }

.mapping-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .8rem;
  margin-top: .4rem;
}
.mapping-grid label { font-size: .82rem; }
.mapping-grid .required { color: var(--neg); margin-left: .15rem; }

.preview-section { padding: .8rem 1rem; }
.preview-section > summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .5rem;
  list-style: none;
  font-size: .95rem;
}
.preview-section > summary::-webkit-details-marker { display: none; }
.preview-section > summary .count { color: var(--text-muted); font-weight: 400; }
.preview-section.section-attention > summary { color: var(--neg); }
.preview-section.section-attention > summary strong { color: var(--neg); }

.row-list { list-style: none; padding: 0; margin: .7rem 0 0; }
.row-item {
  display: grid;
  grid-template-columns: 90px 90px 1fr 1fr auto;
  gap: .55rem;
  align-items: center;
  padding: .4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .88rem;
}
.row-item:last-child { border-bottom: none; }
.row-item .row-date { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.row-item .row-betrag { font-variant-numeric: tabular-nums; }
.row-item .row-zweck,
.row-item .row-empfaenger {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-item.row-error { color: var(--error-text); }
.row-item.row-uncertain { color: var(--text); }
.row-item.row-uncertain .row-reason,
.row-item.row-error .row-reason { color: var(--text-muted); }

.row-override {
  display: flex;
  gap: .8rem;
  border: none;
  padding: 0;
  margin: 0;
  align-items: center;
}
.row-override label {
  display: flex;
  align-items: center;
  gap: .25rem;
  font-size: .82rem;
  cursor: pointer;
}
.row-override input[type="radio"] { width: auto; margin: 0; }

.visually-hidden {
  position: absolute;
  clip: rect(0 0 0 0);
  width: 1px;
  height: 1px;
  overflow: hidden;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .row-item {
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: auto;
    gap: .3rem .6rem;
  }
  .row-item .row-zweck,
  .row-item .row-empfaenger,
  .row-item .row-reason { grid-column: 1 / -1; white-space: normal; }
  .row-override { grid-column: 1 / -1; }
  .mapping-grid { grid-template-columns: 1fr; }
  .import-stat-row { gap: 1rem; }
}
/* === /Phase 27 CSV-Import === */

/* === Phase 29 Hero-v3 Dashboard-Variante === */
/* Tokens fuer die neue Hero-Variante `dashboard-v3` (HERO-V3-05).
   Strategie: wo immer moeglich aliasen wir auf bestehende Hero- bzw. Theme-Tokens,
   damit Light/Dark automatisch konsistent bleibt. Nur dort harte Werte, wo v3
   wirklich neu ist (Card-Shadow). */
:root {
  /* Card-Container */
  --hero-v3-card-bg:      var(--surface);
  --hero-v3-card-border:  var(--border);
  --hero-v3-card-shadow:  0 1px 3px rgba(0, 0, 0, .06);
  /* Stapelbalken-Segmente (Plan 03; Iteration-3 Re-Spec — 3D-Fluessigkeits-Zylinder:
     Reserve dunkelgruen (oben), Frei hellgruen (mitte), Reserviert orange (unten). */
  --hero-v3-reserve:        #15803d;          /* emerald-700 — dunkelgruen */
  --hero-v3-reserve-warn:   #ca8a04;          /* yellow-600 — Warn-Threshold */
  --hero-v3-frei:           #4ade80;          /* green-400 — hellgruen */
  --hero-v3-anrechenbar:    #f97316;          /* orange-500 — Reserviert */
  /* Zylinder-Kappen (Iteration-3: 3D-Metalloptik) */
  --hero-v3-cap-top:        #4b5563;          /* slate-600 — Deckel oben */
  --hero-v3-cap-bottom:     #1f2937;          /* slate-800 — Boden dunkler */
  /* Sankey-Quellsaeule (Iteration-3: violett/blau gemaess Re-Spec) */
  --hero-v3-source-violet:  #7B6FD4;          /* indigo-mid */
  /* Kennzahl-Chips (Plan 05) */
  --hero-v3-chip-bg:      var(--surface);
  --hero-v3-chip-border:  var(--border-2);
  --hero-v3-chip-good:    var(--pos);
  --hero-v3-chip-warn:    var(--hero-warning);
  --hero-v3-chip-alert:   var(--hero-overflow);
  /* Phase 30 VFID-01: Status-Card im Header (Restzeit + Progress-Bar). */
  --hero-v3-status-card-bg:             var(--surface);
  --hero-v3-status-card-border:         var(--border-2);
  --hero-v3-status-card-progress-track: color-mix(in srgb, var(--hero-v3-chip-good) 12%, transparent);
  --hero-v3-status-card-progress-fill:  var(--hero-v3-chip-good);
  /* Phase 30 VFID-09: Footer-Sync-Timestamp. */
  --hero-v3-data-footer-color:          var(--text-muted);
  /* Phase 30 VFID-02: Außen-Legende Hover-Tint Alpha */
  --hero-v3-legend-row-tint-alpha: 6%;
}
[data-theme="dark"] {
  /* Dark-Mode-Overrides nur dort, wo computed value abweichen muss. */
  --hero-v3-card-shadow:    0 1px 3px rgba(0, 0, 0, .4);
  /* Hellere Saettigungen fuers Dark-Theme. */
  --hero-v3-reserve:        #22c55e;          /* green-500 */
  --hero-v3-frei:           #86efac;          /* green-300 */
  --hero-v3-anrechenbar:    #fb923c;          /* orange-400 */
  --hero-v3-cap-top:        #6b7280;
  --hero-v3-cap-bottom:     #374151;
  --hero-v3-source-violet:  #8B7EE0;
  /* Phase 30 (Status-Card + Footer Dark-Overrides) */
  --hero-v3-status-card-progress-track: color-mix(in srgb, var(--hero-v3-chip-good) 18%, transparent);
}

/* Layout-Skelett: zwei gleichberechtigte Karten nebeneinander auf Desktop,
   stacken auf Mobile. */
.hero--v3 .hero-v3__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}
.hero--v3 .hero-v3__cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  /* 2026-06-06 Hero-Unwrap: gap an .dash-grid (1.25rem) angeglichen, damit
     horizontale Card-Abstände auf Desktop einheitlich sind. */
  gap: 1.25rem;
}
.hero-v3__card {
  background: var(--hero-v3-card-bg);
  border: 1px solid var(--hero-v3-card-border);
  border-radius: 12px;
  box-shadow: var(--hero-v3-card-shadow);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  /* Grid-Blow-Out-Fix: ohne min-width:0 nimmt das Grid-Item seine min-content
     als Mindestbreite und sprengt den 1fr-Track der .hero-v3__cards. Auf
     Mobile (393px) wurde die Card so ~24px breiter als ihr Container und
     ragte rechts ueber den Hero-Padding raus. */
  min-width: 0;
}
.hero-v3__card-header { display: flex; flex-direction: column; gap: .15rem; }
.hero-v3__card-title { margin: 0; font-size: 1rem; }
.hero-v3__card-sub { margin: 0; }
/* Variante A 2026-05-29: Übersoll-Marker im Sankey-Subheader. Farb-Token
   --hero-overflow ist der Edge-State-Rot (gleiche Source-of-Truth wie der
   Frei-Slice im Donut, wenn Konto im Defizit). */
.hero-v3__card-sub-overflow { color: var(--hero-overflow); font-weight: var(--weight-medium, 500); }
.hero-v3__card-body { flex: 1 1 auto; min-height: 4rem; }
.hero-v3__card-footer { margin-top: auto; }
.hero-v3__card-footer-link { font-size: .85rem; color: var(--text-muted); text-decoration: none; }
.hero-v3__card-footer-link:hover { color: var(--text); }

.hero--v3 .hero-v3__chips {
  display: grid;
  /* Auto-fit fuer flex. Anzahl Chips (3 oder 4) ohne CSS-Anpassung.
     Mobile-Override (Z. 1045) bleibt: 1fr unter 720px. */
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  /* 2026-06-06 Hero-Unwrap: gap + margin-top auf das einheitliche
     Dashboard-Section-Rhythmus-Maß 1.5rem gehoben (war .5rem / .75rem),
     damit Chips nicht mehr enger sitzen als Hero-Cards / Dash-Grid. */
  gap: 1.25rem;
  margin-top: 1.5rem;
}
/* Frühere .hero-v3__chip-Definition (background/border/padding) wurde entfernt
   — die spätere Definition ab Z. 1310 ist die Source-of-Truth seit dem
   2026-05-29-Chip-Refactor. Padding hier doppelt drauf hätte die Mobile-
   Padding-Reduktion neutralisiert. */
.hero-v3__chip-title { margin: 0; font-size: .85rem; font-weight: 600; color: var(--text-muted); }

/* D-11: "Monat abgeschlossen"-Pill bekommt dezenten Good-Ton statt Alert. */
.hero__days-pill--good {
  background: color-mix(in srgb, var(--hero-v3-chip-good) 18%, transparent);
  color: var(--hero-v3-chip-good);
}

/* --- Plan 29-03: Konto-Ueberblick-Stapelbalken --- */
.hero-v3__card--konto { /* Iteration-3: 3D-Zylinder zentriert, kein Side-Label-Layout. */
  display: grid;
  grid-template-rows: auto 1fr auto;
}
.hero-v3__card-body--konto {
  display: grid;
  /* 2026-06-10 Layout-Polish: Dial war mit 234×425px dominanter als der
     gesamte Sankey daneben (380px) und trieb die Card-Höhe auf 549px.
     min-height runter + Dial-Cap (s. .hero-v4-dial) → Diagramm ~355px hoch,
     Legende bekommt mehr Spaltenanteil und größere Beträge. */
  grid-template-columns: minmax(150px, 1fr) minmax(170px, 1fr);
  align-items: center;
  gap: .5rem;
  min-height: 340px;
}
.hero-v3-cylinder-wrap {
  width: 100%;
  max-width: 240px;
  display: flex;
  justify-content: center;
}
.hero-v3-cylinder {
  width: 100%;
  height: auto;
  max-width: 220px;
  aspect-ratio: 220 / 400;
  display: block;
  overflow: visible;
}
.hero-v3-cylinder__segment {
  transition: opacity 160ms ease, fill 200ms ease;
  cursor: pointer;
}
.hero-v3-cylinder__segment[data-hero-layer="reserviert"] {
  cursor: default; /* composite — kein Drill-Down (D-08) */
}
.hero-v3-cylinder__segment.is-highlighted { filter: brightness(1.12); }
.hero-v3-cylinder__seg-text text {
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  paint-order: stroke;
  /* Subtiler Dark-Stroke fuer bessere Lesbarkeit ueber hellen Segmenten. */
  stroke: rgba(0, 0, 0, 0.18);
  stroke-width: 0.6;
}

/* --- Phase 42 (HERO-V4-01): Vertikaler Halb-Donut-Dial ------------------- */
.hero-v4-dial-wrap {
  width: 100%;
  max-width: 220px;
  display: flex;
  justify-content: center;
}
.hero-v4-dial {
  width: 100%;
  height: auto;
  /* 2026-06-10: 260 → 195 (Display-Höhe 425 → ~355px). Der Donut soll die
     Karte nicht mehr dominieren; Text/Diagramm-Verhältnis s. card-body. */
  max-width: 195px;
  aspect-ratio: 220 / 400;
  display: block;
  overflow: visible;
}
.hero-v4-dial__track {
  fill: rgba(255, 255, 255, 0.03);
  stroke: none;
}
.hero-v4-dial__segment {
  transition: opacity 160ms ease, fill 200ms ease, filter 160ms ease;
  /* 2026-06-06: Halbdonut-Drill-Click deaktiviert (siehe hero-shared.js +
     dashboard-v4.html Peer-Anchors entfernt). cursor:default damit der
     Donut nicht mehr klickbar aussieht. Hover-Highlight bleibt aktiv. */
  cursor: default;
}
.hero-v4-dial__segment.is-highlighted { filter: brightness(1.14); }
/* Prozent-Labels innerhalb der Segmente — wie im Reference-Screenshot.
   Subtiler Text-Shadow fuer Lesbarkeit auf jedem Segment-Hintergrund. */
.hero-v4-dial__label {
  fill: #fff;
  font-family: inherit;
  /* viewBox-units, NICHT Display-px (feedback_svg_text_fontsize_viewbox_units):
     Scale = DialBreite/220. Bei 195px Dial → 20u ≈ 17.7px Display. */
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  paint-order: stroke fill;
  stroke: rgba(0, 0, 0, 0.22);
  stroke-width: 0.6;
  letter-spacing: 0.01em;
}

/* Custom-Tooltip-Tabelle fuer ALLE 3 Segmente (Iteration-1-Fix B-02).
   reserviert-Tooltip nutzt die zwei Grid-Spalten fuer Label/Amount; Reserve und Frei
   rendern nur eine Erklaer-Zeile (greift trotzdem auf das gleiche Container-CSS zurueck). */
.hero-v3-tooltip-table {
  position: fixed;
  z-index: 1100;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.15rem 0.8rem;
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  pointer-events: none;
  max-width: 280px;
}
.hero-v3-tooltip-table[hidden] { display: none; }
.hero-v3-tooltip-row {
  display: contents;
}
.hero-v3-tooltip-header {
  font-weight: 600;
  grid-column: 1 / -1;
  margin-bottom: 0.2rem;
}
.hero-v3-tooltip-explain {
  grid-column: 1 / -1;
  color: var(--text-muted);
  line-height: 1.35;
}
.hero-v3-tooltip-total {
  grid-column: 1 / -1;
  font-weight: 600;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border-2);
  margin-bottom: 0.2rem;
}
.hero-v3-tooltip-label { color: var(--text-muted); }
.hero-v3-tooltip-amount { text-align: right; font-variant-numeric: tabular-nums; }

/* Surface-Wellen-Path — smooth d-Morphing falls Browser es unterstuetzt. */
path[data-hero-v3-surface] { transition: d 100ms linear; }

@media (max-width: 720px) {
  .hero--v3 .hero-v3__cards { grid-template-columns: 1fr; }
  /* 2026-05-29: 4 Chips → 2×2 auf Mobile statt 4× untereinander.
     minmax(0, 1fr) statt 1fr verhindert Grid-Blow-Out durch intrinsische
     Content-Mindestbreite (vgl. project_finances_visual_qa_patterns).
     Padding/Font-Size der Chips sind am ENDE des Files überschrieben —
     hier nicht möglich weil .hero-v3__chip-label-Default später kommt
     und mit gleicher Specificity Cascade-Reihenfolge gewinnt (vgl.
     feedback_finance_visual_qa_patterns: 'Media-Query verliert gegen
     späteren Selector'). */
  .hero--v3 .hero-v3__chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-v3-stack-wrap { grid-template-columns: 1fr; }
  .hero-v3-stack { min-height: 220px; max-height: 280px; }
  .hero-v3-stack-labels { grid-template-rows: auto; gap: 0.3rem; }
}

/* Vor-Reservierung: alter „Mobile-Stack"-Block wurde nach unten verschoben,
   damit er nach den Default-Regeln der Legend kommt (cascade-Reihenfolge). */

/* Sankey-Mobile-Kompakt-Block: 2026-06-10 ans Ende des Sankey-Abschnitts
   verschoben (hinter die Default-Row-Regeln ab Z. ~1020). Der Block stand
   hier VOR den Defaults und war bei gleicher Specificity komplett tot —
   gleiche Cascade-Falle wie beim Konto-Legend-Block (vgl. Kommentar unten
   "Vor-Reservierung"). Sichtbares Symptom: 36px-Icons + Meta-Wraps auf
   iPhone trotz 28px-Mobile-Regel. */

/* D-06 Reduced-Motion: rAF-Loop in hero-dashboard-v3.js wird bereits per
   prefersReducedMotion()-Check unterdrueckt; der zuletzt gerenderte (statische)
   Wellen-Frame bleibt sichtbar. Belt-and-suspenders: CSS-Animation auf dem
   Surface-Path zusaetzlich deaktivieren falls jemand Web-Animations-API ergaenzt. */
@media (prefers-reduced-motion: reduce) {
  path[data-hero-v3-surface] { animation: none !important; }
}

/* --- Plan 29-04: Sankey-Karte (Einkommens-Flow) --- */
.hero-v3__card--sankey {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
/* Iteration-3 Re-Spec: Hybrid-Layout Sankey
   Grid: linke Spalte = SVG (Source-Saeule + Ribbons), rechte Spalte = HTML Rows. */
.hero-v3-sankey-layout {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(180px, 1.2fr);
  gap: 0;
  /* Auch Desktop: height auto + min-height, damit Content nicht aus dem Grid
     fällt wenn Rows mehr Höhe brauchen (multi-line Beträge etc.).
     2026-06-10: 380 → 340, im Verbund mit der Konto-Dial-Verkleinerung —
     beide Cards landen bei ~480px statt 549px Gesamthöhe. */
  min-height: 340px;
  align-items: stretch;
}
.hero-v3-sankey-svg-wrap {
  position: relative;
  width: 100%;
  height: 100%;
}
.hero-v3-sankey-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
/* HTML-Overlay für die Einkommens-Summe — sitzt zentriert über der violetten
   Source-Säule und wird nativ vom Browser gerendert (keine SVG-Aspect-Ratio-
   Distortion). --src-pct kommt vom Template (= source.x in % von viewbox-width). */
.hero-v3-sankey-source-wrap {
  position: absolute;
  left: 0;
  /* Phase 43 Wave 3b Folge-Fix: --src-top / --src-h tracken die SVG-Source-Säule
     (bei frei-overflow ist die Säule oben gekürzt → Label + Hover-Highlight
     müssen sich entsprechend nach unten verschieben statt full-height bleiben). */
  top: var(--src-top, 0);
  height: var(--src-h, 100%);
  width: var(--src-pct, 18%);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 1;
}
.hero-v3-sankey-source-text {
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: .02em;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 540px) {
  .hero-v3-sankey-source-text { font-size: 12px; }
}
.hero-v3-sankey-ribbon {
  transition: fill-opacity 200ms ease, stroke-opacity 200ms ease;
  cursor: pointer;
  stroke-width: 1;
  stroke-opacity: 0;
}
.hero-v3-sankey-ribbon:hover,
.hero-v3-sankey-ribbon:focus,
.hero-v3-sankey-ribbon.is-highlighted {
  fill-opacity: 0.85;
  stroke: var(--row-color, currentColor);
  stroke-opacity: 0.7;
}
/* Andere Bänder dimmen subtil, wenn ein Band aktiv ist (VFID-04 De-Emphasis) */
.hero-v3-sankey-svg:has(.hero-v3-sankey-ribbon:hover) .hero-v3-sankey-ribbon:not(:hover) {
  fill-opacity: 0.25;
}
.hero-v3-sankey-ribbon--zero {
  opacity: 0.3;
  cursor: default;
}
.hero-v3-sankey-source {
  pointer-events: none;
}
.hero-v3-sankey-source-label {
  fill: #ffffff;
  font-family: inherit;
  letter-spacing: 0.02em;
  pointer-events: none;
}

/* Rechte Spalte: 5 HTML-Rows mit Icon + Text + Progress-Linie. */
.hero-v3-sankey-rows {
  display: grid;
  grid-template-rows: repeat(5, 1fr);
  height: 100%;
  padding-left: 0.25rem;
}
.hero-v3-sankey-row {
  display: grid;
  grid-template-columns: 36px 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.6rem;
  row-gap: 0.2rem;
  align-items: center;
  align-content: center;
  padding: 0.4rem 0.5rem 0.4rem 0.6rem;
  cursor: pointer;
  border-radius: 8px;
  transition: background-color 160ms ease;
  /* 2026-06-06: Row ist jetzt <a>-Element (klickbar) — Default-Anchor-Styles
     entfernen damit Text-Farbe + Underline neutral bleiben. */
  text-decoration: none;
  color: inherit;
}
.hero-v3-sankey-row:hover,
.hero-v3-sankey-row.is-highlighted {
  background: color-mix(in srgb, var(--row-color) 12%, transparent);
  border-left: 3px solid var(--row-color);
  padding-left: calc(0.6rem - 3px);
}
.hero-v3-sankey-row--zero { cursor: default; }
.hero-v3-sankey-row--zero:hover,
.hero-v3-sankey-row--zero.is-highlighted {
  /* Phase 30 follow-up: 0%-Rows haben weder Hover noch Cross-Highlight-Effekt
     (keine Aktion, keine sinnvolle Hervorhebung). Border + Tint explizit zurücksetzen,
     damit die Sankey-Row-Hover-Regel nicht durchgreift. */
  background: transparent;
  border-left: none;
  padding-left: 0.6rem;
}
.hero-v3-sankey-row__icon {
  grid-row: 1 / span 2;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: color-mix(in srgb, var(--row-color) 18%, transparent);
  color: var(--row-color);
}
.hero-v3-sankey-row__icon svg {
  width: 18px;
  height: 18px;
}
.hero-v3-sankey-row__text {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.hero-v3-sankey-row__label {
  font-weight: 600;
  font-size: 0.92rem;
}
.hero-v3-sankey-row__meta {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
  row-gap: 0.1rem;
  font-variant-numeric: tabular-nums;
}
/* BL-BUG-07b: ohne nowrap break der Browser "1.263,61 €" zwischen Zahl und €
   bzw. "41 %" zwischen Zahl und %, was bei mittleren Beträgen 2-3 Zeilen pro
   Row erzeugt. nowrap zwingt zusammenhängend; flex-wrap auf der meta-Row
   erlaubt notfalls den Umbruch zwischen amount und percent statt mittendrin. */
.hero-v3-sankey-row__amount {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
  white-space: nowrap;
}
.hero-v3-sankey-row__percent {
  font-weight: 500;
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
  /* 2026-06-10 Polish: Prozent ans rechte Ende der Meta-Zeile — saubere
     rechtsbündige %-Spalte über dem Progress-Balken statt "klebt am Betrag". */
  margin-left: auto;
}
.hero-v3-sankey-row__progress {
  grid-column: 2;
  height: 3px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--row-color) 12%, transparent);
  overflow: hidden;
}
.hero-v3-sankey-row__progress-fill {
  display: block;
  height: 100%;
  width: var(--fill, 0%);
  background: var(--row-color);
  border-radius: 2px;
  transition: width 320ms ease;
}

.hero-v3-sankey-empty {
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  gap: 0.75rem;
  min-height: 200px;
  text-align: center;
}

/* Bug-Sweep 2026-05-24 (2.5) / 2026-05-29: Sankey-Layout auf Mobile kompakter.
   2026-06-10: Block stand vor den Default-Row-Regeln und war dadurch
   cascade-tot (gleiche Specificity, Default kam später im File und gewann —
   vgl. project_finances_visual_qa_patterns). Hierher verschoben, damit er
   wieder greift. Zusätzlich Meta-Zeile: Prozent ans rechte Zeilenende
   (margin-left:auto) — nutzt die volle Row-Breite und verhindert den
   Amount/Prozent-Umbruch bei breiten Beträgen ("1.300,00 €" + "34 %"). */
@media (max-width: 540px) {
  .hero-v3-sankey-layout {
    grid-template-columns: minmax(88px, 0.65fr) minmax(160px, 1fr);
    height: auto;
    min-height: 260px;
  }
  .hero-v3-sankey-source-label { font-size: 11px; }
  /* Row-Innenleben: Icon-Box kleiner, Fonts ~10–15% reduziert, Padding eng. */
  .hero-v3-sankey-row {
    grid-template-columns: 28px 1fr;
    column-gap: .45rem;
    padding: .25rem .35rem;
    border-radius: 6px;
  }
  .hero-v3-sankey-row:hover,
  .hero-v3-sankey-row.is-highlighted {
    border-left-width: 2px;
    padding-left: calc(.35rem - 2px);
  }
  .hero-v3-sankey-row__icon { width: 28px; height: 28px; border-radius: 7px; }
  .hero-v3-sankey-row__icon svg { width: 14px; height: 14px; }
  .hero-v3-sankey-row__label { font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hero-v3-sankey-row__amount { font-size: .82rem; }
  .hero-v3-sankey-row__percent { font-size: .72rem; }
  .hero-v3-sankey-row__progress { height: 2px; }
  .hero-v3-sankey-rows { padding-left: .15rem; }
  /* Header dichter */
  .hero-v3__card--sankey .hero-v3__card-title { font-size: .98rem; }
  .hero-v3__card--sankey .hero-v3__card-sub { font-size: .72rem; }
  .hero-v3__card--sankey .hero-v3__card-footer-link { font-size: .78rem; }
}

/* Reveal-Animation (Plan 04 Task 3) — Stagger via WAAPI in hero-dashboard-v3.js.
   CSS: keine intrinsische Animation; Reduced-Motion-Guard ueberschreibt JS-Setup. */
@media (prefers-reduced-motion: reduce) {
  .hero-v3-sankey-band {
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
  /* Phase 30 VFID-04: Sankey-Hover-Transitions deaktivieren */
  .hero-v3-sankey-ribbon { transition: none; }
  .hero-v3-sankey-row    { transition: none; }
}

/* --- Hero-Kennzahl-Chips (2026-05-29 Refactor: nur Headline + %-Wert,
       Sub-Text in (i)-Tooltip top-right) --- */
.hero-v3__chip {
  position: relative;
  /* Grid-Blow-Out-Schutz: ohne min-width:0 erzwingen die Chips ihre
     intrinsische Content-Breite (Label + padding), was bei schmaleren
     Containern (Hero auf Mobile) zum Overflow nach rechts führt. */
  min-width: 0;
  border: 1px solid var(--hero-v3-chip-border);
  border-radius: 10px;
  background: var(--hero-v3-chip-bg);
  transition: background 120ms ease, border-color 120ms ease;
}
.hero-v3__chip-link {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  padding: .7rem .9rem .8rem;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  border-radius: inherit;
}
/* Labels wie 'Fixkostenquote' sind Einzelworte und dürfen im Mobile-Engpass
   notfalls brechen (overflow-wrap), statt den Chip rauszublasen. */
.hero-v3__chip-label,
.hero-v3__chip-value,
.hero-v3__chip-cta { overflow-wrap: anywhere; }
.hero-v3__chip-link:hover,
.hero-v3__chip-link:focus-visible {
  text-decoration: none;
  outline: none;
}
.hero-v3__chip:hover {
  background: color-mix(in srgb, var(--hero-v3-chip-bg) 70%, var(--text) 6%);
  border-color: color-mix(in srgb, var(--hero-v3-chip-border) 60%, var(--text) 12%);
}
.hero-v3__chip-label {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-muted);
  /* Space rechts neben dem Label, damit das (i)-Icon das Label nicht überlappt. */
  padding-right: 1.6rem;
}
.hero-v3__chip-value {
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.hero-v3__chip-cta {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 500;
}

/* Placeholder-Variante: dashed border + dezent gedimmt. */
.hero-v3__chip--placeholder {
  border-style: dashed;
  opacity: 0.9;
}

/* === 2026-06-07 Polish: Animierte Welle als Chip-Background ===
   Wird derzeit nur am Notgroschen-Chip genutzt. Höhe == aktueller Füllstand
   (CSS-Var --chip-water-fill, 0..100). Sinus-SVG als Repeat-Background mit
   horizontaler Animation. Text + Info-Button bleiben über z-index lesbar.

   2026-06-07 Fix 1: overflow:hidden + isolation:isolate vom Outer-Chip
   ENTFERNT — sie clippten die `.hero-v3__chip-info::after`-Tooltip-Bubble,
   die unter den (i)-Button rendert, und erzeugten visuelle Glitches am
   Info-Button-Layout. overflow:hidden + gerundete Bottom-Ecken sitzen
   jetzt am Welle-Fill selbst (wo sie ohnehin nötig sind, damit die Welle
   nicht über die Card-Border ausläuft). */
.hero-v3__chip--water {
  position: relative;
}
.hero-v3__chip--water .hero-v3__chip-link {
  position: relative;
  z-index: 2;
}
.hero-v3__chip-water-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--chip-water-fill, 0%);
  pointer-events: none;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--accent, #2f7df4) 28%, transparent) 0%,
    color-mix(in srgb, var(--accent, #2f7df4) 18%, transparent) 100%
  );
  transition: height 800ms cubic-bezier(.4, 0, .2, 1);
  overflow: hidden;
  border-bottom-left-radius: inherit;
  border-bottom-right-radius: inherit;
  z-index: 0;
}
.hero-v3__chip-water-wave {
  position: absolute;
  top: -10px;
  left: -50%;
  width: 200%;
  height: 14px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 14' preserveAspectRatio='none'><path d='M0,7 Q25,0 50,7 T100,7 T150,7 T200,7 V14 H0 Z' fill='%232f7df4' fill-opacity='0.55'/></svg>");
  background-repeat: repeat-x;
  background-size: 100px 100%;
  animation: hero-chip-wave 5s linear infinite;
}
@keyframes hero-chip-wave {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(100px, 0, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-v3__chip-water-wave { animation: none; }
  .hero-v3__chip-water-fill { transition: none; }
}

/* (i)-Tooltip-Trigger oben rechts. Eigenes Button, sitzt absolut über dem Link. */
.hero-v3__chip-info {
  position: absolute;
  top: .5rem;
  right: .5rem;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: help;
  border-radius: 999px;
  transition: color 120ms ease, background 120ms ease;
  z-index: 2;
}
.hero-v3__chip-info:hover,
.hero-v3__chip-info:focus-visible {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 10%, transparent);
  outline: none;
}
.hero-v3__chip-info .icon { width: 16px; height: 16px; }

/* Tooltip-Bubble (CSS-only via ::after pseudo). */
.hero-v3__chip-info::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: max-content;
  max-width: min(260px, 75vw);
  padding: .55rem .75rem;
  background: var(--hero-tooltip-bg, #1a1a1a);
  color: var(--hero-tooltip-fg, #f5f5f5);
  font-size: .78rem;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 50;
}
.hero-v3__chip-info:hover::after,
.hero-v3__chip-info:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}
/* Light-Theme-Anpassung (Defaults oben sind dark). */
@media (prefers-color-scheme: light) {
  .hero-v3__chip-info::after {
    --hero-tooltip-bg: #2a2a2a;
    --hero-tooltip-fg: #f8f8f8;
  }
}
/* === Phase 30 VFID-01: Status-Card im Header === */
/* 2026-06-07 Polish: Card kompakter — Höhe ≈ Headline-Element gegenüber.
   Inhalt zu einer Zeile zusammengefasst (Icon + N Tage), Label "Restzeit"
   entfernt; Progress-Bar darunter. */
.hero-v3__status-card {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding: .65rem .85rem;
  border-radius: 10px;
  border: 1px solid var(--hero-v3-status-card-border);
  background: var(--hero-v3-status-card-bg);
  min-width: 160px;
  align-self: stretch;
  justify-content: center;
}
.hero-v3__status-card-row {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}
.hero-v3__status-card-icon {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
}
.hero-v3__status-card-icon svg { width: 18px; height: 18px; }
.hero-v3__status-card-value {
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.hero-v3__status-card-progress {
  height: 3px;
  border-radius: 999px;
  background: var(--hero-v3-status-card-progress-track);
  overflow: hidden;
}
.hero-v3__status-card-progress-fill {
  display: block;
  height: 100%;
  width: var(--fill, 0%);
  background: var(--hero-v3-status-card-progress-fill);
  border-radius: 999px;
  transition: width 320ms ease;
}
.hero-v3__status-card--done .hero-v3__status-card-progress-fill { width: 100%; }
@media (prefers-reduced-motion: reduce) {
  .hero-v3__status-card-progress-fill { transition: none; }
}

/* === Phase 30 VFID-09: Footer Sync-Timestamp === */
.hero-v3__data-footer {
  margin-top: .5rem;
  padding-top: .5rem;
  border-top: 1px solid var(--border);
  font-size: .8rem;
  color: var(--hero-v3-data-footer-color);
}

/* === Phase 35 FIX-02 D-07: Warning-Pill bei veraltetem Datenstand === */
/* Konsistent mit pill-success/pill-neutral-Tokens (siehe Z. 35-37, 97-99).
   Selektor-Konvention im Projekt ist [data-theme="dark"] (nicht .theme-dark);
   das Plan-Wording verlangt semantisch eine Dark-Mode-Variante. */
.hero-v3__data-footer-pill {
  display: inline-flex;
  align-items: center;
  padding: .15rem .5rem;
  margin-left: .5rem;
  border-radius: .5rem;
  font-size: .7rem;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: .01em;
  vertical-align: baseline;
}
.hero-v3__data-footer-pill--warning {
  background: #fef3c7;
  color: #92400e;
}
/* Dark-Mode: warmer Peach-on-Espresso, dark-mode-fest. Selektor-Reihenfolge
   `.theme-dark .hero-v3__data-footer-pill--warning` wird hier durch das im
   Projekt etablierte Pattern `[data-theme="dark"] ...` realisiert. */
[data-theme="dark"] .hero-v3__data-footer-pill--warning {
  background: #422006;
  color: #fdba74;
}

/* === Phase 30 VFID-02: Außen-Legende neben dem Zylinder === */
.hero-v3-cylinder-legend {
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  height: 100%;
  padding-right: .5rem;
}
.hero-v3-cylinder-legend__row {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: .55rem;
  align-items: center;
  padding: .35rem .25rem;
  border-radius: 8px;
  transition: background-color 160ms ease;
}
.hero-v3-cylinder-legend__row:hover,
.hero-v3-cylinder-legend__row.is-highlighted {
  background: color-mix(in srgb, var(--seg-color) var(--hero-v3-legend-row-tint-alpha), transparent);
}
.hero-v3-cylinder-legend__row:hover .hero-v3-cylinder-legend__sub,
.hero-v3-cylinder-legend__row.is-highlighted .hero-v3-cylinder-legend__sub {
  color: var(--text);
}
.hero-v3-cylinder-legend__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--seg-color);
  flex-shrink: 0;
}
.hero-v3-cylinder-legend__text {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  min-width: 0;
}
.hero-v3-cylinder-legend__label   {
  font-weight: 600;
  font-size: .92rem;
}
/* 2026-06-10: Betrag ist die Kern-Info der Card — von .92rem auf 1.08rem
   gehoben, damit die Legende gegen das (jetzt kleinere) Diagramm besteht. */
.hero-v3-cylinder-legend__amount  { font-weight: 600; font-size: 1.08rem; font-variant-numeric: tabular-nums; }
.hero-v3-cylinder-legend__sub     { font-size: .8rem; }

/* 2026-06-23 (Fred-Design): Deckungs-Hinweis in der Kontostand-Card.
   Zwei Stufen via --alert-color: warn (gelb) / critical (rot). */
.hero-coverage-alert {
  display: flex;
  gap: .6rem;
  align-items: flex-start;
  margin: 0 0 .85rem;
  padding: .7rem .8rem;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--alert-color) 45%, transparent);
  background: color-mix(in srgb, var(--alert-color) 12%, var(--surface));
}
.hero-coverage-alert--warn     { --alert-color: var(--hero-v3-reserve-warn); }
.hero-coverage-alert--critical { --alert-color: var(--hero-overflow); }
.hero-coverage-alert__icon {
  color: var(--alert-color);
  flex-shrink: 0;
  display: inline-flex;
  margin-top: .08rem;
}
.hero-coverage-alert__icon svg { width: 18px; height: 18px; }
.hero-coverage-alert__body { min-width: 0; }
.hero-coverage-alert__header {
  font-weight: 600;
  font-size: .9rem;
  color: var(--alert-color);
  margin: 0 0 .2rem;
}
.hero-coverage-alert__text {
  font-size: .82rem;
  line-height: 1.45;
  color: var(--text);
  margin: 0;
}
.hero-coverage-alert__cause { margin: .35rem 0 0; font-size: .75rem; }

/* Inline Info-Button neben dem Label (z.B. Reserve-Formel-Tooltip).
   Spiegelt das Verhalten von .hero-v3__chip-info (CSS-only Bubble via ::after),
   aber inline statt absolute positioniert. */
.hero-v3-cylinder-legend__info {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* 2026-05-29 Fix #3: 16px statt 18px desktop, damit die effektive Button-
     Höhe nicht über die Text-Line-Box rausragt und die Label-Row pusht.
     min-height: 0 ÜBERSCHREIBT die globale Mobile-Tap-Target-Regel
     (button { min-height: 40px }, Z. 101) — sonst wird die Box 40 px
     hoch und die Label-Höhe ebenfalls. */
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0 !important;
  margin: 0;
  line-height: 1;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: help;
  border-radius: 999px;
  flex-shrink: 0;
  vertical-align: middle;
}
.hero-v3-cylinder-legend__info:hover,
.hero-v3-cylinder-legend__info:focus-visible {
  color: var(--text);
  outline: none;
  background: color-mix(in srgb, var(--text) 10%, transparent);
}
.hero-v3-cylinder-legend__info .icon { width: 14px; height: 14px; }
.hero-v3-cylinder-legend__info::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: max-content;
  max-width: min(260px, 75vw);
  padding: .55rem .75rem;
  background: var(--hero-tooltip-bg, #1a1a1a);
  color: var(--hero-tooltip-fg, #f5f5f5);
  font-size: .76rem;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 50;
}
.hero-v3-cylinder-legend__info:hover::after,
.hero-v3-cylinder-legend__info:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .hero-v3-cylinder-legend__row { transition: none; }
}

/* Bug-Sweep 2026-05-25 (Block 2 #4): Konto-Karte auf Mobile side-by-side mit
   Legende LINKS und kleinerem Dial RECHTS (max 144px, Öffnung nach rechts wie
   in der Desktop-Variante — die geschlossene Donut-Seite zeigt zur Legende).
   Vorher: vertikal gestapelt, Dial 220px breit = "zu groß", Texte unter dem
   Diagramm wirkten verloren. Legend ist DOM-first, kommt also natürlich links. */
@media (max-width: 540px) {
  /* 2026-05-29 (Fred-Feedback #2): Konto-Karte hatte trotz erstem Compactness-
     Pass noch große Leerräume oben/unten — Ursache: Dial-Aspect-Ratio
     (220x400) erzwingt bei 128px Breite ~233px Höhe, und align-items:center
     verteilt die Differenz zur 3-Row-Legende symmetrisch oben+unten.
     Fix: Dial kleiner (98px → ~178px Höhe), align-items:start (Restraum
     nach unten unterm Footer, nicht zwischen Header und Content), Card-
     Padding/Gap weiter reduziert. */
  .hero-v3__card { padding: .85rem; gap: .5rem; }
  /* 2026-06-10 Layout-Polish Mobile: Card-Höhe war ok, aber die Fläche wurde
     schlecht genutzt — Legende klein zusammengequetscht links, Dial 108px mit
     unleserlichen %-Labels rechts, dazwischen Leerraum. Dial moderat größer
     (124px), Legende mit größeren Fonts + mehr Zeilenabstand, beide Spalten
     vertikal zentriert → Höhen matchen (~220px je Spalte). */
  .hero-v3__card-body--konto {
    grid-template-columns: 1fr minmax(108px, 124px);
    grid-template-rows: auto;
    align-items: center;
    min-height: auto;
    gap: .6rem;
  }
  .hero-v4-dial-wrap { max-width: 124px; margin: 0; }
  /* %-Labels im Dial: viewBox-units! Bei 124px Display-Breite ist Scale
     124/220 ≈ .56 → 24u ≈ 13.5px Display (vorher 18u ≈ 10px, unleserlich).
     Mobile braucht GRÖSSERE viewBox-units, nicht kleinere
     (feedback_svg_text_fontsize_viewbox_units). */
  .hero-v4-dial__label { font-size: 24px; }
  .hero-v3-cylinder-wrap { max-width: 124px; margin: 0; }
  .hero-v3-cylinder-legend {
    grid-template-rows: auto;
    gap: .45rem;
    height: auto;
    padding-right: 0;
    align-content: center;
  }
  .hero-v3-cylinder-legend__row {
    grid-template-columns: 10px 1fr;
    column-gap: .45rem;
    padding: .2rem .25rem;
    /* Dot auf die Label-Zeile ausrichten statt vertikal über den ganzen
       3-Zeilen-Block zu mitteln — das wirkte "schwebend"/unaligned. */
    align-items: start;
  }
  .hero-v3-cylinder-legend__dot { margin-top: .2rem; }
  /* Hierarchie pro Item: Name (Row 1) → Betrag + Prozent (Row 2) → Sub (Row 3).
     Betrag und Prozent stehen nebeneinander statt verstreut über das Item.
     Default ist flex-column → hier auf grid umstellen. */
  .hero-v3-cylinder-legend__text {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    column-gap: .4rem;
    row-gap: 0;
  }
  /* 2026-06-10: Fonts hoch — der Platz ist da, Betrag ist die Kern-Info. */
  .hero-v3-cylinder-legend__label   { grid-column: 1 / -1; grid-row: 1; font-size: .88rem; }
  .hero-v3-cylinder-legend__amount  { grid-column: 1 / -1; grid-row: 2; font-size: 1.05rem; }
  .hero-v3-cylinder-legend__sub     { grid-column: 1 / -1; grid-row: 3; font-size: .75rem; line-height: 1.25; }
  /* Header dichter, Title knapp ueber 1rem statt 1.05rem */
  .hero-v3__card--konto .hero-v3__card-title { font-size: .98rem; }
  .hero-v3__card--konto .hero-v3__card-sub { font-size: .72rem; }
  .hero-v3__card--konto .hero-v3__card-footer-link { font-size: .78rem; }
  /* Inline-Info-Button auf Mobile noch kompakter — 14px Box passt unter die
     .8rem-Label-Line-Box, ohne sie zu pushen (Fix #3, 2026-05-29). */
  .hero-v3-cylinder-legend__info { width: 14px; height: 14px; }
  .hero-v3-cylinder-legend__info .icon { width: 11px; height: 11px; }
  .hero-v3-cylinder-legend__label { line-height: 1.1; }
}
/* iPhone SE / sehr schmale Screens: noch etwas kleinerer Dial rechts. */
@media (max-width: 380px) {
  .hero-v3__card-body--konto {
    grid-template-columns: 1fr minmax(96px, 108px);
    gap: .45rem;
  }
  .hero-v4-dial-wrap { max-width: 108px; }
  .hero-v3-cylinder-wrap { max-width: 108px; }
}

/* === /Phase 29 Hero-v3 === */

/* === Phase 35-04: Category color editor (picker + hex live-sync) === */
.color-edit-row {
  display: flex;
  gap: .75rem;
  align-items: flex-end;
}
.color-edit-row > label {
  flex: 0 0 auto;
}
.color-edit-row__field {
  width: 9rem;
  height: 2.4rem;
  padding: .35rem .5rem;
  border: 1px solid var(--border, #d1d5db);
  border-radius: .35rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
}
.color-edit-row__field--invalid {
  border-color: var(--neg, #dc2626);
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--neg, #dc2626) 20%, transparent);
}
@media (max-width: 480px) {
  .color-edit-row {
    flex-direction: column;
    align-items: stretch;
  }
  .color-edit-row__field {
    width: 100%;
  }
}
/* === /Phase 35-04 === */

/* ============================================================
   Geldfluss-Seite — interaktiver Sankey-Drilldown
   ============================================================ */
.geldfluss {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 1180px;
  margin: 0 auto;
  padding: 1rem 0 2rem;
}

.geldfluss__header {
  /* Header-Layout identisch zum Hero (period + Restzeit-Card rechts).
     hero-v3__header bringt das Default-Layout schon mit; hier nur Hülle. */
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem 1.4rem;
}

.geldfluss__layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.geldfluss__sankey-card {
  position: sticky;
  top: calc(var(--header-h) + 1rem);
}

.geldfluss__sankey-body {
  padding-bottom: 1rem;
}

/* Sankey-Rows als Button (statt div) damit sie keyboard-fokussierbar sind. */
.geldfluss__sankey-row {
  appearance: none;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;  /* Browser-default button-color (Light-Mode oft hellgrau) bricht sonst Label-Kontrast */
  cursor: pointer;
  /* Standardrow-Styles bleiben aus hero-v3-sankey-row, hier nur Reset. */
}
/* Sankey-Row-Innentext explizit auf Theme-Variablen — Buttons erben sonst font/color schlecht */
.geldfluss__sankey-card .hero-v3-sankey-row__label { color: var(--text); }
.geldfluss__sankey-card .hero-v3-sankey-row__amount { color: var(--text); }
.geldfluss__sankey-card .hero-v3-sankey-row__percent { color: var(--text-muted); }
.geldfluss__sankey-row:focus { outline: none; }
.geldfluss__sankey-row:focus-visible {
  outline: 2px solid var(--row-color, var(--accent));
  outline-offset: 2px;
}
.hero-v3-sankey-row.is-active,
.hero-v3-sankey-ribbon.is-active {
  filter: brightness(1.08);
}
.hero-v3-sankey-row.is-active {
  background: color-mix(in srgb, var(--row-color) 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--row-color) 35%, transparent);
}
.hero-v3-sankey-ribbon.is-active {
  filter: brightness(1.12) saturate(1.1);
}

/* Detail-Panel rechts */
.geldfluss__detail {
  padding: 1.1rem 1.2rem 1.25rem;
  border-top: 3px solid var(--detail-color, var(--accent));
}

.geldfluss__detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: .9rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: .9rem;
}
.geldfluss__detail-header-main {
  display: flex;
  gap: .8rem;
  align-items: center;
  min-width: 0;
}
.geldfluss__detail-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--detail-color) 14%, transparent);
  color: var(--detail-color);
  flex-shrink: 0;
}
.geldfluss__detail-icon svg { width: 22px; height: 22px; }
.geldfluss__detail-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}
.geldfluss__detail-sub { margin: .15rem 0 0; }

.geldfluss__detail-total {
  text-align: right;
  flex-shrink: 0;
}
.geldfluss__detail-total-label { display: block; }
.geldfluss__detail-total-value {
  display: block;
  font-size: 1.1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-top: .15rem;
}
.geldfluss__detail-total-value.neg { color: var(--neg, #dc2626); }
.geldfluss__detail-total-value.pos { color: var(--pos, #16a34a); }

.geldfluss__detail-empty {
  padding: 2.5rem 1rem;
  text-align: center;
}

.geldfluss__detail-body {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.geldfluss__group--titled {
  /* Optische Trennung pro Budget */
}
.geldfluss__group-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: .15rem 0 .5rem;
  border-bottom: 1px dashed var(--border);
  margin-bottom: .35rem;
}
.geldfluss__group-title {
  margin: 0;
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--text);
  text-transform: uppercase;
}
.geldfluss__group-meta {
  display: flex;
  align-items: baseline;
  gap: .8rem;
}
.geldfluss__group-subtotal {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: .9rem;
}
.geldfluss__group-subtotal.neg { color: var(--neg, #dc2626); }
.geldfluss__group-subtotal.pos { color: var(--pos, #16a34a); }

.geldfluss__items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.geldfluss__item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .8rem;
  align-items: center;
  padding: .55rem .35rem;
  border-radius: 8px;
  transition: background .12s;
  position: relative;
}
.geldfluss__item:hover { background: var(--nav-hover); }
.geldfluss__item--upcoming { opacity: .55; }
.geldfluss__item--split .tx-icon { box-shadow: inset 0 0 0 1px var(--border); }
/* "angekündigt"-Buchungen analog zur Buchungsseite leicht ausblenden +
   kursiv — Hinweis auf den nicht-finalen Status, ohne sie zu verstecken. */
.geldfluss__item--announced .geldfluss__item-label,
.geldfluss__item--announced .geldfluss__item-amount { opacity: .85; font-style: italic; }

/* Full-row Trigger — überdeckt die gesamte Buchungs-Row als Tap-Target.
   Sichtbar nur via focus-ring; die eigentlichen Inhalte (Icon, Body, Side)
   liegen via z-index visuell darüber, sind aber via pointer-events:none
   nicht selbst klickbar, sodass jeder Tap am Trigger ankommt.
   - manuelle Tx → <button> mit HTMX-Modal
   - sonstige Tx → <a href="/transactions/{id}"> */
.geldfluss__item-trigger {
  position: absolute;
  inset: 0;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  border-radius: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  color: inherit;
  text-align: inherit;
  text-decoration: none;
  z-index: 1;
}
.geldfluss__item-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: 8px;
}
.geldfluss__item > .tx-icon,
.geldfluss__item > .geldfluss__item-body,
.geldfluss__item > .geldfluss__item-side {
  position: relative;
  z-index: 2;
  pointer-events: none;
}

.geldfluss__item .tx-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  color: #fff;
  flex-shrink: 0;
}
.geldfluss__item .tx-icon.empty {
  background: var(--surface-alt, var(--surface));
  color: var(--text-muted);
  box-shadow: inset 0 0 0 1px var(--border);
}
.geldfluss__item-body { min-width: 0; }
.geldfluss__item-label {
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.geldfluss__item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem;
  margin-top: .15rem;
  font-size: .8rem;
}
.geldfluss__item-meta .tx-pill {
  padding: .05rem .45rem;
  border-radius: 999px;
  background: var(--nav-hover);
  color: var(--text-muted);
  font-size: .72rem;
  display: inline-flex;
  align-items: center;
  gap: .25rem;
}
.geldfluss__item-meta .tx-pill svg { width: 12px; height: 12px; }
.geldfluss__item-meta .upcoming-pill {
  background: color-mix(in srgb, var(--accent, #6366f1) 12%, transparent);
  color: var(--accent, #6366f1);
}

.geldfluss__item-side {
  text-align: right;
  flex-shrink: 0;
}
.geldfluss__item-amount {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: .95rem;
}
.geldfluss__item-amount.neg { color: var(--neg, #dc2626); }
.geldfluss__item-amount.pos { color: var(--pos, #16a34a); }
.geldfluss__item-date {
  font-variant-numeric: tabular-nums;
  margin-top: .1rem;
}

@media (max-width: 900px) {
  .geldfluss__layout {
    grid-template-columns: 1fr;
  }
  .geldfluss__sankey-card {
    position: static;
  }
}

@media (max-width: 620px) {
  .geldfluss { padding: .5rem 0 1.5rem; }
  .geldfluss__header { padding: 1rem; border-radius: 12px; }
  .geldfluss__layout { gap: .85rem; }
  .geldfluss__detail { padding: 1rem .9rem 1.1rem; border-radius: 12px; }
  .geldfluss__detail-title { font-size: 1rem; }
  .geldfluss__detail-total-value { font-size: 1rem; }
  .geldfluss__item { grid-template-columns: auto 1fr auto; gap: .6rem; padding: .5rem .25rem; }
  .geldfluss__item-label { font-size: .92rem; }
}

/* === Geldfluss — Source-Button (Klick auf Einkommens-Säule) === */
.geldfluss__source-button {
  /* überschreibt .hero-v3-sankey-source-wrap pointer-events:none */
  appearance: none;
  background: transparent;
  border: none;
  color: inherit;
  font: inherit;
  pointer-events: auto;
  cursor: pointer;
  padding: 0;
  border-radius: 8px;
  transition: filter .14s ease, box-shadow .14s ease;
}
.geldfluss__source-button:hover { filter: brightness(1.06); }
.geldfluss__source-button:focus { outline: none; }
.geldfluss__source-button:focus-visible {
  box-shadow: 0 0 0 2px var(--hero-v3-source-violet);
}
.geldfluss__source-button.is-active {
  filter: brightness(1.12) saturate(1.1);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--hero-v3-source-violet) 60%, white);
}

/* === Geldfluss — Frei-Verfügbar Info-Karte === */
.geldfluss__info-card {
  padding: 1.5rem 1.25rem 1.4rem;
  text-align: center;
  background: color-mix(in srgb, var(--detail-color, var(--accent)) 6%, transparent);
  border-radius: 12px;
  margin-top: .25rem;
}
.geldfluss__info-card-value {
  font-size: 2.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--detail-color, var(--text));
  margin-bottom: .25rem;
  letter-spacing: -.01em;
}
.geldfluss__info-card-value.neg { color: var(--neg, #dc2626); }
.geldfluss__info-card-title {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .6rem;
}
.geldfluss__info-card-body {
  margin: 0 auto;
  max-width: 38ch;
  font-size: .9rem;
  line-height: 1.45;
  color: var(--text-muted);
}

/* Total-Breakdown unter der Summe (gebucht vs. anstehend) */
.geldfluss__detail-total-breakdown {
  display: block;
  margin-top: .25rem;
  font-variant-numeric: tabular-nums;
}

.geldfluss__detail-note {
  margin: -.4rem 0 .9rem;
  padding: .55rem .8rem;
  border-left: 3px solid color-mix(in srgb, var(--detail-color, var(--accent)) 50%, transparent);
  background: color-mix(in srgb, var(--detail-color, var(--accent)) 5%, transparent);
  border-radius: 0 6px 6px 0;
  font-size: .82rem;
  line-height: 1.45;
}
.geldfluss__detail-note--warn {
  border-left-color: var(--neg, #dc2626);
  background: color-mix(in srgb, var(--neg, #dc2626) 8%, transparent);
}

/* --- Konten-Seite (P41) -------------------------------------------------- */
/* 50/50-Layout reuses .geldfluss__layout. Sticky-Verhalten links erbt aus
   .geldfluss__sankey-card. Hier nur die Konten-spezifischen Komponenten. */

.konten-page .konten-chart-wrap {
  min-height: 180px;
}

/* Konto-Row als Button (statt onclick auf <li>) damit keyboard-fokussierbar
   und visual mit aria-pressed-State steuerbar. */
.konten-row {
  padding: 0;
}
.konten-row__btn {
  appearance: none;
  background: none;
  border: none;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .65rem .75rem;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border-radius: 8px;
  transition: background .12s ease, box-shadow .12s ease;
}
.konten-row__btn:hover {
  background: var(--surface-4);
}
.konten-row__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.konten-row.is-active .konten-row__btn {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  box-shadow: inset 3px 0 0 var(--accent);
}

/* --- Rücklagen-Gauge (P42) ----------------------------------------------- */
.ruecklagen-gauge {
  position: relative;
  width: 260px;
  height: 260px;
  margin: 0 auto;
  /* 2026-06-10: isolation:isolate begrenzt mix-blend-mode auf diesen
     Container. Ohne Isolation reicht der Blend bis zum Stacking-Root und
     iOS-Safari evicted unter Scroll/rAF-Repaint das fixed .tabbar aus
     seinem Compositing-Layer (Bottom-Navi rutscht mit hoch). */
  isolation: isolate;
}
.ruecklagen-gauge__svg {
  width: 100%;
  height: 100%;
  display: block;
}
.ruecklagen-gauge__bg {
  fill: var(--surface-3, #1a1f33);
}
.ruecklagen-gauge__wave {
  fill: var(--text, #f4f4f5);
  transition: d 0.4s ease;
}
.ruecklagen-gauge__ring {
  fill: none;
  stroke: color-mix(in srgb, var(--text, #f4f4f5) 18%, transparent);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}
.ruecklagen-gauge__text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-align: center;
}
.ruecklagen-gauge__current {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text, #f4f4f5);
  /* mix-blend-mode: difference invertiert die Farbe ueber der Welle automatisch.
     Funktioniert weil Wave-Fill = var(--text) und BG dunkel ist. KEIN filter
     dahinter — der wuerde das Blend-Ergebnis nochmal verfaelschen. */
  mix-blend-mode: difference;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}
.ruecklagen-gauge__target {
  font-size: 0.92rem;
  margin-top: .15rem;
  mix-blend-mode: difference;
  color: #ffffff;
}

/* --- Sparen-Seite (P42) -------------------------------------------------- */
.sparen-page__layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  gap: 1.25rem;
  /* align-items default stretch — Rücklagen/Vermögen werden auf gleiche Höhe gezogen. */
}
.sparen-page__card-body {
  padding: 1rem 0 .5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}
/* Card flex-Wrapper, damit body sich auf restliche Card-Höhe stretchen kann. */
.sparen-page__layout > .hero-v3__card {
  display: flex;
  flex-direction: column;
}
/* Gauge im Card-Body vertikal zentrieren, wenn Card durch Schwester-Card höher wird. */
.sparen-card-ruecklagen .sparen-page__card-body {
  justify-content: center;
}
.sparen-gauge-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
}

/* --- Sparen Picker-Chips ------------------------------------------------- */
.picker-form .picker-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}
.picker-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .7rem;
  border: 1px solid var(--surface-4);
  border-radius: 999px;
  font-size: .85rem;
  cursor: pointer;
  user-select: none;
  transition: background .12s ease, border-color .12s ease;
}
.picker-chip input[type="checkbox"] {
  /* Native-Checkbox versteckt — Chip-Klick toggelt sie. */
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.picker-chip:hover {
  background: var(--surface-4);
}
.picker-chip:has(input:checked) {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: var(--accent);
  color: var(--text);
}
.field-block {
  display: block;
}
.field-label {
  display: block;
  font-size: .82rem;
  color: var(--text-muted);
  margin-bottom: .25rem;
}
/* === Icon-Picker (Block 4 Icons-Sweep 2026-05-25) =========================
   Inline expandable Picker für Kategorie-/Vertrag-Icons. Trigger = Icon-Button
   im Form, Click klappt Grid + Suchfeld aus. JS-Filter via data-icon-tags. */
.icon-picker {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  margin: .25rem 0;
}
.icon-picker[open] {
  background: var(--surface-2);
}
.icon-picker__summary {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .85rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.icon-picker__summary::-webkit-details-marker { display: none; }
.icon-picker__trigger-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.icon-picker__trigger-icon .icon { width: 1.2rem; height: 1.2rem; }
.icon-picker__trigger-text {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  flex: 1;
  min-width: 0;
}
.icon-picker__trigger-label { font-weight: 500; font-size: .9rem; color: var(--text); }
.icon-picker__trigger-value { font-variant-numeric: tabular-nums; }
.icon-picker__trigger-cta {
  padding: .25rem .55rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.icon-picker[open] .icon-picker__trigger-cta { background: var(--accent-bg, var(--surface-2)); }

.icon-picker__body {
  padding: .85rem;
  border-top: 1px solid var(--border-2);
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.icon-picker__search {
  width: 100%;
  padding: .55rem .75rem;
  font-size: .92rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}
.icon-picker__search:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.icon-picker__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(2.4rem, 1fr));
  gap: .35rem;
  max-height: 18rem;
  overflow-y: auto;
  padding: .25rem;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 8px;
}
.icon-picker__group-header {
  grid-column: 1 / -1;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  padding: .5rem .25rem .15rem;
}
.icon-picker__group-header:first-child { padding-top: 0; }
.icon-picker__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color .12s, border-color .12s;
}
.icon-picker__item:hover { background: var(--surface-3, var(--surface)); border-color: var(--border); }
.icon-picker__item .icon { width: 1.25rem; height: 1.25rem; color: var(--text); }
.icon-picker__item.is-selected {
  border-color: var(--accent);
  background: var(--accent-bg, var(--surface-2));
}
.icon-picker__item.is-hidden { display: none; }
.icon-picker__group-header.is-hidden { display: none; }
.icon-picker__empty { text-align: center; margin: .25rem 0 0; }
.icon-picker__clear {
  align-self: flex-start;
  padding: .35rem .65rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-muted);
}
.icon-picker__clear:hover { color: var(--text); border-color: var(--accent); }


/* === Mobile-Overrides für Hero-Chips (am File-Ende, damit Cascade gewinnt) ===
   Muss NACH der allgemeinen .hero-v3__chip-* Definition stehen. Memory:
   feedback_finance_visual_qa_patterns / 'Media-Query verliert gegen späteren
   Selector'. Schmalere Labels passen damit auf 161px-Mobile-Chips. */
@media (max-width: 720px) {
  .hero-v3__chip-link {
    padding: .55rem .65rem .6rem;
    gap: .15rem;
  }
  .hero-v3__chip-label {
    font-size: .74rem;
    padding-right: 1.2rem;
    line-height: 1.25;
  }
  .hero-v3__chip-value { font-size: 1.1rem; }
  .hero-v3__chip-cta { font-size: .78rem; }
  .hero-v3__chip-info { top: .3rem; right: .3rem; width: 20px; height: 20px; }
  .hero-v3__chip-info .icon { width: 14px; height: 14px; }
}
