/* =====================================================================
   stil.css – das Aussehen der ganzen Website
   ---------------------------------------------------------------------
   Aufbau dieser Datei (von allgemein nach speziell):
     1. Schrift und Farben (Variablen)
     2. Grundlagen (Seite, Text, Links)
     3. Kopf und Fuss
     4. Bausteine (Karten, Knöpfe, Formularfelder, Meldungen)
     5. Rechner (zwei Spalten, Ergebnis-Dashboard)
     6. Quellen-Popover und anklickbare Zahlen
     7. Methodenseite (Formeln, Legenden, Ausführlich-Blöcke)
     8. Weitere Seiten (Anmeldung, Rechtliches, Impressum)
     9. Handy (schmale Bildschirme)
    10. Drucken

   Gestaltungsregeln (aus dem Prompt vom 24.11.2026):
   - nur heller Modus, viel Weissraum, keine Farbverläufe, keine
     schweren Schatten, keine Neon-Effekte
   - Amber = Solarstrom/Ertrag, Smaragdgrün = Geld/CO2
   - alle Zahlen mit «tabular-nums»: jede Ziffer ist gleich breit,
     damit beim Neurechnen nichts hin- und herspringt
   ===================================================================== */


/* ---------------------------------------------------------------------
   1. SCHRIFT UND FARBEN
   ---------------------------------------------------------------------
   @font-face lädt die Schrift Inter aus dem eigenen Ordner schrift/.
   So wird keine Anfrage an Google oder einen anderen Dienst geschickt
   (Datenschutz). Lizenz: SIL Open Font License, siehe schrift/.
   --------------------------------------------------------------------- */
@font-face { font-family: "Inter"; font-weight: 400; font-style: normal; font-display: swap; src: url("../schrift/inter-regular.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 400; font-style: italic; font-display: swap; src: url("../schrift/inter-italic.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-style: normal; font-display: swap; src: url("../schrift/inter-medium.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-style: normal; font-display: swap; src: url("../schrift/inter-semibold.woff2") format("woff2"); }

/* Variablen: Jede Farbe steht nur hier. Im Rest der Datei steht
   immer var(--name). Will man eine Farbe ändern, ändert man sie hier. */
:root {
  --hintergrund: #F8FAFC;      /* Seitenhintergrund */
  --flaeche: #FFFFFF;          /* Karten und Kästen */
  --flaeche-2: #F1F5F9;        /* leicht abgesetzte Flächen */
  --rand: #E2E8F0;             /* feine Rahmen */
  --rand-stark: #CBD5E1;
  --text: #0F172A;             /* Haupttext und Zahlen */
  --text-2: #64748B;           /* Nebentext */
  --text-3: #94A3B8;           /* sehr leiser Text */

  --amber: #F59E0B;            /* Akzent Solar/Ertrag */
  --amber-dunkel: #B45309;     /* Amber als Textfarbe (gut lesbar auf Weiss) */
  --amber-hell: #FFFBEB;
  --amber-rand: #FDE68A;

  --gruen: #059669;            /* Akzent Finanzen/Ökologie */
  --gruen-dunkel: #047857;
  --gruen-hell: #ECFDF5;
  --gruen-rand: #A7F3D0;

  --rot: #DC2626;
  --rot-hell: #FEF2F2;
  --rot-rand: #FECACA;

  --blau: #2563EB;             /* nur für Links und Fokus */
  --blau-hell: #EFF6FF;

  --radius: 12px;              /* Rundung der Karten */
  --radius-klein: 8px;         /* Rundung von Feldern und Knöpfen */
  --schatten: 0 1px 2px rgba(15, 23, 42, 0.04);   /* nur ein Hauch */
  --breite: 1200px;            /* maximale Breite des Inhalts */
  --kopf-hoehe: 64px;

  --schrift: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --schrift-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}


/* ---------------------------------------------------------------------
   2. GRUNDLAGEN
   --------------------------------------------------------------------- */

/* box-sizing: border-box heisst: Rand und Innenabstand zählen zur Breite.
   So ist ein Feld mit width: 100% wirklich 100 % breit. */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--kopf-hoehe) + 16px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--hintergrund);
  color: var(--text);
  font-family: var(--schrift);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* cv11 = einstöckiges a, ss01 = offene Ziffern: macht Inter ruhiger */
  font-feature-settings: "cv11", "ss01";
}

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5em; font-weight: 600; letter-spacing: -0.015em; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem); letter-spacing: -0.025em; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.0625rem; }
h4 { font-size: 1rem; }
p { margin: 0 0 1em; }
small, .klein { font-size: 0.8125rem; }

a { color: var(--blau); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

/* Sichtbarer Fokus für die Tastatur (Barrierefreiheit) */
:focus-visible { outline: 2px solid var(--blau); outline-offset: 2px; border-radius: 4px; }

/* Zahlen: gleich breite Ziffern */
.zahl, .kpi-wert, td.wert, .tabelle td, input[type="number"], output { font-variant-numeric: tabular-nums; }

/* Nur für Screenreader sichtbar (z. B. Beschriftungen von Symbolen) */
.nur-vorlesen {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

[hidden] { display: none !important; }

/* Inhalt in der Mitte, mit Rand links und rechts */
.seite {
  max-width: var(--breite);
  margin: 0 auto;
  padding: 0 24px;
}


/* ---------------------------------------------------------------------
   3. KOPF UND FUSS
   --------------------------------------------------------------------- */
.kopf {
  position: sticky; top: 0; z-index: 50;
  background: rgba(248, 250, 252, 0.92);
  backdrop-filter: saturate(180%) blur(8px);   /* leicht durchscheinend beim Scrollen */
  border-bottom: 1px solid var(--rand);
}
.kopf-innen {
  max-width: var(--breite); margin: 0 auto; padding: 0 24px;
  height: var(--kopf-hoehe);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.marke {
  display: flex; align-items: center; gap: 10px;
  color: var(--text); text-decoration: none; font-weight: 600; letter-spacing: -0.01em;
}
.marke-zeichen { width: 28px; height: 28px; flex: none; }
.marke-text small { display: block; font-weight: 400; color: var(--text-2); font-size: 0.75rem; letter-spacing: 0; line-height: 1.2; }

.navi { display: flex; gap: 4px; }
.navi a {
  color: var(--text-2); text-decoration: none; font-size: 0.9375rem; font-weight: 500;
  padding: 8px 12px; border-radius: var(--radius-klein);
}
.navi a:hover { color: var(--text); background: var(--flaeche-2); }
.navi a[aria-current="page"] { color: var(--text); background: var(--flaeche); box-shadow: inset 0 0 0 1px var(--rand); }

.fuss {
  margin-top: 96px;
  border-top: 1px solid var(--rand);
  background: var(--flaeche);
  color: var(--text-2);
  font-size: 0.875rem;
}
.fuss-innen {
  max-width: var(--breite); margin: 0 auto; padding: 40px 24px;
  display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px;
}
.fuss h2 { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text); margin-bottom: 12px; }
.fuss ul { list-style: none; padding: 0; margin: 0; }
.fuss li { margin-bottom: 6px; }
.fuss a { color: var(--text-2); }
.fuss a:hover { color: var(--text); }
.fuss-hinweis { max-width: 46ch; }


/* ---------------------------------------------------------------------
   4. BAUSTEINE
   --------------------------------------------------------------------- */

/* Einleitung oben auf jeder Seite */
.einleitung { padding: 48px 0 32px; max-width: 760px; }
.einleitung p { color: var(--text-2); font-size: 1.0625rem; }
.oberzeile {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.8125rem; font-weight: 500; color: var(--amber-dunkel);
  background: var(--amber-hell); border: 1px solid var(--amber-rand);
  padding: 3px 10px; border-radius: 999px; margin-bottom: 16px;
}

/* Karte: weisser Kasten mit feinem Rahmen */
.karte {
  background: var(--flaeche);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 24px;
}
.karte + .karte { margin-top: 16px; }
.karte-kopf { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.karte-kopf h2 { font-size: 1.0625rem; margin: 2px 0 2px; }
.karte-kopf p { margin: 0; color: var(--text-2); font-size: 0.875rem; }
.nummer {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 0.8125rem; font-weight: 600;
  background: var(--flaeche-2); color: var(--text); border: 1px solid var(--rand);
}
.karte.erledigt .nummer { background: var(--text); color: #fff; border-color: var(--text); }

/* Knöpfe */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 0.9375rem; font-weight: 500;
  padding: 10px 16px; border-radius: var(--radius-klein);
  border: 1px solid var(--rand-stark); background: var(--flaeche); color: var(--text);
  cursor: pointer; text-decoration: none; line-height: 1.2;
}
.knopf:hover { background: var(--flaeche-2); }
.knopf:disabled { opacity: 0.55; cursor: progress; }
.knopf-haupt { background: var(--text); border-color: var(--text); color: #fff; }
.knopf-haupt:hover { background: #1E293B; }
.knopf-klein { font-size: 0.8125rem; padding: 6px 10px; }
.knopf-text { border: 0; background: none; padding: 4px 0; color: var(--blau); }
.knopf-text:hover { background: none; text-decoration: underline; }
.knopf-reihe { display: flex; flex-wrap: wrap; gap: 8px; }

/* Formularfelder */
.feld { margin-bottom: 18px; }
.feld:last-child { margin-bottom: 0; }
.feld > label, .feld > .label, fieldset > legend {
  display: block; font-weight: 500; font-size: 0.9375rem; margin-bottom: 6px; padding: 0;
}
.pflicht { color: var(--amber-dunkel); font-weight: 500; font-size: 0.8125rem; margin-left: 4px; }
/* «Dringend empfohlen»: stärker als «Pflicht»-Markierung, als kleines Abzeichen */
.dringend {
  display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px;
  background: var(--amber); color: #0F172A; font-size: 0.75rem; font-weight: 600; vertical-align: 1px;
}
.hilfe { color: var(--text-2); font-size: 0.8125rem; margin: 6px 0 0; line-height: 1.5; }
fieldset { border: 0; margin: 0 0 18px; padding: 0; min-width: 0; }

input[type="text"], input[type="search"], input[type="number"], select {
  width: 100%;
  font: inherit; font-size: 1rem; color: var(--text);
  background: var(--flaeche);
  border: 1px solid var(--rand-stark); border-radius: var(--radius-klein);
  padding: 10px 12px; min-height: 44px;   /* 44 px: gut mit dem Finger zu treffen */
}
input:hover, select:hover { border-color: var(--text-3); }
input:focus, select:focus { outline: none; border-color: var(--blau); box-shadow: 0 0 0 3px var(--blau-hell); }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--rot); }
input::placeholder { color: var(--text-3); }

/* Feld mit Einheit rechts (z. B. «kWh/Jahr») */
.mit-einheit { position: relative; }
.mit-einheit input { padding-right: 84px; }
.einheit {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-2); font-size: 0.875rem; pointer-events: none;
}

.zwei-spalten { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Segment-Auswahl: Radio-Knöpfe, die wie eine Knopfleiste aussehen */
.segment { display: flex; flex-wrap: wrap; gap: 6px; }
.segment label { position: relative; cursor: pointer; }
.segment input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segment span {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: var(--radius-klein);
  border: 1px solid var(--rand-stark); background: var(--flaeche);
  font-size: 0.9375rem; font-weight: 500; min-height: 40px;
}
.segment label:hover span { background: var(--flaeche-2); }
.segment input:checked + span { background: var(--text); border-color: var(--text); color: #fff; }
.segment input:focus-visible + span { outline: 2px solid var(--blau); outline-offset: 2px; }

/* Neigungs-Auswahl: Kärtchen mit kleiner Zeichnung */
.neigungen { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.neigungen span { flex-direction: column; gap: 2px; padding: 8px 4px; width: 100%; justify-content: center; text-align: center; }
.neigungen svg { width: 32px; height: 32px; }
.neigungen svg .modul { stroke: currentColor; }
.neigungen small { font-weight: 400; font-size: 0.6875rem; opacity: 0.8; line-height: 1.2; }

/* Schieberegler */
.regler-zeile { display: flex; align-items: center; gap: 12px; }
.regler-zeile input[type="range"] { flex: 1; }
.regler-zeile .mit-einheit { width: 140px; flex: none; }
.regler-zeile .mit-einheit input { padding-right: 48px; }
input[type="range"] { accent-color: var(--text); height: 28px; }

/* Aufklappbarer Bereich «Erweitert» */
details.erweitert { border-top: 1px solid var(--rand); margin-top: 20px; padding-top: 14px; }
details.erweitert > summary {
  cursor: pointer; font-weight: 500; font-size: 0.9375rem; color: var(--text-2);
  list-style: none; display: flex; align-items: center; gap: 8px;
}
details.erweitert > summary::-webkit-details-marker { display: none; }
details.erweitert > summary::before {
  content: ""; width: 8px; height: 8px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg); transition: transform 0.15s;
}
details.erweitert[open] > summary::before { transform: rotate(45deg); }
details.erweitert[open] > summary { margin-bottom: 16px; color: var(--text); }

/* Meldungen */
.meldung {
  border-radius: var(--radius-klein); padding: 10px 14px; font-size: 0.875rem; margin: 10px 0 0;
  border: 1px solid var(--rand); background: var(--flaeche-2);
}
.meldung-fehler { background: var(--rot-hell); border-color: var(--rot-rand); color: #991B1B; }
.meldung-warnung { background: var(--amber-hell); border-color: var(--amber-rand); color: #92400E; }
.meldung-ok { background: var(--gruen-hell); border-color: var(--gruen-rand); color: var(--gruen-dunkel); }
.fehler { color: var(--rot); font-size: 0.8125rem; margin: 6px 0 0; }

/* Tabellen */
.tabelle { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.tabelle th, .tabelle td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rand); vertical-align: top; }
.tabelle thead th { font-weight: 600; color: var(--text-2); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
.tabelle td.wert, .tabelle th.wert { text-align: right; white-space: nowrap; }
.tabelle-rahmen { overflow-x: auto; border: 1px solid var(--rand); border-radius: var(--radius-klein); }
.tabelle-rahmen .tabelle tr:last-child td { border-bottom: 0; }


/* ---------------------------------------------------------------------
   5. RECHNER
   ---------------------------------------------------------------------
   Grosse Bildschirme: zwei Spalten. Links die Eingaben, rechts das
   Ergebnis, das beim Scrollen stehen bleibt (position: sticky).
   --------------------------------------------------------------------- */
.rechner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 440px;
  gap: 32px;
  align-items: start;
}
.ergebnis-spalte {
  position: sticky;
  top: calc(var(--kopf-hoehe) + 24px);
  max-height: calc(100vh - var(--kopf-hoehe) - 48px);
  overflow-y: auto;          /* zu langes Ergebnis kann in sich gescrollt werden */
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

/* Adresssuche */
.suche-zeile { display: flex; gap: 8px; }
.suche-zeile input { flex: 1; }
.vorschlaege {
  list-style: none; margin: 4px 0 0; padding: 4px;
  border: 1px solid var(--rand); border-radius: var(--radius-klein); background: var(--flaeche);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  position: absolute; left: 0; right: 0; z-index: 20;
}
.vorschlaege li { padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 0.9375rem; }
.vorschlaege li[aria-selected="true"], .vorschlaege li:hover { background: var(--flaeche-2); }
.suchfeld-rahmen { position: relative; flex: 1; }
.beispiel { font-size: 0.8125rem; color: var(--text-2); margin-top: 8px; }

.gefunden {
  display: flex; align-items: center; gap: 10px; margin-top: 14px;
  padding: 10px 12px; background: var(--flaeche-2); border-radius: var(--radius-klein); font-size: 0.875rem;
}
.gefunden svg { flex: none; color: var(--gruen); }

/* Luftbild mit Fassaden (js/karte.js): Bild unten, durchsichtiges SVG
   genau darüber (position: absolute; inset: 0 = alle vier Ränder 0) */
.luftbild {
  position: relative; margin-top: 16px; border-radius: var(--radius-klein); overflow: hidden;
  border: 1px solid var(--rand); background: var(--flaeche-2);
}
.luftbild img.karte-bild { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; }
.luftbild .karte-svg { position: absolute; left: 0; top: 0; width: 100%; aspect-ratio: 1 / 1; }
.luftbild.karte-ohne-bild img.karte-bild { visibility: hidden; }
.karte-fassade { cursor: pointer; outline: none; }
.karte-klickflaeche { stroke: transparent; stroke-width: 34; fill: none; stroke-linecap: round; }
.karte-schatten { stroke: rgba(15, 23, 42, 0.75); stroke-width: 13; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.karte-strich { stroke-width: 7; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.karte-fassade:hover .karte-schatten, .karte-fassade:focus-visible .karte-schatten { stroke: #fff; }
.karte-fassade.gewaehlt .karte-schatten { stroke: #fff; stroke-width: 17; }
.karte-fassade.gewaehlt .karte-strich { stroke-width: 9; }
.karte-nord path { fill: #fff; stroke: rgba(15, 23, 42, 0.6); stroke-width: 1.5; }
.karte-nord text { fill: #fff; font-size: 20px; font-weight: 600; font-family: var(--schrift); paint-order: stroke; stroke: rgba(15, 23, 42, 0.6); stroke-width: 3px; }
.karte-fuss {
  position: relative; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px; font-size: 0.75rem; color: var(--text-2); background: var(--flaeche); border-top: 1px solid var(--rand);
}
.karte-legende { display: flex; gap: 10px; flex-wrap: wrap; }
.karte-legende span { display: inline-flex; align-items: center; gap: 4px; }
.karte-legende i { width: 12px; height: 4px; border-radius: 2px; display: inline-block; }
.karte-auswahl { font-size: 0.875rem; margin: 10px 0 0; font-weight: 500; }
details.fassaden-box { margin-top: 12px; }
details.fassaden-box > summary { cursor: pointer; font-size: 0.875rem; color: var(--text-2); font-weight: 500; }

/* Fassadenliste */
.fassaden { display: grid; gap: 8px; margin-top: 12px; }
.fassade {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--rand-stark); border-radius: var(--radius-klein);
  cursor: pointer; background: var(--flaeche);
}
.fassade:hover { background: var(--flaeche-2); }
.fassade:has(input:checked) { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.fassade input { accent-color: var(--text); width: 18px; height: 18px; margin: 0; }
.fassade-titel { font-weight: 500; display: block; }
.fassade-details { color: var(--text-2); font-size: 0.8125rem; }
.fassade-wert { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 0.9375rem; white-space: nowrap; }
.fassade-wert small { display: block; font-weight: 400; color: var(--text-2); font-size: 0.6875rem; }
.fassade-balken { grid-column: 2 / 4; height: 4px; background: var(--flaeche-2); border-radius: 2px; overflow: hidden; }
.fassade-balken span { display: block; height: 100%; background: var(--amber); }
.kompass { width: 36px; height: 36px; flex: none; }

.ort-info { margin-top: 14px; font-size: 0.875rem; color: var(--text-2); display: flex; flex-wrap: wrap; gap: 6px 16px; }
.ort-info strong { color: var(--text); font-weight: 500; }

/* Voreinstellungen (Presets) */
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.preset {
  font: inherit; font-size: 0.8125rem; font-weight: 500;
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--rand-stark); background: var(--flaeche); color: var(--text);
}
.preset:hover { background: var(--flaeche-2); }
.preset[aria-pressed="true"] { background: var(--amber-hell); border-color: var(--amber); color: var(--amber-dunkel); }

/* --- Ergebnis-Dashboard --- */
.dashboard { padding: 20px; }
.dashboard-kopf { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.dashboard-kopf h2 { font-size: 1rem; margin: 0; }
.dashboard-kopf span { font-size: 0.75rem; color: var(--text-2); }
.berechnet-fuer { font-size: 0.8125rem; color: var(--text-2); margin: 0 0 14px; }

.leer {
  text-align: center; padding: 28px 12px; color: var(--text-2); font-size: 0.9375rem;
}
.leer svg { color: var(--amber); margin-bottom: 8px; }
.leer ol { text-align: left; display: inline-block; margin: 12px 0 0; padding-left: 20px; font-size: 0.875rem; }
.leer li.fertig { color: var(--gruen-dunkel); }
.leer li.fertig::marker { content: "✓  "; }

/* Ampel */
.ampel {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radius-klein); margin-bottom: 14px;
  border: 1px solid var(--rand); font-size: 0.875rem;
}
.ampel p { margin: 0; }
.ampel-punkt { width: 12px; height: 12px; border-radius: 50%; flex: none; margin-top: 4px; }
.ampel-gruen { background: var(--gruen-hell); border-color: var(--gruen-rand); }
.ampel-gruen .ampel-punkt { background: var(--gruen); }
.ampel-gelb { background: var(--amber-hell); border-color: var(--amber-rand); }
.ampel-gelb .ampel-punkt { background: var(--amber); }
.ampel-rot { background: var(--rot-hell); border-color: var(--rot-rand); }
.ampel-rot .ampel-punkt { background: var(--rot); }

/* Bento-Raster mit vier Kennzahlen */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 16px; }
.kpi {
  border: 1px solid var(--rand); border-radius: var(--radius-klein); padding: 12px 14px;
  background: var(--flaeche); position: relative; overflow: hidden; min-width: 0;
}
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--rand-stark); }
.kpi-solar::before { background: var(--amber); }
.kpi-geld::before, .kpi-co2::before { background: var(--gruen); }
.kpi dt { font-size: 0.75rem; color: var(--text-2); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi dd { margin: 4px 0 0; }
.kpi-wert { font-size: 1.625rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; display: block; }
.kpi-einheit { font-size: 0.75rem; color: var(--text-2); }
.kpi svg { width: 14px; height: 14px; }
.kpi-solar svg { color: var(--amber); }
.kpi-geld svg, .kpi-co2 svg { color: var(--gruen); }

/* Säulendiagramm Monate (nur HTML/CSS, keine Bibliothek) */
.diagramm { margin: 0 0 16px; }
.diagramm h3, .dashboard h3 { font-size: 0.8125rem; font-weight: 600; margin: 0 0 10px; }
.monate { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; align-items: end; padding-top: 18px; }
.monat { display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; outline: none; }
.monat-saeule { flex: none; width: 100%; background: var(--amber); border-radius: 3px 3px 0 0; position: relative; min-height: 2px; opacity: 0.9; }
.monat:hover .monat-saeule, .monat:focus .monat-saeule { opacity: 1; background: var(--amber-dunkel); }
.monat-wert {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 2px;
  font-size: 0.625rem; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap;
  opacity: 0; transition: opacity 0.1s;
}
.monat:hover .monat-wert, .monat:focus .monat-wert { opacity: 1; color: var(--text); font-weight: 600; }
.monat-name { font-size: 0.6875rem; color: var(--text-2); margin-top: 4px; }
.diagramm-text { font-size: 0.75rem; color: var(--text-2); margin: 8px 0 0; }

/* Alltagsvergleiche */
.vergleiche { list-style: none; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.vergleiche li { background: var(--flaeche-2); border-radius: var(--radius-klein); padding: 10px; font-size: 0.75rem; color: var(--text-2); line-height: 1.35; }
.vergleiche strong { display: block; font-size: 1rem; color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; }

.hinweise { padding-left: 18px; margin: 0 0 16px; font-size: 0.8125rem; color: var(--text-2); }
.hinweise li { margin-bottom: 4px; }

/* Rechenweg mit eingesetzten Zahlen */
details.rechenweg { border: 1px solid var(--rand); border-radius: var(--radius-klein); margin-bottom: 16px; }
details.rechenweg > summary { cursor: pointer; padding: 10px 14px; font-weight: 500; font-size: 0.875rem; }
details.rechenweg[open] > summary { border-bottom: 1px solid var(--rand); }
.rechenweg ol { list-style: none; padding: 4px 14px 10px; margin: 0; counter-reset: schritt; }
.rechenweg li { padding: 10px 0; border-bottom: 1px dashed var(--rand); }
.rechenweg li:last-child { border-bottom: 0; }
.rechenweg h4 { font-size: 0.8125rem; margin: 0 0 4px; display: flex; justify-content: space-between; gap: 8px; }
.rechenweg h4 a { font-weight: 400; font-size: 0.75rem; white-space: nowrap; }
.rechenweg .formel { font-size: 0.8125rem; margin: 2px 0; font-variant-numeric: tabular-nums; overflow-x: auto; }
.rechenweg .formel math { font-size: 1.05em; }

.weiter { border-top: 1px solid var(--rand); padding-top: 16px; }
.weiter p { font-size: 0.8125rem; color: var(--text-2); }
.disclaimer { font-size: 0.75rem; color: var(--text-2); margin: 14px 0 0; }

/* Handy: Ergebnisleiste unten */
.mini-ergebnis { display: none; }


/* ---------------------------------------------------------------------
   6. QUELLEN-POPOVER UND ANKLICKBARE ZAHLEN
   ---------------------------------------------------------------------
   .q       = eine Zahl oder ein Wort im Text, das zur Quelle führt
   .q-chip  = kleines Kästchen «BFE ↗» neben einem Vorgabewert
   .gls     = Fachbegriff mit Erklärung (Glossar)
   --------------------------------------------------------------------- */
.q {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer;
  text-decoration: underline; text-decoration-style: dotted; text-decoration-color: var(--amber);
  text-decoration-thickness: 2px; text-underline-offset: 3px;
  font-variant-numeric: tabular-nums;
}
.q:hover { text-decoration-style: solid; color: var(--amber-dunkel); }
.q-zitat { color: var(--text-2); font-size: 0.875em; white-space: nowrap; }
.q-zitat .q { text-decoration-color: var(--rand-stark); }
.q-zitat .q:hover { color: var(--text); text-decoration-color: var(--text-2); }

.q-chip {
  display: inline-flex; align-items: center; gap: 3px;
  font: inherit; font-size: 0.6875rem; font-weight: 500; line-height: 1;
  padding: 3px 6px; border-radius: 4px; cursor: pointer; vertical-align: 1px;
  background: var(--flaeche); color: #475569; border: 1px solid var(--rand-stark);
  white-space: nowrap;
}
.q-chip:hover { color: var(--text); border-color: var(--rand-stark); }
.q-chip::after { content: "↗"; font-size: 0.75em; }

.gls {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: help;
  border-bottom: 1px dotted var(--text-3);
}
.gls:hover { border-bottom-color: var(--text); }

.popover {
  position: absolute; z-index: 100;
  width: min(360px, calc(100vw - 24px));
  background: var(--flaeche); color: var(--text);
  border: 1px solid var(--rand-stark); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
  padding: 14px 16px; font-size: 0.875rem; line-height: 1.5;
}
.popover-art { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); font-weight: 600; margin: 0 0 6px; }
.popover-wert { font-size: 1.125rem; font-weight: 600; font-variant-numeric: tabular-nums; margin: 0 0 4px; }
.popover-titel { font-weight: 500; margin: 0 0 4px; }
.popover-meta { color: var(--text-2); font-size: 0.8125rem; margin: 0 0 10px; }
.popover-links { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.8125rem; border-top: 1px solid var(--rand); padding-top: 10px; margin: 0; }
.popover-zu { position: absolute; top: 8px; right: 8px; border: 0; background: none; cursor: pointer; color: var(--text-2); font-size: 1.125rem; line-height: 1; padding: 4px 6px; border-radius: 4px; }
.popover-zu:hover { background: var(--flaeche-2); color: var(--text); }


/* ---------------------------------------------------------------------
   7. METHODENSEITE
   --------------------------------------------------------------------- */
.methode {
  display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 48px; align-items: start;
}
.inhalt-navi { position: sticky; top: calc(var(--kopf-hoehe) + 24px); font-size: 0.8125rem; max-height: calc(100vh - var(--kopf-hoehe) - 48px); overflow-y: auto; }
.inhalt-navi h2 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); }
.inhalt-navi ol { list-style: none; padding: 0; margin: 0; }
.inhalt-navi ol ol { padding-left: 12px; }
.inhalt-navi a { display: block; padding: 4px 8px; color: var(--text-2); text-decoration: none; border-left: 2px solid transparent; }
.inhalt-navi a:hover { color: var(--text); }
.inhalt-navi a.aktiv { color: var(--text); border-left-color: var(--amber); font-weight: 500; }

.text { max-width: 760px; }
.text h2 { font-size: 1.5rem; margin-top: 56px; padding-top: 8px; }
.text h3 { font-size: 1.1875rem; margin-top: 40px; }
.text h4 { font-size: 1rem; margin-top: 28px; }
.text h2:first-child, .text h3:first-child { margin-top: 0; }
.text .abschnitt-nr { color: var(--text-3); font-weight: 500; margin-right: 8px; font-variant-numeric: tabular-nums; }
.text p, .text li { font-size: 1.0313rem; line-height: 1.7; }
.text .absatz-titel { font-weight: 600; }

/* Umschalter Kurz / Ausführlich */
.ansicht {
  display: inline-flex; padding: 3px; border-radius: 10px; background: var(--flaeche-2); border: 1px solid var(--rand);
  position: sticky; top: calc(var(--kopf-hoehe) + 12px); z-index: 10; margin-bottom: 8px;
}
.ansicht button {
  font: inherit; font-size: 0.875rem; font-weight: 500; border: 0; background: none; cursor: pointer;
  padding: 7px 14px; border-radius: 7px; color: var(--text-2);
}
.ansicht button[aria-pressed="true"] { background: var(--flaeche); color: var(--text); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 0 0 1px var(--rand); }

/* Formelblock mit Nummer rechts */
.formel-block {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px;
  margin: 20px 0 8px; padding: 16px 20px;
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius-klein);
  overflow-x: auto;
}
.formel-block math { font-size: 1.15rem; }
.formel-nr { color: var(--text-2); font-variant-numeric: tabular-nums; font-size: 0.875rem; }
math { font-family: "Latin Modern Math", "STIX Two Math", "Cambria Math", math; }

/* Legende unter einer Formel */
.legende { width: 100%; border-collapse: collapse; margin: 0 0 20px; font-size: 0.875rem; }
.legende td { padding: 6px 10px; border-bottom: 1px solid var(--rand); vertical-align: top; line-height: 1.5; }
.legende td:first-child { white-space: nowrap; width: 1%; font-size: 1rem; }
.legende td:nth-child(2) { white-space: nowrap; width: 1%; color: var(--text-2); }
.legende tr:last-child td { border-bottom: 0; }

/* Ausführlich-Block: Inhalt aus dem Anhang */
details.mehr {
  margin: 14px 0 20px; border: 1px solid var(--amber-rand); border-radius: var(--radius-klein);
  background: var(--amber-hell);
}
details.mehr > summary {
  cursor: pointer; padding: 10px 14px; font-size: 0.875rem; font-weight: 500; color: var(--amber-dunkel);
  list-style: none; display: flex; align-items: center; gap: 8px;
}
details.mehr > summary::-webkit-details-marker { display: none; }
details.mehr > summary::before { content: "+"; font-weight: 600; width: 1em; text-align: center; }
details.mehr[open] > summary::before { content: "−"; }
details.mehr > .mehr-inhalt { padding: 4px 18px 16px; background: var(--flaeche); border-top: 1px solid var(--amber-rand); border-radius: 0 0 var(--radius-klein) var(--radius-klein); }
details.mehr .mehr-inhalt h4 { margin-top: 16px; }

.abbildung { margin: 24px 0; }
.abbildung figcaption { font-size: 0.8125rem; color: var(--text-2); margin-top: 8px; }

/* Quellenverzeichnis */
.quellen-liste { list-style: none; padding: 0; margin: 0; counter-reset: q; }
.quellen-liste li { padding: 14px 0; border-bottom: 1px solid var(--rand); font-size: 0.875rem; scroll-margin-top: calc(var(--kopf-hoehe) + 24px); }
.quellen-liste li:target { background: var(--amber-hell); box-shadow: -12px 0 0 var(--amber-hell), 12px 0 0 var(--amber-hell); }
.quellen-liste .q-titel { font-weight: 500; }
.quellen-liste .q-verwendet { color: var(--text-2); font-size: 0.8125rem; margin-top: 4px; }
.stufe { display: inline-block; font-size: 0.6875rem; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: var(--flaeche-2); color: var(--text-2); margin-right: 6px; }


/* ---------------------------------------------------------------------
   8. WEITERE SEITEN
   --------------------------------------------------------------------- */
.schmal { max-width: 760px; }
.raster-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.checkliste { list-style: none; padding: 0; margin: 0; }
.checkliste li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--rand); }
.checkliste li:last-child { border-bottom: 0; }
.checkliste .haken { flex: none; width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--rand-stark); display: grid; place-items: center; font-size: 0.75rem; font-weight: 600; color: var(--text-2); }
.nb-ergebnis { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--rand); outline: none; }
.nb-ergebnis h3, .nb-name { font-size: 1.25rem; margin: 0 0 2px; }
.nb-ort { color: var(--text-2); font-size: 0.875rem; }
.nb-schritt { background: var(--flaeche-2); border-radius: var(--radius-klein); padding: 14px 16px; margin: 12px 0; font-size: 0.9375rem; }
.nb-schritt p { margin: 6px 0 0; }
.nb-knopf { margin: 16px 0; }
.kontakt { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 16px 0; font-size: 0.875rem; }
.kontakt div.breit { grid-column: 1 / -1; }
.kontakt dt { color: var(--text-2); font-size: 0.75rem; font-weight: 500; }
.kontakt dd { margin: 2px 0 0; word-break: break-word; }
.quelle { font-size: 0.75rem; color: var(--text-2); }
.meldung-info { background: var(--blau-hell); border-color: #BFDBFE; color: #1E3A8A; }
.recht-block > h2 { margin-bottom: 4px; }
.recht-block details.erweitert:first-of-type { border-top: 0; margin-top: 4px; }
.recht-block details.erweitert > p { margin: 0 0 8px; }
.checkliste li > div { font-size: 0.875rem; line-height: 1.55; }
.stichdatum { font-size: 0.8125rem; color: var(--text-2); }
.recht-block { margin-bottom: 16px; }
.recht-block h2 { font-size: 1.125rem; }
.recht-block ul { padding-left: 20px; }


/* ---------------------------------------------------------------------
   9. HANDY (schmale Bildschirme)
   ---------------------------------------------------------------------
   @media gilt nur, wenn die Bedingung stimmt, hier: Bildschirm
   schmaler als 960 px. Dann wird aus zwei Spalten eine.
   --------------------------------------------------------------------- */
@media (max-width: 960px) {
  .rechner { grid-template-columns: 1fr; }
  .ergebnis-spalte { position: static; max-height: none; overflow: visible; }
  .methode { grid-template-columns: 1fr; }
  .inhalt-navi { position: static; max-height: none; }
  .inhalt-navi { display: none; }
  .fuss-innen { grid-template-columns: 1fr; }

  /* kompakte Ergebnisleiste unten, solange das Ergebnis nicht sichtbar ist */
  .mini-ergebnis {
    position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 40;
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    background: var(--text); color: #fff; border-radius: var(--radius);
    padding: 10px 14px; text-decoration: none; font-size: 0.8125rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
  }
  .mini-ergebnis[hidden] { display: none !important; }
  main { padding-bottom: 88px; }   /* Platz für die Leiste, damit sie nichts verdeckt */
  .mini-ergebnis strong { font-size: 1rem; font-variant-numeric: tabular-nums; display: block; }
  .mini-ergebnis span { color: #CBD5E1; }
}
@media (max-width: 640px) {
  .seite, .kopf-innen { padding: 0 16px; }
  .navi { display: none; }
  .navi-handy { display: block; }
  .karte { padding: 18px; }
  .zwei-spalten, .raster-2 { grid-template-columns: 1fr; }
  .neigungen { grid-template-columns: repeat(3, 1fr); }
  .vergleiche { grid-template-columns: 1fr 1fr 1fr; }
  .kpi-wert { font-size: 1.375rem; }
  .regler-zeile { flex-wrap: wrap; }
  .regler-zeile .mit-einheit { width: 100%; }
  .formel-block { padding: 12px; }
  .formel-block math { font-size: 1rem; }
}

/* Menü auf dem Handy: einfaches <details>, braucht kein JavaScript */
.navi-handy { display: none; position: relative; }
.navi-handy summary { list-style: none; cursor: pointer; padding: 8px 12px; border: 1px solid var(--rand-stark); border-radius: var(--radius-klein); font-size: 0.875rem; font-weight: 500; background: var(--flaeche); }
.navi-handy summary::-webkit-details-marker { display: none; }
.navi-handy nav { position: absolute; right: 0; top: calc(100% + 6px); background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); padding: 6px; min-width: 220px; box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12); }
.navi-handy a { display: block; padding: 10px 12px; color: var(--text); text-decoration: none; border-radius: 6px; }
.navi-handy a:hover, .navi-handy a[aria-current="page"] { background: var(--flaeche-2); }
@media (max-width: 640px) { .navi-handy { display: block; } }


/* ---------------------------------------------------------------------
   10. DRUCKEN
   --------------------------------------------------------------------- */
@media print {
  body { background: #fff; font-size: 11pt; }
  .kopf, .fuss, .eingabe-spalte, .mini-ergebnis, .ansicht, .inhalt-navi, .knopf-reihe, .popover, .presets { display: none !important; }
  .rechner, .methode { display: block; }
  .ergebnis-spalte { position: static; max-height: none; overflow: visible; }
  .karte { border: 0; box-shadow: none; padding: 0; }
  details.rechenweg, details.mehr { border: 0; }
  a { color: inherit; }
}
#uebernommen { margin: 0 0 16px; }

/* Kasten «Was der Bund verlangt» auf der Anmeldeseite */
.bund-kasten { display: block; margin-bottom: 16px; }
.bund-kasten p { margin: 0; }
.bund-kasten .kasten-titel { margin-bottom: 6px; font-weight: 600; }
/* Anmeldeseite: Checkliste nicht mitscrollen, sondern ganz zeigen */
.ergebnis-spalte.statisch { position: static; max-height: none; overflow: visible; }
/* Anmeldeseite: Zwischentitel der Phasen (vor dem Kauf, beim Kauf …) */
.phase { margin: 18px 0 0; font-size: 0.8125rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-2); }
.netzbetreiber-fragen { display: block; margin: 16px 0 8px; }
