/*
 * EIT-Tools – Rechner (Eingabe und Ergebnis)
 * Autor: Niklas Pauli
 * Version: 261010.2116
 *
 * Mobile First: Eingabe oben, Ergebnis darunter. Ab 980 px stehen beide nebeneinander.
 */

.seitenkopf--flach .seitenkopf__innen { padding-block: clamp(28px, 5vw, 48px); }
.abschnitt--rechner { padding-top: clamp(24px, 4vw, 40px); }

.rechner { display: grid; gap: 28px; }
.rechner__eingabe { gap: 16px; min-width: 0; }
.rechner__ausgabe { min-width: 0; }
.rechner__titel { margin: 0 0 12px; font-size: 1.25rem; }
.rechner__knoepfe { margin: 4px 0 0; }
.rechner-aktiv .rechner__knoepfe .knopf--primaer { display: none; }
@media (max-width: 979.98px) { .rechner-aktiv .rechner__knoepfe .knopf--primaer { display: inline-flex; } }
@media (min-width: 980px) {
    .rechner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: start; }
    /* Kein eigener Rollbereich: Es wird nur die Seite gerollt. Das Ergebnis bleibt nur dann oben stehen,
       wenn es vollständig in das Fenster passt (rechner.js setzt dafür die Klasse ist-haftend). */
    .rechner__ausgabe.ist-haftend { position: sticky; top: 96px; }
}

/* --- Gruppen der Eingabe --- */
.gruppe { display: grid; gap: 14px; min-width: 0; margin: 0; padding: 16px; border: 1px solid var(--linie); border-radius: var(--radius); background: var(--weiss); }
.gruppe[hidden], .feld[hidden], .feld__erklaerung[hidden] { display: none; }
.gruppe legend { padding: 0 8px; font-size: .8rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--eit-primaer-dunkel); }

/* --- Auswahl als große Schaltflächen (statt kleiner Punkte) --- */
.auswahl { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.auswahl--drei { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.auswahl__feld { position: relative; display: block; cursor: pointer; }
.auswahl__feld input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.auswahl__feld > span { display: grid; align-content: center; gap: 2px; min-height: 52px; height: 100%; padding: 8px 6px; border: 1.5px solid var(--linie); border-radius: var(--radius-klein); background: var(--weiss); text-align: center; transition: border-color .15s ease, background-color .15s ease; }
.auswahl__feld strong { font-size: clamp(.8rem, 3.5vw, .98rem); font-weight: 650; hyphens: auto; overflow-wrap: break-word; }
.auswahl__feld small { font-size: .78rem; line-height: 1.3; color: var(--text-weich); }
.auswahl__feld:hover > span { border-color: #b9c9d6; }
.auswahl__feld input:checked + span { border-color: var(--eit-primaer-dunkel); background: rgba(25, 142, 206, .1); box-shadow: inset 0 0 0 1px var(--eit-primaer-dunkel); }
.auswahl__feld input:checked + span strong { color: var(--eit-primaer-dunkel); }
.auswahl__feld input:focus-visible + span { outline: 3px solid rgba(25, 142, 206, .45); outline-offset: 2px; }
@media (min-width: 620px) { .auswahl--ziel { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 980px) and (max-width: 1239.98px) { .auswahl--ziel { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* --- Felder --- */
.feld__zusatz { font-weight: 400; color: var(--text-weich); }
.feld__zusatz::before { content: "· "; }
.feld__hilfe { font-size: .85rem; color: var(--text-weich); }
.feld__einheit { display: flex; align-items: stretch; }
.feld__einheit input { min-width: 0; flex: 1 1 auto; border-top-right-radius: 0; border-bottom-right-radius: 0; font-size: 1.1rem; }
.feld__einheit span { display: flex; align-items: center; padding: 0 14px; border: 1.5px solid var(--linie); border-left: 0; border-radius: 0 var(--radius-klein) var(--radius-klein) 0; background: var(--eit-hell); font-weight: 650; color: var(--text-weich); }
.feld__erklaerung { padding: 10px 12px; border-left: 3px solid var(--eit-primaer); border-radius: 0 var(--radius-klein) var(--radius-klein) 0; background: var(--eit-hell); font-size: .9rem; }
.feld__erklaerung p { margin: 0; }
.feld__beispiele { margin-top: 4px !important; color: var(--text-weich); }

/* --- Ergebnis --- */
#ergebnis { transition: opacity .15s ease; scroll-margin-top: 88px; }
#ergebnis:focus { outline: none; }
#ergebnis.wird-geladen { opacity: .55; }

.ergebnis { --ton: var(--text-weich); --flaeche: #f4f6f8; display: grid; gap: 12px; padding: 20px; border: 1px solid var(--linie); border-top: 6px solid var(--ton); border-radius: var(--radius); background: var(--weiss); box-shadow: var(--schatten); }
.ergebnis--ok { --ton: var(--erfolg); --flaeche: #eef8f2; }
.ergebnis--warnung { --ton: #9a6200; --flaeche: #fff6e0; }
.ergebnis--fehler { --ton: var(--fehler); --flaeche: #fdf1f0; }
.ergebnis--leer { box-shadow: none; }
.ergebnis > * { margin: 0; }
.ergebnis__marke { justify-self: start; padding: .2em .8em; border-radius: 999px; background: var(--flaeche); color: var(--ton); font-size: .8rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.ergebnis__frage { font-size: .95rem; color: var(--text-weich); }
.ergebnis__wert { margin-top: -8px; font-size: clamp(2.1rem, 9vw, 3.2rem); font-weight: 780; line-height: 1.05; color: var(--eit-nacht); overflow-wrap: anywhere; }
.ergebnis--fehler .ergebnis__wert { font-size: clamp(1.5rem, 6vw, 2rem); color: var(--ton); }
.ergebnis__satz { font-size: 1.02rem; }
.ergebnis__notiz { padding: 10px 12px; border-radius: var(--radius-klein); background: var(--eit-hell); font-size: .92rem; }
.ergebnis__liste { padding-left: 1.2em; list-style: disc; }
.ergebnis__titel { margin-top: 6px; font-size: .8rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-weich); }
.ergebnis__rat { padding: 12px 14px; border-radius: var(--radius-klein); background: var(--flaeche); border-left: 4px solid var(--ton); }
.ergebnis__hinweis { margin-top: 4px; font-size: .82rem; line-height: 1.5; color: var(--text-weich); }

.pruefliste { display: grid; gap: 10px; padding: 0; list-style: none; }
.pruefung { --ton: var(--text-weich); display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--linie); border-left: 5px solid var(--ton); border-radius: var(--radius-klein); }
.pruefung--ok { --ton: var(--erfolg); }
.pruefung--warnung { --ton: #9a6200; }
.pruefung--fehler { --ton: var(--fehler); }
.pruefung > * { margin: 0; }
.pruefung__kopf { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; }
.pruefung__name { font-weight: 700; }
.pruefung__urteil { font-size: .85rem; font-weight: 750; color: var(--ton); text-transform: uppercase; letter-spacing: .06em; }
.pruefung__wert { font-size: 1.35rem; font-weight: 750; color: var(--eit-nacht); }
.pruefung__wert span { font-size: .95rem; font-weight: 400; color: var(--text-weich); }
.pruefung__grenze { font-size: .85rem; line-height: 1.45; color: var(--text-weich); }

/* Balken: volle Breite = 4 %, Marke bei 3 % */
.balken { position: relative; height: 10px; border-radius: 999px; background: #e6ebef; overflow: hidden; }
.balken__fuellung { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--ton); }
.balken__marke { position: absolute; top: 0; bottom: 0; left: 75%; width: 2px; background: var(--eit-nacht); opacity: .55; }

.kennwerte { display: grid; gap: 0; border-top: 1px solid var(--linie); }
.kennwerte > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 16px; padding: 8px 0; border-bottom: 1px solid var(--linie); }
.kennwerte dt { color: var(--text-weich); }
.kennwerte dd { margin: 0; font-weight: 650; }

.klappe { border: 1px solid var(--linie); border-radius: var(--radius-klein); }
.klappe summary { display: flex; align-items: center; min-height: 46px; padding: 8px 14px; font-weight: 650; cursor: pointer; }
.klappe[open] summary { border-bottom: 1px solid var(--linie); }
.klappe > div, .klappe > dl { margin: 0; padding: 4px 14px 10px; }
.angaben--eng { border-top: 0; margin: 0; }
.angaben--eng > div { padding: 8px 0; }
.angaben--eng > div:last-child { border-bottom: 0; }
@media (min-width: 700px) { .angaben--eng > div { grid-template-columns: 150px minmax(0, 1fr); } }

.datentabelle--vergleich tr.ist-ungeeignet { color: var(--text-weich); }
.datentabelle--vergleich tr.ist-empfohlen { background: #eef8f2; }
.datentabelle--vergleich tr.ist-empfohlen th { color: var(--erfolg); }
.datentabelle--vergleich .vw-marke { margin-left: 6px; }
@media (max-width: 759.98px) { .datentabelle--vergleich tr.ist-empfohlen { margin-inline: -14px; padding-inline: 14px; } }

.kennwerte dt small { display: block; font-size: .8rem; }
.auswahl--drei .auswahl__feld strong { font-size: clamp(.74rem, 3.1vw, .98rem); }

/* --- Rohrbelegung: Leitungszeilen --- */
.gruppe__teil { display: grid; gap: 14px; min-width: 0; }
.gruppe__teil[hidden], .feld label span[hidden] { display: none; }
.leitungen { display: grid; gap: 12px; }
.leitung { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); padding: 12px; border: 1px solid var(--linie); border-radius: var(--radius-klein); background: var(--eit-hell); }
.leitung .feld { min-width: 0; }
.leitung select, .leitung input { background: var(--weiss); }
.leitung__entfernen { justify-self: start; min-height: 44px; padding: 8px 0; border: 0; background: none; color: var(--fehler); font: inherit; font-size: .95rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.leitung__entfernen[hidden] { display: none; }
@media (min-width: 620px) {
    .leitung { grid-template-columns: 168px minmax(0, 1fr); align-items: end; }
    .leitung__durchmesser, .leitung__entfernen { grid-column: 2; }
}

/* Anzahl mit großen Knöpfen für Minus und Plus */
.zaehler { display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; }
.zaehler input { min-width: 0; text-align: center; border-radius: 0; border-left: 0; border-right: 0; font-size: 1.1rem; font-weight: 650; }
.zaehler__knopf { min-height: 50px; border: 1.5px solid var(--linie); background: var(--weiss); color: var(--eit-primaer-dunkel); font: inherit; font-size: 1.4rem; font-weight: 700; line-height: 1; cursor: pointer; }
.zaehler__knopf:first-child { border-radius: var(--radius-klein) 0 0 var(--radius-klein); }
.zaehler__knopf:last-child { border-radius: 0 var(--radius-klein) var(--radius-klein) 0; }
.zaehler__knopf:hover { background: rgba(25, 142, 206, .1); }
.zaehler__knopf:focus-visible { outline: 3px solid rgba(25, 142, 206, .45); outline-offset: 2px; position: relative; }

/* Balken mit frei gesetzter Marke (Füllfaktor) und Schnittbild */
.balken--frei { background: #e6ebef; }
.balken--frei .balken__fuellung { background: var(--ton); }
.ergebnis__rat--neutral { --ton: var(--eit-primaer-dunkel); --flaeche: var(--eit-hell); font-size: .92rem; }
.schnitt { margin: 4px 0 0; display: grid; gap: 6px; justify-items: center; }
.schnitt svg { width: min(100%, 260px); height: auto; }
.schnitt figcaption { font-size: .85rem; color: var(--text-weich); text-align: center; }
.schnitt__wand { fill: #6d6a68; }
.schnitt__innen { fill: #eaf3f9; }
.schnitt__leitung { fill: var(--eit-primaer); stroke: var(--eit-primaer-dunkel); stroke-width: 1; }
.ergebnis--fehler .schnitt__leitung { fill: #d9655e; stroke: var(--fehler); }

/* --- Ergebnis als PDF per E-Mail --- */
.export { margin-top: 28px; }
.export .gruppe { gap: 12px; }
.export .meldung { margin-bottom: 12px; }
.export .formular__falle { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* --- Kabeltrasse --- */
.feld__titel { font-size: .92rem; font-weight: 650; }
.schnitt--trasse svg { width: 100%; max-width: 520px; }
.schnitt__profil { fill: none; stroke: #6d6a68; stroke-width: 5; stroke-linejoin: round; }
.pruefung__name small { font-weight: 400; color: var(--text-weich); }

/* --- Strom und Leistung --- */
.wertekacheln { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.wertekacheln > div { display: grid; gap: 2px; align-content: start; padding: 10px 12px; border: 1px solid var(--linie); border-radius: var(--radius-klein); }
.wertekacheln dt { font-size: .85rem; color: var(--text-weich); }
.wertekacheln dt span { font-weight: 700; color: var(--text); }
.wertekacheln dd { margin: 0; font-size: 1.3rem; font-weight: 750; color: var(--eit-nacht); overflow-wrap: anywhere; }
.wertekacheln dd small { font-size: .85rem; font-weight: 600; color: var(--text-weich); }
.wertekacheln p { margin: 0; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--eit-primaer-dunkel); }
.wertekacheln .ist-eingabe { border-color: var(--eit-primaer-dunkel); background: rgba(25, 142, 206, .08); }
.wertekacheln .ist-haupt { border-color: var(--erfolg); background: #eef8f2; }
@media (min-width: 560px) { .wertekacheln { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.schnitt--dreieck svg { width: min(100%, 300px); }
.dreieck__flaeche { fill: rgba(25, 142, 206, .12); }
.dreieck__p, .dreieck__q, .dreieck__s { stroke-width: 3; stroke-linecap: round; }
.dreieck__p { stroke: var(--erfolg); }
.dreieck__q { stroke: #9a6200; }
.dreieck__s { stroke: var(--eit-primaer-dunkel); }
.schnitt--dreieck text { font-size: 13px; font-weight: 700; fill: var(--text); }
.ergebnis__rat a { display: inline-block; margin-top: 4px; font-weight: 650; }

/* --- UV-Planer --- */
.uv-gruppen { display: grid; gap: 16px; }
.uv-gruppe { border-left: 5px solid var(--eit-primaer); }
.kreise { display: grid; gap: 10px; }
.kreis { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--linie); border-radius: var(--radius-klein); background: var(--eit-hell); }
.kreis input, .kreis select { background: var(--weiss); }
.kreis__entfernen { justify-self: start; min-height: 40px; padding: 4px 0; }
@media (min-width: 620px) { .kreis { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: end; } .kreis__entfernen { grid-column: 1 / -1; } }
.uv-gruppe__knoepfe { align-items: center; justify-content: space-between; margin: 0; }
.plan { margin: 0; display: grid; gap: 6px; }
.plan__bild { overflow-x: auto; border: 1px solid var(--linie); border-radius: var(--radius-klein); background: var(--weiss); padding: 8px; }
.plan__bild svg { display: block; width: 100%; min-width: 520px; height: auto; }
.plan figcaption { font-size: .85rem; color: var(--text-weich); }
.hinweisliste { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.hinweisliste li { padding: 10px 12px; border-left: 4px solid #9aa7b2; border-radius: 0 var(--radius-klein) var(--radius-klein) 0; background: #f4f6f8; font-size: .95rem; }
.hinweisliste li span { font-weight: 750; text-transform: uppercase; letter-spacing: .06em; font-size: .78rem; margin-right: 6px; }
.hinweisliste__warnung { border-left-color: #9a6200 !important; background: #fff6e0 !important; }
.hinweisliste__fehler { border-left-color: var(--fehler) !important; background: #fdf1f0 !important; }
.klappe__text { margin: 0; padding: 0 14px 10px; }
@media (min-width: 980px) { .rechner--planer { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); } }
