/* SPDX-License-Identifier: AGPL-3.0-only
 * Copyright (C) 2026 Mitwirkende der PV-P2P-Plattform
 * Teil der PV-P2P-Plattform. Freie Software unter der GNU Affero General Public
 * License, Version 3. Ohne jede Gewährleistung; Details in LICENSE.
 *
 * Gestaltung nach docs/KONZEPT.md, Abschnitt 11, und dem Entwurf unter
 * docs/oberflaeche/. Farbe trägt Bedeutung, nicht Dekoration:
 * Türkis = geteilte Energie, Ocker = Erzeugung und Akku, Grau = Netz.
 */

@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/plus-jakarta-sans-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/plus-jakarta-sans-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/plus-jakarta-sans-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/plus-jakarta-sans-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/jetbrains-mono-latin-500-normal.woff2) format("woff2"); }

:root {
  --hintergrund: #F3F5F4;
  --flaeche: #FFFFFF;
  --rand: #DCE1DE;
  --rand-eingabe: #838E95;
  --rand-plus: #838E95;
  --text: #14212B;
  --text-2: #3B4A52;
  --gedaempft: #55636B;
  --akzent: #0F766E;
  --akzent-dunkel: #0B5953;
  --akzent-hell: #E6F1EF;
  --akzent-flaeche: #F0F7F6;
  --pv: #C98A2E;
  --pv-text: #8A5410;
  --pv-hell: #F6E8D2;
  --netz: #C3CBCF;
  --spur: #E3E7E9;
  --warn-hell: #FBF1E0;
  --warn-text: #7A4A0C;
  --warn-flaeche: #FDF9F0;
  --warn-rand: #E9CD96;
  --gefahr: #A8361F;
  --gefahr-hell: #FBEAE6;
  /* Verwaltung: kräftig und dunkel, klar anders als die Bewohnerseiten */
  --verwaltung: #1E3A5F;
  --verwaltung-dunkel: #152B47;
  --verwaltung-hell: #DCE6F2;
  --radius: 16px;
  --radius-klein: 12px;
  --radius-feld: 10px;
  --schrift: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --seitenrand: 32px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--hintergrund);
  color: var(--text);
  font-family: var(--schrift);
  font-size: 15px;
  line-height: 1.5;
}
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 16px; font-weight: 600; color: var(--text-2); }
h2.gross { font-size: 20px; font-weight: 700; color: var(--text); }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0; }
a { color: var(--akzent); }
a:hover { color: var(--akzent-dunkel); }
:focus-visible { outline: 3px solid var(--akzent); outline-offset: 2px; border-radius: 4px; }
.mono, .zahl { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.gedaempft { color: var(--gedaempft); }
.klein { font-size: 13px; }
.rechts { text-align: right; }
.mitte { text-align: center; }
.unsichtbar {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.zum-inhalt { position: absolute; left: -9999px; top: 0; }
.zum-inhalt:focus { left: 16px; top: 8px; z-index: 10; background: var(--flaeche); padding: 8px 12px; border-radius: 8px; }

/* --- Kopf ---------------------------------------------------------------- */
.kopf { background: var(--flaeche); border-bottom: 1px solid var(--rand); }
.kopf-innen {
  max-width: 1280px; margin: 0 auto; padding: 16px var(--seitenrand);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px;
}
.marke { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.marke:hover { color: var(--text); }
.marke-name { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.nav { display: flex; flex-wrap: wrap; gap: 4px; }
.nav a {
  display: inline-flex; align-items: center; min-height: 44px;
  padding: 10px 14px; border-radius: 10px; color: var(--text-2);
  font-weight: 500; font-size: 15px; text-decoration: none;
}
.nav a:hover { background: var(--hintergrund); color: var(--text); }
.nav a[aria-current="page"] { background: var(--akzent-hell); color: var(--akzent-dunkel); font-weight: 600; }
.kopf-rechts { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pille {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px;
  border: 1px solid var(--rand); border-radius: 999px; font-size: 14px; color: var(--text-2);
}
.punkt { width: 8px; height: 8px; border-radius: 50%; background: var(--netz); flex: 0 0 auto; }
.punkt.an { background: var(--akzent); }
.punkt.warn { background: var(--pv); }
.punkt.aus { background: var(--gefahr); }
.link-knopf {
  background: none; border: 0; padding: 10px 6px; min-height: 44px; font: inherit;
  color: var(--text-2); font-weight: 500; cursor: pointer;
}
.link-knopf:hover { color: var(--text); text-decoration: underline; }

/* --- Inhalt -------------------------------------------------------------- */
.inhalt {
  width: 100%; max-width: 1280px; margin: 0 auto; padding: var(--seitenrand);
  display: flex; flex-direction: column; gap: 24px; flex: 1 0 auto;
}
.inhalt.schmal { max-width: 760px; }
.seitenkopf { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; }
.seitenkopf .titel { display: flex; flex-direction: column; gap: 4px; }
.seitenkopf .titel-zeile { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.untertitel { font-size: 15px; color: var(--gedaempft); }
.brotkrumen { font-size: 15px; color: var(--gedaempft); display: flex; gap: 8px; flex-wrap: wrap; }
.brotkrumen a { text-decoration: none; }

.reihe { display: flex; flex-wrap: wrap; gap: 24px; }
.reihe.eng { gap: 16px; }
.spalte { display: flex; flex-direction: column; gap: 24px; }
.breit { flex: 2 1 560px; min-width: 0; }
.schmal-spalte { flex: 1 1 300px; min-width: 0; }

.karte {
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius);
  padding: 28px; display: flex; flex-direction: column; gap: 20px; min-width: 0;
}
.karte.kompakt { padding: 22px; gap: 14px; }
.karte.akzent { background: var(--akzent-hell); border-color: #CFE3DF; }
.karte.warn { background: var(--warn-flaeche); border-color: var(--warn-rand); }
.karte-kopf { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 12px; }

.kachel {
  flex: 1 1 160px; padding: 16px; background: var(--hintergrund); border-radius: var(--radius-klein);
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.kachel.akzent { background: var(--akzent-hell); color: var(--akzent-dunkel); }
.kachel.akzent .kachel-titel, .kachel.akzent .kachel-zusatz { color: var(--akzent-dunkel); }
.kachel-titel, .kachel-zusatz { font-size: 13px; color: var(--gedaempft); }
.kachel-wert { font-family: var(--mono); font-size: 22px; font-weight: 500; font-variant-numeric: tabular-nums; }

.kennzahl { flex: 1 1 220px; }
.kennzahl .kachel-wert { font-size: 28px; }

.gross-zahl {
  font-family: var(--mono); font-size: 48px; font-weight: 500; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.gross-zeile { display: flex; align-items: baseline; flex-wrap: wrap; gap: 12px; }
.gross-zusatz { font-size: 18px; color: var(--text-2); }

/* Balken als SVG (ohne Inline-Styles, wegen CSP) */
.balken { display: block; width: 100%; height: 12px; overflow: visible; }
.balken .spur { fill: var(--spur); }
.balken .fuellung { fill: var(--akzent); }
.balken.akku .spur { fill: var(--pv-hell); }
.balken.akku .fuellung { fill: var(--pv); }
.balken .marker { fill: var(--text); }
/* unbekannter Wert: gestrichelte Spur wie im Flussbild, keine Füllung (QM B-07) */
.balken.unbekannt .spur, .balken.akku.unbekannt .spur { fill: none; stroke: var(--gedaempft); stroke-width: 1; stroke-dasharray: 3 3; }
.balken.unbekannt .fuellung { display: none; }
.balken-legende { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--gedaempft); }

/* Werteliste in Karten */
.werte { display: flex; flex-direction: column; gap: 8px; font-size: 14px; margin: 0; }
.werte > div { display: flex; justify-content: space-between; gap: 12px; }
.werte dt { color: var(--gedaempft); }
.werte dd { margin: 0; font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
.werte dd.text { font-family: var(--schrift); }
.werte.gross { font-size: 15px; gap: 12px; }
.werte .trenner { border-top: 1px solid var(--rand); padding-top: 12px; }

/* --- Marken (Status) ----------------------------------------------------- */
.marke-status {
  display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 600; white-space: nowrap; background: var(--spur); color: var(--text-2);
}
.marke-status.ok { background: var(--akzent-hell); color: var(--akzent-dunkel); }
.marke-status.warn { background: var(--warn-hell); color: var(--warn-text); }
.marke-status.fehler { background: var(--gefahr-hell); color: var(--gefahr); }
.marke-status.erzeugung { background: var(--pv-hell); color: var(--pv-text); }

/* --- Diagramm ------------------------------------------------------------ */
.legende { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--text-2); }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.legende i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; background: var(--netz); }
.legende i.geteilt { background: var(--akzent); }
.legende i.erzeugung { background: var(--pv); }
.legende i.plan { background: transparent; border: 2px dashed var(--text-2); }
.diagramm-rahmen { overflow-x: auto; }
.diagramm { display: block; width: 100%; min-width: 560px; height: auto; }
.diagramm .geteilt { fill: var(--akzent); }
.diagramm .netz { fill: var(--netz); }
.diagramm .erzeugung { fill: var(--pv); }
.diagramm .vorlaeufig { opacity: 0.55; }
.diagramm .achse { fill: var(--gedaempft); font-family: var(--mono); font-size: 15px; }
.diagramm .linie { stroke: var(--rand); stroke-width: 1; }
.diagramm .plan { fill: none; stroke: var(--text-2); stroke-width: 1.5; stroke-dasharray: 3 3; }
.diagramm .jetzt { stroke: var(--text); stroke-width: 1; stroke-dasharray: 2 3; }
.leer { color: var(--gedaempft); font-size: 14px; padding: 24px 0; text-align: center; }

/* --- Tabellen ------------------------------------------------------------ */
.tabelle-rahmen { overflow-x: auto; position: relative; } /* hält auch unsichtbare Screenreader-Texte im Rahmen */
.tabelle { width: 100%; border-collapse: collapse; font-size: 15px; }
.tabelle th {
  text-align: left; padding: 10px 8px; font-weight: 600; border-bottom: 1px solid var(--rand); white-space: nowrap;
}
.tabelle td { padding: 12px 8px; border-bottom: 1px solid var(--rand); vertical-align: middle; }
.tabelle tr:last-child td { border-bottom: 0; }
.tabelle .zahl, .tabelle th.zahl { text-align: right; }
.tabelle th.zahl { font-family: var(--schrift); }
.tabelle td.aktion { text-align: right; white-space: nowrap; }
.tabelle td.aktion form { display: inline; }
.tabelle .fett { font-weight: 600; }

/* --- Formulare ----------------------------------------------------------- */
form { margin: 0; }
.formular { display: flex; flex-direction: column; gap: 18px; }
.felder { display: flex; flex-wrap: wrap; gap: 16px; }
.feld { display: flex; flex-direction: column; gap: 6px; flex: 1 1 240px; min-width: 0; }
.feld.voll { flex-basis: 100%; }
.feld.klein-feld { flex: 0 1 180px; }
.feld label, .feld .label, legend { font-size: 14px; font-weight: 600; color: var(--text-2); }
.feld .hilfe { font-size: 13px; color: var(--gedaempft); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="time"],
input[type="date"], input[type="month"], input[type="search"], input[type="url"], select, textarea {
  width: 100%; min-height: 46px; padding: 0 14px; border: 1px solid var(--rand-eingabe);
  border-radius: var(--radius-feld); font: inherit; font-size: 15px; color: var(--text); background: var(--flaeche);
}
textarea { padding: 12px 14px; min-height: 120px; resize: vertical; line-height: 1.5; }
select { padding: 0 12px; }
input.mono { font-family: var(--mono); }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--akzent-hell); border-color: var(--akzent); }
input[aria-invalid="true"] { border-color: var(--gefahr); }
input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; accent-color: var(--akzent); margin: 0; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.wahl-zeile {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px; background: var(--hintergrund); border-radius: var(--radius-klein);
}
.wahl-zeile label { display: flex; flex-direction: column; gap: 2px; font-weight: 600; font-size: 15px; color: var(--text); }
.wahl-zeile .hilfe { font-weight: 400; font-size: 13px; color: var(--gedaempft); }
.haken-zeile { display: flex; align-items: center; gap: 10px; min-height: 44px; }

/* Typwahl als Karten */
.typwahl { display: flex; flex-wrap: wrap; gap: 12px; }
.typ-option { flex: 1 1 200px; position: relative; }
.typ-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.typ-option label {
  display: flex; flex-direction: column; gap: 8px; min-height: 120px; height: 100%; padding: 16px;
  border: 2px solid var(--rand); border-radius: 14px; background: var(--flaeche); cursor: pointer;
}
.typ-option label strong { font-size: 15px; font-weight: 600; color: var(--text); }
.typ-option label span { font-size: 13px; line-height: 1.45; color: var(--text-2); font-weight: 400; }
.typ-option input:checked + label { border-color: var(--akzent); background: var(--akzent-flaeche); }
.typ-option input:focus-visible + label { outline: 3px solid var(--akzent); outline-offset: 2px; }

.knopfleiste { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; padding-top: 16px; border-top: 1px solid var(--rand); }
.knopfleiste.links { justify-content: flex-start; border-top: 0; padding-top: 0; }

/* --- Knöpfe -------------------------------------------------------------- */
.knopf, button.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px; border-radius: var(--radius-feld); border: 1px solid var(--akzent);
  background: var(--akzent); color: #fff; font: inherit; font-size: 15px; font-weight: 600;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.knopf:hover { background: var(--akzent-dunkel); border-color: var(--akzent-dunkel); color: #fff; }
.knopf.zweit { background: var(--flaeche); color: var(--text); border-color: var(--rand-eingabe); }
.knopf.zweit:hover { background: var(--hintergrund); color: var(--text); }
.knopf.rahmen { background: var(--flaeche); color: var(--akzent-dunkel); border-color: var(--akzent); min-height: 44px; font-size: 14px; padding: 0 16px; }
.knopf.rahmen:hover { background: var(--akzent-hell); }
.knopf.still { background: transparent; border-color: transparent; color: var(--text-2); }
.knopf.still:hover { background: var(--hintergrund); color: var(--text); }
.knopf.gefahr { background: var(--gefahr); border-color: var(--gefahr); color: #fff; }
.knopf.gefahr:hover { background: #8C2C18; }
.knopf.gefahr-rahmen { background: var(--flaeche); border-color: var(--gefahr); color: var(--gefahr); min-height: 44px; font-size: 14px; padding: 0 16px; }
.knopf.voll-breit { width: 100%; }
.knopf[disabled] { opacity: 0.5; cursor: not-allowed; }

/* --- Hinweise ------------------------------------------------------------ */
.meldung {
  padding: 14px 16px; border-radius: var(--radius-klein); font-size: 15px;
  background: var(--akzent-hell); color: var(--akzent-dunkel); border: 1px solid #CFE3DF;
}
.meldung.fehler { background: var(--gefahr-hell); color: var(--gefahr); border-color: #F1C7BE; }
.meldung.warn { background: var(--warn-hell); color: var(--warn-text); border-color: var(--warn-rand); }
.meldung.neutral { background: var(--hintergrund); color: var(--text-2); border-color: var(--rand); }
.infobox { padding: 16px; background: var(--hintergrund); border-radius: var(--radius-klein); font-size: 14px; color: var(--text-2); }
.code-anzeige {
  font-family: var(--mono); font-size: 36px; letter-spacing: 0.08em; font-weight: 500;
  padding: 16px 20px; background: var(--akzent-hell); color: var(--akzent-dunkel); border-radius: var(--radius-klein);
  text-align: center; word-break: break-all;
}
.geheim {
  font-family: var(--mono); font-size: 14px; padding: 10px 12px; background: var(--hintergrund);
  border: 1px solid var(--rand); border-radius: 8px; word-break: break-all; user-select: all;
}

/* --- Anmeldung ----------------------------------------------------------- */
.anmeldung {
  flex: 1 0 auto; display: flex; align-items: center; justify-content: center; padding: 48px var(--seitenrand);
}
.anmeldung-innen { width: 100%; max-width: 960px; display: flex; flex-wrap: wrap; align-items: center; gap: 48px 96px; }
.anmeldung-text { flex: 1 1 360px; display: flex; flex-direction: column; gap: 20px; }
.anmeldung-text h1 { font-size: 40px; line-height: 1.15; letter-spacing: -0.02em; }
.anmeldung-text p { font-size: 17px; color: var(--text-2); line-height: 1.6; }
.punkte { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; color: var(--text-2); }
.punkte li { display: flex; align-items: baseline; gap: 10px; }
.punkte li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--akzent); flex: 0 0 auto; transform: translateY(-2px); }
.anmeldung-karte { flex: 1 1 340px; max-width: 420px; padding: 36px; gap: 18px; }
.anmeldung-karte h2 { font-size: 22px; font-weight: 700; color: var(--text); }

/* --- Fuß ----------------------------------------------------------------- */
.fuss { background: var(--flaeche); border-top: 1px solid var(--rand); margin-top: 32px; }
.fuss-innen {
  max-width: 1280px; margin: 0 auto; padding: 20px var(--seitenrand);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; font-size: 14px; color: var(--gedaempft);
}
.fuss nav { display: flex; flex-wrap: wrap; gap: 20px; }
.fuss a { text-decoration: none; }

/* --- Regler-Kopf (lokale Seite, nur Vorschau) ------------------------------ */
.textblock { white-space: pre-wrap; line-height: 1.6; }

/* --- Schritte der Abrechnung ---------------------------------------------- */
.schritte { display: flex; flex-wrap: wrap; gap: 16px; list-style: none; margin: 0; padding: 0; }
.schritt {
  flex: 1 1 220px; background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 4px;
}
.schritt .nr { font-size: 13px; color: var(--gedaempft); }
.schritt .stand { font-weight: 600; color: var(--text); }
.schritt.fertig .stand { color: var(--akzent-dunkel); }
.schritt.offen .stand { color: var(--warn-text); }

.rechnungen { display: flex; flex-wrap: wrap; gap: 16px; }
.rechnung-karte { flex: 1 1 360px; padding: 20px; border-radius: var(--radius); border: 1px solid var(--rand); background: var(--flaeche); display: flex; flex-direction: column; gap: 12px; }
.rechnung-karte.offen { background: var(--warn-flaeche); border-color: var(--warn-rand); }
.ueberweisung { padding: 12px 14px; background: var(--flaeche); border-radius: 10px; font-size: 14px; color: var(--text-2); }

/* --- Zeitplan ------------------------------------------------------------ */
.wochentage { display: flex; flex-wrap: wrap; gap: 6px; }
.wochentage label {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px;
  border: 1px solid var(--rand-eingabe); border-radius: 10px; font-weight: 500; font-size: 14px; color: var(--text);
}

/* --- Handybreite --------------------------------------------------------- */
@media (max-width: 760px) {
  :root { --seitenrand: 16px; }
  h1 { font-size: 26px; }
  .karte { padding: 20px; }
  .gross-zahl { font-size: 40px; }
  .kopf-innen { gap: 8px 16px; }
  .anmeldung-text h1 { font-size: 30px; }
  .anmeldung-karte { padding: 24px; }
  .knopfleiste { justify-content: stretch; }
  .knopfleiste .knopf { flex: 1 1 auto; }
}

/* --- Ergänzungen ---------------------------------------------------------- */
.fehlertext { color: var(--gefahr); font-weight: 600; }
details { border: 1px solid var(--rand); border-radius: var(--radius-klein); padding: 0 16px; }
details[open] { padding-bottom: 16px; }
summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; color: var(--text-2); }
details .felder { margin-top: 8px; }
.geraet-zeile { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--rand); }
.geraet-zeile:last-child { border-bottom: 0; }
.geraet-zeile .info { display: flex; flex-direction: column; gap: 2px; }
.schritte-liste { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; color: var(--text-2); }
.zwei-spalten { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }

/* --- Kopfzeile: wer bin ich (Konzept 5.2) -------------------------------- */
.nav { align-items: center; gap: 4px 16px; }
.rolle { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 20px; white-space: nowrap; }
.rolle-erzeuger { background: var(--pv-hell); color: var(--pv-text); }
.rolle-verbraucher { background: var(--akzent-hell); color: var(--akzent-dunkel); }
.rolle-erzeuger_verbraucher { background: linear-gradient(90deg, var(--pv-hell) 0 50%, var(--akzent-hell) 50% 100%); color: var(--text); }
.rolle-admin { background: var(--verwaltung); color: #FFFFFF; }
.menue {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 240px;
  display: flex; flex-direction: column; padding: 8px; gap: 2px;
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius-klein);
  box-shadow: 0 12px 32px rgba(20, 33, 43, 0.12);
}
.menue a, .menue .link-knopf { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 8px 12px; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 500; text-align: left; width: 100%; }
.menue a:hover, .menue .link-knopf:hover { background: var(--hintergrund); text-decoration: none; }
.menue a[aria-current="true"] { background: var(--akzent-hell); color: var(--akzent-dunkel); }
.menue form { margin: 0; border-top: 1px solid var(--rand); padding-top: 4px; margin-top: 4px; }
.band-innen {
  max-width: 1280px; margin: 0 auto; padding: 8px var(--seitenrand); font-weight: 500;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
}
/* Not-Stopp (KONZEPT 5.5): roter Balken und großer roter Knopf */
.not-stopp-balken { background: var(--gefahr); color: #FFFFFF; font-size: 15px; }
.not-stopp-balken form { margin: 0; }
.knopf.balken-knopf { background: #FFFFFF; border-color: #FFFFFF; color: var(--gefahr); min-height: 40px; font-weight: 700; }
.knopf.balken-knopf:hover { background: var(--gefahr-hell); }
.not-stopp-knopf {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 72px;
  border: 0; border-radius: 14px; background: var(--gefahr); color: #FFFFFF; font-size: 20px; font-weight: 800;
  letter-spacing: 0.02em; cursor: pointer; box-shadow: 0 2px 0 #7A2614;
}
.not-stopp-knopf:hover { background: #8C2C18; }
.not-stopp-knopf:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }
.not-stopp-aktiv { border: 2px solid var(--gefahr); background: var(--gefahr-hell); color: var(--gefahr); border-radius: 14px; padding: 14px 16px; font-weight: 700; text-align: center; }
/* Grenzen der Anlage: Eingabe in der Zeile */
.grenze-formular { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; }
.grenze-formular input { width: 6.5em; min-height: 40px; }
.grenze-formular .knopf { min-height: 40px; }
/* Kopfzeile der Verwaltung */
.bereich-verwaltung .kopf { background: var(--verwaltung); border-bottom-color: var(--verwaltung); }
.bereich-verwaltung .marke, .bereich-verwaltung .marke:hover { color: #FFFFFF; }
.bereich-verwaltung .marke svg { stroke: #9FD8D1; }
/* nur die Kopfleiste: die Reiter der Gruppe stehen auf heller Seite und sehen
   aus wie im Bewohnerbereich (Befund vom 31.10.2026: heller Text auf hellem Grund) */
.bereich-verwaltung .kopf .nav a { color: #D5E0EC; }
.bereich-verwaltung .kopf .nav a:hover { background: rgba(255, 255, 255, 0.10); color: #FFFFFF; }
.bereich-verwaltung .kopf .nav a[aria-current="page"] { background: rgba(255, 255, 255, 0.18); color: #FFFFFF; }
.bereich-verwaltung .pille { border-color: rgba(255, 255, 255, 0.35); color: #E6EDF5; }
.bereich-verwaltung .rolle-admin { background: #FFFFFF; color: var(--verwaltung); }

/* --- Regler-Einsicht ------------------------------------------------------- */
.zeitwahl { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.zeitwahl .feld { min-width: 240px; }
.sprung { display: flex; flex-wrap: wrap; gap: 4px; }
/* Zeitleiste der Regler-Einsicht (5.7): Live, ◀ Viertelstunde ▶, Springen zu */
.zeitleiste { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding: 12px 16px; }
.zeitleiste-blaettern { display: flex; align-items: center; gap: 6px; }
.zeit-knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 44px; min-height: 44px;
  padding: 0 14px; border: 1px solid var(--rand-eingabe); border-radius: 10px; background: var(--flaeche);
  color: var(--text); font-weight: 600; text-decoration: none;
}
.zeit-knopf:hover { background: var(--akzent-hell); color: var(--akzent-dunkel); }
.zeit-knopf.live.aktiv { background: var(--akzent-hell); border-color: var(--akzent); color: var(--akzent-dunkel); }
.zeit-knopf.pfeil { padding: 0; font-size: 14px; }
.zeit-knopf.aus { opacity: 0.35; pointer-events: none; }
.zeitleiste-slot { display: flex; flex-direction: column; align-items: center; min-width: 8.5em; line-height: 1.25; }
.zeitleiste-slot strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.zeitleiste-sprung { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.zeitleiste-sprung input[type="date"] { width: 11.5em; }
.zeitleiste-sprung input[type="time"] { width: 9em; }
.zeitleiste-hinweis { flex-basis: 100%; margin: 0; }
@media (max-width: 640px) {
  .zeitleiste-blaettern { width: 100%; justify-content: space-between; }
  .zeitleiste-sprung { width: 100%; }
  .zeitleiste-sprung label { flex-basis: 100%; }
  .zeitleiste-sprung input[type="date"] { flex: 1 1 0; min-width: 0; width: auto; }
  .zeitleiste-sprung input[type="time"] { flex: 0 0 8.5em; }
  .zeitleiste-sprung .knopf { flex-basis: 100%; }
}
.diagramm.einsicht a .treffer { cursor: pointer; }
.diagramm.einsicht a:hover .treffer, .diagramm.einsicht a:focus .treffer { fill: var(--akzent-hell); fill-opacity: 0.6; }
.diagramm .linie.null { stroke: var(--text-gedaempft, #8A969C); }
.sprung a[aria-current="page"] { background: var(--akzent-hell); color: var(--akzent-dunkel); }
.diagramm.einsicht .treffer { fill: transparent; }
.diagramm.einsicht .treffer:hover { fill: rgba(20, 33, 43, 0.06); }
.farbmarke { flex: 0 0 auto; vertical-align: middle; margin-right: 6px; }
.legende span { display: inline-flex; align-items: center; }
.rechnung { margin: 0; display: grid; grid-template-columns: minmax(150px, max-content) 1fr; gap: 8px 20px; }
.rechnung > div { display: contents; }
.rechnung dt { color: var(--gedaempft); }
.rechnung dd { margin: 0; }
.erklaerung p { font-size: 17px; line-height: 1.6; margin: 0; }
.ereignisliste { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 760px) { .rechnung { grid-template-columns: 1fr; gap: 2px; } .rechnung dd { margin-bottom: 10px; } }

/* --- Zweiter Faktor --------------------------------------------------------- */
.qr-zeile { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; margin: 16px 0; }
.qr { border: 1px solid var(--rand); border-radius: var(--radius-klein); background: #FFFFFF; }
.schluessel { font-size: 17px; letter-spacing: 0.05em; word-break: break-all; margin: 4px 0; }
.ersatzcodes { list-style: none; padding: 0; margin: 12px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; font-size: 17px; }
.ersatzcodes li { padding: 8px 12px; border: 1px solid var(--rand); border-radius: 8px; background: var(--hintergrund); }

/* Stornieren in der Rechnungstabelle */
.tabelle td.aktion details.storno-aufklapp { display: inline-block; border: 0; padding: 0; vertical-align: middle; text-align: left; }
.storno-aufklapp > summary { min-height: 44px; padding: 0 12px; font-weight: 600; font-size: 14px; color: var(--text-2); border-radius: var(--radius-klein); }
.storno-aufklapp > summary:hover { background: var(--hintergrund); }
.tabelle td.aktion details.storno-aufklapp[open] { display: block; white-space: normal; }
.tabelle td.aktion form.storno-form, .storno-form { display: flex; flex-direction: column; gap: 8px; padding: 8px 0 12px; max-width: 360px; margin-left: auto; }
.storno-form label { font-size: 14px; font-weight: 600; color: var(--text-2); }
.knopfzeile { display: flex; flex-wrap: wrap; gap: 8px; }

/* --- Hinweise und erste Schritte (Konzept 11) ----------------------------- */
.hinweise { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.hinweis-zeile {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  padding: 12px 16px; background: var(--akzent-flaeche); border: 1px solid var(--akzent-hell); border-left: 4px solid var(--akzent);
  border-radius: var(--radius-klein);
}
.hinweis-zeile.wichtig { background: var(--warn-flaeche); border-color: var(--warn-rand); border-left-color: var(--pv); }
.hinweis-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 320px; }
.hinweis-text a { color: var(--text); }
.erste-schritte { margin-bottom: 20px; }
.erste-schritte-liste { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.erste-schritte-liste li { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--rand); }
.erste-schritte-liste li:last-child { border-bottom: 0; }
.erste-schritte-liste .haken { flex: 0 0 20px; padding-top: 2px; }
.erste-schritte-liste .schritt-text { display: flex; flex-direction: column; gap: 2px; }
.erste-schritte-liste li.fertig .schritt-text { color: var(--gedaempft); }
.erste-schritte-liste li.offen a { font-weight: 600; }
details.abschnitt-aufklapp { margin-top: 16px; }
/* lange Zählpunkte (33 Zeichen) brechen auf Handybreite um statt überzustehen */
.werte dd { overflow-wrap: anywhere; min-width: 0; }
/* Warnung in der Live-Karte, leer unsichtbar (STELLUNGNAHME E14) */
.warnzeile { margin: 8px 0 0; padding: 8px 12px; border-radius: var(--radius-klein); background: var(--warn-flaeche); border: 1px solid var(--warn-rand); color: var(--warn-text); font-size: 14px; font-weight: 600; }
.warnzeile:empty { display: none; }

/* --- Begrenzender Faktor (KONZEPT 9) --------------------------------------- */
.begrenzung { margin: 8px 0 0; display: flex; flex-direction: column; gap: 6px; }
.begrenzung-satz { margin: 0; padding: 8px 12px; border-radius: var(--radius-klein); background: var(--akzent-flaeche); border: 1px solid var(--akzent-hell); border-left: 4px solid var(--akzent); color: var(--text); font-size: 14px; font-weight: 600; }
.begrenzung-satz:empty { display: none; }
.begrenzung p.klein { margin: 0 0 0 16px; }
.begrenzung-liste { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }

/* --- Übersicht für Bewohner (Konzept B) ---------------------------------- */
.quelle-zeile { display: inline-flex; align-items: center; gap: 8px; }
.punkt.an { background: var(--akzent); }
.punkt.warn { background: var(--pv); }
.flussbild-rahmen { display: flex; justify-content: center; }
.flussbild { display: block; width: 100%; max-width: 520px; height: auto; }
.flussbild.klein { max-width: 560px; }
.flussbild .knoten circle { fill: var(--flaeche); stroke: var(--rand-plus); stroke-width: 2; }
.flussbild .knoten.pv circle { stroke: var(--pv); fill: var(--pv-hell); }
.flussbild .knoten.akku circle { stroke: var(--akzent-dunkel); fill: var(--akzent-flaeche); }
.flussbild .knoten.netz circle { stroke: var(--netz); fill: var(--spur); }
.flussbild .knoten.haus circle { stroke: var(--text-2); }
.flussbild .knoten.gruppe circle { stroke: var(--akzent); fill: var(--akzent-hell); }
.flussbild .knoten-titel { fill: var(--gedaempft); font-size: 13px; font-weight: 600; }
.flussbild .knoten-wert { fill: var(--text); font-family: var(--mono); font-size: 15px; }
.flussbild .nabe { fill: var(--rand-plus); }
.fluss { fill: none; stroke: var(--rand); stroke-width: 4; stroke-linecap: round; }
.fluss.unbekannt { stroke-dasharray: 2 6; }
.fluss.an { stroke-dasharray: 8 10; animation: fluss-lauf 1.4s linear infinite; }
.fluss.an.s2 { animation-duration: 0.9s; }
.fluss.an.s3 { animation-duration: 0.5s; }
.fluss.an.rueck { animation-direction: reverse; }
.fluss.pv.an { stroke: var(--pv); }
.fluss.akku.an { stroke: var(--akzent-dunkel); }
.fluss.netz.an { stroke: var(--text-2); }
.fluss.haus.an { stroke: var(--text); }
.fluss.gruppe.an { stroke: var(--akzent); }
@keyframes fluss-lauf { to { stroke-dashoffset: -18; } }
@media (prefers-reduced-motion: reduce) { .fluss.an { animation: none; stroke-dasharray: none; } }
.bilanz .kachel { flex: 1 1 180px; }
.diagramm.kurve polyline { fill: none; stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.diagramm.kurve .reihe-pv polyline { stroke: var(--pv); }
.diagramm.kurve .reihe-pv circle { fill: var(--pv); }
.diagramm.kurve .reihe-haus polyline { stroke: var(--text); }
.diagramm.kurve .reihe-haus circle { fill: var(--text); }
.diagramm.kurve .reihe-netz polyline { stroke: var(--gedaempft); }
.diagramm.kurve .reihe-netz circle { fill: var(--gedaempft); }
.diagramm.kurve .reihe-akku polyline { stroke: var(--akzent-dunkel); stroke-dasharray: 4 3; }
.diagramm.kurve .reihe-akku circle { fill: var(--akzent-dunkel); }
.diagramm.kurve .reihe-aus-ueberschuss polyline { stroke: var(--pv); }
.diagramm.kurve .reihe-aus-ueberschuss circle { fill: var(--pv); }
.diagramm.kurve .reihe-aus-akku polyline { stroke: var(--akzent-dunkel); stroke-dasharray: 4 3; }
.diagramm.kurve .reihe-aus-akku circle { fill: var(--akzent-dunkel); }
.legende i.kurve-aus-ueberschuss { background: var(--pv); height: 3px; }
.legende i.kurve-aus-akku { background: var(--akzent-dunkel); height: 3px; }
.diagramm.kurve .reihe-soc polyline { stroke: var(--akzent); }
.diagramm.kurve .reihe-soc circle { fill: var(--akzent); }
.legende i.kurve-pv { background: var(--pv); height: 3px; }
.legende i.kurve-haus { background: var(--text); height: 3px; }
.legende i.kurve-netz { background: var(--gedaempft); height: 3px; }
.legende i.kurve-akku { background: var(--akzent-dunkel); height: 3px; }
/* Übersicht = heute: Prognose gestrichelt, Bedarf der Gruppe nur gemessen (KONZEPT 5.5) */
.diagramm.kurve .reihe-pv-prognose polyline { stroke: var(--pv); stroke-dasharray: 6 4; stroke-width: 1.5; }
.diagramm.kurve .reihe-pv-prognose circle { fill: var(--pv); }
.diagramm.kurve .reihe-haus-prognose polyline { stroke: var(--text); stroke-dasharray: 6 4; stroke-width: 1.5; }
.diagramm.kurve .reihe-haus-prognose circle { fill: var(--text); }
.diagramm.kurve .reihe-gruppe polyline { stroke: var(--akzent); }
.diagramm.kurve .reihe-gruppe circle { fill: var(--akzent); }
.legende i.kurve-pv-prognose { background: repeating-linear-gradient(90deg, var(--pv) 0 6px, transparent 6px 10px); height: 3px; }
.legende i.kurve-haus-prognose { background: repeating-linear-gradient(90deg, var(--text) 0 6px, transparent 6px 10px); height: 3px; }
.legende i.kurve-gruppe { background: var(--akzent); height: 3px; }
.gross-satz { font-size: 18px; margin: 4px 0 8px; }
.diagramm a rect { cursor: pointer; }

/* Reiter einer Gruppe in der Verwaltung (KONZEPT 5.5, Fassung 18.10.2026) */
.nav.reiter { border-bottom: 1px solid var(--rand); padding-bottom: 8px; margin: -8px 0 20px; gap: 4px; }
.abschnitt-titel { margin: 32px 0 12px; font-size: 20px; }

/* Vergleich mit dem Netzbetreiber (KONZEPT 5.5, Fassung 18.10.2026) */
.tabelle.vergleich tr.markiert th, .tabelle.vergleich .abweichung { color: var(--warn-text); font-weight: 600; }
.tabelle.vergleich tr.markiert { background: var(--warn-hell); }
.diagramm.kurve .reihe-vgl-bezug-nb polyline { stroke: var(--gedaempft); }
.diagramm.kurve .reihe-vgl-bezug-pf polyline { stroke: var(--gedaempft); stroke-dasharray: 4 3; }
.diagramm.kurve .reihe-vgl-einspeisung-nb polyline { stroke: var(--akzent); }
.diagramm.kurve .reihe-vgl-einspeisung-pf polyline { stroke: var(--akzent); stroke-dasharray: 4 3; }
.diagramm.kurve .reihe-vgl-bezug-nb circle, .diagramm.kurve .reihe-vgl-bezug-pf circle { fill: var(--gedaempft); }
.diagramm.kurve .reihe-vgl-einspeisung-nb circle, .diagramm.kurve .reihe-vgl-einspeisung-pf circle { fill: var(--akzent); }
.legende i.kurve-vgl-bezug-nb { background: var(--gedaempft); height: 3px; }
.legende i.kurve-vgl-bezug-pf { background: repeating-linear-gradient(90deg, var(--gedaempft) 0 4px, transparent 4px 7px); height: 3px; }
.legende i.kurve-vgl-einspeisung-nb { background: var(--akzent); height: 3px; }
.legende i.kurve-vgl-einspeisung-pf { background: repeating-linear-gradient(90deg, var(--akzent) 0 4px, transparent 4px 7px); height: 3px; }
/* Warnbalken nur bei den Betroffenen (KONZEPT 5.5, Grundsatz 5) */
.warn-balken { background: var(--warn-hell); color: var(--warn-text); border-bottom: 1px solid var(--warn-rand); font-size: 15px; }
.knopf.balken-knopf-warn { min-height: 36px; border-color: var(--warn-text); color: var(--warn-text); background: transparent; }

/* Prognose und Budget, Entwickleransicht (KONZEPT 5.5, 9; 19.10.2026) */
.diagramm.kurve .reihe-prog-erwartet polyline { stroke: var(--akzent); stroke-dasharray: 5 3; }
.diagramm.kurve .reihe-prog-gemessen polyline { stroke: var(--text); }
.diagramm.kurve .reihe-prog-erwartet circle { fill: var(--akzent); }
.diagramm.kurve .reihe-prog-gemessen circle { fill: var(--text); }
.diagramm.kurve [class^="reihe-prog-schatten"] polyline { stroke-width: 1; opacity: .7; }
.diagramm.kurve .reihe-prog-schatten-1 polyline { stroke: var(--pv); }
.diagramm.kurve .reihe-prog-schatten-2 polyline { stroke: var(--netz); }
.diagramm.kurve .reihe-prog-schatten-3 polyline { stroke: var(--akzent-dunkel); }
.diagramm.kurve .reihe-prog-schatten-4 polyline { stroke: var(--gedaempft); }
.legende i.kurve-prog-erwartet { background: repeating-linear-gradient(90deg, var(--akzent) 0 5px, transparent 5px 8px); height: 3px; }
.legende i.kurve-prog-gemessen { background: var(--text); height: 3px; }
.legende i.kurve-prog-schatten-1 { background: var(--pv); height: 2px; }
.legende i.kurve-prog-schatten-2 { background: var(--netz); height: 2px; }
.legende i.kurve-prog-schatten-3 { background: var(--akzent-dunkel); height: 2px; }
.legende i.kurve-prog-schatten-4 { background: var(--gedaempft); height: 2px; }
.tabelle.schritte th { font-weight: 400; }
.tabelle.schritte tr.fett th, .tabelle.schritte tr.fett td { font-weight: 700; }
.prognose-zahlen { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .75rem; }
input.voll { width: 100%; min-width: 16rem; }

/* --- Verwaltung, Fassung vom 1. November 2026 (KONZEPT 5.5) -------------------- */
/* Zu tun: nur, was der Admin tun muss, je mit Knopf */
.zu-tun { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.zu-tun-zeile {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  padding: 12px 16px; background: var(--akzent-flaeche); border: 1px solid var(--akzent-hell); border-left: 4px solid var(--akzent);
  border-radius: var(--radius-klein);
}
.zu-tun-zeile.wichtig { background: var(--warn-flaeche); border-color: var(--warn-rand); border-left-color: var(--pv); }
.zu-tun-zeile .knopfzeile { display: flex; flex-wrap: wrap; gap: 8px; }
.zu-tun-zeile form { display: inline; }
/* Ampelfarben: grün läuft, gelb Hinweis, rot Störung, grau Schatten oder aus */
.einheiten-zeilen .pille { white-space: nowrap; }
/* Schritte der Abrechnung als Links mit sichtbarem Stand */
.schritte-reiter { margin-bottom: 20px; }
.schritte-reiter .schritt { padding: 0; }
.schritte-reiter .schritt a { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; min-height: 44px; color: var(--text); text-decoration: none; border-radius: var(--radius); }
.schritte-reiter .schritt a:hover { background: var(--hintergrund); }
.schritte-reiter .schritt.gewaehlt { border: 2px solid var(--akzent); }
/* Auf dem Handy werden die Zeilen zu Karten */
@media (max-width: 760px) {
  .einheiten-zeilen thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .einheiten-zeilen, .einheiten-zeilen tbody, .einheiten-zeilen tr, .einheiten-zeilen th, .einheiten-zeilen td { display: block; width: 100%; }
  .einheiten-zeilen tr { border: 1px solid var(--rand); border-radius: var(--radius-klein); padding: 8px 12px; margin-bottom: 12px; }
  .einheiten-zeilen td, .einheiten-zeilen th { border-bottom: 0; padding: 4px 0; text-align: left; }
  .einheiten-zeilen td.zahl { text-align: left; }
  .einheiten-zeilen td[data-titel]::before { content: attr(data-titel) ": "; color: var(--gedaempft); font-family: var(--schrift); }
}


/* --- Kopfzeile, Fassung vom 7. November 2026 (KONZEPT 5.2) ---------------------------- */
/* eine Leiste, immer eine Zeile: Logo · Ortswahl · Navigation · Status · Personenmenü */
.kopf-innen { flex-wrap: nowrap; justify-content: flex-start; gap: 12px 20px; padding-top: 12px; padding-bottom: 12px; }
/* Platz geht zuerst vom Instanznamen (mit „…“) und von der Ortswahl, nie von der
   Navigation: sonst ragen ihre Punkte rechts aus der Leiste (Befund vom 7.11.2026) */
/* Reihenfolge beim Schrumpfen: erst der Instanzname, dann die Status-Pille, zuletzt die Ortswahl */
.marke { flex: 0 1000 auto; min-width: 32px; }
.marke svg { flex: 0 0 auto; }
.marke-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kopf .nav { flex: 1 0 auto; justify-content: center; flex-wrap: nowrap; }
.kopf .nav a { gap: 8px; white-space: nowrap; }
.kopf .nav .symbol { display: none; }
.kopf .nav a.entwickler { outline: 1px dashed var(--akzent-dunkel); outline-offset: -4px; }
.kopf-rechts { flex: 0 100 auto; min-width: 44px; margin-left: auto; flex-wrap: nowrap; gap: 10px; }
.kopf-rechts .person { flex: 0 0 auto; }
.kopf a:focus-visible, .kopf summary:focus-visible, .kopf button:focus-visible { outline: 3px solid var(--akzent); outline-offset: 2px; }
/* Ortswahl */
/* Die Ortswahl schrumpft nicht mit (sonst kürzt schon ein halbes Pixel „W1“ zu „W…“);
   sie hat eine feste Höchstbreite, ein langer Name endet mit „…“ */
.ortswahl { position: relative; border: 0; padding: 0; flex: 0 0 auto; min-width: 0; max-width: 14em; }
.ortswahl[open] { padding: 0; }
.ortswahl > summary, .ortswahl.einfach {
  list-style: none; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 12px;
  border: 1px solid var(--rand); border-radius: 12px; color: var(--text); font-weight: 600; font-size: 15px;
  background: var(--flaeche); max-width: 100%; min-width: 0;
}
.ortswahl.einfach { border-color: transparent; background: transparent; max-width: 14em; }
.ortswahl > summary::-webkit-details-marker { display: none; }
.ortswahl > summary::after { content: ""; flex: 0 0 auto; width: 8px; height: 8px; border-right: 2px solid var(--gedaempft); border-bottom: 2px solid var(--gedaempft); transform: rotate(45deg) translateY(-2px); margin-left: 2px; }
.ortswahl[open] > summary { border-color: var(--akzent); }
.ort-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ortswahl .rolle { flex: 0 0 auto; }
.ort-menue { left: 0; right: auto; min-width: 300px; }
.ort-menue a > span:first-child { display: flex; flex-direction: column; }
.ort-zusatz { font-weight: 400; }
/* Status-Pille nur bei einem Problem, als Link */
a.pille { text-decoration: none; min-height: 44px; white-space: nowrap; max-width: 18em; min-width: 44px; flex: 0 1 auto; }
a.pille .pille-text { overflow: hidden; text-overflow: ellipsis; }
a.pille.status-warn { background: var(--warn-hell); border-color: var(--warn-rand); color: var(--warn-text); }
a.pille.status-aus { background: var(--gefahr-hell); border-color: var(--gefahr); color: var(--gefahr); }
/* Personenmenü: Kreis mit Initialen */
.person { position: relative; border: 0; padding: 0; }
.person[open] { padding: 0; }
.person > summary { list-style: none; min-height: 44px; padding: 0; }
.person > summary::-webkit-details-marker { display: none; }
.initialen {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%;
  background: var(--akzent-hell); color: var(--akzent-dunkel); font-weight: 700; font-size: 15px; letter-spacing: 0.02em;
}
.initialen .symbol { width: 22px; height: 22px; }
.person[open] .initialen { box-shadow: 0 0 0 2px var(--akzent); }
.person-kopf { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px 10px; border-bottom: 1px solid var(--rand); margin-bottom: 4px; overflow-wrap: anywhere; }
.person-menue form { border-top: 0; margin-top: 0; padding-top: 0; }
.person-menue form:last-child { border-top: 1px solid var(--rand); padding-top: 4px; margin-top: 4px; }
/* Verwaltung: dunkle Leiste */
.bereich-verwaltung .ortswahl > summary { background: transparent; border-color: rgba(255, 255, 255, 0.35); color: #FFFFFF; }
.bereich-verwaltung .ortswahl > summary::after { border-color: #D5E0EC; }
.bereich-verwaltung .ortswahl.einfach { color: #FFFFFF; }
.bereich-verwaltung .initialen { background: rgba(255, 255, 255, 0.16); color: #FFFFFF; }
.bereich-verwaltung .person[open] .initialen { box-shadow: 0 0 0 2px #FFFFFF; }
.bereich-verwaltung .menue .rolle-admin { background: var(--verwaltung); color: #FFFFFF; }
.bereich-verwaltung .kopf a.entwickler { outline-color: #D5E0EC; }
/* ohne Instanzname bis 1024 px */
@media (max-width: 1024px) {
  .marke-name { display: none; }
  .kopf-innen { gap: 10px 12px; }
  .kopf .nav { gap: 0; }
  .kopf .nav a { padding: 10px 7px; font-size: 14px; }
  .ortswahl, .ortswahl.einfach { max-width: 9em; }
}
@media (min-width: 761px) and (max-width: 1024px) {
  .kopf-innen { padding-left: 20px; padding-right: 20px; }
}
/* Handy bis 760 px: oben Logo, Ortswahl, Status, Personenmenü; Navigation als feste Leiste unten */
@media (max-width: 760px) {
  .kopf-innen { gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  .ortswahl > summary, .ortswahl.einfach { padding: 6px 10px; font-size: 14px; }
  .ortswahl, .ortswahl.einfach { flex: 1 1 auto; max-width: none; }
  .ortswahl > summary { max-width: 100%; }
  .ort-menue { position: fixed; left: 16px; right: 16px; top: auto; min-width: 0; }
  a.pille { max-width: 8.5em; padding: 8px 10px; font-size: 13px; }
  .person-menue { position: fixed; left: 16px; right: 16px; top: auto; min-width: 0; }
  .kopf .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; order: 0; width: auto; overflow: visible;
    display: flex; justify-content: space-around; align-items: stretch; gap: 0;
    background: var(--flaeche); border-top: 1px solid var(--rand);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(20, 33, 43, 0.06);
  }
  .kopf .nav a {
    flex: 1 1 0; flex-direction: column; justify-content: center; gap: 2px; min-height: 56px; min-width: 0;
    padding: 6px 2px; font-size: 12px; border-radius: 10px;
  }
  .kopf .nav .symbol { display: block; }
  .kopf .nav .nav-text { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .bereich-verwaltung .kopf .nav { background: var(--verwaltung); border-top-color: var(--verwaltung-dunkel); }
  body.mit-navleiste { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
}


/* --- Verlauf: Zeitraum oben (KONZEPT 5.5, Fassung vom 7. November 2026) ------------------ */
.zeitraum { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 0 0 24px; }
.segment {
  display: inline-flex; border: 1px solid var(--rand-eingabe); border-radius: 12px; overflow: hidden;
  background: var(--flaeche);
}
.segment a {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 5.5em;
  padding: 8px 16px; color: var(--text-2); font-weight: 600; text-decoration: none;
}
.segment a + a { border-left: 1px solid var(--rand-eingabe); }
.segment a:hover { background: var(--hintergrund); color: var(--text); }
.segment a[aria-current="page"] { background: var(--akzent); color: #FFFFFF; }
.segment a:focus-visible { outline: 3px solid var(--akzent); outline-offset: -3px; }
.datumsleiste { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; max-width: 640px; }
.pfeil {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  border-radius: 50%; border: 1px solid var(--rand-eingabe); background: var(--flaeche); color: var(--text);
}
a.pfeil:hover { background: var(--akzent-hell); color: var(--akzent-dunkel); }
a.pfeil:focus-visible { outline: 3px solid var(--akzent); outline-offset: 2px; }
.pfeil.aus { color: var(--rand-plus); border-color: var(--rand); background: transparent; cursor: default; }
.datumswahl { position: relative; flex: 1 1 auto; border: 0; padding: 0; text-align: center; min-width: 0; }
.datumswahl[open] { padding: 0; }
.datumswahl > summary {
  list-style: none; justify-content: center; min-height: 44px; padding: 4px 12px; border-radius: 10px;
  color: var(--text); font-size: 22px; font-weight: 700; letter-spacing: -0.01em;
}
.datumswahl > summary::-webkit-details-marker { display: none; }
.datumswahl > summary:hover { background: var(--hintergrund); }
.datumswahl > summary:focus-visible { outline: 3px solid var(--akzent); outline-offset: 2px; }
.zeitraum-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-bottom: 1px dashed var(--rand-plus); }
.datumswahl-form {
  position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-50%); z-index: 20;
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 16px; min-width: 260px;
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius-klein);
  box-shadow: 0 12px 32px rgba(20, 33, 43, 0.12); text-align: left;
}
.datumswahl-form .feld { margin: 0; }
@media (max-width: 760px) {
  .zeitraum { align-items: stretch; }
  .segment { display: flex; }
  .segment a { flex: 1 1 0; min-width: 0; padding: 8px 4px; }
  .datumswahl > summary { font-size: 18px; }
  .datumswahl { position: static; }
  .datumswahl-form { left: 0; right: 0; transform: none; min-width: 0; }
}


/* --- Technische Details (KONZEPT 5.5, Fassung vom 7. November 2026) ------------------------ */
.technik-marke {
  display: inline-flex; align-items: center; padding: 1px 8px; margin-left: 8px; vertical-align: middle;
  border: 1px dashed var(--rand-plus); border-radius: 999px; color: var(--gedaempft);
  font-size: 12px; font-weight: 600; letter-spacing: 0.01em; white-space: nowrap;
}
.kachel .technik-marke { margin: 0 0 4px; align-self: flex-start; }
[data-technik] { position: relative; }
