/* Sheri Garba Live v1.1.1 · operator control room */
html, body.op { height: 100%; }
body.op { background: var(--bg); font-size: 14px; }
.muted { color: var(--text-mute); }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 0 12px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--panel-2); color: var(--text);
  font-family: var(--f-label); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; font-size: 13px;
  transition: background 0.12s, border-color 0.12s, transform 0.06s;
}
.btn:hover { background: var(--panel-3); border-color: var(--gold-500); }
.btn:active { transform: translateY(1px); }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 12px; }
.btn-xs { min-height: 24px; padding: 0 8px; font-size: 11px; }
.btn-xl { min-height: 52px; min-width: 150px; font-size: 20px; letter-spacing: 0.1em; border-radius: var(--r-md); }
.btn-take { background: linear-gradient(180deg, var(--gold-300), var(--gold-500)); color: #2a0710; border-color: var(--gold-400); }
.btn-take:hover { background: linear-gradient(180deg, #fbe2a4, var(--gold-400)); }
.btn-take:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-standby { background: transparent; color: #ff8d92; border: 2px solid var(--tally-pgm); }
.btn-standby:hover { background: rgba(236, 43, 52, 0.16); border-color: var(--tally-pgm); }
.btn-danger { color: #ff9aa0; border-color: rgba(236, 43, 52, 0.5); }

/* ---------------------------------------------------------------- login */
.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; background: radial-gradient(70% 60% at 50% 20%, #3a0912, var(--bg) 70%); }
.login-card { width: min(380px, 100%); display: grid; gap: 14px; padding: 28px; border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line-strong); text-align: center; }
.login-mark { width: 64px; height: 64px; margin: 0 auto; }
.login-mark svg { width: 100%; height: 100%; }
.login-card h1 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 36px; line-height: 1; }
.login-card p { margin: 0; color: var(--text-mute); }
.login-card label { display: grid; gap: 6px; text-align: left; }
.login-card .label { font-size: 12px; color: var(--gold-400); }
.login-card input { font-size: 22px; letter-spacing: 0.3em; text-align: center; padding: 12px; border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--panel-2); }
.login-err { color: #ff9aa0 !important; min-height: 1.2em; }
.login-card .btn { min-height: 48px; font-size: 16px; }

/* ---------------------------------------------------------------- shell */
.app { height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto 1fr; }
.topbar {
  display: flex; align-items: center; gap: 18px; padding: 8px 14px;
  background: linear-gradient(180deg, #1d0a0e, #160709); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 34px; height: 34px; }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand b { display: block; font-family: var(--f-display); font-weight: 400; font-size: 20px; line-height: 1; color: var(--gold-400); }
.brand small { display: block; font-family: var(--f-label); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; font-size: 11px; color: var(--text-mute); margin-top: 3px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-family: var(--f-label); font-weight: 600; font-size: 12px; letter-spacing: 0.05em; color: var(--cream-dim); }
.chip i { width: 8px; height: 8px; border-radius: 50%; background: #666; }
.chip.ok i { background: var(--tally-pvw); }
.chip.bad i { background: var(--tally-pgm); }
.chip.mid i { background: var(--warn); }
.chip.warn { border-color: rgba(245, 165, 36, 0.6); color: var(--warn); }

.crew { display: flex; align-items: center; gap: 8px; margin-left: auto; padding: 4px 6px 4px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); }
.crew .label { font-size: 11px; color: var(--text-mute); }
.crew b { font-size: 20px; letter-spacing: 0.18em; color: var(--gold-300); }
.top-right { display: flex; align-items: center; gap: 8px; }
.clock { font-size: 16px; color: var(--cream); min-width: 5.5ch; text-align: right; }

.workspace { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 340px; }
.deck { min-height: 0; display: grid; grid-template-rows: minmax(220px, 46%) auto minmax(0, 1fr); gap: 10px; padding: 12px; }
.side { min-height: 0; overflow-y: auto; border-left: 1px solid var(--line); background: #130608; padding: 12px; display: grid; gap: 12px; align-content: start; }

/* ---------------------------------------------------------------- monitors */
.monitors { min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.monitor { margin: 0; min-height: 0; display: grid; grid-template-rows: auto 1fr; border-radius: var(--r-md); border: 2px solid var(--line); background: #060203; overflow: hidden; }
.monitor figcaption { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: var(--panel); border-bottom: 1px solid var(--line); min-width: 0; }
.monitor .label { font-size: 13px; padding: 2px 8px; border-radius: 4px; }
.tag-pvw { background: var(--tally-pvw); color: #04210e; }
.tag-pgm { background: #5a2a2e; color: #ffd9db; }
.monitor-pgm.is-live { border-color: var(--tally-pgm); }
.monitor-pgm.is-live .tag-pgm { background: var(--tally-pgm); color: #fff; }
.monitor-pvw.has-src { border-color: rgba(35, 197, 82, 0.6); }
.mon-name { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--cream); }
.pgm-timer { color: #ff9aa0; font-size: 13px; }
.sel-xs { font-size: 11px; padding: 3px 20px 3px 6px; }
.mon-host { min-height: 0; }
.monitor-pgm.flash { animation: flash 0.5s ease-in-out 4; }
@keyframes flash { 50% { border-color: #fff; box-shadow: 0 0 0 4px rgba(236, 43, 52, 0.6); } }

/* full-screen program output: nothing but the stage */
#pgm-host:fullscreen { background: #000; }
#pgm-host:-webkit-full-screen { background: #000; width: 100%; height: 100%; }

/* ---------------------------------------------------------------- controls */
.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border-radius: var(--r-md); background: var(--panel); border: 1px solid var(--line); }
.ctl-sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 4px; }
.seg-ctl { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; }
.seg-ctl button { min-height: 34px; padding: 0 14px; border: 0; background: var(--panel-2); color: var(--text-mute); font-family: var(--f-label); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; font-size: 13px; }
.seg-ctl button + button { border-left: 1px solid var(--line-strong); }
.seg-ctl button[aria-checked="true"] { background: var(--gold-500); color: #2a0710; }
.ctl-field { display: inline-flex; align-items: center; gap: 8px; }
.ctl-field .label { font-size: 12px; color: var(--text-mute); }
select, .field input, .field textarea, .cue-row input {
  font-size: 14px; padding: 7px 9px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--panel-2); color: var(--text);
}
select { padding-right: 26px; }

/* ---------------------------------------------------------------- sources */
.sources { min-height: 0; display: grid; grid-template-rows: auto 1fr; gap: 8px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-head h2 { margin: 0; font-size: 14px; color: var(--gold-400); }
.sources .panel-head .muted { font-size: 12px; }
.tiles { min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; align-content: start; padding: 2px; }
.empty { grid-row: 2; align-self: start; padding: 26px; text-align: center; border: 1px dashed var(--line-strong); border-radius: var(--r-md); color: var(--cream-dim); }
.empty p { margin: 4px 0; }

.tile { position: relative; display: grid; grid-template-rows: auto auto; border-radius: var(--r-md); border: 2px solid var(--line); background: var(--panel); overflow: hidden; cursor: pointer; user-select: none; }
.tile:hover { border-color: var(--line-strong); }
.tile.is-pvw { border-color: var(--tally-pvw); }
.tile.is-pgm { border-color: var(--tally-pgm); box-shadow: 0 0 0 1px var(--tally-pgm); }
.tile-video { position: relative; aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
.tile-video video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.tile-badges { position: absolute; left: 6px; top: 6px; display: flex; gap: 4px; }
.badge { padding: 2px 6px; border-radius: 4px; font-family: var(--f-label); font-weight: 700; font-size: 11px; letter-spacing: 0.08em; background: rgba(0, 0, 0, 0.7); color: #fff; }
.badge.pgm { background: var(--tally-pgm); }
.badge.pvw { background: var(--tally-pvw); color: #04210e; }
.badge.key { background: rgba(0, 0, 0, 0.7); color: var(--gold-300); }
.badge.relay { background: rgba(80, 60, 150, 0.85); }
.badge.warn { background: var(--warn); color: #2a1800; }
.tile-batt { position: absolute; right: 6px; top: 6px; }
.tile-nosig { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-mute); font-family: var(--f-label); letter-spacing: 0.08em; text-transform: uppercase; font-size: 12px; }
.tile-foot { display: grid; gap: 4px; padding: 7px 9px 8px; }
.tile-name { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-weight: 700; color: var(--cream); }
.tile-name span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-stats { font-size: 11px; color: var(--text-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-actions { display: flex; gap: 6px; }
.tile-actions details { position: relative; }
.tile-actions summary { list-style: none; }
.tile-actions summary::-webkit-details-marker { display: none; }
.cue-pop { position: absolute; z-index: 10; bottom: calc(100% + 6px); left: 0; width: 230px; display: grid; gap: 6px; padding: 8px; border-radius: var(--r-md); background: var(--panel-3); border: 1px solid var(--line-strong); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5); }
.cue-pop .presets { display: flex; flex-wrap: wrap; gap: 4px; }
.cue-row { display: flex; gap: 6px; }
.cue-row input { flex: 1; min-width: 0; }

/* ---------------------------------------------------------------- PTZ */
.ptz-cam { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ptz-cam b { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--cream); }
.ptz-lenses { display: flex; flex-wrap: wrap; gap: 4px; }
.ptz-lenses:empty { display: none; }
.lens-btn { min-height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--panel-2); color: var(--cream-dim); font-family: var(--f-label); font-weight: 700; font-size: 12px; letter-spacing: 0.04em; }
.lens-btn[aria-checked="true"] { background: var(--gold-500); color: #2a0710; border-color: var(--gold-400); }
.ptz-main { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; }
.dpad { display: grid; grid-template-columns: repeat(3, 40px); grid-template-rows: repeat(3, 40px); gap: 4px; }
.dpad button, .zoom-rocker button {
  border: 1px solid var(--line-strong); background: var(--panel-2); color: var(--cream); border-radius: var(--r-sm);
  font-size: 18px; line-height: 1; touch-action: none; user-select: none;
}
.dpad button:hover, .zoom-rocker button:hover { border-color: var(--gold-500); background: var(--panel-3); }
.dpad button.active, .zoom-rocker button.active { background: var(--gold-500); color: #2a0710; }
.dpad .home { color: var(--gold-300); }
.ptz-side { display: grid; gap: 8px; justify-items: start; }
.zoom-rocker { display: grid; grid-template-columns: 52px 52px; gap: 4px; }
.zoom-rocker button { height: 40px; font-size: 22px; font-weight: 700; }
.seg-sm button { min-height: 26px; padding: 0 8px; font-size: 11px; }
#ptz-zoom { width: 100%; accent-color: var(--gold-500); }
.ptz-presets { display: flex; gap: 4px; flex-wrap: wrap; }
.ptz-presets .btn.has-preset { border-color: var(--gold-500); color: var(--gold-300); }
.ptz-presets #ptz-store[aria-pressed="true"] { background: var(--gold-500); color: #2a0710; }
.ptz-readout { margin: 0; font-size: 11px; color: var(--cream-dim); min-height: 1.3em; }
.ptz-hint { margin: 0; font-size: 11px; color: var(--text-mute); }
.ptz.is-disabled .dpad, .ptz.is-disabled .ptz-side, .ptz.is-disabled #ptz-zoom, .ptz.is-disabled .ptz-presets { opacity: 0.4; pointer-events: none; }
#pvw-host { cursor: grab; touch-action: none; }
#pvw-host.dragging { cursor: grabbing; }
#pvw-host.dragging .stage-video { transition: opacity 0.35s ease !important; }
.tile-frame { position: absolute; pointer-events: none; border: 2px dashed rgba(244, 213, 141, 0.9); border-radius: 2px; box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.25); }
.tile.is-pgm .tile-frame { border-color: var(--tally-pgm); border-style: solid; }

/* ---------------------------------------------------------------- side panels */
.panel { display: grid; gap: 8px; padding: 10px; border-radius: var(--r-md); background: var(--panel); border: 1px solid var(--line); }
.field { display: grid; gap: 4px; }
.field .label { font-size: 11px; color: var(--text-mute); }
.field textarea { resize: vertical; font-family: var(--f-ui); }
.ovl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.switch { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--r-sm); background: var(--panel-2); border: 1px solid var(--line); font-weight: 600; font-size: 13px; cursor: pointer; }
.switch input { accent-color: var(--gold-500); width: 16px; height: 16px; }

.screens { display: grid; gap: 6px; }
.scr { display: grid; gap: 6px; padding: 8px; border-radius: var(--r-sm); background: var(--panel-2); border: 1px solid var(--line); }
.scr-top { display: flex; align-items: center; gap: 8px; }
.scr-dot { width: 9px; height: 9px; border-radius: 50%; background: #555; flex: none; }
.scr.online .scr-dot { background: var(--tally-pvw); }
.scr-name { font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scr-state { font-family: var(--f-label); font-weight: 700; font-size: 11px; letter-spacing: 0.08em; padding: 2px 6px; border-radius: 4px; background: #3a2a2c; color: var(--cream-dim); text-transform: uppercase; }
.scr-state.st-live { background: var(--tally-pgm); color: #fff; }
.scr-state.st-standby { background: #3d3214; color: var(--gold-300); }
.scr-state.st-nosig { background: var(--warn); color: #2a1800; }
.scr-meta { font-size: 11px; color: var(--text-mute); }
.scr-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.scr-row label.feed { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12px; }
.scr-row select { font-size: 12px; padding: 4px 22px 4px 6px; max-width: 150px; }

.panel-log { max-height: 320px; grid-template-rows: auto 1fr; }
.log { margin: 0; padding: 0; list-style: none; overflow-y: auto; display: grid; gap: 2px; font-size: 12px; min-height: 80px; }
.log li { display: grid; grid-template-columns: 5.5ch 1fr; gap: 8px; padding: 3px 4px; border-radius: 4px; }
.log li:nth-child(odd) { background: rgba(255, 255, 255, 0.02); }
.log time { color: var(--text-mute); font-family: var(--f-mono); font-size: 11px; }
.log li.take span { color: #ff9aa0; }
.log li.alert span { color: var(--warn); }
.ver { margin: 0; text-align: center; font-size: 11px; color: var(--text-mute); }

/* ---------------------------------------------------------------- dialogs */
.dlg { border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--panel); color: var(--text); padding: 22px; width: min(440px, 92vw); }
.dlg::backdrop { background: rgba(0, 0, 0, 0.7); }
.dlg h2 { margin: 0 0 8px; font-family: var(--f-display); font-weight: 400; color: var(--gold-400); font-size: 26px; }
.dlg p { color: var(--cream-dim); }
.qr-box { display: grid; place-items: center; padding: 14px; background: #fff; border-radius: var(--r-md); }
.qr-box img { width: 260px; height: 260px; image-rendering: pixelated; }
.keys { width: 100%; border-collapse: collapse; margin: 6px 0 14px; }
.keys td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
kbd { display: inline-block; min-width: 1.8em; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line-strong); background: var(--panel-2); font-family: var(--f-mono); font-size: 12px; text-align: center; }

.blocker { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(8, 2, 4, 0.88); padding: 24px; }
.blocker-card { width: min(460px, 100%); display: grid; gap: 12px; padding: 26px; border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line-strong); text-align: center; }
.blocker-card h2 { margin: 0; font-family: var(--f-display); font-weight: 400; color: var(--gold-400); }
.blocker-card p { margin: 0; color: var(--cream-dim); }

/* ---------------------------------------------------------------- narrow */
@media (max-width: 1180px) {
  .app { height: auto; min-height: 100vh; }
  .workspace { grid-template-columns: 1fr; }
  .deck { grid-template-rows: auto auto auto; }
  .monitors { height: 46vw; min-height: 240px; }
  .side { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .tiles { overflow: visible; }
  .crew { margin-left: 0; }
  .topbar { flex-wrap: wrap; }
}
@media (max-width: 720px) {
  .monitors { grid-template-columns: 1fr; height: auto; }
  .monitor { height: 56vw; }
}
