/* ==========================================================================
   TTS Enterprise Tool — Bausteine im Design des TB PE Monitors
   Wird NACH dem seiteneigenen <style> geladen und ersetzt dessen Grundregeln.
   Gerüst: volle Seitenleiste (Marke, Verbindung, Navigation, Benutzer) und
   eine schmale Kopfzeile im Inhalt (Seitentitel, Status) – wie app.css des PE-Monitors.
   ========================================================================== */
@import url("/css/tokens.css?v=3c576666");

/* Alte Variablennamen der Seite auf die Grundlage abbilden.
   Damit folgen auch die Inline-Stile der Farbwelt – hell wie dunkel. */
:root {
  --bg: var(--papier);  --bg1: var(--flaeche);  --bg2: var(--flaeche-2);  --bg3: var(--linie-2);
  --text: var(--tinte); --text2: var(--tinte-2); --text3: var(--tinte-3);
  --border: var(--linie); --border2: var(--linie-stark);
  --accent: var(--akzent); --accent2: var(--akzent-tint);
  --info-bg: var(--akzent-tint); --info-text: var(--akzent);
  --ok-bg: var(--ok-tint);       --ok-text: var(--ok);
  --warn-bg: var(--warn-tint);   --warn-text: var(--warn);
  --err-bg: var(--fehler-tint);  --err-text: var(--fehler);
  --radius: var(--r-1); --radius-lg: var(--r-2);
  --font: var(--schrift); --mono: var(--schrift-mono);
  --shadow: var(--schatten);
}

/* --- Grundlage ----------------------------------------------------------- */
html { -webkit-text-size-adjust: 100%; scroll-behavior: auto; }
body {
  font-family: var(--schrift); font-size: var(--t-m); line-height: 1.45;
  color: var(--tinte); background: var(--papier);
}
h1, h2, h3 { font-weight: 700; }
a { color: var(--akzent); }
:focus-visible { outline: 2px solid var(--akzent); outline-offset: 1px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--linie); border-radius: 5px; border: 2px solid var(--papier); }
::-webkit-scrollbar-thumb:hover { background: var(--linie-stark); }
.small { font-size: 12px; }
.ico { flex: none; display: block; }

/* --- Gerüst: volle Seitenleiste + Inhalt --------------------------------- */
header { display: none !important; }   /* alte Kopfzeile – Inhalt steht jetzt in der Seitenleiste */
.app { display: grid !important; grid-template-columns: 264px minmax(0, 1fr); height: 100vh; min-height: 0; }
.sidebar {
  width: auto; background: var(--flaeche); border-right: 1px solid var(--linie);
  padding: 14px 12px 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 14px; font-weight: 700; color: var(--tinte); text-decoration: none; line-height: 1.3; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 32px; height: 32px; border-radius: 9px; background: var(--akzent); display: grid; place-items: center; flex: none; }
.brand-logo svg { width: 20px; height: 20px; fill: none; stroke: var(--auf-akzent); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.brand-logo svg circle { fill: var(--auf-akzent); stroke: none; }
.brand small { display: block; font-weight: 400; color: var(--tinte-2); font-size: 11px; }

/* Verbindungsbox (PE: „Verbindung“) */
.conn-switch { margin: 0 0 6px; padding: 10px; border: 1px solid var(--linie); border-radius: 10px; background: var(--papier); }
.conn-switch .nav-caption, .conn-switch .nav-section { padding: 0 0 6px; display: block; }
.conn-box { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--tinte); min-width: 0; }
.conn-box > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 6px; min-height: 18px; flex-wrap: wrap; }
.conn-ctx { font-size: 11px; color: var(--tinte-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.role-chip { font-size: 10.5px; font-weight: 600; letter-spacing: .03em; padding: 1px 7px; border-radius: 999px; background: var(--akzent-tint); color: var(--akzent); white-space: nowrap; }
.role-chip.ok { background: var(--ok-tint); color: var(--ok); }

/* Navigation */
.nav { display: flex; flex-direction: column; gap: 1px; padding-bottom: 12px; }
.nav-section, .nav-caption {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--tinte-2);
  font-weight: 600; padding: 14px 8px 5px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; min-height: 34px;
  border: 0; border-radius: 8px; background: none; color: var(--tinte); text-align: left; cursor: pointer;
  font-family: var(--schrift); font-size: var(--t-m); font-weight: 400; position: relative; text-decoration: none;
  transition: background-color .12s;
}
.nav-item .nav-icon, .nav-item .ico { width: 16px; height: 16px; flex: none; color: var(--tinte-2); opacity: 1; }
.nav-item:hover { background: var(--linie-2); color: var(--tinte); text-decoration: none; border-color: transparent; }
.nav-item.active { background: var(--akzent-tint); color: var(--akzent); font-weight: 600; }
.nav-item.active .nav-icon, .nav-item.active .ico { color: var(--akzent); }
.nav-item.active::before { content: ''; position: absolute; left: -12px; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: var(--akzent); }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-count, .badge-n {
  font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  display: inline-grid; place-items: center; background: var(--fehler); color: var(--auf-fehler); margin-left: auto;
}
.nav-item:focus-visible { outline: 2px solid var(--akzent); outline-offset: 1px; }

/* Benutzer unten in der Seitenleiste */
.nav-footer {
  margin-top: auto; position: sticky; bottom: 0; background: var(--flaeche); border-top: 1px solid var(--linie);
  display: flex; align-items: center; gap: 10px; padding: 10px 4px 12px;
}
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--akzent-tint); color: var(--akzent); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.who b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who span { font-size: 11px; color: var(--tinte-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who a { color: inherit; }
.icon-btn {
  border: 1px solid transparent; background: transparent; color: var(--tinte-2); border-radius: 8px;
  width: 36px; height: 36px; min-height: 36px; padding: 0; display: inline-grid; place-items: center; cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--linie-2); color: var(--tinte); border-color: transparent; }

/* Inhalt mit Kopfzeile (Seitentitel links, Status rechts) */
.content, main.content { padding: 16px 24px 40px; min-width: 0; height: 100vh; overflow-y: auto; position: relative; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; min-height: 36px; }
.topbar-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.crumb { font-size: 13px; color: var(--tinte); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb .sep { color: var(--tinte-2); margin: 0 4px; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--tinte-2); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.menu-btn { display: none !important; }
.nav-backdrop { display: none; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 300; left: 0; top: 0; width: 280px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--schatten-gross); }
  .sidebar.open { transform: none; }
  body.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 299; }
  .menu-btn { display: inline-grid !important; }
  .content, main.content { padding: 12px 14px 40px; }
}

/* --- Flächen (PE: „panel“) ---------------------------------------------- */
.card {
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--r-2);
  padding: 14px 16px; margin-bottom: 14px; box-shadow: var(--schatten); min-width: 0;
}
.card-title { font-size: var(--t-l); font-weight: 700; margin-bottom: 10px; color: var(--tinte); letter-spacing: 0; }
h2.sec { font-size: var(--t-xl); }

/* Kontextzeile (Tenant / App-ID): wer gerade angezeigt wird */
.ctx-bar {
  background: var(--flaeche); border: 1px solid var(--linie); border-left: 4px solid var(--akzent);
  border-radius: var(--r-2); padding: 8px 12px; font-size: var(--t-s); color: var(--tinte-2); gap: 8px; box-shadow: var(--schatten);
}
.ctx-bar b { font-weight: 700; color: var(--tinte); }
.ctx-sep { color: var(--linie-stark); }

/* --- Formulare ------------------------------------------------------------ */
label { font-size: 12px; font-weight: 600; color: var(--tinte-2); margin-bottom: 3px; }
input[type=text], input[type=search], input[type=password], input[type=number], input[type=date], input[type=email],
input[type=datetime-local], input[type=time], input[type=url], select, textarea {
  font-family: var(--schrift); font-size: var(--t-m); color: var(--tinte);
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: 8px;
  padding: 7px 10px; min-height: 36px;
}
textarea { font-family: var(--schrift-mono); font-size: 12px; line-height: 1.55; width: 100%; box-sizing: border-box; display: block; }
input:hover, select:hover, textarea:hover { border-color: var(--linie-stark); }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--akzent) 40%, transparent); outline-offset: 0; border-color: var(--akzent); box-shadow: none; }
input::placeholder, textarea::placeholder { color: var(--tinte-3); }
input:disabled, select:disabled, textarea:disabled { background: var(--flaeche-2); color: var(--tinte-3); }
input[type=checkbox], input[type=radio] { accent-color: var(--akzent); }

/* --- Schaltflächen (PE: „btn“) ------------------------------------------ */
button {
  font-family: var(--schrift); font-size: var(--t-m); font-weight: 600;
  padding: 7px 14px; min-height: 36px; border-radius: 8px;
  background: var(--flaeche); color: var(--tinte); border: 1px solid var(--linie);
  transition: background-color .12s, border-color .12s, color .12s; cursor: pointer;
}
button:hover { background: var(--flaeche); border-color: var(--akzent); color: var(--akzent); }
button:active { background: var(--linie-2); }
button.primary, .login-btn {
  background: var(--akzent); border-color: var(--akzent); color: var(--auf-akzent); opacity: 1;
}
button.primary:hover, .login-btn:hover { background: var(--akzent-dunkel); border-color: var(--akzent-dunkel); color: var(--auf-akzent); opacity: 1; }
button.danger { color: var(--fehler); border-color: var(--linie); background: var(--flaeche); }
button.danger:hover { border-color: var(--fehler); color: var(--fehler); background: var(--flaeche); }
button:disabled, button[disabled] {
  opacity: .55; background: var(--flaeche); color: var(--tinte-2);
  border-color: var(--linie); border-style: solid; cursor: default;
}
button:disabled:hover { color: var(--tinte-2); border-color: var(--linie); }
.btn-row { gap: 8px; }
/* Datenquelle (Demo / TTS API): gewählte Quelle wirkt gedrückt, nicht wie eine zweite Hauptaktion */
.src-btn.active { background: var(--akzent-tint); color: var(--akzent); border-color: var(--akzent); }

/* Zeitbereich: Reiter-Segmente */
.range-presets { gap: 0; margin-bottom: 14px; display: inline-flex; flex-wrap: wrap;
  border: 1px solid var(--linie); border-radius: 8px; overflow: hidden; background: var(--flaeche); }
.preset-btn {
  font-family: var(--schrift); font-size: var(--t-s); font-weight: 600; color: var(--tinte-2);
  border: 0; border-right: 1px solid var(--linie); border-radius: 0; padding: 6px 14px; min-height: 34px; background: var(--flaeche);
}
.preset-btn:last-child { border-right: 0; }
.preset-btn:hover:not(.active) { background: var(--linie-2); color: var(--tinte); }
.preset-btn.active { background: var(--akzent); color: var(--auf-akzent); }

/* --- Status: Pillen ------------------------------------------------------ */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.badge-info, .badge-accent { background: var(--akzent-tint); color: var(--akzent); }
.badge-ok   { background: var(--ok-tint);     color: var(--ok); }
.badge-warn { background: var(--warn-tint);   color: var(--warn); }
.badge-err  { background: var(--fehler-tint); color: var(--fehler); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.dot-ok { background: var(--ok); } .dot-err { background: var(--fehler); } .dot-idle { background: var(--unbekannt); }

/* --- Kennzahlen (PE: „tile“ mit Statusband links) ------------------------ */
.metric-grid { gap: 12px; }
.metric {
  background: var(--flaeche); border: 1px solid var(--linie); border-left: 4px solid var(--akzent);
  border-radius: var(--r-2); padding: 12px 14px; box-shadow: var(--schatten);
}
.metric-label { font-size: 12px; font-weight: 400; color: var(--tinte-2); margin-bottom: 2px; }
.metric-value { font-size: var(--t-2xl); font-weight: 700; letter-spacing: 0; font-variant-numeric: tabular-nums; color: var(--tinte); }
.metric-sub { font-size: 12px; color: var(--tinte-2); }

/* --- Tabellen (PE: ruhige Kopfzeile, feine Linien) ----------------------- */
/* Knöpfe in Tabellenzeilen klein wie „btn sm“ im PE-Monitor */
table.data-table td button:not(.raw-copy-btn):not(.copy-eui-btn):not(.th-sort-btn), .rank-tbl td button { padding: 3px 9px; min-height: 28px; font-size: 12px; white-space: nowrap; }
.table-wrap { border: 0; border-radius: 0; background: transparent; }
table.data-table { font-size: var(--t-m); font-variant-numeric: tabular-nums; }
table.data-table th {
  background: var(--flaeche); color: var(--tinte-2); font-size: 12px; font-weight: 600;
  text-transform: none; letter-spacing: 0; padding: 7px 8px; border-bottom: 1px solid var(--linie);
  position: sticky; top: 0; z-index: 1; white-space: nowrap;
}
table.data-table td { padding: 7px 8px; border-bottom: 1px solid var(--linie-2); font-size: var(--t-s); }
table.data-table tbody tr:nth-child(even) td,
table.data-table tbody tr:nth-child(odd) td { background: transparent; }
table.data-table tbody tr:hover td { background: var(--linie-2) !important; }
table.data-table td.alarm-cell { color: var(--fehler); font-weight: 700; }
.row-alarm td { background: var(--fehler-tint) !important; }
.rank-tbl th { text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--tinte-2); font-weight: 600; border-bottom: 1px solid var(--linie); }
.rank-tbl td { border-bottom: 1px solid var(--linie-2); font-size: var(--t-s); }
.rank-tbl tr:hover td { background: var(--linie-2); }

/* --- Paketdarstellung ----------------------------------------------------
   Das Paket ist der Gegenstand dieses Werkzeugs: dekodierte Werte vorn,
   Rohdaten als Byte-Folge in Mono (0/O und 8/B eindeutig), Funkweg dahinter. */
.ts-cell { font-size: var(--t-s); color: var(--tinte-2); font-variant-numeric: tabular-nums; width: auto; }
/* Datum über Uhrzeit: bricht nach dem Komma um, statt abgeschnitten zu werden */
#hist-tbody td.ts-cell { white-space: normal; overflow: visible; line-height: 1.5; }
.ts-cell, .ts-cell * { font-family: var(--schrift) !important; }
.dev-cell { font-size: var(--t-s); }
.dev-name-text, .dev-name { font-weight: 700; font-size: var(--t-m); color: var(--tinte); }
.dev-cell .mono, .dev-cell [style*="var(--mono)"] { font-size: var(--t-xs) !important; color: var(--tinte-2) !important; letter-spacing: 0.02em; }

.fields-cell { line-height: 1.6; }
.field-badge {
  display: inline-flex; align-items: baseline; gap: 5px; margin: 2px 4px 2px 0;
  padding: 2px 7px; border-radius: var(--r-1);
  background: var(--flaeche-2); border: 1px solid var(--linie); color: var(--tinte);
}
.field-key { font-size: var(--t-xs); color: var(--tinte-2); margin-right: 0; }
.field-val { font-size: var(--t-m); font-weight: 700; color: var(--tinte); font-variant-numeric: tabular-nums; }
.field-val > span { font-size: var(--t-xs) !important; font-weight: 400; color: var(--tinte-2); opacity: 1 !important; }

.raw-hex {
  font-family: var(--schrift-mono); font-size: var(--t-s); color: var(--tinte);
  background: var(--flaeche); border: 1px dashed var(--linie-stark); border-radius: var(--r-1);
  padding: 2px 8px; word-spacing: 0.15em; letter-spacing: 0.02em;
}
.raw-label {
  font-size: var(--t-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--tinte-2); padding: 2px 6px; border-radius: var(--r-1); background: var(--flaeche-2, var(--flaeche));
  border: 1px solid var(--linie);
}
.raw-sub { font-size: var(--t-xs); color: var(--tinte-2); white-space: nowrap; }
.raw-sub .mono { font-family: var(--schrift-mono); color: var(--tinte); overflow-wrap: anywhere; white-space: normal; }
.raw-sub b { color: var(--tinte); }
.raw-sim-btn {
  min-height: 0; padding: 3px 9px; font-size: var(--t-xs); font-weight: 600; border-radius: var(--r-1);
  background: var(--flaeche); border: 1px solid var(--akzent); color: var(--akzent); cursor: pointer;
}
.raw-sim-btn:hover { background: var(--akzent); color: var(--auf-akzent); }
.raw-copy-btn {
  min-height: 0; padding: 3px 6px; border-radius: var(--r-1); background: var(--flaeche);
  border: 1px solid var(--linie); color: var(--tinte-2);
}
.raw-copy-btn:hover { background: var(--akzent-tint); color: var(--akzent-dunkel); border-color: var(--akzent); }
.raw-copy-btn.copied { background: var(--ok-tint); color: var(--ok); border-color: var(--ok); }

.gw-count { font-size: var(--t-xs); color: var(--tinte-2); font-weight: 700; }
.gw-badge {
  font-family: var(--schrift-mono); font-size: var(--t-xs); color: var(--tinte-2);
  background: none; border: 1px solid var(--linie); border-radius: var(--r-1); padding: 1px 6px;
}

/* Nachrichtentyp: Uplink ist der Normalfall und bleibt leise */
.msg-badge { font-size: var(--t-xs); font-weight: 700; border-radius: var(--r-1); padding: 1px 6px; border-width: 1px; }
.msg-uplink  { background: var(--ok-tint);    color: var(--ok);       border: 1px solid transparent; }
.msg-mac     { background: var(--flaeche-2);  color: var(--tinte-2);  border: 1px solid var(--linie-stark); }
.msg-join    { background: var(--akzent-tint);color: var(--akzent-dunkel); border: 1px solid transparent; }
.msg-unknown { background: var(--flaeche-2);  color: var(--tinte-3);  border: 1px dashed var(--linie-stark); }
.mac-cmd-badge { background: var(--flaeche-2); color: var(--tinte); border: 1px solid var(--linie-stark); }
.mac-cmd-badge .field-key { color: var(--tinte-2); }
.mac-cmd-badge .field-val { color: var(--tinte); font-size: var(--t-s); }
.mac-info { color: var(--tinte-2); font-family: var(--schrift); font-size: var(--t-xs); }

.rf-cell { font-size: var(--t-s); font-variant-numeric: tabular-nums; }
.rssi-good { color: var(--ok); font-weight: 700; }
.rssi-mid  { color: var(--warn); font-weight: 700; }
.rssi-bad  { color: var(--fehler); font-weight: 700; }

.packet-row { border: 1px solid var(--linie); border-radius: var(--r-1); background: var(--flaeche); }
.packet-row:hover, .packet-row.selected { background: var(--flaeche-2); border-color: var(--linie-stark); }
.packet-row.selected { box-shadow: inset 3px 0 0 var(--akzent); }
.packet-row.alarm { border-left: 4px solid var(--fehler); }
.packet-meta { font-size: var(--t-s); color: var(--tinte-2); font-variant-numeric: tabular-nums; }

.mono { font-family: var(--schrift-mono); font-size: var(--t-s); }
.raw-box, .api-hint {
  font-family: var(--schrift-mono); font-size: var(--t-s); color: var(--tinte);
  background: var(--flaeche-2); border: 1px solid var(--linie); border-radius: var(--r-1);
}
.decoded-tree { font-family: var(--schrift-mono); font-size: var(--t-s); }
.tree-key { color: var(--tinte-2); }
.tree-num { color: var(--akzent-dunkel); font-weight: 700; }
.tree-str { color: var(--warn); font-weight: 700; }

/* --- Weitere Bausteine ---------------------------------------------------- */
.alarm-rule, .dlp-profile-card, .dlp-cmd-item, .profile-card {
  border: 1px solid var(--linie); border-radius: var(--r-1); background: var(--flaeche);
}
.dlp-cmd-item { background: var(--flaeche-2); }
.dlp-cmd-item.editing, .profile-card.active { border-color: var(--akzent); background: var(--akzent-tint); }
.profile-card.active .profile-name { color: var(--akzent-dunkel); }
.profile-name { font-size: var(--t-l); font-weight: 700; }
.profile-desc { font-size: var(--t-s); color: var(--tinte-2); }
.profile-meta { font-size: var(--t-xs); color: var(--tinte-2); }
.profile-active-badge { background: var(--akzent); border-radius: var(--r-1); font-size: var(--t-xs); }
.dlp-cmd-num { background: var(--akzent-tint); color: var(--akzent-dunkel); font-weight: 700; }
.dl-quick-btn { border: 1px solid var(--akzent); background: var(--akzent-tint); color: var(--akzent-dunkel); border-radius: var(--r-1); min-height: 0; }
.dl-quick-btn:hover { background: var(--akzent); color: var(--auf-akzent); }
.dl-quick-menu { border: 1px solid var(--linie-stark); border-radius: var(--r-1); box-shadow: 0 6px 18px rgba(31,42,51,.14); }
.dl-quick-item { font-size: var(--t-s); border-bottom: 1px solid var(--linie); }
.ql-filter-bar { background: var(--flaeche-2); border: 1px solid var(--linie); border-radius: var(--r-1); }
.ql-accordion-header:hover .card-title { color: var(--akzent-dunkel); }
.toggle-track { background: var(--linie-stark); }
.toggle-track.on { background: var(--akzent); }
.gw-online { background: var(--ok); } .gw-offline { background: var(--fehler); } .gw-unknown { background: var(--linie-stark); }
#map-container { border: 1px solid var(--linie); border-radius: var(--r-2); }
.empty { color: var(--tinte-2); font-size: var(--t-m); padding: 2.5rem 1rem; }

/* Meldungen (PE: dunkle Kurzmeldung unten rechts; Fehler rot) */
.toast {
  background: var(--tinte); color: var(--flaeche); border: 0; border-left: 0;
  border-radius: 8px; box-shadow: var(--schatten-gross); font-size: var(--t-m); padding: 10px 14px; max-width: 420px;
}
.toast.err, .toast.alarm, .toast.error { background: var(--fehler); color: var(--auf-fehler); }
.toast.ok, .toast.success { background: var(--tinte); color: var(--flaeche); }
.toast * { color: inherit; }

/* Dialoge */
.modal, .modal-bg, .dialog-bg { background: var(--abdunkeln); }
.modal-box, .dialog, dialog { background: var(--flaeche); color: var(--tinte); border-radius: var(--r-3); box-shadow: var(--schatten-gross); border: 1px solid var(--linie); }

/* --- Anmeldung (PE: Fläche mit Marke, mittig) ---------------------------- */
.login-screen { background: var(--papier); }
.login-card {
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--r-2); box-shadow: var(--schatten);
  padding: 22px 22px 18px; width: 380px; max-width: calc(100vw - 32px);
}
.login-card .brand { justify-content: center; font-size: 18px; padding-bottom: 18px; }
.login-logo { display: none; }
.login-title { font-size: var(--t-l); font-weight: 700; color: var(--tinte); text-align: left; margin-bottom: 4px; }
.login-sub { font-size: 12px; color: var(--tinte-2); text-align: left; margin-bottom: 16px; }
.login-field { margin-bottom: 10px; }
.login-field label { font-size: 12px; font-weight: 600; color: var(--tinte-2); margin-bottom: 3px; }
.login-field input { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 8px; font-size: var(--t-m); min-height: 36px; padding: 7px 10px; }
.login-btn { width: 100%; font-size: var(--t-m); font-weight: 600; min-height: 36px; border-radius: 8px; margin-top: 6px; }
.login-err { color: var(--fehler); font-size: 12px; }

/* --- Niedrige Fenster --------------------------------------------------- */
@media (max-height: 700px) {
  .nav-item { min-height: 30px; padding: 5px 8px; }
  .nav-section, .nav-caption { padding: 8px 8px 3px; }
  .brand { padding-bottom: 8px; }
}

/* Druck: nur Inhalt */
@media print {
  .sidebar, .toast-container, .topbar, .nav-backdrop { display: none !important; }
  .app { display: block !important; height: auto; } .content { overflow: visible; padding: 0; height: auto; }
  .card { break-inside: avoid; box-shadow: none; }
}

/* Hinweis: Standardpasswort noch aktiv */
.pw-warning { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; padding: 10px 14px;
  background: var(--warn-tint); color: var(--warn); border: 1px solid var(--warn); border-left-width: 4px; border-radius: var(--r-1); font-weight: 600; }
.pw-warning button { margin-left: auto; }

/* Lange Gerätenamen umbrechen statt abschneiden (Kopier-Knopf überdeckte sonst das Ende) */
/* Gerätename und DevEUI je in EINER Zeile: kein Umbruch, zu Langes endet mit … (voller Wert im Tooltip) */
#hist-tbody td.dev-cell { white-space: nowrap; overflow: hidden; }
#hist-tbody td.dev-cell > div { min-width: 0; }
#hist-tbody td.dev-cell [style*="var(--mono)"] { letter-spacing: 0 !important; }
.dev-cell .dev-name-text, .dev-cell .dev-eui-text { display: block; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; word-break: normal; }

/* --- Listen: bündige Überschriften, Sortierung, Suche ------------------- */
table.data-table th, .rank-tbl th { text-align: left; vertical-align: bottom; }
table.data-table td, .rank-tbl td { text-align: left; }
.th-sort { padding: 0 !important; }
.th-sort-btn {
  all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 4px; width: 100%;
  padding: 8px 10px; cursor: pointer; font: inherit; font-weight: 700; color: inherit; text-align: inherit;
}
th[style*="right"] .th-sort-btn { justify-content: flex-end; }
.th-sort-btn:hover { color: var(--akzent-dunkel); background: var(--akzent-tint); }
.th-sort-btn:focus-visible { box-shadow: inset 0 0 0 2px var(--akzent); }
.th-sort-ind { display: inline-block; width: 10px; color: var(--linie-stark); font-size: 10px; }
.th-sort-ind::after { content: "↕"; }
th[aria-sort="ascending"] .th-sort-ind, th[aria-sort="descending"] .th-sort-ind { color: var(--akzent); }
th[aria-sort="ascending"] .th-sort-ind::after { content: "▲"; }
th[aria-sort="descending"] .th-sort-ind::after { content: "▼"; }
th[aria-sort="ascending"], th[aria-sort="descending"] { color: var(--akzent-dunkel); }
.tbl-tools { display: flex; align-items: center; gap: 12px; margin: 0 0 8px; flex-wrap: wrap; }
.tbl-tools[hidden] { display: none; }
.tbl-search input { width: 280px; max-width: 100%; min-height: 32px; padding: 5px 10px; font-size: var(--t-s); }
.tbl-count { font-size: var(--t-s); color: var(--tinte-2); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Kartenhinweis: Links nicht nur über Farbe erkennbar (WCAG 1.4.1) */
.leaflet-control-attribution a { text-decoration: underline; }

/* Karten (Leaflet): Popups und Bedienelemente in der Farbwelt – auch im dunklen Thema lesbar */
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--flaeche); color: var(--tinte); box-shadow: var(--schatten-gross); }
.leaflet-popup-content-wrapper { border-radius: var(--r-2); border: 1px solid var(--linie); }
.leaflet-container a.leaflet-popup-close-button { color: var(--tinte-2); }
.leaflet-bar a, .leaflet-control-layers { background: var(--flaeche); color: var(--tinte); border-color: var(--linie); }
.leaflet-bar a:hover { background: var(--linie-2); color: var(--tinte); }
.leaflet-container .leaflet-control-attribution { background: color-mix(in srgb, var(--flaeche) 85%, transparent); color: var(--tinte-2); }
.leaflet-container .leaflet-control-attribution a { color: var(--akzent); }
.leaflet-container { background: var(--flaeche-2); font-family: var(--schrift); }

/* Lange Listen: Nachladen in 1.000er-Paketen */
.pager { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.pager[hidden] { display: none; }

/* ==========================================================================
   4.3.0 – gemeinsame Navigation (nav.js), Einstellungen mit Unternavigation,
   Version & Updates, Mein Konto, Datensicherung, Wartungsband, Dialoge
   ========================================================================== */
.hidden { display: none !important; }
.view-off { display: none !important; }
/* Verbindung: Auswahl der Instanz */
.conn-box select { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-weight: 600; color: var(--tinte); padding: 2px 0; min-height: 28px; }
.conn-box select:focus { outline: 2px solid var(--akzent); outline-offset: 2px; border-radius: 4px; }
.conn-live { display: flex; align-items: center; gap: 6px; margin-top: 6px; min-width: 0; }
.conn-live .conn-ctx { flex: 1; }
.dot-warn { background: var(--warn); }
/* Zähler und Statuspunkte */
.nav-cnt { font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-grid; place-items: center; margin-left: auto; flex: none; }
.nav-cnt.c-crit { background: var(--fehler); color: var(--auf-fehler); }
.nav-cnt.c-warn { background: var(--warn-tint); color: var(--warn); }
.nav-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; margin-left: auto; }
.d-ok { background: var(--ok); } .d-warn { background: var(--warn); } .d-err { background: var(--fehler); }
.d-unknown, .d-off { background: var(--unbekannt); } .d-manual { background: transparent; border: 2px solid var(--unbekannt); width: 9px; height: 9px; box-sizing: border-box; }
.nav-sec-tog { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.nav-tog { font: inherit; font-size: 10.5px; text-transform: none; letter-spacing: 0; font-weight: 600; border: 1px solid var(--linie); background: var(--flaeche); color: var(--tinte-2); border-radius: 999px; padding: 1px 8px; min-height: 22px; cursor: pointer; }
.nav-tog.on { background: var(--akzent); border-color: var(--akzent); color: var(--auf-akzent); }
.nav-tog:hover { border-color: var(--akzent); }
.nav-grp { display: flex; align-items: center; gap: 6px; padding: 6px 8px; font-size: 12.5px; font-weight: 600; color: var(--tinte-2); }
.nav-grp .ico { color: var(--tinte-2); }
.nav-grpitems { padding-left: 8px; margin-left: 14px; border-left: 1px solid var(--linie-2); display: flex; flex-direction: column; gap: 1px; }
.nav-grpitems .nav-item.active::before { left: -21px; }
.nav-grp[hidden], .nav-grpitems[hidden], .nav-item[hidden] { display: none; }
#nav-ver { text-decoration: underline; }
/* Einstellungen: Unternavigation links, Inhalt rechts */
.setlay { display: block; }
.setnav, .set-mobile { display: none; }
body.in-settings .setlay { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
body.in-settings .setnav { display: block; flex: 0 0 230px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--r-2); padding: 4px 8px 10px; box-shadow: var(--schatten); position: sticky; top: 0; }
.setbody { min-width: 0; }
body.in-settings .setbody { flex: 999 1 520px; }
.setnav .nav-caption { padding: 10px 8px 4px; }
.setbtn { display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 8px; border-radius: 7px; color: var(--tinte); font-size: 13.5px; text-decoration: none; box-sizing: border-box; }
.setbtn:hover { background: var(--linie-2); text-decoration: none; color: var(--tinte); }
.setbtn.on { background: var(--akzent-tint); color: var(--akzent); font-weight: 600; }
.setbtn .ico { color: var(--tinte-2); } .setbtn.on .ico { color: var(--akzent); }
@media (max-width: 1100px) {
  body.in-settings .setnav { display: none; }
  body.in-settings .set-mobile { display: block; margin-bottom: 12px; }
  body.in-settings .set-mobile select { width: 100%; max-width: 420px; font-weight: 600; }
}
.page-h { font-size: 20px; margin: 4px 0 12px; }
.page-h[hidden] { display: none; }
.setbody h2.sec { display: none; }
/* Hinweisbänder (Wartung, Update) */
.sys-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; padding: 10px 14px; border-radius: var(--r-1); border: 1px solid var(--linie); border-left-width: 4px; font-size: var(--t-m); }
.sys-banner.warn { background: var(--warn-tint); color: var(--warn); border-color: var(--warn); }
.sys-banner.info { background: var(--akzent-tint); color: var(--akzent-dunkel); border-color: var(--akzent); }
.sys-banner.ok { background: var(--ok-tint); color: var(--ok); border-color: var(--ok); }
.sys-banner > span { flex: 1; min-width: 200px; }
.sys-banner a, .sys-banner button { margin-left: auto; }
/* Kacheln, Module, Raster */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 0 0 14px; }
.tile { display: block; border: 1px solid var(--linie); border-left: 4px solid var(--linie); border-radius: var(--r-2); padding: 10px 14px; background: var(--flaeche); box-shadow: var(--schatten); color: var(--tinte); text-decoration: none; min-width: 0; }
a.tile:hover { border-color: var(--akzent); text-decoration: none; color: var(--tinte); }
.tile .l { display: block; color: var(--tinte-2); font-size: 12px; }
.tile b { display: block; font-size: var(--t-2xl); font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.tile b.tile-s { font-size: 17px; }
.tile > span:last-child { display: block; font-size: 12px; color: var(--tinte-2); }
.tile.ok { border-left-color: var(--ok); } .tile.err { border-left-color: var(--fehler); } .tile.warn { border-left-color: var(--warn); } .tile.info { border-left-color: var(--akzent); }
.ov-ph { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.mods { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.mod { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--linie); border-radius: var(--r-1); background: var(--flaeche); color: var(--tinte); text-decoration: none; }
.mod:hover { border-color: var(--akzent); text-decoration: none; color: var(--tinte); }
.mod .nav-dot { margin-left: 0; }
.mod b { display: block; font-size: 13px; } .mod .muted { display: block; font-size: 11px; color: var(--tinte-2); }
.sys-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.sys-grid > .card { margin-bottom: 0; }
.sys-span { grid-column: 1 / -1; }
.sys-view input[type=text], .sys-view input[type=password], .sys-view input[type=number] { width: 100%; box-sizing: border-box; }
.sys-view label { display: block; }
.sys-btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sys-view .muted, .vu-prev .muted { color: var(--tinte-2); font-size: var(--t-s); }
.sys-view .mono { font-family: var(--schrift-mono); font-size: 12px; }
.sys-view .sev-err { color: var(--fehler); font-weight: 700; }
.sys-view .stale, .vu-prev .stale { color: var(--warn); font-weight: 700; }
.cmd { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 0; border-top: 1px solid var(--linie-2); }
.cmd code { font-family: var(--schrift-mono); font-size: 13px; background: var(--linie-2); padding: 4px 8px; border-radius: 6px; }
.cmd .btn-copy { min-height: 28px; padding: 3px 9px; font-size: 12px; }
details.cl { border-top: 1px solid var(--linie-2); padding: 8px 0; }
details.cl:first-child { border-top: 0; }
details.cl summary { cursor: pointer; color: var(--akzent); }
details.cl ul { margin: 6px 0 0; padding-left: 20px; }
.vu-prev { border: 1px solid var(--linie); border-left: 4px solid var(--akzent); border-radius: var(--r-1); padding: 10px 14px; margin-top: 12px; background: var(--flaeche-2); }
.vu-cl { max-height: 50vh; overflow: auto; }
.rc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; padding: 10px 14px; background: var(--flaeche-2); border: 1px dashed var(--linie-stark); border-radius: var(--r-1); margin: 10px 0; font-size: 15px; }
.keybox { font-family: var(--schrift-mono); background: var(--flaeche-2); border: 1px dashed var(--linie-stark); padding: 8px 10px; border-radius: var(--r-1); word-break: break-all; }
.tf-setup { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.tf-qr { flex: 0 0 210px; background: #fff; padding: 6px; border-radius: var(--r-1); border: 1px solid var(--linie); }
.tf-qr svg { display: block; width: 100%; height: auto; }
.tf-setup > div:last-child { flex: 1 1 240px; min-width: 0; }
.tf-steps { margin: 0; padding-left: 20px; } .tf-steps li { margin-bottom: 8px; }
/* Dialoge */
dialog.tts-dlg { width: min(480px, calc(100vw - 32px)); padding: 18px 20px 16px; }
dialog.tts-dlg.wide { width: min(680px, calc(100vw - 32px)); }
dialog.tts-dlg::backdrop { background: var(--abdunkeln); }
dialog.tts-dlg h2 { font-size: var(--t-l); margin: 0 0 10px; }
dialog.tts-dlg label { display: block; margin-top: 10px; }
dialog.tts-dlg input:not([type=checkbox]):not([type=radio]) { width: 100%; box-sizing: border-box; }
.dlg-cb { display: flex !important; gap: 8px; align-items: flex-start; font-weight: 400 !important; color: var(--tinte) !important; font-size: var(--t-m) !important; cursor: pointer; margin: 8px 0; }
.dlg-cb input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; }
.dlg-body p { margin: 0 0 8px; }
.dlg-err { color: var(--fehler); font-size: 12px; min-height: 0; margin: 6px 0 0; }
.dlg-act { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
button.danger-solid { background: var(--fehler); border-color: var(--fehler); color: var(--auf-fehler); }
button.danger-solid:hover { background: var(--fehler); color: var(--auf-fehler); opacity: .9; }
.sys-view .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.sys-view .row > div { display: flex; flex-direction: column; min-width: 160px; flex: 1; }
.jm-set { border: 1px solid var(--linie); border-radius: 8px; padding: 8px 12px 10px; margin: 0; }
.jm-set legend { font-weight: 600; padding: 0 4px; }
/* Karten: Reiter GPS | Gateways */
.map-seg { display: inline-flex; border: 1px solid var(--linie); border-radius: var(--r-1); overflow: hidden; background: var(--flaeche); margin: 0 0 12px; }
.map-seg a { padding: 7px 18px; font-weight: 600; color: var(--tinte-2); text-decoration: none; min-height: 36px; box-sizing: border-box; display: inline-flex; align-items: center; }
.map-seg a + a { border-left: 1px solid var(--linie); }
.map-seg a[aria-current="page"] { background: var(--akzent); color: var(--auf-akzent); }
.map-seg a:hover:not([aria-current]) { background: var(--linie-2); text-decoration: none; }
@media (max-width: 900px) { .tf-qr { flex-basis: 100%; max-width: 260px; } }
a.btn-link { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; min-height: 36px; box-sizing: border-box; border-radius: 8px; border: 1px solid var(--linie); background: var(--flaeche); color: var(--tinte); font-weight: 600; text-decoration: none; white-space: nowrap; }
a.btn-link:hover { border-color: var(--akzent); color: var(--akzent); text-decoration: none; }
.sys-btns button, .sys-btns a.btn-link { display: inline-flex; align-items: center; gap: 6px; }
.sys-btns .ico { display: inline-block; }
.muted { color: var(--tinte-2); font-size: var(--t-s); }
/* Zeile unter dem Mauszeiger: gedämpfter Text bleibt ausreichend kontrastreich (WCAG 1.4.3) */
table.data-table tbody tr:hover .muted, table.data-table tbody tr:hover .mail-st, table.data-table tbody tr:hover .sev-info { color: var(--tinte-3); }
.badge-off { background: var(--linie-2); color: var(--tinte); }
/* Verbindung: zweite Stufe (Application) und Hinweis zur Live-Quelle */
.conn-app { margin-top: 4px; padding-left: 2px; }
.conn-app[hidden] { display: none; }
.conn-app-ico { width: 9px; color: var(--tinte-2); font-size: 12px; text-align: center; flex: none; }
.conn-app select { font-weight: 500; }
.conn-hint { margin-top: 6px; font-size: 11px; line-height: 1.35; color: var(--warn); }
.conn-hint[hidden] { display: none; }
.conn-hint a { color: inherit; text-decoration: underline; }
/* Speicherplatz */
.disk-bar { height: 10px; border-radius: 5px; background: var(--linie-2); overflow: hidden; margin: 4px 0 8px; max-width: 520px; }
.disk-bar span { display: block; height: 100%; background: var(--akzent); }
.disk-bar.warn span { background: var(--warn); } .disk-bar.err span { background: var(--fehler); }
/* Kopfzeile einer Karte mit Knopf rechts (Datensicherung, Tenant-Sicherung) */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.card-head .card-title { margin-bottom: 0; }
.cb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 16px; margin: 6px 0 4px; }
.cb-grid label { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 0; }
.nowrap { white-space: nowrap; }
.bk-btns { justify-content: flex-end; flex-wrap: nowrap; }
.bk-btns button { padding: 5px 10px; min-height: 30px; font-size: 13px; }
@media (max-width: 1100px) { .bk-btns { flex-wrap: wrap; } }
.bk-table td .ico { display: inline-block; vertical-align: -2px; margin-left: 4px; color: var(--akzent); }
/* Tenant-Sicherung */
.tb-table td.tb-inh { text-align: left; min-width: 260px; }
.tb-table .tb-btns { display: grid; grid-template-columns: repeat(3, auto); justify-content: end; gap: 6px; }
.tb-table .tb-btns [data-tbk] { grid-column: span 2; }
@media (max-width: 1100px) { .tb-table .tb-btns { grid-template-columns: repeat(2, auto); } .tb-table .tb-btns [data-tbk] { grid-column: auto; } }
h3.card-title, h4.card-title { margin-top: 0; }
.card-head h3.card-title { margin-bottom: 0; }
.ts-savebar { padding-top: 12px; padding-bottom: 12px; }
.ts-savebar .sys-btns { align-items: center; }
#tb-up-prog { width: 160px; }
.ql-preset.active { background: var(--akzent); border-color: var(--akzent); color: var(--auf-akzent); }
