/* =====================================================================
   Funksystem-Portal – Gestaltung
   Bewusst ohne Framework. Farben als Variablen; Schrift aus dem System
   (keine externen Schriftdateien, keine Verbindung zu Fremdservern).
   ===================================================================== */

:root {
  --ink: #1d1d1b;
  --quiet: #66645e;
  --line: #e2e0db;
  --bg: #f5f4f1;
  --card: #ffffff;
  --head: #141414;
  --accent: #c8233c;
  --accent-soft: #fbe9ec;
  --ok: #1f8a4c;      --ok-soft: #e3f4ea;
  --warn: #b7791f;    --warn-soft: #fdf3e1;
  --crit: #c8233c;    --crit-soft: #fbe9ec;
  --unk: #8a877f;     --unk-soft: #efeeea;
  --maint: #3b6fb6;   --maint-soft: #e6eef9;
  --radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
}

* { box-sizing: border-box; }
/* Platz für den senkrechten Scrollbalken immer reservieren: Nichts verschiebt
   sich, wenn eine Seite länger wird und der Balken erscheint. */
body { margin: 0; background: var(--bg); }
/* Aufbau angemeldet: Kopfzeile oben, Fusszeile ganz unten, dazwischen scrollt
   nur der Inhalt. Der Platz für den Scrollbalken ist immer reserviert, damit
   sich nichts verschiebt, wenn er erscheint. */
body.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
body.app > .topbar, body.app > .footer { flex: none; overflow-y: hidden; scrollbar-gutter: stable; } /* gleiche Breite wie der Inhalt mit Scrollbalken */
/* position: relative (ab 1.59.7): Absolut platzierte Elemente (z. B. .sr-only)
   bleiben im scrollenden Bereich. Ohne das verlängerten sie die ganze Seite,
   und ein Sprung zu einem Abschnitt (/profile#push) schob die Kopfzeile weg. */
body.app > .scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-gutter: stable; position: relative; }
body.auth-page { min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
p { margin: 0 0 .75rem; }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .9em; }
small, .muted { color: var(--quiet); }

/* --- Kopfzeile ------------------------------------------------------ */
.topbar { background: var(--head); color: #fff; }
.topbar .inner { max-width: 1280px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 32px; height: 68px; }
/* Logo: offizielle OKULA-Dateien (CI 2021), Kopfzeile negativ, Anmeldung positiv */
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; white-space: nowrap; }
.brand img { height: 32px; width: auto; display: block; }
.brand span { font-size: .78rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: #fff; opacity: .7;
  padding-left: 12px; border-left: 1px solid rgba(255,255,255,.3); line-height: 32px; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav a { color: #cfccc6; padding: 6px 12px; border-radius: 6px; white-space: nowrap; font-size: .93rem; }
.nav a:hover, .nav a.active { color: #fff; background: rgba(255,255,255,.1); text-decoration: none; }
.nav .badge { background: var(--accent); color: #fff; border-radius: 10px; padding: 0 7px; font-size: .75rem; margin-left: 4px; }
.usermenu { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: #cfccc6; }
.usermenu form { margin: 0; }
.usermenu .iconbtn.current { background: rgba(255,255,255,.12); border-color: #77756f; } /* Zahnrad: in den Einstellungen */
/* Symbol-Knöpfe rechts (Sprache, Profil, Abmelden): alle gleich gross, rund,
   mit sichtbarem Hover und Tastatur-Fokus */
.iconbtn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  padding: 0; border: 1px solid #3a3a38; border-radius: 50%; background: none; color: #cfccc6; cursor: pointer; list-style: none; }
.iconbtn::-webkit-details-marker { display: none; }
.iconbtn img { width: 20px; height: 20px; display: block; }
.iconbtn img.flag { border-radius: 50%; }
.iconbtn:hover, .menu[open] > .iconbtn { background: rgba(255,255,255,.12); border-color: #77756f; text-decoration: none; }
.iconbtn:focus-visible, .menu-panel button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.iconbtn .code { position: absolute; right: -4px; bottom: -3px; background: var(--head); color: #fff; border: 1px solid #77756f;
  border-radius: 6px; font-size: .58rem; font-weight: 700; line-height: 1; padding: 2px 3px; letter-spacing: .03em; }
/* Aufklappmenü der Sprache. position: fixed, weil die Kopfzeile überstehenden
   Inhalt abschneidet; app.js richtet es unter dem Knopf aus. */
.menu { position: relative; }
.menu-panel { position: fixed; top: 64px; right: 20px; z-index: 50; min-width: 170px; margin: 0; padding: 6px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.menu-panel button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px;
  background: none; color: var(--ink); font: inherit; font-size: .92rem; text-align: left; cursor: pointer; }
.menu-panel button:hover { background: var(--bg); }
.menu-panel button.current { font-weight: 700; }
.menu-panel button.current::after { content: "✓"; margin-left: auto; color: var(--accent); }
.menu-panel img.flag { width: 20px; height: 20px; border-radius: 50%; }
/* Sprachwahl unter dem Anmeldefenster */
.langswitch { display: flex; justify-content: center; gap: 4px; margin-top: 20px; }
.langswitch form { margin: 0; display: flex; gap: 4px; }
.langswitch button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 6px;
  padding: 4px 10px; font: inherit; font-size: .85rem; color: var(--quiet); cursor: pointer; }
.langswitch button.current { color: var(--ink); font-weight: 700; border-color: #a8a49a; }
.langswitch button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.langswitch img { width: 16px; height: 16px; border-radius: 50%; }
/* Sprachwahl im Profil */
.langchoice { display: flex; gap: 8px; flex-wrap: wrap; }
.langchoice img { width: 18px; height: 18px; border-radius: 50%; }

/* --- Inhalt --------------------------------------------------------- */
main { max-width: 1280px; margin: 0 auto; padding: 24px 20px 40px; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.pagehead .crumbs { font-size: .85rem; color: var(--quiet); margin-bottom: 2px; }
.pagehead .crumbs a { color: var(--quiet); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 20px; }
.card > h2:first-child { margin-top: 0; }
.card.flush { padding: 0; }
.card.flush > h2 { padding: 16px 20px 0; }
.subform { border-top: 1px solid var(--line); padding: 14px 20px 16px; background: #fbfaf8; border-radius: 0 0 var(--radius) var(--radius); }
.grid { display: grid; gap: 20px; margin-bottom: 20px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid > .card { margin-bottom: 0; }

/* --- Kennzahlen ----------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .n { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.stat .l { color: var(--quiet); font-size: .85rem; }
.stat.critical .n { color: var(--crit); }
.stat.warning .n { color: var(--warn); }
.stat.ok .n { color: var(--ok); }

/* --- Tabellen ------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th { text-align: left; font-weight: 600; color: var(--quiet); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #faf9f7; }
.card.flush table th:first-child, .card.flush table td:first-child { padding-left: 20px; }
.card.flush table th:last-child, .card.flush table td:last-child { padding-right: 20px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

/* --- Statuskennzeichen ---------------------------------------------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; background: var(--unk-soft); color: var(--unk); }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.ok, .pill.online { background: var(--ok-soft); color: var(--ok); }
.pill.monitor { background: var(--maint-soft); color: var(--maint); } /* ohne Bridge, Monitor prüft selbst */
.pill.warning { background: var(--warn-soft); color: var(--warn); }
.pill.critical, .pill.offline { background: var(--crit-soft); color: var(--crit); }
.pill.maintenance { background: var(--maint-soft); color: var(--maint); }
.pill.plain::before { display: none; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--unk); vertical-align: middle; }
.dot.ok { background: var(--ok); } .dot.warning { background: var(--warn); } .dot.critical { background: var(--crit); } .dot.maintenance { background: var(--maint); }

/* --- Installationskacheln ------------------------------------------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.tile { display: block; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--unk); border-radius: var(--radius); padding: 12px 14px; color: var(--ink); }
.tile:hover { text-decoration: none; border-color: #cfccc6; }
.tile.ok { border-left-color: var(--ok); } .tile.warning { border-left-color: var(--warn); } .tile.critical { border-left-color: var(--crit); }
.tile .name { font-weight: 600; }
.tile .cust { font-size: .82rem; color: var(--quiet); }
.tile .meta { display: flex; gap: 10px; margin-top: 8px; font-size: .82rem; color: var(--quiet); flex-wrap: wrap; }
.customer-group { margin-bottom: 18px; }
.customer-group > h3 { margin: 0 0 8px; font-size: .9rem; color: var(--quiet); text-transform: uppercase; letter-spacing: .05em; }

/* --- Formulare ------------------------------------------------------ */
form.stack { display: grid; gap: 14px; max-width: 640px; }
form.inline { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin: 0; }
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 4px; }
label .hint, .hint { font-weight: 400; color: var(--quiet); font-size: .82rem; }
input[type=text], input[type=search], input[type=email], input[type=password], input[type=number], input[type=url], input[type=tel], input[type=datetime-local], input[type=date], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #cfccc6; border-radius: 6px; font: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.check input { width: auto; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin: 0; }
legend { font-weight: 600; padding: 0 6px; font-size: .9rem; }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 6px 16px; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 6px; border: 1px solid #cfccc6; background: #fff; color: var(--ink); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; border-color: #a8a49a; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #ad1d33; }
.btn.danger { color: var(--crit); }
.btn.small { padding: 4px 10px; font-size: .82rem; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 0; font-weight: 600; }

/* --- Meldungen ------------------------------------------------------ */
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; border: 1px solid; }
.flash.ok { background: var(--ok-soft); border-color: #b9e2c8; color: #165f35; }
.flash.error { background: var(--crit-soft); border-color: #f2c0c8; color: #8d1427; }
.flash.info { background: var(--maint-soft); border-color: #c4d6ef; color: #244d84; }
/* Alarmierung unterdrückt (Installation/Kunde nicht scharf, AlertArming) */
.flash.muted-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: #fff4e0; border-color: #f2d29b; color: #7a4b00; }
.flash.muted-banner form { margin: 0; }
.empty { color: var(--quiet); padding: 24px; text-align: center; }
.codebox { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.8rem; letter-spacing: .15em; background: var(--head); color: #fff; padding: 12px 20px; border-radius: 8px; display: inline-block; }

/* --- Anmeldung ------------------------------------------------------ */
/* Hintergrund: abstraktes Netz (login-bg.svg, vom OKULA Monitor übernommen).
   Das weisse Fenster in der Mitte bleibt im Vordergrund. */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 20px;
  background: #090b12 url("login-bg.svg") center / cover no-repeat; }
.auth .box { position: relative; background: #fff; border-radius: 16px; padding: 36px 36px 28px; width: 100%; max-width: 420px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .06); }
.auth .brand { color: var(--ink); margin-bottom: 6px; display: flex; align-items: center; gap: 12px; }
.auth .brand img { height: 30px; }
.auth .brand span { font-size: .78rem; letter-spacing: .22em; text-transform: uppercase; color: var(--quiet); padding-left: 12px; border-left: 1px solid var(--line); }
.auth .brand { margin-bottom: 26px; }
.auth h1 { font-size: 1.35rem; margin: 0 0 16px; }
.auth .divider { display: flex; align-items: center; gap: 12px; color: var(--quiet); font-size: .82rem; margin: 18px 0; }
.auth .divider::before, .auth .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth .stack label { font-size: .85rem; }
.auth-foot { color: rgba(255, 255, 255, .45); font-size: .78rem; text-align: center; }
.auth-foot a { color: inherit; }
.btn.ms { width: 100%; justify-content: center; background: #fff; border-color: #8c8c8c; }
.btn.ms svg { width: 18px; height: 18px; }
.btn.block { width: 100%; justify-content: center; }
.qr { background: #fff; padding: 8px; border: 1px solid var(--line); border-radius: 8px; display: inline-block; }

/* --- Diagramm ------------------------------------------------------- */
.spark { width: 100%; height: 120px; }
.spark path.line { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.spark path.area { fill: var(--accent-soft); }
.spark text { font-size: 10px; fill: var(--quiet); }

dl.props { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.props dt { color: var(--quiet); }
dl.props dd { margin: 0; }
ol.steps-list { margin: 0 0 12px; padding-left: 20px; }
ol.steps-list li { margin: 2px 0; }

@media (max-width: 720px) {
  .topbar .inner { gap: 12px; }
  .grid.two { grid-template-columns: 1fr; }
  main { padding: 16px 12px 48px; }
}

/* Verlaufsdiagramm (src/Util/SvgChart.php) */
.cardhead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.cardhead h2 { margin: 0; }
.cardhead form.inline { margin: 0; }
.chart { width: 100%; height: auto; display: block; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-label { font-size: 11px; fill: var(--quiet); }
.chart-band { fill: var(--accent-soft); }
/* Schalter Wertebereich über dem Diagramm (ganzer Bereich / zoomen) */
.chart-scale { margin: 0 0 .5rem auto; width: fit-content; font-size: .85rem; }
/* Zeitraum ohne Messwerte (Lücke, noch nicht oder nicht mehr gemessen) */
.chart-nodata { fill: var(--quiet); fill-opacity: .08; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 1.6; }
.chart-warn { stroke: var(--warn); stroke-width: 1; stroke-dasharray: 5 4; }
.chart-crit { stroke: var(--crit); stroke-width: 1; stroke-dasharray: 2 3; }
.cardhead form.inline { display: flex; gap: 6px; align-items: stretch; }
/* Knopf gleich hoch wie die Auswahlfelder daneben (z. B. "Anzeigen" beim Verlauf) */
.cardhead form.inline .btn { padding-top: 0; padding-bottom: 0; font-size: .9rem; }
.cardhead form.inline select { width: auto; }

/* --- Alarmkanäle und Pikett ----------------------------------------- */
ul.chanlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
ul.chanlist li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
ul.chanlist li.off strong, small.off, .off { color: var(--unk); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.oncall { font-size: 1.05rem; }
.oncall strong { color: var(--ok); }
.oncall.none strong { color: var(--crit); }

/* Einstellungen: Kacheln und Felder */
h2.section { margin: 28px 0 12px; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--quiet); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tile { display: flex; flex-direction: column; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; color: var(--ink); }
.tile:hover { border-color: var(--accent); text-decoration: none; }
.tile strong { font-size: 1rem; }
.tile span { color: var(--quiet); font-size: .88rem; line-height: 1.4; }
.tile small { margin-top: auto; padding-top: 6px; font-size: .8rem; color: var(--ink); }
.setting { max-width: 560px; }
.setting .hint { margin: 4px 0 0; }
label.check.small { font-size: .85rem; margin-top: 4px; }

/* Fusszeile und Fenster "Änderungen" */
.footer { background: var(--card); border-top: 1px solid var(--line); color: var(--quiet); font-size: .82rem; }
.footer .inner { max-width: 1280px; margin: 0 auto; padding: 10px 20px; display: flex; gap: 16px; justify-content: space-between; align-items: center; }
.footer a { color: var(--quiet); text-decoration: none; }
.footer a.version { border-bottom: 1px dotted currentColor; }
.footer a:hover { color: var(--accent); }
.dialog { border: 0; border-radius: 12px; padding: 0; width: min(680px, calc(100vw - 32px)); max-height: min(80vh, 760px); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.dialog::backdrop { background: rgba(20,20,20,.45); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); }
.dialog-head h2 { margin: 0; }
.dialog-body { padding: 8px 20px 20px; overflow: auto; }
.changelog-entry h3 { margin: 16px 0 6px; }
.changelog-entry h3 small { color: var(--quiet); font-weight: 400; margin-left: 6px; }
.changelog-entry ul { margin: 0; padding-left: 20px; }
.changelog-entry li { margin: 3px 0; }
/* Fenster: nur der Inhalt scrollt, der Rahmen bleibt rundum abgerundet
   (sonst sitzt der Scrollbalken auf der rechten Kante und die Ecken werden eckig). */
.dialog[open] { display: flex; flex-direction: column; overflow: hidden; }
.dialog-head { flex: none; position: static; }
.dialog-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: thin; }

/* --- Hauptmenü: alle Schaltflächen gleich breit ------------------------
   Breite nach dem längsten Begriff ("Einstellungen"); bei schmalen
   Bildschirmen schmaler, das Menü scrollt dann waagrecht. */
.nav a { flex: 0 0 8.4rem; display: inline-flex; justify-content: center; align-items: center; text-align: center; padding: 8px 6px; }
@media (max-width: 1180px) { .nav a { flex-basis: 7.2rem; font-size: .88rem; } }
@media (max-width: 720px) { .nav a { flex-basis: auto; padding: 6px 10px; } }

/* --- Kacheln mit Symbol (Einstellungen, Benutzer, Alarmierung) ----------
   Alle gleich hoch, unabhängig vom Inhalt: Beschreibung höchstens 3 Zeilen,
   Stand höchstens 1 Zeile. */
.tile.nav-tile { flex-direction: row; align-items: flex-start; gap: 14px; height: 9.5rem; overflow: hidden; }
.tile.nav-tile .tile-icon { flex: none; width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); }
.tile.nav-tile .tile-icon .icon { width: 24px; height: 24px; }
.tile.nav-tile:hover .tile-icon { background: var(--accent); color: #fff; }
.tile.nav-tile .tile-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; height: 100%; }
.tile.nav-tile .tile-text { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tile.nav-tile small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
td.right { text-align: right; }
.cardhead .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cardhead .actions form.inline { margin: 0; }

/* --- Fernzugriff (Geräteseite) -------------------------------------------- */
.remote-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.remote-actions form { margin: 0; }
.btn .icon.small, .icon.small { width: 16px; height: 16px; vertical-align: -3px; }
#remote details { margin-top: 12px; }
#remote details summary { cursor: pointer; color: var(--quiet); }
p.download { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 12px; }

/* Installationscode (PCs verbinden) */
.joincode { border: 1px dashed var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; display: grid; gap: 8px; }
.joincode .codebox { font-size: 1.4rem; letter-spacing: .12em; }
form.inline-toggle { display: inline; margin: 4px 0 0; }
details.expert { margin-top: 12px; }
details.expert summary { cursor: pointer; color: var(--quiet); font-size: .9rem; }

/* Fernzugriff in der Geräteliste: Symbol mit Menü (hell, für weisse Tabellen) */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
td.remote-cell { width: 48px; }
.iconbtn.light { width: 34px; height: 34px; border: 1px solid #17a34a; background: #17a34a; color: #fff; /* kräftig grün: Fernzugriff vorhanden */
  box-shadow: 0 1px 4px rgba(23, 163, 74, .45); }
.iconbtn.light:hover, .menu[open] > .iconbtn.light { background: #12863c; border-color: #12863c; color: #fff; }
.iconbtn.light .icon.small { width: 18px; height: 18px; }
.iconbtn.light.off { color: #c4c1bb; border-color: #e6e3de; background: var(--card); box-shadow: none; cursor: default; }
.iconbtn.light.off:hover { background: var(--card); border-color: #e6e3de; }
.menu-panel form { margin: 0; }
.menu-panel button .icon { color: var(--ok); }

/* Sortieren und Filtern von Tabellen (app.js, Abschnitt 6) */
.flushhead { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 14px 20px 10px; }
.flushhead h2 { margin: 0; }
.table-tools { display: flex; align-items: center; gap: 12px; }
input[type=search].table-search { width: 300px; max-width: 100%; padding-left: 34px;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a877f' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 10px center / 16px; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable::after { content: "↕"; margin-left: 6px; color: #c4c1bb; font-size: .85em; }
th.sortable[aria-sort="ascending"]::after { content: "↑"; color: var(--accent); }
th.sortable[aria-sort="descending"]::after { content: "↓"; color: var(--accent); }
th.sortable:hover { color: var(--ink); }

/* Alarm-Tabelle (Übersicht und Alarmliste, templates/alerts/_table.php):
   farbiger Balken links je Stufe, Gerät fett, Problem darunter, Messwert hervorgehoben */
.alert-table td { vertical-align: middle; padding-top: 12px; padding-bottom: 12px; }
.alert-table tr.alert-row td:first-child { box-shadow: inset 4px 0 0 var(--unk); }
.alert-table tr.alert-row.critical td:first-child { box-shadow: inset 4px 0 0 var(--crit); }
.alert-table tr.alert-row.warning td:first-child { box-shadow: inset 4px 0 0 var(--warn); }
.alert-table tr.alert-row:hover td { background: #faf9f7; }
.alert-table tr.alert-row.acked td { opacity: .75; }
.alert-table tr.alert-row.acked td:first-child { opacity: 1; }
.alert-subject { font-weight: 600; color: var(--ink); text-decoration: none; }
.alert-subject:hover { color: var(--accent); text-decoration: underline; }
.alert-text { margin-top: 2px; color: var(--quiet); }
.alert-value { display: inline-block; margin: 0 4px; padding: 0 7px; border-radius: 6px; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--unk-soft); color: var(--ink); }
.alert-row.critical .alert-value { background: var(--crit-soft); color: var(--crit); }
.alert-row.warning .alert-value { background: var(--warn-soft); color: var(--warn); }
.alert-where a { font-weight: 500; }
.alert-since { white-space: nowrap; }
.alert-since strong { font-weight: 600; }
.alert-action { white-space: nowrap; width: 1%; }
.alert-table .small, .flushhead a.small { font-size: .82rem; }

/* Meldungen unten rechts (templates/layout.php, Bereich .toasts):
   fahren von rechts herein, bleiben einige Sekunden und fahren wieder hinaus.
   Sie liegen über der Seite und verschieben nichts. Maus darauf hält sie an. */
.toasts { position: fixed; right: 20px; bottom: 58px; z-index: 1000; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; pointer-events: none; max-width: calc(100vw - 40px); }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; width: 360px; max-width: 100%; padding: 12px 12px 12px 14px;
  background: #fff; color: var(--ink); border-radius: 10px; border-left: 5px solid var(--ok);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .16), 0 2px 6px rgba(0, 0, 0, .08); font-size: .93rem;
  animation: toast-in .35s cubic-bezier(.2, .8, .2, 1) both, toast-out .4s ease-in 5s forwards; }
.toast.error { border-left-color: var(--crit); animation-delay: 0s, 10s; }
.toast.info { border-left-color: #2f6fc4; }
.toast:hover { animation-play-state: paused; }
.toast-icon { flex: 0 0 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; color: #fff; background: var(--ok); margin-top: 1px; }
.toast.error .toast-icon { background: var(--crit); }
.toast.info .toast-icon { background: #2f6fc4; }
.toast-msg { flex: 1; line-height: 1.4; padding-top: 2px; overflow-wrap: anywhere; }
.toast-close { flex: 0 0 auto; border: 0; background: none; color: var(--quiet); font-size: 1.2rem; line-height: 1; padding: 2px 4px; cursor: pointer; border-radius: 4px; }
.toast-close:hover { color: var(--ink); background: #f0eeea; }
@keyframes toast-in { from { transform: translateX(calc(100% + 30px)); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-out { from { transform: none; opacity: 1; } to { transform: translateX(calc(100% + 30px)); opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) {
  @keyframes toast-in { from { opacity: 0; } to { opacity: 1; } }
  @keyframes toast-out { from { opacity: 1; } to { opacity: 0; visibility: hidden; } }
}
@media print { .toasts { display: none; } }

/* Felder auf der Übersicht sind Links (Klick → passende Alarme) */
a.stat { display: block; color: var(--ink); text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
a.stat:hover { border-color: #c9c5bd; box-shadow: 0 4px 14px rgba(0,0,0,.07); transform: translateY(-1px); text-decoration: none; }
a.stat:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.stat.suppressed .n { color: var(--maint); }

/* Reiter der Alarmliste (Offen, Kritisch, Warnung, Unterdrückt, Behoben) */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 14px; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font-size: .9rem; font-weight: 500; text-decoration: none; }
.tab:hover { border-color: #c9c5bd; text-decoration: none; }
.tab.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.tab-n { min-width: 20px; padding: 0 6px; border-radius: 999px; font-size: .75rem; font-weight: 700; text-align: center; background: var(--unk-soft); color: var(--ink); }
.tab-critical .tab-n { background: var(--crit-soft); color: var(--crit); }
.tab-warning .tab-n { background: var(--warn-soft); color: var(--warn); }
.tab-suppressed .tab-n { background: var(--maint-soft); color: var(--maint); }
.tab.active .tab-n { background: rgba(255,255,255,.2); color: #fff; }

/* Aktionen in der Alarm-Tabelle: Quittieren, Unterdrücken ▾, Wieder anzeigen */
.alert-buttons { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; }
.alert-buttons form { margin: 0; }
.alert-buttons summary.btn, .actions summary.btn { list-style: none; }
.alert-buttons summary.btn::-webkit-details-marker, .actions summary.btn::-webkit-details-marker { display: none; }
.alert-until { display: inline-flex; flex-direction: column; align-items: flex-end; margin-right: 6px; line-height: 1.25; }
.menu-panel form { margin: 0; }

/* Strommessgerät (templates/devices/_power.php) */
.power-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 4px 0 16px; }
.power-stats > div { background: var(--bg); border-radius: var(--radius); padding: 12px 14px; }
.power-stats .n { font-size: 1.5rem; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.power-stats .n small { font-size: .9rem; font-weight: 600; color: var(--quiet); }
.power-stats .l { color: var(--quiet); font-size: .85rem; margin-top: 2px; }
.power-table td.num { font-variant-numeric: tabular-nums; }
.power-table tr.muted td { color: var(--quiet); }
.small { font-size: .82rem; }

/* Fernaktualisierung in der Liste «PCs verbinden» */
.update-all { margin: 0 0 10px; }
.error-text { color: var(--crit); }

/* Geräte-Browser: Ports mit Protokoll (templates/devices/_remote.php) */
.port-rows { display: flex; flex-direction: column; gap: 6px; }
.port-row { display: grid; grid-template-columns: 110px 1fr; gap: 6px; max-width: 320px; }
/* Knöpfe zum Verbinden oben auf der Geräteseite: grün wie das Fernzugriff-Symbol */
.btn.remote-go { background: #17a34a; border-color: #17a34a; color: #fff; }
.btn.remote-go:hover { background: #128a3e; border-color: #128a3e; }
.btn.remote-go .icon { stroke: currentColor; }

/* Aktuelle Werte eines Geräts: feste Spaltenbreiten, lange Texte umbrechen
   (sonst ragt die Tabelle über die Karte hinaus) */
.values-table { table-layout: fixed; }
/* nur umbrechen, wenn ein Wort allein nicht in die Spalte passt */
.values-table td { overflow-wrap: break-word; }
.values-table td:nth-child(3), .values-table td:nth-child(4) { white-space: nowrap; }
.values-table col.c-metric { width: 36%; }
.values-table col.c-value { width: 34%; }
.values-table col.c-since { width: 16%; }
.values-table col.c-ago { width: 14%; }
.warn-text { color: var(--warn); }

/* Verlaufsdiagramm: Anzeige beim Messpunkt (app.js Abschnitt 8) */
.chart-wrap { position: relative; touch-action: pan-y; cursor: crosshair; }
.chart-cursor { stroke: var(--quiet); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-marker { fill: #fff; stroke: var(--accent); stroke-width: 2; }
.chart-dot { fill: var(--accent); }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--ink); color: #fff; border-radius: 8px;
  padding: 7px 10px; font-size: .82rem; line-height: 1.35; white-space: nowrap; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.chart-tip-time { opacity: .75; }
.chart-tip-value { font-weight: 700; font-variant-numeric: tabular-nums; }

/* Breite Formulare (Gerät, Gerätevorlage): ganze Breite, Abschnitte als Karten */
form.stack.wide { max-width: none; gap: 16px; }
form.stack.wide > .card { margin: 0; }
form.stack.wide > .card > h2 { margin-top: 0; }
.row.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row.four .span2 { grid-column: span 2; }
.row.four .span3 { grid-column: span 3; }
.check.spaced { margin-top: 12px; }
/* Leiste mit dem einen Knopf «Speichern»: bleibt unten sichtbar, solange das Formular länger als das Fenster ist */
.form-bar { position: sticky; bottom: 0; z-index: 5; display: flex; gap: 8px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 20px; box-shadow: 0 -4px 14px rgba(0, 0, 0, .06); }
.check-cell { display: flex; align-items: flex-end; padding-bottom: 10px; }
.form-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.form-cols > fieldset { display: grid; gap: 12px; align-content: start; }
.driver-section { display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.driver-section h3 { margin: 0; font-size: .95rem; }
.proto-grid { display: grid; grid-template-columns: 1.1fr .8fr 1fr 1fr; gap: 10px 12px; align-items: end; }
.proto-grid > .check { padding-bottom: 10px; }
.preset-secrets { color: var(--ok); }
.row-actions { display: inline-flex; gap: 6px; justify-content: flex-end; }
.row-actions form { margin: 0; }
@media (max-width: 900px) {
  .row.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row.four .span3 { grid-column: span 2; }
  .form-cols { grid-template-columns: 1fr; }
  .proto-grid { grid-template-columns: 1fr 1fr; }
}
[hidden] { display: none !important; }
.presets-table td { vertical-align: middle; }

/* Mehrfachbearbeitung der Geräteliste */
.check-col { width: 36px; text-align: center; }
.check-col input { width: 16px; height: 16px; margin: 0; vertical-align: middle; accent-color: var(--accent, #c8102e); }
.bulk-bar { margin: 0; border-radius: 0 0 var(--radius) var(--radius); border-left: 0; border-right: 0; border-bottom: 0; }
.bulk-table td strong { font-weight: 600; }

/* Windows-Agent im Geräteformular und in Vorlagen (_agent_settings.php) */
.check-row { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 4px 0 8px; }
.app-rows { width: 100%; }
.app-rows th { text-align: left; }
.app-rows td { padding: 4px 8px 4px 0; vertical-align: middle; }
.app-rows input[type=number] { width: 100px; }
.inline-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.inline-tools label { margin: 0; }
.inline-tools select { width: auto; min-width: 220px; }

/* Formular mit beliebig vielen Feldern (SMS-Anbieter) */
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; margin-top: 14px; align-items: start; }
@media (max-width: 900px) { .form-grid { grid-template-columns: 1fr; } }
.sms-table td { vertical-align: middle; }
.card .hint.pad { padding: 0 20px 14px; }

/* Kontrollkästchen und Optionsfelder überall gut sichtbar */
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; flex: none; }
.check { cursor: pointer; }

/* Schalter Ein/Aus (z. B. SMS-Anbieter eingeschaltet, Testmodus) */
.switch-row { display: flex; gap: 12px; align-items: flex-start; font-weight: 400; cursor: pointer; padding: 6px 0; margin: 0; }
.switch-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { flex: none; position: relative; width: 44px; height: 24px; border-radius: 12px; background: #cfccc6; transition: background .15s; margin-top: 1px; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch-row input:checked + .switch { background: var(--accent); }
.switch-row input:checked + .switch::after { transform: translateX(20px); }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--accent-soft); outline-offset: 2px; }
.switch-row strong { display: block; font-size: .95rem; }
.switch-row .hint { display: block; margin-top: 2px; }
.switch-cell { display: flex; align-items: center; padding-top: 22px; }

/* Auswahl als grosse Felder (z. B. Art der SMS) */
.choice-group { border: 0; padding: 0; margin: 0 0 16px; }
.choice-group legend { padding: 0; margin-bottom: 8px; font-size: .88rem; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.choice { position: relative; display: block; margin: 0; cursor: pointer; font-weight: 400; }
.choice input { position: absolute; top: 16px; left: 14px; }
.choice-body { display: block; height: 100%; border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 14px 13px 42px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.choice-body strong { display: block; margin-bottom: 3px; }
.choice:hover .choice-body { border-color: #a8a49a; }
.choice input:checked + .choice-body { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: #fff8f8; }
.card-intro { margin: -6px 0 14px; }
.sms-form .form-grid { margin-top: 0; }
.sms-form .card > .switch-row { margin-top: 10px; }

/* Profil → Direktverbindung: Prüfliste */
.checklist { list-style: none; padding: 0; margin: 12px 0 16px; display: grid; gap: 10px; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.checklist li strong { display: block; }
.checklist li .hint { display: block; margin-top: 2px; }
.step-state { flex: none; width: 22px; height: 22px; border-radius: 50%; background: #e4e1db; margin-top: 1px; position: relative; }
.step-state::after { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; }
.step-ok .step-state { background: #2e7d4f; }
.step-ok .step-state::after { content: "✓"; }
.step-bad .step-state { background: var(--accent); }
.step-bad .step-state::after { content: "!"; }
.step-warn .step-state { background: #d39b1a; }
.step-warn .step-state::after { content: "?"; }
.step-skip { opacity: .6; }
.step-actions { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }

/* 1.19.0 – Installationsseiten mit Reitern, Geräteliste nach Bridges */
/* Kopf der Installationsseiten: Name, darunter Bereichsleiste mit Unterstrich
   (bewusst anders als die runden Filter-Knöpfe, z. B. bei den Alarmen) */
.insthead { margin-bottom: 22px; }
.insthead .crumbs { font-size: .85rem; color: var(--quiet); margin-bottom: 2px; }
.insthead .crumbs a { color: var(--quiet); }
.insthead h1 { margin-bottom: 14px; }
.inst-location { font-size: 1rem; font-weight: 400; color: var(--quiet); margin-left: 6px; letter-spacing: 0; }
.subnav { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.subnav a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px 11px; margin-bottom: -1px;
  color: var(--quiet); font-weight: 600; white-space: nowrap; border-bottom: 2px solid transparent; }
.subnav a:hover { color: var(--ink); text-decoration: none; border-bottom-color: #cfccc6; }
.subnav a.active { color: var(--ink); border-bottom-color: var(--accent); }
.subnav a .icon { opacity: .75; }
.subnav a.active .icon { opacity: 1; color: var(--accent); }
.subnav-n { min-width: 20px; padding: 0 6px; border-radius: 999px; font-size: .75rem; font-weight: 700; text-align: center; background: var(--unk-soft); color: var(--ink); }
.subnav-n.bad { background: var(--crit); color: #fff; }
.subnav-n.warn { background: var(--warn); color: #fff; }
.empty.all-clear { color: var(--ok); font-weight: 600; }
.subnav-n.warn { background: var(--warn); color: #fff; }
.empty.all-clear { color: var(--ok); font-weight: 600; }
.subhead { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 16px 20px 6px; border-top: 1px solid var(--line); }
.subnav-n.maint { background: var(--maint); color: #fff; }

/* Kopf einer Liste: Titel (+ Suche/Hinweis) links, Aktionen rechts */
.listhead { align-items: center; padding: 16px 20px 12px; }
.listhead-title { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px; min-width: 0; flex: 1 1 auto; }
.listhead-title h2 { white-space: nowrap; }
.listhead-hint { font-size: .88rem; flex-basis: 100%; }
.listhead .actions { align-items: center; }
.listhead .actions form { margin: 0; }
.listhead .table-search { width: 240px; }
.btn-n { font-size: .78rem; font-weight: 700; padding: 0 7px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); }
.back-link { color: var(--quiet); margin-right: 4px; font-weight: 400; }
.back-link:hover { color: var(--ink); text-decoration: none; }
/* Umschalter (Filter in einer Liste) */
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.segmented a { padding: 7px 12px; font-size: .88rem; font-weight: 600; color: var(--quiet); border-left: 1px solid var(--line); }
.segmented a:first-child { border-left: 0; }
.segmented a:hover { color: var(--ink); text-decoration: none; background: #f8f7f4; }
.segmented a.active { background: var(--ink); color: #fff; }
@media (max-width: 700px) {
  .listhead .table-search { width: 100%; }
  .listhead-title, .listhead .actions { flex-basis: 100%; }
}
table.grouped tbody + tbody tr.group-head td { border-top: 10px solid var(--bg); }
tr.group-head td { background: #f8f7f4; border-bottom: 1px solid var(--line); padding: 10px 14px; }
tr.group-head.group-none td { background: var(--warn-soft); }
.group-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.group-line strong { font-size: 1rem; }
.group-icon { display: inline-flex; width: 30px; height: 30px; border-radius: 50%; align-items: center; justify-content: center; background: var(--ink); color: #fff; }
.group-none .group-icon { background: var(--warn); }
.group-link { margin-left: auto; font-size: .88rem; white-space: nowrap; }
tr.group-empty td { padding: 8px 14px 12px 58px; }
.maint-banner a { margin-left: 8px; font-weight: 600; }

/* Seite Bridges */
.muted-row td { color: var(--quiet); }
.sub-row td { padding-top: 0; background: #fcfbf9; }
.card-foot { padding: 12px 20px 14px; border-top: 1px solid var(--line); }
.card-foot .hint { margin: 0; }
.ok-text { color: var(--ok); font-weight: 600; }
.bridge-table td { vertical-align: top; }

/* Seite Wartungsfenster */
.quick-buttons { gap: 6px; }

/* Alarm-Protokoll */
.nowrap { white-space: nowrap; }
.log-filter .grow { flex: 1 1 220px; }
.log-filter select { width: auto; }
.log-table td { vertical-align: top; }

/* 1.20.0 – Dashboard-Editor (Einstellungen → Dashboards, dashboard-editor.js).
   Die Felder selbst gestaltet dashboard.css (gleich wie in der Anzeige). */
.dash-settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; align-items: end; }
.dash-settings > div > label { display: block; }
.dash-size { display: flex; gap: 8px; align-items: flex-end; }
.dash-size > span { padding-bottom: 10px; color: var(--quiet); }
.dash-size input { width: 110px; }
.dash-access { margin: 18px 0 0; border: 0; padding: 0; }
.dash-access legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.choice-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.choice-card { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; cursor: pointer; margin: 0; font-weight: 400; }
.choice-card:hover { border-color: #c9c5bd; }
.choice-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--accent-soft); }
.choice-card input { margin-top: 3px; width: auto; }
.choice-card strong { display: block; }
.choice-card small { display: block; color: var(--quiet); line-height: 1.4; }
.dash-password { margin-top: 12px; max-width: 360px; }
.dash-access .flash { margin: 12px 0 0; }
.dash-link { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.dash-link-url { padding: 5px 8px; border-radius: 6px; background: #f3f2ee; font-size: .85rem; word-break: break-all; }

.ed-wrap { display: grid; grid-template-columns: 170px minmax(0, 1fr) 280px; gap: 16px; padding: 0 20px 20px; align-items: start; }
.ed-palette { display: flex; flex-direction: column; gap: 6px; position: sticky; top: 12px; }
.ed-tool { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff;
  font: inherit; font-size: .9rem; font-weight: 600; color: var(--ink); cursor: grab; text-align: left; }
.ed-tool:hover { border-color: var(--accent); color: var(--accent); }
.ed-tool:active { cursor: grabbing; }
.ed-board { position: relative; overflow: hidden; border-radius: 6px; background: #2a2a28; touch-action: none; user-select: none; }
.ed-board.scroll { overflow: auto; touch-action: pan-x pan-y; }
.ed-sizer { position: relative; }
.ed-zoom-pct { min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; }
.ed-head .segmented a { cursor: pointer; }
.ed-expanded-only { display: none; }

/* Seiten eines Dashboards: Reiter und Einstellungen der aktuellen Seite */
.ed-pages { padding: 0 20px 14px; display: flex; flex-direction: column; gap: 10px; }
.ed-page-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.ed-page-tab { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 0; padding: 6px 12px; min-width: 70px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff; font: inherit; font-size: .88rem; color: var(--ink); cursor: pointer; text-align: left; }
.ed-page-tab small { color: var(--quiet); font-size: .75rem; }
.ed-page-tab:hover { border-color: #c9c5bd; }
.ed-page-tab.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--accent-soft); }
.ed-page-add { justify-content: center; color: var(--accent); font-weight: 600; border-style: dashed; }
.ed-page-settings { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border-radius: 6px; background: #f8f7f4; }
.ed-inline { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: .88rem; font-weight: 600; }
.ed-inline input[type=text] { width: 200px; padding: 5px 8px; }
.ed-inline input[type=number] { width: 80px; padding: 5px 8px; }
.ed-page-hint { font-size: .85rem; }

/* Grosse Ansicht: Editor über das ganze Fenster */
body.ed-noscroll { overflow: hidden; }
.ed.ed-expanded { position: fixed; inset: 0; z-index: 60; margin: 0; border-radius: 0; border: 0; overflow: auto; }
.ed.ed-expanded .ed-expanded-only { display: inline-flex; }
.ed.ed-expanded .ed-wrap { grid-template-columns: 140px minmax(0, 1fr) 240px; gap: 12px; padding: 0 12px 12px; }
.ed.ed-expanded .listhead-hint { display: none; }
.ed.ed-expanded .listhead { padding: 10px 12px 8px; }
.ed.ed-expanded .ed-pages { padding: 0 12px 10px; }
.ed-canvas { cursor: crosshair; }
.ed-preview { position: absolute; left: 0; top: 0; pointer-events: none; }
.ed-grid { position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(to right, rgba(128,128,128,.25) 1px, transparent 1px), linear-gradient(to bottom, rgba(128,128,128,.25) 1px, transparent 1px); }
.ed-frames { position: absolute; inset: 0; }
.ed-frame { position: absolute; box-sizing: border-box; border: calc(var(--u) * .04) dashed rgba(160,160,160,.55); cursor: move; outline: none; }
.ed-frame:hover { border-color: rgba(200,35,60,.8); }
.ed-frame.selected { border: calc(var(--u) * .07) solid #c8233c; background: rgba(200,35,60,.06); }
.ed-frame-label { position: absolute; left: 0; top: 0; padding: calc(var(--u) * .05) calc(var(--u) * .2); font-size: calc(var(--u) * .3); font-weight: 700;
  background: #c8233c; color: #fff; border-bottom-right-radius: calc(var(--u) * .12); opacity: 0; }
.ed-frame:hover .ed-frame-label, .ed-frame.selected .ed-frame-label { opacity: 1; }
.ed-handle { position: absolute; width: calc(var(--u) * .4); height: calc(var(--u) * .4); background: #fff; border: calc(var(--u) * .06) solid #c8233c;
  border-radius: 2px; box-sizing: border-box; }
.ed-h-n, .ed-h-s { left: 50%; margin-left: calc(var(--u) * -.2); cursor: ns-resize; }
.ed-h-e, .ed-h-w { top: 50%; margin-top: calc(var(--u) * -.2); cursor: ew-resize; }
.ed-h-n, .ed-h-ne, .ed-h-nw { top: calc(var(--u) * -.2); }
.ed-h-s, .ed-h-se, .ed-h-sw { bottom: calc(var(--u) * -.2); }
.ed-h-e, .ed-h-ne, .ed-h-se { right: calc(var(--u) * -.2); }
.ed-h-w, .ed-h-nw, .ed-h-sw { left: calc(var(--u) * -.2); }
.ed-h-ne, .ed-h-sw { cursor: nesw-resize; }
.ed-h-nw, .ed-h-se { cursor: nwse-resize; }
.ed-ghost { position: absolute; box-sizing: border-box; border: calc(var(--u) * .07) dashed #c8233c; background: rgba(200,35,60,.15); pointer-events: none; }
.ed-chooser { position: fixed; z-index: 50; display: flex; flex-direction: column; gap: 2px; min-width: 200px; padding: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.ed-chooser strong { padding: 4px 8px 6px; font-size: .85rem; color: var(--quiet); }
.ed-chooser-item { text-align: left; font: inherit; padding: 7px 10px; border: 0; border-radius: 6px; background: none; cursor: pointer; color: var(--ink); }
.ed-chooser-item:hover { background: var(--accent-soft); color: var(--accent); }
.ed-props { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--line);
  border-radius: var(--radius); background: #fbfaf8; min-height: 120px; }
.ed-props h3 { margin: 0; font-size: 1rem; }
.ed-props .hint { margin: 0; }
.ed-field label { display: block; font-size: .85rem; }
.ed-pos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ed-pos-label { grid-column: 1 / -1; font-size: .85rem; font-weight: 600; }
.ed-pos label { font-size: .75rem; color: var(--quiet); margin: 0; }
.ed-pos input { padding: 5px 6px; }
.ed-actions { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 1100px) {
  .ed-wrap { grid-template-columns: 1fr; }
  .ed-palette { position: static; flex-direction: row; flex-wrap: wrap; }
  .ed-props { position: static; }
}

/* 1.22.0 – Raster, Mehrfachauswahl und Zwischenablage im Dashboard-Editor */
.ed-ghost.select { border-color: #3b6fb6; background: rgba(59,111,182,.15); }
.ed-note { font-size: .85rem; font-weight: 600; color: var(--ok); min-width: 0; }
.ed-keys { font-size: .8rem; }
.ed-head .ed-inline select { width: auto; padding: 5px 8px; }

/* 1.23.0 – Prüfung durch den Monitor, Webseiten */
.check-source { border: 0; padding: 0; margin: 0 0 18px; }
.check-source legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.web-check { margin: 0; }
.warn-text { color: var(--warn); }
.group-server .group-icon { background: var(--maint); }
.web-card .web-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.web-card h2 { margin-bottom: 4px; }
.web-url { word-break: break-all; }
.web-card .small { font-size: .85rem; margin-top: 4px; }
.pill.big { font-size: .95rem; padding: 6px 14px 6px 12px; }
.web-error { margin: 14px 0 0; }
.web-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 16px; }
.web-stats > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fbfaf8; }
.web-stats .muted { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.web-stats strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; }

/* Übersicht: Kacheln der Installationen, immer gleich aufgebaut */
.tile.inst-tile { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; }
.inst-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.inst-top .name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-size: .98rem; }
.inst-top .pill { flex: none; }
.inst-facts { display: grid; grid-template-columns: 1fr 1fr 1.6fr; gap: 8px; margin: 0; padding-top: 10px; border-top: 1px solid var(--line); }
.inst-facts div { min-width: 0; }
.inst-facts dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--quiet); margin: 0; }
.inst-facts dd { margin: 2px 0 0; font-size: .95rem; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.inst-facts dd.none { color: var(--quiet); font-weight: 400; }
.inst-facts dd.bad { color: var(--crit); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--unk); }
.dot.online { background: var(--ok); } .dot.offline { background: var(--crit); } .dot.warning { background: var(--warn); } .dot.monitor { background: var(--maint); }

/* --- Handy-Menü (layout.php) ---------------------------------------- */
/* Auf breiten Bildschirmen unsichtbar. Unter 900 px ersetzt der Knopf mit
   drei Strichen oben rechts das Menü und die Symbol-Knöpfe; die Liste
   öffnet sich darunter (dunkel wie die Kopfzeile, Symbole sind hell). */
.mobilemenu { display: none; margin-left: auto; }
.burger { color: #fff; }
.burger-dot { position: absolute; top: 5px; right: 5px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--head); }
.menu-panel.mobile-panel { width: min(320px, calc(100vw - 16px)); max-height: calc(100dvh - 84px); overflow-y: auto;
  padding: 8px; background: var(--head); border-color: #3a3a38; color: #e9e7e2; }
.mobile-nav { display: flex; flex-direction: column; gap: 2px; }
.mobile-nav a, .mobile-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px; padding: 10px 12px;
  border: 0; border-radius: 8px; background: none; color: #e9e7e2; font: inherit; font-size: 1rem; text-align: left;
  cursor: pointer; text-decoration: none; box-sizing: border-box; }
.mobile-nav a:hover, .mobile-nav a.active, .mobile-item:hover, .mobile-item.active { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.mobile-nav a.active { box-shadow: inset 3px 0 0 var(--accent); }
.mobile-nav .badge { background: var(--accent); color: #fff; border-radius: 10px; padding: 0 8px; font-size: .8rem; margin-left: auto; }
.mobile-item img, .mobile-item .icon { width: 20px; height: 20px; flex: none; }
.mobile-item small { color: #a9a6a0; margin-left: 4px; }
.mobile-sep { height: 1px; background: #3a3a38; margin: 6px 4px; }
.mobile-panel form { margin: 0; }
.mobile-panel button.mobile-item:hover { background: rgba(255,255,255,.1); }
@media (max-width: 900px) {
  .topbar .nav, .topbar .usermenu { display: none; }
  .mobilemenu { display: block; }
  .topbar .inner { height: 60px; padding: 0 12px; }
  .brand img { height: 28px; }
}
.menu-panel button.mobile-item { color: #e9e7e2; padding: 10px 12px; font-size: 1rem; border-radius: 8px; }

/* --- Handy-Ansicht (nur bis 720 px, der Computer bleibt unverändert) ---
   Tabellen: Auf dem Handy nur die nötigen Spalten. Die Vorlage gibt der
   Tabelle Klassen m-h<N> (Spalte N ausblenden) oder einzelnen Zellen die
   Klasse m-hide; m-only zeigt etwas nur auf dem Handy (z. B. Installation
   als kleine Zeile unter dem Problem). Zeilen der Gruppenköpfe
   (data-group-head) bleiben immer sichtbar.
   Formulare: Auswahlfelder mit langem Text dürfen die Karte nicht über den
   Bildschirmrand drücken (min-width: 0). */
.m-only { display: none; }
@media (max-width: 720px) {
  .m-hide, .m-hide-row,
  table.m-h1 tr:not([data-group-head]) > :nth-child(1),
  table.m-h2 tr:not([data-group-head]) > :nth-child(2),
  table.m-h3 tr:not([data-group-head]) > :nth-child(3),
  table.m-h4 tr:not([data-group-head]) > :nth-child(4),
  table.m-h5 tr:not([data-group-head]) > :nth-child(5),
  table.m-h6 tr:not([data-group-head]) > :nth-child(6),
  table.m-h7 tr:not([data-group-head]) > :nth-child(7),
  table.m-h8 tr:not([data-group-head]) > :nth-child(8),
  table.m-h9 tr:not([data-group-head]) > :nth-child(9) { display: none !important; }
  .m-only { display: revert; }
  th, td { padding: 8px 6px; }
  th:first-child, td:first-child { padding-left: 10px; }
  th:last-child, td:last-child { padding-right: 10px; }
  table { font-size: .88rem; }
  th { font-size: .72rem; letter-spacing: .02em; }
  .card { padding: 14px 14px; }
  .grid > *, .row > *, .form-cols > *, .stack > *, .card, .card > * { min-width: 0; }
  fieldset { min-inline-size: 0; min-width: 0; }
  select, input, textarea { max-width: 100%; min-width: 0; }
  dl.props { grid-template-columns: max-content minmax(0, 1fr); }
  dl.props dd, dd.mono { overflow-wrap: anywhere; }
  td .mono, td.mono { overflow-wrap: break-word; }
  .log-table td.nowrap { white-space: normal; }
  td { hyphens: auto; -webkit-hyphens: auto; }
  .error-text { overflow-wrap: anywhere; }
  th .hint { display: none; }
  .row-actions { gap: 4px; }
  table.app-rows { table-layout: fixed; }
  table.app-rows input { width: 100%; box-sizing: border-box; }
  .btn.small { font-size: .82rem; }
  .btn.small { padding-left: 8px; padding-right: 8px; }
}
@media (max-width: 720px) {
  /* Alarme: Knöpfe untereinander statt nebeneinander (schmale Spalte) */
  .alert-buttons { flex-direction: column; align-items: flex-end; gap: 6px; }
  .alert-where-m { margin-top: 3px; }
  .group-line { flex-wrap: wrap; row-gap: 4px; }
}
@media (max-width: 720px) {
  /* Unternavigation der Installation: alle Reiter sichtbar (zwei Zeilen statt seitlich scrollen) */
  .subnav { flex-wrap: wrap; gap: 0 2px; }
  .subnav a { padding: 8px 9px 9px; gap: 6px; }
  .subnav a .icon { display: none; }
}
@media (max-width: 720px) {
  /* Absicherung: Der Inhalt verschiebt sich auf dem Handy nie seitlich
     (iPhone/Safari macht Auswahlfelder so breit wie die längste Option).
     Breite Tabellen scrollen innerhalb ihrer Karte (.table-wrap). */
  body.app > .scroll { overflow-x: hidden; }
  main { max-width: 100vw; }
  /* Verlauf (Geräteseite) und ähnliche Köpfe: Auswahlfelder über die ganze
     Breite, darunter Zeitraum und Knopf */
  .cardhead:has(> form.inline) { flex-direction: column; align-items: stretch; }
  .cardhead form.inline { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; width: 100%; }
  .cardhead form.inline select:first-of-type:not(:only-of-type) { grid-column: 1 / -1; }
  .cardhead form.inline select { width: 100%; }
  .cardhead form.inline .btn { padding-top: 8px; padding-bottom: 8px; }
}
@media (max-width: 720px) {
  /* Aktuelle Werte: Breiten nach Inhalt (feste Breiten passen nicht, wenn «Seit» ausgeblendet ist) */
  .values-table { table-layout: auto; }
  .values-table col { width: auto !important; }
  .values-table td:nth-child(4) { white-space: nowrap; font-size: .8rem; }
  .values-table td:nth-child(2) { overflow-wrap: anywhere; }
}

/* Projektor-Selbsttest (devices/_selftest.php) und «Alarm aus» je Messwert */
#selftest .flushhead { flex-wrap: wrap; gap: 6px 16px; }
#selftest .listhead-title { display: flex; align-items: center; gap: 10px; }
#selftest .listhead-title h2 { margin: 0; }
.selftest-table td:first-child { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .86rem; letter-spacing: .02em; }
.selftest-table td.num { width: 110px; }
.selftest-table td.right { width: 120px; }
.selftest-ok summary { cursor: pointer; padding: 10px 20px; color: var(--quiet); border-top: 1px solid var(--line); }
.selftest-ok[open] summary { border-bottom: 1px solid var(--line); }
.alert-off-row td { color: var(--quiet); }
.small-pill { font-size: .72rem; padding: 0 6px; vertical-align: 1px; }
.values-table.with-alarm col.c-metric { width: 30%; }
.values-table.with-alarm col.c-value { width: 28%; }
.values-table.with-alarm col.c-since { width: 14%; }
.values-table.with-alarm col.c-ago { width: 12%; }
.values-table.with-alarm col.c-alarm { width: 16%; }
.values-table td:nth-child(5) form, .selftest-table form { margin: 0; }
.alert-off-btn { border-color: var(--accent); color: var(--accent); }

/* Fortschritt der Fernaktualisierung (Seite «Bridges») */
.upd-progress { margin: .35rem 0 .2rem; padding: .4rem .55rem; border-left: 3px solid var(--warn); background: var(--warn-soft); color: var(--ink); border-radius: 4px; max-width: 26rem; }
.upd-progress.failed { border-left-color: var(--crit); background: var(--crit-soft); }
.upd-title { font-weight: 600; font-size: .85rem; margin-bottom: .2rem; }
.upd-steps { list-style: none; margin: 0 0 .2rem; padding: 0; font-size: .82rem; }
.upd-steps li { padding-left: 1.25rem; position: relative; color: var(--quiet); }
.upd-steps li::before { content: "○"; position: absolute; left: 0; }
.upd-steps li.done { color: inherit; }
.upd-steps li.done::before { content: "✓"; color: var(--ok); }
.upd-steps li.now { color: inherit; font-weight: 600; }
.upd-steps li.now::before { content: "●"; color: var(--warn); }
.upd-steps li.bad::before { content: "✕"; color: var(--crit); }
.upd-progress small { display: block; }

/* Inventar (templates/inventory) */
.inventory-filter { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.inventory-filter input[type=search] { min-width: 16rem; flex: 1; }
.inventory-filter select { width: auto; }
.inventory-deps .row-actions { white-space: nowrap; }
.inventory-deps tr.selected-row td { background: var(--accent-soft); }
@media (max-width: 720px) { .inventory-deps .row-actions { flex-direction: column; align-items: flex-end; } .inventory-deps small.m-only, .inventory-table small.m-only { display: block; } }
/* Inventar: Bearbeiten-Zeile unter einem Einsatz (volle Breite, drei Spalten) */
.dep-edit-row > td { background: var(--bg); padding: 1rem; border-top: 0; }
.dep-edit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1.25rem; }
.dep-edit-grid form { margin: 0; align-content: start; align-self: start; }

/* Bridges-Tabellen: feste Spaltenbreiten (nur Desktop), damit die Spalten nicht
   springen, wenn der Fortschritt einer Aktualisierung erscheint oder verschwindet.
   Spalten: Name | Installation bzw. Aufgabe | Zustand | Softwarestand | Zuletzt | Aktionen */
@media (min-width: 721px) {
  .bridge-table { table-layout: fixed; width: 100%; }
  .bridge-table th:nth-child(1) { width: 19%; }
  .bridge-table th:nth-child(2) { width: 19%; }
  .bridge-table th:nth-child(3) { width: 11%; }
  .bridge-table th:nth-child(4) { width: 29%; }
  .bridge-table th:nth-child(5) { width: 10%; }
  .bridge-table th:nth-child(6) { width: 12%; }
  .bridge-table td { overflow-wrap: break-word; }
  .bridge-table .upd-progress { max-width: none; }
  .bridge-table td.num .btn, .bridge-table td.row-actions .btn { white-space: normal; text-align: center; }
}

/* Fenster «Alarmadressen» (templates/admin/_contact.php) */
.alert-contacts th[scope=row] { white-space: nowrap; font-weight: 600; text-transform: none; letter-spacing: 0; font-size: inherit; color: var(--ink); vertical-align: middle; }
.alert-contacts th[scope=row] small { font-weight: 400; }
.alert-contacts input { width: 100%; min-width: 11rem; }
@media (max-width: 720px) {
  .alert-contacts thead { display: none; }
  .alert-contacts tr { display: grid; grid-template-columns: 1fr auto; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .alert-contacts th[scope=row] { grid-column: 1; border: 0; padding: 0; }
  .alert-contacts td { border: 0; padding: 0; }
  .alert-contacts td:nth-child(2), .alert-contacts td:nth-child(3) { grid-column: 1 / -1; }
  .alert-contacts td.num { grid-column: 2; grid-row: 1; }
  .alert-contacts input { min-width: 0; }
}

/* Kundenliste (templates/customers/index.php): feste Spaltenbreiten, alle
   Zeilen gleich hoch, Inhalte senkrecht in der Mitte, lange Texte mit «…».
   Spalten: Name | Kürzel | Kontakt | Installationen | Status */
.customer-table td { vertical-align: middle; height: 58px; overflow-wrap: anywhere; }
.customer-table th.center, .customer-table td.center { text-align: center; }
.customer-table .num-center { font-variant-numeric: tabular-nums; }
.customer-table .cell-name a { font-weight: 600; }
.customer-table .cell-contact .line { display: block; }
.customer-table .cell-contact small.line { margin-top: 2px; }
.code-tag { display: inline-block; font-family: var(--mono, ui-monospace, monospace); font-size: .82rem; padding: 2px 7px; border-radius: 6px; background: var(--soft, #f1efea); border: 1px solid var(--line); }
@media (min-width: 721px) {
  .customer-table { table-layout: fixed; width: 100%; }
  .customer-table th:nth-child(1) { width: 34%; }
  .customer-table th:nth-child(2) { width: 12%; }
  .customer-table th:nth-child(3) { width: 30%; }
  .customer-table th:nth-child(4) { width: 12%; }
  .customer-table th:nth-child(5) { width: 12%; }
  .customer-table .cell-name, .customer-table .cell-contact .line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* WhatsApp: Vorschau der gefüllten Vorlage unter «Vorlage (JSON)» */
.template-preview { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #faf9f6; font-size: .88rem; }
.template-preview ol { margin: 6px 0 0; padding-left: 20px; }

/* Steuerung eines Windows-PCs (templates/devices/_command_menu.php): Symbol
   (Blitz = Aktion) links neben dem Fernzugriff, dunkel statt grün (verändert den PC).
   Eigene Klasse .row-icons: .remote-actions gibt es schon (Geräteseite, umbrechend). */
.row-icons { display: inline-flex; flex-wrap: nowrap; gap: 6px; align-items: center; justify-content: flex-end; white-space: nowrap; }
td.remote-cell { width: 108px; }
.iconbtn.light.cmd { background: #3a3936; border-color: #3a3936; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
.iconbtn.light.cmd:hover, .menu[open] > .iconbtn.light.cmd { background: #1d1d1b; border-color: #1d1d1b; }
.cmd-panel { width: 300px; white-space: normal; text-align: left; }
.cmd-panel button .icon { color: var(--ink); }
.cmd-panel button.danger-item, .cmd-panel button.danger-item .icon { color: var(--accent); }
.cmd-message { border-top: 1px solid var(--line); margin-top: 6px !important; padding: 8px 10px 4px; }
.cmd-message label { display: flex; align-items: center; gap: 10px; font-size: .92rem; font-weight: 400; margin-bottom: 6px; }
.cmd-message textarea { width: 100%; font: inherit; font-size: .9rem; resize: vertical; }
.cmd-message .cmd-send { display: flex; justify-content: flex-end; margin-top: 6px; }
.cmd-message .cmd-send button { width: auto; display: inline-flex; padding: 6px 12px; background: var(--accent); color: #fff; }
summary.btn { list-style: none; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
summary.btn::-webkit-details-marker { display: none; }

/* Öffentliche Alarmseite (templates/share/alert.php, Link aus den Nachrichten) */
.auth.share .box { max-width: 560px; }
.share-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.share-head .brand { color: var(--ink); display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.share-head .brand img { height: 26px; display: block; }
.share-head .brand span { color: var(--quiet); font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; }
.share-sev { margin: 0 0 4px; color: var(--quiet); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
.auth.share h1 { font-size: 1.25rem; line-height: 1.35; margin: 0 0 18px; }
.auth.share h2 { font-size: 1rem; margin: 20px 0 8px; }
.share-props { margin-bottom: 4px; }
.share-events { list-style: none; margin: 0 0 22px; padding: 0; font-size: .9rem; }
.share-events li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.share-events li .muted { display: inline-block; min-width: 92px; }
.share-hint { text-align: center; margin: 10px 0 0; }

/* Hauptseite Fernzugriff (templates/remote/index.php): Baum Kunde → Installation → Gerät */
.remote-list .flushhead { gap: 12px; }
.tree { padding: 0 0 8px; }
.tree details > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.tree details > summary::-webkit-details-marker { display: none; }
.tree-caret { width: 0; height: 0; border-left: 5px solid var(--quiet); border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform .15s; }
.tree details[open] > summary > .tree-caret { transform: rotate(90deg); }
.tree-customer > summary { padding: 12px 20px; background: #f8f7f4; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tree-customer:first-child > summary { border-top: 0; }
.tree-inst > summary { padding: 10px 20px 10px 36px; font-weight: 600; border-bottom: 1px solid var(--line); }
.tree-link { margin-left: auto; font-weight: 400; font-size: .85rem; }
.tree-devices { list-style: none; margin: 0; padding: 0; }
.tree-devices li { display: flex; align-items: center; gap: 12px; padding: 9px 20px 9px 56px; border-bottom: 1px solid var(--line); min-height: 52px; }
.tree-dev { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.tree-dev a { font-weight: 600; }
.tree-dev small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tree-actions form { margin: 0; }
.dot-state { width: 10px; height: 10px; border-radius: 50%; background: #c4c1bb; flex: none; }
.dot-state.ok { background: var(--ok); }
.dot-state.warning { background: #e08a00; }
.dot-state.critical { background: var(--accent); }
.dot-state.maintenance { background: #6b8cc7; }
@media (max-width: 720px) {
  .tree-inst > summary { padding-left: 28px; }
  .tree-devices li { padding-left: 20px; flex-wrap: wrap; }
  .tree-actions { width: 100%; justify-content: flex-start; }
}
.tree-tools { display: flex; align-items: center; gap: 6px; }
.btn.icon-only { width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
@media (max-width: 720px) { .tree-tools { width: 100%; } .tree-tools .table-search { flex: 1; } }
.tree-tools .btn.icon-only { width: 40px; height: 40px; } /* so hoch wie das Suchfeld */

/* Sprachwahl im Anmeldefenster: oben rechts auf Höhe des Logos, Liste beim Klick */
.auth-lang { position: absolute; top: 34px; right: 32px; }
.auth-lang > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; padding: 5px 9px;
  border: 1px solid var(--line); border-radius: 8px; font-size: .82rem; font-weight: 600; color: var(--ink); background: #fff; }
.auth-lang > summary::-webkit-details-marker { display: none; }
.auth-lang > summary:hover, .auth-lang[open] > summary { border-color: #a8a49a; }
.auth-lang > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.auth-lang > summary img { width: 16px; height: 16px; border-radius: 50%; }
.auth-lang .caret { color: var(--quiet); font-size: .7rem; }
.auth-lang .menu-panel { min-width: 160px; }
.auth-lang .menu-panel img.flag { width: 18px; height: 18px; border-radius: 50%; }
.auth .divider { margin: 16px 0 10px; }

/* Eigenes Abfragefenster statt Browser-Meldung (app.js okulaConfirm), mittig */
dialog.ask { border: 0; border-radius: 14px; padding: 26px 26px 20px; width: min(440px, calc(100vw - 32px));
  box-shadow: 0 24px 70px rgba(0, 0, 0, .45); color: var(--ink); }
dialog.ask::backdrop { background: rgba(12, 14, 15, .55); backdrop-filter: blur(3px); }
dialog.ask .ask-msg { margin: 0 0 22px; white-space: pre-line; line-height: 1.5; font-size: .98rem; }
dialog.ask .ask-actions { display: flex; justify-content: flex-end; gap: 10px; }
dialog.ask[open] { animation: ask-in .14s ease-out; }
@keyframes ask-in { from { opacity: 0; transform: translateY(8px) scale(.98) } to { opacity: 1; transform: none } }
@media (prefers-reduced-motion: reduce) { dialog.ask[open] { animation: none } }
.plain-fieldset { border: 0; padding: 0; margin: 0; display: contents; }

/* Rechte-Tabelle der Rollen (ab 1.43) */
.perm-matrix th.c, .perm-matrix td.c { text-align: center; width: 7.5rem; }
.perm-matrix td.c input { width: 1.1rem; height: 1.1rem; }
.perm-matrix .perm-cat th { background: var(--bg); font-weight: 600; text-align: left; }
.perm-matrix tbody tr:hover td { background: rgba(0, 0, 0, .02); }
@media (max-width: 640px) {
  .perm-matrix th.c, .perm-matrix td.c { width: auto; padding-left: .25rem; padding-right: .25rem; }
  .perm-matrix th.c { font-size: .7rem; letter-spacing: 0; }
  .perm-matrix td:first-child { font-size: .85rem; }
}

/* Bereich «Löschen» (ab 1.44) */
.danger-zone { border-color: var(--crit); }
.danger-zone h2 { color: var(--crit); }
.danger-zone p { color: var(--quiet); margin-top: 0; }

/* Knopf «PDF-Bericht» mit Auswahl (templates/_report_menu.php, ab 1.46) */
.report-panel { width: 320px; padding: 12px 14px; white-space: normal; text-align: left; }
.report-panel .hint { margin: 0; }
.report-panel button { width: auto; display: inline-flex; padding: 6px 14px; background: var(--accent); color: #fff; font-weight: 600; }
.report-panel button:hover { background: #a91d32; }

/* Anmeldeseite: «Angemeldet bleiben» (ab 1.50) */
.auth .check.remember { justify-content: center; margin-top: 14px; font-size: .92rem; color: var(--quiet); }

/* Fernwartung (ab 1.52): freie Kunden-PCs über der Liste «Fernzugriff» */
.support-list { margin-bottom: 16px; }
.support-devices li { padding-left: 20px; }
.support-devices li:last-child { border-bottom: 0; }
.support-id { font-size: .95rem; letter-spacing: .04em; padding: 2px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--soft, #f1efea); }

/* Menü «Programme herunterladen» oben rechts (ab 1.52, templates/_download_menu.php) */
.dl-panel { width: 340px; padding: 8px; }
.dl-head { margin: 4px 10px 8px; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--quiet); }
.dl-panel .dl-item { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 10px; border: 0; border-radius: 8px;
  background: none; color: var(--ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer; box-sizing: border-box; }
.dl-panel .dl-item:hover { background: var(--bg); text-decoration: none; }
.dl-panel .dl-item .icon { width: 20px; height: 20px; flex: none; margin-top: 2px; color: var(--accent); }
.dl-item span { display: flex; flex-direction: column; gap: 2px; }
.dl-item strong { font-size: .95rem; }
.dl-item small { color: var(--quiet); font-size: .82rem; line-height: 1.35; font-weight: 400; }
.mobile-item.dl-item small { color: #a9a6a0; margin-left: 0; }
.mobile-item.dl-item { align-items: flex-start; }
.usermenu .dl-menu .iconbtn .icon { width: 20px; height: 20px; color: #fff; }
/* «Link kopieren» rechts neben dem Eintrag (ab 1.59.3) */
.dl-panel { width: 400px; }
.dl-row { display: flex; align-items: center; gap: 6px; border-radius: 8px; }
.dl-row:hover { background: var(--bg); }
.dl-row > .dl-item { flex: 1; min-width: 0; }
.dl-panel .dl-row > .dl-item:hover { background: none; }
.menu-panel button.dl-copy { flex: none; width: auto; margin-right: 8px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; color: var(--ink); font-size: .78rem; white-space: nowrap; }
.menu-panel button.dl-copy:hover { border-color: var(--accent); color: var(--accent); background: #fff; }
/* Handy-Menü (dunkel): Knopf unter dem Text, damit dieser Platz hat */
.mobile-panel .dl-row { flex-direction: column; align-items: stretch; gap: 0; }
.mobile-panel .dl-row:hover { background: none; }
.mobile-panel .dl-item .icon { color: inherit; }
.menu-panel.mobile-panel button.dl-copy { align-self: flex-start; margin: -4px 0 8px 46px; background: transparent; color: #e9e7e2;
  border-color: rgba(255,255,255,.28); }
.menu-panel.mobile-panel button.dl-copy:hover { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.5); }

/* Öffentliche Seite «Fernwartung» für Kunden (/downloads, ab 1.52) */
.auth.support-page { justify-content: flex-start; padding-top: 6vh; }
.auth .box.support-box { max-width: 900px; padding: 40px 44px 30px; }
.support-hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 36px; align-items: center; }
.support-hero > * { min-width: 0; }
.support-intro .brand { margin-bottom: 22px; }
.support-intro h1 { font-size: 1.9rem; line-height: 1.2; margin: 0 0 12px; letter-spacing: -.01em; }
.support-lead { color: var(--quiet); font-size: 1.02rem; line-height: 1.55; margin: 0 0 24px; }
.btn.support-download { display: inline-flex; align-items: center; gap: 12px; padding: 14px 22px; font-size: 1.05rem; border-radius: 12px; }
.btn.support-download .icon { width: 22px; height: 22px; }
.btn.support-download span { display: flex; flex-direction: column; text-align: left; line-height: 1.2; }
.btn.support-download small { font-size: .78rem; font-weight: 400; color: rgba(255, 255, 255, .85); }
.support-visual { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.support-window { width: 100%; max-width: 330px; border-radius: 12px; overflow: hidden; background: #141414;
  box-shadow: 0 18px 40px rgba(10, 12, 20, .28); transform: rotate(-1.5deg); }
.support-window-bar { display: flex; gap: 6px; padding: 10px 12px; background: #23231f; }
.support-window-bar span { width: 10px; height: 10px; border-radius: 50%; background: #4a4944; }
.support-window-bar span:first-child { background: var(--accent); }
.support-window-body { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 26px 18px 28px; color: #e9e7e2; }
.support-window-label { font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: #a9a6a0; }
.support-window-id { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.85rem; letter-spacing: .06em; color: #fff; }
.support-window-state { display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; color: #cfccc6; }
.support-window-state .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(46, 160, 67, .2); }
.support-example { font-size: .75rem; color: var(--quiet); }
.support-steps { list-style: none; margin: 34px 0 0; padding: 26px 0 0; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.support-steps li { display: flex; gap: 12px; align-items: flex-start; }
.support-steps .num { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem; }
.support-steps div, .support-trust li > span { display: flex; flex-direction: column; gap: 3px; font-size: .9rem; color: var(--quiet); line-height: 1.45; }
.support-steps strong, .support-trust strong { color: var(--ink); font-size: .95rem; }
.support-trust { list-style: none; margin: 24px 0 0; padding: 18px 20px; background: var(--bg); border-radius: 12px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.support-trust li { display: flex; gap: 10px; align-items: flex-start; }
.support-trust .icon { flex: none; width: 22px; height: 22px; color: var(--accent); margin-top: 1px; }
.support-contact { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 18px; margin-top: 22px;
  font-size: .92rem; color: var(--quiet); }
.support-contact a { font-weight: 600; }
@media (max-width: 760px) {
  .auth .box.support-box { padding: 26px 20px 22px; }
  .support-hero { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .support-window { transform: none; }
  .auth.support-page { padding: 12px; }
  .support-intro h1 { font-size: 1.5rem; }
  .btn.support-download { width: 100%; justify-content: center; box-sizing: border-box; }
  .support-steps, .support-trust { grid-template-columns: 1fr; }
}

/* Filter als Raster (Einstellungen → Fernzugriffe, ab 1.54.1): gleich hohe
   Felder, Beschriftungen auf einer Linie, Knöpfe rechts unten. */
.filter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 16px; align-items: end; }
.filter-grid > div { min-width: 0; }
.filter-grid input, .filter-grid select { height: 40px; box-sizing: border-box; }
.filter-grid .span-2 { grid-column: span 2; }
.filter-grid .range { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px; align-items: center; }
.filter-grid .range span { color: var(--quiet); }
.filter-grid .filter-actions { display: flex; gap: 8px; justify-content: flex-end; }
.filter-grid .filter-actions .btn { height: 40px; display: inline-flex; align-items: center; }
@media (max-width: 1000px) {
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .filter-grid { grid-template-columns: minmax(0, 1fr); }
  .filter-grid .span-2 { grid-column: auto; }
  .filter-grid .filter-actions { justify-content: stretch; }
  .filter-grid .filter-actions .btn { flex: 1; justify-content: center; }
}

/* Geräteseite: Diagramm wird nachgeladen (ab 1.54.3) – Platz halten, damit nichts springt */
.chart-async { min-height: 220px; }
.chart-async.loaded { min-height: 0; } /* ab 1.60.2: Höhe nur, solange der Verlauf lädt */
.chart-loading { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 220px; color: var(--quiet); font-size: .9rem; }
.chart-loading .spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: okula-spin .8s linear infinite; }
@keyframes okula-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .chart-loading .spinner { animation: none; } }

/* Wartungsfenster bearbeiten (ab 1.59.4): Formular hervorgehoben, Knöpfe nebeneinander */
.form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card.editing { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }


/* =====================================================================
   Funksystem (ab Portal 0.2)
   ===================================================================== */
input.narrow { width: 80px; }
.code-tag.big-tag { font-size: 1.1rem; padding: 3px 10px; vertical-align: 2px; }
td .pill.small-pill + .pill.small-pill { margin-left: 2px; }
input.channel-name { width: 260px; max-width: 100%; }
#channels form.inline { flex-wrap: nowrap; align-items: center; }
#channels form.inline .check { margin: 0; white-space: nowrap; }
@media (max-width: 720px) { #channels form.inline { flex-wrap: wrap; } }
