/* =========================================================================
   JUMBO BLOCK® Dashboard – UI-Schicht 8.2.0 „Brilon“
   Wird auf allen Seiten ZULETZT geladen. Vereinheitlicht Kopfzeile,
   Navigation, Karten, Überschriften, Knöpfe und Eingabefelder.
   Keine Funktion hängt an dieser Datei – nur Darstellung.
   ========================================================================= */

/* ---------- Design-Tokens ---------- */
body {
  --ui-bg: #eef2f7;
  --ui-surface: #ffffff;
  --ui-surface-2: #f6f8fb;
  --ui-ink: #0f172a;
  --ui-muted: #5b6576;
  --ui-line: #e2e8f0;
  --ui-accent: #2563eb;
  --ui-accent-ink: #ffffff;
  --ui-accent-soft: #e8f0fe;
  --ui-danger: #dc2626;
  --ui-danger-soft: #fdecec;
  --ui-bar: rgba(255, 255, 255, 0.9);
  --ui-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 6px 20px rgba(15, 23, 42, 0.06);
  --ui-radius: 16px;
  --ui-radius-sm: 12px;
  --ui-tap: 44px;
  --ui-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ui-nav-h: 64px;
}
body.theme-dark,
body[data-theme="dark"],
html[data-theme="dark"] body:not([data-theme]) {
  --ui-bg: #0a1020;
  --ui-surface: #111a2e;
  --ui-surface-2: #0d1526;
  --ui-ink: #e8edf6;
  --ui-muted: #98a3b8;
  --ui-line: #1e2a44;
  --ui-accent: #4f8cff;
  --ui-accent-ink: #ffffff;
  --ui-accent-soft: #16264a;
  --ui-danger: #f87171;
  --ui-danger-soft: #3a1518;
  --ui-bar: rgba(10, 16, 32, 0.88);
  --ui-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.25);
}

/* ---------- Seite ---------- */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0 !important;
  padding: 0 !important;
  background: var(--ui-bg) !important;
  color: var(--ui-ink) !important;
  font-family: var(--ui-font) !important;
  font-size: 16px;
  line-height: 1.5;
}
body::before { display: none !important; }

/* Hintergrundfoto nur auf großen Bildschirmen, stark gedämpft */
.bg-layer { display: none !important; }
@media (min-width: 1100px) {
  .bg-layer {
    display: block !important;
    opacity: 0.12 !important;
    filter: grayscale(0.3) !important;
  }
  body.theme-dark .bg-layer, body[data-theme="dark"] .bg-layer { opacity: 0.18 !important; }
}

/* Inhaltsbreite */
body > main,
body > .section,
body > section,
body > #site-notice,
body > .alarm-banner,
#footer-slot {
  box-sizing: border-box;
  width: 100%;
  max-width: 1120px;
  margin-left: auto !important;
  margin-right: auto !important;
}
body > main { padding: 0; }
body > .section,
body > section,
main > .section,
main > section {
  padding: 0 16px !important;
  margin-top: 0 !important;
  margin-bottom: 22px !important;
  box-sizing: border-box;
}
main > .section, main > section { padding: 0 !important; }
body > main { padding: 0 16px !important; }
#header-slot + * { margin-top: 18px !important; }

/* ---------- App-Leiste ---------- */
#header-slot { position: sticky; top: 0; z-index: 50; }
#jb-header.jb-appbar {
  display: flex !important;
  align-items: center;
  gap: 16px;
  padding: 10px 20px !important;
  margin: 0 !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  justify-content: flex-start !important;
  position: relative;
  isolation: isolate;
  background: transparent !important;
  border-bottom: 1px solid var(--ui-line);
  box-shadow: none !important;
  border-radius: 0 !important;
  width: 100% !important;
  box-sizing: border-box;
  /* keine filter/backdrop-filter am Header selbst: sonst wären die fixierten
     Elemente (Navigation unten, Mehr-Menü) an den Header gebunden */
}
#jb-header.jb-appbar::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--ui-bar);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
}
#jb-header .jb-brand {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none !important; color: var(--ui-ink) !important;
  min-width: 0; flex: 0 1 auto;
}
#jb-header .jb-brand-logo { width: 40px; height: 40px; border-radius: 10px; flex: none; }
#jb-header .jb-brand-text { display: flex; flex-direction: column; min-width: 0; }
#jb-header .jb-brand-title { font-size: 17px; font-weight: 700; line-height: 1.2; letter-spacing: 0; }
#jb-header .jb-brand-context { font-size: 13px; color: var(--ui-muted); line-height: 1.2; white-space: nowrap; }

/* Navigation – Desktop: in der Leiste */
#jb-header .jb-nav { display: flex; gap: 4px; margin-left: auto; }
#jb-header .jb-nav-item {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 14px !important; margin: 0 !important;
  border-radius: 10px !important; border: 0 !important;
  background: transparent !important; box-shadow: none !important;
  color: var(--ui-muted) !important; text-decoration: none !important;
  font: 600 15px/1 var(--ui-font) !important; text-transform: none !important; letter-spacing: 0 !important;
  cursor: pointer; transform: none !important; min-width: 0 !important;
}
#jb-header .jb-nav-item svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
#jb-header .jb-nav-item:hover { background: var(--ui-surface-2) !important; color: var(--ui-ink) !important; text-decoration: none !important; }
#jb-header .jb-nav-item.is-active { background: var(--ui-accent-soft) !important; color: var(--ui-accent) !important; }

/* Sprache / Design */
#jb-header .jb-prefs { display: flex; gap: 8px; flex: none; }
#jb-header .jb-seg {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--ui-surface-2); border: 1px solid var(--ui-line); border-radius: 11px;
}
#jb-header .jb-seg button {
  height: 32px; min-width: 38px !important; padding: 0 10px !important; margin: 0 !important;
  border: 0 !important; border-radius: 8px !important; box-shadow: none !important;
  background: transparent !important; color: var(--ui-muted) !important;
  font: 700 13px/1 var(--ui-font) !important; letter-spacing: 0.02em !important; text-transform: none !important;
  cursor: pointer; transform: none !important; backdrop-filter: none !important;
}
#jb-header .jb-seg button.is-active {
  background: var(--ui-accent) !important; color: var(--ui-accent-ink) !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.2) !important;
}
/* Design-Umschalter als Symbol (Text bleibt für Screenreader erhalten) */
#jb-header .jb-seg-theme button { font-size: 0 !important; width: 38px; padding: 0 !important; position: relative; }
#jb-header .jb-seg-theme button::before {
  content: ""; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px;
  background-color: currentColor;
  -webkit-mask: var(--ui-icon) center / contain no-repeat; mask: var(--ui-icon) center / contain no-repeat;
}
#btn-theme-light { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='4.5'/%3E%3Cpath d='M12 1.5v3M12 19.5v3M1.5 12h3M19.5 12h3M4.6 4.6l2.1 2.1M17.3 17.3l2.1 2.1M4.6 19.4l2.1-2.1M17.3 6.7l2.1-2.1' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); }
#btn-theme-dark  { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20.5 14.5A8.5 8.5 0 0 1 9.5 3.5a8.5 8.5 0 1 0 11 11z'/%3E%3C/svg%3E"); }

/* Mehr-Menü */
#jb-header .jb-more { position: fixed; inset: 0; z-index: 100; }
#jb-header .jb-more[hidden] { display: none; }
#jb-header .jb-more-backdrop { position: absolute; inset: 0; background: rgba(2, 6, 23, 0.45); }
#jb-header .jb-more-sheet {
  position: absolute; right: 20px; top: 64px; width: min(360px, calc(100vw - 32px));
  background: var(--ui-surface); color: var(--ui-ink);
  border: 1px solid var(--ui-line); border-radius: var(--ui-radius); box-shadow: var(--ui-shadow);
  padding: 8px; box-sizing: border-box;
}
#jb-header .jb-more-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 6px; font-weight: 700; }
#jb-header .jb-more-close {
  width: 36px !important; min-width: 36px !important; max-width: 36px; flex: none !important; height: 36px; padding: 0 !important; margin: 0 !important; border-radius: 10px !important;
  border: 0 !important; background: var(--ui-surface-2) !important; color: var(--ui-ink) !important;
  font: 400 22px/1 var(--ui-font) !important; box-shadow: none !important; text-transform: none !important;
}
#jb-header .jb-more-link {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 12px; border-radius: 12px;
  color: var(--ui-ink) !important; text-decoration: none !important; font-weight: 600; font-size: 16px;
}
#jb-header .jb-more-link small { font-weight: 400; font-size: 13px; color: var(--ui-muted); }
#jb-header .jb-more-link:hover,
#jb-header .jb-more-link.is-active { background: var(--ui-accent-soft); }

/* ---------- Handy: Navigation unten ---------- */
@media (max-width: 760px) {
  #jb-header.jb-appbar { padding: 8px 14px !important; gap: 10px; }
  #jb-header .jb-brand-logo { width: 36px; height: 36px; }
  #jb-header .jb-brand-title { font-size: 16px; }
  #jb-header .jb-prefs { margin-left: auto; gap: 6px; }
  #jb-header .jb-seg button { min-width: 34px !important; padding: 0 8px !important; }
  #jb-header .jb-seg-theme button { width: 34px; }

  #jb-header .jb-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; margin: 0;
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: var(--ui-bar);
    -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
    border-top: 1px solid var(--ui-line);
  }
  #jb-header .jb-nav-item {
    flex-direction: column; justify-content: center; gap: 3px;
    height: 52px; padding: 0 !important; font-size: 12px !important;
  }
  #jb-header .jb-nav-item svg { width: 22px; height: 22px; }
  body.jb-has-appbar { padding-bottom: calc(var(--ui-nav-h) + env(safe-area-inset-bottom)) !important; }
  #jb-header .jb-more-sheet {
    left: 0; right: 0; top: auto; bottom: 0; width: auto;
    border-radius: 20px 20px 0 0; padding: 8px 8px calc(16px + env(safe-area-inset-bottom));
  }
}
/* Schmale Handys / große Systemschrift: Platz für „Dashboard Live“ schaffen.
   Design-Umschalter zeigt nur das jeweils andere Symbol (ein Tipp wechselt). */
@media (max-width: 480px) {
  #jb-header.jb-appbar { gap: 8px; padding: 8px 10px !important; }
  #jb-header .jb-brand { gap: 8px; flex: 1 1 auto; }
  #jb-header .jb-brand-title { white-space: normal; line-height: 1.15; }
  #jb-header .jb-prefs { gap: 4px; flex: none; }
  #jb-header .jb-seg { padding: 2px; }
  #jb-header .jb-seg button { min-width: 30px !important; height: 30px; padding: 0 6px !important; font-size: 12px !important; }
  #jb-header .jb-seg-theme { padding: 2px; }
  #jb-header .jb-seg-theme button { width: 32px; font-size: 0 !important; padding: 0 !important; }
  #jb-header .jb-seg-theme button.is-active { display: none !important; }
}
@media (max-width: 340px) {
  #jb-header .jb-brand-context { display: none; }
  #jb-header .jb-brand-logo { width: 30px; height: 30px; }
}

/* ---------- Abschnitts-Überschriften ---------- */
body > h2,
body .section > h2,
body section > h2,
body main h2,
body .weather-split h2 {
  display: block !important;
  margin: 0 0 10px 4px !important;
  padding: 0 !important;
  background: none !important;
  -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
  text-shadow: none !important;
  color: var(--ui-ink) !important;
  font: 700 18px/1.3 var(--ui-font) !important;
  letter-spacing: 0 !important;
  border-radius: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
}
/* Zwischenüberschriften innerhalb einer Karte */
body .panel h2, body .panel h3, body .control-box h3 {
  display: block !important;
  margin: 18px 0 8px 0 !important;
  padding: 0 !important;
  background: none !important; text-shadow: none !important; backdrop-filter: none !important;
  color: var(--ui-ink) !important;
  font: 700 16px/1.3 var(--ui-font) !important;
  border: 0 !important; box-shadow: none !important;
}
body .panel > h2:first-child, body .panel > h3:first-child { margin-top: 0 !important; }

/* ---------- Karten ---------- */
body .panel,
body .kpi-card,
body .control-box {
  background: var(--ui-surface) !important;
  color: var(--ui-ink) !important;
  border: 1px solid var(--ui-line) !important;
  border-radius: var(--ui-radius) !important;
  box-shadow: var(--ui-shadow) !important;
  -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
  padding: 18px !important;
  box-sizing: border-box;
}
body .panel .panel { box-shadow: none !important; background: var(--ui-surface-2) !important; }
body .kpi-card { padding: 14px !important; }
body .divider { border-color: var(--ui-line) !important; background: var(--ui-line) !important; }

/* Beschriftung / Wert */
body .label {
  color: var(--ui-muted) !important;
  font-size: 13px !important; font-weight: 500 !important;
  letter-spacing: 0.01em; margin-top: 12px; text-transform: none !important;
}
body .panel-col > .label:first-child, body .system-col > .label:first-child { margin-top: 0; }
body .value { color: var(--ui-ink) !important; font-size: 16px !important; font-weight: 600; margin-top: 2px; word-break: break-word; }
body .small, body .hint { color: var(--ui-muted) !important; }
body .mono, body code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important; }
body .kpi-label { color: var(--ui-muted) !important; font-size: 13px !important; }
body .kpi-value { color: var(--ui-ink) !important; font-weight: 700 !important; }
body .kpi-sub { color: var(--ui-muted) !important; }

/* Spalten im Handy-Format untereinander */
@media (max-width: 760px) {
  body .panel-row, body .system-grid, body .weather-split { display: flex !important; flex-direction: column !important; gap: 16px !important; }
  body .panel-col, body .system-col { width: 100% !important; min-width: 0 !important; flex: none !important; height: auto !important; }
}
/* Wasserstand-Ampel kompakt in zwei Spalten */
body #public-ampel-scale { display: grid !important; grid-template-columns: 1fr 1fr; gap: 6px !important; }
body #public-ampel-scale .ampel-item { border-radius: 10px !important; }

/* ---------- Knöpfe ---------- */
body button:not(.jb-nav-item):not(.jb-more-close):not(#jb-header .jb-seg button),
body .btn-explorer,
body .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--ui-tap);
  padding: 0 18px !important;
  margin: 4px 0 !important;
  border-radius: var(--ui-radius-sm) !important;
  border: 1px solid var(--ui-line) !important;
  background: var(--ui-surface) !important;
  color: var(--ui-accent) !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
  font: 600 15px/1.2 var(--ui-font) !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  text-shadow: none !important;
  transform: none !important;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
  box-sizing: border-box;
}
body button:not(.jb-nav-item):not(.jb-more-close):not(#jb-header .jb-seg button):hover,
body .btn-explorer:hover, body .btn:hover {
  background: var(--ui-accent-soft) !important;
  border-color: var(--ui-accent) !important;
}
body button:focus-visible, body a:focus-visible, body input:focus-visible, body select:focus-visible, body textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--ui-accent) 45%, transparent) !important;
  outline-offset: 2px;
}
/* Hauptaktionen */
body #btn-login, body #btn-operator-login, body .primary-btn, body button.primary {
  background: var(--ui-accent) !important; border-color: var(--ui-accent) !important; color: var(--ui-accent-ink) !important;
}
body #btn-login:hover, body #btn-operator-login:hover, body .primary-btn:hover, body button.primary:hover {
  background: color-mix(in srgb, var(--ui-accent) 88%, black) !important;
}
/* Gefährliche Aktionen */
body button.danger {
  color: var(--ui-danger) !important; border-color: color-mix(in srgb, var(--ui-danger) 35%, var(--ui-line)) !important;
  background: var(--ui-surface) !important;
}
body button.danger:hover { background: var(--ui-danger-soft) !important; border-color: var(--ui-danger) !important; }
/* Gesperrt */
body button:disabled, body .btn-explorer:disabled {
  opacity: 0.45 !important; cursor: not-allowed !important; background: var(--ui-surface-2) !important; color: var(--ui-muted) !important;
}
body .btn-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start !important; gap: 8px; margin-top: 10px; text-align: left; }
body .btn-row > button { margin: 0 !important; }
@media (max-width: 760px) {
  body .panel button:not(.jb-seg button), body .panel .btn-explorer { width: 100%; }
  body .btn-row > button { flex: 1 1 100%; }
  body .btn-row-split, body .btn-group-left, body .btn-group-right { display: flex !important; flex-direction: column; width: 100%; gap: 8px; }
}

/* ---------- Eingabefelder ---------- */
body input[type="text"], body input[type="password"], body input[type="number"], body input[type="email"],
body input[type="month"], body input[type="date"], body input:not([type]), body .input-text, body select, body textarea {
  box-sizing: border-box;
  min-height: var(--ui-tap);
  min-width: 0 !important;
  max-width: 100%;
  padding: 10px 12px !important;
  border-radius: var(--ui-radius-sm) !important;
  border: 1px solid var(--ui-line) !important;
  background: var(--ui-surface-2) !important;
  color: var(--ui-ink) !important;
  font: 400 16px/1.3 var(--ui-font) !important;
  box-shadow: none !important;
}
body textarea { min-height: 120px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important; font-size: 14px !important; }
body input:focus, body select:focus, body textarea:focus { border-color: var(--ui-accent) !important; background: var(--ui-surface) !important; }
@media (max-width: 760px) {
  body .panel input:not([type="checkbox"]):not([type="radio"]), body .panel select, body .panel textarea { width: 100% !important; }
}

/* ---------- Statuspunkte, Hinweise ---------- */
body .status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; vertical-align: middle; flex: none; }
body .site-notice {
  box-sizing: border-box;
  margin: 18px auto 18px !important;
  width: calc(100% - 32px) !important; max-width: 1088px;
  padding: 14px 16px !important;
  border-radius: var(--ui-radius) !important;
  background: #fff7ed !important; color: #7c2d12 !important;
  border: 1px solid #fed7aa !important; box-shadow: none !important;
  font-size: 15px !important; line-height: 1.45 !important;
}
body.theme-dark .site-notice, body[data-theme="dark"] .site-notice { background: #2a1a0b !important; color: #fed7aa !important; border-color: #7c3e12 !important; }
body .site-notice[hidden] { display: none !important; }

/* Überschriften direkt im body (Control-Center) mit Inhaltsbreite */
body > h2 { box-sizing: border-box; max-width: 1120px; margin-left: auto !important; margin-right: auto !important; padding: 0 20px !important; }
body > .panel, body > .control-box { margin-left: 16px !important; margin-right: 16px !important; }
@media (min-width: 1152px) { body > .panel, body > .control-box { max-width: 1120px; margin-left: auto !important; margin-right: auto !important; } }

/* Statuszeile (Punkt + Text) immer linksbündig in einer Zeile */
body .btn-row:has(> .status-dot) { flex-direction: row !important; flex-wrap: nowrap !important; align-items: center !important; justify-content: flex-start !important; }
body .btn-row:has(> .status-dot) > span:not(.status-dot) { text-align: left; }

/* Setup-Verknüpfung im Admin-Login: auf dem Handy über „Mehr“ erreichbar */
@media (max-width: 760px) {
  body .panel > a[href="/setup.html"] { display: none !important; }
}

/* Passwort-Verwaltung (Admin): schwebender Knopf über der Navigation */
body #jb-pwd-fab {
  position: fixed !important; right: 16px; bottom: 16px; z-index: 55 !important; width: auto !important;
  box-shadow: var(--ui-shadow) !important;
}
@media (max-width: 760px) {
  /* auf dem Handy kein schwebender Knopf über Inhalten: normaler Knopf am Seitenende */
  /* doppelte ID: muss die allgemeine Knopfregel (enthält selbst eine ID) überstimmen */
  #jb-pwd-fab#jb-pwd-fab { position: static !important; display: flex !important; width: calc(100% - 32px) !important; max-width: 1088px; margin: 0 auto 24px !important; box-shadow: none !important; }
}
body .jb-pwd-modal { background: var(--ui-surface) !important; color: var(--ui-ink) !important; border: 1px solid var(--ui-line) !important; }
body .jb-pwd-label, body .jb-pwd-note { color: var(--ui-muted) !important; }

/* ---------- Dialoge ---------- */
body .version-modal-content {
  background: var(--ui-surface) !important; color: var(--ui-ink) !important;
  border: 1px solid var(--ui-line) !important; border-radius: var(--ui-radius) !important; box-shadow: var(--ui-shadow) !important;
  max-width: min(640px, calc(100vw - 32px)) !important;
}

/* ---------- Fußbereich ---------- */
#footer-slot { padding: 8px 16px 24px !important; }
#footer-slot .section { margin-bottom: 12px !important; }
#footer-slot .panel { box-shadow: none !important; padding: 16px !important; }
#footer-slot .footer-logos {
  display: grid !important; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 18px 16px;
  align-items: center; justify-items: center;
}
#footer-slot .footer-logos a { display: flex; align-items: center; justify-content: center; margin: 0 !important; }
#footer-slot .footer-logos img { max-height: 36px; max-width: 100%; width: auto; height: auto; }
#footer-slot .footer-meta-row { display: flex !important; flex-wrap: wrap; justify-content: center; gap: 8px; }
#footer-slot .footer-meta-row button { flex: 0 1 auto; width: auto !important; }


/* ---------- Admin: Überläufe auf schmalen Bildschirmen ---------- */
body .panel { min-width: 0; overflow-wrap: break-word; }
body .panel select { width: 100% !important; max-width: 100% !important; }
body .panel pre { max-width: 100%; white-space: pre-wrap !important; word-break: break-word; box-sizing: border-box; }
body .admin-table-container { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
body .weather-split > * { width: 100% !important; min-width: 0 !important; align-self: stretch !important; box-sizing: border-box; }
@media (max-width: 760px) {
  body .backup-col-left, body .backup-col-right {
    min-width: 0 !important; width: 100% !important; padding-left: 0 !important; border-left: 0 !important; flex: none !important;
  }
  body .admin-table { min-width: 460px; }
}


/* ---------- Handy: kompakte Abstände zwischen den Karten ---------- */
@media (max-width: 760px) {
  html body .section, html body .section.compact, html body section.section.compact, html body main.section.compact {
    padding-top: 0 !important; padding-bottom: 0 !important;
    margin-top: 0 !important; margin-bottom: 14px !important;
  }
  html body .panel, html body div.panel, html body section.panel, html body .control-box { margin-top: 0 !important; margin-bottom: 12px !important; }
  html body .panel:last-child, html body .control-box:last-child { margin-bottom: 0 !important; }
  html body .panel .panel { margin-bottom: 10px !important; }
  html body h2, html body > h2, html body h2.h2-tight, html body .section > h2, html body section > h2, html body main h2, html body .weather-split h2 { margin-top: 0 !important; margin-bottom: 8px !important; }
  html body .panel h2, html body .panel h3, html body .control-box h3 { margin-top: 14px !important; margin-bottom: 6px !important; }
  html body .panel > h2:first-child, html body .panel > h3:first-child { margin-top: 0 !important; }
  html body .grid-2-col { gap: 12px !important; row-gap: 12px !important; }
  #header-slot + * { margin-top: 12px !important; }
  body .site-notice { margin: 12px auto 12px !important; }
  #footer-slot { padding-top: 4px !important; padding-bottom: 12px !important; }
  #footer-slot .section { margin-bottom: 12px !important; }
  #footer-slot .panel { margin: 0 !important; }
}

/* Bis zur Übersetzung ausblenden (siehe modules/common/i18n-early.js) */
html.jb-i18n-pending body > *:not(#header-slot):not(.bg-layer):not(script) { visibility: hidden; }

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

/* ---------- Breite Bildschirme (8.2.0) ----------
   Ab 1200 px: Inhaltsbreite 1440 px in allen Centern, zweispaltige Anordnung.
   Darunter unverändert einspaltig (Handy, Tablet, kleine Laptops). */
@media (min-width: 1200px) {
  body > main,
  body > .section,
  body > section,
  body > #site-notice,
  body > .alarm-banner,
  body > h2,
  #footer-slot {
    max-width: 1440px;
  }
  /* Start-Center: links Live-Daten, rechts Wetter und Sensoren */
  body > main.start-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    column-gap: 22px;
    align-items: start;
  }
  body > main.start-grid { grid-template-rows: auto 1fr; }
  main.start-grid > section:first-of-type { grid-row: span 2; }
  /* Admin- und Setup-Center: zwei feste Spalten (kein Umspringen bei wachsendem Inhalt) */
  .center-cols {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 22px;
    align-items: start;
  }
  .center-col > .panel:first-child,
  .center-col > section.panel:first-child { margin-top: 0 !important; }
}

/* ---------- Einheitliche Abstände zwischen den Karten (8.2.0) ----------
   Ein Abstand für alle Center, Inhalt und Fußbereich: --card-gap.
   Vorher addierten sich Abschnitts-Innenabstand, Außenabstand und
   Kartenabstand unterschiedlich (12 bis 125 px). */
:root { --card-gap: 16px; }
body > main,
body > main.section,
body > main.section.compact { padding-top: 0 !important; padding-bottom: 0 !important; margin-bottom: 0 !important; }
body > section.section,
body > section.section.compact,
body > main section.section,
body > main section.section.compact {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin-top: 0 !important;
  margin-bottom: var(--card-gap) !important;
}
body > main > .panel + .panel,
body > main > .panel + section.panel,
body > main > section.panel + section.panel,
.center-col > .panel + section.panel,
.center-col > section.panel + section.panel { margin-top: var(--card-gap) !important; }
body > main > section.panel:last-child,
.center-col > section.panel:last-child { margin-bottom: var(--card-gap) !important; }
#footer-slot { margin-top: 0 !important; padding-top: 0 !important; }
.weather-split .panel { margin-bottom: 0 !important; }
#footer-slot .footer-grid {
  display: flex !important;
  flex-direction: column !important;
  gap: var(--card-gap) !important;
  margin: 0 !important;
}
#footer-slot section,
#footer-slot .section {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}
#footer-slot .panel { margin: 0 !important; }
#footer-slot { padding-bottom: var(--card-gap); }
.grid-2-col { gap: var(--card-gap) !important; margin-bottom: var(--card-gap) !important; }
