/* SRT-Gateway · BestPixels */
:root {
  --bg: #0d0f13; --bg2: #11141a; --card: #151920; --inset: #1b2029; --line: #232833; --line2: #2c3240;
  --text: #e8eaed; --muted: #9aa3b2; --muted2: #8a93a3;
  --accent: #ff5500; --accent-text: #ff7a33;
  --ok: #3ddc84; --warn: #f5b300; --bad: #ff6b6b; --idle: #8a93a3;
  --radius: 12px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 Inter, system-ui, -apple-system, 'Segoe UI', sans-serif; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { color: #ff9a63; text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 8px; }
h2 { font-size: 18px; margin: 0 0 8px; }
h3 { font-size: 15px; margin: 0 0 10px; }
.card h2 { font-size: 16px; margin: 0; }
.card h2 a { color: var(--text); }
p { margin: 0 0 12px; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.xsmall { font-size: 11px; }
.hidden { display: none !important; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.min0 { min-width: 0; }
.grow { flex: 1 1 auto; min-width: 0; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); } .idle { color: var(--idle); }
.icon { width: 16px; height: 16px; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Kopf */
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; padding: 12px 24px; background: var(--bg2); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; color: var(--text); }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: var(--bg); font-weight: 700; display: grid; place-items: center; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small { color: var(--muted); font-size: 12px; }
.mainnav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1 1 auto; }
.mainnav a { padding: 8px 12px; border-radius: 8px; color: #b4bcc8; }
.mainnav a:hover { background: var(--inset); text-decoration: none; color: var(--text); }
.mainnav a.active { background: #1f2430; color: #fff; font-weight: 600; }
.sysbar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; font-size: 12px; color: var(--muted); }
.sys-item { display: flex; align-items: center; gap: 6px; }
.warnbar { background: #3a1d10; color: #ffd2bd; border-bottom: 1px solid var(--accent); padding: 10px 24px; font-size: 13px; }

.page { max-width: 1400px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 28px; }
.narrow { max-width: 680px; display: flex; flex-direction: column; gap: 16px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; margin-bottom: -12px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line2); background: transparent; color: var(--text); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none; }
.btn:hover { text-decoration: none; background: var(--inset); color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }
.btn-primary:hover { background: #ff6a1f; color: var(--bg); }
.btn-outline { border-color: var(--accent); color: var(--accent-text); }
.btn-ghost { background: #1f2430; }
.btn-danger { border-color: var(--bad); color: var(--bad); }
.btn-sm { min-height: 34px; padding: 6px 10px; font-size: 12px; }
.btn-xs { min-height: 30px; padding: 4px 9px; font-size: 12px; }
.btn.range.on { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
form.inline, .btn-row form { display: inline; margin: 0; }

/* Flash */
.flash { padding: 12px 16px; border-radius: 10px; border: 1px solid var(--line2); background: var(--card); }
.flash-ok { border-color: #1f6b44; background: #10241a; }
.flash-warn { border-color: #7a5a00; background: #2a2208; }
.flash-error { border-color: #7a2c2c; background: #2a1212; }

/* Übersicht */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-size: 28px; font-weight: 700; }
.stat-value.accent { color: var(--accent-text); }
.stat-sub { font-size: 12px; color: var(--muted); }

.block { display: flex; flex-direction: column; gap: 14px; }
.block-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; }
.block-head h1, .block-head h2 { margin: 0; }
.empty { background: var(--card); border: 1px dashed var(--line2); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--muted); }

/* Karten */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(380px, 100%), 1fr)); gap: 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.card.st-warn { border-color: #6b5200; }
.card.st-bad { border-color: #6b2a2a; }
.card-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; flex: 1; }
.card-title-row { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.card-actions { margin-top: auto; }
.card-actions .btn { flex: 1; }

.thumb { position: relative; aspect-ratio: 16 / 9; background: var(--inset); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-ph { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: #6f7888; font-size: 12px; }
.thumb-ph .icon { width: 34px; height: 34px; }
.bars { position: absolute; inset: 0; display: flex; }
.bars i { flex: 1; }
.bars i:nth-child(1) { background: #c0c0c0; } .bars i:nth-child(2) { background: #c0c000; } .bars i:nth-child(3) { background: #00c0c0; }
.bars i:nth-child(4) { background: #00c000; } .bars i:nth-child(5) { background: #c000c0; } .bars i:nth-child(6) { background: #c00000; } .bars i:nth-child(7) { background: #0000c0; }
.bars::after { content: 'Kein Signal'; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--bg); color: #fff; padding: 8px 14px; border-radius: 8px; font-weight: 600; }
.thumb-age { position: absolute; bottom: 10px; right: 10px; background: rgba(13, 15, 19, .85); padding: 3px 8px; border-radius: 6px; font-size: 11px; color: #c4cad4; }
.thumb-age:empty { display: none; }

.pill { position: absolute; top: 10px; left: 10px; display: inline-flex; align-items: center; gap: 6px; background: rgba(13, 15, 19, .85); padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--idle); }
.pill .dot { background: currentColor; }
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); } .pill.bad { color: var(--bad); }
.pill-static { position: static; font-size: 11px; vertical-align: middle; background: var(--inset); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot-ok { background: var(--ok); } .dot-warn { background: var(--warn); } .dot-bad { background: var(--bad); } .dot-idle { background: var(--idle); }

.health { display: flex; flex-direction: column; align-items: flex-end; flex: none; }
.health-value { font-size: 22px; font-weight: 700; color: var(--idle); }
.health-value.ok { color: var(--ok); } .health-value.warn { color: var(--warn); } .health-value.bad { color: var(--bad); }
.health-lg .health-value { font-size: 44px; line-height: 1; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.metric { background: var(--inset); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.metric span { font-size: 11px; color: var(--muted); }
.metric b { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric b.warn { color: var(--warn); } .metric b.bad { color: var(--bad); }
.spark { width: 100%; height: 40px; display: block; }
.spark polyline { stroke: var(--accent); }
.spark.warn polyline { stroke: var(--warn); }

.outs { display: flex; flex-direction: column; gap: 6px; }
.outs .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.out-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 10px; background: var(--inset); border-radius: 8px; min-height: 44px; }
.out-row a { color: var(--text); }
.out-state { white-space: nowrap; color: var(--idle); }
.out-state.ok { color: var(--ok); } .out-state.warn { color: var(--warn); } .out-state.bad { color: var(--bad); } .out-state.info { color: #c4cad4; }

.chip { font-size: 10px; font-weight: 700; padding: 3px 6px; border-radius: 5px; color: var(--bg); min-width: 34px; text-align: center; flex: none; background: var(--idle); }
.chip-youtube { background: #ff6b6b; } .chip-twitch { background: #b69cff; } .chip-rtmp { background: #6cb8ff; }
.chip-srt { background: #4fd1c5; } .chip-record { background: #f5b300; } .chip-pull { background: #3ddc84; }

/* Routing-Matrix */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.matrix, .table { width: 100%; border-collapse: collapse; }
.matrix { min-width: 760px; }
.matrix th, .matrix td, .table th, .table td { padding: 10px 14px; border-top: 1px solid var(--line); text-align: left; vertical-align: middle; }
.matrix thead th, .table thead th { border-top: 0; color: var(--muted); font-size: 12px; font-weight: 500; }
.matrix th.center, .matrix td.center { text-align: center; }
.matrix td.right { text-align: right; }
.matrix form { margin: 0; }
.out-cell { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.out-cell .min0 { display: flex; flex-direction: column; }
.out-cell a { color: var(--text); }
.cell { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line2); background: var(--inset); display: inline-grid; place-items: center; cursor: pointer; }
.cell span { width: 12px; height: 12px; border-radius: 50%; background: #3a4150; }
.cell:hover { border-color: var(--accent); }
.cell.on { border-color: var(--accent); background: #2a1a10; }
.cell.on span { background: var(--accent); }

/* Detail */
.detail { display: flex; flex-direction: column; gap: 24px; }
.detail-top { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; }
.thumb-lg { border-radius: 14px; border: 1px solid var(--line); }
.facts { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.facts .health { align-items: flex-start; }
.facts dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 16px; margin: 0; }
.facts dt, .kv dt { font-size: 12px; color: var(--muted); }
.facts dd, .kv dd { margin: 0; overflow-wrap: anywhere; }
.facts dd.warn { color: var(--warn); } .facts dd.bad { color: var(--bad); }
.charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 14px; }
.chart { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.chart figcaption { display: flex; justify-content: space-between; align-items: baseline; color: #c4cad4; font-size: 13px; }
.chart figcaption b { font-size: 16px; color: var(--accent-text); font-weight: 500; }
.chart svg { width: 100%; height: 110px; display: block; overflow: visible; }
.chart .grid { stroke: var(--line2); stroke-dasharray: 3 4; }
.chart .line { stroke: var(--accent); fill: none; stroke-width: 1.5; }
.chart .area { fill: rgba(255, 85, 0, .10); stroke: none; }
.chart .lbl { fill: var(--muted2); font-size: 9px; font-family: var(--mono); }
.chart-foot { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted2); }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 16px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.panel h2 { font-size: 16px; }
.steps { margin: 0; padding-left: 20px; color: #c4cad4; display: flex; flex-direction: column; gap: 4px; }
.kv { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.copy { display: flex; gap: 6px; align-items: center; }
.copy input { flex: 1; min-width: 0; }

.events { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.events li { display: flex; gap: 12px; padding: 6px 10px; background: var(--card); border-radius: 8px; }
.ev-error td:nth-child(3), .events li.ev-error span:last-child { color: #ffb3b3; }
.ev-warn td:nth-child(3), .events li.ev-warn span:last-child { color: #ffe08a; }
.lvl { font-size: 11px; padding: 2px 7px; border-radius: 5px; background: var(--inset); }
.lvl-error { color: var(--bad); } .lvl-warn { color: var(--warn); } .lvl-info { color: var(--muted); }

/* Formulare */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #c4cad4; }
input, select { font: inherit; color: var(--text); background: var(--inset); border: 1px solid var(--line2); border-radius: 8px; padding: 10px 12px; min-height: 42px; }
input:focus, select:focus { border-color: var(--accent); outline: none; }
input[readonly] { color: #c4cad4; }
.form label.check { flex-direction: row; align-items: center; gap: 10px; }
.check input { min-height: auto; width: 18px; height: 18px; accent-color: var(--accent); }
.types { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.types legend { font-size: 13px; color: #c4cad4; margin-bottom: 6px; }
.form .type-opt { flex-direction: row; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line2); border-radius: 10px; background: var(--inset); cursor: pointer; color: var(--text); }
.type-opt input { min-height: auto; accent-color: var(--accent); }
.type-opt:has(input:checked) { border-color: var(--accent); background: #2a1a10; }
.danger-zone { border-top: 1px solid var(--line); padding-top: 16px; }

/* Login */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.brand-lg .brand-mark { width: 40px; height: 40px; }

@media (max-width: 900px) {
  .detail-top { grid-template-columns: 1fr; }
  .page { padding: 16px; }
  .topbar { padding: 12px 16px; }
}
@media (max-width: 520px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hide-sm { display: none !important; }
}
