/* Auslegung: feste Fläche 800 × 480 px (9-Zoll-Display). Keine Seite scrollt,
   nur Listen innerhalb ihrer Ansicht. Größere Fenster skalieren per JS.

   Gestaltung: ruhig und sachlich – weiße Flächen mit feinen Linien, Farbe nur dort, wo
   sie etwas bedeutet (Zustand als Streifen/Punkt: rot Störung, gelb Warnung, blau aktiv,
   grün in Ordnung, grau aus). Weinrot nur als Marken- und Auswahlfarbe.
   Für alte Display-Browser (Chrome 39): kein CSS-Grid und kein gap in neuen Regeln;
   die älteren Stellen ersetzt legacy-extra.css. */

:root {
  --rot: #8c1a37;
  --rot-dunkel: #6e1029;
  --grau: #3d3c3f;
  --bg: #eceef0;
  --card: #ffffff;
  --text: #26282b;
  --muted: #73777d;
  --line: #dde0e4;
  --soft: #f5f6f7;

  --ok: #2f7d3a;
  --error: #c0392b;
  --warning: #d49a00;
  --active: #1f5fa8;
  --off: #b5b9be;

  --border-strong: #c9cdd2;
  --press: #e6e8ea;
  --faint: #9a9ea4;
  --fill-strong: #3d3c3f;
  --on-strong: #ffffff;
  --text-warn: #8a6400;
  --tint-err: #fdf3f2;
  --tint-warn: #fffaeb;
  --tint-active: #eef3fa;
  --border-err: #e7b7b1;
  --border-warn: #ecd9a0;
  --backdrop: rgba(24, 26, 29, .5);
}

/* Dunkelmodus (Klasse "dark" am html-Element, siehe app.js/diag.js). Für alte
   Display-Browser ohne CSS-Variablen baut tools/build-device.mjs daraus legacy-dark.css. */
:root.dark {
  /* Dunkel, angelehnt an das SCS-Control-Panel: Anthrazit, helle Schrift, Grün für „in Ordnung“ */
  --rot: #c4405f;
  --rot-dunkel: #9a2a46;
  --grau: #d3d7db;
  --bg: #24272b;
  --card: #2f3338;
  --text: #eef0f2;
  --muted: #a3aab1;
  --line: #3f444a;
  --soft: #383d43;

  --ok: #86c440;
  --error: #ef4b4b;
  --warning: #f0b429;
  --active: #5aa7f0;
  --off: #626970;

  --border-strong: #4c5258;
  --press: #43494f;
  --faint: #7b838b;
  --fill-strong: #e2e5e8;
  --on-strong: #181a1d;
  --text-warn: #f3c45a;
  --tint-err: #4a2226;
  --tint-warn: #3d3420;
  --tint-active: #22344a;
  --border-err: #8a3a3f;
  --border-warn: #7a6630;
  --backdrop: rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; overflow: hidden; background: #1d1e20; }

body {
  font-family: Calibri, Carlito, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  -webkit-user-select: none;
  user-select: none;
}

button { font-family: inherit; }

/* Lange Wörter (Komposita wie „Netz-/Ersatznetzumschaltung“) müssen in Tasten, Kacheln, Zellen und
   Fenstern umbrechen können: Trennstellen setzt text.js (soft) beim Anzeigen, break-word ist der
   Notnagel für Wörter ohne Trennstelle. Chrome 39 kennt kein hyphens:auto und nur word-wrap sicher. */
button, li, td, th, dt, dd, label, p, h2, h3, .name, .notice, .toast, .dialog, .e-btn, .e-link {
  word-wrap: break-word; overflow-wrap: break-word;
}

#screen {
  position: absolute; left: 0; top: 0;
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}

/* --- Kopfzeile: 56 px. Alles darin ist eine Tippfläche ------------------------
   Logo = Start, Projektname = Info, letzte Meldung = Prüfbuch, Zustand = Alarme,
   Benutzer = An-/Abmelden, Uhr = Datum/Uhrzeit stellen */
.topbar {
  height: 56px; flex: none;
  display: flex; align-items: center;
  padding: 0 6px 0 2px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  box-shadow: inset 0 -2px 0 var(--rot);
  color: var(--grau);
}
.topbar button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; border-radius: 3px; }
.topbar button:active { background: var(--soft); }
.topbar > * + * { margin-left: 6px; }
.logo-btn { height: 46px; padding: 0 10px; flex: none; display: flex; align-items: center; }
.logo { height: 24px; display: block; }
.project { flex: 1; min-width: 0; height: 46px; padding-left: 12px; border-left: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; }
/* Nie mit „…“ kürzen: Text bricht um, passt er nicht in die 46 px, verkleinert app.js (fitText) die Schrift */
.project-name {
  display: block; max-width: 100%; padding: 0 !important; text-align: left;
  font-size: 18px !important; font-weight: 700 !important; line-height: 1.15; color: var(--text) !important;
}
.last-msg {
  display: block; max-width: 100%; padding: 0 !important; text-align: left;
  font-size: 12px !important; line-height: 1.2; color: var(--muted) !important;
}
.last-msg::before { content: "Letzte Meldung: "; color: var(--faint); }
.clock { height: 46px; padding: 0 8px; flex: none; text-align: right; line-height: 1.15; font-variant-numeric: tabular-nums; display: flex; flex-direction: column; justify-content: center; border-left: 1px solid var(--line) !important; border-radius: 0 !important; }
#clock-time { display: block; font-size: 19px; font-weight: 700; color: var(--text); }
#clock-date { display: block; font-size: 12px; color: var(--muted); }

/* Gesamtzustand in der Kopfzeile */
.sys-status {
  height: 32px; max-width: 200px; padding: 0 11px 0 9px !important; flex: none;
  display: flex; align-items: center;
  border: 1px solid var(--line) !important; border-radius: 3px !important;
  font-size: 13px !important; font-weight: 700 !important; line-height: 1.1; color: var(--grau) !important;
  text-align: left;
}
.sys-status .lamp { width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; }
.sys-status span:last-child { min-width: 0; }
.sys-status.s-ok .lamp { background: var(--ok); }
.sys-status.s-error { border-color: var(--error) !important; color: var(--error) !important; background: var(--tint-err) !important; }
.sys-status.s-error .lamp { background: var(--error); }
.sys-status.s-warning { border-color: var(--warning) !important; color: var(--text-warn) !important; background: var(--tint-warn) !important; }
.sys-status.s-warning .lamp { background: var(--warning); }
.sys-status.s-active { border-color: var(--active) !important; color: var(--active) !important; }
.sys-status.s-active .lamp { background: var(--active); }

/* Anmeldung in der Kopfzeile */
.user-btn {
  height: 32px; padding: 0 9px !important; flex: none;
  border: 1px solid var(--line) !important; border-radius: 3px !important;
  font-size: 13px !important; font-weight: 700; color: var(--grau) !important; white-space: nowrap;
}
.user-btn.in { background: var(--fill-strong) !important; border-color: var(--fill-strong) !important; color: var(--on-strong) !important; }
.user-btn[hidden] { display: none; }

/* --- Mittelteil: 480 − 56 = 424 px -------------------------------------------- */
.body { flex: 1; display: flex; min-height: 0; }
main { flex: 1; min-width: 0; padding: 10px; }

.view { height: 100%; }
.view[hidden] { display: none !important; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; }
section.panel { display: flex; flex-direction: column; min-height: 0; }

h2 {
  margin: 0 0 6px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted);
}
h2.sub { margin-top: 12px; }
.hint { text-transform: none; letter-spacing: 0; color: var(--faint); font-weight: 400; margin-left: 6px; }
.empty { color: var(--muted); font-style: italic; font-size: 15px; }
.scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* Statuslampen */
.lamp { width: 14px; height: 14px; border-radius: 50%; flex: none; background: var(--off); }
.name { flex: 1; min-width: 0; }
.state { font-size: 12px; color: var(--muted); }

.s-ok .lamp { background: var(--ok); }
.s-error .lamp { background: var(--error); }
.s-warning .lamp { background: var(--warning); }
.s-active .lamp { background: var(--active); }
.s-off .lamp, .s-unknown .lamp, .s-missing .lamp { background: transparent; border: 2px solid var(--off); }
.s-off .name, .s-missing .name { color: var(--muted); }
.s-error .state { color: var(--error); font-weight: 700; }
.s-warning .state { color: var(--text-warn); font-weight: 700; }
.s-active .state { color: var(--active); font-weight: 700; }

/* --- Start: Gesamtzustand, Statusanzeigen, Batterie, UV ----------------------- */
#view-overview { display: flex; }
.col-status { flex: 1.3; min-width: 0; display: flex; flex-direction: column; }
.col-side { flex: 1; min-width: 0; display: flex; flex-direction: column; margin-left: 10px; }
.col-side .panel + .panel { margin-top: 10px; }
.col-side .grow { flex: 1; min-height: 0; overflow-y: auto; }

.hero {
  flex: none; height: 84px; padding: 0 16px 0 14px;
  display: flex; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--ok); border-radius: 4px;
}
.hero.s-error { border-left-color: var(--error); background: var(--tint-err); }
.hero.s-warning { border-left-color: var(--warning); background: var(--tint-warn); }
.hero.s-active { border-left-color: var(--active); }
.hero.s-unknown { border-left-color: var(--off); }
.hero-icon { width: 36px; height: 36px; flex: none; border-radius: 50%; margin-right: 14px; background: var(--ok); position: relative; }
.hero.s-error .hero-icon { background: var(--error); }
.hero.s-warning .hero-icon { background: var(--warning); }
.hero.s-active .hero-icon { background: var(--active); }
.hero.s-unknown .hero-icon { background: var(--off); }
.hero.s-ok .hero-icon::after { content: ""; position: absolute; left: 13px; top: 7px; width: 8px; height: 16px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg); }
.hero.s-error .hero-icon::after, .hero.s-warning .hero-icon::after { content: "!"; position: absolute; left: 0; right: 0; top: 2px; text-align: center; font-size: 26px; font-weight: 700; color: #fff; }
.hero.s-active .hero-icon::after { content: ""; position: absolute; left: 14px; top: 10px; border-style: solid; border-width: 8px 0 8px 12px; border-color: transparent transparent transparent #fff; }
.hero-text { min-width: 0; }
.hero-title { font-size: 24px; font-weight: 700; line-height: 1.1; color: var(--text); }
.hero.s-error .hero-title { color: var(--error); }
.hero-sub { font-size: 14px; line-height: 1.2; color: var(--muted); margin-top: 4px; }

.tiles { list-style: none; margin: 10px 0 0; padding: 0; flex: 1; min-height: 0; display: flex; flex-wrap: wrap; align-content: flex-start; }
.tile {
  width: calc(50% - 5px); height: 64px; margin-bottom: 10px; padding: 0 12px;
  display: flex; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--off); border-radius: 4px;
  cursor: pointer;
}
.tile:nth-child(odd) { margin-right: 10px; }
.tile:active { background: var(--soft); }
.tile .lamp { margin-right: 10px; }
.tile-text { min-width: 0; display: flex; flex-direction: column; }
.tile .name { font-size: 17px; line-height: 1.1; }
.tile .state { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; margin-top: 3px; }
.tile.s-ok { border-left-color: var(--ok); }
.tile.s-error { border-left-color: var(--error); background: var(--tint-err); }
.tile.s-error .name { color: var(--error); font-weight: 700; }
.tile.s-warning { border-left-color: var(--warning); background: var(--tint-warn); }
.tile.s-warning .name { font-weight: 700; }
.tile.s-active { border-left-color: var(--active); }
.tile.s-active .name { color: var(--active); font-weight: 700; }

.measure { display: flex; justify-content: space-between; align-items: baseline; padding: 5px 0; border-bottom: 1px solid var(--line); }
.measure:last-child { border-bottom: 0; }
.measure .label { font-size: 15px; color: var(--grau); }
.measure .value { font-size: 23px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.measure.s-error .value { color: var(--error); }
.measure.s-warning .value { color: var(--text-warn); }

.dist-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.dist-chips li {
  display: flex; align-items: center; height: 38px; padding: 0 12px; margin: 0 6px 6px 0;
  border: 1px solid var(--line); border-radius: 3px; background: var(--soft); font-size: 15px; cursor: pointer;
}
.dist-chips li .lamp { width: 10px; height: 10px; margin-right: 7px; }
.dist-chips li.s-error { border-color: var(--border-err); background: var(--tint-err); color: var(--error); font-weight: 700; }
.dist-chips li.s-warning { border-color: var(--border-warn); background: var(--tint-warn); }
.dist-chips li:active { background: var(--press); }

/* --- Unterverteilungen ----------------------------------------------------------- */
.dist-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.dist-list li {
  display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 12px;
  border: 1px solid var(--line); border-left: 4px solid var(--off); border-radius: 4px; background: var(--card);
  font-size: 18px; cursor: pointer;
}
.dist-list li.s-ok { border-left-color: var(--ok); }
.dist-list li.s-error { border-left-color: var(--error); background: var(--tint-err); }
.dist-list li.s-warning { border-left-color: var(--warning); background: var(--tint-warn); }
.dist-list li:active { background: var(--soft); }

/* --- Leuchten -------------------------------------------------------------------- */
.toolbar { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.seg { display: flex; border: 1px solid var(--border-strong); border-radius: 3px; overflow: hidden; }
.seg button {
  height: 36px; min-width: 64px; padding: 0 12px;
  border: 0; border-right: 1px solid var(--border-strong);
  background: var(--card); color: var(--grau);
  font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
}
.seg button:last-child { border-right: 0; }
.seg button.active { background: var(--fill-strong); color: var(--on-strong); }

.circuits { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.circuit { display: flex; flex-direction: column; gap: 3px; }
.circuit-head { display: flex; align-items: center; gap: 8px; font-size: 15px; height: 20px; }
.circuit-head .lamp { width: 10px; height: 10px; }
.circuit-head b { color: var(--text); }
.circuit-head .va { color: var(--muted); font-size: 13px; margin-left: auto; font-variant-numeric: tabular-nums; }
.slots { display: grid; grid-template-columns: repeat(20, 1fr); gap: 3px; }
.slot {
  height: 30px; border-radius: 2px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-variant-numeric: tabular-nums;
  background: var(--card); border: 1px dashed var(--border-strong); color: var(--faint);
}
.slot.s-ok { background: var(--ok); border: 0; color: #fff; }
.slot.s-error { background: var(--error); border: 0; color: #fff; font-weight: 700; }
.slot.s-warning, .slot.s-ballast_error { background: var(--warning); border: 0; color: #fff; }
.slot.s-active { background: var(--tint-active); border: 1px solid var(--active); color: var(--active); }

/* --- Werkzeuge, Prüfbuch, Archiv ------------------------------------------------ */
.pager { display: flex; align-items: center; gap: 6px; }
.pager[hidden] { display: none; }
.tool {
  height: 36px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: 3px;
  background: var(--card); color: var(--grau);
  font: inherit; font-size: 15px; cursor: pointer;
}
.tool:active { background: var(--soft); }
.tool.icon { width: 42px; padding: 0; font-size: 15px; }
.tool:disabled { opacity: .35; cursor: default; }
.tool.on { border-color: var(--grau); color: var(--text); font-weight: 700; box-shadow: inset 0 -2px 0 var(--rot); }
.tool.primary { background: var(--rot); border-color: var(--rot); color: #fff; font-weight: 700; }
.tool.primary:active { background: var(--rot-dunkel); }
select.tool { padding: 0 8px; }
.page { min-width: 54px; text-align: center; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.seg.small button { min-width: 0; height: 36px; font-size: 14px; }
.toolbar > .tool { flex: none; }

.book-body { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.filter-panel {
  position: absolute; inset: 0;
  background: var(--card);
  display: flex; flex-direction: column; gap: 10px;
  padding: 4px 2px;
}
.filter-panel[hidden] { display: none; }
.filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.filter-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--muted); }
.filter-grid select, .filter-grid input {
  height: 38px; padding: 0 8px;
  border: 1px solid var(--border-strong); border-radius: 3px;
  font: inherit; font-size: 15px; color: var(--text); background: var(--card);
}
.filter-actions { margin-top: auto; display: flex; justify-content: flex-end; gap: 8px; }

.months { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 2px; }
.months button {
  height: 50px; border: 1px solid var(--line); border-radius: 3px; background: var(--soft);
  font: inherit; font-size: 16px; color: var(--grau); cursor: pointer;
}
.months button:active { background: var(--press); }
.archive-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; font-size: 15px; }

/* Überschrift mit Verweis auf die vollständige Originalseite */
h2 .more + .more { margin-right: 6px; }
h2 .more {
  float: right; margin: -4px 0 0; height: 24px; padding: 0 9px;
  border: 1px solid var(--line); border-radius: 3px; background: var(--card); color: var(--grau);
  font: inherit; font-size: 11px; font-weight: 700; letter-spacing: .05em; cursor: pointer;
}

/* --- Tests ------------------------------------------------------------------------ */
#view-tests { display: flex; gap: 12px; }
.test-list { list-style: none; margin: 0; width: 220px; flex: none; display: flex; flex-direction: column; gap: 6px; padding: 10px; }
.test-list button {
  width: 100%; min-height: 58px; padding: 6px 10px; text-align: left;
  border: 1px solid var(--line); border-left: 4px solid transparent; border-radius: 3px; background: var(--soft);
  font: inherit; font-size: 15px; color: var(--grau); cursor: pointer;
}
.test-list button.active { background: var(--card); border-color: var(--line); border-left-color: var(--rot); color: var(--text); font-weight: 700; }
.test-detail { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.test-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.test-detail h3 { margin: 0; font-size: 19px; color: var(--text); }
.test-detail p { margin: 0; font-size: 14px; color: var(--grau); line-height: 1.3; }
.test-values {
  margin: 0; display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 3px 10px;
  font-size: 14px; align-items: baseline;
}
.test-values dt { color: var(--muted); }
.test-values dd { margin: 0; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.test-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 5px; }
.test-chips li { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 3px; background: var(--soft); font-size: 13px; }
.test-chips .lamp { width: 10px; height: 10px; }
.test-start { flex: none; display: flex; align-items: center; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.test-start .hint { margin: 0; font-size: 13px; }
.test-start .tool.big { font-size: 16px; padding: 0 16px; white-space: nowrap; }
.test-start > .tool + .tool { margin-left: 8px; }
.test-running { display: flex; align-items: center; padding: 10px 12px; border-left: 4px solid var(--active); border-radius: 3px; background: var(--tint-active); color: var(--active); font-size: 16px; }
.test-running .lamp { background: var(--active); margin-right: 9px; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .35; } }
.notice { padding: 10px 12px; border-left: 4px solid var(--warning); border-radius: 3px; background: var(--tint-warn); color: var(--text-warn); font-size: 15px; }

/* --- Listen ----------------------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: 15px; }
.list td, .list th { padding: 6px 6px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.list th { position: sticky; top: 0; background: var(--card); color: var(--muted); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
td.no { width: 30px; color: var(--muted); text-align: right; }
td.time { width: 138px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
td.loc { width: 54px; color: var(--muted); }
.book { font-size: 14px; }
.book td, .book th { padding-top: 4px; padding-bottom: 4px; }
.book td.no { width: 42px; }
.book td.type { width: 66px; color: var(--muted); }
.book td.vals { width: 168px; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--grau); }

.kv td { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 16px; }
.kv td:first-child { width: 170px; color: var(--muted); }

/* --- Navigation rechts: 88 px, 6 Tasten à 64 px + Verbindung ------------------------ */
.rail { width: 88px; flex: none; display: flex; flex-direction: column; background: var(--card); border-left: 1px solid var(--line); }
.rail button {
  position: relative;
  height: 64px;
  border: 0; border-bottom: 1px solid var(--line); border-left: 3px solid transparent;
  background: none; color: var(--grau);
  font: inherit; font-size: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  cursor: pointer;
}
.rail button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.rail button.active { background: var(--soft); border-left-color: var(--rot); color: var(--text); font-weight: 700; }
.rail button:active { background: var(--press); }
.badge {
  position: absolute; top: 7px; right: 16px;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--error); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.badge[hidden] { display: none; }

.conn { margin-top: auto; display: flex; align-items: center; justify-content: center; gap: 6px; height: 32px; font-size: 11px; color: var(--muted); }
.conn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--off); }
.conn.online .dot { background: var(--ok); }
.conn.offline .dot { background: var(--error); }
.conn.offline { color: var(--error); font-weight: 700; }

.stale main { opacity: .5; }

/* Aktionsleiste unter einer Liste */
.view-actions { display: flex; justify-content: flex-end; padding-top: 8px; }
.view-actions[hidden] { display: none; }
.view-actions > * + * { margin-left: 8px; }
.tool.big { height: 46px; padding: 0 26px; font-size: 18px; }

/* --- Dialoge ---------------------------------------------------------------------- */
.modal {
  position: absolute; inset: 0; z-index: 10;
  background: var(--backdrop);
  display: flex; align-items: center; justify-content: center;
}
.modal[hidden] { display: none; }
.dialog {
  width: 380px; background: var(--card); border-radius: 4px; padding: 16px 20px;
  border-top: 3px solid var(--rot);
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.3);
}
.dialog h2 { font-size: 13px; margin: 0; color: var(--text); }
.dialog p { margin: 0; font-size: 16px; line-height: 1.35; }
.dialog label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.dialog select, .dialog input {
  height: 40px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: 3px;
  font: inherit; font-size: 17px; color: var(--text); background: var(--card);
}
.dialog-error { min-height: 18px; color: var(--error); font-size: 14px; font-weight: 700; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dialog-actions .tool { height: 42px; min-width: 110px; font-size: 16px; }
.dialog-actions .spacer { flex: 1; }
.dialog-note { font-size: 14px !important; color: var(--grau); background: var(--tint-warn); border-left: 3px solid var(--warning); padding: 6px 10px; }
.dialog-note[hidden] { display: none; }
#confirm-modal.danger .dialog { border-top-color: var(--error); }
#confirm-modal.danger #confirm-ok { background: var(--error); border-color: var(--error); }

/* Datum und Uhrzeit */
.dialog.wide { width: 470px; }
.clock-now { font-size: 15px; }
.clock-now b { font-size: 18px; font-variant-numeric: tabular-nums; margin-left: 6px; }
/* Drehräder: 5 Zeilen à 36 px, die mittlere ist gewählt (Band), oben/unten ausgeblendet */
.wheels { position: relative; display: flex; justify-content: center; align-items: center; height: 180px; border-radius: 4px; background: var(--card); overflow: hidden; }
.wheels::before { content: ""; position: absolute; left: 6px; right: 6px; top: 72px; height: 36px; border-radius: 4px; background: var(--soft); border: 1px solid var(--line); }
.wheels::after { content: ""; position: absolute; left: 0; right: 0; top: 0; bottom: 0; pointer-events: none;
  background: linear-gradient(to bottom, var(--card) 0%, transparent 32%, transparent 68%, var(--card) 100%); }
.wheel { position: relative; width: 58px; height: 180px; overflow: hidden; cursor: grab; touch-action: none; }
.wheel.wide { width: 128px; }
.wheel ul { list-style: none; margin: 0; padding: 0; }
.wheel li { height: 36px; line-height: 36px; text-align: center; font-size: 19px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.wheel li.sel { color: var(--text); font-weight: 700; font-size: 21px; }
.wheel-gap { width: 26px; }
.wheel-colon { position: relative; z-index: 1; font-size: 22px; font-weight: 700; color: var(--text); width: 10px; text-align: center; }
.clock-tz { flex-direction: row !important; align-items: center; }
.clock-tz select { flex: 1; min-width: 0; margin-left: 10px; height: 36px !important; font-size: 15px !important; }

/* Kurze Rückmeldung */
.toast {
  position: absolute; left: 50%; bottom: 14px; z-index: 30;
  max-width: 560px; transform: translateX(-50%);
  padding: 10px 16px; border-radius: 3px; border-left: 4px solid var(--off);
  background: var(--fill-strong); color: var(--on-strong); font-size: 15px;
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
}
.toast[hidden] { display: none; }
.toast.ok { border-left-color: #6fcf7c; }
.toast.error { border-left-color: #ff7a6b; }

/* --- Bildschirmtastatur: unten auf der 800×480-Fläche, 250 px hoch ------------------- */
.osk {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 20;
  height: 250px; padding: 6px;
  background: #2b2c2f;
  display: flex; flex-direction: column; gap: 5px;
  box-shadow: 0 -4px 16px rgba(0,0,0,.35);
}
.osk[hidden] { display: none; }
.osk-echo {
  height: 30px; flex: none;
  display: flex; align-items: center; gap: 10px;
  padding: 0 10px; border-radius: 3px; background: var(--card);
}
.osk-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.osk-value { flex: 1; font-size: 17px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .02em; }
.osk-value.empty { color: #b0b4b9; font-style: italic; }
.osk-row { flex: 1; display: flex; gap: 5px; }
.osk-key {
  flex: 1; min-width: 0;
  border: 0; border-radius: 3px;
  background: #4a4c50; color: #fff;
  font: inherit; font-size: 19px;
  cursor: pointer; touch-action: manipulation;
}
.osk-key:active { background: var(--rot); }
.osk-back, .osk-shift, .osk-sym, .osk-abc, .osk-close { background: #38393c; font-size: 15px; }
.osk-back { flex: 1.4; font-size: 20px; }
.osk-shift.on { background: #6b6d71; }
.osk-space { flex: 5; font-size: 14px; color: #c9cbce; }
.osk-sym, .osk-abc, .osk-close { flex: 1.6; }
.osk-enter { flex: 1.8; background: var(--rot); font-weight: 700; }

/* Bei offener Tastatur Dialoge nach oben schieben und kompakter machen */
.osk-open .modal { align-items: flex-start; padding-top: 8px; }
.osk-open .dialog { padding: 10px 16px; gap: 6px; }
.osk-open .dialog-actions { display: none; }
.osk-open .filter-actions { display: none; }

/* --- Menü: alle Seiten, Karten je Gruppe in drei Spalten ----------------------------- */
#view-menu { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.menu-grid { display: flex; flex-wrap: wrap; align-items: flex-start; }
.menu-card {
  width: calc(33.333% - 7px); margin: 0 10px 10px 0; padding: 8px 0 4px;
  background: var(--card); border: 1px solid var(--line); border-radius: 4px;
}
.menu-card:nth-child(3n) { margin-right: 0; }
.menu-card h3 {
  margin: 0 0 4px; padding: 0 10px 0 8px; border-left: 4px solid var(--rot);
  font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--text);
}
.menu-item {
  width: 100%; min-height: 38px; padding: 4px 12px;
  display: flex; flex-direction: column; justify-content: center; text-align: left;
  border: 0; border-top: 1px solid var(--line); background: none;
  font: inherit; font-size: 15px; color: var(--text); cursor: pointer;
}
.menu-item:active { background: var(--soft); }
.menu-item small { font-size: 11px; color: var(--muted); }
.menu-item.locked { color: var(--faint); }

/* --- Seite der Anlage (Seitenmotor) ------------------------------------------------- */
.page-view { padding: 8px 10px; }
.page-head { flex: none; display: flex; align-items: center; margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--line); min-width: 0; }
.page-head > * + * { margin-left: 8px; }
.page-head .tool.icon { width: 38px; height: 32px; flex: none; }
.page-title { flex: none; max-width: 230px; max-height: 38px; font-size: 17px; font-weight: 700; line-height: 1.1; color: var(--text); overflow: hidden; }
.page-tabs { flex: 1; min-width: 0; display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.page-tabs::-webkit-scrollbar { display: none; }
.page-tabs button {
  flex: none; height: 30px; margin-right: 2px; padding: 0 10px;
  border: 0; border-bottom: 2px solid transparent; background: none;
  font: inherit; font-size: 14px; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.page-tabs button.active { border-bottom-color: var(--rot); color: var(--text); font-weight: 700; }
.page-tabs button.locked { color: var(--faint); }
.page-host { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.locked-page { margin: auto; text-align: center; color: var(--grau); }
.locked-page b { font-size: 19px; }
.locked-page p { margin: 8px 0 14px; font-size: 16px; }

/* Inhalt des Seitenmotors: Original-Struktur, eigene Gestaltung. Zeilen (Text + Eingaben)
   nebeneinander, Blöcke untereinander; Zustände (Level) farbig */
.e-page { font-size: 15px; color: var(--text); }
.e-tools { flex: none; display: flex; flex-wrap: wrap; justify-content: flex-end; margin-bottom: 4px; }
.e-tools > * { margin-left: 6px; }
.e-body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; padding-right: 2px; }
.e-page .e-row { display: flex; flex-wrap: wrap; align-items: center; }
.e-page .e-row > * { margin: 2px 8px 2px 0; }
.e-page .e-col > * + * { margin-top: 4px; }
.e-page .e-btnbar { padding: 2px 0 6px; }
.e-page .e-hide { display: none !important; }
.e-page [hidden] { display: none !important; }
.e-page span:empty, .e-page div:empty:not(.e-btn):not(.e-dot) { display: none; }

.e-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 36px; min-width: 42px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: 3px; background: var(--card); color: var(--grau);
  font-size: 15px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.e-btn * { margin: 0 !important; }
.e-page .e-btn { display: inline-flex; flex: none; }
.e-page .e-row.e-field { flex-wrap: nowrap; }
/* Beschriftung: feste Spalte, darf umbrechen – die Anlage trennt mit geschützten Leerzeichen */
.e-page .e-field > :first-child { flex: 0 0 34%; max-width: 230px; color: var(--grau); white-space: normal; word-wrap: break-word; overflow-wrap: break-word; overflow-wrap: anywhere; }
.e-page .e-field > :first-child + * { flex: 0 1 auto; min-width: 0; }

/* Nichts darf seitlich aus Seite oder Fenster ragen: Elemente schrumpfen statt überzulaufen,
   Felder mit fester Breite (size=…) höchstens so breit wie ihr Platz, Text bricht um */
.e-page .e-row > *, .e-page .e-col > * { min-width: 0; max-width: 100%; }
.e-page span, .e-page label, .e-page div { word-wrap: break-word; overflow-wrap: break-word; overflow-wrap: anywhere; }
/* in Tabellen nur sehr lange Wörter trennen (sonst brechen Zahlen und Spalten werden zu schmal) */
.e-page td, .e-page th { word-wrap: break-word; overflow-wrap: break-word; }
.e-page td span, .e-page th span, .e-page td div { word-wrap: break-word; overflow-wrap: break-word; }
.e-page input:not([type=checkbox]):not([type=radio]), .e-page select, .e-page textarea { box-sizing: border-box; max-width: 100%; min-width: 0; }
.e-table td input:not([type=checkbox]):not([type=radio]), .e-table td select { width: 100%; }
.e-page .e-table td input[type=text] { padding: 0 6px; }
.e-btn { max-width: 100%; }
.e-btn:not(.e-icon) { white-space: normal; text-align: center; line-height: 1.15; padding-top: 4px; padding-bottom: 4px; }
.e-overlay { overflow-x: hidden; }
.e-btn:active { background: var(--soft); }
.e-btn.e-ctl { border-color: var(--grau); color: var(--text); }
.e-btn.e-ctl:active { background: var(--fill-strong); color: var(--on-strong); }
.e-btn.e-danger { border-color: var(--error); color: var(--error); }
.e-btn[data-st="inactive"], .e-btn[data-st="forbidden"] { opacity: .35; pointer-events: none; }
.e-btn.e-busy { opacity: .6; pointer-events: none; }
.e-btn.e-icon { min-width: 36px; min-height: 32px; padding: 0 8px; font-size: 16px; color: var(--grau); }
.e-btn.e-icon-del { color: var(--error); }
/* Bildtasten mit Beschriftung (Schalter): Zustand als Streifen links */
.e-btn.e-tile { min-width: 150px; min-height: 48px; justify-content: flex-start; padding: 0 14px 0 11px; border-left: 4px solid var(--off); font-weight: 400; color: var(--text); }
.e-btn.e-tile[data-st="ok"], .e-btn.e-tile[data-st="active"] { border-left-color: var(--ok); font-weight: 700; }
.e-btn.e-tile[data-st="active"] { border-left-color: var(--active); }
.e-btn.e-tile[data-st="err"] { border-left-color: var(--error); background: var(--tint-err); }
.e-btn.e-tile[data-st="warn"] { border-left-color: var(--warning); background: var(--tint-warn); }
.e-table .e-btn.e-icon { border-color: var(--line); }
.e-link { color: var(--rot); text-decoration: underline; cursor: pointer; }
div.e-link, td.e-link, li.e-link { text-decoration: none; border-radius: 3px; }
div.e-link:active, td.e-link:active { background: var(--soft); }
.e-btnbar div.e-link { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border: 1px solid var(--border-strong); font-weight: 700; color: var(--grau); }
.e-btnbar div.e-link::after { content: " ›"; margin-left: 4px; color: var(--muted); }

.e-page input:not([type=checkbox]):not([type=radio]), .e-page select {
  height: 36px; padding: 0 8px; max-width: 100%;
  border: 1px solid var(--border-strong); border-radius: 3px; background: var(--card);
  font: inherit; font-size: 15px; color: var(--text);
}
.e-page input[type=checkbox], .e-page input[type=radio] { width: 22px; height: 22px; }
.e-page select[multiple] { height: auto; }
.e-page textarea { font: inherit; border: 1px solid var(--border-strong); border-radius: 3px; }

.e-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.e-table td, .e-table th { padding: 5px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.e-table th { color: var(--muted); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.e-table tr[data-st="err"] td { background: var(--tint-err); }
.e-table tr[data-st="warn"] td { background: var(--tint-warn); }
.e-table tr[data-st="active"] td { background: var(--tint-active); }

/* Zustandsfarben (Level der Anlage) für Texte, Felder und Punkte */
/* Grün/Grau nicht für ganze Tabellenzeilen und -zellen: das Original stellt dort LO und LN gleich dar */
.e-page [data-st="ok"]:not(.e-btn):not(tr):not(td) { color: var(--ok); }
.e-page [data-st="err"]:not(.e-btn):not(tr) { color: var(--error); font-weight: 700; }
.e-page [data-st="warn"]:not(.e-btn):not(tr) { color: var(--text-warn); font-weight: 700; }
.e-page [data-st="active"]:not(.e-btn):not(tr) { color: var(--active); font-weight: 700; }
.e-page [data-st="missing"]:not(.e-btn):not(tr):not(td), .e-page [data-st="neutral"]:not(.e-btn):not(tr):not(td) { color: var(--muted); }
.e-table [data-st="ok"]:not(.e-btn):not(.e-dot), .e-table [data-st="neutral"]:not(.e-btn):not(.e-dot) { color: inherit; }
.e-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: var(--off); vertical-align: middle; }
.e-dot[data-st="ok"] { background: var(--ok); }
.e-dot[data-st="err"] { background: var(--error); }
.e-dot[data-st="warn"] { background: var(--warning); }
.e-dot[data-st="active"] { background: var(--active); }
.e-dot[data-st="inactive"], .e-dot[data-st="missing"], .e-dot[data-st="neutral"] { background: transparent; border: 2px solid var(--off); }
.e-raw { margin: 0; font-size: 12px; white-space: pre-wrap; }

/* Eingabefenster der Anlage als Dialog über der Seite */
.e-overlay {
  position: absolute; z-index: 5; left: 4%; right: 4%; top: 4px;
  max-height: calc(100% - 8px); overflow-y: auto;
  padding: 14px 16px 12px; border-radius: 4px; border-top: 3px solid var(--rot);
  background: var(--card); box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.e-has-overlay::before { content: ""; position: absolute; left: -10px; right: -10px; top: -46px; bottom: -8px; z-index: 4; background: rgba(24, 26, 29, .45); }
.e-x { position: absolute; right: 6px; top: 4px; width: 34px; height: 34px; border: 0; background: none; font-size: 24px; color: var(--muted); cursor: pointer; }
.osk-open .e-overlay { top: 0; max-height: 200px; }

/* Kopfzeilen-Tasten: Schriftstärke gegen ".topbar button { font: inherit }" */
.topbar .sys-status, .topbar .user-btn { font-weight: 700; }

/* Dunkelmodus: Logo (dunkle Schrift) auf heller Platte, Zustandspunkte etwas heller */
.dark .logo-btn { background: #f2f3f4; margin: 0 4px; height: 40px; }
.dark .logo-btn:active { background: #dfe2e5; }
.dark .slot { background: var(--soft); }
.dark .e-page input:not([type=checkbox]):not([type=radio]), .dark .e-page select, .dark .dialog select, .dark .dialog input,
.dark .filter-grid select, .dark .filter-grid input, .dark select.tool { color-scheme: dark; }

/* Darstellung (Info) */
.theme-seg { flex: none; align-self: flex-start; margin-top: 2px; }
#view-info { overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* --- Auswahllisten und Zeitpunkt-Felder: einheitlich, ohne Browser-Optik ----------- */
/* Pfeil bzw. Kalender als Hintergrundbild (alte Browser: -webkit-appearance) */
select:not([multiple]) {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  padding-right: 30px !important; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2373777d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important; background-position: right 10px center !important; background-size: 12px 8px !important;
}
select::-ms-expand { display: none; }
select:focus, input[data-dt]:focus { outline: none; border-color: var(--rot) !important; }
select:disabled { opacity: .5; cursor: default; }
input[data-dt] {
  cursor: pointer; padding-right: 32px !important; caret-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cg fill='none' stroke='%2373777d' stroke-width='1.6'%3E%3Crect x='1.5' y='2.5' width='13' height='12' rx='1.5'/%3E%3Cpath d='M1.5 6.5h13M5 1v3M11 1v3'/%3E%3C/g%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important; background-position: right 9px center !important; background-size: 16px 16px !important;
}
.e-page input[data-dt] { width: 100%; min-width: 12.5em; font-size: 14px; }
/* In Tabellenköpfen bestimmt das Feld die Spaltenbreite (max-width in % ließe die Spalte zu schmal) */
.e-page .e-table td input[data-dt] { max-width: none; min-width: 15em; font-size: 13px; }
.dark select:not([multiple]) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23b4b9bf' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
}
.dark input[data-dt] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cg fill='none' stroke='%23b4b9bf' stroke-width='1.6'%3E%3Crect x='1.5' y='2.5' width='13' height='12' rx='1.5'/%3E%3Cpath d='M1.5 6.5h13M5 1v3M11 1v3'/%3E%3C/g%3E%3C/svg%3E") !important;
}
.dt-quick { display: flex; }
.dt-quick > * + * { margin-left: 6px; }
.dt-quick .tool { flex: 1; min-width: 0; height: 36px; padding: 0 2px; font-size: 13px; white-space: nowrap; }
#dt-modal .wheels { margin: 2px 0; }
/* Auswahllisten in Tabellenköpfen (Filter "Alle"): Platz für Text und Pfeil */
.e-table td select:not([multiple]) { min-width: 70px; }
/* Mehrere Felder in einer Zeile (Seitenmotor, z. B. Serviceeintrag): Beschriftung über dem Feld */
.e-page .e-row.e-pairs { flex-wrap: wrap; align-items: flex-start; }
.e-page .e-pair { flex: 1 1 130px; display: flex; flex-direction: column; padding: 0 10px 8px 0; min-width: 0; margin: 0 !important; }
.e-page .e-pair:last-child { padding-right: 0; }
.e-page .e-pair > :first-child { margin: 0 0 3px !important; font-size: 13px; color: var(--muted); }
.e-page .e-pair > select, .e-page .e-pair > input { width: 100%; }
/* Einzelnes Textfeld in einem Eingabefenster: volle Breite */
.e-overlay .e-row > input[type=text]:only-child { width: 100%; }

/* ================================================================================
   Neue Optik (Entscheidungsbaum): Kopfzeile mit Home und Pfad, Start mit Zustand und
   Kacheln, Bereiche als Kachelebenen. Sammelstörung = Taste oben + rot leuchtender
   Hintergrund. Für Chrome 39: kein grid, kein gap, kein inset.
   ================================================================================ */

/* --- Kopfzeile -------------------------------------------------------------------- */
.topbar { position: relative; z-index: 2; padding: 0 6px 0 4px; box-shadow: none; border-bottom: 1px solid var(--line); }
.dark .topbar { background: #1b1d20; border-bottom-color: #34383d; }
.logo-btn { padding: 0 8px; }
.dark .logo-btn { margin: 0; height: 38px; padding: 0 8px; background: #f2f3f4; border-radius: 4px !important; }
.home-btn {
  width: 46px; height: 42px; flex: none; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line) !important; border-radius: 4px !important;
}
.home-btn svg { width: 24px; height: 24px; fill: none; stroke: var(--grau); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.home-btn.active { border-color: var(--ok) !important; }
.home-btn.active svg { stroke: var(--ok); }
.crumbs { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; align-content: center; height: 46px; overflow: hidden; font-size: 16px; line-height: 1.15; }
.crumbs button { padding: 2px 4px !important; color: var(--muted) !important; font-size: inherit !important; }
.crumbs b { padding: 2px 4px; color: var(--text); font-weight: 700; }
.crumbs .sep { color: var(--faint); margin: 0 1px; }
.clock { position: relative; }
.clock .conn { display: block; font-size: 10px; line-height: 1; font-weight: 700; }
.clock .conn .dot { display: none; }
.clock .conn.offline { color: var(--error); }
.sys-status { height: 40px; max-width: 170px; font-size: 14px !important; }
.sys-status.s-ok { border-color: var(--ok) !important; color: var(--ok) !important; }
.sys-status.s-error { background: var(--error) !important; border-color: var(--error) !important; color: #fff !important; }
.sys-status.s-error .lamp { background: #fff; }
.user-btn { height: 40px; }

/* --- Inhalt ohne Seitenleiste ------------------------------------------------------ */
main { padding: 10px; position: relative; z-index: 1; }
.page-title { display: none; }

/* --- Start ------------------------------------------------------------------------- */
#view-overview { display: flex; }
.land-left { width: 290px; flex: none; display: flex; flex-direction: column; }
.land-right { flex: 1; min-width: 0; margin-left: 12px; display: flex; flex-direction: column; }
.state-card {
  flex: none; display: flex; align-items: center; width: 100%; height: 118px; padding: 0 16px;
  background: var(--card); border: 1px solid var(--line); border-left: 8px solid var(--off); border-radius: 6px;
  font: inherit; text-align: left; cursor: pointer; color: var(--text);
}
.state-card:active { background: var(--press); }
.state-icon { width: 52px; height: 52px; flex: none; border-radius: 50%; margin-right: 14px; position: relative; background: var(--off); }
.state-text { min-width: 0; display: flex; flex-direction: column; }
.state-title { font-size: 26px; font-weight: 700; line-height: 1.1; }
.state-sub { font-size: 14px; color: var(--muted); margin-top: 5px; line-height: 1.2; }
.state-card.s-ok { border-left-color: var(--ok); }
.state-card.s-ok .state-icon { background: var(--ok); }
.state-card.s-ok .state-icon::after { content: ""; position: absolute; left: 19px; top: 10px; width: 11px; height: 23px; border: solid #fff; border-width: 0 4px 4px 0; transform: rotate(45deg); }
.state-card.s-warning { border-left-color: var(--warning); }
.state-card.s-warning .state-icon { background: var(--warning); }
.state-card.s-error { background: var(--error); border-color: var(--error); color: #fff; }
.state-card.s-error .state-sub { color: rgba(255, 255, 255, .9); }
.state-card.s-error .state-icon { background: #fff; }
.state-card.s-error .state-icon::after, .state-card.s-warning .state-icon::after { content: "!"; position: absolute; left: 0; right: 0; top: 5px; text-align: center; font-size: 36px; font-weight: 700; color: var(--error); line-height: 1.1; }
.state-card.s-warning .state-icon::after { color: #fff; }

.modes { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; }
.modes li {
  display: flex; align-items: center; height: 34px; padding: 0 12px; margin: 0 6px 6px 0;
  border: 1px solid var(--line); border-radius: 17px; background: var(--card); font-size: 15px; font-weight: 700;
}
.modes li .lamp { width: 10px; height: 10px; margin-right: 8px; }
.modes li.s-warning { border-color: var(--warning); color: var(--text-warn); }
.modes li.s-active { border-color: var(--active); color: var(--active); }

.battery { margin-top: 4px; flex: 1; min-height: 0; padding: 4px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 6px; display: flex; flex-direction: column; justify-content: space-around; }
.battery .measure { padding: 4px 0; }
.battery .measure .label { font-size: 14px; color: var(--muted); }
.battery .measure .label::before { content: "Batterie"; }
.battery .measure .value { font-size: 24px; }

.land-head { flex: none; height: 52px; margin-bottom: 8px; display: flex; flex-direction: column; justify-content: center; }
.land-head .project-name { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.15; }
.land-head .last-msg { display: block; width: 100%; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; font: inherit; font-size: 12px; color: var(--muted); line-height: 1.2; }
.land-head .last-msg::before { content: "Letzte Meldung: "; color: var(--faint); }

/* --- Kacheln (Start und jede Ebene des Baums) --------------------------------------- */
.node-tiles { display: flex; flex-wrap: wrap; align-content: flex-start; margin: -5px; }
.node-tile {
  position: relative; width: calc(50% - 10px); height: 82px; margin: 5px; padding: 0 12px;
  display: flex; align-items: center; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: 6px; color: var(--text);
  font: inherit; cursor: pointer;
}
.node-tiles.big .node-tile { width: calc(33.333% - 10px); height: 96px; }
.node-tile:active { background: var(--press); border-color: var(--ok); }
.nt-icon { width: 44px; height: 44px; flex: none; margin-right: 12px; border-radius: 50%; background: var(--soft); display: flex; align-items: center; justify-content: center; }
.nt-icon svg { width: 24px; height: 24px; fill: none; stroke: var(--ok); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nt-text { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.nt-title { font-size: 18px; font-weight: 700; line-height: 1.15; }
.nt-sub { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.2; }
.nt-badge { position: absolute; right: 8px; top: 8px; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; background: var(--error); color: #fff; font-size: 13px; line-height: 24px; text-align: center; }
.node-tile.bad .nt-icon svg { stroke: var(--error); }
.node-tile.login-tile { border-style: dashed; background: transparent; }
.node-tile.login-tile .nt-icon svg { stroke: var(--muted); }
#view-node { overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* --- Sammelstörung: rot leuchtender Hintergrund (ruhig, ohne Blinken) -------------- */
.fault-glow { display: none; position: absolute; left: 0; top: 0; right: 0; bottom: 0; z-index: 9; pointer-events: none; box-shadow: inset 0 0 0 4px var(--error), inset 0 0 70px 14px rgba(239, 75, 75, .55); }
#screen.fault .fault-glow { display: block; }
#screen.fault { background: #4a1c21; background-image: radial-gradient(ellipse at center, #3a1d20 0%, #5a1c22 70%, #6e1d25 100%); }
:root:not(.dark) #screen.fault { background: #f6d6d6; background-image: radial-gradient(ellipse at center, #fbeaea 0%, #f3c4c4 70%, #eba9a9 100%); }
/* Start: Projektname steht im Pfad oben – hier nur die letzte Meldung; 4 Kachelreihen passen */
.land-head { height: auto; min-height: 30px; margin-bottom: 6px; }
.land-head .project-name { display: none; }
#home-tiles .node-tile { height: 81px; }
.battery { justify-content: center; }
.battery .measure { padding: 8px 0; }
#view-node { overflow-x: hidden; padding: 5px; }
#view-node .node-tiles { margin: 0 -5px; }
/* Zustand in einer Zeile: passt er nicht, verkleinert fitText die Schrift (nie trennen) */
.state-title { white-space: nowrap; }
.state-card { padding: 0 12px; }
.state-icon { width: 44px; height: 44px; margin-right: 12px; }
.state-card.s-ok .state-icon::after { left: 16px; top: 8px; width: 9px; height: 19px; }
.state-card.s-error .state-icon::after, .state-card.s-warning .state-icon::after { top: 4px; font-size: 30px; }
.state-text { flex: 1; overflow: hidden; }

/* ================================================================================
   Chipsee-Display: 1024 × 600 echte Pixel (diag.js setzt zoom 1/Pixelverhältnis).
   Ein CSS-Pixel ist hier physisch 20 % kleiner als im Browser-Standard – Schriften und
   Tippflächen daher größer, damit sie am 7-Zoll-Panel gut lesbar und bedienbar bleiben.
   ================================================================================ */
body { font-size: 17px; }
.topbar { height: 64px; }
.logo { height: 28px; }
.dark .logo-btn { height: 46px; }
.home-btn { width: 56px; height: 50px; }
.home-btn svg { width: 28px; height: 28px; }
.crumbs { height: 56px; font-size: 19px; }
.sys-status { height: 48px; max-width: 220px; font-size: 17px !important; padding: 0 14px 0 12px !important; }
.sys-status .lamp { width: 12px; height: 12px; }
.user-btn { height: 48px; font-size: 16px !important; padding: 0 14px !important; }
.clock { height: 56px; }
#clock-time { font-size: 23px; }
#clock-date { font-size: 14px; }

main { padding: 12px; }
.land-left { width: 370px; }
.land-right { margin-left: 14px; }
.state-card { height: 140px; padding: 0 18px; }
.state-icon { width: 58px; height: 58px; margin-right: 16px; }
.state-card.s-ok .state-icon::after { left: 21px; top: 11px; width: 12px; height: 25px; border-width: 0 5px 5px 0; }
.state-card.s-error .state-icon::after, .state-card.s-warning .state-icon::after { top: 4px; font-size: 42px; }
.state-title { font-size: 32px; }
.state-sub { font-size: 17px; }
.modes { margin-top: 12px; }
.modes li { height: 42px; padding: 0 16px; border-radius: 21px; font-size: 18px; }
.modes li .lamp { width: 12px; height: 12px; }
.battery { padding: 6px 18px; }
.battery .measure .label { font-size: 17px; }
.battery .measure .value { font-size: 32px; }
.land-head { min-height: 34px; margin-bottom: 8px; }
.land-head .last-msg { font-size: 15px; }

.node-tile { padding: 0 16px; }
#home-tiles .node-tile { height: 104px; }
.node-tiles.big .node-tile { height: 120px; }
.nt-icon { width: 56px; height: 56px; margin-right: 14px; }
.nt-icon svg { width: 30px; height: 30px; }
.nt-title { font-size: 22px; }
.nt-sub { font-size: 15px; margin-top: 4px; }
.nt-badge { min-width: 30px; height: 30px; line-height: 30px; border-radius: 15px; font-size: 16px; }

/* Ansichten und Originalseiten */
.tool { min-height: 44px; font-size: 16px; }
.e-btn { min-height: 44px; font-size: 16px; }
.e-page { font-size: 16px; }
.e-page input:not([type=checkbox]):not([type=radio]), .e-page select { height: 42px; font-size: 16px; }
.e-table { font-size: 16px; }
.e-table th { font-size: 13px; }
.list td { font-size: 16px; }
h2 { font-size: 14px; }
.dialog h2 { font-size: 15px; }
.dialog-actions .tool { height: 50px; font-size: 18px; }

/* ================================================================================
   Reduzierte Startseite (Chipsee): Informationszeile, breite Reiter, Batterie links,
   aktuelle Meldungen als größtes Element, Anmelden einmal unten rechts.
   ================================================================================ */
.topbar { height: 58px; }
.back-btn[hidden] { display: none; }
.crumbs { font-size: 17px; }

/* Betriebsinfo: „i“ im Normalbetrieb, „!“ wenn Ersatzbetrieb, Test oder Dauerlicht */
.ops-btn {
  height: 46px; flex: none; max-width: 230px; display: flex; align-items: center; padding: 0 12px 0 8px !important;
  border: 1px solid var(--line) !important; border-radius: 4px !important; font-size: 16px !important; font-weight: 700; text-align: left;
}
.ops-icon {
  width: 28px; height: 28px; flex: none; margin-right: 8px; border-radius: 50%;
  border: 2px solid var(--muted); color: var(--muted); font: 700 17px/24px Georgia, serif; text-align: center;
}
.ops-btn.alert { border-color: var(--warning) !important; color: var(--text-warn) !important; }
.ops-btn.alert .ops-icon { background: var(--warning); border-color: var(--warning); color: #1b1d20; font-family: inherit; }

/* Breite Reiter */
.tabs { flex: none; position: relative; z-index: 2; height: 58px; display: flex; padding: 8px 12px 0; border-bottom: 2px solid var(--line); }
.tabs button {
  flex: 1; min-width: 0; height: 50px; margin-right: 8px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-bottom: 0; border-radius: 6px 6px 0 0; background: var(--card); color: var(--grau);
  font: inherit; font-size: 19px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; cursor: pointer;
}
.tabs button:last-child { margin-right: 0; }
.tabs button .nt-icon { width: 32px; height: 32px; margin-right: 10px; background: none; }
.tabs button .nt-icon svg { width: 24px; height: 24px; }
.tabs button.active { background: var(--ok); border-color: var(--ok); color: #16181a; }
.tabs button.active .nt-icon svg { stroke: #16181a; }
.tabs button:active { background: var(--press); }

/* Start */
#view-overview { display: flex; }
#view-overview .battery {
  width: 300px; flex: none; margin: 0; padding: 8px 20px;
  display: flex; flex-direction: column; justify-content: space-around;
}
#view-overview .battery .measure { flex-direction: column; align-items: flex-start; border-bottom: 1px solid var(--line); padding: 6px 0 10px; }
#view-overview .battery .measure:last-child { border-bottom: 0; }
#view-overview .battery .measure .label { font-size: 17px; color: var(--muted); }
#view-overview .battery .measure .label::before { content: none; }
#view-overview .battery .measure .value { font-size: 38px; line-height: 1.1; margin-top: 2px; }
.land-log {
  flex: 1; min-width: 0; margin-left: 12px; padding: 12px 14px 10px;
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-radius: 6px;
}
.land-log h2 { font-size: 16px; margin-bottom: 8px; }
.land-log h2 .hint { display: inline-block; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 13px; background: var(--error); color: #fff; font-size: 15px; line-height: 26px; text-align: center; font-weight: 700; }
.land-log h2 .hint:empty { display: none; }
.land-log .list td { font-size: 18px; padding: 8px 6px; }
.land-log .list td.time { font-size: 15px; color: var(--muted); white-space: nowrap; }
.land-log .list td.loc { font-size: 15px; color: var(--muted); }
.land-log .ok-empty { color: var(--ok); font-style: normal; font-weight: 700; font-size: 20px; padding: 20px 6px; }
/* Unten rechts liegt die Anmelde-Taste: Tasten der Startseite links davon */
.land-actions { flex: none; display: flex; padding-top: 10px; margin-right: 150px; }
.land-actions[hidden] { display: none; }
.land-actions .tool { height: 48px; min-width: 140px; font-size: 17px; margin-right: 10px; }

/* Anmelden / Abmelden: einmal, unten rechts – über dem Inhalt, unter Dialogen */
#screen > .user-btn {
  position: absolute; right: 12px; bottom: 12px; z-index: 8;
  height: 52px !important; min-width: 140px; padding: 0 20px !important;
  border: 1px solid var(--border-strong) !important; border-radius: 26px !important; background: var(--card); color: var(--text) !important;
  font: inherit; font-size: 17px !important; font-weight: 700; cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}
#screen > .user-btn.in { background: var(--fill-strong) !important; border-color: var(--fill-strong) !important; color: var(--on-strong) !important; }
#screen > .user-btn[hidden] { display: none; }
/* Platz für die Anmelde-Taste unten rechts in den übrigen Ansichten */
.page-host, #view-node, #view-info, .book-body .scroll, #view-log .scroll, #view-dist .dist-list, #circuits { padding-bottom: 66px; }
.test-start { padding-right: 160px; }
#view-log .view-actions { margin-right: 150px; justify-content: flex-start; }

/* Info: Projekt */
.info-project { display: flex; align-items: baseline; margin-bottom: 4px; }
.info-project b { font-size: 24px; color: var(--text); margin-right: 12px; }
.info-project span { font-size: 15px; color: var(--muted); }
.info-last { margin: 0 0 12px; font-size: 14px; color: var(--muted); }
.info-last .last-msg { display: inline; padding: 0; border: 0; background: none; font: inherit; color: var(--grau); text-align: left; cursor: pointer; }
.info-last .last-msg::before { content: none; }

/* Betriebsinfo-Fenster */
.ops-list { list-style: none; margin: 0; padding: 0; }
.ops-list li { display: flex; align-items: center; padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 18px; }
.ops-list li .lamp { margin-right: 12px; }
.ops-list li .state { font-size: 14px; text-transform: uppercase; letter-spacing: .05em; }
.ops-list li.s-ok .state { color: var(--ok); font-weight: 700; }
.ops-list li .name { flex: 1; min-width: 0; margin-right: 12px; }
.ops-list li.s-active .state { color: var(--active); font-weight: 700; }
.ops-list li.s-warning .state { color: var(--text-warn); font-weight: 700; }

/* ================================================================================
   Feinschliff Chipsee: Farben am Logo (Weinrot statt Grün), einheitliche Rundungen,
   große Zurück-Taste statt Pfad, Einstellungsseiten als Pop-up-Fenster.
   ================================================================================ */


/* Einheitliche Tasten in der Kopfzeile und unten rechts */
.home-btn, .ops-btn, .sys-status, .clock { border-radius: 6px !important; }
.home-btn.active { border-color: var(--rot) !important; }
.home-btn.active svg { stroke: var(--rot); }
.topbar .spacer { flex: 1; min-width: 0; }
.back-btn {
  height: 46px; flex: none; display: flex; align-items: center; padding: 0 20px 0 12px !important;
  border: 1px solid var(--border-strong) !important; border-radius: 6px !important;
  font-size: 19px !important; font-weight: 700 !important; color: var(--text) !important;
}
.back-btn[hidden] { display: none; }
.back-btn svg { width: 26px; height: 26px; margin-right: 6px; fill: none; stroke: var(--rot); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
#screen > .user-btn { border-radius: 6px !important; height: 50px !important; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }

/* Uhr mittig (Verbindungsanzeige nur, wenn getrennt) */
.clock { justify-content: center; }
.clock .conn.online { display: none; }

/* Reiter: Weinrot wie das Logo */
.tabs button { border-radius: 6px 6px 0 0; }
.tabs button .nt-icon svg { stroke: var(--grau); }
.tabs button.active { background: var(--rot); border-color: var(--rot); color: #fff; }
.tabs button.active .nt-icon svg { stroke: #fff; }
.tabs { border-bottom-color: var(--rot); }

/* Kacheln: Symbole in Logo-Farbe */
.nt-icon svg { stroke: var(--rot); }
.node-tile { border-radius: 6px; }
.node-tile:active { border-color: var(--rot); }
.node-title { margin: 0 0 10px; font-size: 15px; }
.node-title[hidden] { display: none; }

/* Hervorgehobene Tasten (Sichern, Übernehmen …) in Logo-Farbe */
.e-btn.e-ctl { background: var(--rot); border-color: var(--rot); color: #fff; }
.e-btn.e-ctl:active { background: var(--rot-dunkel); color: #fff; }

/* --- Einstellungsseite als Pop-up über dem Bereich ----------------------------------- */
.sheet-title, .sheet-close { display: none; }
#view-node.dimmed { opacity: .25; pointer-events: none; }
#view-page.sheet {
  position: absolute; left: 34px; right: 34px; top: 10px; bottom: 10px; z-index: 6; height: auto;
  border: 1px solid var(--border-strong); border-top: 4px solid var(--rot); border-radius: 10px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, .55);
}
#view-page.sheet .page-head { align-items: center; }
#view-page.sheet .sheet-title { display: block; flex: none; max-width: 40%; margin: 0 14px 0 8px; font-size: 21px; font-weight: 700; color: var(--text); line-height: 1.15; }
#view-page.sheet .sheet-close {
  display: flex; align-items: center; justify-content: center; flex: none; order: 9; margin-left: auto;
  width: 48px; height: 44px; border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--card); color: var(--text); font-size: 22px; cursor: pointer;
}
#view-page.sheet .page-tabs { flex: 1; min-width: 0; }

/* Eingabefenster der Anlage: modernes Fenster, mittig */
.e-overlay { left: 7%; right: 7%; top: 18px; padding: 18px 20px 16px; border-radius: 10px; border-top: 4px solid var(--rot); }
.e-has-overlay::before { background: rgba(10, 11, 13, .6); }
.e-x { right: 10px; top: 8px; width: 42px; height: 42px; font-size: 26px; }
.crumbs[hidden] { display: none !important; }
/* Im Pop-up führt die Zurück-Taste oben zurück; das ◀ der Seite entfällt */
#view-page.sheet #page-back { display: none; }
#screen.sheet-open > .user-btn { display: none !important; }
#view-page.sheet .page-host { padding-bottom: 10px; }

/* ================================================================================
   Runde 4 (Chipsee): Start mit Betriebszuständen unten links und Störungsursachen,
   Leuchten als Symbole, Info als Karten, keine doppelten Reiter, touchfreundliche Tasten.
   ================================================================================ */

/* Start links: Batterie oben, Betriebszustände darunter */
.land-left { width: 300px; flex: none; display: flex; flex-direction: column; }
#view-overview .battery { width: auto; flex: 1; min-height: 0; padding: 4px 20px; }
#view-overview .battery .measure { padding: 4px 0 8px; }
#view-overview .battery .measure .value { font-size: 34px; }
.land-ops { list-style: none; margin: 10px 0 0; padding: 6px 16px; flex: none; background: var(--card); border: 1px solid var(--line); border-radius: 6px; }
.land-ops li { display: flex; align-items: center; height: 38px; font-size: 18px; color: var(--muted); border-bottom: 1px solid var(--line); }
.land-ops li:last-child { border-bottom: 0; }
.land-ops li .lamp { width: 13px; height: 13px; margin-right: 12px; }
.land-ops li.s-ok, .land-ops li.s-active, .land-ops li.s-warning { color: var(--text); font-weight: 700; }
.land-ops li.s-active { color: var(--active); }
.land-ops li.s-warning { color: var(--text-warn); }

/* Störungsursachen (Sammelstörung) */
.fault-list { list-style: none; margin: 0 0 6px; padding: 0; }
.fault-list:empty { display: none; }
.fault-list li { display: flex; align-items: center; min-height: 44px; padding: 6px 12px; margin-bottom: 6px; border-radius: 6px; background: var(--tint-err); border: 1px solid var(--border-err); color: var(--error); font-size: 19px; font-weight: 700; }
.fault-list li .lamp { background: var(--error); margin-right: 12px; }
.fault-list li.msg { background: var(--card); border-color: var(--line); color: var(--text); font-weight: 400; }
.fault-list li.msg .lamp { background: var(--warning); }
.fault-list li small { display: block; font-size: 13px; color: var(--muted); }
.fault-list li.more { background: none; border: 0; color: var(--muted); font-weight: 400; font-size: 15px; }
.fault-list.big { max-height: 330px; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* Leuchten: alle Kreise untereinander, Leuchten als Symbole */
.lamp-legend { flex: none; display: flex; align-items: center; font-size: 15px; color: var(--muted); margin: 0 0 8px; }
.lamp-legend .slot { width: 26px; height: 26px; margin: 0 6px 0 14px; font-size: 14px; }
.lamp-legend .slot:first-child { margin-left: 0; }
#circuits { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.circuit { margin-bottom: 12px; }
.slots { display: flex; flex-wrap: wrap; }
.slot {
  position: relative; width: 44px; height: 46px; margin: 0 5px 5px 0; display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 6px; border: 1px solid var(--line); background: transparent; color: var(--faint); font-style: normal;
}
.slot i { font-style: normal; font-size: 18px; line-height: 1; }
.slot small { font-size: 11px; margin-top: 2px; }
.slot.s-ok { background: rgba(134, 196, 64, .18); border-color: var(--ok); color: var(--ok); }
.slot.s-error { background: var(--error); border-color: var(--error); color: #fff; }
.slot.s-missing { background: var(--soft); border-color: var(--border-strong); color: var(--muted); }
.slot.s-missing i { font-size: 20px; font-weight: 700; }
.slot.s-none i { display: none; }
.slot.s-none { opacity: .45; }

/* Info: aufgeräumte Karten, scrollbar */
#view-info { overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 70px; }
.info-card { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 14px 18px; margin-bottom: 12px; }
.info-card h2 { display: flex; align-items: center; margin-bottom: 10px; }
.info-card h2 .more { margin-left: auto; }
.info-head .info-project { margin: 0 0 4px; }
.info-head .last-msg { display: block; padding: 0; border: 0; background: none; font: inherit; font-size: 15px; color: var(--muted); text-align: left; cursor: pointer; }
.info-head .last-msg::before { content: "Letzte Meldung: "; color: var(--faint); }
.info-card .kv { width: 100%; border-collapse: collapse; font-size: 16px; }
.info-card .kv td { padding: 7px 0; border-bottom: 1px solid var(--line); }
.info-card .kv tr:last-child td { border-bottom: 0; }
.info-card .kv td:first-child { color: var(--muted); width: 45%; padding-right: 12px; }
.info-card .theme-seg button { min-width: 140px; height: 46px; font-size: 17px; }

/* Keine doppelten Reiter: Bereichswahl im Prüfbuch und Nachbarseiten-Leiste entfallen */
#seg-book { display: none; }
.page-tabs { display: none; }
#view-page.sheet .sheet-title { max-width: none; flex: 1; }

/* Tasten der Anlage: groß und gut zu treffen; nur Speichern-Tasten gefüllt */
.e-page .e-btn { min-height: 52px; padding: 0 18px; font-size: 17px; border-radius: 6px; }
.e-btn.e-ctl { background: var(--card); border-color: var(--border-strong); color: var(--text); }
.e-btn.e-ctl:active { background: var(--press); color: var(--text); }
.e-btn.e-primary { background: var(--rot); border-color: var(--rot); color: #fff; min-width: 140px; }
.e-btn.e-primary:active { background: var(--rot-dunkel); color: #fff; }
.e-btnbar > * { margin: 0 8px 8px 0; }
.slot { width: 34px; height: 42px; margin: 0 3px 4px 0; }
.slot i svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; }
.slot.s-ok i svg { fill: rgba(134, 196, 64, .35); }
.slot.s-error i svg { fill: rgba(255, 255, 255, .3); }
.lamp-legend .slot i svg { width: 16px; height: 16px; }
.circuit-head { padding-right: 14px; }
/* Kopf der Originalseite nur im Pop-up (Titel + Schließen); sonst führt „Zurück“ oben zurück */
#view-page:not(.sheet) .page-head { display: none; }

/* ================================================================================
   Runde 5 (Chipsee): Batterie ruhiger, Zustände nur wenn aktiv, große Testliste,
   luftige Dialoge, ganze Zeilen antippbar, Abmelden als rote Taste.
   ================================================================================ */

/* Start links: Batteriewerte in normaler Größe, aktive Zustände stapeln sich darunter */
#view-overview .battery { justify-content: flex-start; padding: 10px 18px; }
#view-overview .battery .measure { flex-direction: row; align-items: baseline; justify-content: space-between; padding: 12px 0; }
#view-overview .battery .measure .label { font-size: 17px; }
#view-overview .battery .measure .value { font-size: 24px; margin: 0; }
.land-ops:empty { display: none; }
.land-ops { padding: 0; background: none; border: 0; }
.land-ops li {
  height: 56px; margin-top: 8px; padding: 0 16px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--card); font-size: 20px; font-weight: 700;
}
.land-ops li:last-child { border-bottom: 1px solid var(--line); }
.land-ops li.s-active { border-color: var(--active); background: var(--tint-active); color: var(--active); }
.land-ops li.s-warning { border-color: var(--warning); background: var(--tint-warn); color: var(--text-warn); }
.land-ops li .lamp { width: 14px; height: 14px; }

/* Tests: Liste links über die volle Höhe, große Tasten */
.test-list { width: 300px; padding: 10px; display: flex; flex-direction: column; }
.test-list li { flex: 1; min-height: 0; display: flex; }
.test-list li + li { margin-top: 8px; }
.test-list button { flex: 1; min-height: 64px; height: auto; padding: 8px 16px; font-size: 20px; line-height: 1.2; border-radius: 6px; }
.test-list button.active { border-left-width: 6px; }

/* Dialoge: breiter, mehr Luft, Tasten nie umbrochen */
.dialog { width: 520px; padding: 22px 26px; border-radius: 10px; border-top-width: 4px; }
.dialog.wide { width: 760px; }
.dialog h2 { font-size: 17px; margin-bottom: 6px; }
.dialog-actions { margin-top: 8px; }
.dialog-actions > * + * { margin-left: 10px; }
.dialog-actions .tool { height: 54px; min-width: 150px; padding: 0 22px; font-size: 18px; white-space: nowrap; border-radius: 6px; }
.dialog-actions .spacer { flex: 1; }
#clock-modal .wheels { height: 220px; margin: 8px 0; }
#clock-modal .wheels::before { top: 92px; }
#clock-modal .wheel { height: 180px; width: 76px; }
#clock-modal .wheel.wide { width: 170px; }
#clock-modal .wheel li { font-size: 22px; }
#clock-modal .wheel li.sel { font-size: 25px; }
.clock-now { font-size: 17px; }
.clock-tz { font-size: 16px; }
.clock-tz select { height: 46px !important; font-size: 17px !important; }
#dt-modal .wheels { height: 220px; }
#dt-modal .dt-quick .tool { height: 48px; font-size: 16px; }

/* Zeilen mit Bearbeiten-Stift: ganze Zeile antippbar, Stift groß */
.e-rowlink { cursor: pointer; }
tr.e-rowlink:active td, .e-row.e-rowlink:active { background: var(--press); }
.e-table tr.e-rowlink td { padding-top: 10px; padding-bottom: 10px; }
.e-btn.e-icon-edit { min-width: 56px; min-height: 50px; font-size: 30px; line-height: 1; padding: 0 10px; color: var(--rot); border-color: var(--border-strong); }

/* Abmelden: rote Taste, Stufe klein darüber */
#screen > .user-btn.in { background: var(--rot) !important; border-color: var(--rot) !important; color: #fff !important; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
#screen > .user-btn small { display: block; font-size: 12px; font-weight: 400; opacity: .85; }
.test-list { gap: 0; }
#dt-modal .wheels::before { top: 92px; }
.clock-tz { font-size: 16px !important; color: var(--muted); }
#dt-modal.time-only .dw-d, #dt-modal.time-only .dw-m, #dt-modal.time-only .dw-y, #dt-modal.time-only .wheel-gap, #dt-modal.time-only #dt-quick, #dt-modal.time-only #dt-clear { display: none; }
#dt-modal.time-only .dialog { width: 420px; }
#dt-modal .wheel { height: 180px; }
#dt-modal.time-only .wheel { width: 96px; }
#dt-modal.time-only .wheel li { font-size: 24px; }
#dt-modal.time-only .wheel li.sel { font-size: 28px; }
.e-page input[name=sysclockNewValueDate] { min-width: 10em !important; }
/* Testdetails am Chipsee gut lesbar */
.test-detail h3 { font-size: 24px; }
.test-detail p { font-size: 17px; }
.test-values { font-size: 17px; row-gap: 6px; }
.test-values dt, .test-values dd { padding: 3px 0; }
.test-start .tool.big { height: 54px; font-size: 19px; padding: 0 24px; }

/* Gerätevorschau am PC (?geraet=chipsee): Display 1024 × 600 im dunklen Gehäuse, eingepasst */
html.device-preview, html.device-preview body { background: #0b0b0c; }
html.device-preview #screen {
  transform-origin: 0 0;
  box-shadow: 0 0 0 22px #18181a, 0 0 0 23px #2c2c30, 0 18px 60px 20px rgba(0, 0, 0, .7);
  border-radius: 2px;
}

/* ================================================================================
   Runde 6: ein Satz Bedienelemente für alles (Ansichten, Originalseiten, Fenster).
   Tasten 50 px hoch, 8 px Rundung, 17 px fett; nur die Hauptaktion weinrot gefüllt;
   Hauptaktion unten rechts neben Abmelden; Fenster: Beschriftung links, Feld rechts,
   Abbrechen und Hauptaktion rechtsbündig unten. Feste Werte (legacy.css kennt nur :root-Variablen).
   ================================================================================ */

/* --- Tasten ---------------------------------------------------------------------- */
.tool, .e-page .e-btn, .e-btnbar div.e-link {
  min-height: 50px; height: auto; padding: 0 20px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--card); color: var(--text);
  font-size: 17px; font-weight: 700; line-height: 1.15;
}
.tool { height: 50px; }
.tool.icon, .e-page .e-btn.e-icon { width: 50px; min-width: 50px; padding: 0; font-size: 22px; }
.tool.primary, .e-page .e-btn.e-primary { background: var(--rot); border-color: var(--rot); color: #fff; }
.tool.primary:active, .e-page .e-btn.e-primary:active { background: var(--rot-dunkel); color: #fff; }
.e-page .e-btn.e-ctl:not(.e-primary) { background: var(--card); border-color: var(--border-strong); color: var(--text); }
.e-page .e-btn.e-ctl:not(.e-primary):active, .tool:not(.primary):active { background: var(--press); color: var(--text); }
.e-page .e-btn.e-danger, .e-page .e-btn.e-icon-del { color: var(--error); border-color: var(--border-strong); }
.tool.big { min-width: 170px; }
/* Text im Inneren einer Taste übernimmt deren Farbe (Zustandsfarben gelten nur für freien Text) */
.e-page .e-btn [data-st], .e-page .e-btn span { color: inherit !important; font-weight: inherit !important; }
.e-btnbar div.e-link { display: inline-flex; align-items: center; color: var(--text); }
.e-btnbar div.e-link::after { content: "›"; margin-left: 8px; font-size: 20px; color: var(--rot); }

/* Tastenleisten: gleicher Abstand, Blättern rechts in derselben Zeile */
.e-page .e-btnbar { display: flex; flex-wrap: wrap; align-items: center; padding: 0 0 10px; }
.e-page .e-btnbar > * { margin: 0 10px 8px 0 !important; }
.e-page .e-tools-inline { margin-left: auto !important; display: flex; }
.e-page .e-tools-inline > * { margin: 0 0 0 8px !important; }
.e-tools > * { margin-left: 8px; }

/* --- Umschalter (Segmente): gleich breite Felder, wie iOS ---------------------------- */
.seg { display: flex; padding: 3px; border: 0; border-radius: 10px; background: var(--soft); overflow: visible; }
.seg button {
  flex: 1 1 0; min-width: 0; height: 44px; padding: 0 14px; margin: 0;
  border: 0; border-radius: 8px; background: none; color: var(--grau);
  font-size: 16px; font-weight: 700; white-space: nowrap;
}
.seg button + button { margin-left: 3px; }
.seg button.active { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
.dark .seg button.active { background: #4a4e55; }
.info-card .theme-seg { display: flex; width: 100%; max-width: 560px; }
.info-card .theme-seg button { flex: 1 1 0; min-width: 0; height: 46px; font-size: 17px; }
#view-lamps .toolbar .seg { flex: 1; min-width: 0; margin-right: 10px; }
#view-lamps .toolbar .seg button { padding: 0 8px; }

/* --- Felder ---------------------------------------------------------------------- */
.e-page input:not([type=checkbox]):not([type=radio]), .e-page select {
  height: 46px; padding: 0 12px; border-radius: 8px; font-size: 17px;
}
.e-page .e-table td input:not([type=checkbox]):not([type=radio]), .e-page .e-table td select { height: 42px; font-size: 15px; }
.e-page input[type=checkbox], .e-page input[type=radio] { width: 26px; height: 26px; accent-color: #8c1a37; }
.e-page .e-row.e-field { min-height: 52px; }

/* --- Eingabefenster der Anlage: wie die eigenen Dialoge -------------------------------- */
.e-page .e-overlay {
  left: 50%; right: auto; top: 14px; width: 720px; max-width: 94%;
  -webkit-transform: translateX(-50%); transform: translateX(-50%);
  max-height: calc(100% - 28px); padding: 22px 26px 20px;
  border-radius: 10px; border-top: 4px solid var(--rot);
  background: var(--card); box-shadow: 0 16px 48px rgba(0, 0, 0, .55);
}
.e-page .e-overlay .e-row.e-field { padding: 4px 0; border-bottom: 1px solid var(--line); }
.e-page .e-overlay .e-field > :first-child { flex: 0 0 200px; max-width: 200px; font-size: 17px; color: var(--grau); }
.e-page .e-overlay .e-field > :first-child + * { flex: 1 1 auto; }
.e-page .e-overlay .e-field > input:not([type=checkbox]), .e-page .e-overlay .e-field > select { width: 100%; }
.e-page .e-overlay > .e-row, .e-page .e-overlay > .e-col > .e-row { font-size: 17px; }
/* Tasten des Fensters: rechtsbündig unten, gleich breit */
.e-page .e-overlay .e-btnbar { justify-content: flex-end; padding: 16px 0 0; margin-top: 8px; }
.e-page .e-overlay .e-btnbar > * { margin: 0 0 0 10px !important; min-width: 150px; }
.e-page .e-overlay .e-x { right: 10px; top: 10px; width: 44px; height: 44px; font-size: 28px; }
.e-page .e-overlay.e-has-cancel .e-x { display: none; }
.e-has-overlay::before { background: rgba(0, 0, 0, .55); }

/* --- Hauptaktion der Seite (Test starten): unten rechts, auf Höhe von Abmelden ---------- */
.e-actionbar {
  flex: none; display: flex; justify-content: flex-end; align-items: center;
  margin: 0 -10px -9px; padding: 0 152px 0 10px; min-height: 62px; align-items: flex-end;
  border-top: 1px solid var(--line);
}
.e-actionbar .e-btn { min-width: 200px; height: 50px; margin: 0 0 0 10px !important; }
.page-host.has-actions { padding-bottom: 0 !important; }

/* Testansicht: Tasten unten auf Höhe von Abmelden, gleich hoch */
/* Unterkante der Tasten = Unterkante von Abmelden (Feld: 10 px Innenabstand + 1 px Rand) */
.test-start { min-height: 62px; margin: 0 -10px -11px; padding: 0 152px 0 10px; align-items: flex-end; border-top: 1px solid var(--line); }
.test-start .tool.big { height: 50px; font-size: 17px; padding: 0 22px; }
.test-start > .tool + .tool { margin-left: 10px; }
.test-start .hint { flex: 1; min-width: 0; margin-right: 10px; text-align: right; }

/* Leuchtenfelder der Originalseite 1810: Nummer, Farbe = Zustand */
.e-page .e-btn.e-lamp { min-width: 44px; width: 44px; min-height: 40px; height: 40px; padding: 0; font-size: 14px; border-radius: 6px; color: var(--muted); }
.e-page .e-btn.e-lamp[data-st="ok"] { background: rgba(134, 196, 64, .18); border-color: var(--ok); color: var(--ok); }
.e-page .e-btn.e-lamp[data-st="err"] { background: var(--error); border-color: var(--error); color: #fff; }
.e-page .e-btn.e-lamp[data-st="missing"] { background: var(--soft); color: var(--muted); }

/* Mehr-Tasten der Ansichten („Weitere Funktionen“) */
.tool.more-fn { flex: none; margin-left: auto; }
#view-dist h2 .more-fn { height: 44px; min-height: 44px; font-size: 15px; letter-spacing: 0; text-transform: none; }

/* Rückfrage: Werte zeilenweise; Neu-anlegen-Taste in der Feldzeile unten bündig */
#confirm-text { white-space: pre-line; }
.e-page .e-pairs > .e-btn.e-create { align-self: flex-end; margin: 0 0 8px !important; }
/* Blättern ohne Ziel (nur eine Seite) ausblenden statt grau stehen lassen */
.e-tools > .e-btn[data-st="inactive"], .e-tools > .e-btn[data-st="forbidden"] { display: none; }
.e-page .e-btnbar > .e-btn, .e-page .e-btnbar > div.e-link { padding: 0 16px; }
#confirm-modal #confirm-title { font-size: 21px; text-transform: none; letter-spacing: 0; color: var(--text); margin-bottom: 10px; }
#confirm-modal #confirm-text { font-size: 17px; line-height: 1.45; color: var(--grau); }

/* Auswahl als Zeilen (iOS-Einstellungen): Bezeichnung links, Wert rechts, Pfeil */
.e-page .e-pick { position: relative; max-width: 680px; margin: 0 0 12px !important; border: 1px solid var(--line); border-radius: 10px; background: var(--card); cursor: pointer; }
.e-page .e-pick > .e-row { min-height: 52px; margin: 0 !important; padding: 0 48px 0 16px; flex-wrap: nowrap; justify-content: space-between; border-bottom: 1px solid var(--line); font-size: 17px; }
.e-page .e-pick > .e-row:nth-last-child(2) { border-bottom: 0; }
.e-page .e-pick > .e-row > span:first-child { color: var(--grau); }
.e-page .e-pick > .e-row > span + span { margin-left: auto !important; font-weight: 700; color: var(--text); text-align: right; }
.e-page .e-pick::after { content: "›"; position: absolute; right: 16px; top: 50%; margin-top: -16px; font-size: 30px; line-height: 30px; color: var(--rot); }
.e-page .e-pick:active { background: var(--press); }
.e-page .e-pick > .e-pick-btn { display: none !important; }
.e-page .e-picklist { max-width: 680px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.e-page .e-picklist > * + * { margin-top: 0 !important; }
.e-page .e-picklist > .e-pick { max-width: none; margin: 0 !important; border: 0; border-radius: 0; border-bottom: 1px solid var(--line); }
.e-page .e-picklist > .e-pick:last-child { border-bottom: 0; }
.e-page .e-pick > .e-row > span.e-unset { color: var(--muted) !important; font-weight: 400 !important; }
/* Kleine Zusatztasten in Kartenköpfen (Handbuch): gleiche Form wie alle Tasten, nur flacher */
.info-card h2 .more, #view-dist h2 .more-fn {
  height: 44px; min-height: 44px; padding: 0 18px; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--card); color: var(--text); font-size: 15px; font-weight: 700; letter-spacing: 0; text-transform: none; cursor: pointer;
}
#view-dist > h2:first-child { display: flex; align-items: center; }
#view-dist > h2:first-child .more-fn { margin-left: auto; }

/* Info-Zeilen: Bezeichnung links (feste Spalte), Wert daneben */
.e-page .e-row.e-kv { flex-wrap: nowrap; min-height: 40px; max-width: 680px; border-bottom: 1px solid var(--line); font-size: 17px; }
.e-page .e-row.e-kv > :first-child { flex: 0 0 240px; color: var(--grau); }
.e-page .e-row.e-kv > :first-child + * { font-weight: 700; }
@supports selector(:has(a)) { .e-page .e-row.e-kv:has(> span + span:empty) { display: none; } }
/* Abschnittstitel vor Tabellen */
.e-page .e-row.e-section { margin-top: 14px !important; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
/* Verweisliste (Unterseiten) */
.e-page .e-navlist { max-width: 680px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.e-page .e-navlist > * { margin: 0 !important; }
.e-page .e-navlist > * + * { border-top: 1px solid var(--line); }
.e-page .e-navlist div.e-link {
  display: flex; align-items: center; min-height: 56px; padding: 0 18px; border: 0; border-radius: 0;
  font-size: 18px; font-weight: 400; color: var(--text); text-decoration: none;
}
.e-page .e-navlist div.e-link::after { content: "›"; margin-left: auto; font-size: 28px; color: var(--rot); }
.e-page .e-navlist div.e-link:active { background: var(--press); }
.e-page .e-pick > .e-row.e-kv { min-height: 52px; max-width: none; }
/* Info-Zeilen und zweispaltige Tabellen: Werte in derselben Spalte, gleiche Zeilenhöhe */
.e-page .e-row.e-kv { max-width: none; font-size: 16px; }
.e-page .e-row.e-kv > :first-child { flex: 0 0 45%; padding-left: 6px; }
.e-page .e-table { font-size: 16px; }
.e-page .e-table td { height: 40px; }
.e-page .e-table td:first-child:nth-last-child(2) { width: 45%; color: var(--grau); }
.e-page .e-table td:last-child:nth-child(2) { font-weight: 700; }
/* Tastenleiste mit Blättern: eine Zeile, Tasten dürfen etwas schmaler werden */
.e-page .e-btnbar:has(> .e-tools-inline) { flex-wrap: nowrap; }
.e-page .e-btnbar:has(> .e-tools-inline) > .e-btn, .e-page .e-btnbar:has(> .e-tools-inline) > div.e-link { flex: 0 1 auto; min-width: 0; padding: 0 13px; }
.e-page .e-btnbar:has(> .e-tools-inline) > .e-btn, .e-page .e-btnbar:has(> .e-tools-inline) > div.e-link { padding: 0 12px; font-size: 16px; white-space: nowrap; -webkit-hyphens: none; hyphens: none; }
.e-page .e-btnbar:has(> .e-tools-inline) > * { margin-right: 8px !important; }
/* Filter im Prüfbuch: Felder wie überall (46 px, 8 px Rundung); Tasten links neben Abmelden */
.filter-grid select, .filter-grid input { height: 46px; padding: 0 12px; border-radius: 8px; font-size: 17px; }
.filter-grid label { font-size: 14px; }
/* Unterkante = Unterkante von Abmelden (Ansicht: 10 px Innenabstand + 1 px Rand, Fenster 4 px) */
.filter-actions { align-items: flex-end; gap: 10px; padding-right: 152px; margin-bottom: -15px; }
.filter-actions .tool { min-width: 150px; }

/* Auswahl oben auf Konfigurationsseiten: Bezeichnung links, Liste rechts, ohne Auswählen-Taste */
.e-page .e-shadow { display: none !important; }
.e-page .e-row.e-selector { max-width: 680px; min-height: 60px; margin-bottom: 10px !important; padding: 0 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.e-page .e-row.e-selector > :first-child { flex: 0 0 200px; font-size: 17px; color: var(--grau); }
.e-page .e-row.e-selector > select { flex: 1 1 auto; width: auto; margin: 0 !important; }

/* Haustechnik (automation): Schalter als gleich große Kacheln, vier je Zeile */
.e-page[data-nav="automation"] .e-btnbar { flex-wrap: wrap; padding: 0; }
.e-page[data-nav="automation"] .e-btnbar > * { flex: 0 0 calc(25% - 10px); min-width: 0; margin: 0 10px 10px 0 !important; }
.e-page[data-nav="automation"] .e-btn.e-tile { width: 100%; min-height: 72px; margin: 0 !important; font-size: 18px; }
/* DALI-Leuchtenadressierung: Tastenreihen gleich breit, Tasten je Reihe gleich groß */
.e-page[data-nav="dalilampassign"] .e-btnbar[data-cls="da0"] { width: 520px; max-width: 100%; flex-wrap: nowrap; }
.e-page[data-nav="dalilampassign"] .e-btnbar[data-cls="da0"] > * { flex: 1 1 0; min-width: 0; margin: 0 10px 10px 0 !important; }
.e-page[data-nav="dalilampassign"] .e-btnbar[data-cls="da0"] > :last-child { margin-right: 0 !important; }
.e-page[data-nav="dalilampassign"] .e-btnbar[data-cls="da0"] .e-btn { width: 100%; }
#view-page.sheet .e-actionbar { padding-right: 10px; }
/* Rückfrage „Änderungen sichern?“: drei Tasten nebeneinander, Titel wie bei Rückfragen */
#save-modal .dialog { width: 640px; }
#save-modal #save-title { font-size: 21px; text-transform: none; letter-spacing: 0; color: var(--text); margin-bottom: 10px; }
#save-modal #save-text { font-size: 17px; line-height: 1.45; color: var(--grau); }
#save-modal .dialog-actions .tool { min-width: 0; }
/* Mehrere Auswahlzeilen untereinander als eine Gruppe (wie iOS-Einstellungen) */
.e-page .e-row.e-selector + .e-row.e-selector { margin-top: -11px !important; border-top-left-radius: 0; border-top-right-radius: 0; }
.e-page .e-row.e-selector:has(+ .e-row.e-selector) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.e-page[data-nav="automation"] .e-btnbar > :first-child:nth-last-child(2), .e-page[data-nav="automation"] .e-btnbar > :last-child:nth-child(2) { flex-basis: calc(50% - 10px); }
.e-page[data-nav="automation"] .e-btn.e-tile { text-align: left; }
/* Schalter-Kacheln: Streifen links nur bei einem Zustand, der etwas sagt (aktiv, Störung, Warnung) */
.e-page .e-btn.e-tile[data-st="active"] { border-left: 6px solid var(--active); background: var(--tint-active); }
.e-page .e-btn.e-tile[data-st="err"] { border-left: 6px solid var(--error); background: var(--tint-err); }
.e-page .e-btn.e-tile[data-st="warn"] { border-left: 6px solid var(--warning); background: var(--tint-warn); }
.e-page[data-nav="dalilampassign"] .e-btnbar:not(:has(.e-tile)) { width: 520px; max-width: 100%; flex-wrap: nowrap; }
.e-page[data-nav="dalilampassign"] .e-btnbar:not(:has(.e-tile)) > * { flex: 1 1 0; min-width: 0; margin: 0 10px 10px 0 !important; }
.e-page[data-nav="dalilampassign"] .e-btnbar:not(:has(.e-tile)) > :last-child { margin-right: 0 !important; }
.e-page[data-nav="dalilampassign"] .e-btnbar:not(:has(.e-tile)) .e-btn { width: 100%; padding: 0 8px; }

/* --- Leuchtenstatus der Anlage (1810, „Weitere Funktionen“) wie die eigene Leuchtenansicht --- */
/* Netzwächter: belegte als Punkte mit Nummer, unbelegte ausgeblendet */
.e-page[data-nav="lightfail"] [data-cls="left_text"] { min-height: 40px; color: var(--grau); font-size: 16px; }
.e-page[data-nav="lightfail"] [data-cls="var"] { display: flex; flex-direction: row; flex-wrap: wrap; margin: 0 0 10px !important; counter-reset: bnw; }
.e-page[data-nav="lightfail"] [data-cls="vaec0"] { margin: 0 8px 0 0 !important; counter-increment: bnw; }
.e-page[data-nav="lightfail"] [data-cls^="vaeci"] { display: flex !important; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; font-size: 14px; font-weight: 700; }
.e-page[data-nav="lightfail"] [data-cls^="vaeci"]::before { content: counter(bnw); }
.e-page[data-nav="lightfail"] [data-cls^="vaeci"][data-st="ok"] { background: rgba(134, 196, 64, .18); border: 1px solid var(--ok); color: var(--ok); }
.e-page[data-nav="lightfail"] [data-cls^="vaeci"][data-st="err"] { background: var(--error); color: #fff; }
.e-page[data-nav="lightfail"] [data-cls^="vaeci"][data-st="warn"] { background: var(--warning); color: #fff; }
.e-page[data-nav="lightfail"] [data-cls="vaec0"]:has(> [data-st="neutral"]), .e-page[data-nav="lightfail"] [data-cls="vaec0"]:has(> [data-st="inactive"]) { display: none; }
/* Auswahl oben, darunter „Nur defekte Leuchten anzeigen“ */
.e-page[data-nav="lightfail"] [data-cls="ur1"] { display: flex; flex-direction: column; }
.e-page[data-nav="lightfail"] [data-cls="uri1"] { order: 2; margin: 0 0 12px !important; }
.e-page[data-nav="lightfail"] [data-cls="ld14"] { order: 1; }
/* Kreis: Titel + Aktualisieren in einer Zeile, darunter 20 Leuchtenplätze im Raster */
.e-page[data-nav="lightfail"] [data-cls="sdrc1"] {
  display: grid; grid-template-columns: repeat(20, minmax(0, 1fr)); grid-gap: 4px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.e-page[data-nav="lightfail"] [data-cls="sdrc1"] > * { margin: 0 !important; }
.e-page[data-nav="lightfail"] [data-cls="sdrc1"] > [data-cls="rt0"] { grid-column: 1 / 18; font-size: 16px; font-weight: 700; }
.e-page[data-nav="lightfail"] [data-cls="sdrc1"] > [data-cls="rec0"] { grid-column: 18 / 21; justify-content: flex-end; }
.e-page[data-nav="lightfail"] [data-cls="sdrc1"] > [data-cls="cec0"] { display: none; }
.e-page[data-nav="lightfail"] [data-cls^="lec"] .e-lamp { width: 100%; min-width: 0; height: 40px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; font-size: 14px; color: var(--faint); }
.e-page[data-nav="lightfail"] [data-cls^="lec"] .e-lamp[data-st="ok"] { background: rgba(134, 196, 64, .18); border-color: var(--ok); color: var(--ok); }
.e-page[data-nav="lightfail"] [data-cls^="lec"] .e-lamp[data-st="err"] { background: var(--error); border-color: var(--error); color: #fff; }
.e-page[data-nav="lightfail"] [data-cls^="lec"] .e-lamp[data-st="missing"] { background: var(--soft); border-color: var(--border-strong); color: var(--muted); }
.e-page[data-nav="lightfail"] [data-cls^="lec"] .e-lamp[data-st="active"] { background: var(--tint-active); border-color: var(--active); color: var(--active); }
.e-page[data-nav="lightfail"] .e-col:has(> [data-cls="left_text"]) { display: flex; flex-direction: row; align-items: center; min-height: 52px; margin-bottom: 10px !important; border-bottom: 1px solid var(--line); }
.e-page[data-nav="lightfail"] .e-col:has(> [data-cls="left_text"]) > * { margin: 0 !important; }
.e-page[data-nav="lightfail"] .e-col:has(> [data-cls="left_text"]) > [data-cls="left_text"] { flex: 0 0 45%; padding-left: 6px; }
.e-page[data-nav="lightfail"] .e-col:has(> [data-cls="left_text"]) [data-cls="var"] { margin: 0 !important; }
.e-page[data-nav="lightfail"] [data-cls="sdrc1"] > [data-cls="rt0"] span { color: var(--text) !important; }

/* Leuchtenstörungen (1820): Spalten über die ganze Breite */
.e-page[data-nav="lightfail_errorlist"] [data-cls="ur1_LN"] { display: none !important; }
/* Zustandsfeld rechts: nur ausblenden, wenn es kein Verweis ist (Anlage liefert dort nur den Zustand) */
.e-page[data-nav="lightfail_errorlist"] [data-cls="ceclf"]:not(:has([data-k], [data-link], .e-link)) { display: none !important; }
.e-page[data-nav="lightfail_errorlist"] [data-cls="lfeo"], .e-page[data-nav="lightfail_errorlist"] [data-cls="clear"] { margin: 0 !important; }
.e-page[data-nav="lightfail_errorlist"] .e-col > * + * { margin-top: 0; }
.e-page[data-nav="lightfail_errorlist"] .lf-stamp { margin: 4px 0 10px !important; font-size: 14px; color: var(--muted); }
.e-page[data-nav="lightfail_errorlist"] .lf-row {
  display: grid; grid-template-columns: 22% 26% 30% 1fr; align-items: center;
  min-height: 48px; padding: 0 8px; border-bottom: 1px solid var(--line); font-size: 17px;
}
.e-page[data-nav="lightfail_errorlist"] .lf-row > * { margin: 0 12px 0 0 !important; }
.e-page[data-nav="lightfail_errorlist"] .lf-head { min-height: 36px; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.e-page[data-nav="lightfail_errorlist"] .lf-err { color: var(--error); font-weight: 700; }
.e-page[data-nav="lightfail_errorlist"] .lf-missing { color: var(--grau); }
.e-page[data-nav="lightfail_errorlist"] .lf-err::before, .e-page[data-nav="lightfail_errorlist"] .lf-missing::before {
  content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 10px; border-radius: 50%; vertical-align: middle;
}
.e-page[data-nav="lightfail_errorlist"] .lf-err::before { background: var(--error); }
.e-page[data-nav="lightfail_errorlist"] .lf-missing::before { background: none; border: 2px solid var(--muted); width: 8px; height: 8px; }
/* Rote Linie unter den Reitern durchgehend vor den Tasten (vorher lagen die Tasten 2 px darüber) */
.tabs { border-bottom: 0; }
.tabs::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--rot); z-index: 1; pointer-events: none; }

/* Unterverteilungen: ganze Ansicht scrollt (Liste der Leuchtenstörungen bis unter Abmelden) */
#view-dist { overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 70px; }
#view-dist .dist-list { padding-bottom: 0; }
#view-dist .dist-list li .state { font-size: 14px; font-weight: 700; }
#view-dist .dist-list li.s-warning .state { color: var(--text-warn); }
.lf-table th { text-align: left; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.lf-table td, .lf-table th { height: 44px; padding: 0 10px 0 8px; border-bottom: 1px solid var(--line); font-size: 16px; }
.lf-table th:nth-child(1) { width: 22%; } .lf-table th:nth-child(2) { width: 26%; } .lf-table th:nth-child(3) { width: 30%; }
.lf-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.lf-table .lf-err { color: var(--error); font-weight: 700; }
.lf-table .lf-missing { color: var(--grau); }
.lf-table .lf-err::before, .lf-table .lf-missing::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 10px; border-radius: 50%; vertical-align: middle; }
.lf-table .lf-err::before { background: var(--error); }
.lf-table .lf-missing::before { border: 2px solid var(--muted); width: 8px; height: 8px; }

/* ================================================================================
   Anmelden/Abmelden in der Kopfzeile neben dem Anlagenzustand. Die Ecke unten rechts
   gehört damit überall der Hauptaktion der Ansicht (Test starten, Quittieren, Anwenden …).
   ================================================================================ */
.topbar .user-btn {
  position: static; flex: none; height: 46px !important; min-width: 120px; margin-left: 8px; padding: 0 16px !important;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1;
  border: 1px solid var(--border-strong) !important; border-radius: 6px !important; box-shadow: none;
  background: var(--card); color: var(--text) !important; font-size: 16px !important; font-weight: 700; cursor: pointer;
}
.topbar .user-btn.in { background: var(--rot) !important; border-color: var(--rot) !important; color: #fff !important; }
.topbar .user-btn small { display: block; font-size: 12px; font-weight: 400; opacity: .85; }
.topbar .user-btn[hidden] { display: none; }
.topbar .user-btn + .clock { margin-left: 8px; }
/* kein Platz mehr für die schwebende Taste freihalten */
.page-host, #view-node, .book-body .scroll, #view-log .scroll, #view-dist .dist-list, #circuits { padding-bottom: 0; }
#view-info, #view-dist { padding-bottom: 12px; }
.land-actions { margin-right: 0; justify-content: flex-end; }
#view-log .view-actions { margin-right: 0; justify-content: flex-end; }
.e-actionbar, .test-start { padding-right: 10px; }
.filter-actions { padding-right: 0; margin-bottom: 0; }
/* Hauptaktion unten rechts: überall dieselbe Unterkante (Innenkante des Felds) */
.test-start { margin-bottom: 0; }
.e-actionbar { margin-bottom: 0; }
.filter-actions { margin: auto -2px -4px 0; }
.e-actionbar { padding-right: 12px; padding-bottom: 2px; }

/* Logbücher: fortlaufend scrollen, unten Hinweis auf weitere bzw. Ende der Liste */
.book tr.book-more td { height: 52px; text-align: center; font-size: 14px; color: var(--muted); border-bottom: 0; }

/* Info: Software-Version als antippbare Zeile, Update-Log als Fenster */
.info-link {
  display: flex; align-items: center; width: 100%; min-height: 52px; padding: 0 6px; margin-bottom: 4px;
  border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--text); font: inherit; font-size: 17px; cursor: pointer; text-align: left;
}
.info-link > span:first-child { flex: 1; color: var(--muted); font-size: 16px; }
.info-link b { font-size: 17px; }
.info-link .chev { margin-left: 14px; font-size: 26px; color: var(--rot); }
.info-link:active { background: var(--press); }
.ul-dialog { display: flex; flex-direction: column; max-height: 540px; }
.ul-list { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; margin: 6px -6px 0; padding: 0 6px; }
.ul-fassung + .ul-fassung { margin-top: 18px; }
.ul-fassung h3 { display: flex; align-items: baseline; margin: 0 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); font-size: 15px; font-weight: 400; color: var(--muted); }
.ul-fassung h3 b { margin-right: 12px; font-size: 21px; color: var(--text); }
.ul-fassung h3 time { margin-left: auto; }
.ul-fassung ul { list-style: none; margin: 0; padding: 0; }
.ul-fassung li { display: flex; align-items: flex-start; padding: 7px 0; }
.ul-fassung li b { display: block; font-size: 16px; color: var(--text); }
.ul-fassung li p { margin: 2px 0 0; font-size: 15px; line-height: 1.35; color: var(--grau); }
.ul-art { flex: none; width: 96px; margin: 1px 12px 0 0; padding: 3px 0; border-radius: 6px; font-size: 12px; font-weight: 700; text-align: center; text-transform: uppercase; letter-spacing: .04em; }
.ul-funktion { background: var(--rot); color: #fff; }
.ul-kosmetik { background: var(--soft); color: var(--text); }
.ul-korrektur { background: none; border: 1px solid var(--border-strong); color: var(--grau); }
#view-info { padding-bottom: 24px !important; }

/* IP-Felder: Ziffern mittig gut lesbar, ungültig rot; Ziffernblock der Bildschirmtastatur */
.e-page input[data-ip] { font-variant-numeric: tabular-nums; letter-spacing: .03em; min-width: 14em; }
.e-page input.e-invalid { border-color: var(--error) !important; box-shadow: 0 0 0 1px var(--error); }
.osk.osk-ip .osk-row { justify-content: center; }
.osk.osk-ip .osk-key { flex: 0 0 140px; font-size: 22px; }
.osk.osk-ip .osk-close, .osk.osk-ip .osk-enter { flex: 0 0 196px; font-size: 17px; }
.e-page .e-col:has(> .e-field) > .e-kv > :first-child { flex: 0 0 34%; max-width: 230px; padding-left: 0; }

/* Erklärsatz: auf der Kachel unter dem Namen, im Pop-up unter dem Titel */
.node-tile .nt-sub { white-space: normal; }
.sheet-desc { display: none; }
#view-page.sheet .sheet-desc:not([hidden]) { display: block; flex: none; margin: 0 0 10px; padding: 0 2px 10px; border-bottom: 1px solid var(--line); font-size: 16px; line-height: 1.35; color: var(--grau); }
.info-note { margin: 6px 6px 0; font-size: 14px; color: var(--muted); }

/* ================================================================================
   0.5.0 – aus dem Feedback-Portal
   ================================================================================ */

/* #1 Start: drei Batteriewerte füllen den Kasten – groß, gleichmäßig verteilt, von weitem lesbar */
#view-overview .battery { justify-content: space-evenly; padding: 4px 20px; }
#view-overview .battery .measure {
  flex: 1; min-height: 0; flex-direction: column; justify-content: center; align-items: flex-start;
  padding: 0; border-bottom: 1px solid var(--line);
}
#view-overview .battery .measure:last-child { border-bottom: 0; }
#view-overview .battery .measure .label { font-size: 17px; }
#view-overview .battery .measure .value { font-size: 44px; line-height: 1.1; margin-top: 4px; }

/* #2 Zurück: kräftig hervorgehoben (gefüllt, größerer Pfeil) */
.back-btn {
  background: var(--rot) !important; border-color: var(--rot) !important; color: #fff !important;
  padding: 0 22px 0 12px !important; font-size: 20px !important; box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}
.back-btn svg { width: 30px; height: 30px; stroke: #fff; stroke-width: 3; }

/* #3 Betriebszustände sind Tasten: Antippen führt zur passenden Stelle */
.land-ops li { padding: 0 !important; }
.land-ops li button {
  flex: 1; align-self: stretch; display: flex; align-items: center; padding: 0 12px 0 16px;
  background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.land-ops li .lamp { margin-right: 12px; }
.land-ops li .t { flex: 1; }
.land-ops li .pfeil { font-size: 28px; line-height: 1; opacity: .7; }

/* #6 Kurze Erklärung unter einer Taste (z. B. Prüfintervall → Testzeiten einstellen) */
.tool.mit-desc { display: inline-flex; flex-direction: column; justify-content: center; line-height: 1.15; }
.tool.mit-desc small { display: block; margin-top: 3px; font-size: 13px; font-weight: 400; opacity: .75; }

/* Info → Software: Version und Build in derselben Spaltenaufteilung wie „Anlage“, untereinander */
.info-card .kv tr.kv-link { cursor: pointer; }
.info-card .kv tr.kv-link:active td { background: var(--press); }
.info-card .kv tr.kv-link b { font-weight: 700; }
.info-card .kv tr.kv-link .chev { margin-left: 16px; font-size: 14px; color: var(--rot); white-space: nowrap; }

/* Tests: laufenden Test in der Liste kennzeichnen, bei den anderen sagen, welcher läuft */
.test-list button.laeuft { border-color: var(--active); color: var(--active); }
.test-list .badge-laeuft {
  margin-left: auto; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 700;
  background: var(--tint-active); color: var(--active); border: 1px solid var(--active); animation: blink 1.4s infinite;
}
.test-list button { display: flex; align-items: center; gap: 8px; text-align: left; }
.test-running.anderer { gap: 10px; }
.test-running.anderer span:not(.lamp) { flex: 1; }
.test-running.anderer .tool { height: 38px; padding: 0 14px; font-size: 15px; }
