/* Eigenes, schlichtes Panel für skycast-java: Systemschrift, eine Akzentfarbe, keine externen Ressourcen. */
:root {
  --bg: #f4f3f0;
  --panel: #ffffff;
  --ink: #1d1c1a;
  --muted: #6b6862;
  --line: #e2dfd8;
  --accent: #d9480f;
  --accent-ink: #ffffff;
  --live: #2b8a3e;
  --warn: #b7791f;
  --danger: #c92a2a;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161514; --panel: #201f1d; --ink: #ecebe8; --muted: #9b978f; --line: #34322e;
    --accent: #ff6b2c; --live: #51cf66; --warn: #fcc419; --danger: #ff6b6b; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
h1 { font-size: 20px; margin: 0 0 16px; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 650; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(380px, 100%); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: -0.01em; }
.brand i { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); display: inline-block; }
.login .brand { font-size: 18px; margin-bottom: 20px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 12.5px; color: var(--muted); }
.field small { color: var(--muted); font-size: 12px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg);
}
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.form-text { color: var(--danger); min-height: 1.4em; margin-top: 8px; font-size: 13px; }
.form-text p { margin: 2px 0; }

button { cursor: pointer; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 7px 12px; }
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.primary:hover { filter: brightness(1.05); }
button.danger { color: var(--danger); }
button.icon { padding: 4px 8px; min-width: 32px; }
button:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > h1 { margin: 0; }
.main > .top + div > .row:first-child { margin-bottom: 16px; }
.spacer { flex: 1; }

/* Rahmen */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { border-right: 1px solid var(--line); padding: 16px 12px; background: var(--panel); }
.side .brand { padding: 0 8px 16px; }
.side .version { padding: 16px 8px 0; color: var(--muted); font-size: 12px; }
.side nav a { display: block; padding: 6px 8px; border-radius: var(--radius); text-decoration: none; color: var(--muted); }
.side nav a:hover { color: var(--ink); }
.side nav a.active { background: var(--bg); color: var(--ink); font-weight: 600; }
.side .group { margin: 16px 8px 6px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.main { padding: 20px 28px 40px; min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.usermenu { position: relative; margin-left: auto; }
.menu { position: absolute; right: 0; top: calc(100% + 4px); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 6px 24px rgba(0,0,0,.12); min-width: 200px; z-index: 20; padding: 4px; }
.menu button, .menu a { display: block; width: 100%; text-align: left; border: 0; padding: 7px 10px; background: none;
  border-radius: 4px; text-decoration: none; }
.menu button:hover:not(:disabled), .menu a:hover { background: var(--bg); }
.menu .danger { color: var(--danger); }
.menu .danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.menu button:disabled { opacity: .45; }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); }
  .main { padding: 16px; }
}

/* Kacheln */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile .k { font-size: 12px; color: var(--muted); }
.tile .v { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 2px; }
.tile .s { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 4px; background: var(--line); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }

/* Tabellen */
table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; font-weight: 600; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
th.actions, td.actions { text-align: right; white-space: nowrap; position: relative; }
.table-wrap { overflow-x: auto; }
.status { display: inline-flex; align-items: center; gap: 6px; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status.live::before { background: var(--live); }
.status.prep::before { background: var(--warn); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs a, .tabs button { padding: 8px 12px; text-decoration: none; color: var(--muted); border: 0; border-bottom: 2px solid transparent;
  border-radius: 0; background: none; margin-bottom: -1px; }
.tabs a.active, .tabs button.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

.inline-form { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px;
  display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.inline-form .field { margin: 0; }
.inline-form .form-text { grid-column: 1 / -1; margin: 0; min-height: 0; }
@media (max-width: 760px) { .inline-form { grid-template-columns: 1fr; } }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; color: var(--muted); }

/* Dialoge und Toasts */
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); padding: 20px;
  width: min(440px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog h2 { font-size: 17px; }
dialog .row { justify-content: flex-end; margin-top: 16px; }
dialog.player { width: min(900px, calc(100vw - 32px)); }
dialog.player video { width: 100%; background: #000; border-radius: var(--radius); aspect-ratio: 16 / 9; }
#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: var(--radius); max-width: 380px;
  box-shadow: 0 6px 24px rgba(0,0,0,.2); }
.toast.error { background: var(--danger); color: #fff; }
pre.log { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; overflow: auto;
  max-height: 70vh; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-all; }
dl.kv { display: grid; grid-template-columns: minmax(160px, max-content) 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

button.primary.danger-btn { background: var(--danger); border-color: var(--danger); }
.toast.warn { background: var(--warn); color: #1d1c1a; }
dialog { position: relative; }
.dialog-close { position: absolute; top: 10px; right: 10px; border: 0; background: none; font-size: 20px; line-height: 1;
  padding: 4px 8px; color: var(--muted); }
.dialog-close:hover { color: var(--ink); }
dialog h2 { padding-right: 28px; }
pre.copy { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-all; background: var(--bg);
  padding: 10px; border-radius: var(--radius); }

/* App-Seite */
.toolbar { margin-bottom: 12px; }
.toolbar input[type=search] { width: min(260px, 100%); }
.pager-wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.pager-wrap select { width: auto; padding: 4px 6px; }
.pager-wrap .pager { margin-top: 0; }
td.extradata { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* App-Settings */
.settings { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; align-items: start; }
.group h3 { font-size: 14px; margin: 0 0 12px; font-weight: 650; }
.group[data-group="Advanced Settings"] { grid-column: 1 / -1; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 16px; }
label.check { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.abr-head, .abr-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr 36px; gap: 8px; align-items: center; }
.abr-head { font-size: 12px; color: var(--muted); margin: 4px 0 6px; }
.abr-row { margin-bottom: 6px; }
.abr-row .icon.danger { color: var(--danger); }
#abrAdd { margin-top: 4px; }
.savebar { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 40%); }
[role=tabpanel] > section.group { margin-bottom: 12px; }
/* WebRTC-Statistik: „WebRTC“ in der Zuschauerspalte als Link-Knopf, Dialog mit Kacheln je Client */
button.linklike { border: 0; background: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; }
dialog.stats { width: min(720px, calc(100vw - 32px)); }
dialog.stats .stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }

/* Stufenwahl im Player-Dialog (ABR) */
#video_container { position: relative; }
#playerQuality { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.6); color: #eee; border: 1px solid #555; border-radius: 4px; }
#playerQuality[hidden] { display: none; }
