/* Security Mission Suite: dunkles Design, alle Farben als Variablen */
:root {
  --bg: #0d0f12;
  --surface: #161a1f;
  --surface-2: #1e232a;
  --border: #2a3038;
  --text: #e8eaed;
  --muted: #9aa3ad;
  --accent: #f36d34; /* BBK-Orange, am 27.11.2026 aus dem Favicon von bbk.bund.de abgenommen (Hauptfarbe des Zivilschutzzeichens); nur die Farbe, kein Zeichen */
  --on-accent: #000000;
  --status-green: #2fbf71;
  --status-yellow: #f2c230;
  --status-red: #e5484d;
  --status-none: #6b7480;
  --radius: 6px;
  --bracket-size: 18px;
  --bracket-width: 3px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }
/* iOS soll Schrift im Querformat nicht selbst vergrößern */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2 { margin: 0; font-weight: 650; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.05rem; }

.muted { color: var(--muted); margin: 0; }

/* Eckenklammer der Manufakturen: offene Klammer oben rechts */
.bracket { position: relative; }
.bracket::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: var(--bracket-size);
  height: var(--bracket-size);
  border-top: var(--bracket-width) solid var(--accent);
  border-right: var(--bracket-width) solid var(--accent);
  pointer-events: none;
}

/* Logo der Sicherheitsmanufaktur (views/partials/logo.php) */
.logo-mark { display: block; flex: 0 0 auto; }
.logo-shield { fill: var(--text); }
.logo-bracket { fill: var(--accent); }
.logo-word { font-weight: 700; letter-spacing: .01em; color: var(--text); }
.logo-side { display: flex; align-items: center; gap: 9px; min-width: 0; }
.logo-side .logo-mark { width: 26px; height: 28px; }
.logo-side .logo-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.logo-side .logo-word { font-size: .9rem; }
.logo-hero { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 6vh auto 22px; text-align: center; }
.logo-hero .logo-mark { width: 84px; height: 90px; }
.logo-hero .logo-word { font-size: clamp(1.5rem, 5vw, 2.1rem); line-height: 1.1; }
.logo-hero .logo-claim { display: flex; align-items: center; gap: 12px; color: var(--accent); font-size: .78rem; font-weight: 600; letter-spacing: .38em; text-transform: uppercase; }
.logo-hero .logo-claim::before, .logo-hero .logo-claim::after { content: ""; width: 28px; height: 1px; background: var(--text); opacity: .8; }
.logo-hero + .login-card { margin-top: 0; }

/* Kopf */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.brand { padding: 4px 0; display: flex; color: var(--text); text-decoration: none; }
.brand:hover { filter: none; }
.brand-name { font-weight: 700; letter-spacing: .02em; }
.brand-sub { color: var(--muted); font-size: .85rem; }
.header-user { display: flex; align-items: center; gap: 12px; }
.header-who { color: var(--muted); font-size: .9rem; }
.inline-form { margin: 0; }

.site-main { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 24px 16px; }

.site-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .8rem;
}

/* Knöpfe und Formulare */
.btn {
  font: inherit;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 8px 14px;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--text);
}
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 650; }
.btn-accent:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { border-color: var(--accent); }
.btn:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.login-card {
  max-width: 380px;
  margin: 8vh auto 0;
  padding: 28px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.login-card h1 { margin-bottom: 16px; }
.login-form { display: flex; flex-direction: column; gap: 6px; }
.login-form label { color: var(--muted); font-size: .9rem; margin-top: 8px; }
.login-form input {
  font: inherit;
  padding: 9px 11px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
.login-form .btn { margin-top: 18px; }

.alert {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--status-red);
  background: var(--surface-2);
}
.notice {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-left: 3px solid var(--status-yellow);
  background: var(--surface);
  font-size: .9rem;
}

/* Dashboard */
.dashboard-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

.tile-grid {
  display: grid;
  /* min(): auf schmalen Bildschirmen nie breiter als die Spalte; minmax(0, …) und min-width: 0 verhindern,
     dass ein breiter Inhalt (Diagramm, Tabelle) die Kachel und damit die ganze Seite über die Bildschirmbreite drückt */
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 16px;
}
.tile-grid > *, .tile, .tile-body, .map-layout > *, .fq-layout > * { min-width: 0; }
.tile { overflow-wrap: break-word; }
.tile-body svg { max-width: 100%; }

.tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 180px;
}
.tile-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-right: 14px; }
.tile-time { margin: 0; color: var(--muted); font-size: .85rem; }
.tile-body { flex: 1; }
.tile-empty { color: var(--muted); margin: 0; }
.tile-value { font-size: 2rem; font-weight: 700; margin: 0; }
.tile-error { margin: 0; color: var(--status-yellow); font-size: .85rem; }
.tile-foot { color: var(--muted); font-size: .75rem; border-top: 1px solid var(--border); padding-top: 8px; }

/* Ampel */
.ampel { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--muted); white-space: nowrap; }
.ampel-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--status-none); }
.status-gruen .ampel-dot { background: var(--status-green); box-shadow: 0 0 8px var(--status-green); }
.status-gelb .ampel-dot { background: var(--status-yellow); box-shadow: 0 0 8px var(--status-yellow); }
.status-rot .ampel-dot { background: var(--status-red); box-shadow: 0 0 8px var(--status-red); }

@media (max-width: 520px) {
  .site-header { flex-direction: column; align-items: flex-start; }
  .tile-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Netzfrequenz: Diagramm als Inline-SVG (Farben nur über Variablen) */
.tile-value .unit { font-size: 1rem; font-weight: 400; color: var(--muted); }
.fq-stale { opacity: .5; }
.fq-chart { width: 100%; }
.fq-svg { display: block; width: 100%; height: auto; }
.fq-band { fill: var(--status-green); fill-opacity: .08; }
.fq-ref { stroke-width: 1; }
.fq-ref-green { stroke: var(--status-green); stroke-opacity: .55; stroke-dasharray: 4 4; }
.fq-ref-yellow { stroke: var(--status-yellow); stroke-opacity: .55; stroke-dasharray: 4 4; }
.fq-ref-mid { stroke: var(--muted); stroke-opacity: .5; }
.fq-line { fill: none; stroke: var(--accent); stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; }
.fq-label { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.fq-note { margin: 0; font-size: .8rem; }

/* NINA: Warnliste */
.warn-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.warn { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; border-left: 3px solid var(--status-none); background: var(--surface-2); border-radius: 3px; }
.warn.sev-rot { border-left-color: var(--status-red); }
.warn.sev-gelb { border-left-color: var(--status-yellow); }
.warn-title { font-weight: 600; overflow-wrap: anywhere; }
.warn-meta { color: var(--muted); font-size: .8rem; }

/* Passwort vergessen, Rechtstexte */
.alert-ok { border-left-color: var(--status-green); }
.form-link { margin: 14px 0 0; font-size: .9rem; }
a { color: var(--accent); }
a:hover { filter: brightness(1.15); }
.site-footer { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.footer-links a { color: var(--muted); margin-left: 14px; }
.footer-links a:first-child { margin-left: 0; }
.legal { max-width: 760px; margin: 0 auto; line-height: 1.55; }
.legal h1 { margin-bottom: 6px; }
.legal h2 { font-size: 1.05rem; margin: 24px 0 6px; }
.legal p, .legal ul { margin: 0 0 10px; }
.legal .stand { color: var(--muted); font-size: .9rem; }

/* Netzfrequenz: Zeigerinstrument, Feinanzeige, breite Kachel */
.tile[data-module="netzfrequenz"] { grid-column: 1 / -1; }
.fq-layout { display: grid; grid-template-columns: 1fr; gap: 18px; }
@media (min-width: 900px) {
  .fq-layout { grid-template-columns: minmax(300px, 420px) 1fr; align-items: center; gap: 28px; }
}
.fq-gauge-col { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.fq-chart-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fq-gauge { display: block; width: 100%; max-width: 420px; height: auto; }
.fq-fine { display: block; width: 100%; max-width: 420px; height: auto; overflow: visible; }
.fq-digital { text-align: center; margin-top: -10px; }
.fq-arc { fill: none; stroke-width: 14; }
.fq-z-red { stroke: var(--status-red); background: var(--status-red); }
.fq-z-orange { stroke: var(--accent); background: var(--accent); }
.fq-z-green { stroke: var(--status-green); background: var(--status-green); }
.fq-z-blue { stroke: #5b6ee1; background: #5b6ee1; }
.fq-z-grey { stroke: var(--status-none); background: var(--status-none); }
.fq-tick { stroke: var(--muted); stroke-width: 1; }
.fq-tick-major { stroke: var(--text); stroke-width: 2; }
.fq-gauge-label { fill: var(--text); font-size: 13px; font-family: var(--font); }
.fq-needle { transform-box: view-box; transform-origin: 200px 205px; transition: transform .8s ease-out; }
.fq-needle line { stroke: var(--text); stroke-width: 3.5; stroke-linecap: round; }
.fq-hub { fill: var(--text); }
.fq-fine-yellow { fill: var(--status-yellow); fill-opacity: .35; }
.fq-fine-green { fill: var(--status-green); fill-opacity: .7; }
.fq-fine-mark { transform-box: view-box; transition: transform .8s ease-out; }
.fq-fine-mark path { fill: var(--text); }
.fq-fine-mark line { stroke: var(--text); stroke-width: 2; }
.fq-needle.fq-stale, .fq-fine-mark.fq-stale { opacity: .35; }
.fq-legend { list-style: none; margin: 6px 0 0; padding: 0; font-size: .8rem; color: var(--muted); display: grid; gap: 3px; width: 100%; max-width: 420px; }
.fq-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 7px; vertical-align: -1px; }
@media (prefers-reduced-motion: reduce) {
  .fq-needle, .fq-fine-mark { transition: none; }
}
.fq-needle.fq-novalue, .fq-fine-mark.fq-novalue { visibility: hidden; }

/* Seitenleiste mit Kategorien (Aufbau wie in der Mission Suite) */
.page { flex: 1; display: flex; flex-direction: column; min-width: 0; }
body.with-sidebar { padding-left: 240px; }
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 240px; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 16px 12px; display: flex; flex-direction: column; z-index: 20;
}
.side-brand { display: flex; flex-direction: column; padding: 6px 6px 14px 8px; margin-bottom: 6px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; }
.side-brand:hover { filter: none; }
.side-nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; margin-bottom: 2px;
  border-radius: var(--radius); color: var(--text); text-decoration: none; font-size: .92rem;
}
.side-nav a svg { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-nav a:hover { background: var(--surface-2); filter: none; }
.side-nav a.active { background: var(--surface-2); color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.side-nav a.nav-planned { color: var(--muted); }
.side-nav a.nav-planned.active { color: var(--accent); }
.nav-label { flex: 1; min-width: 0; }
.nav-group { font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 14px 10px 4px; }
.nav-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; background: var(--status-none); }
.nav-dot.status-gruen { background: var(--status-green); }
.nav-dot.status-gelb { background: var(--status-yellow); }
.nav-dot.status-rot { background: var(--status-red); }
.sidebar-foot { margin-top: auto; padding: 14px 10px 4px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; font-size: .85rem; }
.sidebar-foot .footer-links a { margin-left: 0; margin-right: 14px; }
.btn-small { padding: 5px 10px; font-size: .85rem; align-self: flex-start; }
.menu-toggle { display: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.planned { margin-top: 18px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.planned h2 { margin-bottom: 4px; }
.planned ul { margin: 10px 0 0; padding-left: 20px; color: var(--text); }
.planned li { margin: 3px 0; }
@media (max-width: 900px) {
  body.with-sidebar { padding-left: 0; }
  /* zugeklappt auch für Tastatur und Screenreader verborgen */
  .sidebar { transform: translateX(-100%); visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; box-shadow: 0 0 24px rgba(0,0,0,.5); padding-top: 58px; }
  .sidebar.open { transform: none; visibility: visible; transition: transform .2s ease; }
  .menu-toggle {
    display: block; position: fixed; top: 10px; left: 10px; z-index: 30;
    background: var(--surface); color: var(--text); border: 1px solid var(--border);
    border-radius: var(--radius); font-size: 20px; line-height: 1; padding: 6px 10px; cursor: pointer;
  }
  body.with-sidebar .site-main { padding-top: 56px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* Karten (Leaflet, zoombar): Strahlung, Luftlage, Pegel, Autobahn, Unwetter */
:root {
  --map-bg: #1b1f24;
  --map-edge: #000000;
  --odl-low: #2fbf71;
  --odl-mid: #9bd35a;
  --adsb-low: #7fd1ff;
  --adsb-mid: #f0f0f0;
  --adsb-high: #c39bff;
  --adsb-ground: #8a929c;
  --dwd-1: #ffeb3b;
  --dwd-2: #fb8c00;
  --dwd-3: #e53935;
  --dwd-4: #b0338f;
  --dwd-none: #6b7480;
  --road-closure: #e5484d;
  --road-jam: #fb8c00;
  --road-slow: #f2c230;
  --road-other: #9aa3ad;
  --gauge-0: #2fbf71;
  --gauge-1: #f2c230;
  --gauge-2: #fb8c00;
  --gauge-3: #e5484d;
  --gauge-4: #b0338f;
  --gauge-none: #7fd1ff;
}
.tile[data-module="odl"], .tile[data-module="adsb"], .tile[data-module="pegel"], .tile[data-module="autobahn"], .tile[data-module="dwd"] { grid-column: 1 / -1; }
.map-layout { display: grid; grid-template-columns: 1fr; gap: 18px; }
@media (min-width: 1000px) {
  .map-layout { grid-template-columns: minmax(320px, 2fr) minmax(260px, 1fr); align-items: start; }
  .map-layout.side-wide { grid-template-columns: minmax(320px, 1.4fr) minmax(0, 1fr); }
}
.map-box { position: relative; width: 100%; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--map-bg); }
.lmap { width: 100%; height: clamp(320px, 62vh, 640px); background: var(--map-bg); font-family: var(--font); }
.map-loading { margin: 0; padding: 16px; color: var(--muted); }
.map-side { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.map-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .8rem; color: var(--muted); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.small { font-size: .8rem; }
.odl-low { background: var(--odl-low); }
.odl-mid { background: var(--odl-mid); }
.odl-yellow { background: var(--status-yellow); }
.odl-red { background: var(--status-red); }
.adsb-low { background: var(--adsb-low); }
.adsb-mid { background: var(--adsb-mid); }
.adsb-high { background: var(--adsb-high); }
.adsb-ground { background: var(--adsb-ground); }
.adsb-alert { background: var(--status-red); }

/* Leaflet im dunklen Design: Kartenbild abgedunkelt (nur Kachelebene), Bedienelemente dunkel */
.lmap.leaflet-container { background: var(--map-bg); outline-offset: -2px; }
.lmap .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.6); }
.lmap .leaflet-bar { border: 1px solid var(--border); box-shadow: none; }
.lmap .leaflet-bar a { background: var(--surface); color: var(--text); border-bottom-color: var(--border); width: 32px; height: 32px; line-height: 32px; display: flex; align-items: center; justify-content: center; }
.lmap .leaflet-bar a:hover, .lmap .leaflet-bar a:focus-visible { background: var(--surface-2); color: var(--accent); }
.lmap .leaflet-bar a svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lmap .leaflet-control-attribution { background: rgba(13, 15, 18, .75); color: var(--muted); font-size: 10px; }
.lmap .leaflet-control-attribution a { color: var(--text); }
.lmap .leaflet-control-scale-line { background: rgba(13, 15, 18, .7); color: var(--text); border-color: var(--muted); }
.lmap .leaflet-tooltip { width: max-content; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,.5); font-size: .8rem; max-width: 320px; white-space: normal; }
.lmap .leaflet-tooltip-top::before { border-top-color: var(--border); }
.lmap .leaflet-tooltip-bottom::before { border-bottom-color: var(--border); }
.lmap .leaflet-tooltip-left::before { border-left-color: var(--border); }
.lmap .leaflet-tooltip-right::before { border-right-color: var(--border); }
.lmap .leaflet-tooltip.gauge-label { background: rgba(22, 26, 31, .9); padding: 2px 6px; font-weight: 600; white-space: nowrap; }
.lmap .leaflet-popup-content-wrapper, .lmap .leaflet-popup-tip { background: var(--surface-2); color: var(--text); box-shadow: 0 2px 10px rgba(0,0,0,.6); }
.lmap .leaflet-popup-content-wrapper { border: 1px solid var(--border); border-radius: var(--radius); }
.lmap .leaflet-popup-content { margin: 10px 14px; font-size: .85rem; line-height: 1.45; }
.lmap .leaflet-container a.leaflet-popup-close-button, .lmap a.leaflet-popup-close-button { color: var(--muted); }
.map-hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 1000; padding: 10px 14px; border-radius: var(--radius); background: rgba(13, 15, 18, .85); color: var(--text); font-size: .9rem; pointer-events: none; opacity: 0; transition: opacity .2s ease; text-align: center; }
.map-hint.show { opacity: 1; }
.map-box.is-full { border-radius: 0; border: 0; }
.map-box.is-full .lmap, .map-box:fullscreen .lmap { height: 100%; }
.map-box:fullscreen { width: 100%; height: 100%; }
.map-box.map-full { position: fixed; inset: 0; z-index: 1000; }
body.has-map-full { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .map-hint { transition: none; } }
@media (max-width: 520px) {
  .lmap { height: clamp(300px, 58vh, 560px); }
  .lmap .leaflet-control-attribution { max-width: 66%; font-size: 9px; }
}

/* Pegel: Tabelle, Meldestufe, Verlauf */
.gauge-0 { background: var(--gauge-0); }
.gauge-1 { background: var(--gauge-1); }
.gauge-2 { background: var(--gauge-2); }
.gauge-3 { background: var(--gauge-3); }
.gauge-4 { background: var(--gauge-4); }
.gauge-none { background: var(--gauge-none); }
.gauge-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.gauge-table th, .gauge-table td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.gauge-table thead th { color: var(--muted); font-weight: 600; font-size: .78rem; }
.gauge-table tbody th { font-weight: 600; }
.gauge-table .num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.gauge-table .note-row td { border-bottom: 1px solid var(--border); padding-top: 0; }
.ms-badge { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.trend { white-space: nowrap; }
.cell-sub { display: block; color: var(--muted); font-size: .78rem; font-weight: 400; }
.spark { display: block; width: 120px; height: 28px; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 1.4; stroke-linejoin: round; }
.spark-ms { stroke: var(--status-yellow); stroke-width: 1; stroke-dasharray: 3 3; }
@media (max-width: 520px) { .gauge-table .spark-cell, .gauge-table thead th:last-child { display: none; } }

/* Autobahn */
.road-closure { background: var(--road-closure); }
.road-jam { background: var(--road-jam); }
.road-slow { background: var(--road-slow); }
.road-other { background: var(--road-other); }
.warn.road-closure { background: var(--surface-2); border-left-color: var(--road-closure); }
.warn.road-jam { background: var(--surface-2); border-left-color: var(--road-jam); }
.warn.road-slow { background: var(--surface-2); border-left-color: var(--road-slow); }
.warn.road-warn, .warn.road-ramp { border-left-color: var(--road-other); }
.lmap .popup-desc { display: block; margin-top: 6px; color: var(--muted); font-size: .8rem; }

/* DWD-Warnungen */
.dwd-k1 { background: var(--dwd-1); }
.dwd-k2 { background: var(--dwd-2); }
.dwd-k3 { background: var(--dwd-3); }
.dwd-k4 { background: var(--dwd-4); }
.warn.dwd-l1 { border-left-color: var(--dwd-1); }
.warn.dwd-l2 { border-left-color: var(--dwd-2); }
.warn.dwd-l3 { border-left-color: var(--dwd-3); }
.warn.dwd-l4 { border-left-color: var(--dwd-4); }
.side-head { font-size: .95rem; margin: 0; }

/* Stimmung */
.st-wrap { display: flex; flex-direction: column; gap: 8px; }
.st-scale { width: 100%; max-width: 420px; height: auto; }
.st-neg { fill: var(--status-red); background: var(--status-red); fill-opacity: .8; }
.st-mid { fill: var(--status-none); background: var(--status-none); }
.st-pos { fill: var(--status-green); background: var(--status-green); fill-opacity: .8; }
.st-mark { stroke: var(--text); stroke-width: 3; }
.st-bar { display: flex; width: 100%; max-width: 420px; height: 10px; border-radius: 3px; overflow: hidden; background: var(--surface-2); }
.st-seg { display: block; height: 100%; }
.st-themes { margin: 0; padding-left: 20px; }
.st-seg.w0 { width: 0%; }
.st-seg.w5 { width: 5%; }
.st-seg.w10 { width: 10%; }
.st-seg.w15 { width: 15%; }
.st-seg.w20 { width: 20%; }
.st-seg.w25 { width: 25%; }
.st-seg.w30 { width: 30%; }
.st-seg.w35 { width: 35%; }
.st-seg.w40 { width: 40%; }
.st-seg.w45 { width: 45%; }
.st-seg.w50 { width: 50%; }
.st-seg.w55 { width: 55%; }
.st-seg.w60 { width: 60%; }
.st-seg.w65 { width: 65%; }
.st-seg.w70 { width: 70%; }
.st-seg.w75 { width: 75%; }
.st-seg.w80 { width: 80%; }
.st-seg.w85 { width: 85%; }
.st-seg.w90 { width: 90%; }
.st-seg.w95 { width: 95%; }
.st-seg.w100 { width: 100%; }

/* Gemeinsame Diagramme (app/Chart/SvgChart.php): Farben nur über diese Klassen */
:root {
  --chart-1: var(--accent);
  --chart-2: #7fd1ff;
  --chart-3: #c39bff;
  --chart-4: #9bd35a;
  --chart-5: #f2c230;
  --chart-6: #e8eaed;
  --chart-grid: #2a3038;
  --chart-blue: #5b6ee1;
}
.chart-svg { display: block; width: 100%; height: auto; font-family: var(--font); }
.chart-frame { fill: none; stroke: var(--chart-grid); }
.chart-grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart-grid-x { stroke-dasharray: 2 4; }
.chart-axis { stroke: var(--muted); stroke-width: 1; }
.chart-axis-label { fill: var(--muted); font-size: 11px; }
.chart-legend-text { fill: var(--text); font-size: 12px; }
.chart-legend-swatch { stroke-width: 3; stroke-linecap: round; }
.chart-empty { fill: var(--muted); font-size: 13px; }
.chart-line { fill: none; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { stroke: none; }
.chart-ref { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; }
.chart-ref-label { fill: var(--muted); font-size: 10px; }
.chart-band { fill: var(--status-none); fill-opacity: .1; }
.chart-band-gruen { fill: var(--status-green); fill-opacity: .1; }
.chart-band-gelb { fill: var(--status-yellow); fill-opacity: .1; }
.chart-band-rot { fill: var(--status-red); fill-opacity: .12; }
.chart-ref-gruen { stroke: var(--status-green); }
.chart-ref-gelb { stroke: var(--status-yellow); }
.chart-ref-rot { stroke: var(--status-red); }
.chart-series-1 { stroke: var(--chart-1); fill: var(--chart-1); }
.chart-series-2 { stroke: var(--chart-2); fill: var(--chart-2); }
.chart-series-3 { stroke: var(--chart-3); fill: var(--chart-3); }
.chart-series-4 { stroke: var(--chart-4); fill: var(--chart-4); }
.chart-series-5 { stroke: var(--chart-5); fill: var(--chart-5); }
.chart-series-6 { stroke: var(--chart-6); fill: var(--chart-6); }
.chart-svg .chart-line { fill: none; }
.chart-bar { fill: var(--status-none); }
.chart-bar-default { fill: var(--accent); }
.chart-bar-gruen { fill: var(--status-green); }
.chart-bar-gelb { fill: var(--status-yellow); }
.chart-bar-rot { fill: var(--status-red); }
.chart-value { fill: var(--text); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-value-none { fill: var(--muted); }
.chart-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.chart-key.chart-series-1 { background: var(--chart-1); }
.chart-key.chart-series-2 { background: var(--chart-2); }
.chart-key.chart-series-3 { background: var(--chart-3); }
.chart-key.chart-series-4 { background: var(--chart-4); }
.chart-key.chart-series-5 { background: var(--chart-5); }
.chart-key.chart-series-6 { background: var(--chart-6); }

/* Gemeinsames Zeigerinstrument (SvgChart::gauge), Look wie der Netzfrequenz-Zeiger.
   Namen bewusst nicht gauge-0 bis gauge-4, gauge-none, gauge-table, gauge-label (gehören zum Pegel-Modul). */
.gauge-svg { display: block; width: 100%; max-width: 420px; height: auto; margin: 0 auto; font-family: var(--font); overflow: visible; }
.gauge-svg .gauge-arc { fill: none; stroke-width: 14; }
.gauge-z-gruen { stroke: var(--status-green); fill: var(--status-green); background: var(--status-green); }
.gauge-z-gelb { stroke: var(--status-yellow); fill: var(--status-yellow); background: var(--status-yellow); }
.gauge-z-orange, .gauge-z-akzent { stroke: var(--accent); fill: var(--accent); background: var(--accent); }
.gauge-z-rot { stroke: var(--status-red); fill: var(--status-red); background: var(--status-red); }
.gauge-z-blau { stroke: var(--chart-blue); fill: var(--chart-blue); background: var(--chart-blue); }
.gauge-z-grau { stroke: var(--status-none); fill: var(--status-none); background: var(--status-none); }
.gauge-tick { stroke: var(--muted); stroke-width: 1; }
.gauge-tick-major { stroke: var(--text); stroke-width: 2; }
.gauge-scale { fill: var(--text); font-size: 13px; }
.gauge-needle line { stroke: var(--text); stroke-width: 3.5; stroke-linecap: round; }
.gauge-needle.gauge-clamped line { stroke: var(--accent); }
.gauge-hub { fill: var(--text); }
.gauge-value { fill: var(--text); font-size: 32px; font-weight: 700; font-variant-numeric: tabular-nums; }
.gauge-value-none { fill: var(--muted); font-size: 20px; font-weight: 400; }
.gauge-unit { fill: var(--muted); font-size: 16px; font-weight: 400; }
.gauge-fine-bg { fill: var(--surface-2); }
.gauge-svg .gauge-fine-zone { fill-opacity: .7; stroke: none; }
.gauge-fine-label { fill: var(--muted); font-size: 11px; }
.gauge-fine-mark path { fill: var(--text); }
.gauge-fine-mark line { stroke: var(--text); stroke-width: 2; }
.gauge-novalue { visibility: hidden; }
.gauge-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 7px; vertical-align: -1px; }
.gauge-legend { list-style: none; margin: 6px auto 0; padding: 0; font-size: .8rem; color: var(--muted); display: grid; gap: 3px; width: 100%; max-width: 420px; }

/* Gemeinsame Tabellen in Kacheln */
.table-wrap { position: relative; width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th, .data-table td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table thead th { color: var(--muted); font-weight: 600; font-size: .78rem; }
.data-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.data-table tbody tr:hover { background: var(--surface-2); }
/* Zeilen mit Ampelbezug: leichte Tönung der ganzen Zeile statt Randstreifen */
.data-table .row-rot { background: color-mix(in srgb, var(--status-red) 14%, transparent); }
.data-table .row-gelb { background: color-mix(in srgb, var(--status-yellow) 11%, transparent); }
.data-table .row-gruen { background: color-mix(in srgb, var(--status-green) 9%, transparent); }
.data-table tbody tr.row-rot:hover { background: color-mix(in srgb, var(--status-red) 22%, transparent); }
.data-table tbody tr.row-gelb:hover { background: color-mix(in srgb, var(--status-yellow) 18%, transparent); }
.data-table tbody tr.row-gruen:hover { background: color-mix(in srgb, var(--status-green) 15%, transparent); }

/* Ampel als Punkt oder Schild in Tabellen und Listen */
.ampel-badge { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--status-none); vertical-align: 0; }
.ampel-badge.ampel-gruen { background: var(--status-green); }
.ampel-badge.ampel-gelb { background: var(--status-yellow); }
.ampel-badge.ampel-rot { background: var(--status-red); }
.ampel-text-gruen { color: var(--status-green); }
.ampel-text-gelb { color: var(--status-yellow); }
.ampel-text-rot { color: var(--status-red); }

/* Einstellungen */
.settings { max-width: 860px; }
.settings-card { padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; gap: 10px; }
.settings-card h2 { padding-right: 20px; }
.settings-group { margin: 0; padding: 10px 0 0; border: 0; border-top: 1px solid var(--border); display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 6px 16px; }
.settings-group legend { padding: 0 8px 0 0; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.settings-item { display: flex; align-items: flex-start; gap: 10px; padding: 7px 8px; border-radius: var(--radius); cursor: pointer; }
.settings-item:hover { background: var(--surface-2); }
.settings-item input { margin: 3px 0 0; width: 18px; height: 18px; flex: 0 0 18px; accent-color: var(--accent); }
.settings-item input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.settings-text { display: flex; flex-direction: column; min-width: 0; }
.settings-title { font-weight: 600; }
.settings-source { color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.settings-actions { padding-top: 6px; }
.settings-hint { margin-top: 14px; font-size: .85rem; }

/* Nutzerverwaltung und Einladung */
.users { display: flex; flex-direction: column; gap: 18px; }
.users .settings-card h2 { margin-bottom: 6px; }
.invite-form { display: grid; grid-template-columns: 1fr; gap: 6px; max-width: 420px; margin-top: 12px; }
.invite-form label { color: var(--muted); font-size: .9rem; margin-top: 6px; }
.invite-form input, .invite-form select, .invite-url { font: inherit; padding: 9px 11px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.invite-form .btn { margin-top: 12px; justify-self: start; }
.invite-new { margin: 12px 0 4px; padding: 12px 14px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--surface-2); }
.invite-new-head { margin: 0 0 8px; font-weight: 600; }
.invite-copy { display: flex; gap: 8px; flex-wrap: wrap; }
.invite-url { flex: 1 1 260px; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }
.users .data-table tbody th[scope="row"] { min-width: 8em; }
