/* Zukunftsdepot-Rechner
   Nutzt die Farben des Themes Zukunftsdepot, mit Fallbacks für andere Themes. */

.zdr {
	--zdr-primaer: var(--wp--preset--color--primaer, #1d3664);
	--zdr-aktion: var(--wp--preset--color--aktion, #006699);
	--zdr-flaeche: var(--wp--preset--color--flaeche, #cce1ed);
	--zdr-flaeche-hell: var(--wp--preset--color--flaeche-hell, #eaf2f8);
	--zdr-akzent: var(--wp--preset--color--akzent, #2e8b57);
	--zdr-akzent-dunkel: var(--wp--preset--color--akzent-dunkel, #1d6b42);
	--zdr-akzent-hell: var(--wp--preset--color--akzent-hell, #e4f3ea);
	--zdr-bg: var(--wp--preset--color--hintergrund, #ffffff);
	--zdr-text: var(--wp--preset--color--text, #26303d);
	--zdr-dezent: var(--wp--preset--color--text-dezent, #56606e);
	--zdr-grau: var(--wp--preset--color--grau, #878787);
	--zdr-linie: var(--wp--preset--color--linie, #dde5ec);
	--zdr-radius: 12px;
	font-size: 1rem;
	color: var(--zdr-text);
}
.zdr *, .zdr *::before, .zdr *::after { box-sizing: border-box; }

/* ---------- Layout volle Version ---------- */
.zdr--voll {
	display: grid; gap: 1.5rem;
	grid-template-columns: minmax(0, 1fr);
	grid-template-areas: "form" "ergebnis" "verlauf" "zusatz";
}
@media (min-width: 960px) {
	.zdr--voll {
		grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
		grid-template-areas: "form ergebnis" "verlauf verlauf" "zusatz zusatz";
		align-items: start;
	}
}
.zdr--voll .zdr-form { grid-area: form; }
.zdr--voll .zdr-ergebnis { grid-area: ergebnis; }
.zdr--voll .zdr-verlauf { grid-area: verlauf; }
.zdr--voll .zdr-zusatz { grid-area: zusatz; }
@media (min-width: 960px) {
	.zdr--voll .zdr-ergebnis { position: sticky; top: 90px; }
}

/* ---------- Formular ---------- */
.zdr-form {
	background: var(--zdr-flaeche-hell);
	border-radius: var(--zdr-radius);
	padding: clamp(1rem, 3vw, 1.5rem);
}
.zdr-gruppe { border: 0; margin: 0 0 1.25rem; padding: 0; min-width: 0; }
.zdr-gruppe:last-child { margin-bottom: 0; }
.zdr-gruppe legend { font-weight: 700; color: var(--zdr-primaer); font-size: 1.05rem; padding: 0; margin-bottom: 0.6rem; }
.zdr-feld { margin-bottom: 0.85rem; }
.zdr-feld label { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 0.3rem; }
.zdr-feld__eingabe { position: relative; display: flex; align-items: stretch; }
.zdr-feld input, .zdr-feld select {
	width: 100%; font: inherit; font-size: 1.05rem; color: var(--zdr-text);
	background: var(--zdr-bg); border: 1px solid var(--zdr-grau);
	border-radius: 8px; padding: 0.55rem 0.75rem; min-height: 44px;
}
.zdr-feld input:focus, .zdr-feld select:focus { outline: 3px solid var(--zdr-aktion); outline-offset: 1px; border-color: var(--zdr-aktion); }
.zdr-feld__einheit {
	display: flex; align-items: center; padding: 0 0.75rem; margin-left: -1px;
	border: 1px solid var(--zdr-grau); border-radius: 0 8px 8px 0;
	background: var(--zdr-flaeche); color: var(--zdr-primaer); font-weight: 600; font-size: 0.9rem; white-space: nowrap;
}
.zdr-feld__eingabe:has(.zdr-feld__einheit) input { border-radius: 8px 0 0 8px; }
.zdr-feld__hinweis, .zdr-grenze { font-size: 0.85rem; color: var(--zdr-dezent); margin: 0.3rem 0 0; }
.zdr-paar { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.zdr-bonus { font-size: 0.875rem; margin: 0.5rem 0 0; padding: 0.5rem 0.75rem; border-radius: 8px; background: var(--zdr-bg); color: var(--zdr-dezent); }
.zdr-bonus.is-aktiv { background: var(--zdr-akzent-hell); color: var(--zdr-akzent-dunkel); font-weight: 600; }

.zdr-chips { display: flex; gap: 0.5rem; margin-top: -0.35rem; margin-bottom: 0.85rem; }
.zdr-chips button {
	font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer;
	padding: 0.35rem 0.9rem; min-height: 36px; border-radius: 999px;
	border: 1px solid var(--zdr-aktion); background: var(--zdr-bg); color: var(--zdr-aktion);
}
.zdr-chips button[aria-pressed="true"] { background: var(--zdr-aktion); color: var(--zdr-bg); }

.zdr-mehr summary { cursor: pointer; font-weight: 600; color: var(--zdr-aktion); padding: 0.35rem 0; }
.zdr-mehr[open] summary { margin-bottom: 0.6rem; }

/* ---------- Ergebnis ---------- */
.zdr-ergebnis {
	border: 1px solid var(--zdr-linie); border-radius: var(--zdr-radius);
	padding: clamp(1rem, 3vw, 1.5rem); background: var(--zdr-bg);
	box-shadow: var(--zd-schatten, 0 6px 20px rgba(29,54,100,.07));
}
.zdr-haupt__label { margin: 0; font-weight: 600; color: var(--zdr-dezent); font-size: 0.95rem; }
.zdr-haupt__wert { margin: 0.1rem 0 0.2rem; font-size: clamp(2.1rem, 6vw, 2.9rem); font-weight: 700; line-height: 1.1; color: var(--zdr-akzent-dunkel); font-variant-numeric: tabular-nums; }
.zdr-haupt__sub { margin: 0; color: var(--zdr-dezent); }
.zdr-warnung { margin: 0.75rem 0 0; padding: 0.6rem 0.8rem; border-radius: 8px; background: #fff4e0; color: #7a4a00; font-size: 0.9rem; border-left: 4px solid #d98a00; }

.zdr-aufteilung { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin: 1.1rem 0 0; }
.zdr-aufteilung div { background: var(--zdr-flaeche-hell); border-radius: 8px; padding: 0.6rem 0.75rem; }
.zdr-aufteilung dt { font-size: 0.8rem; color: var(--zdr-dezent); }
.zdr-aufteilung dd { margin: 0; font-weight: 700; color: var(--zdr-primaer); font-variant-numeric: tabular-nums; }
@media (max-width: 420px) { .zdr-aufteilung { grid-template-columns: 1fr; } }

.zdr-h { font-size: 1.05rem; margin: 1.4rem 0 0.6rem; color: var(--zdr-primaer); }
.zdr-text { margin: 0 0 0.75rem; color: var(--zdr-dezent); }

.zdr-balken__zeile { display: grid; grid-template-columns: 9.5rem 1fr auto; gap: 0.6rem; align-items: center; margin-bottom: 0.45rem; font-size: 0.92rem; }
@media (max-width: 480px) { .zdr-balken__zeile { grid-template-columns: 1fr auto; } .zdr-balken__spur { grid-column: 1 / -1; grid-row: 2; } }
.zdr-balken__spur { height: 12px; background: var(--zdr-flaeche-hell); border-radius: 999px; overflow: hidden; }
.zdr-balken__fill { display: block; height: 100%; border-radius: 999px; background: var(--zdr-grau); transition: width .3s ease; }
.zdr-balken--zd .zdr-balken__fill { background: var(--zdr-akzent); }
.zdr-balken--depot .zdr-balken__fill { background: var(--zdr-aktion); }
.zdr-balken__wert { font-weight: 700; font-variant-numeric: tabular-nums; }
.zdr-vorsprung { margin: 0.75rem 0 0; padding: 0.75rem 0.9rem; border-radius: 8px; background: var(--zdr-akzent-hell); }
.zdr-vorsprung__wert { font-weight: 700; color: var(--zdr-akzent-dunkel); }
.zdr-vorsprung__teile { display: block; font-size: 0.85rem; color: var(--zdr-dezent); margin-top: 0.15rem; }

.zdr-drei { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.zdr-drei__karte { border: 1px solid var(--zdr-linie); border-radius: 8px; padding: 0.55rem 0.7rem; text-align: center; }
.zdr-drei__karte span { display: block; font-size: 0.8rem; color: var(--zdr-dezent); }
.zdr-drei__karte strong { font-variant-numeric: tabular-nums; color: var(--zdr-primaer); }
.zdr-drei__karte.is-aktiv { border-color: var(--zdr-akzent); background: var(--zdr-akzent-hell); }

.zdr-aktionen { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 1.25rem; }
.zdr-knopf {
	display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
	font: inherit; font-weight: 600; font-size: 0.95rem; cursor: pointer; text-decoration: none;
	background: var(--zdr-aktion); color: var(--zdr-bg); border: 1px solid var(--zdr-aktion);
	border-radius: 6px; padding: 0.55rem 1rem;
}
.zdr-knopf:hover { background: var(--zdr-primaer); border-color: var(--zdr-primaer); color: var(--zdr-bg); }
.zdr-knopf--zweit { background: transparent; color: var(--zdr-aktion); }
.zdr-knopf--zweit:hover { background: var(--zdr-flaeche-hell); color: var(--zdr-primaer); }
.zdr-status { font-size: 0.9rem; color: var(--zdr-akzent-dunkel); }

/* ---------- Diagramm ---------- */
.zdr-verlauf, .zdr-zusatz { min-width: 0; }
.zdr-chart svg { width: 100%; height: auto; display: block; }
.zdr-gitter { stroke: var(--zdr-linie); stroke-width: 1; }
.zdr-achse { fill: var(--zdr-dezent); font-size: 12px; font-family: inherit; }
.zdr-linie { fill: none; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.zdr-linie--zd { stroke: var(--zdr-akzent); stroke-width: 3.5; }
.zdr-linie--depot { stroke: var(--zdr-aktion); }
.zdr-linie--spar { stroke: var(--zdr-grau); }
.zdr-linie--ein { stroke: var(--zdr-dezent); stroke-dasharray: 5 5; stroke-width: 2; }
.zdr-punkt { fill: var(--zdr-akzent); stroke: var(--zdr-bg); stroke-width: 2; }

.zdr-legende { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; padding: 0; margin: 0.5rem 0 0.75rem; font-size: 0.875rem; }
.zdr-legende li { display: flex; align-items: center; gap: 0.4rem; }
.zdr-legende li::before { content: ""; width: 22px; height: 0; border-top: 3px solid var(--zdr-grau); }
.zdr-legende--zd::before { border-top-color: var(--zdr-akzent) !important; border-top-width: 4px !important; }
.zdr-legende--depot::before { border-top-color: var(--zdr-aktion) !important; }
.zdr-legende--ein::before { border-top: 2px dashed var(--zdr-dezent) !important; }

/* ---------- Tabellen ---------- */
.zdr-tabelle-wrap { overflow-x: auto; }
.zdr-tabelle { width: 100%; border-collapse: collapse; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.zdr-tabelle caption { text-align: left; font-size: 0.85rem; color: var(--zdr-dezent); padding-bottom: 0.4rem; }
.zdr-tabelle th, .zdr-tabelle td { padding: 0.55rem 0.65rem; border-bottom: 1px solid var(--zdr-linie); text-align: left; white-space: nowrap; }
.zdr-tabelle thead th { background: var(--zdr-flaeche-hell); color: var(--zdr-primaer); font-size: 0.82rem; }
.zdr-tabelle tbody th { font-weight: 600; color: var(--zdr-primaer); }
.zdr-tabelle .zdr-num { text-align: right; }
.zdr-stand { font-size: 0.85rem; color: var(--zdr-dezent); margin-top: 1rem; }

/* ---------- Kompakte Version ---------- */
.zdr--kompakt {
	display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr);
	background: var(--zdr-bg); border: 1px solid var(--zdr-linie);
	border-radius: var(--zdr-radius); padding: clamp(1rem, 3vw, 1.4rem);
	box-shadow: var(--zd-schatten, 0 6px 20px rgba(29,54,100,.07));
}
@media (min-width: 560px) { .zdr--kompakt { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: center; } }
.zdr-form--kompakt { padding: 1rem; }
.zdr-form--kompakt .zdr-feld:last-child { margin-bottom: 0; }
.zdr-kompakt__vorsprung { margin: 0 0 0.35rem; font-weight: 600; color: var(--zdr-primaer); }
.zdr-kompakt__annahme { font-size: 0.8rem; color: var(--zdr-dezent); margin: 0 0 0.75rem; }
.zdr--kompakt .zdr-haupt__wert { font-size: clamp(1.9rem, 5vw, 2.4rem); }

.zdr-hinweis { padding: 0.75rem; background: var(--zdr-flaeche-hell); border-radius: 8px; }

/* Editor-Platzhalter */
.zdr-editor-platzhalter { border: 2px dashed #2e8b57; background: #e4f3ea; border-radius: 12px; padding: 1.25rem; }
.zdr-editor-platzhalter p { margin: 0.4rem 0 0; }

@media (prefers-reduced-motion: reduce) { .zdr-balken__fill { transition: none; } }
