/* =====================================================================
   Argos – Oberfläche
   Dunkel zuerst, helles Schema über prefers-color-scheme.
   Keine externen Ressourcen (CSP: style-src 'self').
   ===================================================================== */
:root {
  --side: 256px;
  --bg: #0a0d13;
  --bg-grad: radial-gradient(1200px 600px at 85% -10%, rgba(59, 130, 246, .10), transparent 60%);
  --surface: #11161f;
  --surface-2: #171d28;
  --surface-3: #1e2532;
  --line: rgba(148, 163, 184, .12);
  --line-strong: rgba(148, 163, 184, .22);
  --text: #e7ebf2;
  --text-2: #c3cad6;
  --muted: #8691a3;
  --accent: #3b82f6;
  --accent-2: #2563eb;
  --accent-soft: rgba(59, 130, 246, .14);
  --accent-text: #8fb8ff;
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --bad-soft: rgba(239, 68, 68, .13);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, .5);
  --ring: 0 0 0 3px rgba(59, 130, 246, .35);
  --font: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6fa;
    --bg-grad: radial-gradient(1200px 600px at 85% -10%, rgba(59, 130, 246, .08), transparent 60%);
    --surface: #ffffff;
    --surface-2: #f3f5f9;
    --surface-3: #e9edf3;
    --line: rgba(15, 23, 42, .09);
    --line-strong: rgba(15, 23, 42, .16);
    --text: #0f172a;
    --text-2: #334155;
    --muted: #64748b;
    --accent-soft: rgba(37, 99, 235, .10);
    --accent-text: #1d4ed8;
    --bad-soft: rgba(239, 68, 68, .10);
    --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 6px 20px rgba(15, 23, 42, .06);
    --shadow-lg: 0 24px 64px rgba(15, 23, 42, .18);
    color-scheme: light;
  }
}

/* ---------- Grundlagen ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg-grad), var(--bg); background-attachment: fixed; color: var(--text);
  font: 14.5px/1.5 var(--font); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01";
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; line-height: 1.2; letter-spacing: -.02em; font-weight: 700; margin: 0; }
h2 { font-size: 16px; letter-spacing: -.01em; font-weight: 650; margin: 0; }
h3 { font-size: 12px; margin: 18px 0 6px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
p { margin: 0; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: none; box-shadow: var(--ring); }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico.rec { fill: var(--bad); stroke: none; }

.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
/* Verwaltung: Reiter */
.admin-head { display: grid; gap: 10px; margin-bottom: 18px; }
.admin-head .eyebrow { justify-self: start; }
.tabs { display: flex; flex-direction: row; gap: 4px; overflow-x: auto; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); scrollbar-width: thin; }
.tabs a { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: var(--radius-sm); color: var(--muted); font-size: 13.5px; font-weight: 550; white-space: nowrap; text-decoration: none; }
.tabs a .ico { width: 16px; height: 16px; }
.tabs a:hover { color: var(--text); background: var(--surface-2); }
.tabs a.active { color: var(--accent-text); background: var(--accent-soft); }
details > summary { cursor: pointer; color: var(--muted); margin: 4px 0 10px; }
button.arm:disabled { opacity: .6; cursor: not-allowed; }

/* Zonen-Editor */
.zone-stage { position: relative; border-radius: var(--radius-sm); overflow: hidden; background: #000; min-height: 200px; }
.zone-img { display: block; width: 100%; height: auto; user-select: none; }
.zone-canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.zone-loading { position: absolute; inset: 0; display: grid; place-items: center; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 8px; vertical-align: -1px; }
.swatch.zones { background: rgba(34, 197, 94, .5); border: 1px solid #22c55e; }
.swatch.masks { background: #000; border: 1px solid #ef4444; }
.swatch.rec { background: var(--accent); }
.swatch.ev { background: #f59e0b; }
.seg .ghost.active, .seg .btn.active { background: var(--accent-soft); color: var(--accent-text); }

/* Verlauf: Auswahl, Merken, ungesehen */
.bulk-bar { position: sticky; top: 8px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; margin-bottom: 12px;
  background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius); box-shadow: var(--shadow); }
.event { position: relative; }
.ev-tools { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.ev-tools > * { pointer-events: auto; }
.ev-select { width: 18px; height: 18px; accent-color: var(--accent); }
.ev-star { background: rgba(0, 0, 0, .45); color: #fff; border-radius: 50%; width: 30px; height: 30px; min-height: 30px; }
.ev-star.on .ico { fill: #fbbf24; stroke: #fbbf24; }
.new-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 6px; vertical-align: 1px; }

/* Zeitleiste */
.timeline { position: relative; height: 56px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); cursor: pointer; overflow: hidden; }
.tl-tick { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line); font-size: 10px; color: var(--muted); padding: 2px 3px; pointer-events: none; }
.tl-rec { position: absolute; top: 18px; height: 22px; background: var(--accent); opacity: .75; border-radius: 2px; pointer-events: none; }
.tl-ev { position: absolute; top: 42px; height: 10px; min-width: 3px; background: #f59e0b; border-radius: 2px; pointer-events: none; }
.tl-ev.person { background: #ef4444; }
.tl-cursor { position: absolute; top: 0; bottom: 0; width: 2px !important; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .4); pointer-events: none; }
.tl-video { display: block; width: 100%; max-height: 70vh; background: #000; border-radius: var(--radius); }

/* Speicheranzeige */
.meter { height: 12px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.meter.warn > span { background: #f59e0b; }
.meter.bad > span { background: var(--bad); }
.card-head { padding: 16px 18px 4px; }

/* Hinweis auf neue Version */
.update-banner {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px;
  background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  max-width: calc(100vw - 32px);
}
.update-banner .ico { color: var(--accent); flex: none; }

/* Ereignismanager */
.rule { display: grid; gap: 12px; }
.rule.off { opacity: .6; }
.rule-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.rule-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.flow-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.chip-flow { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 99px; font-size: 13px; border: 1px solid var(--line); background: var(--surface-2); }
.chip-flow.when { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.chip-flow.act { background: rgba(34, 197, 94, .12); color: #4ade80; border-color: transparent; }
@media (prefers-color-scheme: light) { .chip-flow.act { color: #15803d; } }
.switch-btn { background: none; border: 0; box-shadow: none; padding: 4px; min-height: 0; }
.switch-btn:hover { filter: none; }
.switch.ok.on { background: var(--ok, #22c55e); border-color: var(--ok, #22c55e); }
.rule-sec { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.rule-sec h3 { margin: 0; }
.action-row { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.choices.grid2 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
dialog.wide { width: min(760px, calc(100vw - 24px)); max-width: none; }

/* PTZ-Positionen */
.preset-list { display: grid; gap: 6px; }
.preset { display: flex; align-items: center; gap: 4px; }
.preset .preset-go { flex: 1; justify-content: flex-start; }
.preset-save input { flex: 1; min-width: 140px; }
.choices { display: grid; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; text-align: left; white-space: normal;
  background: var(--surface-2); color: inherit; border: 1px solid var(--line); box-shadow: none; font-weight: 400;
}
.choice:hover { background: var(--surface-3); border-color: var(--line-strong); filter: none; }
.choice-ico { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); }
.choice-ico .ico { width: 20px; height: 20px; }
.choice-text { display: grid; gap: 2px; flex: 1; }
.choice-text span { color: var(--muted); font-size: 13px; }
button.choice .choice-arrow { width: 18px; height: 18px; color: var(--muted); }
.row.tight { gap: 8px; flex-wrap: nowrap; }
.row.end { justify-content: flex-end; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.hint { margin-top: 12px; }

/* ---------- App-Rahmen: Seitenleiste ---------- */
#top {
  position: fixed; inset: 0 auto 0 0; width: var(--side); z-index: 20;
  display: flex; flex-direction: column; gap: 4px; padding: 18px 14px 14px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); border-right: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
#top:not([hidden]) ~ main { margin-left: var(--side); }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 14px; }
.side-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 750; font-size: 18px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand img { width: 32px; height: 32px; border-radius: 9px; }
.icon-btn.menu-btn { display: inline-grid; }

/* Eingeklappte Seitenleiste (nur Desktop): nur Symbole, Beschriftung als Tooltip */
@media (min-width: 961px) {
  body.side-collapsed { --side: 76px; }
  #top, #top:not([hidden]) ~ main { transition: width .18s ease, margin-left .18s ease; }
  body.side-collapsed .side-head { flex-direction: column; gap: 10px; padding: 0 0 14px; }
  body.side-collapsed .brand span,
  body.side-collapsed .nav-section,
  body.side-collapsed #nav a span,
  body.side-collapsed .arm-text,
  body.side-collapsed .arm .switch,
  body.side-collapsed .side-actions span,
  body.side-collapsed .userbox-text { display: none; }
  body.side-collapsed #nav a { justify-content: center; padding: 10px 0; }
  body.side-collapsed #nav { gap: 4px; }
  body.side-collapsed button.arm { justify-content: center; padding: 8px 0; }
  body.side-collapsed .side-actions { grid-template-columns: 1fr; }
  body.side-collapsed .userbox { justify-content: center; padding: 10px 0 2px; }
}

#nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-section { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 10px 6px; opacity: .8; }
#nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500; transition: background .15s, color .15s;
}
#nav a .ico { color: var(--muted); transition: color .15s; }
#nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
#nav a.active { background: var(--accent-soft); color: var(--text); }
#nav a.active .ico { color: var(--accent); }

.side-foot { margin-top: auto; padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.side-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.side-actions button { padding: 7px 8px; font-size: 12.5px; justify-content: center; }
.side-actions button .ico { width: 15px; height: 15px; }

/* Scharf/Unscharf-Schalter */
button.arm {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 12px;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: none;
}
button.arm:hover { background: var(--surface-3); filter: none; }
.arm-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--surface-3); color: var(--muted); flex: none; }
.arm-text { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.25; }
.arm-text small { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
button.arm.on { border-color: rgba(239, 68, 68, .45); background: linear-gradient(135deg, rgba(239, 68, 68, .16), rgba(239, 68, 68, .05)); }
button.arm.on .arm-ico { background: var(--bad); color: #fff; box-shadow: 0 0 0 4px rgba(239, 68, 68, .18); }
.switch { position: relative; width: 34px; height: 20px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--line-strong); flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .2s; }
.switch.on { background: var(--bad); border-color: var(--bad); }
.switch.on::after { transform: translateX(14px); }

.userbox { display: flex; align-items: center; gap: 10px; padding: 10px 6px 2px; border-top: 1px solid var(--line); }
.userbox-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.userbox-text strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userbox-text small { color: var(--muted); font-size: 11.5px; }
.avatar {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--accent), #7c3aed); color: #fff; font-weight: 700; font-size: 14px;
}
.avatar.sm { width: 26px; height: 26px; font-size: 12px; }

/* ---------- Inhalt ---------- */
main { padding: 32px clamp(16px, 3vw, 40px) 72px; max-width: 1480px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-title p { margin-top: 4px; font-size: 13.5px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.page-actions select { width: auto; min-width: 160px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.back .ico { width: 16px; height: 16px; }
.back:hover { color: var(--text); text-decoration: none; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow);
}
.card + .card, .card + p + .card, .card + .empty, .empty + p + .card { margin-top: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card > h2:first-child { margin-bottom: 4px; }
.narrow { max-width: 440px; margin: 48px auto; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); }

/* Leerer Zustand */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
  padding: 56px 24px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 50%, transparent);
}
.empty .muted { max-width: 420px; margin-bottom: 8px; }
.empty-ico { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); margin-bottom: 6px; }
.empty-ico .ico { width: 26px; height: 26px; }
.events .empty { grid-column: 1 / -1; }
.events > .card + .card { margin-top: 0; }

/* ---------- Schaltflächen ---------- */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2)); color: #fff; border: 1px solid transparent;
  border-radius: var(--radius-sm); padding: 8px 14px; min-height: 36px; font: inherit; font-weight: 550; cursor: pointer;
  white-space: nowrap; transition: filter .15s, background .15s, border-color .15s, transform .05s;
  box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 1px 2px rgba(0,0,0,.2);
}
button:hover, .btn:hover { filter: brightness(1.08); text-decoration: none; }
button:active, .btn:active { transform: translateY(1px); }
button .ico, .btn .ico { width: 16px; height: 16px; }
button.block, .btn.block { width: 100%; min-height: 42px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
button.ghost, .btn.ghost {
  background: var(--surface-2); color: var(--text); border-color: var(--line); box-shadow: none;
}
button.ghost:hover, .btn.ghost:hover { background: var(--surface-3); border-color: var(--line-strong); filter: none; }
button.ghost.active { background: var(--accent-soft); color: var(--accent-text); border-color: rgba(59, 130, 246, .4); }
button.danger { background: linear-gradient(180deg, #ef4444, #dc2626); }
button.ghost-danger { background: transparent; color: var(--bad); border-color: rgba(239, 68, 68, .35); box-shadow: none; }
button.ghost-danger:hover { background: var(--bad-soft); filter: none; }
button.sm, .btn.sm { min-height: 30px; padding: 5px 10px; font-size: 13px; }
button:disabled { opacity: .45; cursor: default; filter: none; transform: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; min-height: 34px; height: 34px; padding: 0;
  background: transparent; color: var(--text-2); border: 1px solid transparent; box-shadow: none;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); filter: none; }
.icon-btn.text { width: auto; padding: 0 10px; font-size: 13px; }
.star-btn.on .ico { fill: #fbbf24; stroke: #fbbf24; }

/* ---------- Formulare ---------- */
input, select, textarea {
  width: 100%; background: var(--surface-2); color: var(--text); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 8px 11px; min-height: 38px; font: inherit; transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: var(--muted); opacity: .8; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line-strong)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input[readonly] { color: var(--muted); }
select {
  appearance: none; padding-right: 32px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat;
}
input[type=checkbox] { width: 16px; height: 16px; min-height: 0; padding: 0; accent-color: var(--accent); cursor: pointer; }
input[type=range] { padding: 0; min-height: 0; accent-color: var(--accent); background: transparent; border: 0; box-shadow: none; }
label { display: block; font-size: 12.5px; font-weight: 550; color: var(--text-2); margin-bottom: 6px; }
.field { margin-bottom: 14px; }
.fields { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.fields > button, .fields .field > button { width: 100%; }
.check { display: inline-flex; gap: 8px; align-items: center; color: var(--text); font-size: 13.5px; font-weight: 450; margin: 0 14px 6px 0; cursor: pointer; }
.check.pill { margin: 0; padding: 0 12px; min-height: 38px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-2); }
.checks { display: flex; flex-wrap: wrap; gap: 4px 0; padding-top: 2px; }
details summary { cursor: pointer; color: var(--muted); }
details[open] summary { margin-bottom: 10px; }
.form-foot { padding-top: 16px; margin-top: 8px; border-top: 1px solid var(--line); }

/* ---------- Badges & Status ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 550; padding: 2px 9px; border-radius: 99px;
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--line); white-space: nowrap;
}
.badge .dot { width: 7px; height: 7px; box-shadow: none; }
.badge.live, .badge.done { background: rgba(34, 197, 94, .12); color: #4ade80; border-color: rgba(34, 197, 94, .25); }
.badge.error, .badge.failed, .badge.offline { background: var(--bad-soft); color: #f87171; border-color: rgba(239, 68, 68, .28); }
.badge.person, .badge.ring, .badge.recording, .badge.connecting { background: rgba(245, 158, 11, .13); color: #fbbf24; border-color: rgba(245, 158, 11, .28); }
.badge.motion { background: var(--accent-soft); color: var(--accent-text); border-color: rgba(59, 130, 246, .28); }
@media (prefers-color-scheme: light) {
  .badge.live, .badge.done { color: #15803d; }
  .badge.error, .badge.failed, .badge.offline { color: #b91c1c; }
  .badge.person, .badge.ring, .badge.recording, .badge.connecting { color: #b45309; }
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: #6b7280; flex: none; }
.dot.live { background: var(--ok); box-shadow: 0 0 0 3px rgba(34, 197, 94, .25); animation: pulse 2s infinite; }
.dot.error { background: var(--bad); }
.dot.connecting { background: var(--warn); }
.dot.standby { background: #94a3b8; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(34, 197, 94, 0); } }
.warnbox { border: 1px solid rgba(245, 158, 11, .3); background: rgba(245, 158, 11, .08); padding: 10px 14px; border-radius: var(--radius-sm); color: var(--text); }
code, .mono { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
code.tag { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--surface-3); word-break: normal; }
code.tag.bad { background: var(--bad-soft); color: #f87171; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; background: var(--surface-2); }
tr:not(:first-child):hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
td.actions { text-align: right; }
td.actions .row { justify-content: flex-end; gap: 6px; }
.strong-link { color: var(--text); font-weight: 600; }
.card:not(.flush) table th { background: transparent; }
.card:not(.flush) table th, .card:not(.flush) table td { padding-left: 6px; padding-right: 6px; }

/* ---------- Kennzahlen (Live) ---------- */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 16px; }
.stat { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.stat strong { display: block; font-size: 20px; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span:not(.stat-ico) { color: var(--muted); font-size: 12.5px; }
.stat-ico { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--surface-3); color: var(--muted); flex: none; }
.stat.ok .stat-ico { background: rgba(34, 197, 94, .14); color: var(--ok); }
.stat.bad .stat-ico { background: var(--bad-soft); color: var(--bad); }
.stat.armed .stat-ico { background: var(--bad); color: #fff; }

.toolbar-card {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px; margin-bottom: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.toolbar-card select { width: auto; }
.pager { gap: 4px; font-variant-numeric: tabular-nums; }

/* ---------- Live-Wand ---------- */
.wall-wrap { border-radius: var(--radius); }
.wall-wrap:fullscreen { background: #000; padding: 8px; }
.wall { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 1fr)); }
.wall.l1 { grid-template-columns: 1fr; }
.wall.l4 { grid-template-columns: repeat(2, 1fr); }
.wall.l9 { grid-template-columns: repeat(3, 1fr); }
.wall.l16 { grid-template-columns: repeat(4, 1fr); }
/* Automatisches Raster: Kacheln nebeneinander, Größe wählbar */
.wall.lauto.size-s { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.wall.lauto.size-m { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.wall.lauto.size-l { grid-template-columns: repeat(auto-fill, minmax(min(100%, 500px), 1fr)); }
.wall.lauto.size-s { gap: 8px; }
.wall.l1 > .tile { max-width: 1280px; margin: 0 auto; width: 100%; }
@media (max-width: 760px) { .wall.l4, .wall.l9, .wall.l16 { grid-template-columns: 1fr; } }
.tile {
  position: relative; aspect-ratio: 16/9; background: #05070a; border-radius: var(--radius); overflow: hidden; cursor: pointer;
  border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s, border-color .15s;
}
.tile:hover { border-color: rgba(59, 130, 246, .5); box-shadow: 0 0 0 1px rgba(59, 130, 246, .3), var(--shadow); }
.tile.over { border-color: var(--accent); box-shadow: var(--ring); }
.tile.dragging { opacity: .4; }
.tile-view { position: absolute; inset: 0; display: grid; place-items: center; color: #94a3b8; background: radial-gradient(circle at 50% 40%, #111827, #05070a); }
.tile-view img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.ov-top, .ov-bottom {
  position: absolute; left: 0; right: 0; display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  color: #fff; font-size: 12.5px; pointer-events: none;
}
.ov-top { top: 0; justify-content: space-between; background: linear-gradient(rgba(0,0,0,.55), transparent); }
.ov-bottom { bottom: 0; justify-content: space-between; background: linear-gradient(transparent, rgba(0,0,0,.6)); }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 8px; border-radius: 99px; min-width: 0;
  background: rgba(10, 13, 19, .55); border: 1px solid rgba(255,255,255,.1); backdrop-filter: blur(8px);
}
.ov-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-meta { opacity: .85; text-shadow: 0 1px 2px #000; }
.clock { font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12px; text-shadow: 0 1px 2px #000; }
.clock.stale { color: #fbbf24; }
.star {
  pointer-events: auto; display: grid; place-items: center; width: 30px; height: 30px; min-height: 30px; padding: 0; border-radius: 50%;
  background: rgba(10, 13, 19, .45); border: 1px solid rgba(255,255,255,.1); color: rgba(255,255,255,.75); box-shadow: none; backdrop-filter: blur(8px);
}
.star .ico { width: 15px; height: 15px; }
.star.on .ico { fill: #fbbf24; stroke: #fbbf24; }
.glass-btn { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); backdrop-filter: blur(8px); box-shadow: none; }
body.kiosk main { max-width: none; padding: 0; margin: 0; }
body.kiosk { background: #000; }
.kiosk-wall { gap: 4px; min-height: 100vh; align-content: center; }
.kiosk-wall .tile { border-radius: 0; border: 0; box-shadow: none; }
.kiosk-fs { position: fixed; right: 12px; bottom: 12px; opacity: .3; }
.kiosk-fs:hover { opacity: 1; }

/* ---------- Kamera-Detail ---------- */
.detail { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
@media (max-width: 1100px) { .detail { grid-template-columns: 1fr; } }
.stage-wrap { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; border: 1px solid var(--line); box-shadow: var(--shadow); }
.stage-wrap:fullscreen { border-radius: 0; display: grid; border: 0; }
.stage { aspect-ratio: 16/9; overflow: hidden; touch-action: none; cursor: zoom-in; display: grid; place-items: center; }
.stage-wrap:fullscreen .stage { aspect-ratio: auto; height: 100vh; }
.stage.zoomed { cursor: grab; }
.stage img { width: 100%; height: 100%; object-fit: contain; transform-origin: center; user-select: none; pointer-events: none; }
.stage-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; align-items: center; gap: 2px; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.seg > span { min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.kv strong { font-weight: 550; text-align: right; }
.stack > .kv + .kv { margin-top: 0; }
.ptz { display: grid; grid-template-columns: repeat(3, 56px); gap: 6px; justify-content: center; }
.ptz-btn { height: 48px; font-size: 18px; touch-action: none; }
.small-events { grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
.event-line { display: block; color: var(--text); padding: 12px 14px; }
.event-line:hover { text-decoration: none; border-color: var(--line-strong); }
pre.code { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; overflow-x: auto; font: 12px/1.55 var(--mono); }
.token-show { display: block; padding: 10px; background: var(--surface); border-radius: 8px; user-select: all; }

/* ---------- Verlauf ---------- */
.events { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); }
.event { cursor: pointer; padding: 0; overflow: hidden; transition: transform .15s, border-color .15s, box-shadow .15s; }
.event:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow-lg); }
.event .thumb { aspect-ratio: 16/9; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); font-size: 12.5px; }
.event .thumb img { width: 100%; height: 100%; object-fit: cover; }
.event .meta { padding: 12px 14px; }
.event .meta .row { flex-wrap: nowrap; }
.event .meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card + .center, .events + .center { margin-top: 18px; }
video { width: 100%; border-radius: var(--radius-sm); background: #000; display: block; }

/* ---------- Dialoge ---------- */
dialog {
  background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: 18px; padding: 0;
  width: min(880px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: var(--shadow-lg);
}
dialog[open] { animation: pop .18s ease-out; }
dialog::backdrop { background: rgba(3, 6, 12, .62); backdrop-filter: blur(4px); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
#modalBody { padding: 22px 24px 24px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -4px -6px 4px 0; }
.modal-head h2 { font-size: 18px; }
dialog.confirm { width: min(420px, calc(100vw - 32px)); }
#confirmBody { padding: 24px; display: flex; flex-direction: column; gap: 10px; }
#confirmBody .row { margin-top: 10px; }
.confirm-ico { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); }
.confirm-ico.danger { background: var(--bad-soft); color: var(--bad); }
.confirm-ico .ico { width: 22px; height: 22px; }
.unlock .confirm-ico { margin-bottom: 4px; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 60; max-width: calc(100vw - 32px);
  display: flex; align-items: center; gap: 10px; padding: 11px 16px 11px 14px; border-radius: 12px;
  background: var(--surface-3); color: var(--text); border: 1px solid var(--line-strong); box-shadow: var(--shadow-lg);
  border-left: 3px solid var(--ok); animation: toast .2s ease-out;
}
#toast.err { border-left-color: var(--bad); }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- Anmeldung / Einrichtung ---------- */
/* ---------- Anmeldung / Einrichtung: bewusst schlicht, verrät nicht, was dahinter läuft ---------- */
.auth { width: 100%; max-width: 400px; margin: 0 auto; padding: 36px 32px 32px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-lg); }
main:has(> .auth) { max-width: none; display: grid; place-items: center; min-height: 100vh; padding-top: 24px; padding-bottom: 24px; }
.auth-card { width: 100%; }
.auth-card h1 { font-size: 20px; text-align: center; }
.auth-card > .muted { text-align: center; }
.auth-card > .eyebrow { align-self: center; justify-self: center; }
.eyebrow { display: inline-block; font-size: 12px; font-weight: 600; color: var(--accent-text); background: var(--accent-soft); padding: 3px 10px; border-radius: 99px; }
.brand-big { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 4px 0 16px; }
.brand-big img { width: 72px; height: 72px; border-radius: 18px; }
.brand-big span { font-weight: 750; font-size: 22px; letter-spacing: -.01em; }
.qr svg { width: 200px; height: 200px; background: #fff; padding: 10px; border-radius: 12px; }
.loader { width: 36px; height: 36px; margin: 30vh auto; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Zeitplan ---------- */
.sched-row { display: grid; grid-template-columns: 1fr 120px 120px auto; gap: 8px; align-items: center; margin-bottom: 8px; padding: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.sched-row .check { margin: 0 10px 0 0; }

/* ---------- Kleine Bildschirme ---------- */
@media (max-width: 960px) {
  #top { position: sticky; inset: auto; top: 0; width: auto; height: auto; padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  #top:not([hidden]) ~ main { margin-left: 0; }
  .side-head { padding: 0; }
  .side-body { display: none; padding-top: 10px; }
  body.menu-open .side-body { display: flex; max-height: calc(100vh - 70px); overflow-y: auto; }
  main { padding-top: 22px; }
}
@media (max-width: 600px) {
  h1 { font-size: 22px; }
  .card { padding: 16px; }
  .sched-row { grid-template-columns: 1fr 1fr; }
  .sched-row > div:first-child { grid-column: 1 / -1; }
  .page-actions { width: 100%; }
  .page-actions > * { flex: 1 1 auto; }
  .page-actions select { width: 100%; min-width: 0; }
  .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat { padding: 10px 12px; gap: 10px; }
  .stat strong { font-size: 17px; }
  .stat-ico { width: 32px; height: 32px; }
  .toolbar-card > .row { width: 100%; }
  .toolbar-card select { flex: 1; }
  #modalBody { padding: 18px; }
  th, td { padding: 10px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
