/* ==========================================================================
   AUTOREAL CAMS — MASTER CONTROL ROOM (MCR) BROADCAST DESIGN SYSTEM
   Professional TV Studio & Switcher Interface
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  /* Surface & Chroma Palette */
  --bg-app: #080b11;
  --bg-panel: #0e131d;
  --bg-panel-header: #121824;
  --bg-card: #131a26;
  --bg-card-hover: #172030;
  --bg-input: #0a0e16;
  --bg-active-card: #182235;

  /* Borders & Dividers */
  --border-subtle: #192233;
  --border-card: #202b40;
  --border-focus: #0284c7;
  --border-active-pgm: #ff1e42;

  /* Broadcast Tally & Status Colors */
  --tally-pgm: #ff1e42;          /* Program / Live On-Air Red */
  --tally-pgm-glow: rgba(255, 30, 66, 0.4);
  --tally-pvw: #10b981;          /* Preview / Standby Green */
  --tally-pvw-glow: rgba(16, 185, 129, 0.3);
  --tally-amber: #f59e0b;        /* Warning / Standby Amber */
  --tally-cyan: #00e5ff;         /* AI Vision / Telemetry Cyan */
  --tally-cyan-glow: rgba(0, 229, 255, 0.3);
  --tally-purple: #a855f7;       /* SkyLog Purple */

  /* Text & Metrics */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-dim: #475569;
  --text-accent: #38bdf8;

  /* Geometry & Physics */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-panel: 0 4px 20px -2px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border-subtle);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.4);

  /* Fonts */
  --font-ui: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-app);
  background-image: 
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(2, 132, 199, 0.08), transparent 70%),
    linear-gradient(rgba(25, 34, 51, 0.15) 1px, transparent 1px),
    linear-gradient(90deg, rgba(25, 34, 51, 0.15) 1px, transparent 1px);
  background-size: 100% 100%, 32px 32px, 32px 32px;
  color: var(--text-primary);
  font-family: var(--font-ui);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   TOP MASTER CONTROL HEADER
   ========================================================================== */
.app-header {
  height: 56px;
  background: var(--bg-panel-header);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.station-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.station-logo {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 0 12px rgba(2, 132, 199, 0.35);
  position: relative;
}

.station-logo .live-beacon {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: var(--tally-pgm);
  border-radius: 50%;
  border: 1.5px solid var(--bg-panel-header);
  animation: pulse-beacon 1.4s infinite;
}

@keyframes pulse-beacon {
  0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(255, 30, 66, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 5px rgba(255, 30, 66, 0); }
  100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(255, 30, 66, 0); }
}

.station-info {
  display: flex;
  flex-direction: column;
}

.station-info h1 {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  text-transform: uppercase;
  line-height: 1.1;
}

.station-info .station-subtitle {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Central Hardware Tally Cluster */
.header-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  background: rgba(10, 14, 22, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

.status-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--text-dim);
  transition: var(--transition-fast);
}

/* Tally Live States */
.status-badge.running {
  border-color: rgba(255, 30, 66, 0.4);
  background: rgba(255, 30, 66, 0.08);
  color: #fecdd3;
}
.status-badge.running .dot {
  background-color: var(--tally-pgm);
  box-shadow: 0 0 8px var(--tally-pgm);
  animation: pulse-beacon 1s infinite;
}

.status-badge.connected {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.08);
  color: #a7f3d0;
}
.status-badge.connected .dot {
  background-color: var(--tally-pvw);
  box-shadow: 0 0 6px var(--tally-pvw);
}

/* Master Audio VAD Badge */
.status-badge.audio-speaking {
  border-color: rgba(0, 229, 255, 0.4);
  background: rgba(0, 229, 255, 0.08);
  color: #a5f3fc;
}
.status-badge.audio-speaking .dot {
  background-color: var(--tally-cyan);
  box-shadow: 0 0 8px var(--tally-cyan);
}

.status-badge.audio-noise {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.08);
  color: #fde68a;
}
.status-badge.audio-noise .dot {
  background-color: var(--tally-amber);
}

.status-badge.audio-disabled {
  opacity: 0.5;
  filter: grayscale(1);
}

/* Segmented Audio Mini-Meter */
.audio-mini-meter {
  width: 36px;
  height: 6px;
  background: #000;
  border: 1px solid var(--border-subtle);
  border-radius: 2px;
  overflow: hidden;
  margin-left: 2px;
  display: flex;
}

.audio-meter-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #f59e0b 70%, #ff1e42 100%);
  transition: width 0.08s ease-out;
}

/* Tool Buttons (Settings / Preset) */
.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-icon:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
  color: var(--text-primary);
}

/* ==========================================================================
   MAIN DUAL-DECK LAYOUT
   ========================================================================== */
.main-container {
  flex: 1;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 12px;
  padding: 12px;
  overflow: hidden;
}

/* Command Deck Panels */
.panel {
  background-color: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  padding: 14px;
  overflow-y: auto;
  box-shadow: var(--shadow-panel);
}

.panel::-webkit-scrollbar {
  width: 5px;
}
.panel::-webkit-scrollbar-track {
  background: transparent;
}
.panel::-webkit-scrollbar-thumb {
  background: var(--border-card);
  border-radius: 3px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.panel-header h2 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   LEFT DECK: AI DIRECTOR COMMAND & SOURCES
   ========================================================================== */

/* Talkback / Intercom Mic Unit */
.voice-section {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 12px;
}

.mic-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-mic {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 1px solid #334155;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

.btn-mic:hover {
  background: #1e293b;
  border-color: var(--border-focus);
  color: var(--text-accent);
}

.btn-mic.recording {
  background: linear-gradient(135deg, #991b1b, #ef4444);
  border-color: #f87171;
  color: #fff;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.6);
  animation: mic-pulse 1s infinite alternate;
}

@keyframes mic-pulse {
  0% { transform: scale(0.97); }
  100% { transform: scale(1.03); }
}

.mic-status {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mic-status #mic-label {
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

/* Audio Waveform Spectrum */
.waveform {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 14px;
}

.waveform span {
  width: 3px;
  height: 4px;
  background: #334155;
  border-radius: 1px;
  transition: height 0.1s ease;
}

.waveform.active span {
  background: var(--tally-cyan);
  animation: wave-bounce 0.8s infinite ease-in-out;
}

.waveform.active span:nth-child(1) { animation-delay: 0.0s; }
.waveform.active span:nth-child(2) { animation-delay: 0.15s; }
.waveform.active span:nth-child(3) { animation-delay: 0.3s; }
.waveform.active span:nth-child(4) { animation-delay: 0.45s; }
.waveform.active span:nth-child(5) { animation-delay: 0.6s; }

@keyframes wave-bounce {
  0%, 100% { height: 4px; }
  50% { height: 14px; }
}

/* Prompt Console Field */
.field-group {
  margin-bottom: 12px;
}

.field-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.label-with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

textarea#prompt-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-primary);
  resize: vertical;
  min-height: 72px;
  transition: var(--transition-fast);
  outline: none;
}

textarea#prompt-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

/* Source Checklist Matrix */
.camera-checklist {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 170px;
  overflow-y: auto;
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 6px;
}

.cam-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  background: var(--bg-card);
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  transition: var(--transition-fast);
}

.cam-item:hover {
  border-color: var(--border-card);
  background: var(--bg-card-hover);
}

.cam-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 600;
}

.cam-item-left input[type="checkbox"] {
  accent-color: var(--border-focus);
  cursor: pointer;
}

.cam-item-tags {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cam-badge-tag {
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 2px;
  text-transform: uppercase;
}

.tag-stream {
  background: rgba(2, 132, 199, 0.15);
  color: #7dd3fc;
  border: 1px solid rgba(2, 132, 199, 0.3);
}

.tag-local {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.tag-skylog {
  background: rgba(168, 85, 247, 0.15);
  color: #d8b4fe;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.ptz-badge-chip {
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 2px 4px;
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 2px;
}

.cam-item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Micro Buttons */
.btn-small {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-small:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
  color: var(--text-primary);
}

.btn-icon-xs {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  width: 22px;
  height: 22px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
}

.btn-icon-xs:hover {
  border-color: var(--border-card);
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
}

/* Loop Cadence Slider */
.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.slider-value {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-accent);
}

input[type="range"] {
  width: 100%;
  height: 4px;
  background: #1e293b;
  border-radius: 2px;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 2px;
  background: #0284c7;
  border: 1px solid #38bdf8;
  box-shadow: 0 0 6px rgba(2, 132, 199, 0.6);
  cursor: pointer;
}

.field-help {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.35;
}

/* Master Illuminated Push Buttons */
.action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 10px 14px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition-fast);
}

/* TAKE (Démarrer) Button */
.btn-primary {
  background: linear-gradient(180deg, #059669 0%, #047857 100%);
  border-color: #34d399;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 2px 8px rgba(5, 150, 105, 0.35);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.5);
}

/* CUT (Arrêter) Button */
.btn-danger {
  background: linear-gradient(180deg, #dc2626 0%, #b91c1c 100%);
  border-color: #f87171;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 2px 8px rgba(220, 38, 38, 0.35);
}

.btn-danger:hover:not(:disabled) {
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.5);
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  filter: grayscale(0.8);
  box-shadow: none;
}

.btn-secondary {
  background: var(--bg-card);
  border-color: var(--border-card);
  color: var(--text-secondary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
  color: var(--text-primary);
}

.btn-full {
  width: 100%;
}

/* ==========================================================================
   RIGHT DECK: MULTI-VIEW & TELEMETRY
   ========================================================================== */
.panel-cameras {
  display: flex;
  flex-direction: column;
}

.stream-mode-toggle {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 2px;
  gap: 2px;
}

.btn-toggle {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 2px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-toggle.active {
  background: var(--bg-card);
  color: var(--text-accent);
  border: 1px solid var(--border-card);
}

/* Master Tally Box */
.active-cam-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background: rgba(255, 30, 66, 0.12);
  color: #ff4d6d;
  border: 1px solid rgba(255, 30, 66, 0.4);
  box-shadow: 0 0 10px rgba(255, 30, 66, 0.2);
}

/* Camera Viewport Grid */
.camera-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
  flex: 1;
  overflow-y: auto;
  margin-bottom: 10px;
}

/* Individual Camera Card with Physical Tally Bezel */
.cam-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-card);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: var(--transition-fast);
}

.cam-card:hover {
  border-color: #334155;
}

/* Active On-Air Tally Frame */
.cam-card.is-active {
  border-color: var(--tally-pgm);
  box-shadow: 0 0 16px var(--tally-pgm-glow), inset 0 0 0 1px var(--tally-pgm);
}

/* Solo Audio Preview Tally Frame (1st Click) */
.cam-card.is-preview:not(.is-active) {
  border-color: #38bdf8;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.4), inset 0 0 0 1px #38bdf8;
}

.cam-preview-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cam-video, .cam-canvas, .cam-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Tally Status Badges on Viewport */
.cam-badge-live {
  position: absolute;
  top: 6px;
  left: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.7);
  color: #64748b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 2;
  transition: var(--transition-fast);
}

.cam-card.is-active .cam-badge-live {
  background: var(--tally-pgm);
  color: #fff;
  border-color: #ff4d6d;
  box-shadow: 0 0 8px rgba(255, 30, 66, 0.8);
}

.cam-badge-pvw {
  position: absolute;
  top: 6px;
  left: 48px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 2px;
  background: #0284c7;
  color: #fff;
  border: 1px solid #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.7);
  z-index: 2;
  display: none;
}

.cam-card.is-preview:not(.is-active) .cam-badge-pvw {
  display: block;
}

.cam-badge-loud-audio {
  position: absolute;
  top: 6px;
  right: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 2px;
  background: rgba(255, 0, 85, 0.95);
  color: #fff;
  border: 1px solid #ff4d6d;
  box-shadow: 0 0 12px rgba(255, 0, 85, 0.8);
  display: none;
  z-index: 3;
  animation: strobe-alert 0.3s infinite alternate;
}

.cam-badge-loud-audio.active {
  display: block;
}

@keyframes strobe-alert {
  0% { opacity: 0.7; transform: scale(0.96); }
  100% { opacity: 1; transform: scale(1.04); }
}

.cam-no-signal {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  padding: 10px;
}

/* Camera Footer Info Bar */
.cam-info-bar {
  padding: 8px 10px;
  background: var(--bg-panel-header);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cam-title-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.cam-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Integrated VU-Meter & dB Readout */
.cam-audio-meter-widget {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cam-audio-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 2px;
  background: rgba(0,0,0,0.5);
  color: var(--text-dim);
  border: 1px solid var(--border-subtle);
}

.cam-audio-badge.speaking {
  background: rgba(0, 229, 255, 0.15);
  color: #67e8f9;
  border-color: rgba(0, 229, 255, 0.4);
}

.cam-audio-badge.noise {
  background: rgba(245, 158, 11, 0.15);
  color: #fde047;
  border-color: rgba(245, 158, 11, 0.4);
}

.cam-audio-badge.loud {
  background: rgba(255, 0, 85, 0.25);
  color: #fda4af;
  border-color: #ff0055;
}

.cam-audio-vu-track {
  width: 50px;
  height: 5px;
  background: #000;
  border: 1px solid var(--border-subtle);
  border-radius: 1px;
  overflow: hidden;
}

.cam-audio-vu-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #eab308 70%, #ff1e42 100%);
  transition: width 0.08s ease-out;
}

.cam-audio-db {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  min-width: 32px;
  text-align: right;
}

/* Camera Action Buttons (TAKE / MUTE) */
.cam-action-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.btn-cam-mute {
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  font-size: 11px;
  width: 26px;
  height: 24px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-cam-mute.is-unmuted {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
  color: #34d399;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.3);
}

.btn-cam-mute.is-muted {
  background: var(--bg-input);
  border-color: var(--border-subtle);
  color: var(--text-dim);
  opacity: 0.6;
}

.btn-cam-mute:hover {
  background: #1e293b;
  border-color: var(--border-focus);
  opacity: 1;
}

.btn-manual-switch {
  background: #1e293b;
  border: 1px solid #334155;
  color: #f1f5f9;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-manual-switch:hover {
  background: #0284c7;
  border-color: #38bdf8;
  color: #fff;
  box-shadow: 0 0 8px rgba(2, 132, 199, 0.4);
}

.cam-card.is-active .btn-manual-switch {
  background: #991b1b;
  border-color: #f87171;
  color: #fff;
}

/* PTZ Motorized Panel Deck */
.ptz-panel {
  padding: 8px 10px;
  background: #090d14;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ptz-header {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.ptz-dpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  max-width: 90px;
  margin: 0 auto;
}

.ptz-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  font-size: 10px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.ptz-btn:hover {
  background: #1e293b;
  border-color: var(--border-focus);
  color: #fff;
}

.ptz-btn.active {
  background: #0284c7;
  border-color: #38bdf8;
  color: #fff;
}

/* Telemetry Diagnostics Cluster */
.telemetry-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.metric-item {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xs);
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
}

.metric-item.highlight .metric-value {
  color: var(--text-accent);
}

/* AI Director Cognitive Console */
.console-box {
  background: #07090e;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  min-height: 85px;
  max-height: 200px;
  resize: vertical;
  overflow: hidden;
}

.console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-subtle);
}

.console-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.console-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 2px;
  background: rgba(2, 132, 199, 0.15);
  color: #7dd3fc;
  border: 1px solid rgba(2, 132, 199, 0.3);
}

.console-text {
  flex: 1;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.4;
  color: #cbd5e1;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Warning Banner */
.warning-banner {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-xs);
  padding: 6px 10px;
  font-size: 11px;
  color: #fde68a;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

/* ==========================================================================
   BOTTOM PANEL: SWITCHING HISTORY TIMELINE
   ========================================================================== */
.history-panel {
  height: 48px;
  background: var(--bg-panel-header);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  flex-shrink: 0;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

.history-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  white-space: nowrap;
}

.history-count {
  color: var(--text-accent);
}

.history-timeline {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0;
}

.history-timeline::-webkit-scrollbar {
  height: 3px;
}
.history-timeline::-webkit-scrollbar-thumb {
  background: var(--border-card);
}

.history-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  white-space: nowrap;
}

.history-item .hist-cam {
  font-weight: 700;
  color: var(--text-primary);
}

.history-item .hist-time {
  color: var(--text-dim);
}

.history-empty {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
}

/* ==========================================================================
   MODAL DIALOGS (STUDIO SETTINGS & CAM EDIT)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 13, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-overlay.open {
  display: flex;
}

.modal-content {
  background: var(--bg-panel);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 580px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255,255,255,0.05);
  animation: modal-enter 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-enter {
  0% { transform: scale(0.96) translateY(8px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  padding: 14px 18px;
  background: var(--bg-panel-header);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 2px;
}

.btn-close:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

.modal-body {
  padding: 18px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 12px 18px;
  background: var(--bg-panel-header);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* Modal Inputs & Selects */
input[type="text"],
input[type="number"],
input[type="password"],
select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xs);
  padding: 7px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition-fast);
}

input:focus, select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

.divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 14px 0;
}

/* Custom Checkbox Labels */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-primary);
}

.checkbox-label input[type="checkbox"] {
  accent-color: var(--border-focus);
  width: 14px;
  height: 14px;
  cursor: pointer;
}
