/* ============================================================
   COMPONENTS — wiederverwendbare Bausteine.
   Kein Hex-Wert, keine krummen Abstaende: alles aus tokens.css.
   ============================================================ */

/* ---- Leerer Zustand -------------------------------------------
   Die Vorlage verlangt ihn fuer JEDEN leeren Zustand: leeres
   Dashboard, leeres Portfolio, leere Transaktionsliste, leere
   Suche, leere Steuer-Events. Ein leerer Bildschirm ist kein
   Fehler, sondern die am wenigsten genutzte Flaeche im Produkt.
   -------------------------------------------------------------- */
.leerzustand {
  display: grid;
  gap: var(--space-4);
  justify-items: start;
  padding: var(--space-8);
  border: 1px dashed var(--border-strong);
  border-radius: var(--card-radius);
  background: var(--surface-card);
}
.leerzustand h2, .leerzustand h3 {
  margin: 0;
  font-size: var(--text-lg);
  color: var(--text-primary);
}
.leerzustand p { margin: 0; color: var(--text-secondary); max-width: 56ch; }
.leerzustand-aktionen { display: flex; flex-wrap: wrap; gap: var(--space-3); }

/* ---- Skeleton -------------------------------------------------
   Statische Balken, kein Pulsieren: Ein pulsierender alter Wert
   sieht aus wie ein aktueller. Waehrend Marktdaten nachladen,
   soll sichtbar sein, dass noch nichts da ist.
   -------------------------------------------------------------- */
.skelett {
  display: inline-block;
  min-width: 4ch;
  height: 1em;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  color: transparent !important;
  user-select: none;
}
.skelett--breit { width: 100%; min-width: 0; }
.skelett--zeile { height: var(--space-4); margin-block: var(--space-1); }

/* ---- Badge ----------------------------------------------------
   Ein Muster fuer alle Zustaende. Das Geschaetzt-Badge markiert
   ueberall dort, wo value_is_estimated gilt - sonst sieht ein
   Modellwert aus wie ein gemessener.
   -------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.4;
  border: 1px solid var(--border-subtle);
  background: var(--surface-raised);
  color: var(--text-secondary);
}
.badge--geschaetzt { border-style: dashed; border-color: var(--border-strong); }
.badge--positiv { background: var(--state-positive-soft); border-color: var(--state-positive-border); color: var(--state-positive); }
.badge--warnung { background: var(--state-warning-soft); border-color: var(--state-warning-border); color: var(--state-warning); }
.badge--negativ { background: var(--state-negative-soft); border-color: var(--state-negative-border); color: var(--state-negative); }
.badge--info { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }

/* ---- Statusaussage --------------------------------------------
   Ebene 1 des Dashboards: eine Aussage in Klartext, gestuetzt
   durch Farbe UND Symbol UND Text. Nie Farbe allein.
   -------------------------------------------------------------- */
.statuskarte {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-4) var(--space-4);
  align-items: start;
  padding: var(--space-6);
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-card);
}
.statuskarte-symbol {
  display: grid; place-items: center;
  width: var(--space-8); height: var(--space-8);
  border-radius: var(--radius-full);
  border: 1px solid currentColor;
}
.statuskarte--warnung .statuskarte-symbol { color: var(--state-warning); background: var(--state-warning-soft); }
.statuskarte--positiv .statuskarte-symbol { color: var(--state-positive); background: var(--state-positive-soft); }
.statuskarte h2 { margin: 0 0 var(--space-2); font-size: var(--text-2xl); line-height: var(--leading-snug); }
.statuskarte p { margin: 0; color: var(--text-secondary); font-size: var(--text-base); }
.statuskarte-herkunft { margin-top: var(--space-3); font-size: var(--text-xs); color: var(--text-muted); }

/* ---- Fortschritt ----------------------------------------------
   Der Balken traegt keine Information allein: Prozentzahl und
   Beschriftung stehen daneben.
   -------------------------------------------------------------- */
.fortschritt { display: grid; gap: var(--space-2); margin-top: var(--space-4); }
.fortschritt-spur {
  height: var(--space-2);
  border-radius: var(--radius-full);
  background: var(--border-subtle);
  overflow: hidden;
}
.fortschritt-fuellung { height: 100%; background: var(--state-warning-fill); border-radius: inherit; }
.fortschritt--positiv .fortschritt-fuellung { background: var(--state-positive); }
.fortschritt-marken {
  display: flex; justify-content: space-between;
  font-size: var(--text-xs); color: var(--text-muted);
}
.fortschritt-marken b { color: var(--state-warning); font-weight: 600; }
.fortschritt--positiv .fortschritt-marken b { color: var(--state-positive); }

/* ---- Segmentierte Auswahl ------------------------------------- */
.segmente {
  display: inline-flex; gap: var(--space-1);
  padding: var(--space-1);
  background: var(--surface-raised);
  border-radius: var(--radius-md);
}
.segmente button {
  border: 0; background: transparent; cursor: pointer;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm); font-weight: 500;
  color: var(--text-secondary);
}
.segmente button[aria-pressed="true"] {
  background: var(--surface-card);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-card);
}

/* ---- Datentabelle ---------------------------------------------
   EIN Muster fuer Portfolio, Transaktionen, Reports und
   Steuer-Events. Unter 640px werden Zeilen zu Karten - waagerecht
   scrollen ist auf dem Telefon keine Loesung.
   -------------------------------------------------------------- */
.datentabelle { width: 100%; border-collapse: collapse; }
.datentabelle th {
  text-align: start;
  font-size: var(--text-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}
.datentabelle td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--table-row-border);
  font-size: var(--text-sm);
  color: var(--text-primary);
}
.datentabelle td.zahl, .datentabelle th.zahl { text-align: end; }
.datentabelle tbody tr:hover { background: var(--surface-raised); }

@media (max-width: 640px) {
  .datentabelle, .datentabelle tbody, .datentabelle tr, .datentabelle td { display: block; width: 100%; }
  .datentabelle thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .datentabelle tr {
    margin-bottom: var(--space-3);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--surface-card);
  }
  .datentabelle td { display: flex; justify-content: space-between; gap: var(--space-4); border-bottom: 1px solid var(--table-row-border); }
  .datentabelle td:last-child { border-bottom: 0; }
  .datentabelle td::before {
    content: attr(data-spalte);
    font-size: var(--text-xs); font-weight: 600;
    text-transform: uppercase; letter-spacing: .04em;
    color: var(--text-muted);
  }
  .datentabelle td.zahl { text-align: end; }
}

/* ---- Ebene 1 des Dashboards -----------------------------------
   Eine Aussage plus drei Stuetzzahlen. Alles Weitere gehoert in
   die Detailbloecke.
   -------------------------------------------------------------- */
.ebene-antwort {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(260px, 1fr);
  gap: var(--space-6);
  align-items: start;
  margin-bottom: var(--space-6);
}
@media (max-width: 1024px) { .ebene-antwort { grid-template-columns: 1fr; } }
.statuskarte-aktionen { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-4); }

.stuetzzahlen {
  display: grid;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-card);
  padding: var(--space-2) var(--space-6);
}
.stuetzzahlen > div {
  display: grid; gap: var(--space-1);
  padding-block: var(--space-4);
}
.stuetzzahlen > div + div { border-top: 1px solid var(--border-subtle); }
.stuetzzahl-titel {
  font-size: var(--text-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted);
}
.stuetzzahlen strong {
  font-size: var(--text-2xl); font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

/* ---- Ebene 4: Detailbloecke -----------------------------------
   Native details/summary: Tastaturbedienung, Screenreader-Semantik
   und Suchfunktion des Browsers funktionieren ohne eigenes Skript.
   -------------------------------------------------------------- */
.detail-block, .kennzahlen-details {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--card-radius);
  margin-bottom: var(--space-4);
}
.detail-block > summary, .kennzahlen-details > summary {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  cursor: pointer;
  font-size: var(--text-sm); font-weight: 600;
  color: var(--text-primary);
  list-style: none;
}
.detail-block > summary::-webkit-details-marker,
.kennzahlen-details > summary::-webkit-details-marker { display: none; }
.detail-block > summary::before, .kennzahlen-details > summary::before {
  content: "▸"; color: var(--text-muted); font-size: var(--text-xs);
  transition: transform .12s ease-out;
}
.detail-block[open] > summary::before,
.kennzahlen-details[open] > summary::before { transform: rotate(90deg); }
.detail-block > summary > .detail-titel { flex: 1 1 auto; }
.details-vorschau {
  font-weight: 400; font-size: var(--text-xs);
  color: var(--text-muted); font-variant-numeric: tabular-nums;
  text-align: end;
}
.detail-block[open] > *:not(summary),
.kennzahlen-details[open] > *:not(summary) {
  padding: 0 var(--space-6) var(--space-6);
}

.kennzahl-liste {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
}
.kennzahl-liste > div { display: grid; gap: var(--space-1); }
.kennzahl-liste span { font-size: var(--text-xs); color: var(--text-muted); }
.kennzahl-liste strong { font-size: var(--text-lg); font-variant-numeric: tabular-nums; }

/* ======= Aus app.css uebernommen: Bausteine ======= */
.flash { border: 1px solid var(--border-subtle); background: var(--surface-card); border-radius: 18px; padding: var(--space-3) var(--space-4); box-shadow: var(--shadow-raised); color: var(--text-primary); }
.flash.error { border-color: var(--state-negative-border); background: var(--state-negative-soft); }
.flash.success { border-color: var(--state-positive-border); background: var(--state-positive-soft); }
.flash.info { border-color: var(--color-blue-200); background: var(--accent-soft); }
.notice { color: var(--text-muted); font-size: .88rem; line-height: 1.5; margin-top: var(--space-4); }
.button { display: inline-flex; min-height: 48px; align-items: center; justify-content: center; padding: 0 var(--space-4); border-radius: 999px; background: var(--text-primary); color: var(--surface-card); font-weight: 800; border: 0; cursor: pointer; }
.button.secondary { background: var(--border-subtle); color: var(--text-primary); }
.button.wide { width: 100%; }
.feature-card, .metric-card, .chart-card, .input-card, .table-card, .auth-card, .price-card { background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--card-radius); box-shadow: var(--shadow-raised); }
.feature-card { padding: var(--space-6); display: grid; gap: var(--space-2); }
.feature-card strong { font-size: 1.08rem; }
.feature-card span { color: var(--text-muted); line-height: 1.55; }
.auth-card { width: min(520px, 100%); padding: clamp(24px, 4vw, 42px); }
.auth-card h1 { font-size: clamp(2.3rem, 5vw, 3.7rem); }
.form-stack, .plan-form { display: grid; gap: var(--space-3); }
.small-link { margin: var(--space-4) 0 0; color: var(--text-muted); }
.small-link a { color: var(--accent); font-weight: 800; }
.status-pill { white-space: nowrap; padding: var(--space-3) var(--space-4); border-radius: 999px; font-weight: 900; border: 1px solid var(--border-subtle); background: var(--surface-card); }
.status-pill.behind { color: var(--state-negative); background: var(--state-negative-soft); border-color: var(--state-negative-border); }
.status-pill.ahead { color: var(--state-positive); background: var(--state-positive-soft); border-color: var(--state-positive-border); }
.status-pill.on_track { color: var(--accent-text); background: var(--accent-soft); border-color: var(--color-blue-200); }
.metric-card { padding: var(--space-6); }
.metric-card span { display: block; color: var(--text-muted); margin-bottom: var(--space-2); }
.metric-card strong { font-size: clamp(1.35rem, 2vw, 2rem); letter-spacing: -.04em; }
.chart-card, .input-card, .table-card { padding: clamp(20px, 2.5vw, 30px); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-4); margin-bottom: var(--space-4); }
.card-head p { margin: var(--space-1) 0 0; color: var(--text-muted); line-height: 1.5; }
.card-head span { color: var(--text-muted); font-weight: 800; }
.chart-legend-text { display: flex; flex-wrap: wrap; gap: var(--space-4); color: var(--text-muted); margin-top: var(--space-4); }
.chart-legend-text span { display: inline-flex; align-items: center; gap: var(--space-2); }
.chart-legend-text b { width: 20px; height: 4px; border-radius: 999px; display: inline-block; }
.legend-soll { background: var(--chart-target); }
.legend-ist { background: var(--chart-current); }
.legend-paid { background: var(--chart-invested); }
.table-card { margin-top: var(--space-4); }
.table-scroll { overflow-x: auto; }
.price-card { width: min(520px, 100%); padding: clamp(24px, 4vw, 38px); }
@media (max-width: 640px) {
  .status-pill { white-space: normal; }
}
.flash { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); transition: opacity .22s ease, transform .22s ease; }
.flash.is-hiding { opacity: 0; transform: translateY(-6px); }
.flash-close { border: 0; background: transparent; color: var(--text-secondary); font-size: 1.15rem; line-height: 1; cursor: pointer; padding: 0 2px; }
.check-label { display: flex; align-items: center; gap: var(--space-2); min-height: 48px; border: 1px solid var(--border-strong); border-radius: 15px; padding: 0 var(--space-3); background: var(--surface-card); }
.check-label input { width: 18px; min-height: 18px; }
.legend-pessimistic { background: var(--chart-pessimistic); }
.legend-optimistic { background: var(--chart-optimistic); }
@media print {
  .table-card { box-shadow: none; }
}
@media (max-width: 1024px) {
  .metric-card { padding: var(--space-4); border-radius: 20px; }
  .metric-card strong { font-size: 1.28rem; }
  .chart-card, .input-card, .table-card { padding: var(--space-4); border-radius: 22px; }
  .table-scroll { margin-inline: -8px; padding-inline: var(--space-2); }
}
.mini-dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; margin: 0; }
.mini-dl div { border-radius: 14px; background: var(--surface-page); padding: .6rem; }
.mini-dl dt { font-size: .72rem; color: var(--text-muted); margin-bottom: .25rem; }
.mini-dl dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.compact-actions { margin: .75rem 0 1rem; }
.row-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline-button { background: var(--accent-soft); color: var(--accent-text); border: 0; border-radius: 999px; padding: .45rem .7rem; font-weight: 800; cursor: pointer; }
@media (max-width: 1024px) {
  .mini-dl { grid-template-columns: 1fr; }
}
.feature-card, .metric-card, .chart-card, .input-card, .table-card, .auth-card, .price-card,
.etf-card, .definition-grid div, .checklist-panel div, .export-card, .mini-metric, .assumption-grid div {
  background: var(--surface-raised);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}
.hero-points span, .dashboard-tabs a, .status-pill, .qr-box, .manual-key, .recovery-code-grid code {
  background: var(--surface-raised);
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}
.button { background: var(--button-primary-bg); color: var(--text-on-accent); }
.button.secondary { background: var(--surface-raised); color: var(--text-primary); border: 1px solid var(--border-subtle); }
/* Form ohne Farbe: die Pillen stehen im Beispielpanel auf einer Flaeche,
   die dem Thema folgt. Feste Weisstoene waren im hellen Modus unlesbar. */
.preview-pill,
.preview-status,
.chart-tabs span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  min-height: 34px;
  padding: 0 var(--space-3);
  border-radius: 999px;
  border: 1px solid var(--hero-line);
  background: var(--hero-chip);
  color: var(--hero-text);
  font-weight: 900;
  letter-spacing: -.02em;
  box-shadow: inset 0 1px 0 var(--hero-inset);
}
.chart-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
  padding: 0 var(--space-1);
}
/* Ohne min-width:0 behaelt der Titelblock seine Inhaltsbreite und
   schiebt Kennzahl und Zeitraum-Umschalter aus der Karte heraus. */
.chart-card-head > div:first-child { min-width: 0; }
.chart-card-head > div:first-child {
  display: grid;
  gap: var(--space-1);
}
.chart-card-head strong {
  font-size: 1rem;
  letter-spacing: -.035em;
}
.chart-tabs { display: inline-flex; gap: var(--space-1); }
.chart-tabs span {
  min-height: 30px;
  padding-inline: var(--space-2);
  font-size: .72rem;
  color: var(--hero-text-muted);
}
.chart-tabs .active {
  background: var(--hero-accent);
  color: var(--text-on-accent);
  border-color: var(--hero-accent);
}
.legend-target { background: var(--chart-target); }
.legend-actual { background: var(--chart-current); }
.legend-paid { background: var(--chart-invested); opacity: .85; }
@media (max-width: 640px) {
  .chart-card-head { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 640px) {
  .chart-card-head {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }
}
.feature-card span { font-size: 1rem; }
.plan-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.plan-chip {
  display: grid;
  gap: var(--space-1);
  min-width: min(260px, 100%);
  padding: var(--space-3) var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  background: var(--surface-sunken);
  color: var(--text-secondary);
}
.plan-chip strong { color: var(--text-primary); }
.plan-chip span { color: var(--text-muted); font-size: .86rem; font-weight: 750; }
.plan-chip.active {
  border-color: var(--color-blue-400);
  background: linear-gradient(135deg, var(--accent-soft), var(--surface-raised));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.mini-dl div {
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}
.mini-dl dt {
  color: var(--text-secondary);
}
.mini-dl dd {
  color: var(--text-primary);
}
.button.ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}
.selected-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-weight: 850;
}
.selected-summary-row strong {
  color: var(--text-primary);
}
.selected-summary-row strong.negative {
  color: var(--state-negative-border);
}
html[data-theme="dark"] .mini-dl div,
html[data-theme="dark"] .selected-etf-row {
  background: var(--surface-sunken);
  border-color: var(--border-subtle);
}
html[data-theme="dark"] .inline-button,
html[data-theme="dark"] .soft-inline-button {
  background: var(--surface-card);
  color: var(--accent-soft);
  border-color: var(--border-subtle);
}
html[data-theme="dark"] .etf-card p,
html[data-theme="dark"] .selected-etf-name span,
html[data-theme="dark"] .mini-dl dt {
  color: var(--text-secondary);
}
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .mini-dl div,
  html[data-theme="auto"] .selected-etf-row {
    background: var(--surface-sunken);
    border-color: var(--border-subtle);
  }
  html[data-theme="auto"] .inline-button,
  html[data-theme="auto"] .soft-inline-button {
    background: var(--surface-card);
    color: var(--accent-soft);
    border-color: var(--border-subtle);
  }
  html[data-theme="auto"] .etf-card p,
  html[data-theme="auto"] .selected-etf-name span,
  html[data-theme="auto"] .mini-dl dt {
    color: var(--text-secondary);
  }
}
@media (max-width: 1024px) {
  .allocation-controls .button,
  .selected-summary-row .button {
    width: 100%;
  }
}
.estimate-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-left: var(--space-2);
  padding: 2px var(--space-2);
  border-radius: 999px;
  border: 1px solid var(--color-blue-200);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: .64rem;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: .02em;
  vertical-align: middle;
}
html[data-theme="dark"] .estimate-badge {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--color-blue-200);
}
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .estimate-badge {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--color-blue-200);
  }
}
.toast {
  --toast-accent: var(--accent);
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 32px;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  overflow: hidden;
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-3);
  border: 1px solid color-mix(in srgb, var(--toast-accent) 32%, var(--border-subtle));
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface-raised) 94%, var(--toast-accent) 6%);
  color: var(--text-primary);
  box-shadow: 0 18px 54px rgba(15, 23, 42, .18);
  opacity: 0;
  transform: translateY(-10px) scale(.985);
  transition: opacity .22s ease, transform .22s ease;
  pointer-events: auto;
}
.toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.toast.is-hiding {
  opacity: 0;
  transform: translateY(-8px) scale(.985);
}
.toast.success { --toast-accent: var(--state-positive); }
.toast.error { --toast-accent: var(--state-negative); }
.toast.info { --toast-accent: var(--state-info); }
.toast.loading { --toast-accent: var(--state-info); }
.toast-icon {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 11px;
  background: color-mix(in srgb, var(--toast-accent) 14%, transparent);
  color: var(--toast-accent);
  font-size: .88rem;
  font-weight: 950;
  line-height: 1;
}
.toast.success .toast-icon::before { content: "✓"; }
.toast.error .toast-icon::before { content: "!"; }
.toast.info .toast-icon::before { content: "i"; }
.toast.loading .toast-icon::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid color-mix(in srgb, var(--toast-accent) 28%, transparent);
  border-top-color: var(--toast-accent);
  border-radius: 50%;
  animation: toast-spin .8s linear infinite;
}
.toast-copy {
  min-width: 0;
  color: var(--text-primary);
  font-size: .9rem;
  font-weight: 760;
  line-height: 1.42;
  overflow-wrap: anywhere;
}
.toast-close {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  align-self: start;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.18rem;
  line-height: 1;
  transition: background .16s ease, color .16s ease;
}
.toast-close:hover {
  background: color-mix(in srgb, var(--toast-accent) 10%, transparent);
  color: var(--text-primary);
}
.toast-close:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--toast-accent) 34%, transparent);
  outline-offset: 1px;
}
.toast-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--toast-accent);
  transform: scaleX(0);
  transform-origin: left;
  opacity: .72;
}
.toast[data-auto-dismiss="true"].restart-progress .toast-progress {
  animation: toast-progress var(--toast-duration, 5200ms) linear forwards;
}
.toast.is-paused .toast-progress { animation-play-state: paused; }
@keyframes toast-spin { to { transform: rotate(360deg); } }
@keyframes toast-progress { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.metric-card,
.metric-card > *,
.definition-grid > *,
.plan-switcher-head > *,
.card-head > *,
.allocation-overview-item,
.allocation-overview-item > *,
.allocation-overview-item dl,
.allocation-overview-item dl > *,
.security-cell > div,
.selected-etf-name > div,
.phase-row > * {
  min-width: 0;
}
.metric-card {
  overflow: hidden;
}
.metric-card span,
.metric-card strong,
.definition-grid strong,
.definition-grid span,
.plan-chip strong,
.plan-chip span,
.card-head h2,
.card-head p,
.info-band,
.allocation-overview-item strong,
.allocation-overview-item span,
.allocation-overview-item dt,
.allocation-overview-item dd {
  overflow-wrap: anywhere;
}
.metric-card strong {
  display: block;
  max-width: 100%;
  font-size: clamp(1.28rem, 1.55vw, 1.9rem);
  line-height: 1.08;
  font-variant-numeric: tabular-nums;
  word-break: normal;
}
.card-head > .button,
.card-head > a.button {
  flex: 0 0 auto;
  max-width: 100%;
  white-space: normal;
  text-align: center;
}
.destructive-button,
.inline-danger {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 40px;
  max-width: 100%;
  padding: 0 var(--space-3);
  border: 1px solid color-mix(in srgb, var(--state-negative) 34%, var(--border-subtle));
  border-radius: 12px;
  background: color-mix(in srgb, var(--state-negative) 8%, var(--surface-raised));
  color: var(--state-negative);
  font-weight: 860;
  line-height: 1.1;
  text-align: center;
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.destructive-button:hover,
.inline-danger:hover {
  border-color: color-mix(in srgb, var(--state-negative) 58%, var(--border-subtle));
  background: color-mix(in srgb, var(--state-negative) 14%, var(--surface-raised));
  color: var(--state-negative);
  box-shadow: 0 10px 24px rgba(185, 28, 28, .10);
}
.destructive-button:active,
.inline-danger:active { transform: translateY(1px); }
.destructive-button:focus-visible,
.inline-danger:focus-visible {
  outline: 3px solid rgba(220, 38, 38, .22);
  outline-offset: 2px;
}
.destructive-button-icon {
  width: 19px;
  height: 19px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 6px;
  background: color-mix(in srgb, var(--state-negative) 12%, transparent);
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
}
.destructive-button-compact { min-height: 36px; padding-inline: var(--space-2); font-size: .82rem; }
.row-actions .destructive-button { width: auto; }
html[data-theme="dark"] .destructive-button,
html[data-theme="dark"] .inline-danger {
  border-color: var(--state-negative-border);
  background: var(--state-negative-soft);
  color: var(--state-negative-border);
}
html[data-theme="dark"] .destructive-button:hover,
html[data-theme="dark"] .inline-danger:hover {
  border-color: var(--state-negative-border);
  background: var(--state-negative-soft);
  color: var(--state-negative-soft);
}
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .destructive-button,
  html[data-theme="auto"] .inline-danger {
    border-color: var(--state-negative-border);
    background: var(--state-negative-soft);
    color: var(--state-negative-border);
  }
  html[data-theme="auto"] .destructive-button:hover,
  html[data-theme="auto"] .inline-danger:hover {
    border-color: var(--state-negative-border);
    background: var(--state-negative-soft);
    color: var(--state-negative-soft);
  }
}
@media (max-width: 640px) {
  .metric-card strong { font-size: clamp(1.35rem, 7vw, 1.9rem); }
  .row-actions .destructive-button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .toast,
  .toast-progress,
  .toast.loading .toast-icon::before,
  .destructive-button,
  .inline-danger {
    animation: none !important;
    transition: none !important;
  }
  .toast { opacity: 1; transform: none; }
  .toast-progress { display: none; }
}
.flash.toast {
  border-color: color-mix(in srgb, var(--toast-accent) 32%, var(--border-subtle));
  background: color-mix(in srgb, var(--surface-raised) 94%, var(--toast-accent) 6%);
  color: var(--text-primary);
}