:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f6f7fb;
  background: #090b10;
  font-synthesis: none;
  --panel: #11151d;
  --panel-2: #171c26;
  --border: #282f3c;
  --muted: #929caf;
  --red: #ff4057;
  --red-dark: #c9253a;
  --green: #35d07f;
  --yellow: #ffd34e;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 75% 0%, #1a2030 0, #090b10 35rem); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled, input:disabled, select:disabled { cursor: not-allowed; opacity: .45; }
.hidden { display: none !important; }

.topbar {
  height: 72px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(18px, 4vw, 48px); border-bottom: 1px solid var(--border);
  background: rgba(9, 11, 16, .86); backdrop-filter: blur(18px); position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); margin-top: 2px; }
.brand-mark { width: 30px; height: 30px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 7px rgba(255,64,87,.12); }

main { width: min(1500px, 100%); margin: 0 auto; padding: 28px clamp(16px, 3vw, 40px) 50px; }
.login-shell { min-height: calc(100vh - 128px); display: grid; place-items: center; }
.card { background: linear-gradient(145deg, rgba(23,28,38,.98), rgba(15,19,27,.98)); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 18px 60px rgba(0,0,0,.22); }
.login-card { width: min(430px, 100%); padding: 34px; }
h1 { font-size: clamp(30px, 6vw, 46px); margin: 6px 0 10px; letter-spacing: -.04em; }
h2 { margin: 0; font-size: 20px; }
.eyebrow { color: var(--red); font-size: 11px; font-weight: 800; letter-spacing: .16em; margin: 0 0 5px; }
.muted { color: var(--muted); line-height: 1.55; }
.hint { color: var(--muted); font-size: 12px; margin: 12px 0 0; line-height: 1.4; }
.error { min-height: 20px; color: #ff8d9a; margin: 12px 0 0; }

label { display: block; color: #cbd1dd; font-size: 13px; font-weight: 650; margin: 18px 0 7px; }
input:not([type="range"]), select {
  width: 100%; color: #f7f8fb; background: #0c0f15; border: 1px solid #313949;
  border-radius: 10px; padding: 12px 13px; outline: none;
}
input:focus, select:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(255,64,87,.13); }
input[type="range"] { width: 100%; accent-color: var(--red); }

.button { border: 1px solid transparent; border-radius: 10px; color: white; background: #252c38; padding: 10px 15px; font-weight: 750; transition: transform .15s, background .15s, border .15s; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button.primary { background: var(--red); }
.button.primary:hover { background: #ff5b6e; }
.button.secondary { background: #202632; border-color: #343d4d; }
.button.danger { background: transparent; color: #ff8390; border-color: #74303c; }
.button.ghost { background: transparent; border-color: var(--border); }
.button.talk.active { color: #111; background: var(--yellow); }
.button.wide { width: 100%; margin-top: 18px; }

.dashboard { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 22px; align-items: start; }
.sidebar { display: grid; gap: 18px; position: sticky; top: 100px; }
.device-card, .controls-card, .live-card, .recordings-card { padding: 20px; }
.status-row { display: flex; align-items: center; gap: 9px; margin-top: 18px; font-size: 14px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #697183; box-shadow: 0 0 0 5px rgba(105,113,131,.12); }
.status-dot.online { background: var(--green); box-shadow: 0 0 0 5px rgba(53,208,127,.12); }
#viewerCount { display: block; margin-top: 8px; }
.content { display: grid; gap: 22px; min-width: 0; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.section-title .eyebrow { margin-bottom: 4px; }
.pill { color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 6px 10px; font-size: 12px; }
.pill.online { color: var(--green); border-color: rgba(53,208,127,.35); }

.video-stage { position: relative; overflow: hidden; width: 100%; aspect-ratio: 16/9; min-height: 280px; background: #030405; border: 1px solid #242a34; border-radius: 14px; }
.video-stage video { width: 100%; height: 100%; object-fit: contain; background: #030405; }
.video-placeholder { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--muted); text-align: center; }
.video-placeholder strong { color: #dce1ea; }
.camera-icon { width: 58px; height: 40px; border: 3px solid #4c5566; border-radius: 8px; position: relative; margin-bottom: 8px; }
.camera-icon::after { content: ""; position: absolute; right: -16px; top: 8px; border-style: solid; border-width: 9px 14px 9px 0; border-color: transparent #4c5566 transparent transparent; transform: rotate(180deg); }
.focus-marker { position: absolute; width: 56px; height: 56px; border: 2px solid var(--yellow); border-radius: 7px; transform: translate(-50%, -50%); pointer-events: none; animation: focus-pulse 1.1s ease-out; }
@keyframes focus-pulse { 0% { transform: translate(-50%,-50%) scale(1.35); opacity: .4; } 35% { transform: translate(-50%,-50%) scale(1); opacity: 1; } 100% { opacity: .2; } }
.live-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.status-message { min-height: 22px; margin: 10px 0 0; font-size: 13px; }
.recordings-list { display: grid; gap: 8px; margin-top: 15px; }
.recordings-list.empty { border: 1px dashed #343c49; border-radius: 12px; padding: 24px; color: var(--muted); text-align: center; }
.recording-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #0d1118; border: 1px solid #272e3a; border-radius: 11px; padding: 11px 13px; }
.recording-row small { color: var(--muted); display: block; margin-top: 3px; }
.recording-row.active { border-color: var(--red); box-shadow: 0 0 0 1px rgba(255,64,87,.35) inset; }
.day-header { margin: 14px 0 2px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }

.facts { display: grid; gap: 7px; margin: 16px 0 0; font-size: 12.5px; }
.facts div { display: flex; justify-content: space-between; gap: 10px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

.pill.recording { color: var(--red); border-color: rgba(255,64,87,.45); }
.title-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toggle { display: inline-flex; align-items: center; gap: 7px; margin: 0; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.toggle input { width: auto; accent-color: var(--red); }

.stage-tools { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; }
.icon-button {
  min-width: 36px; height: 32px; padding: 0 9px; color: #eef1f6;
  background: rgba(9, 11, 16, .68); border: 1px solid rgba(255,255,255,.14);
  border-radius: 9px; font-size: 13px; font-weight: 700; backdrop-filter: blur(8px);
}
.icon-button:hover:not(:disabled) { background: rgba(9, 11, 16, .9); }
.icon-button[aria-pressed="true"] { color: #111; background: var(--yellow); }
.stats-overlay {  position: absolute; left: 10px; bottom: 10px; margin: 0; padding: 10px 12px;
  color: #d9e0ec; background: rgba(6, 8, 12, .82); border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px; line-height: 1.5; white-space: pre; pointer-events: none;
}

.diagnostics {
  margin: 12px 0 0; padding: 11px 12px; overflow-x: auto;
  color: #d9e0ec; background: #0c0f15; border: 1px solid #272e3a; border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px;
  line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}

.player-shell { display: grid; gap: 10px; margin: 16px 0 20px; }
.recording-player { width: 100%; max-height: 520px; background: black; border-radius: 12px; }
.timeline { position: relative; height: 22px; }
.timeline-track { position: absolute; inset: 8px 0; border-radius: 999px; background: #1d2431; overflow: hidden; }
.timeline-transfer, .timeline-buffered, .timeline-played { position: absolute; top: 0; bottom: 0; left: 0; width: 0; }
.timeline-transfer { background: #253045; }
.timeline-buffered { background: #37445c; }
.timeline-played { background: var(--red); }
.timeline input[type="range"] {
  position: absolute; inset: 0; width: 100%; height: 22px; margin: 0;
  background: transparent; -webkit-appearance: none; appearance: none;
}
.timeline input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: white; border: 2px solid var(--red); cursor: pointer;
}
.timeline input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; background: white;
  border: 2px solid var(--red); cursor: pointer;
}
.timeline input[type="range"]::-moz-range-track { background: transparent; }
.player-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.player-bar select { width: auto; padding: 7px 9px; }
.player-bar output { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.player-spacer { flex: 1 1 auto; }
.transfer-bar { height: 5px; border-radius: 999px; background: #1d2431; overflow: hidden; }
.transfer-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--red), var(--yellow)); transition: width .2s linear; }

.archive-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.field { display: grid; gap: 6px; min-width: 190px; }
.field span { color: var(--muted); font-size: 12px; font-weight: 650; }

@media (max-width: 880px) {
  .dashboard { grid-template-columns: 1fr; }
  .sidebar { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .video-stage { min-height: 220px; }
}
@media (max-width: 580px) {
  .sidebar { grid-template-columns: 1fr; }
  .topbar { height: 64px; }
  main { padding-top: 16px; }
  .live-actions .button { flex: 1 1 100%; }
  .video-stage { aspect-ratio: 3/4; min-height: 320px; }
}
