/* skycast Management Console — eigenes Aussehen (warmes Papier, Tinte, Signalrot). Hell/dunkel über prefers-color-scheme.
   Klassennamen wie .card, .main-panel, .nav-tabs, .swal2-container sind nur Haken für die Selektor-Bindung. */
:root {
  --bg: #f3f1ea;
  --panel: #fffdf8;
  --panel-2: #ebe7dc;
  --side: #17191d;
  --side-ink: #d9d5ca;
  --side-dim: #8b8c8f;
  --ink: #1b1d21;
  --dim: #686a6e;
  --line: #dcd7cb;
  --accent: #e2412f;
  --accent-ink: #fff;
  --ok: #1d8556;
  --warn: #a96d12;
  --danger: #c0392b;
  --focus: #2b6fd6;
  --shadow: 0 1px 0 rgba(0, 0, 0, .04), 0 10px 28px -18px rgba(0, 0, 0, .3);
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101216;
    --panel: #171a1f;
    --panel-2: #1f232a;
    --side: #0b0c0f;
    --ink: #e8e4da;
    --dim: #8f9197;
    --line: #2a2f37;
    --accent: #ff4d3d;
    --ok: #3cc187;
    --warn: #e0a640;
    --danger: #ff6b5c;
    --focus: #6aa3ff;
    --shadow: 0 1px 0 rgba(255, 255, 255, .03), 0 12px 30px -18px rgba(0, 0, 0, .85);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--sans); min-height: 100vh; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 20px; } h2 { font-size: 17px; } h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); margin-bottom: 10px; }
p { margin: 0 0 8px; }
.muted { color: var(--dim); }
.small { font-size: 12px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Knöpfe und Felder */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; border-radius: 8px; padding: 8px 14px;
  font: 600 13px/1 var(--sans); cursor: pointer; background: var(--panel-2); color: var(--ink); text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { background: var(--panel-2); }
.btn.small { padding: 6px 10px; font-size: 12px; }
.btn.block { width: 100%; justify-content: center; padding: 11px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--line);
  background: transparent; color: var(--ink); cursor: pointer; text-decoration: none; }
.icon-btn:hover { background: var(--panel-2); }
.icon-btn.danger { color: var(--danger); }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--dim); margin-bottom: 10px; }
.field > span { font-weight: 600; }
.field small { font-size: 11px; }
.field.narrow { max-width: 220px; }
.field.grow { flex: 1; min-width: 200px; }
input, select, textarea { font: 14px var(--sans); color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  border-radius: 7px; padding: 8px 10px; width: 100%; }
input:focus, select:focus { border-color: var(--focus); outline: none; }
.check { display: flex; gap: 8px; align-items: center; margin: 6px 0; cursor: pointer; }
.check input { width: auto; }
.form-error { color: var(--danger); font-size: 13px; min-height: 1em; }
.form-error:empty { display: none; }
.form-ok { color: var(--accent); font-size: 13px; }
.field-error { color: var(--danger); font-size: 12px; }
.field-error:empty { display: none; }
.warn-ic { color: var(--warn); }
.search { margin-left: auto; max-width: 220px; }
.footer { display: flex; gap: 18px; padding: 10px 26px 18px; margin-top: auto; }
.stack { display: flex; flex-direction: column; gap: 6px; }
.stack.left { text-align: left; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.row { display: flex; gap: 8px; align-items: center; }

/* Symbole (eigene Zeichen, keine Icon-Schrift) */
[class^="ti-"]::before, .ic::before { display: inline-block; font-style: normal; line-height: 1; }
.ti-user::before { content: ""; width: 18px; height: 18px; border-radius: 50%; background:
  radial-gradient(circle at 50% 36%, currentColor 0 4px, transparent 4.5px), radial-gradient(circle at 50% 118%, currentColor 0 8px, transparent 8.5px);
  border: 1.5px solid currentColor; }
.ti-control-play::before { content: "▶"; font-size: 11px; margin-left: 2px; }
.ti-pencil::before { content: "✎"; font-size: 15px; }
.ti-more::before { content: "⋯"; font-size: 18px; }
.ti-close::before { content: "×"; font-size: 18px; }
.ic { width: 18px; display: inline-block; text-align: center; opacity: .8; }
.ic-grid::before { content: "▦"; } .ic-gear::before { content: "⚙"; } .ic-doc::before { content: "☰"; } .ic-app::before { content: "◦"; }

/* Anmeldung */
.auth-wrap { min-height: 100vh; display: grid; place-content: center; padding: 24px; gap: 14px;
  background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%), var(--bg); }
.auth-card { width: min(400px, 92vw); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 26px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 18px; margin: 14px 0 8px; }
.auth-brand { display: flex; gap: 12px; align-items: center; }
.auth-brand b { display: block; font-size: 18px; letter-spacing: .02em; }
.auth-brand span { font-size: 12px; color: var(--dim); }
.auth-foot { text-align: center; color: var(--dim); font-size: 12px; margin: 0; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: var(--side); position: relative; flex: none; }
.logo::after { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(255, 77, 61, .18); }

/* Rahmen */
.shell { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.sidebar { background: var(--side); color: var(--side-ink); padding: 16px 10px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 4px 8px 18px; font-size: 17px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 8px; text-decoration: none; padding: 8px 10px; border-radius: 7px; color: var(--side-ink); }
.nav a:hover { background: rgba(255, 255, 255, .06); }
.nav a.on { background: rgba(255, 255, 255, .1); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav-title { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--side-dim); padding: 14px 10px 4px; }
.nav-group { margin-bottom: 8px; }
.nav-apps a { padding-left: 14px; font-family: var(--mono); font-size: 13px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 26px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; }
.main-panel { padding: 22px 26px 40px; display: flex; flex-direction: column; gap: 18px; }
.user-btn { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 6px 10px; border-radius: 8px; text-decoration: none; }
.user-btn:hover { background: var(--panel-2); }
.user-mail { font-size: 13px; color: var(--dim); }

/* Dropdowns */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu { display: none; position: absolute; top: calc(100% + 4px); left: 0; min-width: 200px; z-index: 20; background: var(--panel);
  border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow); padding: 5px; }
.dropdown-menu.right { left: auto; right: 0; }
.dropdown.open > .dropdown-menu { display: block; }
.dropdown-link { display: block; padding: 8px 10px; border-radius: 6px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.dropdown-link:hover { background: var(--panel-2); }
.dropdown-link.danger { color: var(--danger); }
.dd-head { padding: 6px 10px; font-size: 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }

/* Kacheln und Kästen */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.card-title { font-size: 12px; color: var(--dim); font-weight: 600; }
.card-value { font: 650 24px/1.2 var(--sans); margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.card-sub { font-size: 12px; color: var(--dim); }
.meter { height: 4px; background: var(--panel-2); border-radius: 4px; margin-top: 10px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ok); }
.meter.hot i { background: var(--accent); }
.panel-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.panel-box.error { color: var(--danger); }
.box-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-start; padding: 14px; margin-bottom: 14px;
  border: 1px dashed var(--line); border-radius: 9px; background: var(--panel-2); }
.inline-form .form-actions { display: flex; gap: 8px; padding-top: 22px; }
.inline-form .form-error { flex-basis: 100%; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; color: var(--dim); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.app-cell { font-family: var(--mono); cursor: pointer; }
.app-cell:hover { text-decoration: underline; }
.table td.actions { white-space: nowrap; }
.empty { text-align: center; color: var(--dim); padding: 20px; }

/* App-Seite */
.app-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.app-name { font-family: var(--mono); font-size: 20px; }
.nav-tabs { display: flex; gap: 4px; list-style: none; margin: 0; padding: 3px; background: var(--panel-2); border-radius: 9px; }
.nav-tabs a { display: block; padding: 7px 14px; border-radius: 7px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--dim); }
.nav-tabs a.active { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.streams { border: 1px solid var(--line); border-radius: 9px; }
.streams-head, mat-row { display: grid; grid-template-columns: minmax(200px, 2.2fr) 1.2fr 1fr 1.2fr 104px; gap: 10px; align-items: center; padding: 10px 14px; }
.streams-head { font-size: 12px; color: var(--dim); font-weight: 600; border-bottom: 1px solid var(--line); }
mat-row { border-bottom: 1px solid var(--line); }
mat-row:last-child { border-bottom: 0; }
mat-row:hover { background: color-mix(in srgb, var(--panel-2) 50%, transparent); }
.streams-empty { padding: 22px; text-align: center; }
.sname { font-weight: 600; }
.sid { font-family: var(--mono); font-size: 12px; color: var(--dim); }
.c-viewers { font-variant-numeric: tabular-nums; font-size: 13px; }
.c-actions { display: flex; gap: 6px; justify-content: flex-end; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 99px; font-size: 12px; font-weight: 650; background: var(--panel-2); color: var(--dim); }
.badge.live { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.badge.live::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--dot, currentColor); margin-right: 6px; animation: pulse 1.6s infinite; }
.badge.prep { color: var(--warn); }
.speed { font-family: var(--mono); font-size: 12px; color: var(--dim); }
@keyframes pulse { 50% { opacity: .35; } }
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 12px; }
.pager select { width: auto; padding: 4px 6px; }

/* Settings */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.settings-grid .wide { grid-column: 1 / -1; }
.abr-head, .abr-row { display: grid; grid-template-columns: 1fr 1fr 1fr 36px; gap: 10px; align-items: center; }
.abr-head { font-size: 12px; color: var(--dim); font-weight: 600; margin: 4px 0 6px; }
.abr-row { margin-bottom: 8px; }
.abr-rows + .btn { margin-bottom: 14px; }
.savebar { display: flex; justify-content: flex-end; gap: 10px; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 16px; margin: 12px 0; }
.kv span { display: block; font-size: 12px; color: var(--dim); }
.kv b { font-family: var(--mono); font-weight: 500; }
.log { max-height: 62vh; overflow: auto; background: var(--side); color: #d6d3c9; padding: 14px; border-radius: 8px; font: 12px/1.5 var(--mono); white-space: pre-wrap; word-break: break-all; }

/* Toasts */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--side); color: #f1eee6; padding: 11px 16px; border-radius: 9px; box-shadow: var(--shadow); max-width: 380px;
  border-left: 4px solid var(--focus); animation: slide .18s ease-out; }
.toast.success { border-left-color: var(--ok); } .toast.danger { border-left-color: var(--danger); } .toast.warning { border-left-color: var(--warn); }
@keyframes slide { from { transform: translateY(-6px); opacity: 0; } }

/* Dialog */
.swal2-container { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(10, 11, 14, .55); }
.swal2-modal { position: relative; width: min(440px, 100%); background: var(--panel); border-radius: 14px; padding: 24px; box-shadow: var(--shadow); text-align: center; }
.swal2-modal.wide { width: min(900px, 100%); }
.swal2-title { font-size: 19px; margin: 4px 26px 10px; }
.swal2-content { color: var(--dim); }
.swal2-actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; }
.swal2-actions:empty { display: none; }
.swal2-close { position: absolute; top: 10px; right: 12px; border: 0; background: none; font-size: 24px; line-height: 1; color: var(--dim); cursor: pointer; }
.video-box { position: relative; background: #000; border-radius: 9px; overflow: hidden; aspect-ratio: 16 / 9; }
.video-box video { width: 100%; height: 100%; display: block; background: #000; }
.video-msg { position: absolute; inset: auto 0 0 0; padding: 10px; color: #ddd; background: linear-gradient(transparent, rgba(0, 0, 0, .7)); font-size: 13px; }
.video-msg[hidden] { display: none; }
.video-tech, .play-tech { position: absolute; top: 10px; left: 10px; background: rgba(0, 0, 0, .6); color: #fff; font: 600 11px var(--mono); padding: 3px 7px; border-radius: 5px; }

/* play.html */
.play-page { background: #000; display: grid; place-items: center; height: 100vh; overflow: hidden; }
.play-page video { width: 100vw; height: 100vh; object-fit: contain; }
.play-msg { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); color: #ddd; background: rgba(0, 0, 0, .6); padding: 10px 16px; border-radius: 9px; font-size: 14px; }
.play-msg[hidden] { display: none; }
.play-quality, .video-quality { position: absolute; top: 8px; right: 10px; background: rgba(0, 0, 0, .6); color: #fff; font: 600 12px var(--mono); border: 1px solid rgba(255, 255, 255, .3); border-radius: 5px; padding: 2px 6px; }
.play-quality { position: fixed; }
.play-quality[hidden], .video-quality[hidden] { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .streams-head { display: none; }
  mat-row { grid-template-columns: 1fr 1fr; }
  .c-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .two { grid-template-columns: 1fr; }
}
