/* Realtime TV – Basis für Nutzer- und Admin-Seiten.
   Leitmotiv: Testbild-Farbbalken als Signatur, Sende-Rot nur für «Live» und Notstopp. */

:root {
  --paper: #eef0f4;
  --surface: #ffffff;
  --surface-2: #f6f7fa;
  --ink: #15172a;
  --ink-2: #50556e;
  --line: #cdd1dc;
  --signal: #d4212b;
  --signal-ink: #ffffff;
  --phosphor: #2b3fd1;
  --phosphor-ink: #ffffff;
  --phosphor-soft: #e3e7ff;
  --gold: #f0b81c;
  --gold-ink: #231a00;
  --ok: #17784a;
  --ok-soft: #dcf2e6;
  --warn: #9a5500;
  --warn-soft: #fbeccf;
  --bad-soft: #fde2e3;

  --f-display: "Avenir Next Condensed", "DIN Condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", sans-serif;
  --f-body: "Avenir Next", "Segoe UI", Roboto, "Helvetica Neue", system-ui, sans-serif;

  --r-panel: 14px;
  --r-ctl: 8px;
  --gap: 16px;
  --bars: linear-gradient(90deg, #c0c0c0 0 14.28%, #c0c000 0 28.57%, #00c0c0 0 42.85%, #00c000 0 57.14%, #c000c0 0 71.42%, #c00000 0 85.71%, #0000c0 0);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #10132a; --surface: #181c38; --surface-2: #1f2446; --ink: #e9ebf5; --ink-2: #a3a8c3; --line: #2f3560;
    --signal: #ff4a52; --signal-ink: #1a0003; --phosphor: #8594ff; --phosphor-ink: #0c0f2c; --phosphor-soft: #262d63;
    --gold: #f5c842; --gold-ink: #231a00; --ok: #57d196; --ok-soft: #173a2c; --warn: #f0b562; --warn-soft: #3b2b12; --bad-soft: #43161c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #10132a; --surface: #181c38; --surface-2: #1f2446; --ink: #e9ebf5; --ink-2: #a3a8c3; --line: #2f3560;
  --signal: #ff4a52; --signal-ink: #1a0003; --phosphor: #8594ff; --phosphor-ink: #0c0f2c; --phosphor-soft: #262d63;
  --gold: #f5c842; --gold-ink: #231a00; --ok: #57d196; --ok-soft: #173a2c; --warn: #f0b562; --warn-soft: #3b2b12; --bad-soft: #43161c;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--paper); color: var(--ink);
  font: 16px/1.55 var(--f-body); font-feature-settings: "tnum" 0;
}
body::before { content: ""; display: block; height: 6px; background: var(--bars); flex: none; }
img, video, svg { max-width: 100%; }
a { color: var(--phosphor); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.num, time, .money { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--surface); padding: 8px 12px; z-index: 50; border-radius: var(--r-ctl); }
.skip:focus { top: 12px; }

h1, h2, h3 { font-family: var(--f-display); font-weight: 700; line-height: 1.08; margin: 0 0 .4em; letter-spacing: -.005em; }
h1 { font-size: clamp(2.1rem, 5.2vw, 3.3rem); }
h2 { font-size: 1.65rem; }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
.lede { font-size: 1.15rem; color: var(--ink-2); max-width: 36em; }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }

/* ---------- Kopf ---------- */
.masthead {
  display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap;
  max-width: 1120px; width: 100%; margin: 0 auto; padding: 14px 16px;
}
.bug {
  display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink);
  font: 800 1.35rem/1 var(--f-display); letter-spacing: .01em;
}
.bug-dot { width: 13px; height: 13px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal) 25%, transparent); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; align-items: center; }
.nav a, .nav button {
  font: 600 .95rem/1 var(--f-body); color: var(--ink); text-decoration: none; padding: 9px 11px; border-radius: var(--r-ctl);
  background: none; border: 0; cursor: pointer;
}
.nav a:hover, .nav button:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.nav .who { font-size: .85rem; color: var(--ink-2); padding: 0 6px 0 10px; max-width: 14em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 720px) {
  .masthead { padding: 12px 16px 8px; }
  .nav { margin-left: 0; width: 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .nav a, .nav button { white-space: nowrap; }
}

main { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 12px 16px 56px; }
main.narrow { max-width: 760px; }

/* ---------- Fuss ---------- */
.foot {
  max-width: 1120px; width: 100%; margin: 0 auto; padding: 22px 16px 30px; border-top: 1px solid var(--line);
  display: flex; gap: 8px 20px; flex-wrap: wrap; align-items: center; font-size: .9rem; color: var(--ink-2);
}
.foot a { color: var(--ink-2); }
.foot .theme-toggle { margin-left: auto; }

/* ---------- Flächen ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 22px; }
.panel + .panel { margin-top: var(--gap); }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--gap); }
.stack > * + * { margin-top: 12px; }

/* ---------- Formulare ---------- */
label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.hint { font-size: .85rem; color: var(--ink-2); margin-top: 4px; }
input[type="text"], input[type="email"], input[type="number"], input[type="date"], input[type="search"], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 2px solid var(--line);
  border-radius: var(--r-ctl); padding: 9px 11px; min-height: 44px;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--phosphor); outline: none; box-shadow: 0 0 0 3px var(--phosphor-soft); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--signal); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--phosphor); flex: none; }
.hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }
.counter { font-size: .85rem; color: var(--ink-2); text-align: right; font-variant-numeric: tabular-nums; }
.counter.over { color: var(--signal); font-weight: 700; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  font: 700 1rem/1.1 var(--f-body); border-radius: var(--r-ctl); border: 2px solid var(--phosphor);
  background: var(--phosphor); color: var(--phosphor-ink); cursor: pointer; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; filter: none; }
.btn.quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.quiet:hover { border-color: var(--ink-2); }
.btn.danger { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.btn.small { min-height: 34px; padding: 5px 11px; font-size: .88rem; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Meldungen ---------- */
.msg { border-radius: var(--r-ctl); padding: 12px 14px; margin: 12px 0; border-left: 5px solid var(--phosphor); background: var(--phosphor-soft); }
.msg.ok { border-color: var(--ok); background: var(--ok-soft); }
.msg.warn { border-color: var(--warn); background: var(--warn-soft); }
.msg.bad { border-color: var(--signal); background: var(--bad-soft); }
.msg p:last-child { margin: 0; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; font: 700 .78rem/1 var(--f-body); padding: 5px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--signal); border-color: transparent; }
.badge.live { background: var(--signal); color: var(--signal-ink); border-color: transparent; }
.badge.new { background: var(--gold); color: var(--gold-ink); border-color: transparent; }
.badge.info { background: var(--phosphor-soft); color: var(--phosphor); border-color: transparent; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 700; color: var(--ink-2); background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Kennzahlen ---------- */
.meter { display: flex; gap: 0; border: 2px solid var(--ink); border-radius: var(--r-panel); overflow: hidden; background: var(--surface); }
.meter > div { flex: 1; padding: 14px 18px; }
.meter > div + div { border-left: 2px solid var(--ink); }
.meter .k { font-size: .85rem; color: var(--ink-2); font-weight: 600; }
.meter .v { font: 800 2rem/1.05 var(--f-display); font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .meter { flex-direction: column; }
  .meter > div + div { border-left: 0; border-top: 2px solid var(--ink); }
}

.bar { height: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--phosphor); width: 0; }
.bar.hot > span { background: var(--signal); }

/* ---------- Programmliste (Meine Videos, letzte Prompts) ---------- */
.listing { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.listing > li { display: grid; grid-template-columns: 86px 1fr; gap: 6px 18px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.listing .slot { font: 700 1.5rem/1 var(--f-display); font-variant-numeric: tabular-nums; }
.listing .slot small { display: block; font: 500 .8rem/1.3 var(--f-body); color: var(--ink-2); margin-top: 4px; }
.listing .title { font-weight: 600; font-size: 1.05rem; overflow-wrap: anywhere; margin: 0 0 6px; }
.listing .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: .88rem; color: var(--ink-2); }
.listing video { display: block; width: 100%; max-width: 560px; aspect-ratio: 16 / 9; background: #000; border-radius: 10px; margin-top: 12px; }
@media (max-width: 560px) {
  .listing > li { grid-template-columns: 1fr; }
  .listing .slot { font-size: 1.15rem; }
  .listing .slot small { display: inline; margin-left: 8px; }
}

.empty { padding: 28px; text-align: left; border: 2px dashed var(--line); border-radius: var(--r-panel); color: var(--ink-2); }

.legal { max-width: 68ch; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---------- Mitmachen ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 28px 44px; align-items: center; padding: 20px 0 40px; }
.hero h1 { font-size: clamp(2.6rem, 6.4vw, 4.6rem); line-height: .98; margin-bottom: .3em; }
.hero .btn-row { margin-top: 22px; }
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; padding-top: 8px; } }

.monitor {
  position: relative; display: block; aspect-ratio: 16 / 9; background: #000; border-radius: 18px; overflow: hidden;
  border: 10px solid #1b1e36; box-shadow: 0 0 0 1px var(--line), 0 18px 40px -18px rgba(10, 14, 60, .45);
  color: #fff; text-decoration: none;
}
.monitor video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.monitor.slate { background: var(--bars); }
.monitor.slate::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 25%; background: #111; }
.monitor-live {
  position: absolute; left: 12px; top: 12px; z-index: 1; background: #d4212b; color: #fff; font: 800 .8rem/1 var(--f-display);
  letter-spacing: .12em; text-transform: uppercase; padding: 6px 8px 5px; border-radius: 4px;
}
.monitor-caption {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 1; display: flex; flex-direction: column; align-items: flex-start;
}
.monitor-kind { background: var(--gold); color: var(--gold-ink); font: 800 .75rem/1 var(--f-display); padding: 5px 7px 4px; border-radius: 4px 4px 0 0; }
.monitor-kind:empty { display: none; }
.monitor-caption > span:last-child {
  background: #fff; color: #15172a; font: 700 1.05rem/1.2 var(--f-display); padding: 7px 10px; border-left: 4px solid #d4212b;
  border-radius: 0 6px 6px 6px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.monitor:hover { border-color: var(--phosphor); }

.composer-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr); gap: var(--gap); align-items: start; }
@media (max-width: 820px) { .composer-grid { grid-template-columns: 1fr; } }
.composer textarea { font-size: 1.1rem; min-height: 150px; }
.cost { font-weight: 600; margin: 14px 0; }
.kv { margin: 0 0 12px; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font: 800 1.35rem/1 var(--f-display); }
.recent { margin-top: 36px; }

.how { margin-top: 48px; max-width: 760px; }
.steps { list-style: none; counter-reset: s; margin: 0; padding: 0; }
.steps li { counter-increment: s; position: relative; padding: 0 0 18px 58px; min-height: 44px; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: -2px; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; font: 800 1.2rem/1 var(--f-display); background: var(--ink); color: var(--paper);
}

/* ---------- Guthaben ---------- */
.packages { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; border: 0; padding: 0; margin: 0 0 16px; }
.packages legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.pkg { position: relative; }
.pkg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pkg span {
  display: block; text-align: center; padding: 16px 10px; border: 2px solid var(--line); border-radius: var(--r-panel);
  font: 800 1.6rem/1 var(--f-display); background: var(--surface); font-variant-numeric: tabular-nums;
}
.pkg small { display: block; font: 500 .8rem/1.3 var(--f-body); color: var(--ink-2); margin-top: 6px; }
.pkg input:checked + span { border-color: var(--phosphor); box-shadow: inset 0 0 0 2px var(--phosphor); background: var(--phosphor-soft); }
.pkg input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.amount-pos { color: var(--ok); }
.meter { margin: 8px 0 var(--gap); }
.credit-grid { margin-bottom: var(--gap); align-items: start; }
.more { margin-top: 14px; }
.clip-actions { margin-top: 10px; }
.scene { margin: 8px 0 0; }
.grid-2 > .panel + .panel, .composer-grid > .panel + .panel { margin-top: 0; }
