/* OUTSTANDING TALK – dark console UI. Amber = talking, red/green = tally only, channel color = identity. */
:root {
  --bg: #0f0f15;
  --panel: #161b22;
  --panel2: #1e242d;
  --panel3: #29313c;
  --line: #2b333e;
  --text: #e9edf2;
  --muted: #8f9aa8;
  --talk: #f2a33a;        /* talk lamp */
  --talk-ink: #1d1203;
  --onair: #e5484d;
  --preview: #2fa565;
  --ok: #57d08a;
  --warn: #ffcc66;
  --blue: #7650c4;        /* primary actions (brand purple) */
  --link: #b9a0f0;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 var(--font); -webkit-tap-highlight-color: transparent; }
body { min-height: 100dvh; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
h1 { font-size: 24px; margin: 0; }
h2 { font-size: 13px; margin: 0; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
a { color: var(--link); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.row.head { margin-bottom: 4px; }
.stack { display: grid; gap: 12px; }
.stack-l { display: grid; gap: 16px; }
.spacer { flex: 1; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.empty { color: var(--muted); padding: 18px; border: 1px dashed var(--line); border-radius: var(--radius); text-align: center; margin: 0; }
.hint { background: #2a2312; border: 1px solid #5a4415; color: var(--warn); border-radius: 10px; padding: 10px 12px; margin: 0; }

input, select, button, .btn { font: inherit; color: var(--text); border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); padding: 10px 12px; min-height: 44px; }
input, select { width: 100%; }
input[type=checkbox] { width: 22px; min-height: 22px; accent-color: var(--blue); }
input[type=range] { padding: 0; border: 0; background: none; accent-color: var(--talk); min-height: 32px; }
input:disabled, select:disabled { opacity: .55; }
button, .btn { cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; user-select: none; -webkit-user-select: none; }
button:hover, .btn:hover { border-color: #3d4756; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
button.primary, .btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
button.danger { background: #331417; border-color: var(--onair); color: #ffb4b6; }
button.ghost, .btn.ghost { background: transparent; }
button.small, .btn.small { min-height: 36px; padding: 6px 12px; font-size: 13px; }
button.big { min-height: 56px; font-size: 18px; width: 100%; }
button.on { background: #2a2244; border-color: var(--blue); }
button:disabled { cursor: default; }

.topbar, .st-head { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: rgba(14,17,22,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 700; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--talk); display: inline-block; }
main { padding: 18px 16px; max-width: 1100px; margin: 0 auto; display: grid; gap: 14px; }
.center { display: grid; place-items: center; min-height: 70dvh; padding: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 12px; }
.card.narrow { width: min(420px, 100%); }
.check { display: flex; gap: 10px; align-items: center; min-height: 40px; }

.list { display: grid; gap: 8px; }
.item { display: flex; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; flex-wrap: wrap; }
.item.running { border-color: #24533b; }
.item.inactive { opacity: .6; }
.item .title { font-weight: 600; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.badge.running { color: #8ff0b8; border-color: #24533b; }
.badge.perm-admin { color: #ffcf99; border-color: #5d4320; }
.badge.perm-producer { color: #b9d6ff; border-color: #24406b; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--panel2); color: var(--muted); }
.tabs { display: flex; gap: 6px; }
.tabs a { padding: 8px 14px; border-radius: 99px; text-decoration: none; color: var(--muted); border: 1px solid var(--line); }
.tabs a.on { color: var(--text); background: var(--panel2); }
.led { width: 10px; height: 10px; border-radius: 50%; background: #3a4352; flex: none; }
.led.on { background: var(--ok); }
.pill { font-size: 12px; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line); white-space: nowrap; }
.pill.ok { color: #8ff0b8; border-color: #24533b; }
.pill.warn { color: var(--warn); border-color: #5a4415; }

/* forms in modals */
.field { display: grid; gap: 5px; }
.field .lbl { font-size: 13px; font-weight: 600; }
.hint-s { font-size: 12px; color: var(--muted); }
.perm-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.perm { display: grid; gap: 2px; text-align: left; justify-content: stretch; padding: 10px; }
.perm span { font-size: 12px; color: var(--muted); }
.perm.on { border-color: var(--blue); background: #261f3d; }
.cast { overflow-x: auto; }
.cast table { width: 100%; border-collapse: collapse; min-width: 520px; }
.cast th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px; border-bottom: 1px solid var(--line); }
.cast td { padding: 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.cast select { min-height: 38px; padding: 6px 8px; }

.modal { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.modal-box { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; width: min(520px, 100%); display: grid; gap: 12px; max-height: calc(100dvh - 32px); overflow-y: auto; }
.modal-box:has(.wide-modal) { width: min(760px, 100%); }
.modal-box h2 { font-size: 18px; text-transform: none; letter-spacing: 0; color: var(--text); }
.modal-x { position: absolute; top: 10px; right: 10px; min-height: 34px; width: 34px; padding: 0; }
.qr { background: #fff; border-radius: 10px; padding: 10px; }
.qr svg { display: block; width: 100%; height: auto; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; padding: 10px 16px; border-radius: 10px; background: #331417; border: 1px solid var(--onair); max-width: 90vw; }
.toast.ok { background: #12301f; border-color: var(--preview); }

/* ================= station (Home) ================= */
.station { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; grid-template-columns: minmax(0, 1fr); position: relative; }
/* whole-screen tally frame: visible from across the room */
.station::after { content: ''; position: fixed; inset: 0; pointer-events: none; border: 0 solid transparent; transition: border-color .08s; z-index: 30; }
.station.tally-program::after { border: 8px solid var(--onair); }
.station.tally-preview::after { border: 8px solid var(--preview); }
.st-head .pill { overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.st-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.st-body { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 14px; padding: 14px 16px 20px; max-width: 1100px; width: 100%; margin: 0 auto; align-items: start; }
.st-col { display: grid; gap: 12px; min-width: 0; }

.st-tally { border-radius: var(--radius); padding: 14px 16px; display: flex; align-items: baseline; gap: 12px; background: var(--panel); border: 1px solid var(--line); }
.st-tally .cam { font-size: 30px; font-weight: 800; letter-spacing: .02em; line-height: 1; }
.st-tally .what { font: 700 13px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.st-tally.program { background: var(--onair); border-color: var(--onair); }
.st-tally.preview { background: var(--preview); border-color: var(--preview); }
.st-tally.program .what, .st-tally.preview .what { color: rgba(255,255,255,.9); }
.st-tally.none { padding: 10px 14px; }
.st-tally.none .cam { font-size: 15px; color: var(--muted); }
.st-tally.none .what { letter-spacing: 0; text-transform: none; font: 13px var(--font); }

.st-call { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: var(--talk); color: var(--talk-ink); border-radius: 12px; padding: 10px 12px; font-size: 15px; }
.st-call button { background: rgba(0,0,0,.2); color: var(--talk-ink); border-color: transparent; font-weight: 700; }

.st-talk { display: grid; gap: 8px; }
.key { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.k-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.k-talk { width: 100%; min-width: 0; min-height: 84px; border: 0; border-radius: 0; background: transparent; display: grid; justify-items: start; justify-content: stretch; align-content: center; gap: 3px; padding: 12px 14px; border-left: 6px solid var(--c); text-align: left; touch-action: none; }
.k-talk:disabled { opacity: 1; }
.k-name { font-size: 20px; font-weight: 800; letter-spacing: .03em; display: flex; gap: 8px; align-items: center; }
.k-name kbd { font: 11px var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.k-talk .state { font-size: 12.5px; color: var(--muted); }
.k-talk .who { font-size: 13.5px; font-weight: 600; color: var(--talk); min-height: 0; }
.k-talk .who:empty { display: none; }
.key.incoming { border-color: var(--talk); box-shadow: 0 0 0 1px var(--talk) inset; }
.key.muted-ch .k-name { color: var(--muted); }
.k-talk.talking { background: var(--talk); color: var(--talk-ink); }
.k-talk.talking .state, .k-talk.talking .who, .k-talk.talking kbd { color: var(--talk-ink); border-color: rgba(0,0,0,.25); }
.k-talk.latched { box-shadow: inset 0 0 0 3px rgba(0,0,0,.35); }
.k-side { display: grid; grid-template-rows: 1fr auto auto; border-left: 1px solid var(--line); min-width: 92px; }
.k-listen { border: 0; border-radius: 0; background: var(--panel2); font: 700 12px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); min-height: 52px; }
.k-listen.on { color: #9fe7bd; }
.k-vol { border: 0; border-top: 1px solid var(--line); border-radius: 0; background: var(--panel2); font-size: 12px; color: var(--muted); min-height: 32px; padding: 4px; }
.vol { display: flex; gap: 8px; align-items: center; padding: 6px 12px 10px; }
.vol input { flex: 1; }
.vol button { min-width: 64px; }
.vol button.on-mute { background: #331417; border-color: var(--onair); color: #ffb4b6; }
.key .vol { border-top: 1px solid var(--line); padding-top: 10px; }

.st-pgm, .st-team { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: grid; gap: 10px; }
.st-pgm .vol { padding: 0; }
.seg { display: flex; gap: 4px; }
.seg button { flex: 1; }
.st-pgm video { width: 100%; border-radius: 10px; background: #000; aspect-ratio: 16/9; max-width: 100%; }

.team { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.mate { border-radius: 10px; background: var(--panel2); }
.mate-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.mate .n { font-weight: 600; }
.mate .sub { font-size: 12.5px; color: var(--muted); }
.mate.talking { box-shadow: inset 3px 0 0 var(--talk); }
.mate.talking .led { background: var(--talk); box-shadow: 0 0 8px var(--talk); }
.mate.me { background: transparent; border: 1px dashed var(--line); }
.mate .call { touch-action: none; }
.mate .call.talking { background: var(--talk); color: var(--talk-ink); border-color: var(--talk); }
.mate-admin { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; padding: 0 10px 10px; align-items: end; }
.mate-admin label { display: grid; gap: 3px; font-size: 12px; color: var(--muted); }
.mate-admin select { min-height: 38px; padding: 6px 8px; }

@media (max-width: 820px) {
  .st-body { grid-template-columns: minmax(0, 1fr); padding: 10px 12px 16px; gap: 10px; }
  .topbar .user-name { display: none; }
  .perm-pick { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .k-talk { min-height: 76px; }
  .k-name { font-size: 18px; }
  .st-tally .cam { font-size: 26px; }
  .mate-admin { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---- 1.1: mic test, signal, priority, level, background warning ---- */
.meter-big { height: 12px; background: #05070a; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.meter-big i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--ok) 65%, var(--warn) 85%, var(--onair)); transition: width .05s linear; }
.k-mini { display: grid; grid-template-columns: 1fr 1fr; }
.k-mini .k-vol + .k-vol { border-left: 1px solid var(--line); }
.k-mini:has(> :only-child) { grid-template-columns: 1fr; }
.prio { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--talk); border: 1px solid var(--talk); border-radius: 4px; padding: 0 4px; }
.key.priority { border-width: 2px; }
/* own level while talking: a bar along the bottom of the talking key */
.k-talk.talking { position: relative; }
.k-talk.talking::after { content: ''; position: absolute; left: 0; bottom: 0; height: 5px; width: calc(var(--lvl, 0) * 100%); background: var(--talk-ink); opacity: .55; transition: width .05s linear; }
.signal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; align-content: center; gap: 24px; padding: 24px; background: var(--talk); color: var(--talk-ink); text-align: center; animation: sigflash .5s steps(2) infinite; }
.sig-text { font-size: clamp(30px, 9vw, 64px); font-weight: 900; line-height: 1.05; }
.signal button { background: var(--talk-ink); color: var(--talk); border: 0; max-width: 320px; }
@keyframes sigflash { 50% { background: #fff3dc; } }
@media (prefers-reduced-motion: reduce) { .signal { animation: none; } }
.bg-warn { position: fixed; left: 12px; right: 12px; top: calc(12px + env(safe-area-inset-top)); z-index: 65; background: #3a2a0c; border: 1px solid var(--warn); color: var(--warn); border-radius: 12px; padding: 12px 14px; font-weight: 600; }
.pair-code { font: 800 40px/1 var(--mono); letter-spacing: .12em; text-align: center; padding: 18px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); }
.audit { overflow-x: auto; }
.audit table { width: 100%; border-collapse: collapse; min-width: 720px; font-size: 14px; }
.audit th { text-align: left; color: var(--muted); font-size: 12px; font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.audit td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.nowrap { white-space: nowrap; }

.download { max-width: 640px; margin: 0 auto; gap: 14px; }
.dl-head { display: flex; gap: 14px; align-items: center; }
.dl-head img { border-radius: 14px; }
.steps-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.sha { display: block; word-break: break-all; margin-top: 6px; }

/* ---- 1.2: bigger call (Ruf) buttons ---- */
.k-sig { border: 0; border-top: 1px solid var(--line); border-radius: 0; background: #2a2312; color: var(--talk); font: 800 15px var(--font); letter-spacing: .04em; min-height: 46px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.k-sig:active { background: var(--talk); color: var(--talk-ink); }
.sig-btn { min-height: 42px; min-width: 76px; padding: 6px 14px; font-weight: 800; font-size: 15px; color: var(--talk); background: #2a2312; border: 1px solid #5a4415; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.sig-btn:active { background: var(--talk); color: var(--talk-ink); }
.st-team .card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.prod-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 10px; align-content: start; }
.prod-card h2 { margin: 0; font-size: 17px; }
.prod-card.on { border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }

/* ---- OUTSTANDING TALK brand: green → teal → slate → purple (functional colours stay: amber = talk, red/green = tally) ---- */
:root { --brand-grad: linear-gradient(90deg, #1fbf68 0%, #34a58a 40%, #6d8cc4 70%, #a07fe0 100%); }
.brand .mark { display: inline-flex; width: 26px; flex: none; }
.brand .mark svg { width: 100%; height: auto; display: block; }
.wm { font-weight: 800; letter-spacing: .06em; white-space: nowrap; }
.wm b { background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.topbar .brand { gap: 10px; font-size: 15px; }
@media (max-width: 420px) { .topbar .wm { font-size: 13px; letter-spacing: .04em; } }

/* ---- squelch ---- */
.sq-meter { position: relative; }
.sq-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.5); }
.sq-state { font: 700 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; margin-left: 8px; }
.sq-state.open { color: var(--ok); } .sq-state.shut { color: var(--muted); }
.field .check .spacer { flex: 1; }
.failover { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 50; background: #2a1214; border: 1px solid var(--onair); border-radius: 14px; padding: 14px; display: grid; gap: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.failover .btn { justify-self: start; }
