/* Fernseher, a NETWORK XXIII service. Station frame copied from Secrets (nxsecrets/static/css/app.css),
   which copies it from NetWorkXXIII.de's site.css, Raza skin. App-specific rules live in fernseher.css.
   Originally: Secrets, a NETWORK XXIII service.
   The station frame (tokens, fonts, header, buttons, lamps, footer) is copied from NetWorkXXIII.de's site.css, Raza
   skin, so this app needs nothing from another origin. When the station changes those, copy them again.
   Type follows the station's DESIGN.md: display face for headings and controls, mono for what a machine prints
   (times, dates, durations, channel numbers, labels on controls), body face for every sentence.
   Colour: brand red only on a lit lamp (on air now); amber for trouble and STAND BY; steel blue
   (--accent) for controls, links and line work; green only for measured readings. */

@font-face { font-family: "Chakra Petch"; font-weight: 600; font-style: normal; font-display: swap; src: url(/static/fonts/chakra-petch-600.woff2) format("woff2"); }
@font-face { font-family: "Chakra Petch"; font-weight: 700; font-style: normal; font-display: swap; src: url(/static/fonts/chakra-petch-700.woff2) format("woff2"); }
@font-face { font-family: "Outfit"; font-weight: 100 900; font-style: normal; font-display: swap; src: url(/static/fonts/outfit-variable.woff2) format("woff2"); }
@font-face { font-family: "Share Tech Mono"; font-weight: 400; font-style: normal; font-display: swap; src: url(/static/fonts/share-tech-mono.woff2) format("woff2"); }

:root {
  color-scheme: dark;
  --brand: #cd2127;
  --live: #ff4a50;
  --display: "Chakra Petch", "Trebuchet MS", Arial, sans-serif;
  --body: "Outfit", "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "Share Tech Mono", "Consolas", "Courier New", monospace;
  --bg: #09090b;
  --bg2: #0e0e11;
  --panel: #131316;
  --line: #2a2a30;
  --fg: #d4d4d8;
  --muted: #9696a2;
  --accent: #9fb0c4;
  --accent-ink: #0a0d12;
  --ok: #5ad0a0;
  --warn: #e0b04a;
  --radius: 0px;
  --panel-grad: linear-gradient(180deg, #17171b 0%, #111114 100%);
}

* { box-sizing: border-box; }
html { background: var(--bg); color: var(--fg); -webkit-text-size-adjust: 100%; scroll-padding-top: 90px; }
body {
  margin: 0; font-family: var(--body); font-size: 16px; line-height: 1.55; font-weight: 300; background: var(--bg); color: var(--fg);
  overflow-x: hidden; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul { list-style: none; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.15; text-wrap: balance; }
h1 { font-size: clamp(34px, 6vw, 56px); text-transform: uppercase; letter-spacing: .01em; overflow-wrap: anywhere; }
h2 { font-size: 20px; text-transform: uppercase; letter-spacing: .04em; }
h3 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; }
b, strong { font-weight: 600; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
img { max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.xsmall { font-size: 13px; }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.mono { font-family: var(--mono); }
.wrap { max-width: 1180px; margin-inline: auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* ── Station header ──────────────────────────────────────── */
header.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 9; background: color-mix(in srgb, var(--bg2) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
header.top .wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding-block: 10px; }
.brand { display: flex; align-items: center; flex-shrink: 0; }
.brand img { height: 48px; width: auto; display: block; }
nav.main { display: flex; gap: 4px; flex-wrap: wrap; margin-right: auto; }
nav.main a { font-family: var(--display); font-weight: 600; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--fg); padding: 6px 10px; border-radius: var(--radius); white-space: nowrap; }
nav.main a:hover { background: var(--panel); text-decoration: none; }
nav.main a.current { box-shadow: inset 0 -2px 0 var(--accent); }
.top-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.top-tools form { margin: 0; }
.lang { font-family: var(--mono); font-size: 13px; letter-spacing: .1em; color: var(--muted); }
.lang b { color: var(--fg); font-weight: 400; }
.who { font-family: var(--mono); font-size: 13px; color: var(--fg); max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-top { font-family: var(--display); font-weight: 600; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--fg); background: var(--panel); border: 1px solid var(--line); padding: 8px 12px; min-height: 40px; display: inline-flex; align-items: center; cursor: pointer; white-space: nowrap; }
.btn-top:hover { border-color: var(--accent); text-decoration: none; }

/* ── Page ────────────────────────────────────────────────── */
main.page { flex: 1 0 auto; width: 100%; padding-bottom: 48px; display: flex; flex-direction: column; gap: 24px; }
main.page > .notice:first-child { margin-top: 24px; }
.page-head { padding-block: 40px 4px; display: grid; gap: 10px; }
.page-head.with-action { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
.page-head h1 { margin: 0; }
.lead { font-size: 19px; max-width: 38em; color: color-mix(in srgb, var(--fg) 82%, var(--muted)); }
.page.narrow { max-width: 760px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.tight { gap: 6px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack.tight { gap: 6px; }
.split { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }

.card { background: var(--panel-grad); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card.flat { background: transparent; }
.card.tinted { background: var(--bg2); }
/* The console: the main control of the channel, with the accent stripe on the left. */
.card.console { border-left: 3px solid var(--accent); }

/* ── Buttons ─────────────────────────────────────────────── */
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px;
  font-family: var(--display); font-weight: 600; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; line-height: 1.3;
  border-radius: var(--radius); cursor: pointer; text-decoration: none; white-space: nowrap;
  background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent);
}
.btn:hover { background: #b9c7d7; border-color: #b9c7d7; text-decoration: none; }
.btn.secondary { background: var(--panel); color: var(--fg); border-color: var(--line); }
.btn.secondary:hover { border-color: var(--accent); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); padding-inline: 10px; }
.btn.ghost:hover { background: var(--panel); }
.btn.danger { background: var(--panel); color: var(--fg); border-color: var(--line); }
.btn.danger:hover { border-color: var(--warn); color: var(--warn); }
.btn.big { min-height: 52px; font-size: 13px; padding-inline: 22px; }
.btn.sm { min-height: 36px; padding: 6px 10px; font-size: 11px; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.copied { background: var(--ok); border-color: var(--ok); color: var(--accent-ink); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn[disabled]:hover { background: var(--accent); border-color: var(--accent); }
.btn.secondary[disabled]:hover { background: var(--panel); border-color: var(--line); }

/* ── Forms ───────────────────────────────────────────────── */
.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px 20px; }
/* Labels on controls are machine text (mono); hints are sentences (body face). */
label.field, .field { display: flex; flex-direction: column; gap: 6px; font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.field.wide { grid-column: 1 / -1; }
.field .hint { font-family: var(--body); font-size: 13.5px; letter-spacing: 0; text-transform: none; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  font: 16px var(--body); font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--fg); background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; min-height: 46px; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 1px var(--accent); }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
textarea { min-height: 7rem; resize: vertical; font-family: var(--mono); font-size: 15px; }
select { appearance: auto; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.checks label { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; cursor: pointer; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--accent); }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg button { font-family: var(--display); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; background: transparent; color: var(--muted); border: 0; border-right: 1px solid var(--line); padding: 8px 12px; min-height: 44px; cursor: pointer; white-space: nowrap; }
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--fg); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.seg button:disabled { opacity: .5; cursor: not-allowed; }
fieldset.card { margin: 0; min-width: 0; }
.field-error { font-family: var(--body); font-size: 14px; letter-spacing: 0; text-transform: none; color: var(--warn); }
input[aria-invalid="true"] { border-color: var(--warn); }
.counter { font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: right; }
.counter.over { color: var(--warn); }

/* ── Notices ─────────────────────────────────────────── */
/* Notices: steel blue for information and success, amber for anything that needs attention. Never red. */
.notice { padding: 12px 16px; font-size: 15px; display: flex; gap: 12px; align-items: flex-start; background: var(--bg2); border-left: 3px solid var(--accent); }
.notice svg { flex: none; width: 20px; height: 20px; margin-top: 2px; color: var(--accent); }
.notice.warn, .notice.error { border-left-color: var(--warn); }
.notice.warn svg, .notice.error svg { color: var(--warn); }
.notice.error { color: color-mix(in srgb, var(--warn) 70%, var(--fg)); }

/* ── Lamps ───────────────────────────────────────────────── */
/* A lit red lamp is ON AIR, as on a studio door: here, a programme that is on right now. */
.pill { display: inline-flex; align-items: center; gap: 4px; font-family: var(--display); font-weight: 700; font-size: 10.5px; letter-spacing: .12em; padding: 1px 7px; border: 1px solid var(--line); border-radius: 2px; text-transform: uppercase; white-space: nowrap; color: var(--muted); background: color-mix(in srgb, var(--bg) 80%, #000); }
.pill.on, .pill.active, .pill.partial { background: var(--brand); border-color: var(--live); color: #fff; box-shadow: 0 0 12px color-mix(in srgb, var(--live) 50%, transparent); }
.pill.standby, .pill.soon { border-color: var(--warn); color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, var(--bg)); box-shadow: none; }
.pill.off, .pill.viewed, .pill.expired { color: var(--muted); }
.pill.revoked { color: var(--muted); border-style: dashed; }
.pill.mail, .pill.tag { font-family: var(--mono); font-weight: 400; letter-spacing: .06em; color: var(--fg); background: transparent; }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); background: var(--panel); }
.table-wrap.borderless { border: 0; background: transparent; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font-family: var(--mono); font-weight: 400; font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg2); white-space: nowrap; }
td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--panel) 60%, var(--line)); }
td .sub { display: block; font-size: 13px; color: var(--muted); }
td:last-child { white-space: nowrap; }

.stat { padding: 16px 18px; gap: 4px; }
.stat .num { font-family: var(--mono); font-size: 34px; line-height: 1.1; color: #fff; }

.tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tabs a.tab, .tabs button { font-family: var(--display); font-weight: 600; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--fg); border: 1px solid transparent; padding: 8px 12px; background: transparent; cursor: pointer; }
.tabs a.tab:hover, .tabs button:hover { background: var(--panel); text-decoration: none; }
.tabs a.tab.on, .tabs button.on { border-color: var(--line); background: var(--panel); box-shadow: inset 0 -2px 0 var(--accent); }
.tabs .c { font-family: var(--mono); color: var(--muted); margin-left: 4px; }
.search { max-width: 280px; min-height: 40px; }

/* ── Chips and key/value lists ─────────────────────────── */
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; font-size: 15px; }
dl.kv dt { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding-top: 3px; }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-family: var(--mono); font-size: 12px; letter-spacing: .06em; padding: 2px 8px; border: 1px solid var(--line); background: var(--bg2); }

/* ── Long text: calm, body face ──────────────────────────── */
.prose { max-width: 70ch; display: flex; flex-direction: column; gap: 14px; font-size: 17px; }
.prose h2 { margin-top: 18px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.prose ul { display: flex; flex-direction: column; gap: 8px; }
.prose ul li { padding-left: 18px; position: relative; }
.prose ul li::before { content: "▮"; position: absolute; left: 0; top: 6px; font-size: 10px; color: var(--accent); }
.prose code { font-family: var(--mono); background: var(--panel); border: 1px solid var(--line); padding: 0 5px; }

/* ── Footer ──────────────────────────────────────────────── */
footer.foot { padding-block: 56px 40px; overflow-wrap: anywhere; }
footer.foot .fine { font-family: var(--mono); font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
footer.foot a { color: var(--muted); }
footer.foot a:hover { color: var(--fg); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel); color: var(--fg); border: 1px solid var(--accent); padding: 10px 16px; font-size: 15px; z-index: 60; max-width: calc(100vw - 32px); }

/* ── Utilities (no inline styles: the CSP forbids them) ──── */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; top: -100px; left: 16px; z-index: 110; padding: 12px; background: var(--bg2); color: var(--fg); }
.skip:focus { top: 8px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.form-narrow { max-width: 480px; margin: 0 auto; width: 100%; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.normal { font-family: var(--body); font-weight: 300; letter-spacing: 0; text-transform: none; }
.select-sm { min-height: 38px; padding: 6px 8px; width: auto; }
.summary { cursor: pointer; font-family: var(--display); font-weight: 600; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); min-height: 44px; display: inline-flex; align-items: center; }
.summary::marker { content: ""; }
.summary::after { content: " +"; white-space: pre; }
details[open] > .summary::after { content: " −"; }
.mt { margin-top: 12px; }
.input-num { width: 6rem; }
.card.gap-sm { gap: 12px; }
.big-title { font-size: clamp(26px, 5vw, 36px); }
.field.span2 { grid-column: span 2; }
@media (max-width: 720px) { .field.span2 { grid-column: auto; } }
@media (max-width: 860px) { .detail-grid { grid-template-columns: 1fr; } }
.grow-input { flex: 1; min-width: 12rem; }
.spinner { width: 18px; height: 18px; border: 3px solid color-mix(in srgb, var(--accent-ink) 30%, transparent); border-top-color: var(--accent-ink); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

@media (max-width: 620px) {
  .brand img { height: 38px; }
  header.top .wrap { gap: 6px 8px; }
  nav.main { order: 3; width: 100%; margin-right: 0; }
  nav.main a { padding-inline: 6px; font-size: 12px; }
  .top-tools { margin-left: auto; gap: 8px; }
  .who { display: none; }
  .page-head { padding-top: 28px; }
  .page-head.with-action { grid-template-columns: 1fr; }
  .card { padding: 18px 16px; }
  .actions .btn { flex: 1 1 auto; }
}
.nav-spacer { margin-right: auto; }
.page-head h1.h1-label { font-size: clamp(26px, 4.5vw, 40px); }
/* Option texts inside a control label are shown as written: "a–z" vs "A–Z", "0 O 1 l I" must keep their case. */
.field .checks, .field .checks label, .field select, .field option, .field .row { text-transform: none; letter-spacing: .02em; }
.page-head .sub-lead { max-width: 46em; }
@media (max-width: 620px) { .lead { font-size: 17px; } }
