/* MG.EnergyMap - Gestaltung der Kartenanwendung.
   Grundlage: _s3-ui-standards/STANDARDS.md (Primary #0C5DA6, Square-First, Pills als einzige Rundung,
   Lucide-Icons inline, Schatten <= 12px Blur). Abweichungen für die Vollbild-Karte: siehe README.md. */

@font-face {
    font-family: "Inter";
    src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "JetBrains Mono";
    src: url("../fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
    font-weight: 100 800;
    font-style: normal;
    font-display: swap;
}

:root {
    --akzent: #0c5da6;
    --akzent-hover: #0a4f8d;
    --akzent-hell: #e7f0f8;
    --text: #18212c;
    --text-2: #4f5a68;
    --text-3: #8790a0;
    --rand: #e4e7ec;
    --rand-stark: #d3d8df;
    --flaeche: #ffffff;
    --grund: #f6f7f9;
    --muted: #f0f2f5;
    --gefahr: #c62828;
    --schrift: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
    --schatten-karte: 0 1px 6px rgba(16, 24, 40, 0.10);
    --schatten-schwebend: 0 4px 12px rgba(16, 24, 40, 0.14);
    --leiste-breite: 288px;
    --abstand: 14px;
    --legende-unten: 34px;    /* Abstand der Legende vom unteren Rand (über der Attribution) */
    --legende-kopf: 34px;     /* Höhe der zugeklappten Legende */
    --uebergang: 160ms cubic-bezier(.2, .7, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    font-family: var(--schrift);
    font-size: 14px;
    line-height: 1.45;
    color: var(--text);
    background: var(--grund);
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "cv11", "ss01";
}

button { font: inherit; color: inherit; }
b { font-weight: 600; }
.mono { font-family: var(--mono); }
.klein { font-size: 11px; color: var(--text-3); }
kbd {
    font-family: var(--mono); font-size: 10px; padding: 0 4px; border: 1px solid var(--rand-stark);
    border-bottom-width: 2px; background: var(--flaeche); color: var(--text-2);
}

:focus-visible { outline: 2px solid var(--akzent); outline-offset: 1px; }

/* ---------------------------------------------------------------- Icons, Spinner */

.icon-sm { width: 16px; height: 16px; flex: none; }
.icon-md { width: 20px; height: 20px; flex: none; }

.spinner {
    display: inline-block; flex: none; border-radius: 50%;
    border: 2px solid currentColor; border-right-color: transparent;
    animation: drehen 0.7s linear infinite; opacity: 0.7;
}
.spinner-sm { width: 14px; height: 14px; }
.spinner-md { width: 18px; height: 18px; }
@keyframes drehen { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- Kategoriesymbol */

.kat-marke {
    --kat: #888;
    display: inline-grid; place-items: center; flex: none;
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--kat); color: #fff;
    box-shadow: 0 0 0 1.5px #fff, 0 1px 3px rgba(16, 24, 40, 0.25);
}
.kat-marke-icon { width: 13px; height: 13px; }
.kat-marke-plan { background: #fff; color: var(--kat); box-shadow: inset 0 0 0 2px var(--kat), 0 1px 3px rgba(16, 24, 40, 0.2); }
.kat-marke-still { background: #b4bac3; }
.kat-marke-gross { width: 30px; height: 30px; }
.kat-marke-gross .kat-marke-icon { width: 17px; height: 17px; }

/* ---------------------------------------------------------------- Badges, Buttons */

.badge {
    display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
    padding: 2px 9px; border-radius: 9999px; font-size: 12px; font-weight: 500;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef9c3; color: #854d0e; }
.badge-planung { background: var(--akzent-hell); color: var(--akzent); }
.badge-muted { background: var(--muted); color: var(--text-2); }

.btn {
    display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
    padding: 0.5rem 1rem; border: 1px solid var(--rand-stark); background: var(--flaeche);
    transition: background var(--uebergang), border-color var(--uebergang);
}
.btn:hover { background: var(--muted); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 13px; }

/* ---------------------------------------------------------------- Grundgerüst */

.app {
    display: grid;
    grid-template-columns: var(--leiste-breite) 1fr;
    grid-template-rows: minmax(0, 1fr);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.karte-bereich { position: relative; min-width: 0; overflow: hidden; }
.karte { position: absolute; inset: 0; background: #f2f3f0; }

.lade-balken {
    position: absolute; top: 0; left: 0; right: 0; height: 2px; z-index: 6; pointer-events: none;
    background: linear-gradient(90deg, transparent, var(--akzent), transparent);
    background-size: 40% 100%; background-repeat: no-repeat;
    opacity: 0; transition: opacity 200ms;
}
.lade-balken.aktiv { opacity: 1; animation: laden 1.1s ease-in-out infinite; }
@keyframes laden { from { background-position: -40% 0; } to { background-position: 140% 0; } }

/* ---------------------------------------------------------------- Seitenleiste */

.leiste {
    position: relative;
    display: flex; flex-direction: column; min-height: 0;
    background: var(--flaeche); border-right: 1px solid var(--rand);
    box-shadow: 2px 0 8px rgba(16, 24, 40, 0.06);
    z-index: 20;
}

.leiste-kopf {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 16px 14px;
}
.marke { display: flex; align-items: center; gap: 10px; }
.marke-zeichen { display: block; line-height: 0; }
.marke-text { display: flex; flex-direction: column; line-height: 1.15; }
.marke-name { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
.marke-unter { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.leiste-zu { display: none; }

.reiter { display: flex; padding: 0 16px; border-bottom: 1px solid var(--rand); gap: 18px; }
.reiter-knopf {
    display: inline-flex; align-items: center; gap: 6px; padding: 9px 0 10px;
    background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
    color: var(--text-2); font-weight: 500; cursor: pointer;
    transition: color var(--uebergang), border-color var(--uebergang);
}
.reiter-knopf:hover { color: var(--text); }
.reiter-knopf.aktiv { color: var(--akzent); border-bottom-color: var(--akzent); }
.reiter-zahl {
    display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 9999px; background: var(--akzent); color: #fff; font-size: 11px; font-weight: 600;
}

.chips {
    display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--rand);
    background: linear-gradient(var(--grund), var(--flaeche));
    animation: einblenden 180ms ease-out;
}
.chip {
    display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
    padding: 2px 3px 2px 9px; border-radius: 9999px;
    background: var(--akzent-hell); color: var(--akzent); font-size: 12px;
    border: 1px solid color-mix(in srgb, var(--akzent) 22%, transparent);
}
.chip-label { opacity: 0.75; }
.chip-wert { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-x {
    display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
    border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0; flex: none;
}
.chip-x:hover { background: color-mix(in srgb, var(--akzent) 16%, transparent); }
.chip-x .icon-sm { width: 12px; height: 12px; }
.chips-alle { border: 0; background: none; color: var(--text-2); font-size: 12px; cursor: pointer; text-decoration: underline; padding: 2px 4px; }

.leiste-inhalt { flex: 1; overflow-y: auto; overflow-x: hidden; min-width: 0; min-height: 0; padding: 6px 0 14px; scrollbar-width: thin; }

.leiste-hinweis { margin: 4px 0 8px; font-size: 12px; color: var(--text-3); line-height: 1.5; }
.ebenen > .leiste-hinweis { padding: 8px 16px 0; }

/* Ebenen */
.ebenen-gruppe { padding: 6px 0 4px; }
.ebenen-gruppe-kopf {
    display: flex; align-items: center; gap: 8px; padding: 6px 10px 4px 16px;
    font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3);
}
.ebenen-gruppe-name {
    flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; margin: -4px 0 -4px -6px; padding: 4px 6px;
    border: 0; border-radius: var(--radius-sm, 4px); background: none; cursor: pointer; text-align: left;
    font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit;
}
.ebenen-gruppe-name:hover { background: var(--grund); color: var(--text-2); }
.ebenen-gruppe-name:focus-visible { outline: 2px solid var(--akzent); outline-offset: -2px; }
.ebenen-gruppe-pfeil { flex: none; width: 14px; height: 14px; transition: transform var(--uebergang); }
.ebenen-gruppe-zu .ebenen-gruppe-pfeil { transform: rotate(-90deg); }
/* Eingeklappt: nur der Kopf (Name, Zahl, Auge) bleibt */
.ebenen-gruppe-zu > :not(.ebenen-gruppe-kopf) { display: none; }
.ebenen-gruppe-zu { padding-bottom: 0; }
.ebenen-gruppe-zahl { font-family: var(--mono); font-weight: 500; letter-spacing: 0; }

.ebene { display: flex; align-items: center; padding-right: 10px; transition: background var(--uebergang); }
.ebene:hover { background: var(--grund); }
.ebene-haupt {
    flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
    padding: 6px 4px 6px 16px; background: none; border: 0; cursor: pointer; text-align: left;
}
.ebene-name { flex: 1; min-width: 0; line-height: 1.25; }
.ebene-wert { font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.ebene-aus .ebene-name { color: var(--text-3); }
/* Griff zum Verstellen der Leistenbreite (rechter Rand) */
.leiste-griff {
    position: absolute; top: 0; bottom: 0; right: -4px; width: 8px; z-index: 30;
    cursor: col-resize; touch-action: none; background: transparent;
}
.leiste-griff::after {
    content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px;
    background: var(--akzent); opacity: 0; transition: opacity var(--uebergang);
}
.leiste-griff:hover::after, .leiste-griff:focus-visible::after, .leiste-zieht .leiste-griff::after { opacity: 0.6; }
.leiste-griff:focus-visible { outline: none; }
body.leiste-zieht { cursor: col-resize; user-select: none; }
body.leiste-zieht .karte { pointer-events: none; }

/* „nur“-Knopf schwebt über der Zeile (links neben dem Auge), damit beim Hover nichts umbricht oder springt. */
.ebene { position: relative; }
.ebene-nur {
    position: absolute; top: 50%; right: 34px; transform: translateY(-50%); z-index: 1;
    opacity: 0; pointer-events: none; border: 1px solid var(--rand-stark); background: var(--flaeche);
    color: var(--text-2); font-size: 11px; padding: 0 6px; height: 20px; cursor: pointer;
    box-shadow: -8px 0 8px var(--flaeche);
    transition: opacity var(--uebergang);
}
.ebene:hover .ebene-nur, .ebene-nur:focus-visible { opacity: 1; pointer-events: auto; }
.ebene:hover .ebene-wert { visibility: hidden; }
.ebene-nur:hover { border-color: var(--akzent); color: var(--akzent); }
.ebene-auge {
    display: grid; place-items: center; width: 28px; height: 28px; border: 0; background: none;
    color: var(--text-3); cursor: pointer;
}
.ebene-auge:hover { color: var(--akzent); }
.ebene:not(.ebene-aus) > .ebene-auge { color: var(--text-2); }

/* Stromnetz in der Ebenenliste */
.ebene { flex-wrap: wrap; }
.ebene-haupt:disabled, .ebene-auge:disabled { cursor: default; }
.ebene-auge:disabled { color: var(--rand-stark); }
.ebenen-gruppe-gesperrt .ebene:hover { background: none; }
.ebenen-gruppe-gesperrt .ebene-name, .ebenen-gruppe-gesperrt .ebene-wert { color: var(--text-3); }
.ebenen-gruppe-gesperrt .netz-marke { opacity: 0.4; filter: grayscale(1); }
.ebenen-badge {
    font-size: 10px; font-weight: 600; letter-spacing: 0.02em; text-transform: none; padding: 1px 8px; margin-right: 6px;
    border-radius: 9999px; background: var(--muted); color: var(--text-2); white-space: nowrap;
}
.ebenen-quelle { padding: 2px 16px 0 48px; margin: 2px 0 0; font-size: 11px; }
.ebene-zoom {
    flex-basis: 100%; display: inline-flex; align-items: center; gap: 5px; margin: -3px 0 5px 48px; padding: 1px 0;
    width: fit-content; flex-grow: 0; border: 0; background: none; cursor: pointer;
    font-size: 11px; color: var(--akzent); text-align: left;
}
.ebene-zoom .icon-sm { width: 13px; height: 13px; }
.ebene-zoom:hover { text-decoration: underline; }

/* Linien- und Umspannwerk-Marke (Seitenleiste, Legende): Linie in Stärke der Karte bzw. Quadrat */
.netz-marke {
    --farbe: #1c2552; --staerke: 3px;
    display: inline-block; flex: none; width: 22px; height: 22px;
    background: linear-gradient(var(--farbe), var(--farbe)) center / 100% var(--staerke) no-repeat;
}
.netz-marke-kabel {
    background: repeating-linear-gradient(90deg, var(--farbe) 0 5px, transparent 5px 8px) center / 100% var(--staerke) no-repeat;
}
.netz-marke-uw { background: none; position: relative; }
.netz-marke-uw::after {
    content: ""; position: absolute; inset: 5px; background: var(--farbe);
    box-shadow: 0 0 0 1.5px #fff, 0 1px 3px rgba(16, 24, 40, 0.3);
}
.netz-marke-uw-hell::after { inset: 6px; background: #fff; box-shadow: inset 0 0 0 2px var(--farbe), 0 1px 2px rgba(16, 24, 40, 0.2); }
.legende-zeile .netz-marke { width: 18px; height: 18px; }
.legende-zeile .netz-marke-uw::after { inset: 4px; }
.legende-zeile .netz-marke-uw-hell::after { inset: 5px; }
.legende-zusatz { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--text-3); white-space: nowrap; }

/* Filter */
.filter { padding: 4px 16px; }
.filter-hinweis { padding-top: 6px; }
.filter-abschnitt { padding: 12px 0; border-bottom: 1px solid var(--rand); }
.filter-abschnitt:last-of-type { border-bottom: 0; }
.filter-titel {
    font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2);
    margin-bottom: 8px; display: flex; align-items: baseline; gap: 6px;
}
.filter-einheit { font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--text-3); }

.pillen { display: flex; flex-wrap: wrap; gap: 5px; }
.pille {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; border-radius: 9999px; border: 1px solid var(--rand-stark);
    background: var(--flaeche); color: var(--text-2); font-size: 12px; cursor: pointer;
    transition: background var(--uebergang), color var(--uebergang), border-color var(--uebergang);
}
.pille:hover { border-color: var(--akzent); color: var(--akzent); }
.pille.an { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.pillen-laender .pille { min-width: 38px; justify-content: center; font-family: var(--mono); font-size: 11px; padding: 3px 6px; }
.pille-punkt { width: 8px; height: 8px; border-radius: 50%; background: var(--kat); box-shadow: 0 0 0 1.5px #fff; }

.bereich { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin-bottom: 8px; }
.bereich-strich { color: var(--text-3); font-size: 12px; }
.eingabe {
    width: 100%; min-width: 0; padding: 6px 9px; border: 1px solid var(--rand-stark); background: var(--flaeche);
    font-size: 13px; color: var(--text);
    transition: border-color var(--uebergang), box-shadow var(--uebergang);
}
.eingabe:focus { outline: none; border-color: var(--akzent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--akzent) 16%, transparent); }

.filter-betreiber {
    display: flex; align-items: center; gap: 8px; padding: 8px 6px 8px 10px;
    background: var(--akzent-hell); color: var(--akzent); border: 1px solid color-mix(in srgb, var(--akzent) 22%, transparent);
}
.filter-betreiber-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-weight: 500; }
.filter-zuruecksetzen { margin: 14px 0 6px; width: 100%; justify-content: center; }

/* Statistik */
.statistik { border-top: 1px solid var(--rand); padding: 12px 16px 12px; background: var(--grund); }
.statistik-kopf {
    display: flex; align-items: center; justify-content: space-between; color: var(--text-3);
    font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 8px;
}
.statistik-leer { font-size: 12px; color: var(--text-3); }
.statistik-summen { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.statistik-summen > div { display: flex; flex-direction: column; }
.statistik-zahl { font-size: 20px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.statistik-label { font-size: 11px; color: var(--text-3); }
.statistik-balken { display: grid; gap: 4px; }
.sb-zeile { display: grid; grid-template-columns: 82px 1fr 64px; align-items: center; gap: 8px; font-size: 11px; }
.sb-name { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-spur { height: 6px; background: transparent; }
.sb-balken { display: block; height: 100%; border-radius: 0 3px 3px 0; transition: width 300ms ease; }
.sb-wert { font-family: var(--mono); text-align: right; color: var(--text-2); }
.statistik-hinweis { display: flex; gap: 6px; margin-top: 8px; font-size: 11px; color: var(--text-2); }

.leiste-fuss {
    display: flex; align-items: center; gap: 6px; padding: 8px 16px; min-height: 34px;
    border-top: 1px solid var(--rand); font-size: 11px; color: var(--text-3);
}
.leiste-fuss .icon-sm { width: 13px; height: 13px; }

.leiste-schleier { display: none; }
.leiste-auf { display: none; }

/* ---------------------------------------------------------------- Suche */

.karte-oben-links {
    position: absolute; top: var(--abstand); left: var(--abstand); z-index: 10;
    display: flex; gap: 8px; align-items: flex-start;
}

.suche { position: relative; width: 420px; max-width: calc(100vw - var(--leiste-breite) - 2 * var(--abstand)); }
.suche-feld {
    display: flex; align-items: center; height: 44px; background: var(--flaeche);
    box-shadow: var(--schatten-schwebend); border: 1px solid transparent;
    transition: border-color var(--uebergang), box-shadow var(--uebergang);
}
.suche-feld:focus-within { border-color: var(--akzent); box-shadow: var(--schatten-schwebend), 0 0 0 3px color-mix(in srgb, var(--akzent) 14%, transparent); }
.suche-lupe { margin: 0 4px 0 14px; color: var(--text-3); }
.suche-eingabe {
    flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent;
    font: inherit; font-size: 14px; padding: 0 8px; color: var(--text);
}
.suche-eingabe::placeholder { color: var(--text-3); }
.suche-status { display: grid; place-items: center; width: 40px; color: var(--akzent); }
.suche-leeren { display: grid; place-items: center; width: 40px; height: 100%; border: 0; background: none; color: var(--text-3); cursor: pointer; }
.suche-leeren:hover { color: var(--text); }

.suche-ergebnis {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0; max-height: min(64vh, 560px); overflow-y: auto;
    background: var(--flaeche); box-shadow: var(--schatten-schwebend); border: 1px solid var(--rand);
    animation: aufklappen 150ms ease-out; transform-origin: top;
}
.suche-gruppe {
    position: sticky; top: 0; z-index: 1; background: var(--flaeche);
    padding: 10px 14px 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3);
}
.suche-eintrag {
    display: flex; align-items: center; gap: 10px; padding: 7px 14px; cursor: pointer;
    border-left: 2px solid transparent;
}
.suche-eintrag.markiert { background: var(--akzent-hell); border-left-color: var(--akzent); }
.suche-icon {
    display: grid; place-items: center; width: 28px; height: 28px; flex: none;
    background: var(--muted); color: var(--text-2);
}
.suche-icon-betreiber { background: var(--akzent-hell); color: var(--akzent); }
.suche-icon-netzbetreiber { background: var(--akzent-hell); color: var(--akzent); }
.suche-icon-kat, .suche-icon-hersteller { background: color-mix(in srgb, var(--kat, #16846b) 14%, transparent); color: var(--kat, #16846b); }
.suche-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.suche-titel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.suche-titel mark { background: none; color: var(--akzent); font-weight: 650; }
.suche-unter { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suche-zusatz { font-family: var(--mono); font-size: 11px; color: var(--text-2); white-space: nowrap; }
.suche-aktion { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--akzent); white-space: nowrap; }
.suche-aktion .icon-sm { width: 14px; height: 14px; }
.suche-leer { padding: 14px; color: var(--text-2); }
.suche-fuss { padding: 8px 14px; border-top: 1px solid var(--rand); font-size: 11px; color: var(--text-3); display: flex; gap: 4px; align-items: center; }

/* ---------------------------------------------------------------- Hinweise auf der Karte */

.testdaten {
    position: absolute; top: var(--abstand); left: 50%; transform: translateX(-50%); z-index: 9;
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 9999px;
    background: #fdefb2; color: #713f12; font-size: 12px; box-shadow: var(--schatten-karte);
    border: 1px solid #f3e08a; white-space: nowrap; animation: einblenden 240ms ease-out;
}
.karte-fehler {
    position: absolute; bottom: 48px; left: 50%; transform: translateX(-50%); z-index: 9;
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
    background: #fee2e2; color: #991b1b; font-size: 13px; box-shadow: var(--schatten-karte);
}

/* ---------------------------------------------------------------- Detailfenster */

.detail {
    position: absolute; top: var(--abstand); right: var(--abstand); z-index: 12;
    /* endet oberhalb der zugeklappten Legende (unten 34 px + Kopfzeile ~34 px + 10 px Luft) */
    width: 372px; max-height: calc(100% - var(--abstand) - var(--legende-unten) - var(--legende-kopf) - 10px);
    display: flex; flex-direction: column;
    background: var(--flaeche); box-shadow: var(--schatten-schwebend); border: 1px solid var(--rand);
    animation: hereingleiten 200ms cubic-bezier(.2, .7, .3, 1);
}
.detail-schliessen {
    position: absolute; top: 10px; right: 10px; z-index: 1;
    display: grid; place-items: center; width: 30px; height: 30px; border: 0; background: transparent;
    color: var(--text-2); cursor: pointer;
}
.detail-schliessen:hover { background: var(--muted); color: var(--text); }
.detail-laedt { display: flex; align-items: center; gap: 10px; padding: 22px 18px; color: var(--text-2); }

.detail-kopf { padding: 16px 18px 14px; border-top: 4px solid var(--kat); border-bottom: 1px solid var(--rand); }
.detail-kategorie { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 500; color: var(--text-2); padding-right: 32px; }
.detail-titel { margin: 10px 0 0; font-size: 17px; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
.detail-untertitel { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.detail-leistung-zeile { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.detail-leistung { display: flex; align-items: baseline; gap: 6px; }
.detail-leistung .zahl { font-size: 34px; font-weight: 650; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.detail-leistung .einheit { font-size: 15px; font-weight: 500; color: var(--text-2); }
.detail-leistung-label { font-size: 11px; color: var(--text-3); letter-spacing: 0.06em; text-transform: uppercase; margin-top: 4px; }

.detail-inhalt { overflow-y: auto; padding: 4px 18px 12px; scrollbar-width: thin; }
.detail-abschnitt {
    font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3);
    margin: 14px 0 6px;
}
.betreiber-link {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; cursor: pointer; text-align: left;
    background: var(--akzent-hell); color: var(--akzent); border: 1px solid color-mix(in srgb, var(--akzent) 20%, transparent);
    transition: background var(--uebergang), border-color var(--uebergang);
}
.betreiber-link:hover { background: color-mix(in srgb, var(--akzent) 14%, #fff); border-color: var(--akzent); }
.betreiber-name { flex: 1; min-width: 0; font-weight: 600; }
.betreiber-aktion { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; white-space: nowrap; opacity: 0.85; }
.betreiber-aktion .icon-sm { width: 14px; height: 14px; transition: transform var(--uebergang); }
.betreiber-link:hover .betreiber-aktion .icon-sm { transform: translateX(2px); }

.felder { display: grid; grid-template-columns: auto 1fr; margin: 12px 0 0; font-size: 12.5px; }
.felder dt { color: var(--text-2); padding: 5px 12px 5px 0; border-bottom: 1px solid var(--muted); }
.felder dd {
    margin: 0; padding: 5px 0; border-bottom: 1px solid var(--muted); text-align: right;
    font-family: var(--mono); font-size: 12px; color: var(--text); overflow-wrap: anywhere;
    display: flex; justify-content: flex-end; align-items: center; gap: 6px;
}
.kopieren { display: grid; place-items: center; width: 22px; height: 22px; border: 0; background: none; color: var(--text-3); cursor: pointer; padding: 0; }
.kopieren:hover { color: var(--akzent); }
.kopieren .icon-sm { width: 14px; height: 14px; }

.uw-marke {
    --farbe: #1c2552; display: inline-block; flex: none; width: 14px; height: 14px; background: var(--farbe);
    box-shadow: 0 0 0 1.5px #fff, 0 1px 3px rgba(16, 24, 40, 0.3);
}
.uw-marke-hell { background: #fff; box-shadow: inset 0 0 0 2.5px var(--farbe); }
.detail-leistung .zahl-netz { font-size: 28px; }
.detail-hinweis { font-size: 11.5px; color: var(--text-3); line-height: 1.5; margin: 12px 0 2px; }
a.extern { color: var(--akzent); text-decoration: none; }
a.extern:hover { text-decoration: underline; }

.detail-fuss { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; border-top: 1px solid var(--rand); background: var(--grund); }
.detail-quelle { font-size: 11px; color: var(--text-3); text-align: right; }
.detail-fuss { gap: 10px; }
.detail-fuss .btn { white-space: nowrap; flex: none; }

/* ---------------------------------------------------------------- Legende */

.legende {
    position: absolute; right: var(--abstand); bottom: var(--legende-unten); z-index: 8; width: 250px;
    background: color-mix(in srgb, var(--flaeche) 96%, transparent); box-shadow: var(--schatten-karte); border: 1px solid var(--rand);
    backdrop-filter: blur(4px);
}
.legende-kopf {
    display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; border: 0; background: none; cursor: pointer;
    font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2);
}
.legende-kopf span { flex: 1; text-align: left; }
.legende-pfeil { transition: transform var(--uebergang); }
.legende-zu .legende-pfeil { transform: rotate(180deg); }
.legende-inhalt { padding: 0 12px 10px; max-height: 46vh; overflow-y: auto; scrollbar-width: thin; }
.legende-gruppe { font-size: 11px; color: var(--text-3); margin: 8px 0 4px; }
.legende-zeile { display: flex; align-items: center; gap: 8px; padding: 2px 0; font-size: 12px; }
.legende-zeile .kat-marke { width: 18px; height: 18px; }
.legende-zeile .kat-marke-icon { width: 11px; height: 11px; }
.legende-status { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; }
.legende-status > span { display: inline-flex; align-items: center; gap: 6px; }
.legende-status .kat-marke { width: 16px; height: 16px; }
.legende-status .kat-marke-icon { width: 10px; height: 10px; }
.legende-cluster {
    display: inline-grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 50%;
    background: #16846b; color: #fff; font-size: 10px; font-weight: 700; box-shadow: 0 0 0 2px #fff, 0 0 0 5px rgba(22, 132, 107, 0.18);
}
.legende-zeile:has(.legende-cluster) { align-items: flex-start; font-size: 11.5px; color: var(--text-2); margin-top: 2px; }
.legende-leer { font-size: 12px; color: var(--text-3); }

/* ---------------------------------------------------------------- MapLibre anpassen */

.maplibregl-map { font-family: var(--schrift); }
.maplibregl-ctrl-group { border-radius: 0 !important; box-shadow: var(--schatten-karte) !important; }
.maplibregl-ctrl-group button { width: 34px; height: 34px; }
.maplibregl-ctrl-bottom-left { margin-left: 4px; margin-bottom: 4px; }
.maplibregl-ctrl-scale { border-color: var(--text-2); color: var(--text-2); font-family: var(--mono); font-size: 10px; background: rgba(255, 255, 255, 0.8); }
.maplibregl-ctrl-attrib.maplibregl-compact, .maplibregl-ctrl-attrib {
    font-size: 10.5px; background: rgba(255, 255, 255, 0.86) !important; color: var(--text-2);
}
.maplibregl-ctrl-attrib a { color: var(--text-2); }
/* Eingeklappt nur der „i“-Knopf; aufgeklappt höchstens bis zur Legendenbreite links davon, mehrzeilig */
.maplibregl-ctrl-attrib.maplibregl-compact { min-height: 24px; }
.maplibregl-ctrl-attrib.maplibregl-compact-show { max-width: min(760px, calc(100% - 140px)); line-height: 1.45; }
.maplibregl-ctrl-attrib .quellenvermerk { color: var(--text); font-weight: 500; }

.karte-tooltip .maplibregl-popup-content {
    border-radius: 0; padding: 8px 10px; box-shadow: var(--schatten-schwebend); font-size: 12px; pointer-events: none;
}
.karte-tooltip .maplibregl-popup-tip { display: none; }
.tt-titel { font-weight: 600; margin-bottom: 2px; }
.tt-zeile { color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.tt-zeile b { color: var(--text); font-family: var(--mono); font-weight: 600; }
.tt-punkt { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.karte-tooltip .tt-titel { display: flex; align-items: center; gap: 7px; }
.tt-linie { --farbe: #1c2552; width: 16px; height: 3px; flex: none; background: var(--farbe); }
.tt-linie-kabel { background: repeating-linear-gradient(90deg, var(--farbe) 0 4px, transparent 4px 6px); }
.tt-quadrat { --farbe: #1c2552; width: 9px; height: 9px; flex: none; background: var(--farbe); box-shadow: 0 0 0 1px #fff, 0 0 0 2px var(--farbe); }
.tt-tabelle { display: grid; grid-template-columns: auto 1fr; gap: 1px 12px; margin-top: 4px; }
.tt-tabelle span { color: var(--text-3); font-size: 11px; line-height: 17px; }
.tt-tabelle b { color: var(--text); font-family: var(--mono); font-size: 11px; font-weight: 500; line-height: 17px; text-align: right; overflow-wrap: anywhere; }
.tt-hinweis { margin-top: 5px; padding-top: 4px; border-top: 1px solid var(--muted); font-size: 11px; color: var(--akzent); }

.adress-pin { line-height: 0; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3)); animation: fallen 360ms cubic-bezier(.3, 1.4, .5, 1); }

/* ---------------------------------------------------------------- Animationen */

@keyframes einblenden { from { opacity: 0; } to { opacity: 1; } }
@keyframes aufklappen { from { opacity: 0; transform: scaleY(0.96); } to { opacity: 1; transform: none; } }
@keyframes hereingleiten { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
@keyframes fallen { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}

/* ---------------------------------------------------------------- Ausbaustufe 3: Gebiete, Kleinanlagen, Steckbrief */

.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primaer { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.btn-primaer:hover { background: var(--akzent-hover); }
.btn-icon { padding: 0.3rem 0.45rem; }

/* Hinweis bei 0 Treffern (Betreiber-/Herstellerfilter mit weiteren Filtern) */
.karte-hinweis {
    position: absolute; top: 70px; left: 50%; transform: translateX(-50%); z-index: 9; max-width: min(560px, calc(100% - 2 * var(--abstand)));
    display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; font-size: 13px; line-height: 1.4;
    background: var(--flaeche); border: 1px solid var(--rand); border-left: 3px solid #d97706; box-shadow: var(--schatten-schwebend);
    animation: einblenden 240ms ease-out;
}
.karte-hinweis > .icon-sm { color: #b45309; }
.karte-hinweis .btn { flex: none; white-space: nowrap; }

/* Seitenleiste: Hinweis an einer Ebene, Gebietsmarken, Flächenfärbung */
.ebene-hinweis { flex-basis: 100%; padding: 0 16px 4px 48px; margin-top: -4px; font-size: 11px; color: var(--text-3); cursor: help; }
.gebiet-marke {
    --farbe: #7d6a8a; display: inline-block; flex: none; width: 22px; height: 14px;
    border: 1.6px solid var(--farbe); background: color-mix(in srgb, var(--farbe) 8%, transparent);
}
.gebiet-marke-strich { border-style: dashed; }
.legende-zeile .gebiet-marke { width: 18px; height: 12px; }

.faerbung { padding: 2px 16px 4px 16px; display: grid; gap: 8px; }
.faerbung-aus .faerbung-zeile, .faerbung-aus .segment { opacity: 0.65; }
.faerbung-zeile { display: grid; gap: 4px; }
.faerbung-label { font-size: 12px; color: var(--text-2); }
.auswahl {
    width: 100%; padding: 6px 8px; font: inherit; font-size: 13px; color: var(--text); background: var(--flaeche);
    border: 1px solid var(--rand-stark); border-radius: 0;
}
.auswahl:focus { outline: none; border-color: var(--akzent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--akzent) 16%, transparent); }
.segment { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--rand-stark); }
.segment-knopf { border: 0; background: var(--flaeche); padding: 5px 6px; font-size: 12px; cursor: pointer; color: var(--text-2); }
.segment-knopf + .segment-knopf { border-left: 1px solid var(--rand-stark); }
.segment-knopf.an { background: var(--akzent); color: #fff; }
.segment-knopf:disabled { cursor: default; }
.faerbung-text, .faerbung-warnung { display: flex; gap: 6px; margin: 0; font-size: 11.5px; }
.faerbung-text .icon-sm, .faerbung-warnung .icon-sm { width: 13px; height: 13px; flex: none; margin-top: 2px; }
.faerbung-warnung { color: #92400e; }
.faerbung-zoom { padding-left: 0; }

/* Legende: Klassen der Flächenfärbung */
.legende-einheit { font-family: var(--mono); font-size: 10.5px; }
.legende-klassen { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.legende-klasse { display: flex; align-items: center; gap: 6px; }
.legende-flaeche { width: 14px; height: 10px; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08); }
.legende-fussnote { font-size: 10.5px; color: var(--text-3); margin-top: 3px; }
/* Legende bleibt rechts unten; bei offenem Detail zugeklappt. Klappt der Nutzer sie auf, liegt sie über dem Detail. */
.legende-ueber { z-index: 13; box-shadow: var(--schatten-schwebend); }

/* Tooltip */
.tt-tabelle .tt-klein { font-size: 10px; color: var(--text-3); font-weight: 400; }
.tt-hinweis-still { color: var(--text-3); }
.felder dd.dd-gestapelt { flex-direction: column; align-items: flex-end; gap: 1px; }

/* Steckbrief */
.gebiet { width: 380px; }
.gebiet-verdeckt { display: none; }
.gebiet-kopf { border-top-color: var(--akzent); }
.gebiet-art { color: var(--text-3); }
.gebiet-art .icon-sm { width: 14px; height: 14px; color: var(--akzent); }
.gebiet-titel { font-size: 21px; letter-spacing: -0.015em; margin-top: 6px; }
.gebiet-fakten { display: flex; gap: 14px; margin-top: 4px; font-size: 12.5px; color: var(--text-2); }
.gebiet-fakten b { color: var(--text); font-family: var(--mono); font-weight: 600; }
.gebiet-fakten .mono { font-size: 11.5px; color: var(--text-3); }
.gebiet-anzahl { font-size: 12px; color: var(--text-2); }
.gebiet-aktionen { display: flex; gap: 6px; margin-top: 12px; }
.gebiet-aktionen .btn-primaer { flex: 1; justify-content: center; }
.druck-kopf, .druck-karte { display: none; }

.gebiet-inhalt { padding-top: 2px; }
.gebiet-abschnitt { padding: 14px 0 12px; border-bottom: 1px solid var(--rand); }
.gebiet-abschnitt:last-child { border-bottom: 0; }
.gebiet-titel-klein {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 10px;
    font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2);
}
.gebiet-titel-klein .icon-sm { width: 14px; height: 14px; color: var(--text-3); }
.gebiet-zusatz { font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--text-3); font-size: 11.5px; }
.gebiet-hinweis { display: flex; gap: 6px; margin: 10px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--text-3); }
.gebiet-hinweis .icon-sm { width: 13px; height: 13px; flex: none; margin-top: 2px; }
.gebiet-hinweis-warn { margin: 12px 0 4px; padding: 8px 10px; background: #fffbeb; color: #78350f; border: 1px solid #fde68a; }
.gebiet-notiz { margin: 8px 0 0; font-size: 12px; color: var(--text-2); line-height: 1.5; }
.gebiet-notiz b { color: var(--text); font-weight: 600; }
.leer-hinweis { margin: 0; font-size: 12.5px; color: var(--text-3); }

.gebiet-ring { display: grid; grid-template-columns: 130px 1fr; gap: 12px; align-items: center; }
.ring { display: block; }
.ring-zahl { font-size: 22px; font-weight: 650; fill: var(--text); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.ring-einheit { font-size: 11px; fill: var(--text-3); font-family: var(--mono); }
.ring circle[stroke-dasharray] { transition: opacity var(--uebergang); }
.ring:hover circle[stroke-dasharray]:not(:hover) { opacity: 0.45; }
.gebiet-tabelle { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.gebiet-tabelle th { font-size: 10.5px; font-weight: 500; color: var(--text-3); text-align: right; padding: 0 0 3px; }
.gebiet-tabelle th:first-child, .gebiet-tabelle td:first-child { text-align: left; }
.gebiet-tabelle td { padding: 3px 0; border-top: 1px solid var(--muted); text-align: right; font-family: var(--mono); font-size: 11.5px; white-space: nowrap; }
.gebiet-tabelle td:first-child { font-family: var(--schrift); font-size: 12px; color: var(--text-2); }
.gebiet-tabelle td + td, .gebiet-tabelle th + th { padding-left: 8px; }
.punkt { --kat: #999; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--kat); margin-right: 6px; vertical-align: 1px; }
.punkt-eckig { border-radius: 0; }

.kacheln { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.kachel { display: flex; flex-direction: column; padding: 8px 9px; background: var(--grund); border: 1px solid var(--rand); min-width: 0; }
.kachel-zahl { font-size: 18px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.2; white-space: nowrap; }
.kachel-label { font-size: 11px; color: var(--text-3); line-height: 1.35; }

.zubau { display: block; width: 100%; height: auto; }
.zubau-raster { stroke: var(--muted); stroke-width: 1; }
.zubau-basis { stroke: var(--rand-stark); stroke-width: 1; }
.zubau-achse { font-size: 9.5px; fill: var(--text-3); font-family: var(--mono); }
.zubau-treffer { fill: transparent; }
.zubau-spalte:hover .zubau-treffer { fill: var(--akzent-hell); }
.zubau-balken { stroke: var(--flaeche); stroke-width: 0.5; }
.gebiet-legende { display: flex; flex-wrap: wrap; gap: 3px 12px; margin-top: 6px; font-size: 11.5px; color: var(--text-2); }
.gebiet-legende .punkt { margin-right: 5px; }

.plan-balken .sb-zeile { grid-template-columns: 96px 1fr 64px; }

.netzbetreiber-ebene { font-size: 11px; color: var(--text-3); margin: 10px 0 4px; }
.netzbetreiber-ebene:first-of-type { margin-top: 0; }
.netzbetreiber {
    display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; margin-bottom: 3px; text-align: left; cursor: pointer;
    background: var(--flaeche); border: 1px solid var(--rand); transition: border-color var(--uebergang), background var(--uebergang);
}
.netzbetreiber:hover:not(:disabled) { border-color: var(--akzent); background: var(--akzent-hell); }
.netzbetreiber:disabled { cursor: default; }
.netzbetreiber-name { flex: 1; min-width: 0; font-weight: 500; font-size: 13px; }
.netzbetreiber-zahl { font-family: var(--mono); font-size: 11px; color: var(--text-3); white-space: nowrap; }
.netzbetreiber-pfeil { width: 14px; height: 14px; color: var(--text-3); }
.netzbetreiber:hover .netzbetreiber-pfeil { color: var(--akzent); }
.gebiet-fuss .detail-quelle { text-align: left; line-height: 1.45; overflow-wrap: anywhere; }
.maplibregl-ctrl-attrib .quellenvermerk a { color: var(--akzent); }

/* ---------------------------------------------------------------- Druckansicht Steckbrief (Browser-Druck, „Als PDF speichern“) */

@media print {
    @page { size: A4 portrait; margin: 14mm 14mm 16mm; }
    html, body { height: auto; background: #fff; }
    body { font-size: 11pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .app { display: block; height: auto; overflow: visible; }
    .leiste, .leiste-schleier, .karte, .lade-balken, .karte-oben-links, .testdaten, .karte-hinweis, .karte-fehler,
    .legende, .kontext, .kontext-schleier, .detail:not(.gebiet), .detail-schliessen, .gebiet-aktionen, #blazor-error-ui, #components-reconnect-modal { display: none !important; }
    .karte-bereich { position: static; overflow: visible; }
    .gebiet, .gebiet.gebiet-verdeckt {
        display: block; position: static; width: auto; max-height: none; box-shadow: none; border: 0; animation: none;
    }
    .gebiet .detail-inhalt { overflow: visible; padding: 0; }
    .gebiet-kopf { padding: 0 0 10px; border-top: 0; }
    .gebiet-titel { font-size: 22pt; }
    .druck-kopf {
        display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 6px; margin-bottom: 10px;
        border-bottom: 2px solid var(--akzent); font-size: 9pt; color: var(--text-2);
    }
    .druck-marke { font-weight: 700; color: var(--akzent); font-size: 11pt; }
    .druck-karte { display: block; margin: 0 0 6px; border: 1px solid var(--rand); }
    .druck-karte img { display: block; width: 100%; max-height: 95mm; object-fit: cover; }
    .druck-karte-leer { display: none; }
    .gebiet-inhalt { columns: 2; column-gap: 9mm; }
    .gebiet-abschnitt { break-inside: avoid; padding: 8px 0; }
    .gebiet-hinweis-warn { column-span: all; }
    .gebiet-abschnitt:first-child { column-span: all; }   /* Bestand mit Ring und Tabelle über beide Spalten */
    .zubau-spalte .zubau-treffer { fill: transparent !important; }
    .netzbetreiber { border: 0; padding: 2px 0; }
    .netzbetreiber-pfeil { display: none; }
    .gebiet-fuss { background: none; border-top: 1px solid var(--rand); padding: 8px 0 0; }
}

/* ---------------------------------------------------------------- Tablet und schmaler */

@media (max-width: 1100px) {
    .detail { width: 340px; }
    .suche { width: 340px; }
}

@media (max-width: 960px) {
    .app { grid-template-columns: 1fr; }
    .leiste-griff { display: none; }
    .leiste {
        position: fixed; top: 0; bottom: 0; left: 0; width: min(var(--leiste-breite), 86vw);
        transform: translateX(-102%); transition: transform 220ms cubic-bezier(.2, .7, .3, 1);
    }
    .leiste-offen .leiste { transform: none; box-shadow: var(--schatten-schwebend); }
    .leiste-zu { display: grid; place-items: center; width: 30px; height: 30px; border: 0; background: none; cursor: pointer; color: var(--text-2); }
    .leiste-schleier {
        display: block; position: fixed; inset: 0; z-index: 15; background: rgba(16, 24, 40, 0.28);
        opacity: 0; pointer-events: none; transition: opacity 220ms;
    }
    .leiste-offen .leiste-schleier { opacity: 1; pointer-events: auto; }
    .leiste-auf {
        position: relative; display: grid; place-items: center; width: 44px; height: 44px; flex: none;
        background: var(--flaeche); border: 0; box-shadow: var(--schatten-schwebend); cursor: pointer;
    }
    .leiste-auf .reiter-zahl { position: absolute; top: -5px; right: -5px; }
    .suche { width: min(400px, calc(100vw - 2 * var(--abstand) - 52px)); max-width: none; }
    .testdaten { top: auto; bottom: 40px; }
    .testdaten span { display: none; }
}

@media (max-width: 640px) {
    .detail { left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; max-height: 62%; }
    .karte-hinweis { top: auto; bottom: 46px; flex-wrap: wrap; }
    .legende { display: none; }
}

/* ---------------------------------------------------------------- Firmen (Ausbaustufe 4) */

/* Firmen-Marke: Quadrat mit gerundeten Ecken wie auf der Karte; OSM hell mit Rand, MaStR-Firmensitz gefüllt */
.firma-marke {
    --farbe: #7b5b3a;
    display: inline-grid; place-items: center; flex: none; width: 18px; height: 18px; border-radius: 4px;
    background: #fff; color: var(--farbe); box-shadow: inset 0 0 0 1.5px var(--farbe), 0 1px 2px rgba(16, 24, 40, 0.18);
}
.firma-marke .icon-sm { width: 11px; height: 11px; stroke-width: 2.4; }
.firma-marke-mastr { background: var(--farbe); color: #fff; box-shadow: 0 0 0 1.5px #fff, 0 1px 3px rgba(16, 24, 40, 0.3); }
.ebenen-gruppe-gesperrt .firma-marke { opacity: 0.4; filter: grayscale(1); }
.legende-zeile .firma-marke { width: 16px; height: 16px; }
.legende-zeile .firma-marke .icon-sm { width: 10px; height: 10px; }
.tt-firma { --farbe: #7b5b3a; width: 10px; height: 10px; flex: none; border-radius: 3px; background: #fff; box-shadow: inset 0 0 0 1.5px var(--farbe); }
.tt-firma-mastr { background: var(--farbe); box-shadow: none; }
.tt-zeile.tt-klein { font-size: 11px; color: var(--text-3); }

.detail-zurueck {
    display: inline-flex; align-items: center; gap: 4px; margin: -4px 0 8px -2px; padding: 2px 2px; border: 0;
    background: none; color: var(--akzent); font-size: 12px; cursor: pointer;
}
.detail-zurueck .icon-sm { width: 14px; height: 14px; }
.detail-zurueck:hover { text-decoration: underline; }
.felder dd.dd-text { font-family: var(--schrift); font-size: 12.5px; }
.firma-anlagen-laedt { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; font-size: 12px; color: var(--text-3); }

.firmen-liste { list-style: none; margin: 10px -18px 0; padding: 0; }
.firmen-liste li + li { border-top: 1px solid var(--muted); }
.firmen-liste-klein { margin-top: 2px; }
.firmen-eintrag {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 18px; border: 0; background: none;
    text-align: left; cursor: pointer; color: var(--text); transition: background var(--uebergang);
}
.firmen-eintrag:hover { background: var(--grund); }
.firmen-eintrag > .icon-sm { width: 14px; height: 14px; color: var(--text-3); flex: none; }
.firmen-eintrag:hover > .icon-sm { color: var(--akzent); }
.firmen-eintrag-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.firmen-eintrag-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.firmen-eintrag-unter { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.firmen-eintrag-abstand { font-family: var(--mono); font-size: 11px; color: var(--text-3); white-space: nowrap; }

.suche-icon-firma { background: color-mix(in srgb, #7b5b3a 12%, transparent); color: #7b5b3a; }

/* Schalter „Anlagen zusammenfassen“ (oben im Reiter Ebenen) */
.zusammen { padding: 8px 12px 6px 16px; border-bottom: 1px solid var(--rand); margin-bottom: 2px; }
.schalter { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; position: relative; }
.schalter input { position: absolute; opacity: 0; width: 34px; height: 20px; margin: 0; cursor: pointer; }
.schalter-bahn {
    flex: none; position: relative; width: 32px; height: 18px; margin-top: 1px; border-radius: 9999px;
    background: var(--rand-stark); transition: background var(--uebergang);
}
.schalter-bahn::after {
    content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.3); transition: transform var(--uebergang);
}
.schalter input:checked + .schalter-bahn { background: var(--akzent); }
.schalter input:checked + .schalter-bahn::after { transform: translateX(14px); }
.schalter input:focus-visible + .schalter-bahn { outline: 2px solid var(--akzent); outline-offset: 2px; }
.schalter-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.schalter-name { font-weight: 500; line-height: 20px; }
.schalter-hinweis { font-size: 11.5px; color: var(--text-3); line-height: 1.4; }
.zusammen-gesperrt .schalter { cursor: default; }
.zusammen-gesperrt .schalter input { cursor: default; }
.zusammen-gesperrt .schalter-bahn { opacity: 0.55; }
.zusammen-gesperrt .schalter-name { color: var(--text-3); }
.zusammen .ebenen-badge { margin: 2px 0 0; }

/* Legende: Einzelpunkte */
.legende-punkte { display: inline-flex; align-items: center; gap: 2px; width: 24px; flex: none; }
.legende-punkte i { display: block; border-radius: 50%; background: #16846b; }
.legende-punkte i:nth-child(1) { width: 4px; height: 4px; background: #e0a000; }
.legende-punkte i:nth-child(2) { width: 6px; height: 6px; background: #d4582a; }
.legende-punkte i:nth-child(3) { width: 9px; height: 9px; }
.legende-zeile:has(.legende-punkte) { font-size: 11.5px; color: var(--text-2); }

/* ---------------------------------------------------------------- Sonstiges */

.einfache-seite { max-width: 640px; margin: 15vh auto; padding: 0 2rem; }
.einfache-seite h1 { font-size: 1.5rem; font-weight: 600; }
.einfache-seite a { color: var(--akzent); }

#blazor-error-ui {
    display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
    padding: 0.6rem 1.25rem; background: #fee2e2; color: #991b1b; box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.1);
}
#blazor-error-ui .reload { color: inherit; font-weight: 600; margin-left: 8px; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.9rem; top: 0.5rem; }

/* ---------------------------------------------------------------- Ortsfenster „Diese Stelle“ */

.ort-kopf { border-top-color: var(--akzent); }
.ort-icon { width: 14px; height: 14px; color: var(--akzent); }
.ort-leer {
    display: flex; gap: 10px; align-items: flex-start; margin: 12px 0 2px; padding: 10px 12px;
    background: var(--grund); border: 1px solid var(--rand); font-size: 12.5px; line-height: 1.5; color: var(--text-2);
}
.ort-leer > svg { flex: none; width: 18px; height: 18px; margin-top: 1px; color: var(--akzent); }
.ort-leer b { display: block; color: var(--text); font-weight: 600; margin-bottom: 2px; }
.ort-quelle { text-align: left; line-height: 1.45; }
.link-knopf { border: 0; background: none; padding: 0; color: var(--akzent); font-size: 12px; cursor: pointer; font-family: var(--schrift); }
.link-knopf:hover { text-decoration: underline; }
.firmen-eintrag > .kat-marke { width: 20px; height: 20px; flex: none; }
.firmen-eintrag > .kat-marke .kat-marke-icon { width: 12px; height: 12px; }

/* ---------------------------------------------------------------- Kontextmenü */

.kontext-schleier { position: absolute; inset: 0; z-index: 30; }
.kontext {
    position: absolute; z-index: 31; width: 252px; padding: 4px 0;
    background: var(--flaeche); border: 1px solid var(--rand); box-shadow: var(--schatten-schwebend);
    animation: kontext-auf 110ms ease-out;
}
@keyframes kontext-auf { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.kontext-kopf {
    padding: 6px 12px 7px; font-size: 11px; color: var(--text-3); font-family: var(--mono);
    border-bottom: 1px solid var(--muted); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kontext-eintrag {
    display: flex; align-items: center; gap: 10px; width: 100%; height: 32px; padding: 0 12px; border: 0; background: none;
    font: inherit; font-size: 13px; color: var(--text); text-align: left; text-decoration: none; cursor: pointer;
}
.kontext-eintrag > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kontext-eintrag .icon-sm { width: 15px; height: 15px; color: var(--text-3); flex: none; }
.kontext-eintrag:hover, .kontext-eintrag:focus-visible { background: var(--akzent-hell); color: var(--akzent); outline: none; }
.kontext-eintrag:hover .icon-sm, .kontext-eintrag:focus-visible .icon-sm { color: var(--akzent); }
.kontext-eintrag:disabled { color: var(--text-3); cursor: default; background: none; }
.kontext-eintrag .kontext-extern { width: 12px; height: 12px; transform: rotate(-45deg); opacity: 0.7; }
.kontext-trenner { height: 1px; margin: 4px 0; background: var(--muted); }
@media (prefers-reduced-motion: reduce) { .kontext { animation: none; } }

/* ---------------------------------------------------------------- Zusammengeführte Firmen (OSM und MaStR) */

.firma-marke-kombi { background: var(--farbe); color: #fff; box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--farbe), 0 1px 4px rgba(16, 24, 40, 0.3); }
.tt-firma-kombi { background: var(--farbe); box-shadow: 0 0 0 1.5px #fff, 0 0 0 2.5px var(--farbe); }

/* ---------------------------------------------------------------- Logistik / Schwertransport */

/* Linienmarke wie auf der Karte: durchscheinendes Band mit gestrichelter Mittellinie; Strichmuster je Art */
.logistik-marke {
    --farbe: #c8102e; --strich: 0 5px, transparent 5px 8px;
    display: inline-block; flex: none; width: 22px; height: 22px;
    background:
        repeating-linear-gradient(90deg, var(--farbe) var(--strich)) center / 100% 2.5px no-repeat,
        linear-gradient(color-mix(in srgb, var(--farbe) 26%, transparent), color-mix(in srgb, var(--farbe) 26%, transparent)) center / 100% 9px no-repeat;
}
.logistik-marke-achslast { --strich: 0 2px, transparent 2px 4.5px; }
.logistik-marke-hoehe { --strich: 0 6px, transparent 6px 8px, var(--farbe) 8px 9.5px, transparent 9.5px 11.5px; }
.logistik-marke-mass { --strich: 0 9px, transparent 9px 11.5px; }
.logistik-marke-lkw { --strich: 0 2.5px, transparent 2.5px 4.5px; }
.logistik-marke-tunnel { --strich: 0 3px, transparent 3px 6px; }
.logistik-marke-bruecke {
    background:
        linear-gradient(var(--farbe), var(--farbe)) center 6px / 100% 1.5px no-repeat,
        linear-gradient(var(--farbe), var(--farbe)) center 14.5px / 100% 1.5px no-repeat,
        linear-gradient(color-mix(in srgb, var(--farbe) 18%, transparent), color-mix(in srgb, var(--farbe) 18%, transparent)) center / 100% 9px no-repeat;
}
.legende-zeile .logistik-marke { width: 18px; height: 18px; }
.legende-zeile .logistik-marke-bruecke { background-position: center 4px, center 12.5px, center; }
.ebenen-gruppe-gesperrt .logistik-marke { opacity: 0.4; filter: grayscale(1); }

/* Hindernis-Schild: weiße Scheibe mit farbigem Ring */
.logistik-schild {
    --farbe: #d96c00;
    display: inline-block; flex: none; width: 16px; height: 16px; border-radius: 50%;
    background: #fff; box-shadow: inset 0 0 0 3px var(--farbe), 0 1px 2px rgba(16, 24, 40, 0.25);
}
.legende-zeile .logistik-schild { width: 14px; height: 14px; margin: 0 2px; box-shadow: inset 0 0 0 2.5px var(--farbe); }
.tt-schild { width: 10px; height: 10px; flex: none; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 2px #c8102e; }
.tt-titel:has(.tt-schild) { display: flex; align-items: center; gap: 6px; }
.tt-kritisch { margin-top: 5px; padding: 3px 6px; font-size: 11px; font-weight: 600; color: #fff; background: var(--gefahr); }

/* Hinweis „OSM lückenhaft“: deutlich, aber ohne Alarm */
.logistik-warnung {
    display: flex; gap: 8px; align-items: flex-start; margin: 14px 0 2px; padding: 8px 10px;
    font-size: 12px; line-height: 1.45; color: #7c2d12; background: #fff7ed; border-left: 3px solid #d97706;
}
.logistik-warnung .icon-sm { width: 15px; height: 15px; flex: none; margin-top: 1px; color: #c2410c; }
.logistik-hinweis { display: flex; gap: 6px; color: #92400e; }
.logistik-hinweis .icon-sm { width: 13px; height: 13px; flex: none; margin-top: 2px; }

/* Abgleich mit „Mein Transport“ im Detail */
.logistik-pruefung {
    display: flex; gap: 8px; align-items: flex-start; margin: 0 0 12px; padding: 8px 10px; font-size: 12.5px;
    background: #f0fdf4; border-left: 3px solid #15803d; color: #14532d;
}
.logistik-pruefung > .icon-sm { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.logistik-pruefung ul { margin: 3px 0 0; padding-left: 16px; }
.logistik-pruefung li { font-family: var(--mono); font-size: 12px; }
.logistik-kritisch { background: #fef2f2; border-left-color: var(--gefahr); color: #7f1d1d; }
.logistik-kritisch > .icon-sm { color: var(--gefahr); }

/* „Mein Transport“ in der Seitenleiste */
.transport { margin: 8px 16px 6px 16px; padding: 10px 12px 10px; border: 1px solid var(--rand); background: var(--grund); }
.transport-aktiv { border-color: color-mix(in srgb, var(--gefahr) 45%, var(--rand)); background: #fffafa; }
.transport-aus { opacity: 0.6; }
.transport-kopf { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.transport-titel { font-size: 12px; font-weight: 600; letter-spacing: 0.02em; color: var(--text); }
.transport-leeren { border: 0; background: none; padding: 0; font: inherit; font-size: 11.5px; color: var(--akzent); cursor: pointer; }
.transport-leeren:hover { text-decoration: underline; }
.transport-text { margin: 2px 0 8px; font-size: 11px; }
.transport-felder { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.transport-feld { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 4px; font-size: 11px; color: var(--text-2); }
.transport-feld > span { grid-column: 1 / -1; }
.transport-feld .eingabe { padding: 4px 7px; font-size: 12.5px; }
.transport-feld i { font-style: normal; font-family: var(--mono); font-size: 11px; color: var(--text-3); width: 10px; }
.transport-rest { display: flex; gap: 6px; align-items: center; margin-top: 9px; font-size: 12px; color: var(--text-2); cursor: pointer; }
.transport-rest input { accent-color: var(--akzent); }

/* Netzanschluss im Anlagen-Detail */
.netzanschluss-link { margin: 6px 0 4px; }

/* ---------------------------------------------------------------- Schutzgebiete */

/* Flächenmarke wie auf der Karte: blasse Fläche mit Rand; harte Ausschlüsse mit Schraffur (Richtung je Art) */
.schutz-marke {
    --farbe: #2f7d4a; --muster: none;
    display: inline-block; flex: none; width: 22px; height: 14px;
    border: 1.6px solid var(--farbe);
    background: var(--muster), color-mix(in srgb, var(--farbe) 16%, transparent);
}
.schutz-marke-rechts { --muster: repeating-linear-gradient(-45deg, var(--farbe) 0 1.3px, transparent 1.3px 4.5px); }
.schutz-marke-links { --muster: repeating-linear-gradient(45deg, var(--farbe) 0 1.3px, transparent 1.3px 4.5px); }
.schutz-marke-waagerecht { --muster: repeating-linear-gradient(0deg, var(--farbe) 0 1.2px, transparent 1.2px 4px); }
.schutz-marke-kreuz {
    --muster: repeating-linear-gradient(45deg, var(--farbe) 0 1.1px, transparent 1.1px 4.5px),
              repeating-linear-gradient(-45deg, var(--farbe) 0 1.1px, transparent 1.1px 4.5px);
}
.legende-zeile .schutz-marke { width: 18px; height: 12px; }
.ebenen-gruppe-gesperrt .schutz-marke { opacity: 0.4; filter: grayscale(1); }
.ebenen-untertitel {
    padding: 6px 16px 2px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em; color: var(--text-3);
}
.ebenen-gruppe-zu .ebenen-untertitel { display: none; }
.schutz-hart { font-family: var(--schrift); font-size: 10px; color: #7f1d1d; }
.ebene-aus .schutz-hart { color: var(--text-3); }

/* Ortsfenster: Schutzgebiete hier */
.schutz-liste { list-style: none; margin: 2px -18px 0; padding: 0; }
.schutz-liste li + li { border-top: 1px solid var(--muted); }
.schutz-eintrag { display: flex; align-items: flex-start; gap: 10px; padding: 7px 18px; }
.schutz-eintrag > .schutz-marke { margin-top: 3px; width: 18px; height: 13px; }
.schutz-eintrag-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.schutz-eintrag-name { font-weight: 500; overflow-wrap: anywhere; }
.schutz-eintrag-unter { font-size: 12px; color: var(--text-3); }
.schutz-eintrag-unter .mono { font-size: 11.5px; }
.schutz-eintrag-marken { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none; }
.schutz-badge {
    font-size: 10px; font-weight: 600; padding: 1px 7px; border-radius: 9999px; white-space: nowrap;
    color: #7f1d1d; background: #fef2f2; border: 1px solid #fecaca;
}
.schutz-aus {
    font-size: 10px; padding: 1px 7px; border-radius: 9999px; white-space: nowrap; color: var(--text-2); background: var(--muted);
}
.schutz-eintrag-aus .schutz-eintrag-name { color: var(--text-2); }
.schutz-eintrag-aus .schutz-marke { opacity: 0.55; }
.schutz-warnung {
    display: flex; gap: 8px; align-items: flex-start; margin: 8px 0 2px; padding: 7px 10px;
    font-size: 11.5px; line-height: 1.45; color: #78350f; background: #fffbeb; border-left: 3px solid #d97706;
}
.schutz-warnung .icon-sm { width: 14px; height: 14px; flex: none; margin-top: 1px; color: #b45309; }
.schutz-keins { margin-top: 0; }

/* Kontextmenü: Abschnitt „Schutzgebiete hier“ */
.kontext-titel {
    padding: 4px 12px 2px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3);
}
.kontext-info { display: flex; align-items: flex-start; gap: 10px; padding: 3px 12px; min-height: 36px; }
.kontext-info > .schutz-marke { margin-top: 3px; width: 15px; height: 11px; }
.kontext-info-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 12.5px; line-height: 1.35; }
.kontext-info-text > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kontext-info-unter { font-size: 11px; color: var(--text-3); }
.kontext-info-aus .kontext-info-text > span:first-child { color: var(--text-2); }
.kontext-hinweis { padding: 2px 12px 4px; font-size: 10.5px; line-height: 1.4; color: #92400e; }

/* Tooltip */
.tt-schutz { display: flex; align-items: center; gap: 6px; }
.tt-schutz .schutz-marke { width: 12px; height: 9px; border-width: 1.3px; }
.tt-schutz + .tt-schutz { margin-top: 2px; }
.tt-schutz-name { font-weight: 600; }
.tt-schutz-art { color: var(--text-3); font-size: 11px; }

/* ---------------------------------------------------------------- Netzengpässe (Netzausbaupläne) */

/* Marken wie auf der Karte: Ring um das Umspannwerk (Rot/Orange mit Halo), unscharfer Punkt = Lage ungefähr,
   gestrichelte Linie = Leitung schematisch */
.engpass-ring {
    --farbe: #c62828; display: inline-block; flex: none; width: 13px; height: 13px; border-radius: 50%;
    border: 2.5px solid var(--farbe); background: color-mix(in srgb, var(--farbe) 14%, transparent);
}
.engpass-ring-halo { box-shadow: 0 0 0 3px color-mix(in srgb, var(--farbe) 22%, transparent); }
.engpass-ring-ungefaehr { border: 0; background: color-mix(in srgb, var(--farbe) 60%, transparent); filter: blur(1.2px); }
.engpass-ring-naehe { border-width: 1.5px; border-color: color-mix(in srgb, var(--farbe) 60%, transparent); background: color-mix(in srgb, var(--farbe) 8%, transparent); }
.engpass-massnahme-erledigt { opacity: 0.55; }
.engpass-linie {
    --farbe: #c62828; display: inline-block; flex: none; width: 20px; height: 3px;
    background: repeating-linear-gradient(90deg, var(--farbe) 0 5px, transparent 5px 9px);
}
.legende-zeile .engpass-ring { width: 11px; height: 11px; margin: 0 4px; }
.legende-zeile .engpass-linie { width: 18px; }
.engpass-marke {
    --farbe: #c62828; display: inline-block; flex: none; width: 14px; height: 14px; border-radius: 50%;
    border: 2.5px solid var(--farbe); box-shadow: 0 0 0 3px color-mix(in srgb, var(--farbe) 22%, transparent);
    margin: 0 3px;
}
.ebene-aus .engpass-marke, .ebenen-gruppe-gesperrt .engpass-marke { opacity: 0.45; filter: grayscale(1); }

/* Seitenleiste: Umschalter aktuell/prognostiziert und Farben */
.engpass-optionen { padding: 4px 16px 4px 16px; display: grid; gap: 8px; }
.engpass-optionen-aus { opacity: 0.6; }
.ebenen-gruppe-zu .engpass-optionen { display: none; }
.engpass-klassen { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: 11.5px; color: var(--text-2); }
.engpass-klassen li { display: flex; align-items: center; gap: 8px; }
.engpass-punkt { --farbe: #c62828; width: 9px; height: 9px; border-radius: 50%; flex: none; border: 2px solid var(--farbe); }

/* Tooltip */
.tt-titel-marke { display: flex; align-items: center; gap: 6px; }
.tt-ring { --farbe: #c62828; width: 10px; height: 10px; flex: none; border-radius: 50%; border: 2px solid var(--farbe); box-shadow: 0 0 0 2px color-mix(in srgb, var(--farbe) 22%, transparent); }
.tt-engpass { margin: 3px 0 2px; padding-left: 7px; border-left: 3px solid var(--farbe); font-size: 11.5px; font-weight: 600; color: var(--text); }

/* Detail */
.engpass-nb {
    display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 3px 8px 3px 6px; max-width: 100%;
    border: 1px solid color-mix(in srgb, var(--akzent) 25%, transparent); background: var(--akzent-hell); color: var(--akzent);
    font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; text-align: left;
}
.engpass-nb:hover { border-color: var(--akzent); }
.engpass-nb .icon-sm { width: 14px; height: 14px; flex: none; }
.engpass-nb span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.engpass-status { display: grid; gap: 4px; margin-top: 12px; }
.engpass-status-zeile { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--text-3); }
.engpass-status-aktiv .engpass-status-name { color: var(--text); font-weight: 600; }
.engpass-status-name::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; vertical-align: 1px; background: transparent; }
.engpass-status-aktiv .engpass-status-name::before { background: var(--akzent); }
.badge-engpass { background: #fdecea; color: #9b1c1c; }
.badge-engpass-prognose { background: #fff1e0; color: #8a4b08; }
.engpass-satz { margin: 10px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--text-2); }
.engpass-ungefaehr {
    display: flex; gap: 8px; align-items: flex-start; margin: 12px 0 0; padding: 7px 10px; font-size: 12px; line-height: 1.45;
    color: var(--text-2); background: var(--grund); border-left: 3px solid var(--text-3);
}
.engpass-ungefaehr .icon-sm { width: 14px; height: 14px; flex: none; margin-top: 1px; }
.engpass-laedt { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.engpass-massnahmen { list-style: none; margin: 0 -18px; padding: 0; }
.engpass-massnahme { padding: 9px 18px 10px; border-top: 1px solid var(--muted); }
.engpass-massnahme:last-child { border-bottom: 1px solid var(--muted); }
.engpass-m-kopf { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.engpass-m-name { font-weight: 600; font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.engpass-m-wert { font-family: var(--mono); font-size: 12px; white-space: nowrap; color: var(--text); }
.engpass-m-unter { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.engpass-m-felder { display: grid; grid-template-columns: auto 1fr; gap: 1px 12px; margin: 6px 0 0; font-size: 12px; }
.engpass-m-felder dt { color: var(--text-2); }
.engpass-m-felder dd { margin: 0; text-align: right; font-family: var(--mono); font-size: 11.5px; overflow-wrap: anywhere; }
.engpass-m-felder dd.engpass-ja { color: #9b1c1c; font-weight: 600; }
.engpass-m-felder dd.engpass-ja-prognose { color: #8a4b08; font-weight: 600; }
.engpass-m-quelle { display: flex; gap: 6px; align-items: flex-start; margin-top: 6px; font-size: 11px; color: var(--text-3); line-height: 1.4; }
.engpass-m-quelle .icon-sm { width: 12px; height: 12px; flex: none; margin-top: 1px; }
.engpass-m-quelle .mono, .engpass-m-quelle a { font-family: var(--mono); font-size: 10.5px; overflow-wrap: anywhere; }
.engpass-warnung { margin-top: 12px; }

/* Umspannwerk-Detail: Verweis auf den Netzausbauplan */
.engpass-verweis {
    --farbe: #c62828; display: flex; align-items: center; gap: 10px; width: 100%; margin: 12px 0 0; padding: 8px 10px;
    border: 1px solid color-mix(in srgb, var(--farbe) 35%, var(--rand)); background: color-mix(in srgb, var(--farbe) 6%, #fff);
    font: inherit; text-align: left; cursor: pointer; color: var(--text);
}
button.engpass-verweis:hover { border-color: var(--farbe); }
.engpass-verweis-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 12px; color: var(--text-2); }
.engpass-verweis-text b { font-size: 13px; color: var(--text); }
.engpass-verweis .icon-sm { width: 14px; height: 14px; flex: none; color: var(--text-3); }
.engpass-verweis-leer { cursor: default; border-color: var(--rand); background: var(--grund); font-size: 12px; color: var(--text-2); align-items: flex-start; }
.engpass-verweis-leer .icon-sm { margin-top: 1px; }

/* Netzentgelte im Gemeinde-Steckbrief (Ausbaustufe 8) */
.ne-vnb { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin: 8px 0 2px; }
.ne-vnb:first-of-type { margin-top: 2px; }
.ne-vnb-name { font-weight: 600; font-size: 12.5px; color: var(--text-1, inherit); }
.ne-vnb-anteil { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.ne-tabelle { margin-bottom: 4px; }
.ne-einheit { color: var(--text-3); font-size: 10.5px; }
.ne-auffaellig { color: var(--text-3); text-decoration: line-through dotted; }

/* ---------------------------------------------------------------- EEG-Ende und Post-EEG (Ausbaustufe 9) */

.eeg-punkt { --farbe: #5f6773; display: inline-block; width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--farbe); box-shadow: 0 0 0 1.5px #fff, 0 0 0 2.5px color-mix(in srgb, var(--farbe) 40%, transparent); }
.legende-klasse .eeg-punkt { width: 9px; height: 9px; }

/* Seitenleiste: Schalter Färbung nach EEG-Ende */
.eeg-schalter .eeg-klassen { list-style: none; margin: 8px 0 2px 42px; padding: 0; display: grid; gap: 3px; font-size: 11.5px; color: var(--text-2); }
.eeg-klassen li { display: flex; align-items: center; gap: 8px; }
.eeg-jahre { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--text-3); white-space: nowrap; }

/* Filter EEG-Ende */
.filter-eeg-hinweis { margin: 8px 0 0; font-size: 11.5px; }
.filter-eeg-liste { width: 100%; justify-content: center; margin-top: 8px; }

/* Seitenleiste: Einstieg Post-EEG */
.leiste-post-eeg {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 16px; border: 0; border-top: 1px solid var(--rand);
    background: var(--flaeche); cursor: pointer; text-align: left; color: var(--text);
}
.leiste-post-eeg:hover { background: var(--akzent-hell); }
.leiste-post-eeg > .icon-sm:first-child { color: #b3122e; }
.leiste-post-eeg-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-weight: 600; font-size: 13px; line-height: 1.25; }
.leiste-post-eeg-text span { font-weight: 400; font-size: 11.5px; color: var(--text-3); }
.leiste-post-eeg-pfeil { color: var(--text-3); transition: transform var(--uebergang); }
.leiste-post-eeg.an { background: var(--akzent-hell); box-shadow: inset 3px 0 0 var(--akzent); }
.leiste-post-eeg.an .leiste-post-eeg-pfeil { transform: rotate(90deg); color: var(--akzent); }

/* Anlagen-Detail: Förderende */
.eeg-ende-box {
    --farbe: #5f6773; display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 8px 10px;
    border: 1px solid color-mix(in srgb, var(--farbe) 30%, var(--rand)); border-left: 4px solid var(--farbe);
    background: color-mix(in srgb, var(--farbe) 6%, #fff);
}
.eeg-ende-box .eeg-punkt { display: none; }
.eeg-ende-box-text { display: flex; flex-direction: column; line-height: 1.2; }
.eeg-ende-box-label { font-size: 11px; color: var(--text-3); letter-spacing: 0.04em; text-transform: uppercase; }
.eeg-ende-box-text b { font-size: 15px; }
.eeg-ende-box-rest { margin-left: auto; font-size: 12.5px; font-weight: 600; color: color-mix(in srgb, var(--farbe) 80%, #000); text-align: right; }
.eeg-ende-box-aus { background: color-mix(in srgb, var(--farbe) 10%, #fff); }
.felder dd.eeg-ersatz { color: #92400e; font-style: italic; }
.felder dd.eeg-schluessel { font-size: 10.5px; overflow-wrap: anywhere; }

/* Panel Post-EEG am unteren Kartenrand */
.eeg-panel {
    position: absolute; left: 56px; right: var(--abstand); bottom: var(--abstand); z-index: 11;
    height: min(44%, 430px); min-height: 260px; display: flex; flex-direction: column;
    background: var(--flaeche); border: 1px solid var(--rand); box-shadow: var(--schatten-schwebend);
    animation: einblenden 200ms ease-out;
}
.eeg-kopf { display: flex; align-items: center; gap: 14px; padding: 0 8px 0 14px; border-bottom: 1px solid var(--rand); flex-wrap: wrap; }
.eeg-titel { display: flex; align-items: center; gap: 7px; font-weight: 650; font-size: 14px; }
.eeg-titel .icon-sm { color: #b3122e; }
.eeg-reiter { padding: 0; border-bottom: 0; }
.eeg-reiter .reiter-knopf { padding-top: 11px; padding-bottom: 9px; }
.eeg-reiter-zusatz { font-weight: 400; color: var(--text-3); }
.eeg-werkzeuge { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.eeg-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.eeg-check input { accent-color: var(--akzent); margin: 0; }
.eeg-csv { text-decoration: none; color: var(--text); display: inline-flex; align-items: center; gap: 5px; }
.eeg-csv-aus { opacity: 0.5; cursor: default; }
.eeg-symbol { display: grid; place-items: center; width: 30px; height: 30px; border: 0; background: none; cursor: pointer; color: var(--text-2); }
.eeg-symbol:hover, .eeg-symbol.an { color: var(--akzent); background: var(--akzent-hell); }
.eeg-hinweis {
    display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 7px 14px; font-size: 12px; line-height: 1.45;
    background: #fffbeb; color: #78350f; border-bottom: 1px solid #fde68a;
}
.eeg-hinweis .icon-sm { width: 14px; height: 14px; flex: none; margin-top: 1px; }
.eeg-filterzeile { display: flex; flex-wrap: wrap; gap: 4px 6px; padding: 6px 14px; border-bottom: 1px solid var(--muted); font-size: 11.5px; }
.eeg-filter { padding: 1px 7px; background: var(--grund); border: 1px solid var(--rand); color: var(--text-2); white-space: nowrap; }
.eeg-filter-tipp { background: none; border-style: dashed; color: var(--text-3); }
.eeg-rahmen { position: relative; flex: 1; min-height: 0; overflow: auto; scrollbar-width: thin; }
.eeg-leer { display: flex; align-items: center; gap: 10px; padding: 20px 16px; color: var(--text-2); font-size: 13px; }
.eeg-laedt { position: absolute; top: 8px; right: 12px; z-index: 2; }
.eeg-tabelle { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.eeg-tabelle th {
    position: sticky; top: 0; z-index: 1; background: var(--grund); text-align: left; font-weight: 600; font-size: 11px;
    color: var(--text-2); letter-spacing: 0.02em; padding: 6px 10px; border-bottom: 1px solid var(--rand); white-space: nowrap;
}
.eeg-tabelle td { padding: 6px 10px; border-bottom: 1px solid var(--muted); vertical-align: top; }
.eeg-tabelle .zahl { text-align: right; font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.eeg-tabelle th.zahl { font-family: inherit; font-size: 11px; }
.eeg-tabelle th.zahl .eeg-sort { justify-content: flex-end; }
.eeg-sort { display: inline-flex; align-items: center; gap: 4px; width: 100%; border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.eeg-sort:hover { color: var(--akzent); }
.eeg-sort.an { color: var(--akzent); }
.eeg-sort-pfeil { font-size: 9px; }
.eeg-klickbar { cursor: pointer; }
.eeg-klickbar:hover td { background: var(--akzent-hell); }
.eeg-gewaehlt td { background: color-mix(in srgb, var(--akzent) 10%, #fff); }
.eeg-gewaehlt td:first-child { box-shadow: inset 3px 0 0 var(--akzent); }
.eeg-sammel td { color: var(--text-2); background: var(--grund); font-style: italic; cursor: default; }
.eeg-name { min-width: 200px; max-width: 340px; }
.eeg-name-text { display: block; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.eeg-sammel .eeg-name-text { font-weight: 500; color: var(--text-2); }
.eeg-name .klein { display: block; }
.eeg-einzel { margin-left: 4px; padding: 0 5px; font-size: 10px; font-weight: 500; font-style: normal; color: var(--text-3); border: 1px solid var(--rand); }
.eeg-ende { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.eeg-ende .eeg-punkt { width: 9px; height: 9px; }
/* Windparks: Anteil ausgelaufener Anlagen des Parks (Leistungsanteil) */
.eeg-aus { white-space: nowrap; font-family: var(--mono); font-size: 11.5px; }
.eeg-aus-anteil { font-weight: 600; color: #b3122e; }
.eeg-aus-null, .eeg-aus-null .eeg-aus-anteil, .eeg-aus-leer { color: var(--text-3); font-weight: 400; }
.eeg-kategorien { display: inline-flex; flex-wrap: wrap; gap: 3px 8px; }
.eeg-kat { display: inline-flex; align-items: center; gap: 3px; font-family: var(--mono); font-size: 11px; color: var(--text-2); }
.eeg-kat .kat-marke { width: 15px; height: 15px; }
.eeg-kat .kat-marke-icon { width: 9px; height: 9px; }
.eeg-kontakt { white-space: nowrap; }
.eeg-kontakt a { display: inline-grid; place-items: center; width: 24px; height: 22px; color: var(--text-3); }
.eeg-kontakt a:hover { color: var(--akzent); }
.eeg-liste { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.eeg-keine { color: var(--text-3); padding: 16px 10px !important; }
.eeg-tabelle tfoot td {
    position: sticky; bottom: 0; background: var(--grund); border-top: 1px solid var(--rand-stark); border-bottom: 0;
    font-weight: 600; font-size: 12px;
}
.eeg-fuss { display: flex; align-items: center; gap: 12px; padding: 5px 8px 5px 14px; border-top: 1px solid var(--rand); font-size: 12px; color: var(--text-2); }
.eeg-fuss > span:first-child { font-family: var(--mono); font-size: 11.5px; min-width: 110px; }
.eeg-fuss-hinweis { flex: 1; color: var(--text-3); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eeg-blaettern { display: flex; gap: 4px; }

@media (max-width: 960px) {
    .eeg-panel { left: 8px; right: 8px; bottom: 8px; height: 55%; }
    .eeg-reiter-zusatz, .eeg-fuss-hinweis { display: none; }
}

/* ---------------------------------------------------------------- Nutzungsprotokoll und Rückmeldung (C6b, ADR-008) */

.leiste-nutzung {
    display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 16px; border-top: 1px solid var(--rand);
    font-size: 11px; color: var(--text-3);
}
.leiste-nutzung-hinweis { flex: 1; min-width: 0; line-height: 1.3; cursor: help; }
.leiste-rueck-knopf {
    flex: none; display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; font-size: 12px; color: var(--text-2);
    background: var(--flaeche); border: 1px solid var(--rand-stark); cursor: pointer; white-space: nowrap;
}
.leiste-rueck-knopf:hover, .leiste-rueck-knopf.an { background: var(--akzent-hell); border-color: var(--akzent); color: var(--akzent); }
.leiste-rueck-knopf .icon-sm { width: 13px; height: 13px; }

.rueck-fenster {
    position: fixed; left: calc(var(--leiste-breite) + var(--abstand)); bottom: var(--abstand); z-index: 30;
    width: min(380px, calc(100vw - 2 * var(--abstand))); display: flex; flex-direction: column; gap: 6px; padding: 0 14px 12px;
    background: var(--flaeche); border: 1px solid var(--rand); box-shadow: var(--schatten-schwebend); animation: einblenden 200ms ease-out;
}
.rueck-kopf { display: flex; align-items: center; justify-content: space-between; margin: 0 -6px 4px 0; padding-top: 6px; font-weight: 650; font-size: 14px; }
.rueck-zu { border: 0; background: none; cursor: pointer; padding: 6px; color: var(--text-3); }
.rueck-zu:hover { color: var(--text); }
.rueck-label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.rueck-label span { font-weight: 400; color: var(--text-3); }
.rueck-text, .rueck-kontakt {
    width: 100%; box-sizing: border-box; padding: 6px 8px; font: inherit; font-size: 13px; border: 1px solid var(--rand-stark);
    background: var(--flaeche); color: var(--text); resize: vertical;
}
.rueck-text:focus, .rueck-kontakt:focus { outline: 2px solid color-mix(in srgb, var(--akzent) 35%, transparent); border-color: var(--akzent); }
.rueck-hinweis { margin: 0; font-size: 11.5px; color: var(--text-3); }
.rueck-fehler { margin: 0; font-size: 12.5px; color: var(--gefahr); }
.rueck-danke { display: flex; align-items: center; gap: 8px; padding: 10px 0; font-size: 14px; color: #166534; }
.rueck-aktionen { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

@media (max-width: 900px) {
    .rueck-fenster { left: var(--abstand); }
}
