/* V4.1 – Ergebnisansicht: gemeinsame Farbvariablen (Palette aus dem freigegebenen Mock-up), Hell/Dunkel, neue Bereiche B–E.
   Keine inline-Styles (CSP style-src 'self'). Dunkelmodus: html[data-theme="dark"]; Standard folgt dem System (theme.js). */
:root {
  --ink: #092746; --sub: #455d70; --paper: #ffffff; --ground: #f3f7fa; --line: #dce6ed; --green: #12654c; --tint: #e8f6ef; --blue: #174f86;
  --d-flaeche: #132437; --d-flaeche2: #182c42;
  color-scheme: light;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e6eff8; --sub: #adbdcc; --paper: #132437; --ground: #0c1928; --line: #32485c; --green: #91e2bf; --tint: #1b3c36; --blue: #a5d1ff;
  --papier: #0c1928; --flaeche: #132437; --tinte: #e6eff8; --grau: #adbdcc; --hell: #8fa3b5; --linie: #32485c; --linie2: #243a50;
  --petrol: #a5d1ff; --petrol-hell: #1a3350; --blau: #6fb2ec; --gold: #d3b96f; --gold-hell: #3a3220;
  --rot: #f0948a; --rot-hell: #432a29; --gruen: #7fd1a9; --gruen-hell: #1c3a30;
}
html[data-theme="dark"] body { background: var(--papier); color: var(--tinte); }
/* Flächen mit weißem Text auf dunklem Navy (im Dunkelmodus bleibt die Fläche dunkelblau, nicht hell) */
html[data-theme="dark"] .kopf, html[data-theme="dark"] .primaer, html[data-theme="dark"] #btnSummaryPdf, html[data-theme="dark"] .kz-haupt,
html[data-theme="dark"] .nk-titel, html[data-theme="dark"] .em-schritt, html[data-theme="dark"] .vs-nkf, html[data-theme="dark"] .vs-neu,
html[data-theme="dark"] .p3-k:first-child, html[data-theme="dark"] .v380-faktor.dunkel, html[data-theme="dark"] .hi-kpi.dunkel,
html[data-theme="dark"] .vg3 .vg-teil span, html[data-theme="dark"] .pkte i.voll, html[data-theme="dark"] .band-st,
html[data-theme="dark"] .kf-seg.wc, html[data-theme="dark"] .legende i.wc, html[data-theme="dark"] .schritt-nr, html[data-theme="dark"] .links-leiste::before, html[data-theme="dark"] .ergebnis::before,
html[data-theme="dark"] .stufen button[aria-pressed="true"], html[data-theme="dark"] .reiter button[aria-pressed="true"], html[data-theme="dark"] .umschalter button[aria-pressed="true"],
html[data-theme="dark"] .seg button[aria-pressed="true"], html[data-theme="dark"] .za-wahl button[aria-pressed="true"], html[data-theme="dark"] .al-chip.an,
html[data-theme="dark"] .vs-zielwahl button[aria-pressed="true"], html[data-theme="dark"] .wahl-kacheln button[aria-checked="true"],
html[data-theme="dark"] .v380-kompass .stufen button[aria-pressed="true"] { background: #1f4e85; border-color: #4f86c4; color: #fff; }
html[data-theme="dark"] .kopf { background: #071a31; }
html[data-theme="dark"] .kopf .logo { filter: brightness(1.15); }
html[data-theme="dark"] .primaer:hover { background: #2a62a0; }
html[data-theme="dark"] .v380-faktor.dunkel p, html[data-theme="dark"] .v380-kompass .stufen button[aria-pressed="true"] small { color: #d6e6f6; }
html[data-theme="dark"] img.logo { background: transparent; }
html[data-theme="dark"] svg text { fill: currentColor; }
html[data-theme="dark"] .bereich { --bt: #12263a; }

/* Umschalter oben rechts */
.theme-toggle { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .7rem; border: 1px solid rgba(255,255,255,.35); border-radius: 6px; background: transparent; color: #fff; font-weight: 600; font-size: .9rem; cursor: pointer; }
.theme-toggle:hover { border-color: var(--gold); color: var(--gold); }
.theme-toggle .theme-ico { font-size: 1.05rem; line-height: 1; }
.theme-toggle[aria-pressed="true"] { background: rgba(255,255,255,.12); }

/* Info-Symbole und Rechenweg (A) */
.v41-info { display: inline-flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem; margin-left: .35rem; padding: 0; border: 1.5px solid currentColor; border-radius: 50%; background: transparent; color: inherit; font: 700 .8rem/1 var(--schrift); cursor: pointer; vertical-align: middle; position: relative; opacity: .9; }
.v41-info:hover, .v41-info:focus-visible, .v41-info[aria-expanded="true"] { opacity: 1; background: rgba(127,127,127,.22); }
.v41-info .v41-tip { position: absolute; z-index: 30; left: 50%; bottom: calc(100% + .45rem); transform: translateX(-50%); width: max-content; max-width: min(18rem, 70vw); padding: .5rem .65rem; border-radius: 8px; background: #092746; color: #fff; font: 400 .8rem/1.4 var(--schrift); text-align: left; box-shadow: 0 6px 20px rgba(0,0,0,.28); display: none; pointer-events: none; }
html[data-theme="dark"] .v41-info .v41-tip { background: #e6eff8; color: #092746; }
.v41-info:hover .v41-tip, .v41-info:focus-visible .v41-tip { display: block; }
.v41-rechenweg { margin: .7rem 0 0; padding: .8rem .95rem; border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 10px; background: var(--paper); color: var(--ink); font-size: .88rem; font-weight: 400; text-align: left; }
.v41-rechenweg[hidden] { display: none; }
.v41-rechenweg h4 { margin: 0 0 .35rem; font-size: .95rem; }
.v41-rechenweg p { margin: .35rem 0; }
.v41-formel { font-weight: 700; font-size: 1.02rem; letter-spacing: -.01em; }
.v41-einfach { padding: .5rem .65rem; border-radius: 8px; background: var(--tint); color: var(--ink); }
.v41-split-zeile { margin: .25rem 0 0; font-size: .85rem; color: var(--sub); }

/* Sektionen B–E */
.v41-sektion { margin: 1.4rem 0; padding: 1.2rem clamp(.9rem, 2.4vw, 1.5rem); border: 1px solid var(--line); border-radius: 16px; background: var(--paper); color: var(--ink); }
.v41-sektion > h2 { display: flex; align-items: center; gap: .65rem; margin: 0 0 .6rem; font-size: 1.35rem; color: var(--ink); }
.v41-sektion h3 { color: var(--ink); font-size: 1.02rem; margin: 1rem 0 .4rem; }
.v41-sektion .bereich-marke { flex: 0 0 auto; width: 2rem; height: 2rem; border-radius: 50%; background: var(--blue); color: var(--paper); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1rem; }
.v41-klein { margin: .3rem 0; font-size: .85rem; color: var(--sub); }
.v41-sektion p { max-width: 70ch; }
.v41-hero { background: linear-gradient(160deg, var(--tint), var(--paper) 70%); border-color: color-mix(in srgb, var(--green) 35%, var(--line)); }
.v41-zahl { display: block; font-size: clamp(3rem, 9vw, 4.6rem); line-height: 1; letter-spacing: -.04em; color: var(--green); margin: .2rem 0 .1rem; }
.v41-satz { margin: 0 0 .3rem; font-size: 1.1rem; }
.v41-fs { margin: 1rem 0 .4rem; padding: 0; border: 0; }
.v41-fs legend { padding: 0; font-weight: 700; margin-bottom: .45rem; }
.v41-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.v41-opt { display: flex; gap: .55rem; align-items: flex-start; padding: .75rem .9rem; border: 1.5px solid var(--line); border-radius: 12px; background: var(--paper); cursor: pointer; font-weight: 600; }
.v41-opt:hover { border-color: var(--blue); }
.v41-opt:has(input:checked) { border-color: var(--green); background: var(--tint); }
.v41-opt:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
.v41-opt input { margin-top: .25rem; accent-color: var(--green); }
.v41-wirkung { margin: .8rem 0 .3rem; padding: .7rem .9rem; border-radius: 10px; background: var(--tint); border: 1px solid color-mix(in srgb, var(--green) 30%, var(--line)); font-weight: 700; color: var(--ink); }
.v41-vorschau { font-weight: 600; color: var(--sub); }
.v41-btn { padding: .6rem 1.1rem; border: 0; border-radius: 8px; background: var(--green); color: var(--paper); font-weight: 700; cursor: pointer; margin: .3rem 0; }
html[data-theme="dark"] .v41-btn { color: #07261c; }
.v41-btn:hover { filter: brightness(1.1); }
.v41-linkbtn { background: none; border: 0; padding: 0; color: var(--blue); text-decoration: underline; cursor: pointer; font: inherit; }
.v41-hinweis { margin: .5rem 0; padding: .55rem .75rem; border-radius: 8px; background: var(--gold-hell); color: var(--tinte); border: 1px solid var(--gold); font-size: .88rem; }
.v41-hinweis.v41-weg, .v41-weg { display: none; }
.v41-det, .v41-schutz, .v41-frage { margin: .8rem 0; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.v41-det > summary, .v41-schutz > summary, .v41-frage > summary { cursor: pointer; padding: .75rem .95rem; font-weight: 700; color: var(--ink); list-style-position: inside; }
.v41-det-inhalt, .v41-frage > :not(summary), .v41-schutz > :not(summary) { padding: 0 .95rem .85rem; }
.v41-schutz { background: var(--tint); border-color: color-mix(in srgb, var(--green) 40%, var(--line)); border-left: 5px solid var(--green); }
.v41-schutz > summary { color: var(--green); }
.v41-schutz-cap { color: var(--sub); font-size: .88rem; margin: 0 0 .4rem; }
.v41-frage > summary { display: flex; justify-content: space-between; gap: .8rem; flex-wrap: wrap; align-items: baseline; }
.v41-ergebnis { color: var(--green); font-weight: 700; }
.v41-math { margin: .4rem 0; }
.v41-math > div { display: flex; justify-content: space-between; gap: 1rem; padding: .4rem 0; border-top: 1px solid var(--line); }
.v41-math dt { color: var(--sub); } .v41-math dd { margin: 0; font-weight: 700; text-align: right; white-space: nowrap; }
.v41-math .v41-end { border-top: 2px solid var(--ink); } .v41-math .v41-end dt { color: var(--ink); font-weight: 700; }
.v41-note { margin: .5rem 0; padding: .6rem .8rem; border-radius: 8px; background: var(--tint); color: var(--ink); }
.v41-nsep { color: var(--sub); font-style: italic; font-weight: 500; }
.v41-liste { margin: .4rem 0; padding-left: 1.2rem; } .v41-liste li { margin: .25rem 0; }
.v41-zeile { margin: 1rem 0; padding-bottom: .6rem; border-bottom: 1px solid var(--line); }
.v41-werte { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; margin: .5rem 0; }
.v41-wert { padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--ground); color: var(--sub); }
.v41-wert:first-child { background: var(--tint); border-color: color-mix(in srgb, var(--green) 35%, var(--line)); }
.v41-wert strong { display: block; font-size: 1.9rem; letter-spacing: -.03em; color: var(--ink); line-height: 1.2; }
.v41-delta { margin: .4rem 0; font-weight: 700; color: var(--green); }
.v41-export-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: .9rem; margin: .6rem 0; }
.v41-export-grid > div { padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--ground); display: flex; flex-direction: column; gap: .4rem; align-items: flex-start; }
.v41-export-grid button { margin-top: auto; }
.v41-weitere > h2 { font-size: 1.2rem; }
.v41-sektion .zweit, .v41-sektion .haupt { padding: .5rem .9rem; border-radius: 8px; cursor: pointer; font-weight: 600; }
.v41-sektion .haupt { border: 0; background: var(--blue); color: var(--paper); }
.v41-sektion .zweit { border: 1px solid var(--line); background: var(--paper); color: var(--ink); }

@media (max-width: 720px) {
  .v41-choices, .v41-werte { grid-template-columns: minmax(0, 1fr); }
  .v41-math > div { flex-direction: column; gap: .1rem; } .v41-math dd { text-align: left; white-space: normal; }
  .v41-info .v41-tip { left: 0; transform: none; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* Dunkelmodus: Ergänzungen zu festen Farben */
html[data-theme="dark"] { --c-ruerup: #6fa8dc; --c-bestand: #3a4f63; --c-reserve: #6f8497; --c-depot_flex: #7f95a5; }
html[data-theme="dark"] .rechtlich { background: rgba(12, 25, 40, .96); }
html[data-theme="dark"] .vs-seg.vs-luecke span { color: #f4b9b2; background: rgba(12, 25, 40, .85); }
.v41-opt { flex-direction: row !important; align-items: flex-start; }
.v41-opt input { width: auto !important; flex: 0 0 auto; margin: .2rem 0 0; }
.v41-opt span { flex: 1 1 auto; }
.v41-fs legend::after, .v41-fs legend::before { content: none !important; }
