/* ==========================================================================
   css/basis.css – Grundlage des neuen Seitenrahmens (Etappe 1 ab 23.11.2026, Schritt 0 ab 03.12.2026)
   Eingebunden von includes/layout/kopf.php. Alte Seiten nutzen css/style.css.

   Rahmen: Kopf 56 px (Handy) bzw. 64 px (ab 721 px) + Kontextleiste 32 px (nur Seiten mit Daten; ohne: html.ohne-kontext), gemeinsam
   oben klebend (.kopf-bereich), deckend. Inhalt von Kopf/Kontextleiste auf Inhaltsbreite (--inhalt-max).
   Sticky-Leisten einer Seite kleben bei top: var(--kopf-gesamt-h) – feste Höhe, kein JS-Messen.

   Umbruchpunkte (nur Breite, nie Höhe):
     Mobil   ≤ 720 px   Kopf nur Logo/Titel/Hell-Dunkel, Leiste unten 64 px, „Mehr“ als Sheet, eine Spalte
     Tablet  721–1099   Menü im Kopf (kompakt) + Aufklapp-Menü „Mehr“, keine Leiste unten, Raster 12 Spalten
     Desktop ≥ 1100 px  wie Tablet, Raster 12 Spalten
   Dark ist Standard, Light über html.light (wie header.php / style.css).
   Variablennamen der alten style.css (--bg-page, --blue …) bleiben gleich, damit
   Seiten-CSS beim Umzug weiter funktioniert; neue Namen ergänzen.
   ========================================================================== */

:root {
    color-scheme: dark;

    /* Rahmen-Variablen (Kopf, Kontextleiste, „Mehr“, Leiste unten, Sprung-Link): eigene Namen, weil alte
       Seiten im neuen Rahmen css/style.css NACH basis.css laden und style.css gleichnamige allgemeine
       Variablen (--fs-*, --radius-*, --text-muted …) mit anderen Werten setzt. Der Rahmen sieht so auf
       allen Seiten gleich aus. Die allgemeinen Namen unten verweisen auf diese Werte (keine Doppelwerte). */
    --rahmen-seite:      #0a0e1a;
    --rahmen-abdunkeln:  rgba(0, 0, 0, 0.55);
    --rahmen-text:       #e2e8f0;
    --rahmen-text-2:     #94a3b8;
    --rahmen-text-3:     #8193ab;   /* ≥ 4,5:1 auf --karte-bg */
    --rahmen-blau:       #3b82f6;
    --rahmen-blau-hell:  #60a5fa;
    --rahmen-blau-a10:   rgba(59, 130, 246, 0.10);
    --rahmen-gruen:      #4ade80;
    --rahmen-schrift:    'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
    --rahmen-fs-xs:      0.72rem;
    --rahmen-fs-sm:      0.82rem;
    --rahmen-fs-base:    0.95rem;
    --rahmen-fs-lg:      1.25rem;
    --rahmen-radius-sm:  6px;
    --rahmen-radius-md:  10px;
    --rahmen-radius-lg:  16px;

    /* Flächen */
    --bg-page:        var(--rahmen-seite);
    --bg-card-solid:  #0e1726;
    --karte-bg:       #111a2c;
    --karte-bg-innen: #0d1525;   /* Unterkacheln in einer Karte */
    --karte-rand:     rgba(148, 163, 184, 0.14);
    --bg-card:        var(--karte-bg);   /* Alias wie style.css, für umziehendes Seiten-CSS */
    --kopf-bg:        #0d1322;   /* deckend, kein Glas */
    --kontext-bg:     #0b1120;
    --kopf-rand:      rgba(148, 163, 184, 0.12);
    --bg-overlay:     var(--rahmen-abdunkeln);

    /* Text */
    --text-primary:   var(--rahmen-text);
    --text-secondary: var(--rahmen-text-2);
    --text-muted:     var(--rahmen-text-3);

    /* Blau (Akzent) */
    --blue:           var(--rahmen-blau);
    --blue-light:     var(--rahmen-blau-hell);
    --blue-accent:    #93c5fd;
    --blue-a10:       var(--rahmen-blau-a10);
    --blue-a25:       rgba(59, 130, 246, 0.25);
    --blue-a40:       rgba(59, 130, 246, 0.40);
    --kontext-seite:  #60a5fa;   /* Seitenname in der Kontextleiste */
    --aktiv-bg:       #16233d;   /* aktiver Menüpunkt */

    /* Signalfarben */
    --green:          var(--rahmen-gruen);
    --green-dark:     #22c55e;
    --red:            #ef4444;
    --red-light:      #f87171;
    --yellow:         #fbbf24;
    --warm-bg:        rgba(239, 68, 68, 0.16);   /* Chip Max */
    --kalt-bg:        rgba(59, 130, 246, 0.20);  /* Chip Min */
    --orange:         #f97316;   /* Datenfarbe (z. B. Max-Zeile im Tagesverlauf) */
    --fluss-cron:     #2dd4bf;   /* Datenfluss-Schema (admin_datenfluss.php): Weg automatisch (teal) */
    --fluss-hand:     #fbbf24;   /* … Weg von Hand (amber) */

    /* Ebenen, Linien, Schatten – Namen und Werte wie css/style.css (alte Seiten laden style.css danach,
       dort gelten dieselben Werte; Ausnahme --bg-tooltip: style.css 0.95) */
    --bg-tooltip:     rgba(15, 23, 42, 0.97);
    --overlay-heavy:  rgba(0, 0, 0, 0.7);
    --glass-light:    rgba(255, 255, 255, 0.06);
    --glass-medium:   rgba(255, 255, 255, 0.08);
    --grid-line:        rgba(255, 255, 255, 0.12);
    --grid-line-strong: rgba(255, 255, 255, 0.25);
    --shadow-md:      0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg:      0 10px 40px rgba(0, 0, 0, 0.5);
    --karte-schatten: none;      /* Karten mit Inhalt von außen (Webcam): nur im hellen Modus ein Schatten */
    --border-light:   rgba(255, 255, 255, 0.16);   /* wie style.css (Livekarte: Popups, Trennlinien) */
    --overlay-medium: rgba(0, 0, 0, 0.5);          /* wie style.css (Schatten über Kartenkacheln) */

    /* Farben der Messgrößen – Datenbedeutung, keine Deko (Seiten-Konzept Punkt 1). Gleiche Werte wie die
       Symbole der Startseiten-Kacheln (css/start_d7.css .d7-ic-*): Temperatur rot, Feuchte blau, Luftdruck
       türkis, Niederschlag hellblau, Wind cyan, Schnee eisblau. Böen = Wind, Pegel ohne Startseiten-Kachel. */
    --param-temp:         #ef4444;
    --param-feuchte:      #3b82f6;
    --param-druck:        #2dd4bf;
    --param-niederschlag: #60a5fa;
    --param-wind:         #67e8f9;
    --param-schnee:       #e0f2fe;
    --param-wasser:       #38bdf8;   /* Durchfluss/Wasserstand */
    --segment-aktiv-text: var(--blue-accent);   /* aktives .segment-teil */

    /* Schrift */
    --font-main:      var(--rahmen-schrift);
    --fs-xs:          var(--rahmen-fs-xs);
    --fs-sm:          var(--rahmen-fs-sm);
    --fs-base:        var(--rahmen-fs-base);
    --fs-md:          1.05rem;
    --fs-lg:          var(--rahmen-fs-lg);
    --fs-xl:          1.6rem;
    --fs-hero:        clamp(3.2rem, 9vw, 5.2rem);

    /* Form und Abstand */
    --radius-sm:      var(--rahmen-radius-sm);
    --radius-md:      var(--rahmen-radius-md);
    --radius-lg:      var(--rahmen-radius-lg);
    --radius-segment: 8px;       /* Segment-Umschalter (.segment) */
    --rand-seite:     16px;      /* Seitenrand Mobil */
    --luecke:         16px;      /* Abstand zwischen Karten */
    --max-breite:     1320px;    /* Außenbreite höchstens 1320 px inkl. 16 px Seitenrand (--rand-seite als Innenabstand),
                                    gleich wie style.css --max-width; Inhaltskante bei (Fenster − 1320)/2 + 16 px,
                                    z. B. 316 px bei 1920, unter 1320 px Fensterbreite 16 px (05.12.2026, vorher 1100) */
    --text-max:       72ch;      /* Textspalte der Textseiten (rechtliche Seiten, 403/404): Karte = Text + Innenabstand,
                                    Rahmen unverändert; ch gilt in der Schrift des nutzenden Elements (06.12.2026) */
    --bottomnav-h:    60px;      /* Leiste unten (nur Mobil): schwebende Kapsel */
    --bottomnav-seite: 10px;     /* Abstand der Kapsel links/rechts: Ecken außerhalb der Display-Rundung (iPhone),
                                    Kanten 6 px außerhalb der Karten (--rand-seite 16 px) */
    /* Abstand der Kapsel unten: mind. 16 px, mit Home-Indikator Safe Area + 8 px */
    --bottomnav-unten: max(16px, calc(env(safe-area-inset-bottom, 0px) + 8px));
    /* Inhaltsbreite ohne Seitenrand: Kopf und Kontextleiste richten Logo/Theme-Knopf daran aus.
       Auf allen Seiten gleich (= .inhalt), damit der Kopf beim Seitenwechsel nicht springt; nicht überschreiben. */
    --inhalt-max:     calc(var(--max-breite) - 2 * var(--rand-seite));
    --kopf-h:         56px;
    --kontext-h:      32px;
    /* Abstand oben für Statusleiste/Notch (iPhone); ohne viewport-fit=cover meist 0 */
    --kopf-sicher:    env(safe-area-inset-top, 0px);
    --kopf-gesamt-h:  calc(var(--kopf-h) + var(--kontext-h) + var(--kopf-sicher));
}

html.light {
    color-scheme: light;
    /* Rahmen-Variablen (siehe :root); die allgemeinen Namen folgen über var() */
    --rahmen-seite:      #e4eaf2;
    --rahmen-abdunkeln:  rgba(15, 23, 42, 0.35);
    --rahmen-text:       #1e293b;
    --rahmen-text-2:     #334155;
    --rahmen-text-3:     #5b6b80;
    --rahmen-blau:       #2563eb;
    --rahmen-blau-hell:  #2563eb;
    --rahmen-blau-a10:   rgba(37, 99, 235, 0.08);
    --rahmen-gruen:      #16a34a;
    --bg-card-solid:  #ffffff;
    --karte-bg:       #ffffff;
    --karte-bg-innen: #f3f6fb;
    --karte-rand:     rgba(15, 23, 42, 0.09);
    --kopf-bg:        #f4f7fb;
    --kontext-bg:     #e9eef5;
    --kopf-rand:      rgba(15, 23, 42, 0.10);
    --blue-accent:    #3b82f6;
    --blue-a25:       rgba(37, 99, 235, 0.20);
    --blue-a40:       rgba(37, 99, 235, 0.35);
    --kontext-seite:  #2563eb;   /* #60a5fa hat auf Hell zu wenig Kontrast */
    --aktiv-bg:       #d6e2f5;
    --green-dark:     #15803d;
    --red:            #dc2626;
    --red-light:      #dc2626;
    --yellow:         #b45309;
    --warm-bg:        rgba(220, 38, 38, 0.12);
    --kalt-bg:        rgba(37, 99, 235, 0.12);
    --orange:         #ea580c;
    --fluss-cron:     #0f766e;
    --fluss-hand:     #b45309;
    --bg-tooltip:     rgba(255, 255, 255, 0.98);
    --overlay-heavy:  rgba(0, 0, 0, 0.50);
    --glass-light:    rgba(30, 60, 120, 0.05);
    --glass-medium:   rgba(30, 60, 120, 0.07);
    --grid-line:        rgba(0, 0, 0, 0.18);
    --grid-line-strong: rgba(0, 0, 0, 0.30);
    --shadow-md:      0 2px 8px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(30, 60, 120, 0.06);
    --shadow-lg:      0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(30, 60, 120, 0.08);
    --karte-schatten: 0 1px 4px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(30, 60, 120, 0.05);
    --border-light:   rgba(0, 0, 0, 0.10);
    --overlay-medium: rgba(0, 0, 0, 0.25);
    /* Messgrößen hell: Werte der Startseite (style.css hell); Türkis/Cyan/Eisblau haben dort keinen
       Hell-Wert → dunklere Stufe derselben Farbe, damit sie auf Weiß lesbar sind */
    --param-temp:         #dc2626;
    --param-feuchte:      #2563eb;
    --param-druck:        #0d9488;
    --param-niederschlag: #3b82f6;
    --param-wind:         #0891b2;
    --param-schnee:       #0ea5e9;
    --param-wasser:       #0284c7;
    --segment-aktiv-text: #1d4ed8;   /* #3b82f6 auf --blue-a25 nur 3,3:1 → 5,4:1 */
}

/* Seiten ohne Kontextleiste ($kopf_kontext = false): Kopf allein, --kopf-gesamt-h = 56/64 px (+ Safe Area) */
html.ohne-kontext { --kontext-h: 0px; }
/* $kopf_kontext = 'mobil': Kontextleiste nur ≤ 720 px; am Desktop weg, --kopf-gesamt-h ohne Leiste (klebende Leisten, Pop-ups) */
@media (min-width: 721px) {
    html.kontext-mobil { --kontext-h: 0px; }
    html.kontext-mobil .kontext { display: none; }
}

/* ---------- Grundlagen ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg-page); }   /* ersetzt <html style>, CSP */
/* Scrollleiste ausblenden wie style.css (alte Seiten): Seiten mit und ohne Scrollleiste sind gleich breit,
   Logo und Inhalt springen beim Seitenwechsel nicht (auch nicht zwischen alten und neuen Seiten).
   Scrollen per Rad/Touch/Tasten bleibt. Entscheidung 04.12.2026 statt scrollbar-gutter: stable. */
html { scrollbar-width: none; }
html::-webkit-scrollbar { display: none; }
body {
    margin: 0;
    font-family: var(--font-main);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-page);
    min-height: 100vh;
}
/* Grundregeln für Elemente: auf umgezogenen Seiten überall, auf alten Seiten im neuen Rahmen
   ($seite_alt → html.seite-alt) nur im Rahmen selbst – der alte Inhalt (Symbole im Text, Listen,
   Links, Knöpfe) bleibt wie unter style.css. :where() hält die Spezifität bei der des Elements. */
:where(html:not(.seite-alt), .kopf-bereich, .mehr, .bottomnav) :is(h1, h2, h3, p, ul) { margin: 0; }
:where(html:not(.seite-alt), .kopf-bereich, .mehr, .bottomnav) ul { padding: 0; list-style: none; }
:where(html:not(.seite-alt), .kopf-bereich, .mehr, .bottomnav) a { color: var(--blue-light); text-decoration: none; }
:where(html:not(.seite-alt), .kopf-bereich, .mehr, .bottomnav) a:hover { text-decoration: underline; }
:where(html:not(.seite-alt), .kopf-bereich, .mehr, .bottomnav) button { font: inherit; color: inherit; }
:where(html:not(.seite-alt), .kopf-bereich, .mehr, .bottomnav) :is(img, svg) { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--blue-light); outline-offset: 2px; border-radius: 4px; }
/* Skript-Fokus (✕ in Dialog/Pop-up) nach Maus/Touch ohne Ring – html.zeiger aus js/basis.js, weg bei der
   nächsten Taste. !important: schlägt die Fokusregeln der Bausteine und Seiten (z. B. #sp-schliessen). */
html.zeiger :is(button, a, [tabindex]):focus-visible { outline: none !important; }

.sprung-link {
    position: absolute; left: 8px; top: -60px; z-index: 300;
    padding: 8px 14px; border-radius: var(--rahmen-radius-sm);
    background: var(--rahmen-blau); color: #fff;
    text-decoration: none;   /* liegt außerhalb der Rahmen-Teile: auf alten Seiten greift die a-Grundregel nicht */
}
.sprung-link:focus { top: 8px; }

/* Schneeregen-Symbol (WH.schneeregenSymbolHtml in js/wetter_hilfen.js, 05.12.2026): Inline-SVG im Textfluss –
   ohne diese Regel macht die Grundregel „svg block“ aus dem Symbol eine eigene Zeile */
.ns-schneeregen-svg { display: inline-block; vertical-align: -0.15em; }

/* Nur für Screenreader; .nur-sr-mobil nur ≤ 720 px (Langform neben einer Kurzform am Handy) */
.nur-sr {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}
@media (max-width: 720px) {
    .nur-sr-mobil {
        position: absolute; width: 1px; height: 1px; overflow: hidden;
        clip: rect(0 0 0 0); white-space: nowrap;
    }
}

/* Rahmen-Teile setzen Schrift, Zeilenhöhe und Textfarbe selbst, statt sie vom body zu erben:
   css/style.css (alte Seiten) setzt body { line-height: 1.6 } und eigene Schriftvariablen. */
.sprung-link, .kopf-bereich, .mehr, .bottomnav {
    font-family: var(--rahmen-schrift); font-size: 1rem; line-height: 1.5;
}
.kopf-bereich, .mehr { color: var(--rahmen-text); }   /* Sprung-Link weiß (eigene Regel), Leiste: Links färben selbst */

/* Ohne sichtbaren Rahmen ($rahmen_sichtbar = false, z. B. livekarte.php?einbettung=1): kein Kopf, keine Leiste */
html.ohne-rahmen { --kopf-h: 0px; --kontext-h: 0px; }

/* ---------- Kopf + Kontextleiste (kleben gemeinsam oben) ---------- */
/* Kopf am Desktop 64 px (H1, 04.12.2026), Handy bleibt 56 px; --kopf-gesamt-h zieht klebende Leisten,
   Pop-up-Abdunklung und „Mehr“ mit. html.ohne-rahmen (0 px) hat die höhere Spezifität und gilt weiter. */
@media (min-width: 721px) {
    :root { --kopf-h: 64px; }
}
/* Menü im Kopf als Reiter (05.12.2026, ersetzt die Pillen H2): ohne Rahmen/Kasten, gedämpfter Text,
   aktiv blau mit 2-px-Linie auf der Unterkante des Kopfes, Hover heller mit leichter Fläche */
:root {
    --nav-text:        var(--rahmen-text-2);
    --nav-text-hover:  var(--rahmen-text);
    --nav-bg-hover:    rgba(148, 163, 184, 0.08);
    --nav-text-aktiv:  #60a5fa;
    --nav-linie:       #3b82f6;
    --kopf-glas:       rgba(19, 27, 45, 0.82);   /* Desktop: etwas heller als die Seite, mit Unschärfe */
}
html.light {
    --nav-bg-hover:    rgba(15, 23, 42, 0.05);
    --nav-text-aktiv:  #2563eb;   /* auf dem hellen Kopf ≥ 4,5:1 */
    --nav-linie:       #2563eb;
    --kopf-glas:       rgba(248, 250, 252, 0.85);
}
.kopf-bereich {
    position: sticky; top: 0; z-index: 100;
    padding-top: var(--kopf-sicher);   /* Kopf nie unter Statusleiste/Notch */
    background: var(--kopf-bg);
}
.kopf {
    height: var(--kopf-h);
    background: var(--kopf-bg);
    border-bottom: 1px solid var(--kopf-rand);
}
.kopf-innen {
    height: 100%;
    max-width: calc(var(--inhalt-max) + 2 * var(--rand-seite));   /* Logo/Knopf bündig mit dem Inhalt */
    margin: 0 auto;
    padding: 0 var(--rand-seite);
    display: flex;
    align-items: center;
    gap: 16px;
}
.kopf-marke {
    display: flex; align-items: center; gap: 10px;
    color: var(--rahmen-text); text-decoration: none;
    min-width: 0;
}
/* Desktop: Logo-Text nie kürzen oder umbrechen (H3) – bei Platzmangel werden die Pillen schmaler (unten) */
@media (min-width: 721px) { .kopf-marke { flex: none; } }
.kopf-marke:hover { text-decoration: none; }
.kopf-marke img { width: 44px; height: 44px; flex: none; }
.kopf-name {
    font-size: 19px; font-weight: 700; line-height: 1.2;
    white-space: nowrap;       /* nie umbrechen; schmal wird verkleinert (Mobil, clamp) */
}

/* Menü im Kopf (ab 721 px): Reiter über die volle Kopfhöhe, damit die Linie des aktiven Punkts
   auf der Unterkante liegt (über dem 1-px-Trennstrich). Hover-Fläche und Fokusring als ::before, 40 px hoch. */
.hauptnav { margin-left: auto; align-self: stretch; }
.hauptnav ul { display: flex; gap: 4px; height: 100%; }
.hauptnav-link {
    position: relative;
    display: inline-flex; align-items: center; gap: 4px;
    height: 100%; padding: 0 12px;
    border: 0; background: none; cursor: pointer;
    color: var(--nav-text);
    font-size: var(--rahmen-fs-base); font-weight: 500;
    text-decoration: none; white-space: nowrap;
    transition: color 0.15s;
}
.hauptnav-link::before {   /* Hover-Fläche, 12 px Luft oben/unten */
    content: ''; position: absolute; z-index: -1; left: 2px; right: 2px; top: 50%; height: 40px; margin-top: -20px;
    border-radius: var(--rahmen-radius-sm);
    transition: background-color 0.15s;
}
.hauptnav-link.aktiv::after {   /* Reiter-Linie bündig auf der Kopf-Unterkante (deckt den Trennstrich) */
    content: ''; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px;
    border-radius: 2px 2px 0 0; background: var(--nav-linie);
}
.hauptnav li { position: relative; z-index: 0; }   /* eigene Stapelebene: ::before (z −1) bleibt sichtbar */
.hauptnav-link:hover { color: var(--nav-text-hover); text-decoration: none; }
.hauptnav-link:hover::before { background: var(--nav-bg-hover); }
.hauptnav-link.aktiv { color: var(--nav-text-aktiv); font-weight: 600; }
/* Fokusring auf die 40-px-Fläche statt auf den ganzen Reiter (html.zeiger: kein Ring nach Maus/Touch) */
.hauptnav-link:focus-visible { outline: none; }
.hauptnav-link:focus-visible::before { outline: 2px solid var(--blue-light); outline-offset: 0; }
html.zeiger .hauptnav-link:focus-visible::before { outline: none; }
/* Symbol vor dem Text (gleiche SVGs wie die Leiste unten): Farbe wie der Text, aktiv blau */
.hauptnav-sym { display: inline-flex; margin-right: 2px; }   /* + gap 4 px = 6 px zum Text */
/* Platzmangel (H3): erst Abstände/Polster kleiner (Tablet-Block unten), unter 900 px ohne Symbole */
@media (max-width: 899px) { .hauptnav-sym { display: none; } }
/* Pfeil ▾ an „Mehr“ (im Kopf ohne •••-Symbol; die Kapsel unten zeigt es weiter) */
.mehr-knopf > .icon { transition: transform 0.15s; }
.mehr-knopf[aria-expanded="true"] { color: var(--nav-text-hover); }
.mehr-knopf[aria-expanded="true"]::before { background: var(--nav-bg-hover); }
.mehr-knopf[aria-expanded="true"] > .icon { transform: rotate(180deg); }

/* Hell/Dunkel: 36 px rund, Tippfläche 40 px über den Rand-Abstand (::before) */
.theme-knopf {
    position: relative; flex: none;
    width: 36px; height: 36px; margin-left: 8px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--karte-rand); background: var(--karte-bg);
    color: var(--rahmen-text-2); cursor: pointer;
}
.theme-knopf::before { content: ''; position: absolute; inset: -2px; }
.theme-knopf:hover { color: var(--rahmen-text); }
/* Desktop: Kopf als Glas-Leiste (etwas heller als die Seite, Unschärfe, Trennstrich unten);
   Hell/Dunkel ohne Rahmen wie die Reiter, Hover mit derselben Fläche. Handy unverändert deckend. */
@media (min-width: 721px) {
    .kopf-bereich {
        background: transparent;
        -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%);
    }
    .kopf { background: var(--kopf-glas); }
    .theme-knopf { border-color: transparent; background: none; }
    .theme-knopf:hover { background: var(--nav-bg-hover); }
}
.theme-icon-hell { display: none; }
html.light .theme-icon-hell { display: inline; }
html.light .theme-icon-dunkel { display: none; }

/* Kontextleiste */
.kontext {
    height: var(--kontext-h);
    background: var(--kontext-bg);
    border-bottom: 1px solid var(--kopf-rand);
    font-size: var(--rahmen-fs-sm);
}
.kontext-innen {
    height: 100%;
    max-width: calc(var(--inhalt-max) + 2 * var(--rand-seite)); margin: 0 auto;
    padding: 0 var(--rand-seite);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.kontext-links, .kontext-rechts {
    display: flex; align-items: center; gap: 6px; min-width: 0;
    white-space: nowrap;
}
.kontext-links { overflow: hidden; }
.kontext-icon { display: inline-flex; flex: none; color: var(--kontext-seite); }
.kontext-seite { color: var(--kontext-seite); font-weight: 600; }
.kontext-ort { color: var(--rahmen-text-2); overflow: hidden; text-overflow: ellipsis; }
.kontext-ort::before { content: '·'; margin-right: 6px; color: var(--rahmen-text-3); }
.kontext-rechts { flex: none; color: var(--rahmen-text-3); font-size: var(--rahmen-fs-xs); }
.kontext-live {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: var(--rahmen-fs-sm); font-weight: 600; color: var(--rahmen-gruen);
    font-variant-numeric: tabular-nums;
}
.kontext-live.veraltet { color: var(--rahmen-text-3); }
.live-punkt {
    width: 8px; height: 8px; border-radius: 50%;
    background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 25%, transparent);
}

/* ---------- „Mehr“ (#mehr, includes/layout/fuss.php): ab 721 px Aufklapp-Menü unter „Mehr ▾“ ----------
   fest unter dem Kopf, rechts bündig mit dem Theme-Knopf-Rand des Inhalts (--inhalt-max). Mobil: Sheet (unten). */
.mehr {
    position: fixed;
    top: calc(var(--kopf-sicher) + var(--kopf-h) + 4px);
    right: max(var(--rand-seite), calc((100% - var(--inhalt-max)) / 2));
    z-index: 200;
    width: min(760px, calc(100% - 2 * var(--rand-seite)));
    max-height: calc(100vh - var(--kopf-h) - 24px); overflow-y: auto;
    padding: 18px 20px 14px;
    background: var(--karte-bg);
    border: 1px solid var(--karte-rand);
    border-radius: var(--rahmen-radius-lg);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}
.mehr-kopf { display: none; }
.mehr-titel { font-size: var(--rahmen-fs-lg); font-weight: 700; }
.mehr-zu {
    width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
    border: 0; border-radius: 50%; background: var(--karte-bg-innen); cursor: pointer;
}
.mehr-gruppen { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 24px; }
.mehr-gruppe-titel {
    margin-bottom: 6px;
    font-size: var(--rahmen-fs-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--rahmen-blau-hell);
}
/* Eintrag: Symbol links (Spalte 1, auf Höhe der Titelzeile), Titel und Unterzeile eingerückt in Spalte 2 */
.mehr-link {
    display: grid; grid-template-columns: 18px minmax(0, 1fr); column-gap: 10px; align-items: center;
    padding: 7px 10px; margin: 0 -10px;
    border-radius: var(--rahmen-radius-sm);
    color: var(--rahmen-text); text-decoration: none;
}
.mehr-link:hover { text-decoration: none; }
.mehr-link-sym { grid-row: 1; grid-column: 1; display: inline-flex; color: var(--rahmen-text-3); }
.mehr-link-sym > .icon { width: 18px; height: 18px; }
.mehr-link-name, .mehr-link-info { grid-column: 2; }
@media (hover: hover) {   /* Touch: keine hängenbleibende Hover-Markierung */
    .mehr-link:hover { background: var(--rahmen-blau-a10); }
    .mehr-link:hover .mehr-link-sym { color: var(--rahmen-blau-hell); }
}
.mehr-link.aktiv { background: var(--aktiv-bg); }
.mehr-link.aktiv .mehr-link-sym { color: var(--rahmen-blau-hell); }
.mehr-link-name { font-size: var(--rahmen-fs-base); font-weight: 500; }
.mehr-link-info { font-size: var(--rahmen-fs-xs); color: var(--rahmen-text-3); }

/* ---------- Seiteninhalt, Raster, Karten ---------- */
.inhalt {
    max-width: var(--max-breite);
    margin: 0 auto;
    padding: 24px var(--rand-seite) 32px;
}
.raster {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: var(--luecke);
}
.raster > * { grid-column: 1 / -1; min-width: 0; }   /* Standard: volle Breite */

.karte {
    background: var(--karte-bg);
    border: 1px solid var(--karte-rand);
    border-radius: var(--radius-lg);
    padding: 20px;
}
.karte-kopf {
    display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
    margin-bottom: 14px;
}
.karte-titel {
    font-size: var(--fs-sm); font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
    color: var(--blue-light);
}
.karte-link { font-size: var(--fs-sm); color: var(--text-secondary); white-space: nowrap; }
.karte-link:hover { color: var(--text-primary); }
.karte--hinweis { border-color: color-mix(in srgb, var(--yellow) 55%, transparent); }
.karte--hinweis .karte-titel { color: var(--yellow); }

.chip {
    display: inline-block; padding: 1px 8px; border-radius: var(--radius-sm);
    font-weight: 600; font-variant-numeric: tabular-nums;
}
.chip--warm { background: var(--warm-bg); color: var(--red-light); }
.chip--kalt { background: var(--kalt-bg); color: var(--blue-light); }

/* ---------- Tabelle: div.tabelle-rahmen > table.tabelle (05.12.2026, Datenfluss) ----------
   Rahmen scrollt waagrecht, die Seite nicht. Zahlenspalte .tabelle-zahl, ohne Umbruch .tabelle-nw,
   Gruppenkopf tr.tabelle-gruppe (z. B. eine Aufgabe über mehreren Zeilen). */
.tabelle-rahmen { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tabelle { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.tabelle th, .tabelle td {
    padding: 6px 8px; text-align: left; vertical-align: top;
    border-bottom: 1px solid var(--karte-rand);
}
.tabelle th { color: var(--text-secondary); font-weight: 600; white-space: nowrap; }
.tabelle .tabelle-zahl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabelle .tabelle-nw { white-space: nowrap; }
.tabelle tr.tabelle-gruppe td { padding-top: 14px; background: var(--karte-bg-innen); }

/* ---------- Aufklapp-Block: details.aufklapp > summary.aufklapp-kopf + div.aufklapp-inhalt ---------- */
.aufklapp {
    background: var(--karte-bg);
    border: 1px solid var(--karte-rand);
    border-radius: var(--radius-lg);
}
.aufklapp-kopf {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 14px 20px; cursor: pointer; list-style: none;
    font-weight: 600; color: var(--text-primary);
}
.aufklapp-kopf::-webkit-details-marker { display: none; }
.aufklapp-kopf::before {
    content: ''; width: 8px; height: 8px; flex: none;
    border-right: 2px solid var(--blue-light); border-bottom: 2px solid var(--blue-light);
    transform: rotate(-45deg); transition: transform 0.15s;
}
.aufklapp[open] > .aufklapp-kopf::before { transform: rotate(45deg); }
.aufklapp-kopf:focus-visible { outline: 2px solid var(--blue-light); outline-offset: -2px; }
.aufklapp-inhalt { padding: 0 20px 20px; }

/* ======================= Gemeinsame Bausteine (Nachlese 04.12.2026) =======================
   Nur Variablen von oben → Dark/Light automatisch. Seiten setzen höchstens Abstände/Höhen dazu. */

/* ---------- Knopf: .knopf, .knopf--rund (nur Symbol), .knopf--voll (Hauptaktion), Zähler .zaehler ----------
   Höhe über --knopf-h (Standard 32 px), z. B. .datum-nav { --knopf-h: 38px }. Auch als <a>. */
.knopf {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: var(--knopf-h, 32px); padding: 0 10px; margin: 0;
    font: inherit; font-size: var(--fs-sm); font-weight: 600; line-height: 1;
    color: var(--text-secondary);
    background: var(--karte-bg-innen);
    border: 1px solid var(--karte-rand); border-radius: var(--radius-sm);
    cursor: pointer; white-space: nowrap; text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}
.knopf svg { display: block; flex-shrink: 0; }
.knopf[aria-expanded="true"] { color: var(--blue-light); border-color: var(--blue); }
.knopf:disabled { opacity: 0.4; cursor: not-allowed; }
.knopf--rund { width: var(--knopf-h, 32px); padding: 0; color: var(--blue-light); }
.knopf--voll { color: var(--blue-light); background: var(--blue-a25); border-color: var(--blue); }
@media (hover: hover) {
    .knopf:not(:disabled):hover { color: var(--text-primary); border-color: var(--blue-a40); text-decoration: none; }
}
.knopf:focus-visible { outline: 2px solid var(--blue-light); outline-offset: 1px; }
/* Knopf über einer Karte (Livekarte): 36 px, deckend mit Schatten, damit er sich von den Kartenkacheln abhebt.
   Doppelte Klasse: schlägt auch Leaflets „.leaflet-bar a“ (Zoom-Knöpfe). */
.knopf.knopf--karte {
    --knopf-h: 36px;
    color: var(--blue-light);
    background: var(--bg-card-solid);
    border-color: var(--blue-a40);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}
.knopf.knopf--karte[aria-expanded="true"] { color: var(--text-primary); border-color: var(--blue); }
/* Zahl im Knopf (z. B. Anzahl gewählter Spalten) */
.zaehler {
    min-width: 18px; padding: 0 5px; border-radius: 9px;
    background: var(--blue-a25); color: var(--blue-accent);
    font-size: var(--fs-xs); font-weight: 700; text-align: center; line-height: 18px;
}

/* ---------- Segment-Umschalter: .segment > button.segment-teil[aria-pressed] ----------
   Aktiv über aria-pressed="true" (Knopf) bzw. aria-current="true" (Link). .segment--voll: über die ganze Breite, Teile gleich breit.
   Zweite Zeile klein: <span class="segment-unter">. */
.segment {
    display: inline-flex;
    border: 1px solid var(--blue-a25); border-radius: var(--radius-segment);
    overflow: hidden;
}
.segment--voll { display: flex; }
.segment--voll > .segment-teil { flex: 1 1 0; min-width: 0; }
.segment-teil {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
    margin: 0; padding: 0.45rem 1rem;
    font: inherit; font-size: var(--fs-sm); font-weight: 500; white-space: nowrap;
    color: var(--text-secondary); background: var(--karte-bg);
    border: 0; cursor: pointer;
    transition: background 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.segment-teil + .segment-teil { border-left: 1px solid var(--blue-a25); }
/* Hover flach: Blau-Schleier über der Kartenfläche */
.segment-teil:hover { color: var(--blue-accent); background: linear-gradient(var(--blue-a10), var(--blue-a10)), var(--karte-bg); }
.segment-teil[aria-pressed="true"],
a.segment-teil[aria-current="true"] { color: var(--segment-aktiv-text); background: var(--blue-a25); font-weight: 600; }
a.segment-teil { text-decoration: none; }   /* Segment aus Links (Umschalten = neue Seite, z. B. Grafik Monat | Jahr) */
.segment-unter { font-size: var(--fs-xs); font-weight: 400; color: var(--text-muted); }
.segment-teil[aria-pressed="true"] .segment-unter { color: var(--blue-light); }
.segment-teil:focus-visible { outline-offset: -2px; }

/* ---------- Popover: Knopf [data-pop="id"] aria-controls aria-expanded → <div class="popover" id hidden> ----------
   Liegt im Eltern-Element mit position: relative (z. B. Werkzeugleiste), unter ihm rechtsbündig.
   Öffnen/Schließen in js/basis.js (eines offen, Esc und Klick daneben schließen). */
.popover {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 50;
    /* Höchstbreite am Fenster, nicht am Positions-Container: der ist oft nur ein Knopf breit
       (Gerätetest 04.12.2026: ⓘ in grafik.php nur ~60 px breit, ein Wort je Zeile) */
    width: 340px; max-width: calc(100vw - 2 * var(--rand-seite));
    max-height: min(70vh, 520px); overflow-y: auto; overscroll-behavior: contain;
    padding: 14px 16px;
    background: var(--bg-card-solid);
    border: 1px solid var(--blue-a40); border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    font-size: var(--fs-sm); color: var(--text-secondary);
}
.popover--breit { width: 400px; }

/* ---------- Auswahldialog: .dialog-hg[hidden] > .dialog[role=dialog] ----------
   Kopf .dialog-kopf (.dialog-titel, .dialog-hinweis), Liste .dialog-liste mit
   <label class="dialog-eintrag"><input type="checkbox"> Text</label>, Fuß .dialog-fuss (Knöpfe, .dialog-ok blau,
   .dialog-neben grau). Öffnen/Schließen über WS.dialog (js/basis.js: Esc, Klick daneben, Fokus). */
.dialog-hg {
    position: fixed; inset: 0; z-index: 300;   /* über Leiste unten (150) und „Mehr“ (210) */
    display: flex; align-items: center; justify-content: center; padding: 16px;
    background: var(--bg-overlay);
}
.dialog {
    width: 320px; max-width: 100%; max-height: min(540px, 85vh);
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--bg-card-solid);
    border: 1px solid var(--blue-a25); border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}
.dialog-kopf { flex-shrink: 0; padding: 16px 18px 10px; border-bottom: 1px solid var(--blue-a10); }
.dialog-titel { margin: 0; font-size: var(--fs-base); font-weight: 600; color: var(--text-primary); }
.dialog-hinweis { margin: 2px 0 0; font-size: var(--fs-xs); color: var(--text-muted); }
.dialog-liste {
    flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
    margin: 0; padding: 4px 0; list-style: none;
}
.dialog-eintrag {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 18px; cursor: pointer; user-select: none;
    font-size: var(--fs-base); color: var(--text-primary);
}
.dialog-eintrag:hover { background: var(--blue-a10); }
/* Kästchen: natives Eingabefeld, gezeichnet wie bisher auf der Tagesverlauf-Seite (20 px, Haken weiß auf Blau) */
.dialog-eintrag input[type="checkbox"] {
    -webkit-appearance: none; appearance: none;
    flex: none; width: 20px; height: 20px; margin: 0;
    border: 2px solid var(--text-muted); border-radius: var(--radius-sm);
    background: transparent no-repeat center / 12px 12px;
    cursor: inherit;
    transition: background-color 0.12s, border-color 0.12s;
}
.dialog-eintrag input[type="checkbox"]:checked {
    background-color: var(--blue); border-color: var(--blue);
    background-image: url("../icons/haken.svg");   /* Datei statt data:-URL (CSP img-src 'self') */
}
.dialog-eintrag input[type="checkbox"]:focus-visible { outline: 2px solid var(--blue-light); outline-offset: 2px; }
/* gesperrt: nicht angehakt und nicht wählbar (Höchstzahl erreicht) blass; angehakt und gesperrt (letzte Spalte) normal */
.dialog-eintrag:has(input:disabled) { cursor: not-allowed; }
.dialog-eintrag:has(input:disabled:not(:checked)) { opacity: 0.3; }
.dialog-eintrag:has(input:disabled):hover { background: none; }
.dialog-fuss { flex-shrink: 0; display: flex; border-top: 1px solid var(--blue-a10); }
.dialog-fuss button {
    flex: 1; margin: 0; padding: 12px;
    font: inherit; font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted);
    background: none; border: 0; cursor: pointer;
    transition: background 0.12s;
}
.dialog-fuss button:hover { background: var(--blue-a10); }
.dialog-fuss .dialog-ok { color: var(--blue-light); }
.dialog-fuss .dialog-neben { color: var(--text-secondary); }

/* ---------- Reiter: nav.tabs[data-tabs] > a.tab[aria-current="page"] (Unterstrich-Variante, Grafik Dez. 2026) ----------
   Navigation innerhalb einer Karte (z. B. Parameter eines Diagramms); hebt sich vom Segment-Umschalter (Pille) ab.
   Inhalt: <span class="tab-symbol" data-symbol="temp"></span><span class="tab-text">Name</span><span class="tab-einheit">°C</span>.
   .tabs--kompakt: nur der aktive Reiter zeigt Text, die übrigen nur das Symbol (dann aria-label am Reiter).
   Zu viele Reiter: waagrecht scrollbar, Rand blendet aus (.tabs-mehr-links/-rechts) und der aktive Reiter wird
   ins Bild gerollt; Pfeiltasten wechseln den Fokus – beides js/basis.js. */
.tabs {
    display: flex; gap: 2px; min-width: 0;
    overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
    border-bottom: 1px solid var(--blue-a10);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs.tabs-mehr-rechts { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
.tabs.tabs-mehr-links { -webkit-mask-image: linear-gradient(90deg, transparent, #000 28px); mask-image: linear-gradient(90deg, transparent, #000 28px); }
.tabs.tabs-mehr-links.tabs-mehr-rechts { -webkit-mask-image: linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 28px), transparent); }
.tab {
    flex: none; display: inline-flex; align-items: center; gap: 6px;
    height: 44px; min-width: 44px; padding: 0 10px; margin-bottom: -1px;
    font-size: var(--fs-sm); font-weight: 600; white-space: nowrap;
    color: var(--text-muted); text-decoration: none;
    border-bottom: 2px solid transparent;
    -webkit-tap-highlight-color: transparent;
}
.tab:hover { color: var(--text-primary); text-decoration: none; }
/* Aktiv: Text in normaler Textfarbe, einziger Aktiv-Hinweis ist der blaue Unterstrich; Farbe nur am Symbol (W5) */
.tab[aria-current="page"] { color: var(--text-primary); border-bottom-color: var(--blue-light); }
.tab-symbol { display: inline-flex; }
/* W5: Symbol in der Farbe der Messgröße (.param-farbe--*), inaktiv leicht zurückgenommen, Hover/Fokus/aktiv voll */
.tab:not([aria-current="page"]) .tab-symbol[class*="param-farbe--"] { opacity: var(--tab-symbol-blass, 0.75); }
.tab:hover .tab-symbol, .tab:focus-visible .tab-symbol { opacity: 1; }
.tab-einheit { font-weight: 400; color: var(--text-muted); }
.tabs--kompakt .tab:not([aria-current="page"]) { justify-content: center; padding: 0 9px; }
.tabs--kompakt .tab:not([aria-current="page"]) .tab-text,
.tabs--kompakt .tab:not([aria-current="page"]) .tab-einheit { display: none; }
.tab:focus-visible { outline: 2px solid var(--blue-light); outline-offset: -2px; }

/* Farbe einer Messgröße für Symbole (Reiter, Listen): --param-* wie Startseite/Livekarte, Datenbedeutung */
.param-farbe--temp         { color: var(--param-temp); }
.param-farbe--niederschlag { color: var(--param-niederschlag); }
.param-farbe--schnee       { color: var(--param-schnee); }
.param-farbe--wind         { color: var(--param-wind); }
.param-farbe--feuchte      { color: var(--param-feuchte); }
.param-farbe--druck        { color: var(--param-druck); }
.param-farbe--wasser       { color: var(--param-wasser); }
/* Hell: Symbole ≥ 3:1 auf Weiß – inaktive Reiter nicht zurücknehmen (75 % ergäbe 2,2–2,6:1), Schnee dunkler
   (--param-schnee hell #0ea5e9 nur 2,8:1 → #0284c7 4,1:1) */
html.light { --tab-symbol-blass: 1; }
html.light .param-farbe--schnee { color: #0284c7; }

/* ---------- Diagramme (js/chart-basis.js liest diese Farben) ---------- */
:root {
    --diagramm-text:   #94a3b8;
    --diagramm-gitter: rgba(100, 160, 220, 0.15);
    --diagramm-faden:  rgba(148, 163, 184, 0.6);
    /* Wind (Werte wie Startseite WIND_POPUP_STIL / Livekarte --sp-f-wind*; dort später hierauf umstellen) */
    --wind-mittel:     #60a5fa;                    /* Mittelwind durchgezogen, Fläche darunter */
    --wind-flaeche:    rgba(96, 165, 250, 0.06);
    --wind-boee:       #93c5fd;                    /* W4: Böen eigenes helleres Blau, deckend (Jahr durchgezogen, Monat gestrichelt) */
    --wind-richtung:   rgba(148, 163, 184, 0.35);  /* W4: Richtung kleine blasse Punkte hinter allen Linien */
    --wind-spanne:     rgba(148, 163, 184, 0.05);  /* W4: Spannweite beim Wind ganz dezent, grau statt blau */
    /* Abweichung zum Mittel (Fadenkreuz, W8): nasser/mehr blau, trockener/weniger ocker – Werte wie
       css/klima.css --spag-ns-nass/--spag-ns-trocken (Klima beim Umzug hierauf umstellen) */
    --abw-nass:        #3b82f6;
    --abw-trocken:     #d97706;
    /* Datenlage je Jahr/Monat (Zeitraum-Auswahl): Datenfarbe, Kontrast zur Karte ≥ 3:1 */
    --datenlage-voll:  #4ade80;
    --datenlage-teil:  #fb923c;
}
html.light {
    --diagramm-text:   #475569;
    --diagramm-gitter: rgba(40, 60, 100, 0.16);
    --diagramm-faden:  rgba(51, 65, 85, 0.5);
    --wind-mittel:     #1d4ed8;   /* W1: dunkler als die Böen, damit beide Kennzahlen ≥ 4,5:1 haben */
    --wind-flaeche:    rgba(29, 78, 216, 0.12);
    --wind-boee:       #0369a1;   /* W4: anderer Ton als das Mittel (#1d4ed8), 5,9:1 auf Weiß (Kennzahl-Text) */
    --wind-richtung:   rgba(100, 116, 139, 0.35);
    --wind-spanne:     rgba(71, 85, 105, 0.07);
    --abw-nass:        #2563eb;   /* Klima #3b82f6 nur 3,7:1 auf Weiß → 5,2:1 */
    --abw-trocken:     #b45309;
    --datenlage-voll:  #15803d;
    --datenlage-teil:  #c2410c;
}
/* Legende (CB.legende): Knopf je Reihe, ausgeblendet = blass; Farbe des Zeichens per --cb-leg-farbe (Datenfarbe) */
.cb-legende { display: flex; flex-wrap: wrap; gap: 2px 14px; }
.cb-leg {
    display: inline-flex; align-items: center; gap: 7px;
    min-height: 28px; padding: 0; margin: 0;
    font: inherit; font-size: var(--fs-sm); color: var(--text-secondary);
    background: none; border: 0; cursor: pointer;
}
.cb-leg[aria-pressed="false"] { opacity: 0.4; }
.cb-leg-zeichen { flex: none; width: 18px; height: 3px; border-radius: 2px; background: var(--cb-leg-farbe); }
.cb-leg--strich { height: 0; border-top: 2px dashed var(--cb-leg-farbe); background: none; }
.cb-leg--balken { width: 8px; height: 12px; }
.cb-leg--flaeche { height: 10px; opacity: 0.6; }
.cb-leg--raute { width: 8px; height: 8px; border-radius: 1px; transform: rotate(45deg); }
.cb-leg--punkt { width: 6px; height: 6px; border-radius: 50%; }
.cb-leg:focus-visible { outline: 2px solid var(--blue-light); outline-offset: 2px; }
/* Handy: kurz und dezent, damit die Legende in höchstens zwei Zeilen passt (Grafik-Korrektur G6) */
@media (max-width: 720px) {
    .cb-legende { gap: 0 10px; }
    .cb-leg { gap: 5px; min-height: 24px; font-size: var(--fs-xs); color: var(--text-muted); }
    .cb-leg-zeichen { width: 14px; }
}

/* Wetter-Symbole (Meteocons, icons/weather/): im hellen Modus Schatten, sonst weiße Wolken
   auf weißer Karte unsichtbar. Werte wie css/vorhersage.css (html.light img[src^="icons/weather/"]);
   beim Umzug der Prognose-Seite dort durch diese Klasse ersetzen. */
html.light .wetter-icon {
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25)) contrast(1.15);
}

/* Platzhalter (Etappe 1) */
.platzhalter {
    display: flex; align-items: center; justify-content: center; text-align: center;
    min-height: 90px; padding: 12px;
    border: 1px dashed var(--karte-rand); border-radius: var(--radius-md);
    background: var(--karte-bg-innen);
    color: var(--text-muted); font-size: var(--fs-sm);
}

/* Leiste unten und Sheet-Abdunklung nur Mobil */
.bottomnav, .mehr-hintergrund { display: none; }

/* ======================= Tablet 721–1099 px ======================= */
/* Nur die Menü-Abstände werden kürzer, Titel bleibt 19 px (Entscheidung 03.12.2026); Reiter schmaler (H3) */
@media (max-width: 1099px) {
    .kopf-innen { gap: 10px; }
    .hauptnav ul { gap: 2px; }
    .hauptnav-link { padding: 0 10px; }
    .theme-knopf { margin-left: 4px; }
}
@media (max-width: 799px) {
    .hauptnav ul { gap: 0; }
    .hauptnav-link { padding: 0 8px; }
}

/* ======================= Mobil ≤ 720 px ======================= */
@media (max-width: 720px) {
    /* Seitenende knapp über der Kapsel: Kapsel + Abstand unten + 12 px */
    body { padding-bottom: calc(var(--bottomnav-h) + var(--bottomnav-unten) + 12px); }

    /* 393 px: 19 px; schmaler verkleinern statt umbrechen (320 px ≈ 16 px) */
    .kopf-name { font-size: clamp(15px, 4.9vw, 19px); }
    .inhalt { padding: 16px var(--rand-seite) 24px; }
    .karte { padding: 16px; }
    .popover, .popover--breit { width: auto; left: 0; right: 0; }   /* volle Breite des Eltern-Elements */

    .hauptnav { display: none; }
    .kopf-marke { flex: 1 1 auto; }
    .theme-knopf { margin-left: auto; }

    /* Leiste unten als schwebende Kapsel (Entscheidung 04.12.2026, Variante B3): 60 px, 10 px seitlich,
       unten --bottomnav-unten, Radius 28 (folgt der Display-Rundung), deckend in Seitenfarbe – dunkler als die Karten */
    .bottomnav {
        position: fixed; z-index: 150;
        left: var(--bottomnav-seite); right: var(--bottomnav-seite);
        bottom: var(--bottomnav-unten);
        display: flex;
        height: var(--bottomnav-h); padding: 0 6px;
        background: var(--rahmen-seite);
        border: 1px solid rgba(96, 165, 250, 0.35); border-radius: 28px;
        box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6);
    }
    html.light .bottomnav {
        background: #ffffff;
        border-color: rgba(37, 99, 235, 0.22);
        box-shadow: 0 6px 20px rgba(15, 23, 42, 0.18);
    }
    /* Verlauf unter/neben der Kapsel (ab halber Kapselhöhe): kein Text blitzt unter der Kapsel durch */
    body::after {
        content: ''; position: fixed; left: 0; right: 0; bottom: 0; z-index: 149; pointer-events: none;
        height: calc(var(--bottomnav-h) / 2 + var(--bottomnav-unten));
        background: linear-gradient(to bottom, transparent, var(--rahmen-seite) 55%);
    }
    .bottomnav-link {
        /* a und button („Mehr“) gleich breit: Browser-Vorgaben des button zurücksetzen (WebKit: padding 6 px) */
        flex: 1 1 0; min-width: 0; margin: 0; padding: 0;
        -webkit-appearance: none; appearance: none; font-family: inherit; line-height: inherit; text-align: center;
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        border: 0; background: none; cursor: pointer;
        color: var(--rahmen-text-2); text-decoration: none;
        font-size: var(--rahmen-fs-xs); font-weight: 600;
        -webkit-tap-highlight-color: transparent;
        position: relative; isolation: isolate;   /* Pille hinter Symbol + Text */
    }
    .bottomnav-link:hover { text-decoration: none; }
    .bottomnav-link.aktiv { color: var(--rahmen-blau-hell); }
    .bottomnav-link.aktiv::before {   /* dezente Pille hinter dem aktiven Punkt */
        content: ''; position: absolute; inset: 6px 3px; z-index: -1;   /* 6 px Luft oben/unten, 9 px zum Kapselrand */
        border-radius: 20px; background: rgba(59, 130, 246, 0.15);
    }
    html.light .bottomnav-link.aktiv::before { background: rgba(37, 99, 235, 0.12); }

    /* „Mehr“ als Sheet von unten, über der Leiste */
    .mehr {
        top: auto; left: 0; right: 0; bottom: 0;
        z-index: 210;
        width: auto; max-height: 85vh;
        padding: 6px 20px calc(16px + env(safe-area-inset-bottom, 0px));
        border-bottom: 0;
        border-radius: var(--rahmen-radius-lg) var(--rahmen-radius-lg) 0 0;
        box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.4);
    }
    .mehr-kopf {
        display: flex; align-items: center; justify-content: space-between;
        position: sticky; top: 0; z-index: 1;
        padding: 10px 0 8px; margin-bottom: 4px;
        background: var(--karte-bg);
    }
    .mehr-gruppen { grid-template-columns: 1fr; gap: 14px; }
    .mehr-link { padding: 10px; grid-template-columns: 20px minmax(0, 1fr); column-gap: 12px; }
    .mehr-link-sym > .icon { width: 20px; height: 20px; }
    .mehr-hintergrund {
        display: block; position: fixed; inset: 0; z-index: 205;
        background: var(--rahmen-abdunkeln);
    }
    body.mehr-offen { overflow: hidden; }

    /* Ohne sichtbaren Rahmen: kein Platz für die Kapsel, kein Verlauf */
    html.ohne-rahmen body { padding-bottom: 0; }
    html.ohne-rahmen body::after { content: none; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
