/* Wilhelm & Willhalm – LED-Monitoring
   Design-System: WWVT-Corporate-Design (Anthrazit als Struktur, WWVT-Blau als Akzent),
   Betriebszustände in eigenen Farben. Kompakt, desktop-first, Leitwarten-Charakter. */

:root {
  /* Flächen, aus WWVT-Anthrazit #253539 abgeleitet */
  --bg: #101719;
  --bg-2: #182327;
  --panel: #253539;
  --panel-2: #2d4146;
  --line: #3a5055;
  --line-soft: #2f4247;
  /* Text */
  --text: #f2f5f6;
  --text-2: #aab5b8;
  --muted: #7f8c90;
  /* Corporate */
  --accent: #88bce7;
  --accent-ink: #0f1c26;
  --grey: #706f6f;
  /* Diagrammreihen (System-Reiter): Pi 1 / Pi 2. WWVT-Blau ist als Linie auf Anthrazit zu hell
     und zu wenig gesättigt (Palette-Validator) – daher die nächste gültige Stufe desselben Blaus;
     Orange als zweite Reihe, farbfehlsichtigkeits-geprüft (ΔE 24,7) */
  --series-1: #4a9be0;
  --series-2: #d95926;
  --grid: #33474c;
  /* Betriebszustände – getrennt vom CD */
  --ok: #35b979;
  --warn: #e4a62a;
  --alarm: #d95757;
  --off: #706f6f;
  --unknown: #5c6b70;
  /* Maße */
  --radius: 4px;
  --radius-lg: 6px;
  --top-h: 48px;
  --nav-w: 236px;
  --detail-w: 380px;
  --font: "Calibri", "Carlito", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.4 var(--font); }
body { min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
h1, h2, h3, h4 { font-weight: 700; margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.spacer { flex: 1; }
.meta { color: var(--text-2); font-size: 13px; }
.hint { font-size: 12.5px; color: var(--muted); }

/* ================= Kopfleiste ================= */
.top {
  height: var(--top-h); display: flex; align-items: center; gap: 12px;
  padding: 0 12px 0 10px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; padding-right: 12px; border-right: 1px solid var(--line); height: 100%; }
.brand:hover { text-decoration: none; }
.brand img { height: 26px; width: auto; display: block; }
.brand .wordmark { line-height: 1.1; }
.brand .wordmark b { display: block; font-size: 13px; font-weight: 700; letter-spacing: .04em; }
.brand .wordmark span { display: block; font-size: 11.5px; color: var(--text-2); }
.top .meta, .top .btn, .sysstate { white-space: nowrap; }
.top .divider { width: 1px; height: 24px; background: var(--line); }

/* Gesamtzustand in der Kopfleiste */
.sysstate { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; padding: 4px 10px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); }
.sysstate .dot { width: 9px; height: 9px; border-radius: 2px; background: var(--unknown); }
.sysstate.ok .dot { background: var(--ok); }
.sysstate.warn .dot { background: var(--warn); }
.sysstate.alarm .dot, .sysstate.offline .dot { background: var(--alarm); }
.sysstate.alarm, .sysstate.offline { border-color: color-mix(in srgb, var(--alarm) 60%, var(--line)); }
.sysstate.warn { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); }
.sysstate small { font-weight: 400; color: var(--text-2); }

.userbox { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.userbox .who { color: var(--text); }
.userbox .role { color: var(--muted); }

#progressbar { height: 2px; background: transparent; position: sticky; top: var(--top-h); z-index: 20; }
#progressbar.on { background: var(--line-soft); }
#progressbar-fill { height: 100%; width: 0%; background: var(--accent); transition: width .4s ease; }

/* ================= Anwendungsrahmen: Navigation | Inhalt | Detail ================= */
.shell { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: calc(100vh - var(--top-h) - 2px); }
.shell.with-detail { grid-template-columns: var(--nav-w) minmax(0, 1fr) var(--detail-w); }
.nav { background: var(--bg-2); border-right: 1px solid var(--line); padding: 8px 0; overflow-y: auto;
  position: sticky; top: calc(var(--top-h) + 2px); height: calc(100vh - var(--top-h) - 2px); font-size: 13.5px; }
.nav .navhead { padding: 6px 14px 4px; color: var(--muted); font-size: 12px; }
.nav a, .nav button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 5px 12px 5px 14px;
  color: var(--text-2); background: none; border: 0; border-left: 3px solid transparent; font: inherit; cursor: pointer; }
.nav a:hover, .nav button:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.nav .on { background: var(--panel); color: var(--text); border-left-color: var(--accent); }
.nav .grp { font-weight: 700; color: var(--text); padding-top: 7px; padding-bottom: 7px; }
.nav .grp .arrow { width: 10px; color: var(--muted); font-size: 11px; }
.nav .item { padding-left: 34px; }
.nav .item.on { color: var(--accent); }
.nav .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav .cnt { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav .cnt.alarm { color: var(--alarm); font-weight: 700; }
.nav .cnt.warn { color: var(--warn); font-weight: 700; }
.nav .grp + .sub { margin-bottom: 4px; }

/* Zustandsmarker: kleines Quadrat, ruhig bei OK */
.sq { width: 8px; height: 8px; border-radius: 2px; flex: none; background: var(--unknown); }
.sq.ok { background: var(--ok); opacity: .55; }
.sq.warn { background: var(--warn); }
.sq.alarm, .sq.offline { background: var(--alarm); }
.sq.scheduled_off, .sq.disabled { background: var(--off); opacity: .6; }
.on .sq.ok, tr:hover .sq.ok { opacity: .9; }

.content { padding: 12px 16px 24px; min-width: 0; }
.navselect { display: none; }
.content.kiosk-content { padding: 12px; }

/* Abschnittsleiste über einer Tabelle */
.sectionbar { display: flex; align-items: center; gap: 10px; padding: 6px 0 6px; margin-top: 10px; border-bottom: 1px solid var(--line); }
.sectionbar:first-child { margin-top: 0; }
.sectionbar h2 { font-size: 14px; }
.sectionbar .summary { color: var(--muted); font-size: 12.5px; }
.sectionbar .summary .alarm { color: var(--alarm); font-weight: 700; }
.sectionbar .summary .warn { color: var(--warn); font-weight: 700; }
.toolrow { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }

/* ================= Monitoring-Tabelle ================= */
.mon { width: 100%; border-collapse: collapse; font-size: 13.5px; table-layout: fixed; }
.mon th { text-align: left; color: var(--muted); font-weight: 400; font-size: 12px; padding: 5px 8px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.mon td { padding: 0 8px; height: 30px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.mon th.num, .mon td.num { text-align: right; }
.mon tr.wrow { cursor: pointer; }
.mon tr.wrow:hover td { background: var(--bg-2); }
.mon tr.wrow.sel td { background: var(--panel); }
.mon tr.wrow.sel td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.mon td.sys { font-weight: 700; color: var(--text); }
.mon td.sys .loc { font-weight: 400; color: var(--muted); margin-left: 6px; font-size: 12.5px; }
.mon td.st { display: flex; align-items: center; gap: 7px; height: 30px; }
.mon tr.alarm td.st, .mon tr.offline td.st { color: var(--alarm); font-weight: 700; }
.mon tr.warn td.st { color: var(--warn); font-weight: 700; }
.mon tr.unknown td.st, .mon tr.scheduled_off td.st, .mon tr.disabled td.st { color: var(--muted); }
.mon tr.ok td.st { color: var(--text-2); }
.mon tr.alarm td:first-child, .mon tr.offline td:first-child { box-shadow: inset 3px 0 0 var(--alarm); }
.mon tr.warn td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.mon tr.wrow.sel.alarm td:first-child, .mon tr.wrow.sel.warn td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.mon td.bad { color: var(--alarm); font-weight: 700; }
.mon td.hot { color: var(--warn); font-weight: 700; }
.mon td.age { color: var(--muted); }
.mon td.age.stale { color: var(--warn); }
.mon td.grid { padding: 3px 8px; }
.mon td.grid .mini { display: block; height: 22px; width: 100%; max-width: 120px; }
.mon td.grid .mini canvas { display: block; }
.mon .msgs { color: var(--text-2); font-size: 12.5px; }
.mon .msgs .m { color: var(--alarm); }
.mon tr.detail-row td { height: auto; padding: 8px 8px 10px 19px; background: var(--bg-2); white-space: normal; }

/* Meldungsleiste über der Tabelle */
.alerts { border: 1px solid color-mix(in srgb, var(--alarm) 55%, var(--line)); border-left: 3px solid var(--alarm);
  background: color-mix(in srgb, var(--alarm) 8%, var(--bg-2)); border-radius: var(--radius); margin-bottom: 12px; font-size: 13px; }
.alerts .head { display: flex; align-items: center; gap: 10px; padding: 6px 10px; cursor: pointer; font-weight: 700; }
.alerts .head .arrow { color: var(--muted); font-size: 11px; }
.alerts ul { margin: 0; padding: 0 10px 8px 10px; list-style: none; }
.alerts li { padding: 3px 0; border-top: 1px solid var(--line-soft); display: flex; gap: 8px; }
.alerts li b { min-width: 140px; }
.alerts li .when { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }

/* ================= Detailfenster (rechts) ================= */
.detailpane { background: var(--bg-2); border-left: 1px solid var(--line); position: sticky; top: calc(var(--top-h) + 2px);
  height: calc(100vh - var(--top-h) - 2px); overflow-y: auto; font-size: 13.5px; }
.detailpane .dhead { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; }
.detailpane .dhead h2 { font-size: 15px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detailpane .dhead .close { background: none; border: 0; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 2px 4px; }
.detailpane .dhead .close:hover { color: var(--text); }
.detailpane .dsec { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
.detailpane .dsec h3 { font-size: 12px; color: var(--muted); font-weight: 400; margin-bottom: 6px; }
.detailpane .stateline { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.detailpane .stateline.alarm, .detailpane .stateline.offline { color: var(--alarm); }
.detailpane .stateline.warn { color: var(--warn); }
.detailpane .stateline.ok { color: var(--ok); }
.detailpane .stateline.unknown, .detailpane .stateline.scheduled_off { color: var(--text-2); }
.kvlist { display: grid; grid-template-columns: 128px 1fr; gap: 3px 10px; font-size: 13px; }
.kvlist span { color: var(--muted); }
.kvlist b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.kvlist b.bad { color: var(--alarm); }
.kvlist b.hot { color: var(--warn); }
.detailpane .wallframe { padding: 6px; }
.detailpane .warnlist { margin: 0; padding: 0; list-style: none; font-size: 13px; }
.detailpane .warnlist li { padding: 4px 0 4px 10px; border-left: 2px solid var(--alarm); margin-bottom: 4px; }
.detailpane .warnlist li.warn { border-left-color: var(--warn); }
.detailpane .warnlist .when { display: block; color: var(--muted); font-size: 12px; }
.detailpane .cabinfo { margin-top: 6px; font-size: 12.5px; color: var(--text-2); min-height: 18px; }

/* ================= Kabinettraster ================= */
.wall { display: grid; gap: 2px; margin: 0 auto; }
.wallframe { background: var(--bg); border: 1px solid var(--line-soft); padding: 8px; border-radius: var(--radius); }
.cab {
  position: relative; background: var(--panel-2); border-radius: 1px; min-width: 0;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  color: var(--text-2); overflow: hidden; border: 0; padding: 0; font: inherit; cursor: default;
}
.cab.ok { background: var(--panel-2); }
.cab.empty { background: transparent; outline: 1px dashed var(--line-soft); outline-offset: -1px; }
.cab.unknown { background: #1f2c31; color: var(--muted); }
.cab.scheduled_off { background: #182226; color: var(--muted); }
.cab.warn { background: color-mix(in srgb, var(--warn) 55%, var(--panel-2)); color: #fff; }
.cab.alarm { background: var(--alarm); color: #fff; }
.cab.offline {
  background: repeating-linear-gradient(135deg, #4a2426 0 4px, #33191b 4px 8px);
  color: #ffb3b5; box-shadow: inset 0 0 0 1px var(--alarm);
}
.cab.heat { color: #fff; }
.cab .t { font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.cab .l { font-size: .7em; opacity: .75; line-height: 1.1; }
.cab.sel { outline: 2px solid var(--accent); outline-offset: 1px; z-index: 1; }
button.cab { cursor: pointer; }
.cab .mark { position: absolute; top: 2px; right: 2px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.mini .cab .mark { width: 3px; height: 3px; top: 1px; right: 1px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 12.5px; margin-top: 8px; }
.legend .key { display: inline-flex; align-items: center; gap: 5px; }
.legend .key i { width: 12px; height: 9px; border-radius: 1px; display: inline-block; }
.scale { width: 160px; height: 8px; border-radius: 2px; }

/* ================= Zustandschip (kompakt, eckig) ================= */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 1px 7px 1px 6px; border-radius: 3px; font-size: 12.5px;
  font-weight: 700; background: var(--panel-2); color: var(--text-2); white-space: nowrap; border: 1px solid transparent; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--unknown); }
.pill.ok { color: var(--text-2); }
.pill.ok::before { background: var(--ok); }
.pill.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.pill.warn::before { background: var(--warn); }
.pill.alarm, .pill.offline { color: #ffc6c6; background: color-mix(in srgb, var(--alarm) 25%, var(--panel-2)); border-color: color-mix(in srgb, var(--alarm) 55%, transparent); }
.pill.alarm::before, .pill.offline::before { background: var(--alarm); }

/* ================= Bedienelemente ================= */
.btn {
  font: inherit; font-size: 13px; font-weight: 700; border-radius: var(--radius); padding: 5px 12px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text); line-height: 1.3;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #9dc9ec; }
.btn.danger { color: #ffb3b5; }
.btn.small { padding: 3px 9px; font-size: 12.5px; }
.btn.ghost { background: transparent; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg button { background: none; border: 0; color: var(--text-2); padding: 4px 11px; font: inherit; font-size: 13px; cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
/* Verwaltung: Reihenfolge der Gruppen */
.grporder { list-style: none; margin: 0; padding: 0; }
.grporder li { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line-soft); }
.grporder li:last-child { border-bottom: 0; }
.grporder .pos { width: 3ch; text-align: right; color: var(--muted); }
.grporder .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grporder .btn { min-width: 34px; }
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; color: var(--text-2); font: inherit; font-size: 13.5px; padding: 8px 12px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 700; }
input, select, textarea {
  font: inherit; font-size: 13.5px; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 5px 8px; min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }
input[type=range] { padding: 0; background: none; border: 0; }
label.f, div.f { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--text-2); }
label.f.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 13.5px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.msg { font-size: 13px; }
.msg.err { color: #ff9a9d; }
.msg.ok { color: #8fe0b8; }
.banner { background: color-mix(in srgb, var(--warn) 14%, var(--panel)); border: 1px solid var(--warn); border-left-width: 3px;
  padding: 7px 12px; border-radius: var(--radius); margin-bottom: 12px; font-size: 13px; }
.tag { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; vertical-align: 1px;
  padding: 0 5px; border-radius: 3px; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); }

/* ================= Panels, Tabellen (Verwaltung, Wanddetail) ================= */
main { padding: 16px; max-width: 1500px; margin: 0 auto; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px; margin-bottom: 12px; }
.panel h3 { font-size: 14px; margin-bottom: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 16px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
th { color: var(--muted); font-weight: 400; font-size: 12.5px; }
td.num, th.num { text-align: right; }
.tablewrap { overflow-x: auto; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); }
.login { max-width: 360px; margin: 10vh auto; }
.empty-state { color: var(--muted); padding: 32px 0; }
.note { color: var(--text-2); font-size: 13px; border-left: 3px solid var(--accent); padding: 4px 10px; margin: 0 0 12px; }

/* Wanddetail-Seite */
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.screenhead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.screenhead h2 { font-size: 18px; }
.screenhead .loc { color: var(--muted); }
.kv { display: flex; gap: 0; flex-wrap: wrap; margin-bottom: 12px; font-size: 13px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); }
.kv div { padding: 6px 14px; border-right: 1px solid var(--line-soft); }
.kv div:last-child { border-right: 0; }
.kv div span { display: block; color: var(--muted); font-size: 12px; }
.kv div b { font-weight: 700; font-size: 14px; }
.detail { margin-top: 8px; min-height: 20px; font-size: 13px; }

/* ================= System-Reiter ================= */
.sys-filter { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.sys-nodes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr)); gap: 16px; }
.sys-nodes > .panel { margin-bottom: 0; }
.sys-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.sys-head b { font-size: 15px; }
.sys-key { display: inline-block; width: 16px; height: 3px; border-radius: 2px; }
.sys-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; margin-bottom: 12px; }
.sys-tile { background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 8px 10px; }
.sys-tile .l { font-size: 12px; color: var(--text-2); }
.sys-tile .v { font-size: 20px; font-weight: 600; line-height: 1.25; white-space: nowrap; }
.sys-tile .v small { font-size: 13px; font-weight: 400; color: var(--text-2); margin-left: 2px; }
.sys-tile .s { font-size: 11.5px; color: var(--muted); }
.meter { height: 4px; background: var(--panel-2); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.meter.warn > i { background: var(--warn); }
.meter.alarm > i { background: var(--alarm); }
.sys-status { list-style: none; padding: 0; margin: 0 0 4px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 4px 14px; font-size: 13px; }
.sys-status li { display: flex; gap: 7px; align-items: baseline; }
.sys-status .ic { width: 14px; flex: none; text-align: center; font-weight: 700; }
.ic.ok { color: var(--ok); } .ic.warn { color: var(--warn); } .ic.alarm { color: var(--alarm); } .ic.info { color: var(--muted); }
.sys-status .lbl { color: var(--text-2); }
.sys-block { border-top: 1px solid var(--line-soft); padding-top: 10px; margin-top: 10px; }
.sys-block h4 { margin: 0 0 6px; font-size: 13px; color: var(--text-2); font-weight: 700; }
.sys-block .kvlist { grid-template-columns: 150px 1fr; }
.sys-block table { font-size: 12.5px; }
.sys-block td, .sys-block th { padding: 4px 6px; }
.sys-block .hint { margin: 6px 0 0; }
.sys-h { font-size: 14px; margin: 22px 0 6px; }
.sys-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr)); gap: 16px; }
.sys-charts > .panel { margin-bottom: 0; }
.sys-chart { position: relative; }
.sys-chart .chead { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.sys-chart .chead h4 { margin: 0; font-size: 13.5px; }
.sys-chart .chead .unit { color: var(--muted); font-size: 12px; }
.sys-chart .chead .spacer { flex: 1; }
.sys-legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); }
.sys-legend i { display: inline-block; width: 14px; height: 2px; border-radius: 1px; vertical-align: middle; margin-right: 5px; }
.sys-chart svg { display: block; width: 100%; overflow: visible; }
.sys-chart svg text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.sys-chart svg .endlbl { fill: var(--text-2); font-size: 11.5px; font-weight: 700; }
.sys-chart svg:focus { outline: 1px solid var(--accent); outline-offset: 2px; }
.sys-chart.stale svg { opacity: .55; }
.sys-tip { position: absolute; pointer-events: none; z-index: 5; background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 6px 9px; font-size: 12px; white-space: nowrap; box-shadow: 0 3px 10px rgba(0,0,0,.35); }
.sys-tip .tt { color: var(--muted); margin-bottom: 3px; }
.sys-tip .tr { display: flex; gap: 7px; align-items: center; }
.sys-tip .tr i { display: inline-block; width: 12px; height: 2px; border-radius: 1px; }
.sys-tip .tr b { color: var(--text); font-weight: 700; min-width: 48px; }
.sys-tip .tr span { color: var(--text-2); }
.sys-chart .tview { max-height: 210px; overflow: auto; margin-top: 8px; }
.sys-chart .tview table { font-size: 12px; }
.sys-chart .tview td, .sys-chart .tview th { padding: 3px 8px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-size: 12px; cursor: pointer; }

/* ================= Responsiv ================= */
@media (max-width: 1280px) {
  .shell.with-detail { grid-template-columns: var(--nav-w) minmax(0, 1fr); }
  .detailpane { position: fixed; right: 0; top: calc(var(--top-h) + 2px); width: min(var(--detail-w), 100vw); z-index: 15;
    box-shadow: -6px 0 18px rgba(0,0,0,.35); }
}
@media (max-width: 860px) {
  .shell, .shell.with-detail { grid-template-columns: 1fr; }
  .nav { display: none; }
  .navselect { display: block; margin-bottom: 10px; }
  .navselect select { width: 100%; }
  .top .meta, .userbox .role { display: none; }
  #tables { overflow-x: auto; }
  .top .wordmark span { display: none; }
  .mon th.opt, .mon td.opt { display: none; }
  .mon { table-layout: auto; }
  .mon col { width: auto !important; }
  .mon td.sys { max-width: 40vw; }
  .sysstate small, .brand .wordmark b { display: none; }
  .brand { padding-right: 8px; }
  main { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ================= Kiosk (Touch-Display am Pi) =================
   Eigener Scrollcontainer (touch-action:none, Ziehen = Bildlauf per JS), große Zeilen und
   Tasten, keine Navigation links, Gruppen als Tastenleiste oben. */
body.kiosk { cursor: none; user-select: none; -webkit-user-select: none; overscroll-behavior: none; scrollbar-width: none; overflow: hidden; }
body.kiosk::-webkit-scrollbar, html:has(body.kiosk)::-webkit-scrollbar { display: none; }
body.kiosk a, body.kiosk img { -webkit-user-drag: none; }
body.kiosk .nav, body.kiosk .detailpane, body.kiosk .navselect { display: none; }
body.kiosk .shell, body.kiosk .shell.with-detail { display: block; }
body.kiosk .content, body.kiosk main {
  height: calc(100vh - var(--top-h) - 2px); overflow-y: auto; overflow-x: hidden; touch-action: none;
  padding: 10px 14px 40px; max-width: none; scrollbar-width: none;
}
body.kiosk .content::-webkit-scrollbar, body.kiosk main::-webkit-scrollbar { display: none; }
body.kiosk .top { height: 56px; }
body.kiosk .sysstate { font-size: 16px; padding: 7px 14px; }
body.kiosk .top .meta { font-size: 15px; }
.kioskbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.kbtn { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 16px; font: inherit; font-size: 16px; font-weight: 700;
  color: var(--text-2); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.kbtn .sq { width: 11px; height: 11px; }
.kbtn .cnt { font-size: 14px; }
.kbtn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.kbtn.on .cnt, .kbtn.on .cnt.alarm, .kbtn.on .cnt.warn { color: var(--accent-ink); }
body.kiosk .sectionbar { padding: 10px 0 8px; margin-top: 14px; }
body.kiosk .sectionbar h2 { font-size: 17px; }
body.kiosk .sectionbar .summary { font-size: 14px; }
body.kiosk .mon { font-size: 17px; }
body.kiosk .mon th { font-size: 13.5px; padding: 6px 10px; }
body.kiosk .mon td { height: 56px; padding: 0 10px; }
body.kiosk .mon td.st { height: 56px; gap: 10px; }
body.kiosk .mon .sq { width: 12px; height: 12px; }
body.kiosk .mon td.grid .mini { height: 34px; max-width: 170px; }
body.kiosk .mon .msgs { font-size: 14px; }
body.kiosk .mon tr.wrow:active td { background: var(--panel-2); }
body.kiosk .mon tr.wrow.sel td { background: transparent; }
/* Wandseite im Kiosk */
body.kiosk .kioskback { font-size: 16px; padding: 9px 16px; min-height: 44px; }
body.kiosk .screenhead h2 { font-size: 22px; }
body.kiosk .seg button { padding: 10px 16px; font-size: 15px; }
body.kiosk .kv div b { font-size: 17px; }
body.kiosk .kv div { padding: 8px 16px; }
body.kiosk .btn:not(.kioskback) { min-height: 40px; padding: 8px 14px; font-size: 14px; }
body.kiosk .legend { font-size: 14px; }

/* ---------- Übersicht als Kacheln (wenige Wände): je Wand eine Karte mit dem Kabinettraster ---------- */
.viewbar { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.viewbar.hidden { display: none; }
.walls { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; margin-top: 10px; }
.walls.single { grid-template-columns: 1fr; }
.wallcard { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); color: var(--text); text-decoration: none; min-width: 0; }
.wallcard:hover { text-decoration: none; border-color: var(--accent); }
.wallcard.alarm, .wallcard.offline { border-color: color-mix(in srgb, var(--alarm) 70%, var(--line)); }
.wallcard.warn { border-color: color-mix(in srgb, var(--warn) 60%, var(--line)); }
.wallcard header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.wallcard h2 { margin: 0; font-size: 18px; font-weight: 700; }
.wallcard .loc { color: var(--muted); font-size: 13px; }
.wallcard .stateline { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; white-space: nowrap; color: var(--text-2); }
.wallcard .stateline.alarm, .wallcard .stateline.offline { color: var(--alarm); font-weight: 700; }
.wallcard .stateline.warn { color: var(--warn); font-weight: 700; }
.wallcard .wallframe { flex: 1; display: flex; align-items: center; }
.wallcard .wallframe .wall { width: 100%; }
.wallcard .tilenote { flex: 1; display: grid; place-items: center; min-height: 90px; color: var(--muted); font-size: 14px;
  background: var(--bg); border: 1px solid var(--line-soft); border-radius: var(--radius); }
.wallcard .facts { display: flex; flex-wrap: wrap; gap: 8px 22px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.wallcard .facts div { display: flex; flex-direction: column; }
.wallcard .facts b { font-size: 17px; font-weight: 700; }
.wallcard .facts b.bad { color: var(--alarm); }
.wallcard .facts b.hot { color: var(--warn); }
.wallcard .facts span { color: var(--muted); font-size: 12px; }
.wallcard .facts .age { margin-left: auto; text-align: right; }
@media (max-width: 640px) { .walls { grid-template-columns: 1fr; } .wallcard .stateline { white-space: normal; } }
body.kiosk .wallcard { -webkit-tap-highlight-color: transparent; }
body.kiosk .viewbar { display: none; }

