/* ==========================================================================
   style.css – Aussehen der AVD-Rechner-Seite
   Aufbau: 1) Farb-Variablen (hell/dunkel)  2) Grundlayout  3) Bausteine
   Alle Farben stehen NUR oben als Variablen ("Tokens"). Dadurch funktioniert
   der Dunkelmodus, indem man nur die Variablen austauscht.
   ========================================================================== */

/* ---------- 1) Farb-Variablen ------------------------------------------- */
:root {
  color-scheme: light;
  --bg: #f6f5f1;            /* Seitenhintergrund */
  --surface: #fcfcfb;       /* Karten */
  --surface-2: #efeee9;     /* leicht abgesetzte Flächen */
  --border: #dddcd5;
  --text: #0b0b0b;
  --text-2: #52514e;        /* Nebentext */
  --text-3: #74736d;        /* sehr leiser Text, Achsen */
  --accent: #1c5cab;        /* Links, Buttons */
  --accent-ink: #ffffff;
  --series-avd: #2a78d6;    /* Diagramm: Altersvorsorgedepot */
  --series-frei: #eb6834;   /* Diagramm: freies Depot */
  --series-ref: #9a9992;    /* Diagramm: eingezahlte Beiträge */
  --grid: #e6e5df;
  /* Status-Farben für die Ehrlichkeits-Kennzeichnung in der FAQ */
  --ok-bg: #e3f3e6;  --ok-ink: #1d5e2a;
  --warn-bg: #fdf0d5; --warn-ink: #7a4a00;
  --no-bg: #f8e1e1;  --no-ink: #8a1f1f;
  --radius: 10px;
}

/* Dunkelmodus: folgt der Systemeinstellung (Betriebssystem/Browser) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211;
    --surface: #1a1a19;
    --surface-2: #232321;
    --border: #34332f;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --text-3: #9a998f;
    --accent: #6da7ec;
    --accent-ink: #0b0b0b;
    --series-avd: #3987e5;
    --series-frei: #d95926;
    --series-ref: #7c7b74;
    --grid: #2b2b28;
    --ok-bg: #16331d;  --ok-ink: #9ad7a7;
    --warn-bg: #3a2c0c; --warn-ink: #f2c46b;
    --no-bg: #3d1717;  --no-ink: #f2a3a3;
  }
}

/* ---------- 2) Grundlayout ---------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; } /* 16px Rand am Handy */

header.site {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
header.site .wrap { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; padding-block: 14px; }
header.site .logo { font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--text); }
header.site nav { display: flex; gap: 14px; flex-wrap: wrap; font-size: .95rem; }
header.site nav a { color: var(--text-2); text-decoration: none; }
header.site nav a:hover { color: var(--accent); }

.hero { padding: 36px 0 20px; }
.hero h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); line-height: 1.15; margin: 0 0 10px; letter-spacing: -.01em; }
.hero p { max-width: 70ch; color: var(--text-2); margin: 0 0 8px; }

.notice {
  border: 1px solid var(--border); border-left: 4px solid var(--warn-ink);
  background: var(--warn-bg); color: var(--text);
  padding: 10px 14px; border-radius: var(--radius); font-size: .93rem; max-width: 80ch;
}

section { padding: 28px 0; }
h2 { font-size: 1.45rem; margin: 0 0 14px; }
h3 { font-size: 1.08rem; margin: 0 0 8px; }

/* Eckdaten-Kacheln */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.fact { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.fact .big { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.fact p { margin: 4px 0 0; color: var(--text-2); font-size: .93rem; }

/* Rechner (links) + ETF-Auswahl (rechts) nebeneinander, am Handy untereinander */
.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: minmax(0, 1fr); } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }

/* ---------- 3) Bausteine ------------------------------------------------ */

/* Formular */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 16px; }
label { display: block; font-weight: 600; font-size: .93rem; margin-bottom: 4px; }
.hint { display: block; font-weight: 400; color: var(--text-3); font-size: .82rem; margin-top: 3px; }
input[type="number"], select {
  width: 100%; padding: 8px 10px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
input[type="range"] { width: 100%; accent-color: var(--accent); }
input:focus-visible, select:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.inline { display: flex; gap: 8px; align-items: center; }
.inline input[type="number"] { max-width: 110px; }
.checkbox { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.kinder-liste { display: grid; gap: 8px; margin-top: 8px; }
.kinder-liste .inline span { min-width: 60px; color: var(--text-2); font-size: .9rem; }
details.mehr { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
details.mehr > summary { cursor: pointer; font-weight: 600; color: var(--accent); }
details.mehr .form-grid { margin-top: 12px; }

button, .btn {
  font: inherit; cursor: pointer; border-radius: 8px; padding: 6px 12px;
  border: 1px solid var(--accent); background: transparent; color: var(--accent);
}
button.primary { background: var(--accent); color: var(--accent-ink); }

.status { font-size: .9rem; color: var(--text-2); margin: 10px 0 0; min-height: 1.4em; }
.fehler { color: var(--no-ink); background: var(--no-bg); padding: 8px 12px; border-radius: 8px; }

/* Ergebnis-Kacheln */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-top: 18px; }
.kpi { background: var(--surface-2); border-radius: 8px; padding: 12px 14px; }
.kpi .label { font-size: .82rem; color: var(--text-2); }
.kpi .value { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: .82rem; color: var(--text-3); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: baseline; }
.fazit { margin: 14px 0 0; font-size: .98rem; }

/* Diagramm */
.chart-wrap { position: relative; margin-top: 16px; }
.chart-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .88rem; color: var(--text-2); margin-top: 6px; }
.legend .line { display: inline-block; width: 18px; height: 0; border-top: 2px solid; margin-right: 6px; vertical-align: middle; }
.tooltip {
  position: absolute; pointer-events: none; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: .85rem;
  box-shadow: 0 4px 14px rgba(0,0,0,.12); white-space: nowrap; display: none; z-index: 2;
  font-variant-numeric: tabular-nums;
}

/* Tabellen */
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .8rem; color: var(--text-2); font-weight: 600; }
td.num, th.num { text-align: right; }

/* ETF-Liste */
.etf { border-bottom: 1px solid var(--border); padding: 10px 0; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
.etf:last-child { border-bottom: 0; }
.etf .name { font-weight: 600; }
.etf .meta { font-size: .8rem; color: var(--text-3); grid-column: 1; }
.etf .rendite { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.etf .rendite small { display: block; font-weight: 400; font-size: .78rem; color: var(--text-3); }
.etf button { grid-column: 1 / -1; justify-self: start; font-size: .82rem; padding: 3px 10px; }
.etf-gruppe { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin: 14px 0 0; }
.fussnote { font-size: .82rem; color: var(--text-3); margin-top: 10px; }

/* FAQ mit Ehrlichkeits-Kennzeichnung */
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; }
.faq summary { cursor: pointer; padding: 12px 16px; font-weight: 600; display: flex; gap: 10px; align-items: baseline; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "+"; color: var(--accent); font-weight: 700; width: 12px; }
.faq details[open] summary::before { content: "–"; }
.faq .antwort { padding: 0 16px 14px 38px; }
.faq .antwort p, .faq .antwort ul { margin: 0 0 8px; }
.faq-filter { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; font-size: .9rem; }

.badge { font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; margin-left: auto; }
.badge.ok { background: var(--ok-bg); color: var(--ok-ink); }
.badge.warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge.no { background: var(--no-bg); color: var(--no-ink); }
.legende-badges { display: flex; gap: 14px; flex-wrap: wrap; font-size: .85rem; color: var(--text-2); margin-bottom: 12px; }
.legende-badges .badge { margin-left: 0; margin-right: 6px; }

.quellen { font-size: .88rem; columns: 2 320px; }
.quellen li { margin-bottom: 4px; break-inside: avoid; }

footer.site { border-top: 1px solid var(--border); padding: 20px 0 40px; color: var(--text-2); font-size: .88rem; }
footer.site a { color: var(--text-2); }

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