:root {
  --brand: #1D4ED8;
  --brand-dark: #1E3A8A;
  --brand-light: #DBEAFE;
  --ink: #0F172A;
  --ink-soft: #475569;
  --ink-faint: #94A3B8;
  --paper: #F8FAFC;
  --card: #FFFFFF;
  --line: #E2E8F0;
  --ok: #16A34A;
  --warn: #D97706;
  --crit: #DC2626;
  --sidebar-bg: #0B1220;
  --sidebar-line: #1E293B;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, Menlo, monospace;
  --sans: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  /* abgeleitete Oberflaechen-Variablen (Tabellen, Modal, Warn-/Fehlerboxen) - passen sich im Darkmode an */
  --row-hover: #F8FAFC;
  --border-soft: #F1F5F9;
  --overlay-bg: rgba(15,23,42,.45);
  --modal-bg: #FFFFFF;
  --meter-track: #E2E8F0;
  --error-bg: #FEF2F2;
  --error-border: #FECACA;
  --warn-bg: #FFFBEB;
  --warn-border: #FDE68A;
}

/* ---------- Darkmode ----------
   Wird per data-theme="dark" auf <html> aktiviert (siehe static/theme.js).
   Nur die Oberflaechen-/Textfarben werden ueberschrieben - die Marken-
   farbe eines Mandanten (--brand/--brand-dark/--brand-light, inline pro
   Seite gesetzt) bleibt davon unberuehrt und funktioniert in beiden
   Modi weiter. */
:root[data-theme="dark"] {
  --ink: #E2E8F0;
  --ink-soft: #94A3B8;
  --ink-faint: #64748B;
  --paper: #0B1220;
  --card: #16202F;
  --line: #2A3A52;
  --ok: #4ADE80;
  --warn: #FBBF24;
  --crit: #F87171;
  --row-hover: #1C2739;
  --border-soft: #1E293B;
  --overlay-bg: rgba(0,0,0,.6);
  --modal-bg: #16202F;
  --meter-track: #2A3A52;
  --error-bg: rgba(248,113,113,.12);
  --error-border: rgba(248,113,113,.4);
  --warn-bg: rgba(251,191,36,.12);
  --warn-border: rgba(251,191,36,.4);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
}

button { font-family: var(--sans); cursor: pointer; }
input, select, textarea { font-family: var(--sans); }

/* ---------- Login ---------- */
.login-body {
  height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 20% 20%, #16213E 0%, #0B1220 55%, #060A13 100%);
}
.login-card {
  background: var(--card); border-radius: 14px; padding: 40px 44px;
  width: 360px; box-shadow: 0 30px 60px rgba(0,0,0,.35);
}
.login-card h1 { margin: 0 0 2px; font-size: 22px; letter-spacing: -0.02em; }
.login-card h1 span { color: var(--brand); }
.login-logo { max-width: 180px; max-height: 64px; display: block; margin: 0 auto 16px; object-fit: contain; }
.powered-by { text-align: center; font-size: 10.5px; color: var(--ink-faint); margin-top: 22px; letter-spacing: .03em; }
.login-card .subtitle { color: var(--ink-faint); font-family: var(--mono); font-size: 12px; margin: 0 0 24px; text-transform: uppercase; letter-spacing: .08em; }
.login-card label { display: block; font-size: 12px; color: var(--ink-soft); margin: 14px 0 4px; }
.login-card input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px;
}
.login-card button {
  width: 100%; margin-top: 22px; padding: 11px; border: none; border-radius: 8px;
  background: var(--brand); color: #fff; font-weight: 600; font-size: 14px;
}
.login-card button:hover { background: var(--brand-dark); }
.error-box {
  background: var(--error-bg); color: var(--crit); border: 1px solid var(--error-border);
  padding: 8px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 4px;
}

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--sidebar-bg); color: #CBD5E1; padding: 20px 14px;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { padding: 4px 8px 20px; border-bottom: 1px solid var(--sidebar-line); margin-bottom: 14px; }
.sidebar-logo { max-width: 100%; max-height: 40px; object-fit: contain; margin-bottom: 8px; display: block; }
.brand .name { font-weight: 700; font-size: 15px; color: #fff; }
.brand .name b { color: #60A5FA; }
.brand .tag { font-family: var(--mono); font-size: 10px; color: #64748B; text-transform: uppercase; letter-spacing: .1em; }

.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  color: #94A3B8; font-size: 13.5px; margin-bottom: 2px; text-decoration: none; border: none;
  background: transparent; width: 100%; text-align: left;
}
.nav-item:hover { background: #131E33; color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; }
.nav-item .count {
  margin-left: auto; font-family: var(--mono); font-size: 11px; background: #1E293B; color: #94A3B8;
  padding: 1px 6px; border-radius: 10px;
}
.nav-item.active .count { background: rgba(255,255,255,.25); color: #fff; }

.sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--sidebar-line); }
.sidebar-footer .user { font-size: 12px; color: #64748B; padding: 0 10px 8px; font-family: var(--mono); }
.logout-link { color: #94A3B8; font-size: 12.5px; padding: 8px 10px; display: block; text-decoration: none; border-radius: 8px; }
.logout-link:hover { background: #131E33; color: #fff; }

.main { padding: 28px 36px; overflow-y: auto; }
.page-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 20px; }
.page-header h2 { margin: 0; font-size: 20px; letter-spacing: -0.01em; }
.page-header .sub { color: var(--ink-faint); font-size: 12.5px; font-family: var(--mono); }

/* ---------- Cards / KPI ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.kpi-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.kpi-card .label { font-size: 11.5px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .06em; }
.kpi-card .value { font-size: 26px; font-weight: 700; margin-top: 4px; font-family: var(--mono); }
.kpi-card.crit .value { color: var(--crit); }
.kpi-card.warn .value { color: var(--warn); }
.kpi-card.ok .value { color: var(--ok); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; margin-bottom: 18px; }
.card h3 { margin: 0 0 14px; font-size: 14.5px; }

/* ---------- Table ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--ink-faint); font-weight: 600; font-size: 11px; text-transform: uppercase;
     letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px 10px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
tr.clickable:hover { background: var(--row-hover); cursor: pointer; }
.mono { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); }

.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.status-dot.online { background: var(--ok); box-shadow: 0 0 0 3px rgba(22,163,74,.15); }
.status-dot.offline { background: var(--crit); box-shadow: 0 0 0 3px rgba(220,38,38,.15); }
.status-dot.unknown { background: var(--ink-faint); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 5px; font-size: 11px; font-weight: 600; }
.badge.kritisch { background: #FEF2F2; color: var(--crit); }
.badge.wichtig { background: #FFFBEB; color: var(--warn); }
.badge.normal { background: #F1F5F9; color: var(--ink-soft); }
.badge.server { background: var(--brand-light); color: var(--brand-dark); }
.badge.client { background: #ECFDF5; color: #047857; }
.badge.sonstige { background: #F3F4F6; color: #4B5563; }

.btn { border: 1px solid var(--line); background: #fff; padding: 7px 13px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--crit); }
.btn.danger:hover { border-color: var(--crit); }
.btn.small { padding: 4px 9px; font-size: 11.5px; }

.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; }
.tabs { display: flex; gap: 4px; background: #F1F5F9; padding: 3px; border-radius: 8px; }
.tab { padding: 6px 14px; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); border: none; background: transparent; }
.tab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.spacer { flex: 1; }

.empty-state { text-align: center; padding: 50px 20px; color: var(--ink-faint); }
.empty-state .big { font-size: 28px; margin-bottom: 8px; }

/* ---------- Alerts ---------- */
.alert-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; margin-bottom: 8px; border: 1px solid var(--line); }
.alert-row.kritisch { border-color: #FECACA; background: #FEF2F2; }
.alert-row.wichtig { border-color: #FDE68A; background: #FFFBEB; }
.alert-row .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.alert-row.kritisch .dot { background: var(--crit); }
.alert-row.wichtig .dot { background: var(--warn); }
.alert-row .title { font-weight: 600; font-size: 13px; }
.alert-row .detail { color: var(--ink-soft); font-size: 12px; margin-top: 2px; }

/* ---------- Modal ---------- */
.overlay {
  position: fixed; inset: 0; background: var(--overlay-bg); display: flex;
  align-items: flex-start; justify-content: center; padding: 6vh 20px; overflow-y: auto; z-index: 50;
}
.modal { background: var(--modal-bg); border-radius: 14px; width: 560px; max-width: 100%; padding: 26px 28px; }
.modal h3 { margin: 0 0 18px; font-size: 16px; }
.modal .row { margin-bottom: 12px; }
.modal label { display: block; font-size: 12px; color: var(--ink-soft); margin-bottom: 4px; }
.modal input, .modal select, .modal textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 13.5px;
}
.modal textarea { font-family: var(--mono); font-size: 12.5px; min-height: 70px; }
.modal .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.modal .close-x { position: absolute; }

.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 24px; margin-bottom: 6px; }
.detail-grid div .k { font-size: 11px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em; }
.detail-grid div .v { font-size: 13px; margin-top: 2px; font-family: var(--mono); }

.config-box {
  background: #0B1220; color: #93C5FD; font-family: var(--mono); font-size: 12px;
  padding: 14px 16px; border-radius: 8px; white-space: pre-wrap; word-break: break-all;
}

@media print {
  body * { visibility: hidden; }
  .print-label, .print-label * { visibility: visible; }
  .print-label { position: fixed; top: 40px; left: 0; right: 0; margin: 0 auto; }
}

/* Menue-Knopf nur auf dem Handy */
.menu-toggle { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; position: static; height: auto; flex-direction: column; overflow: visible; }
  body.menu-open .sidebar { display: flex; }
  .menu-toggle { display: block; position: sticky; top: 0; z-index: 20; width: 100%; padding: 12px 16px; border: 0; border-bottom: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
}
a.btn { text-decoration: none; display: inline-block; }
a.btn.primary:hover { color: #fff; }

/* ---- Geraetedetail v1.0.0.5: Kennzahlen, Reiter, Tabellen ---- */
.sub-line { font-size: 12.5px; color: var(--ink-faint); margin-top: 2px; font-family: var(--mono); }
.kpi-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.kpi .k { font-size: 10.5px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em; }
.kpi .v { font-size: 15px; font-weight: 700; margin-top: 3px; }
.kpi.ok .v { color: var(--ok); } .kpi.warn .v { color: var(--warn); } .kpi.crit .v { color: var(--crit); }
.detail-tabs { margin-bottom: 16px; flex-wrap: wrap; }
.tab-pane[hidden] { display: none; }
.table-wrap { overflow-x: auto; }
.table-wrap table { min-width: 100%; }
td.wrap { white-space: normal; max-width: 520px; }
.meter { display: inline-block; width: 110px; height: 8px; background: var(--meter-track); border-radius: 4px; vertical-align: middle; overflow: hidden; }
.meter-fill { height: 100%; border-radius: 4px; }
.meter-fill.ok { background: var(--ok); } .meter-fill.warn { background: var(--warn); } .meter-fill.crit { background: var(--crit); }
.meter-label { margin-left: 8px; font-size: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h3 { margin: 0; }
.filters { display: flex; gap: 8px; }
.filter-input { padding: 6px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 12.5px; }
.card h3 .sub { font-weight: 400; color: var(--ink-faint); font-size: 12px; margin-left: 8px; }
td.nowrap { white-space: nowrap; }

/* ---- Dokumentation / Wissensdatenbank v1.0.0.5 ---- */
.kb-layout { display: grid; grid-template-columns: 240px 1fr; gap: 20px; align-items: start; }
.kb-sidebar { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; position: sticky; top: 16px; }
.kb-search input { width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 12.5px; margin-bottom: 10px; box-sizing: border-box; }
.kb-tree { max-height: 55vh; overflow-y: auto; }
.kb-folder-row { padding: 6px 8px; border-radius: 6px; font-size: 13px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.kb-folder-row:hover { background: var(--paper); }
.kb-folder-row.active { background: var(--brand-light); color: var(--brand-dark); font-weight: 600; }
.kb-folder-del { color: var(--ink-faint); font-size: 11px; opacity: 0; }
.kb-folder-row:hover .kb-folder-del { opacity: 1; }
.kb-folder-del:hover { color: var(--crit); }
.kb-main-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.kb-main-head h2 { margin: 0; }
.kb-row { cursor: pointer; }
.kb-row:hover td { background: var(--paper); }
.kb-preview { font-size: 11.5px; color: var(--ink-faint); margin-top: 2px; font-weight: 400; }
.kb-content { line-height: 1.65; font-size: 13.5px; }
.kb-content h3, .kb-content h4, .kb-content h5, .kb-content h6 { margin: 18px 0 8px; }
.kb-content h3:first-child { margin-top: 0; }
.kb-content pre { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; overflow-x: auto; font-family: var(--mono); font-size: 12.5px; }
.kb-content code { background: var(--paper); padding: 1px 5px; border-radius: 4px; font-family: var(--mono); font-size: 12px; }
.kb-content ul { padding-left: 20px; }
.kb-version-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); gap: 12px; }
.kb-version-row:last-child { border-bottom: none; }
@media (max-width: 860px) {
  .kb-layout { grid-template-columns: 1fr; }
  .kb-sidebar { position: static; }
}

/* ---- Superadmin-Modus (Mandant betreten) v1.0.0.5 ---- */
.sa-banner { display:flex; align-items:center; gap:14px; flex-wrap:wrap; background:#0F172A; color:#E2E8F0; padding:9px 18px; border-radius:10px; margin:0 0 18px; font-size:13px; }
.sa-banner .sa-badge { background:#F59E0B; color:#0F172A; font-weight:700; padding:3px 9px; border-radius:6px; font-size:12px; }
.sa-banner .sa-switch { display:flex; align-items:center; gap:6px; margin-left:auto; }
.sa-banner select { padding:4px 8px; border-radius:6px; border:1px solid #334155; background:#1E293B; color:#F8FAFC; }
.sa-banner .btn { background:#1E293B; color:#F8FAFC; border-color:#334155; }
.sa-banner .btn:hover { background:#334155; }

.kb-section-title { font-size:10.5px; text-transform:uppercase; letter-spacing:.06em; color:var(--ink-faint); margin:14px 0 4px 8px; }
.kb-count { float:right; font-size:11px; color:var(--ink-faint); }
.kb-hint { font-size:12.5px; color:var(--ink-faint); margin:-6px 0 14px; }
.kb-content table { width:100%; border-collapse:collapse; font-size:12.5px; margin:6px 0 10px; }
.kb-content th, .kb-content td { border-bottom:1px solid var(--line); padding:5px 8px; text-align:left; vertical-align:top; }
.kb-content th { font-size:11px; text-transform:uppercase; letter-spacing:.04em; color:var(--ink-faint); }
.kb-main-head h2 .sub { font-size:12px; font-weight:400; color:var(--ink-faint); margin-left:6px; }

/* Geräte-Typen (v1.0.0.5+) */
.badge.firewall { background: #FEF2F2; color: #B91C1C; }
.badge.router { background: #EFF6FF; color: #1D4ED8; }
.badge.switch { background: #EEF2FF; color: #4338CA; }
.badge.accesspoint { background: #ECFEFF; color: #0E7490; }
.badge.drucker { background: #FFF7ED; color: #C2410C; }
.badge.nas { background: #F5F3FF; color: #6D28D9; }
.badge.usv { background: #FEFCE8; color: #A16207; }
.badge.kamera { background: #FDF4FF; color: #A21CAF; }
.badge.telefon { background: #F0FDFA; color: #0F766E; }

/* ---------- Darkmode: Badge-/Status-/Hinweisfarben ----------
   Die pastellfarbenen Hell-Varianten (helles Pastell + dunkler Text) werden im
   Darkmode auf transparente, dunkle Varianten mit hellerem Text umgestellt -
   sonst waeren sie auf dunklem Hintergrund kaum lesbar bzw. wirkten zu grell. */
:root[data-theme="dark"] .badge.kritisch { background: rgba(248,113,113,.15); color: #F87171; }
:root[data-theme="dark"] .badge.wichtig { background: rgba(251,191,36,.15); color: #FBBF24; }
:root[data-theme="dark"] .badge.normal { background: #1E293B; color: var(--ink-soft); }
:root[data-theme="dark"] .badge.server { background: rgba(96,165,250,.15); color: #93C5FD; }
:root[data-theme="dark"] .badge.client { background: rgba(74,222,128,.15); color: #4ADE80; }
:root[data-theme="dark"] .badge.sonstige { background: #1E293B; color: #CBD5E1; }
:root[data-theme="dark"] .badge.firewall { background: rgba(248,113,113,.15); color: #F87171; }
:root[data-theme="dark"] .badge.router { background: rgba(96,165,250,.15); color: #93C5FD; }
:root[data-theme="dark"] .badge.switch { background: rgba(129,140,248,.18); color: #A5B4FC; }
:root[data-theme="dark"] .badge.accesspoint { background: rgba(34,211,238,.15); color: #67E8F9; }
:root[data-theme="dark"] .badge.drucker { background: rgba(251,146,60,.18); color: #FDBA74; }
:root[data-theme="dark"] .badge.nas { background: rgba(167,139,250,.18); color: #C4B5FD; }
:root[data-theme="dark"] .badge.usv { background: rgba(250,204,21,.15); color: #FDE047; }
:root[data-theme="dark"] .badge.kamera { background: rgba(232,121,249,.15); color: #F0ABFC; }
:root[data-theme="dark"] .badge.telefon { background: rgba(45,212,191,.15); color: #5EEAD4; }

:root[data-theme="dark"] .alert-row.kritisch { border-color: rgba(248,113,113,.35); background: rgba(248,113,113,.08); }
:root[data-theme="dark"] .alert-row.wichtig { border-color: rgba(251,191,36,.35); background: rgba(251,191,36,.08); }

:root[data-theme="dark"] .kb-folder-row.active { background: rgba(96,165,250,.18); color: #93C5FD; }
:root[data-theme="dark"] .kb-content pre, :root[data-theme="dark"] .kb-content code { border-color: var(--line); }

:root[data-theme="dark"] input, :root[data-theme="dark"] select, :root[data-theme="dark"] textarea {
  background: var(--paper); color: var(--ink); border-color: var(--line);
}
:root[data-theme="dark"] .btn { background: var(--card); color: var(--ink); border-color: var(--line); }
:root[data-theme="dark"] .tabs { background: var(--paper); }
:root[data-theme="dark"] .tab.active { background: var(--card); color: var(--ink); }

/* ---------- Theme-Umschalter (Sidebar) ---------- */
.theme-switcher { margin: 0 0 12px; }
.theme-switcher label { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: #64748B; margin-bottom: 4px; }
.theme-switcher select { width: 100%; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--sidebar-line); background: #131E33; color: #E2E8F0; font-size: 12.5px; }

/* Formulare direkt in Karten (Einstellungen, Branding) wie im Dialog darstellen */
.card .row { margin-bottom: 12px; }
.card .row label { display: block; font-size: 12px; color: var(--ink-soft); margin-bottom: 4px; }
.card .row input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]), .card .row select, .card .row textarea {
  width: 100%; box-sizing: border-box; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 13.5px;
}
.card .row textarea { min-height: 70px; }
.card .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
@media (max-width: 760px) { .card .grid2 { grid-template-columns: 1fr; } }

/* ---- Ribbon (PC) und Leiste unten (Handy), v1.0.0.105 ---- */
.has-ribbon { grid-template-columns: 1fr !important; grid-template-rows: auto auto 1fr; }
.has-ribbon .sidebar { position: static; height: auto; flex-direction: row; align-items: center; gap: 20px; padding: 8px 20px; overflow: visible; display: flex; }
.has-ribbon .sidebar .brand { padding: 0; margin: 0; border: 0; display: flex; align-items: center; gap: 12px; }
.has-ribbon .sidebar .brand .sidebar-logo { margin: 0; }
.has-ribbon .sidebar nav { display: none; }
.has-ribbon .sidebar-footer { margin: 0 0 0 auto; padding: 0; border: 0; display: flex; align-items: center; gap: 16px; }
.has-ribbon .sidebar-footer .user { padding: 0; }
.has-ribbon .theme-switcher { margin: 0; }
.has-ribbon .theme-switcher label, .has-ribbon .powered-by { display: none; }
.has-ribbon .logout-link { padding: 6px 8px; width: auto !important; }
.ribbon { background: var(--card); border-bottom: 1px solid var(--line); }
.rb-tabs { display: flex; gap: 2px; padding: 6px 20px 0; background: var(--paper); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.rb-tab { border: 0; background: none; padding: 8px 16px; font: inherit; color: var(--ink); cursor: pointer; border-radius: 8px 8px 0 0; }
.rb-tab:hover { background: var(--brand-light); }
.rb-tab.on { background: var(--card); font-weight: 700; color: var(--brand); }
.rb-bar { display: flex; gap: 4px; padding: 10px 20px; min-height: 84px; flex-wrap: wrap; }
.rb-btn { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 96px; padding: 8px 4px; border: 1px solid transparent; border-radius: 8px; background: none; font: inherit; font-size: 12px; color: var(--ink); cursor: pointer; text-align: center; }
.rb-btn i { font-style: normal; font-size: 22px; }
.rb-btn:hover { background: var(--brand-light); }
.rb-btn.act { background: var(--brand-light); border-color: var(--brand); color: var(--brand-dark); font-weight: 600; }
.rb-btn .count { position: absolute; top: 4px; right: 12px; background: var(--crit); color: #fff; border-radius: 9px; font-size: 10px; padding: 0 6px; }
.botnav, .sheet { display: none; }
/* Handy/Tablet: per Media-Query ODER per Erkennung des Geraets (body.is-mobile, gesetzt in der Seitenvorlage) */
@media (max-width: 900px) {
  body:not(.x) .has-ribbon .sidebar, body:not(.x) .ribbon { display: none; }
}
body.is-mobile .has-ribbon .sidebar, body.is-mobile .ribbon { display: none; }
body.is-mobile .has-ribbon { grid-template-rows: 1fr; }
body.is-mobile .main { padding: 16px 14px 84px; }
body.is-mobile .botnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--line); }
body.is-mobile .botnav button { position: relative; flex: 1; border: 0; background: none; padding: 8px 2px 10px; font: inherit; font-size: 11px; color: var(--ink-faint); display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
body.is-mobile .botnav button i { font-style: normal; font-size: 20px; }
body.is-mobile .botnav button.on { color: var(--brand); font-weight: 700; }
body.is-mobile .botnav .count { position: absolute; top: 2px; right: 22%; background: var(--crit); color: #fff; border-radius: 9px; font-size: 10px; padding: 0 5px; }
body.is-mobile .sheet.show { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; position: fixed; left: 0; right: 0; bottom: 58px; z-index: 29; background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -6px 18px rgba(0,0,0,.25); padding: 10px; max-height: 70vh; overflow: auto; }
body.is-mobile .sheet button { border: 1px solid var(--line); border-radius: 8px; background: var(--paper); padding: 12px 8px; font: inherit; font-size: 13px; color: var(--ink); text-align: left; cursor: pointer; }
@media (max-width: 900px) {
  .has-ribbon { grid-template-rows: 1fr; }
  .main { padding: 16px 14px 84px; }
  .botnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--line); }
  .botnav button { position: relative; flex: 1; border: 0; background: none; padding: 8px 2px 10px; font: inherit; font-size: 11px; color: var(--ink-faint); display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
  .botnav button i { font-style: normal; font-size: 20px; }
  .botnav button.on { color: var(--brand); font-weight: 700; }
  .botnav .count { position: absolute; top: 2px; right: 22%; background: var(--crit); color: #fff; border-radius: 9px; font-size: 10px; padding: 0 5px; }
  .sheet.show { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; position: fixed; left: 0; right: 0; bottom: 58px; z-index: 29; background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -6px 18px rgba(0,0,0,.25); padding: 10px; max-height: 70vh; overflow: auto; }
  .sheet button { border: 1px solid var(--line); border-radius: 8px; background: var(--paper); padding: 12px 8px; font: inherit; font-size: 13px; color: var(--ink); text-align: left; cursor: pointer; }
}

/* ---- sichtbare Knoepfe, v1.0.0.109 ---- */
.rb-btn i, .botnav button i, .sheet button i { display: inline-flex; font-style: normal; }
.rb-btn svg, .botnav svg, .sheet svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rb-btn { background: var(--paper); border: 1px solid var(--line); box-shadow: 0 1px 0 rgba(0,0,0,.12); margin-right: 4px; }
.rb-btn:hover { border-color: var(--brand); }
.rb-btn.act { background: var(--brand); border-color: var(--brand); color: #fff; }
.rb-btn .count { top: -6px; right: -6px; }
body .botnav, body.is-mobile .botnav { gap: 6px; padding: 8px 8px calc(10px + env(safe-area-inset-bottom)); background: var(--paper); border-top: 1px solid var(--line); }
body .botnav button, body.is-mobile .botnav button { flex: 1; min-width: 0; padding: 9px 0 7px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 2px 0 rgba(0,0,0,.25); color: var(--ink); font-size: 10.5px; gap: 3px; }
body .botnav button.on, body.is-mobile .botnav button.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
body .botnav .count, body.is-mobile .botnav .count { top: -6px; right: 4px; }
body .sheet button, body.is-mobile .sheet button { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 2px 0 rgba(0,0,0,.2); color: var(--ink); }
body .sheet.show, body.is-mobile .sheet.show { bottom: 74px; background: var(--paper); }

/* ---- Geraeteliste: Karten am Handy, Tabelle am PC, v1.0.0.111 ---- */
.dev-cards { display: none; }
.dev-card { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 12px; margin-bottom: 10px; cursor: pointer; box-shadow: 0 2px 0 rgba(0,0,0,.12); }
.dev-card:active { border-color: var(--brand); }
.dev-card .dn { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-card .dm { grid-column: 1 / 3; color: var(--ink-faint); font-size: 12.5px; line-height: 1.5; word-break: break-word; }
.dev-card .dm b { color: var(--ink); font-weight: 500; }
.dchip { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 9px; }
.dchip.on { background: rgba(52,211,153,.18); color: var(--ok); }
.dchip.off { background: rgba(248,113,113,.2); color: var(--crit); }
.dchip.un { background: rgba(148,163,184,.2); color: var(--ink-faint); }
body.is-mobile .dev-table { display: none; }
body.is-mobile .dev-cards { display: block; }
body.is-mobile .toolbar .filters { flex-direction: column; align-items: stretch; width: 100%; gap: 8px; }
body.is-mobile .toolbar .filters input, body.is-mobile .toolbar .filters select { min-width: 0 !important; margin-left: 0 !important; width: 100%; padding: 11px 12px; font-size: 14px; }
body.is-mobile .toolbar .filters label { display: none; }
body.is-mobile .page-header > div:last-child { display: flex; gap: 8px; width: 100%; }
body.is-mobile .page-header > div:last-child .btn { flex: 1; margin-left: 0 !important; padding: 11px; }
@media (max-width: 900px) {
  .dev-table { display: none; }
  .dev-cards { display: block; }
}

/* ---- Handy-Politur fuer alle Ansichten, v1.0.0.113 ---- */
body.is-mobile .page-header { flex-direction: column; align-items: stretch; gap: 12px; }
body.is-mobile .page-header > div:last-child { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
body.is-mobile .page-header > div:last-child .btn { flex: 1 1 calc(50% - 8px); min-width: 0; margin-left: 0 !important; padding: 11px 8px; white-space: normal; text-align: center; font-size: 13px; line-height: 1.25; }
body.is-mobile .sub-line { font-size: 12px; overflow-wrap: anywhere; }
body.is-mobile .detail-tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding: 0 0 8px; background: none; border-radius: 0; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
body.is-mobile .detail-tabs::-webkit-scrollbar { display: none; }
body.is-mobile .detail-tabs .tab { flex: none; white-space: nowrap; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); }
body.is-mobile .detail-tabs .tab.active { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: none; }
body.is-mobile .tabs:not(.detail-tabs) { flex-wrap: wrap; }
body.is-mobile .card { padding: 14px; overflow-x: auto; }
body.is-mobile .card table { display: block; overflow-x: auto; max-width: 100%; }
body.is-mobile .in-grid, body.is-mobile .detail-grid, body.is-mobile .grid2, body.is-mobile .kb-layout { grid-template-columns: 1fr; }
body.is-mobile .modal { width: calc(100vw - 20px); max-width: none; max-height: 92vh; overflow-y: auto; }
body.is-mobile input, body.is-mobile select, body.is-mobile textarea { font-size: 16px; }
body.is-mobile .kpi-strip { grid-template-columns: repeat(2, 1fr); }
body.is-mobile h2 { font-size: 20px; }

/* ---- Mandanten-Banner am Handy, v1.0.0.114 ---- */
body.is-mobile .sa-banner { display: grid; grid-template-columns: 1fr; gap: 10px; padding: 12px 14px; margin: 0 0 14px; font-size: 13px; }
body.is-mobile .sa-banner .sa-badge { justify-self: start; }
body.is-mobile .sa-banner > span:not(.sa-badge) { color: #94A3B8; line-height: 1.4; }
body.is-mobile .sa-banner .sa-switch { margin-left: 0; display: grid; grid-template-columns: 1fr; gap: 4px; font-size: 12px; color: #94A3B8; }
body.is-mobile .sa-banner select { width: 100%; padding: 10px; font-size: 16px; }
body.is-mobile .sa-banner .btn { display: block; text-align: center; padding: 11px; }

/* ---- Mandanten als Karten am Handy, v1.0.0.115 ---- */
.ten-card { border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 12px; margin-bottom: 12px; }
.ten-card .th { display: flex; align-items: center; gap: 10px; }
.ten-card .th img { height: 28px; max-width: 64px; object-fit: contain; }
.ten-card .sw { width: 14px; height: 14px; border-radius: 4px; flex: none; border: 1px solid var(--line); }
.ten-card .tn { font-weight: 700; font-size: 16px; min-width: 0; overflow-wrap: anywhere; }
.ten-card .ts { display: flex; gap: 8px; margin: 10px 0; }
.ten-card .ts span { flex: 1; background: var(--paper); border-radius: 8px; padding: 8px; text-align: center; color: var(--ink-faint); font-size: 12px; }
.ten-card .ts b { display: block; color: var(--ink); font-size: 16px; }
.ten-card .tl { display: block; font-size: 11.5px; color: var(--ink-faint); word-break: break-all; margin-bottom: 10px; text-decoration: none; }
.ten-card .ta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ten-card .ta .btn { margin: 0; padding: 11px 8px; text-align: center; }
.ten-card .ta .to { grid-column: 1 / 3; }

/* Tabelle ausblenden, wo es Karten gibt (muss staerker sein als ".card table" am Handy), v1.0.0.116 */
body.is-mobile .card table.dev-table, body.is-mobile table.dev-table { display: none !important; }
body.is-mobile .dev-cards { display: block !important; }
@media (max-width: 900px) {
  .card table.dev-table, table.dev-table { display: none !important; }
  .dev-cards { display: block !important; }
}

/* ---- Tabellen als Karten am Handy (alle uebrigen Listen), v1.0.0.117 ---- */
body.is-mobile table.nm-cards { display: block !important; overflow: visible; max-width: 100%; }
body.is-mobile .card table.nm-cards { overflow: visible; }
body.is-mobile table.nm-cards thead { display: none; }
body.is-mobile table.nm-cards tbody { display: block; }
body.is-mobile table.nm-cards tr { display: block; border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 8px 12px; margin-bottom: 10px; box-shadow: 0 2px 0 rgba(0,0,0,.1); }
body.is-mobile table.nm-cards tr.clickable:active { border-color: var(--brand); }
body.is-mobile table.nm-cards td { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 5px 0; border: 0; text-align: right; white-space: normal; overflow-wrap: anywhere; max-width: none; }
body.is-mobile table.nm-cards td::before { content: attr(data-label); flex: none; max-width: 42%; text-align: left; color: var(--ink-faint); font-size: 12px; }
body.is-mobile table.nm-cards td[data-label=""] { justify-content: flex-start; text-align: left; }
body.is-mobile table.nm-cards td[data-label=""]::before { display: none; }
body.is-mobile table.nm-cards td:empty { display: none; }
body.is-mobile table.nm-cards td[colspan] { display: block; text-align: left; }

/* ---- Reiterleiste als Kapseln (1.0.0.129) ---- */
.ribbon { background: var(--paper); }
.rb-tabs { display: flex; width: fit-content; max-width: calc(100% - 40px); margin: 12px 20px 0; padding: 3px; gap: 2px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; }
.rb-tab { padding: 6px 18px; border-radius: 999px; color: var(--ink-soft); }
.rb-tab:hover { background: var(--row-hover); color: var(--ink); }
.rb-tab.on { background: var(--brand); color: #fff; font-weight: 600; }
.rb-bar { gap: 8px; padding: 12px 20px 14px; min-height: 0; }
.rb-btn { flex-direction: row; width: auto; gap: 8px; padding: 7px 15px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); box-shadow: none; margin-right: 0; font-size: 13px; color: var(--ink-soft); }
.rb-btn svg { width: 17px; height: 17px; }
.rb-btn:hover { border-color: var(--brand); color: var(--ink); background: var(--card); }
.rb-btn.act { background: rgba(96,165,250,.16); border-color: #60A5FA; color: #60A5FA; font-weight: 600; }
:root:not([data-theme="dark"]) .rb-btn.act { background: var(--brand-light); border-color: var(--brand); color: var(--brand-dark); }
.rb-btn .count { top: -5px; right: -4px; }

/* Segment-Schalter (z. B. Zeitraum im Datenbank-Report) */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: transparent; color: var(--ink); padding: 6px 14px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { background: rgba(127,127,127,.12); }
.seg button[aria-pressed="true"], :root[data-theme="dark"] .seg button[aria-pressed="true"] { background: var(--brand); color: #fff; }
.seg button:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
/* Primär-Buttons waren im dunklen Design nicht von normalen zu unterscheiden */
:root[data-theme="dark"] .btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
:root[data-theme="dark"] .btn.primary:hover { background: var(--brand-dark); }

/* ---------- Dashboard (Startseite) ---------- */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 16px; align-items: start; }
.dash-card h3 { font-size: 16px; }
.dash-bar { display: flex; height: 22px; border-radius: 5px; overflow: hidden; margin: 8px 0; }
.dash-bar a { display: block; }
.dash-bar a:hover { filter: brightness(1.15); }
.dash-leg { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; }
.dash-leg a { color: var(--ink-soft); text-decoration: none; }
.dash-leg i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }
.dash-sec { font-weight: 600; font-size: 13px; margin: 12px 0 4px; }
.dash-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 6px; border-bottom: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.dash-row:hover, .dash-row:focus-visible { background: var(--row-hover); outline: none; }
.dash-row.zero { cursor: default; color: var(--ink-faint); }
.dash-row.zero:hover { background: none; }
.dash-row b { min-width: 34px; text-align: right; }
.dash-row.zero b { font-weight: 400; }
.dash-ic { display: inline-block; width: 22px; text-align: center; margin-right: 6px; }
.dash-org { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; border-left: 4px solid #22a06b; background: var(--row-hover); margin-bottom: 8px; border-radius: 0 8px 8px 0; cursor: pointer; }
.dash-org.y { border-color: #e8b400; } .dash-org.r { border-color: #e5484d; } .dash-org.cur { outline: 2px solid var(--brand); }
.dash-org small { display: block; color: var(--ink-faint); font-size: 12px; }
.dash-chips { display: flex; gap: 14px; font-weight: 600; color: var(--ink-faint); }
.dash-chips .r { color: #e5484d; } .dash-chips .y { color: #e8b400; }
.dash-ev { padding: 8px 4px; border-bottom: 1px solid var(--line); }
.dash-ev b { display: block; font-size: 13.5px; } .dash-ev span { color: var(--ink-faint); font-size: 12px; }
.dash-ev.lnk { cursor: pointer; border-radius: 6px; } .dash-ev.lnk:hover { background: var(--row-hover); }
.dash-filter { display: flex; align-items: center; gap: 12px; background: var(--row-hover); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; }

.page-header .sub a { color: #6ea8ff; text-decoration: none; }
.page-header .sub a:hover { text-decoration: underline; }
[data-theme="light"] .page-header .sub a { color: #1d4ed8; }

html[data-theme="dark"] { color-scheme: dark; }

.rb-tab.sa-tab { background: #F59E0B; color: #0F172A; font-weight: 700; border-radius: 999px; margin-left: 10px; }
.rb-tab.sa-tab:hover { background: #FBBF24; }
.sheet button.sa-tab { background: #F59E0B; color: #0F172A; font-weight: 700; border-radius: 10px; grid-column: 1 / -1; }

/* Übergeordnete Geräte / Gerätebaum */
.dt-cols{display:grid;grid-template-columns:1fr 1fr;gap:18px}
@media(max-width:760px){.dt-cols{grid-template-columns:1fr}}
.dt-h{font-weight:600;font-size:13px;margin-bottom:6px;display:flex;align-items:center;gap:8px}
.dt-h .btn{margin-left:auto}
.dt-li{display:flex;align-items:center;gap:10px;padding:7px 0;border-top:1px solid var(--line);font-size:13.5px}
.dt-li .muted{font-size:12px;margin-left:auto}
.dt-warn{background:rgba(245,158,11,.12);border:1px solid #F59E0B;border-radius:8px;padding:8px 12px;margin-bottom:10px;font-size:13px}
.dt-badge{font-size:11px;padding:2px 8px;border-radius:99px;background:rgba(245,158,11,.16);color:#F59E0B;white-space:nowrap}
.dt-badge.crit{background:rgba(229,72,77,.16);color:#e5484d}
.dt-pick{max-height:320px;overflow:auto;border:1px solid var(--line);border-radius:8px}
.dt-pick-row{display:flex;align-items:center;gap:10px;padding:7px 10px;border-top:1px solid var(--line);cursor:pointer;font-size:13.5px}
.dt-pick-row:first-child{border-top:0}
.dt-pick-row .muted{margin-left:auto;font-size:12px}
.dt-err{color:#e5484d;font-size:12.5px;min-height:16px;margin-top:6px}
.dt-tree{padding:14px 18px}
.dt-row{display:flex;align-items:center;gap:8px;padding:6px 0;font-size:14px;flex-wrap:wrap}
.dt-tg{width:14px;cursor:pointer;color:var(--ink-faint);user-select:none;text-align:center}
.dt-sub{margin-left:20px;padding-left:12px;border-left:1px solid var(--line)}
.dt-loose{margin-top:14px;border-top:1px solid var(--line);padding-top:10px}
.dt-loose summary{cursor:pointer;font-size:13px;color:var(--ink-faint);margin-bottom:4px}

/* Berichts-Designer */
.rd-top{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:12px 14px;margin-bottom:14px}
.rd-logo{font-size:13px;display:flex;gap:6px;align-items:center}
.rd-main{display:grid;grid-template-columns:230px minmax(0,1fr) 310px;gap:14px;align-items:start}
@media(max-width:1100px){.rd-main{grid-template-columns:1fr}}
.rd-pal h3,.rd-props h3{font-size:12.5px;color:var(--ink-faint);margin:0 0 10px;font-weight:600}
.rd-pal-i{padding:8px 10px;border:1px dashed var(--line);border-radius:8px;margin-bottom:6px;cursor:grab;font-size:13px}
.rd-pal-i:hover{border-color:var(--brand);background:rgba(29,78,216,.08)}
.rd-canvas{background:rgba(0,0,0,.18);border-radius:12px;padding:18px}
.rd-page{background:#fff;color:#1E293B;max-width:620px;margin:0 auto;border-radius:4px;padding:16px;min-height:420px}
.rd-lg{display:flex;align-items:center;gap:10px;margin-bottom:12px;min-height:24px}
.rd-lg .muted{color:#94A3B8;font-size:11px;margin-left:auto}
.rd-blk{border:1px solid #D6DEE9;border-radius:8px;padding:9px 12px;margin-bottom:8px;display:flex;align-items:center;gap:10px;background:#F8FAFC;cursor:pointer}
.rd-blk.sel{border-color:#1D4ED8;box-shadow:0 0 0 2px rgba(29,78,216,.2);background:#EEF4FF}
.rd-blk.over{border-top:3px solid #1D4ED8}
.rd-blk small{color:#64748B;margin-left:auto;font-size:12px;text-align:right}
.rd-h{color:#94A3B8;cursor:grab}
.rd-ac{display:flex;gap:2px}.rd-ac button{border:0;background:transparent;color:#64748B;cursor:pointer;padding:2px 6px;border-radius:5px}.rd-ac button:hover{background:#E2E8F0}
.rd-empty{color:#94A3B8;text-align:center;padding:40px 10px;border:1px dashed #CBD5E1;border-radius:8px}
.rd-props .row{margin-bottom:12px}.rd-props .row>label{display:block;color:var(--ink-faint);font-size:12px;margin-bottom:4px}
.rd-chk{display:flex;flex-direction:column;gap:5px}.rd-chk label{display:flex;gap:8px;align-items:center;font-size:13px}
.rd-ord{display:flex;flex-direction:column;gap:4px}
.rd-ord-r{display:flex;align-items:center;gap:8px;font-size:13px}
.rd-ord-r span{flex:1}.rd-ord-r .filter-input{flex:1;min-width:0;padding:4px 8px}
.rd-ord-r button{border:1px solid var(--line);background:transparent;color:var(--ink-faint);border-radius:6px;cursor:pointer;padding:1px 7px}

/* ---- Nexus Signature ---- */
.sig-tabs{margin-bottom:14px;flex-wrap:wrap}
.sig-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:12px}
.sig-k b{display:block;font-size:26px;line-height:1.1}.sig-k span{color:var(--ink-faint);font-size:12.5px}
.sig-steps{list-style:none;margin:0;padding:0}.sig-steps li{display:flex;gap:12px;padding:9px 0;border-top:1px solid var(--line)}.sig-steps li:first-child{border-top:0}
.sig-steps li>span{width:20px;color:var(--ink-faint);font-weight:700}.sig-steps li.ok>span{color:#16a34a}
.sig-err{background:rgba(229,72,77,.1);border:1px solid rgba(229,72,77,.35);color:#b42318;border-radius:8px;padding:8px 10px;margin:6px 0;font-size:12.5px}
.sig-bar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:12px 14px;margin-bottom:14px}
.sig-main{display:grid;grid-template-columns:200px minmax(0,1fr) 320px;gap:14px;align-items:start}
@media(max-width:1100px){.sig-main{grid-template-columns:1fr}}
.sig-pal h3,.sig-props h3{font-size:12.5px;color:var(--ink-faint);margin:0 0 10px;font-weight:600}
.sig-pi{padding:8px 10px;border:1px dashed var(--line);border-radius:8px;margin-bottom:6px;cursor:grab;font-size:13px}
.sig-pi:hover{border-color:var(--brand);background:rgba(29,78,216,.08)}
.sig-canvas{background:rgba(0,0,0,.08);border-radius:12px;padding:16px}
.sig-page{background:#fff;color:#1E293B;border-radius:4px;padding:16px;min-height:300px}
.sig-mail{font-size:12px;margin-bottom:12px;color:#94A3B8}
.sig-sheet{border:1px dashed transparent;border-radius:6px;padding:4px;margin:0}.sig-sheet.sel{border-color:#94A3B8}
.sig-row{border:1px solid #E2E8F0;border-radius:8px;margin-bottom:8px;background:#fff;position:relative}
.sig-row.sel{border-color:#1D4ED8;box-shadow:0 0 0 2px rgba(29,78,216,.18)}
.sig-rh{display:flex;align-items:center;padding:2px 8px;font-size:11px;color:#94A3B8;cursor:pointer;background:#F8FAFC;border-radius:8px 8px 0 0}
.sig-ac{margin-left:auto;display:flex;gap:2px}.sig-ac button{border:0;background:transparent;color:#64748B;cursor:pointer;padding:1px 6px;border-radius:5px}.sig-ac button:hover{background:#E2E8F0}
.sig-cols{display:flex;gap:6px;padding:6px}
.sig-col{min-width:0;border:1px dashed #CBD5E1;border-radius:6px;padding:4px;min-height:44px}.sig-col.sel{border-color:#1D4ED8}.sig-col.over{background:#EEF4FF;border-color:#1D4ED8}
.sig-blk{position:relative;border:1px solid transparent;border-radius:5px;padding:2px 3px;cursor:pointer}.sig-blk:hover{border-color:#CBD5E1}.sig-blk.sel{border-color:#1D4ED8;background:#F5F9FF}
.sig-blk .sig-ac{position:absolute;top:0;right:0;display:none;background:#fff;border-radius:5px;box-shadow:0 1px 4px rgba(0,0,0,.15)}.sig-blk:hover .sig-ac,.sig-blk.sel .sig-ac{display:flex}
.sig-drop,.sig-ph,.sig-empty{color:#94A3B8;text-align:center;font-size:12px;padding:10px;border:1px dashed #CBD5E1;border-radius:6px}
.sig-av{display:flex;align-items:center;justify-content:center;color:#fff;font-weight:700;font-size:22px}
.sig-so{display:inline-flex;width:26px;height:26px;margin-right:5px;border-radius:5px;background:#64748B;color:#fff;align-items:center;justify-content:center;font-size:11px;font-weight:700}
.sig-props .row{margin-bottom:12px}.sig-props .row>label{display:block;color:var(--ink-faint);font-size:12px;margin-bottom:4px}
.sig-tb{display:flex;gap:4px;align-items:center;margin-bottom:6px;flex-wrap:wrap}.sig-tb button{border:1px solid var(--line);background:#fff;border-radius:5px;padding:2px 9px;cursor:pointer}
.sig-ed{min-height:90px;border:1px solid var(--line);border-radius:8px;padding:8px;background:#fff;font-size:13px;line-height:1.4}
.sig-rule{border:1px solid var(--line);border-radius:10px;padding:12px;margin-bottom:10px}
.sig-rh2{display:flex;align-items:center;gap:8px;margin-bottom:10px}
.sig-rg{display:grid;grid-template-columns:1.3fr 1fr 1fr;gap:12px}@media(max-width:900px){.sig-rg{grid-template-columns:1fr}}
.sig-rg label,.sig-fg label{display:block;color:var(--ink-faint);font-size:12px;margin-bottom:4px}
.sig-fg{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:10px}
.sig-t{width:100%;border-collapse:collapse;font-size:13px}.sig-t th{text-align:left;color:var(--ink-faint);font-weight:600;font-size:12px;padding:6px 8px;border-bottom:1px solid var(--line)}.sig-t td{padding:8px;border-bottom:1px solid var(--line);vertical-align:top}
.sig-ol{margin:0 0 8px 18px;padding:0}.sig-ol li{margin-bottom:6px}
.sig-det{border:1px solid var(--line);border-radius:8px;padding:6px 10px;margin:10px 0}.sig-det summary{cursor:pointer;font-size:12.5px;color:var(--ink-faint);font-weight:600}
.sig-ci{display:flex;flex-wrap:wrap;gap:4px;margin-bottom:6px}.sig-ci .sg-cv{flex:1;min-width:90px}
.sig-gal{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:12px;max-height:68vh;overflow:auto}
.sig-gc{border:1px solid var(--line);border-radius:10px;padding:10px}.sig-gf{width:100%;height:170px;border:1px solid var(--line);border-radius:8px;background:#fff}
.sig-sc{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:8px}
.sig-sco{display:flex;gap:8px;border:1px solid var(--line);border-radius:9px;padding:8px 10px;cursor:pointer;font-size:12.5px}.sig-sco.on{border-color:var(--brand);background:rgba(29,78,216,.08)}
.sig-ul{max-height:260px;overflow:auto;border:1px solid var(--line);border-radius:8px;padding:6px 10px}.sig-ul label{display:block;padding:2px 0}
.modal{max-width:min(900px,95vw)}
.sig-sco input,.sig-ul input,.sig-sc input[type=radio]{width:auto;flex:none;margin:0}.sig-ul label{display:flex;align-items:center;gap:8px}.sig-sco{align-items:center}
.sig-grp{display:flex;gap:6px;align-items:flex-start}.sig-grp .sig-blk{flex:1 1 auto;min-width:0}

.sig-simple{display:grid;grid-template-columns:minmax(340px,430px) 1fr;gap:14px;align-items:start}@media(max-width:1000px){.sig-simple{grid-template-columns:1fr}}
.sig-sform .sg-s{border-top:1px solid var(--line);padding-top:12px;margin-top:12px}.sig-sform .sg-s:first-child,.sig-sform .sig-warn+.sg-s{border:0;padding-top:0;margin-top:0}
.sig-sform h3{margin:0 0 8px;font-size:13px;color:var(--ink-faint);font-weight:600}
.sg-r{display:flex;align-items:center;gap:8px;margin:7px 0}.sg-r>label:first-of-type{flex:1;min-width:0}.sg-i{width:22px;text-align:center;flex:none}
.sg-tg{position:relative;width:36px;height:20px;flex:none;display:inline-block}.sg-tg input{opacity:0;width:0;height:0}.sg-tg span{position:absolute;inset:0;background:#475569;border-radius:12px;transition:.15s}.sg-tg span:after{content:"";position:absolute;left:2px;top:2px;width:16px;height:16px;border-radius:50%;background:#fff;transition:.15s}.sg-tg input:checked+span{background:#1d4ed8}.sg-tg input:checked+span:after{transform:translateX(16px)}
.sg-tpl{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}.sg-t{border:1px solid var(--line);border-radius:8px;padding:6px;font-size:12px;text-align:center;cursor:pointer}.sg-t.on{border-color:#3b82f6;box-shadow:0 0 0 1px #3b82f6}
.sg-ti{display:block;height:30px;border-radius:5px;margin-bottom:4px;background:linear-gradient(90deg,#334155 28%,#1e293b 28%)}.sg-ti-klassisch,.sg-ti-banner{background:linear-gradient(#334155 25%,#1e293b 25% 60%,#334155 60% 66%,#1e293b 66%)}.sg-ti-balken{background:linear-gradient(#1d4ed8 40%,#1e293b 40%)}.sg-ti-kompakt{background:linear-gradient(90deg,#334155 33%,#1e293b 33% 34%,#334155 34% 66%,#1e293b 66% 67%,#334155 67%)}.sg-ti-logo{background:linear-gradient(90deg,#1d4ed8 25%,#1e293b 25% 27%,#334155 27%)}
.sg-sw{width:26px;height:26px;border-radius:7px;border:2px solid var(--line);cursor:pointer;padding:0}.sg-sw.on{border-color:#fff;box-shadow:0 0 0 2px #3b82f6}
.sig-warn{background:rgba(245,158,11,.12);border:1px solid rgba(245,158,11,.4);border-radius:8px;padding:8px 10px;margin-bottom:10px;font-size:12.5px}

.sig-cols{gap:0}
.sig-rs{flex:none;width:10px;cursor:col-resize;position:relative}.sig-rs:after{content:"";position:absolute;left:4px;top:4px;bottom:4px;width:2px;border-radius:2px;background:transparent}.sig-rs:hover:after{background:#2f6fed}
.sig-sheet{border:2px dashed #93b4f5;border-radius:8px;padding:16px 8px 16px;position:relative;margin:26px 0 34px}.sig-sheet.sel{border-color:#2f6fed}
.sig-sheet:before,.sig-sheet:after{position:absolute;left:10px;background:#2f6fed;color:#fff;font:600 11px/1 "Segoe UI",Arial;padding:3px 8px}
.sig-sheet:before{content:"▼ Hier beginnt deine Signatur";top:-1px;transform:translateY(-100%);border-radius:6px 6px 0 0}
.sig-sheet:after{content:"▲ Hier endet deine Signatur";bottom:-1px;transform:translateY(100%);border-radius:0 0 6px 6px}
.sig-ft{position:absolute;bottom:100%;left:0;margin-bottom:5px;z-index:30;display:flex;gap:2px;align-items:center;background:#111a2b;color:#fff;border-radius:8px;padding:3px;box-shadow:0 4px 14px rgba(0,0,0,.35);white-space:nowrap;cursor:default}
.sig-ft button,.sig-ft select,.sig-ftc{background:#1b2740;color:#fff;border:0;border-radius:5px;padding:3px 8px;font-size:12.5px;cursor:pointer}
.sig-ft button:hover{background:#2f6fed}.sig-ft .ed{display:none}.sig-blk.editing .sig-ft .ed{display:inline-block}
.sig-ftc{display:inline-flex;align-items:center;gap:3px}.sig-ftc input{width:20px;height:18px;padding:0;border:0;background:none}
.sig-ied{outline:2px solid #2f6fed;outline-offset:2px;border-radius:3px;cursor:text;min-height:1.4em}
.sig-blk.dz-l{box-shadow:inset 5px 0 0 #2f6fed}.sig-blk.dz-r{box-shadow:inset -5px 0 0 #2f6fed}.sig-blk.dz-t{box-shadow:inset 0 5px 0 #2f6fed}.sig-blk.dz-b{box-shadow:inset 0 -5px 0 #2f6fed}
.sig-blk.sel{outline:2px solid #2f6fed;outline-offset:0}

.sig-rb{display:flex;gap:2px;margin-bottom:18px;padding:4px;width:max-content;max-width:100%;overflow-x:auto;background:rgba(127,140,170,.12);border:1px solid var(--line);border-radius:14px}
.sig-rbt{display:flex;align-items:center;gap:8px;padding:9px 17px;border:0;border-radius:10px;background:transparent;color:var(--ink-faint);font-size:13.5px;font-weight:600;cursor:pointer;white-space:nowrap;position:relative;transition:background .15s,color .15s}
.sig-rbt .ic{font-size:15px;line-height:1}
.sig-rbt:hover{color:var(--ink);background:rgba(127,140,170,.16)}
.sig-rbt.active{background:linear-gradient(180deg,#3b82f6,#2563eb);color:#fff;box-shadow:0 4px 14px rgba(37,99,235,.45)}
.sig-rbt .err{width:8px;height:8px;border-radius:50%;background:#ef4444;box-shadow:0 0 0 2px rgba(239,68,68,.3)}
@media(max-width:700px){.sig-rbt{padding:8px 12px;font-size:13px}}
