:root, body[data-theme="cyan"] {
  --bg-dark: #070a10;
  --bg-surface: #0f1523;
  --bg-surface-elevated: #162033;
  --bg-control: #1e2b44;
  --bg-control-hover: #293a5c;
  --bg-control-active: #344a75;

  --accent-primary: #00d2ff;
  --accent-primary-hover: #33dcff;
  --accent-glow: rgba(0, 210, 255, 0.3);
  --accent-amber: #ffaa00;
  --accent-red: #ff3b5c;
  --accent-green: #00e676;

  --text-primary: #f0f4fc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --border-subtle: #1e293b;
  --border-prominent: #334155;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --transition-fast: 0.15s ease;
}

body[data-theme="amber"] {
  --bg-dark: #0c0904;
  --bg-surface: #171208;
  --bg-surface-elevated: #241c0e;
  --bg-control: #332815;
  --bg-control-hover: #48381d;
  --bg-control-active: #5c4826;
  --accent-primary: #ffaa00;
  --accent-primary-hover: #ffbb33;
  --accent-glow: rgba(255, 170, 0, 0.35);
  --border-subtle: #2d2315;
  --border-prominent: #48381d;
}

body[data-theme="obsidian"] {
  --bg-dark: #08090d;
  --bg-surface: #10121a;
  --bg-surface-elevated: #181c29;
  --bg-control: #23283b;
  --bg-control-hover: #2f364f;
  --bg-control-active: #3d4666;
  --accent-primary: #818cf8;
  --accent-primary-hover: #9ca3af;
  --accent-glow: rgba(129, 140, 248, 0.3);
  --border-subtle: #1e2436;
  --border-prominent: #2f3854;
}

body[data-theme="green"] {
  --bg-dark: #040d06;
  --bg-surface: #09170c;
  --bg-surface-elevated: #102414;
  --bg-control: #18331d;
  --bg-control-hover: #214527;
  --bg-control-active: #2c5933;
  --accent-primary: #00ff66;
  --accent-primary-hover: #33ff85;
  --accent-glow: rgba(0, 255, 102, 0.35);
  --border-subtle: #18301d;
  --border-prominent: #264a2e;
}

body[data-theme="red"] {
  --bg-dark: #0d0406;
  --bg-surface: #17080b;
  --bg-surface-elevated: #240d12;
  --bg-control: #33131a;
  --bg-control-hover: #471b25;
  --bg-control-active: #5c2330;
  --accent-primary: #ff3366;
  --accent-primary-hover: #ff5c85;
  --accent-glow: rgba(255, 51, 102, 0.35);
  --border-subtle: #33141b;
  --border-prominent: #4d1e29;
}

body[data-theme="purple"] {
  --bg-dark: #0a0512;
  --bg-surface: #140b24;
  --bg-surface-elevated: #1f1136;
  --bg-control: #2b184a;
  --bg-control-hover: #3a2163;
  --bg-control-active: #4a2a7e;
  --accent-primary: #a855f7;
  --accent-primary-hover: #bf7fff;
  --accent-glow: rgba(168, 85, 247, 0.35);
  --border-subtle: #2a1847;
  --border-prominent: #40246d;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font-sans);
  height: 100vh;
  width: 100vw;
  max-width: 100vw;
  overflow-x: hidden;
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

/* Header */
.app-header {
  height: 52px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 50;
  overflow: visible;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 1;
  min-width: 0;
  overflow: visible;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

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

.camera-lens-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle, #1a2333 40%, #0d121c 100%);
  border: 2px solid var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 0 10px var(--accent-glow);
}

.lens-inner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 210, 255, 0.6);
  background: #060910;
}

.lens-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #00d2ff;
  position: absolute;
  top: 8px;
  right: 8px;
}

.brand {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--text-primary);
}

.brand-subtitle {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--accent-primary);
  margin-top: -2px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface-elevated);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  font-size: 11px;
  max-width: 140px;
  min-width: 0;
  flex-shrink: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.connected {
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.status-dot.disconnected {
  background: var(--accent-red);
}

.status-dot.connecting {
  background: var(--accent-amber);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.4; }
}

.status-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-details {
  display: none; /* Hidden to protect toolbar from horizontal overflow */
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

/* Header Buttons */
.quality-selector {
  display: flex;
  background: var(--bg-surface-elevated);
  padding: 3px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.pill-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition-fast);
}

.pill-btn.active {
  background: var(--accent-primary);
  color: #030814;
  font-weight: 700;
  box-shadow: 0 0 8px var(--accent-glow);
}

.icon-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition-fast);
}

.icon-btn:hover {
  background: var(--bg-control-hover);
  border-color: var(--border-prominent);
}

/* Main Content Layout - 100% Edge-to-Edge Screen Fill */
.main-content {
  flex: 1;
  position: relative;
  width: 100vw;
  height: calc(100vh - 60px);
  overflow: hidden;
  margin: 0;
  padding: 0;
}

.single-view-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  overflow: hidden;
}

/* Video Section - Full Screen Bleed */
.video-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #000;
  overflow: hidden;
}

.video-wrapper {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}

video {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Default to 100% screen fill: ZERO black bars! */
  display: block;
}

video.fit {
  object-fit: contain;
}

/* Floating Quick Status Bar */
.quick-status-bar {
  position: absolute;
  bottom: 68px;
  left: 20px;
  z-index: 20;
  display: flex;
  gap: 14px;
  background: rgba(10, 13, 20, 0.75);
  backdrop-filter: blur(10px);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  pointer-events: none;
  font-size: 11px;
}

/* Video Overlay States */
.video-overlay-state {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 13, 20, 0.88);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: opacity 0.3s;
}

.video-overlay-state.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(0, 210, 255, 0.2);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.state-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* OSD Overlay */
.osd-bar {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  z-index: 5;
  pointer-events: none;
}

.osd-bar.top {
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, transparent 100%);
}

.osd-badge.live {
  background: rgba(255, 59, 92, 0.25);
  border: 1px solid var(--accent-red);
  color: var(--accent-red);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 6px;
}

.rec-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-red);
  animation: pulse 1s infinite;
}

.osd-info {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.osd-timestamp {
  font-family: var(--font-mono);
  font-size: 13px;
  color: #ddd;
  margin-left: auto;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.video-controls-overlay {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  gap: 10px;
  z-index: 8;
}

.osd-btn {
  background: rgba(24, 32, 48, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition-fast);
}

.osd-btn:hover {
  background: rgba(0, 210, 255, 0.25);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}

.osd-btn:active {
  transform: translateY(0);
}

/* Shutter flash */
.shutter-flash {
  position: absolute;
  inset: 0;
  background: white;
  opacity: 0;
  pointer-events: none;
  z-index: 15;
  transition: opacity 0.08s ease-out;
}

.shutter-flash.flash {
  opacity: 0.85;
}

/* Quick Status Bar */
.quick-status-bar {
  height: 36px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 20px;
}

.quick-info {
  font-size: 12px;
  display: flex;
  gap: 6px;
}

.info-label {
  color: var(--text-muted);
}

.info-val {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-weight: 500;
}

/* Controls Sidebar */
.controls-sidebar {
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.control-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card-header h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  color: var(--text-secondary);
}

.header-badge {
  font-size: 10px;
  background: var(--bg-control);
  color: var(--accent-primary);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}

.header-action-btn {
  background: none;
  border: none;
  color: var(--accent-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.header-action-btn:hover {
  text-decoration: underline;
}

/* PTZ D-PAD */
.dpad-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.dpad-grid {
  width: 200px;
  height: 200px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 6px;
  padding: 6px;
  background: var(--bg-dark);
  border-radius: 50%;
  border: 2px solid var(--border-subtle);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.5);
}

.dpad-btn {
  background: var(--bg-control);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.1s ease;
  touch-action: manipulation;
}

.dpad-btn svg {
  width: 20px;
  height: 20px;
}

.dpad-btn.diag svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.dpad-btn:hover {
  background: var(--bg-control-hover);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.dpad-btn:active, .dpad-btn.active {
  background: var(--accent-primary);
  color: #030814;
  border-color: var(--accent-primary);
  box-shadow: 0 0 12px var(--accent-glow);
  transform: scale(0.95);
}

.dpad-btn.center-btn {
  background: #141c2c;
  border-radius: 50%;
}

.stop-icon {
  width: 12px;
  height: 12px;
  background: var(--accent-red);
  border-radius: 2px;
}

.dpad-btn.center-btn:hover .stop-icon {
  transform: scale(1.1);
}

/* Zoom Cluster */
.zoom-cluster {
  width: 100%;
}

.cluster-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.zoom-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.zoom-btn {
  background: var(--bg-control);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition-fast);
}

.zoom-btn:hover {
  background: var(--bg-control-hover);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.zoom-btn:active, .zoom-btn.active {
  background: var(--accent-primary);
  color: #030814;
  box-shadow: 0 0 12px var(--accent-glow);
}

/* Speed Slider */
.speed-slider-group {
  margin-top: 14px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 6px;
}

.slider-header label {
  color: var(--text-secondary);
}

.slider-header span {
  font-family: var(--font-mono);
  color: var(--accent-primary);
  font-weight: 600;
}

input[type="range"] {
  width: 100%;
  height: 6px;
  background: var(--bg-dark);
  border-radius: var(--radius-full);
  outline: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  box-shadow: 0 0 6px var(--accent-glow);
  transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

/* Focus Group */
.focus-group {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.btn-group-3 {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1fr;
  gap: 6px;
}

.secondary-btn {
  background: var(--bg-control);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: center;
}

.secondary-btn:hover {
  background: var(--bg-control-hover);
  border-color: var(--border-prominent);
}

.secondary-btn.accent {
  background: rgba(0, 210, 255, 0.15);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.secondary-btn.accent:hover {
  background: var(--accent-primary);
  color: #030814;
}

/* Presets List */
.presets-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
}

.preset-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-dark);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  transition: var(--transition-fast);
}

.preset-item:hover {
  border-color: var(--border-prominent);
}

.preset-info {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  flex: 1;
}

.preset-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-primary);
  background: rgba(0, 210, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

.preset-name {
  font-size: 12px;
  font-weight: 500;
}

.preset-actions {
  display: flex;
  gap: 6px;
}

.mini-btn {
  background: var(--bg-control);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
}

.mini-btn:hover {
  background: var(--bg-control-hover);
  color: var(--text-primary);
}

.mini-btn.go {
  background: var(--accent-primary);
  color: #030814;
  font-weight: 700;
  border-color: var(--accent-primary);
}

.mini-btn.del:hover {
  background: var(--accent-red);
  color: #fff;
}

/* Hardware Controls */
.night-vision-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.row-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.btn-toggle-group {
  display: flex;
  background: var(--bg-dark);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.toggle-opt {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
}

.toggle-opt.active {
  background: var(--bg-control-active);
  color: var(--text-primary);
  font-weight: 600;
}

.danger-outline-btn {
  background: none;
  border: 1px solid rgba(255, 59, 92, 0.4);
  color: var(--accent-red);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  justify-content: center;
}

.danger-outline-btn:hover {
  background: rgba(255, 59, 92, 0.15);
  border-color: var(--accent-red);
}

.mt-3 { margin-top: 12px; }

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-prominent);
  border-radius: var(--radius-lg);
  width: 520px;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
  transform: translateY(10px);
  transition: transform 0.2s ease;
}

.modal-card.wide {
  width: 780px;
}

.modal-card.qr-suite-modal {
  width: 1040px;
  max-width: 95vw;
}

.modal-backdrop.open .modal-card {
  transform: translateY(0);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 700;
}

.gallery-header-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.gallery-header-meta code {
  font-family: var(--font-mono);
  color: var(--accent-primary);
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}

.modal-close-btn:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

/* Forms */
.network-scanner-banner {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.scanner-text {
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.scanner-text strong {
  color: var(--text-primary);
}

.scanner-text span {
  color: var(--text-muted);
}

.discovered-cameras-list {
  background: var(--bg-dark);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px;
  margin-bottom: 16px;
  max-height: 140px;
  overflow-y: auto;
}

.discovered-cam-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.discovered-cam-item:hover {
  background: var(--bg-surface-elevated);
}

.discovered-cam-item button {
  background: var(--accent-primary);
  border: none;
  color: #030814;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
}

.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.form-group.flex-2 { flex: 2; }

label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

input[type="text"],
input[type="password"],
input[type="number"] {
  background: var(--bg-dark);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-mono);
  outline: none;
}

input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 1px var(--accent-primary);
}

.password-field {
  position: relative;
  display: flex;
}

.password-field input {
  width: 100%;
  padding-right: 50px;
}

.pw-toggle-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
}

.test-result-box {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  margin-bottom: 14px;
  font-family: var(--font-mono);
}

.test-result-box.success {
  background: rgba(0, 230, 118, 0.15);
  border: 1px solid var(--accent-green);
  color: var(--accent-green);
}

.test-result-box.error {
  background: rgba(255, 59, 92, 0.15);
  border: 1px solid var(--accent-red);
  color: var(--accent-red);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

.primary-btn {
  background: var(--accent-primary);
  border: none;
  color: #030814;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
}

.primary-btn:hover {
  background: var(--accent-primary-hover);
  box-shadow: 0 0 10px var(--accent-glow);
}

/* Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.gallery-item {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: #000;
  aspect-ratio: 16/9;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  opacity: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px;
  transition: opacity 0.15s;
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
}

.gallery-time {
  font-size: 10px;
  color: #fff;
  font-family: var(--font-mono);
}

.gallery-item-actions {
  display: flex;
  gap: 6px;
}

.gallery-btn {
  background: var(--accent-primary);
  color: #030814;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}

.toast {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-prominent);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  box-shadow: 0 6px 16px rgba(0,0,0,0.4);
  font-size: 13px;
  animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
  from { transform: translateX(50px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Record Pill Button */
.record-btn-pill {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-prominent);
  color: var(--text-primary);
  padding: 5px 14px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
}

.record-btn-pill:hover {
  background: var(--bg-control-hover);
  border-color: var(--accent-red);
}

.record-btn-pill.recording {
  background: rgba(255, 59, 92, 0.2);
  border-color: var(--accent-red);
  color: var(--accent-red);
}

.rec-icon-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-red);
}

.record-btn-pill.recording .rec-icon-dot {
  animation: pulse 0.8s infinite;
}

/* AI Tracking Canvas */
.ai-overlay-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}

/* Motion Alert Banner */
.motion-alert-banner {
  position: absolute;
  top: 48px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(17, 22, 34, 0.95);
  backdrop-filter: blur(8px);
  border: 1.5px solid var(--accent-red);
  box-shadow: 0 8px 24px rgba(255, 59, 92, 0.35);
  border-radius: var(--radius-full);
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 12;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.motion-alert-banner.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.alert-icon {
  font-size: 18px;
}

.alert-text {
  display: flex;
  flex-direction: column;
}

.alert-text strong {
  font-size: 12px;
  color: var(--accent-red);
  letter-spacing: 0.5px;
}

.alert-text span {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.alert-rec-badge {
  background: var(--accent-red);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

/* OSD Badges */
.osd-badge.rec {
  background: rgba(255, 59, 92, 0.25);
  border: 1px solid var(--accent-red);
  color: var(--accent-red);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 6px;
}

.osd-badge.ai {
  background: rgba(0, 210, 255, 0.15);
  border: 1px solid var(--accent-primary);
  color: var(--accent-primary);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-primary);
  box-shadow: 0 0 6px var(--accent-primary);
}

/* Light / Spotlight Buttons */
.light-mode-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.light-btn {
  background: var(--bg-control);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.light-btn:hover {
  background: var(--bg-control-hover);
  border-color: var(--border-prominent);
  color: var(--text-primary);
}

.light-btn.active {
  background: rgba(0, 210, 255, 0.15);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-glow);
}

/* Toggle Switches */
.setting-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toggle-meta {
  display: flex;
  flex-direction: column;
}

.toggle-meta strong {
  font-size: 12px;
  color: var(--text-primary);
}

.toggle-meta span {
  font-size: 11px;
  color: var(--text-muted);
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-toggle {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--bg-control);
  border: 1px solid var(--border-subtle);
  transition: .2s;
  border-radius: 24px;
}

.slider-toggle:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: #94a3b8;
  transition: .2s;
  border-radius: 50%;
}

input:checked + .slider-toggle {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
}

input:checked + .slider-toggle:before {
  transform: translateX(20px);
  background-color: #030814;
}

.sub-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-left: 8px;
  font-size: 11px;
  color: var(--text-secondary);
}

.styled-select {
  background: var(--bg-dark);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  outline: none;
}

/* Events Feed */
.events-feed {
  max-height: 160px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.event-placeholder {
  color: var(--text-muted);
  font-size: 11px;
  font-style: italic;
  padding: 6px 0;
}

.event-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-dark);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 11px;
}

.event-row.human {
  border-left: 3px solid var(--accent-red);
}

.event-row.motion {
  border-left: 3px solid var(--accent-amber);
}

.event-title-badge {
  display: flex;
  align-items: center;
  gap: 6px;
}

.event-time {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 10px;
}

/* Modal Tabs */
.modal-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-surface-elevated);
}

.tab-btn.active {
  color: #030814;
  background: var(--accent-primary);
}

.tab-badge {
  display: inline-block;
  padding: 1px 6px;
  font-size: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.15);
  margin-left: 6px;
}

/* Recordings Storage Banner */
.recordings-storage-banner {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.storage-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.storage-title {
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.storage-stats {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-cyan);
}

.storage-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.storage-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #00d2ff 0%, #3a7bd5 60%, #ff5252 100%);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Recordings Action Toolbar */
.recordings-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  gap: 12px;
  flex-wrap: wrap;
}

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

.select-all-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  color: var(--text-secondary);
}

.select-all-label input[type="checkbox"] {
  accent-color: var(--accent-primary);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.selection-count-badge {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-only-btn {
  padding: 5px 8px;
  font-size: 13px;
}

/* Card Checkbox Overlay */
.card-select-checkbox {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 10;
  width: 18px;
  height: 18px;
  accent-color: var(--accent-primary);
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.15s, transform 0.15s;
}

.card-select-checkbox:hover,
.card-select-checkbox:checked,
.recording-card-item:hover .card-select-checkbox {
  opacity: 1;
  transform: scale(1.1);
}

.recording-card-item.selected {
  border-color: var(--accent-primary);
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.2);
}

/* Confirm Modal */
.confirm-modal-card {
  max-width: 440px;
  border: 1px solid rgba(255, 82, 82, 0.4);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(255, 82, 82, 0.15);
}

/* Recordings Grid */
.recordings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  max-height: 55vh;
  overflow-y: auto;
}

.recording-card-item {
  background: var(--bg-dark);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s;
}

.recording-card-item:hover {
  border-color: var(--border-prominent);
}

.recording-thumb-wrapper {
  position: relative;
  aspect-ratio: 16/9;
  background: #000;
  cursor: pointer;
}

.recording-thumb-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.recording-thumb-wrapper .no-thumb {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
}

.play-badge-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  background: rgba(0, 210, 255, 0.85);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.recording-meta {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.recording-subinfo {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.recording-actions-row {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.recording-actions-row button,
.recording-actions-row a {
  flex: 1;
  text-align: center;
  font-size: 11px;
  padding: 4px 6px;
  border-radius: 4px;
}

/* Playback Modal Video */
.playback-body video {
  width: 100%;
  max-height: 60vh;
  background: #000;
  border-radius: var(--radius-sm);
}

.playback-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.slider-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mt-2 { margin-top: 8px; }

/* Responsive adjustments */
@media (max-width: 900px) {
  .main-content {
    grid-template-columns: 1fr;
    grid-template-rows: 55vh 1fr;
    overflow-y: auto;
  }
  .controls-sidebar {
    border-left: none;
    border-top: 1px solid var(--border-subtle);
    height: auto;
    overflow-y: visible;
  }
  .btn-label {
    display: none;
  }
}

/* ==========================================================================
   MULTI-CAMERA SUITE: SELECTOR, GRID VIEW & ADD CAMERA WIZARD
   ========================================================================== */

/* Camera Selector Dropdown in Header */
.camera-select-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-prominent);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  margin-left: 4px;
  max-width: 160px;
  min-width: 0;
  flex-shrink: 1;
  transition: var(--transition-fast);
}

.camera-select-wrapper:hover {
  border-color: var(--accent-primary);
}

.cam-icon {
  color: var(--accent-primary);
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

.camera-select {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  max-width: 125px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
}

.camera-select option {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  padding: 6px;
}

/* Single vs Grid Mode Selector */
.view-mode-selector {
  display: flex;
  background: var(--bg-surface-elevated);
  padding: 2px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.view-mode-selector .pill-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 11px;
}

.highlight-accent {
  background: rgba(0, 210, 255, 0.15) !important;
  border: 1px solid var(--accent-primary) !important;
  color: var(--accent-primary) !important;
  font-weight: 700;
}

.highlight-accent:hover {
  background: var(--accent-primary) !important;
  color: #030814 !important;
  box-shadow: 0 0 12px var(--accent-glow);
}

/* Single View Container */
.single-view-container {
  display: grid;
  grid-template-columns: 1fr 380px;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Grid View Container */
.grid-view-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: var(--bg-dark);
  padding: 16px 20px;
  overflow-y: auto;
}

.grid-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

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

.grid-header-left h2 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}

.grid-cam-count {
  background: rgba(0, 230, 118, 0.15);
  border: 1px solid var(--accent-green);
  color: var(--accent-green);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.grid-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Cameras Multi-Grid Wall */
.cameras-multi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 16px;
}

@media (max-width: 600px) {
  .cameras-multi-grid {
    grid-template-columns: 1fr;
  }
}

.grid-camera-tile {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease, border-color 0.15s ease;
  position: relative;
}

.grid-camera-tile:hover {
  border-color: var(--border-prominent);
}

.grid-camera-tile.active-cam {
  border-color: var(--accent-primary);
  box-shadow: 0 0 15px rgba(0, 210, 255, 0.2);
}

.grid-tile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
}

.grid-tile-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.grid-tile-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.grid-brand-tag {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.grid-brand-tag.anpviz { background: rgba(0, 210, 255, 0.15); color: var(--accent-primary); border: 1px solid var(--accent-primary); }
.grid-brand-tag.blink { background: rgba(255, 171, 0, 0.15); color: var(--accent-amber); border: 1px solid var(--accent-amber); }
.grid-brand-tag.tapo { background: rgba(0, 230, 118, 0.15); color: var(--accent-green); border: 1px solid var(--accent-green); }
.grid-brand-tag.kangaroo { background: rgba(255, 87, 34, 0.15); color: #ff7043; border: 1px solid #ff7043; }
.grid-brand-tag.ubia { background: rgba(255, 214, 0, 0.15); color: #ffd600; border: 1px solid #ffd600; }
.grid-brand-tag.reolink { background: rgba(33, 150, 243, 0.15); color: #42a5f5; border: 1px solid #42a5f5; }
.grid-brand-tag.generic_rtsp { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; border: 1px solid #64748b; }

.grid-tile-body {
  position: relative;
  aspect-ratio: 16/9;
  background: #000;
  overflow: hidden;
}

.grid-tile-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.grid-tile-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 14, 23, 0.85);
  gap: 8px;
  z-index: 3;
}

.grid-tile-loading span {
  font-size: 11px;
  color: var(--text-muted);
}

.grid-tile-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.2s ease;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 12px;
  z-index: 4;
}

.grid-camera-tile:hover .grid-tile-overlay {
  opacity: 1;
}

.grid-tile-actions {
  display: flex;
  gap: 8px;
}

.tile-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-prominent);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition-fast);
}

.tile-btn:hover {
  background: var(--accent-primary);
  color: #030814;
  border-color: var(--accent-primary);
}

.tile-btn.focus-btn {
  background: var(--accent-primary);
  color: #030814;
  font-weight: 700;
}

/* Add Camera Tile in Grid */
.grid-add-tile {
  background: rgba(17, 22, 34, 0.5);
  border: 2px dashed var(--border-prominent);
  border-radius: var(--radius-md);
  aspect-ratio: 16/9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  transition: var(--transition-fast);
  color: var(--text-muted);
  min-height: 240px;
}

.grid-add-tile:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(0, 210, 255, 0.05);
}

.grid-add-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.grid-add-text {
  font-size: 13px;
  font-weight: 700;
}

/* Add Camera Wizard Modal */
.add-camera-modal {
  width: 840px !important;
}

.brand-selection-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

@media (max-width: 700px) {
  .brand-selection-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.brand-card {
  background: var(--bg-dark);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-fast);
  gap: 4px;
}

.brand-card:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-prominent);
}

.brand-card.active {
  background: rgba(0, 210, 255, 0.1);
  border-color: var(--accent-primary);
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.2);
}

.brand-icon {
  font-size: 22px;
  margin-bottom: 2px;
}

.brand-title-text {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.brand-sub-text {
  font-size: 10px;
  color: var(--text-muted);
}

.brand-guide-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.guide-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.guide-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Blink Discovered Cameras */
.blink-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.blink-item-card {
  background: var(--bg-dark);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.blink-item-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 4px;
  object-fit: cover;
}

.blink-item-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
}

.blink-item-name {
  font-weight: 700;
  color: var(--text-primary);
}

.blink-item-battery {
  color: var(--accent-green);
  font-family: var(--font-mono);
}

/* All Cameras Table in Settings */
.all-cams-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
}

.cams-list-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 50vh;
  overflow-y: auto;
}

.cam-table-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-dark);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  transition: var(--transition-fast);
}

.cam-table-row:hover {
  border-color: var(--border-prominent);
}

.cam-table-row.is-active {
  border-color: var(--accent-primary);
  background: rgba(0, 210, 255, 0.05);
}

.cam-row-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cam-row-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cam-row-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.active-cam-badge {
  background: var(--accent-primary);
  color: #030814;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 3px;
}

.cam-row-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.cam-row-actions {
  display: flex;
  gap: 8px;
}

/* ==========================================================================
   QR CODE PAIRING & SCANNER SUITE
   ========================================================================== */

.qr-suite-modal {
  width: 860px !important;
}

.qr-action-banner-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

@media (max-width: 650px) {
  .qr-action-banner-row {
    flex-direction: column;
  }
}

.qr-action-card {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-dark);
  border: 1px solid var(--border-prominent);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.qr-action-card:hover {
  border-color: var(--accent-primary);
  background: rgba(0, 210, 255, 0.05);
}

.qr-card-icon {
  font-size: 26px;
  flex-shrink: 0;
}

.qr-card-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.qr-card-text strong {
  font-size: 13px;
  color: var(--text-primary);
}

.qr-card-text span {
  font-size: 11px;
  color: var(--text-muted);
}

.divider-line-label {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 16px 0;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.divider-line-label::before,
.divider-line-label::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-subtle);
}

.divider-line-label span {
  padding: 0 10px;
}

/* QR Manifestation Layout */
.qr-manifest-layout {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 28px;
  align-items: start;
}

@media (max-width: 768px) {
  .qr-manifest-layout {
    grid-template-columns: 1fr;
  }
}

.qr-manifest-form {
  display: flex;
  flex-direction: column;
}

.input-with-action {
  display: flex;
  gap: 8px;
}

.input-with-action input {
  flex: 1;
}

.qr-display-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-dark);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  box-sizing: border-box;
  width: 100%;
  overflow: visible;
}

.qr-card-white-canvas {
  background: #ffffff;
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 400px;
  aspect-ratio: 1;
  height: auto;
  box-sizing: border-box;
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
  transition: all 0.2s ease;
  overflow: visible;
}

.qr-card-white-canvas.pure-white-boost {
  background: #ffffff;
  box-shadow: 0 0 60px rgba(255, 255, 255, 0.9);
  transform: scale(1.03);
}

.pairing-qr-img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  display: block;
}

.qr-placeholder-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: #475569;
  gap: 8px;
  font-size: 12px;
  padding: 20px;
}

.qr-icon-large {
  font-size: 40px;
}

.qr-camera-reticle {
  position: absolute;
  inset: -12px;
  pointer-events: none;
  border: 1px dashed rgba(0, 210, 255, 0.4);
  border-radius: 16px;
}

.reticle-corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: var(--accent-primary);
  border-style: solid;
}

.reticle-corner.tl { top: -2px; left: -2px; border-width: 3px 0 0 3px; }
.reticle-corner.tr { top: -2px; right: -2px; border-width: 3px 3px 0 0; }
.reticle-corner.bl { bottom: -2px; left: -2px; border-width: 0 0 3px 3px; }
.reticle-corner.br { bottom: -2px; right: -2px; border-width: 0 3px 3px 0; }

.reticle-guide-text {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 10px;
  font-weight: 800;
  color: var(--accent-primary);
  letter-spacing: 0.5px;
  font-family: var(--font-mono);
}

.qr-display-toolbar {
  display: flex;
  gap: 10px;
  margin-top: 36px;
}

.network-detect-box {
  width: 100%;
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.detect-status-row {
  width: 100%;
  display: flex;
  justify-content: center;
}

.detect-status-row button {
  width: 100%;
}

/* QR Code Scanner (Live & Upload) */
.qr-scan-subtabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.qr-scanner-viewport {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.scanner-video-box {
  position: relative;
  width: 100%;
  max-width: 460px;
  aspect-ratio: 4/3;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid var(--border-prominent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.scanner-video-box video,
.scanner-video-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scanner-helper-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  width: 100%;
  max-width: 460px;
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  box-sizing: border-box;
}

.scanner-badge {
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent-green);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.scanner-tip {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
}

.scanner-canvas-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.scanner-laser-line {
  position: absolute;
  left: 10%;
  right: 10%;
  height: 2px;
  background: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green), 0 0 20px var(--accent-green);
  z-index: 3;
  animation: scanLaser 2s infinite alternate ease-in-out;
}

@keyframes scanLaser {
  0% { top: 15%; opacity: 0.2; }
  50% { opacity: 1; }
  100% { top: 85%; opacity: 0.2; }
}

.scanner-target-reticle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200px;
  height: 200px;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  pointer-events: none;
  z-index: 3;
}

.target-corner {
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: var(--accent-green);
  border-style: solid;
}

.target-corner.tl { top: -2px; left: -2px; border-width: 3px 0 0 3px; }
.target-corner.tr { top: -2px; right: -2px; border-width: 3px 3px 0 0; }
.target-corner.bl { bottom: -2px; left: -2px; border-width: 0 0 3px 3px; }
.target-corner.br { bottom: -2px; right: -2px; border-width: 0 3px 3px 0; }

.scanner-hud-text {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(10, 14, 23, 0.85);
  color: var(--text-secondary);
  font-size: 11px;
  text-align: center;
  padding: 6px;
  z-index: 4;
}

.scanner-controls-row {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 460px;
}

/* Upload Photo Area */
.qr-upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.drop-zone {
  border: 2px dashed var(--border-prominent);
  border-radius: var(--radius-md);
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  cursor: pointer;
  background: var(--bg-dark);
  transition: var(--transition-fast);
  width: 100%;
  max-width: 460px;
}

.drop-zone:hover {
  border-color: var(--accent-primary);
  background: rgba(0, 210, 255, 0.05);
}

.drop-icon {
  font-size: 36px;
  margin-bottom: 4px;
}

.drop-zone strong {
  font-size: 13px;
  color: var(--text-primary);
}

.drop-zone span {
  font-size: 11px;
  color: var(--text-muted);
}

.upload-preview-img {
  max-width: 460px;
  max-height: 240px;
  border-radius: var(--radius-sm);
  margin-top: 14px;
  border: 1px solid var(--border-subtle);
}

/* Decoded Result Card */
.qr-decoded-result-card {
  background: var(--bg-surface-elevated);
  border: 1.5px solid var(--accent-green);
  box-shadow: 0 8px 24px rgba(0, 230, 118, 0.15);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  width: 100%;
  max-width: 520px;
  margin: 16px auto 0 auto;
}

.decoded-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.decoded-type-badge {
  background: rgba(0, 230, 118, 0.2);
  color: var(--accent-green);
  border: 1px solid var(--accent-green);
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.decoded-timestamp {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.decoded-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

.decoded-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.decoded-label {
  font-size: 11px;
  color: var(--text-muted);
}

.decoded-val {
  font-family: var(--font-mono);
  font-size: 12px;
  word-break: break-all;
}

/* ========================================================
   Bluetooth / BLE Fast Pair Styling
   ======================================================== */

.qr-action-card.highlight-ble {
  border-color: rgba(0, 210, 255, 0.4);
  background: linear-gradient(135deg, rgba(0, 210, 255, 0.08) 0%, rgba(13, 22, 38, 0.8) 100%);
}

.qr-action-card.highlight-ble:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 0 16px rgba(0, 210, 255, 0.25);
}

.ble-pair-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ble-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
}

.ble-status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-normal);
}

.ble-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #64748b;
  display: inline-block;
  transition: all 0.3s ease;
}

.ble-dot.active {
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.ble-dot.scanning {
  background: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-primary);
  animation: pulseBle 1.2s infinite ease-in-out;
}

@keyframes pulseBle {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

.ble-split-layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 16px;
  min-height: 380px;
}

.ble-device-col, .ble-config-col {
  background: rgba(13, 19, 33, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
}

.ble-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ble-list-header h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-normal);
  margin: 0;
}

.ble-device-count {
  font-size: 11px;
  color: var(--text-muted);
}

.ble-device-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  max-height: 340px;
  padding-right: 4px;
}

.ble-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 12px;
  gap: 10px;
}

.ble-empty-icon {
  font-size: 32px;
  opacity: 0.5;
}

.ble-device-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ble-device-item:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.15);
}

.ble-device-item.active {
  background: rgba(0, 210, 255, 0.12);
  border-color: var(--accent-primary);
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.2);
}

.ble-device-item.is-cam-candidate {
  border-left: 3px solid #ffd600;
}

.ble-dev-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ble-dev-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-bright);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ble-tag-cam {
  background: rgba(255, 214, 0, 0.2);
  color: #ffd600;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 700;
}

.ble-dev-mac {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.ble-dev-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ble-rssi-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.ble-rssi-badge.strong {
  background: rgba(34, 197, 94, 0.18);
  color: var(--accent-green);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.ble-rssi-badge.medium {
  background: rgba(255, 171, 0, 0.18);
  color: var(--accent-amber);
  border: 1px solid rgba(255, 171, 0, 0.3);
}

.ble-prompt-select {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  gap: 12px;
  padding: 30px;
}

.ble-prompt-select .prompt-icon {
  font-size: 28px;
  opacity: 0.6;
}

.ble-selected-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ble-selected-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ble-dev-icon {
  font-size: 24px;
}

.ble-selected-mac {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.ble-dual-sync-card {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

.dual-sync-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #ffd600;
  margin-bottom: 4px;
}

.dual-sync-subtext {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0 0 10px 0;
}

.ble-qr-mini-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #ffffff;
  padding: 18px;
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  max-width: 340px;
  margin: 12px auto;
  box-sizing: border-box;
}

.ble-qr-mini-wrap img {
  width: 100%;
  max-width: 300px;
  height: auto;
  aspect-ratio: 1;
  display: block;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: pixelated;
}

.primary-btn.success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  font-weight: 700;
}

.primary-btn.success:hover {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.4);
}

/* ========================================================
   Fullscreen QR Code Theater Overlay
   ======================================================== */

.fullscreen-qr-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}

.fullscreen-qr-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.94);
  backdrop-filter: blur(10px);
}

.fullscreen-qr-card {
  position: relative;
  background: #0b1322;
  border: 1px solid rgba(0, 210, 255, 0.35);
  border-radius: 20px;
  padding: 30px;
  max-width: 580px;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.85), 0 0 50px rgba(0, 210, 255, 0.2);
  z-index: 2;
  animation: popQr 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popQr {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.fullscreen-qr-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: none;
  border: none;
  font-size: 32px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s;
}

.fullscreen-qr-close:hover {
  color: #ffffff;
}

.fullscreen-qr-header {
  text-align: center;
  margin-bottom: 20px;
}

.fullscreen-qr-header h3 {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent-primary);
  letter-spacing: 0.8px;
  margin: 0 0 6px 0;
}

.fullscreen-qr-header p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.fullscreen-qr-white-canvas {
  background: #ffffff;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 0 60px rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  max-width: 440px;
  aspect-ratio: 1;
}

.fullscreen-qr-white-canvas img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: pixelated;
  display: block;
}

.fullscreen-qr-footer {
  display: flex;
  gap: 12px;
  margin-top: 22px;
  width: 100%;
  justify-content: center;
}

.tile-btn.highlight-btn {
  background: rgba(0, 210, 255, 0.15);
  border-color: rgba(0, 210, 255, 0.4);
  color: var(--accent-primary);
  font-weight: 700;
}

.tile-btn.highlight-btn:hover {
  background: rgba(0, 210, 255, 0.25);
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.3);
}

.gps-schedule-box {
  background: rgba(18, 25, 38, 0.7);
  border: 1px solid rgba(0, 210, 255, 0.2);
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 14px;
}

.gps-schedule-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #fff;
}

.gps-coords-display {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #94a3b8;
  margin-top: 6px;
}

.solar-times-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.solar-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

.solar-badge.day {
  border-color: rgba(251, 191, 36, 0.3);
  color: #fbbf24;
}

.solar-badge.night {
  border-color: rgba(129, 140, 248, 0.3);
  color: #818cf8;
}

.solar-badge.phase {
  border-color: rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  margin-left: auto;
}

/* =========================================================================
   PERIMETER NAVIGATION & SLIDING DRAWERS SYSTEM
   ========================================================================= */

/* Header Gamepad & Theme Selector */
.gamepad-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface-elevated);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.gamepad-pill:hover {
  background: var(--bg-control-hover);
  border-color: var(--accent-primary);
}

.gamepad-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.gamepad-dot.connected {
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.gamepad-dot.disconnected {
  background: var(--text-muted);
}

.gamepad-text {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}

.theme-selector-wrapper {
  display: flex;
  align-items: center;
}

.theme-select {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: var(--transition-fast);
}

.theme-select:hover, .theme-select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 8px var(--accent-glow);
}

.highlight-settings {
  border-color: var(--accent-primary) !important;
  color: var(--accent-primary) !important;
  background: rgba(0, 210, 255, 0.08) !important;
}

.highlight-settings:hover {
  background: var(--accent-primary) !important;
  color: #030814 !important;
  box-shadow: 0 0 12px var(--accent-glow);
}

/* Compact Record & Settings Buttons */
.record-btn-pill.compact-rec-btn {
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  gap: 5px;
}

.compact-settings-btn {
  padding: 4px 8px;
  font-size: 11px;
  flex-shrink: 0;
  gap: 5px;
}

.gamepad-pill.compact {
  padding: 4px 8px;
  font-size: 11px;
  flex-shrink: 0;
}

/* ==========================================================================
   PURE DROPDOWN NAVIGATION MENU BAR SYSTEM
   ========================================================================== */
.menu-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.menu-dropdown-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.menu-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 600;
  transition: var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}

.menu-dropdown-trigger * {
  pointer-events: none;
}

.menu-dropdown-trigger:hover,
.menu-dropdown-wrapper.open .menu-dropdown-trigger {
  background: var(--bg-control-hover);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-glow);
}

.menu-dropdown-trigger.recording-active {
  border-color: var(--accent-red);
  color: var(--accent-red);
  box-shadow: 0 0 10px rgba(255, 59, 92, 0.4);
}

.dropdown-caret {
  font-size: 9px;
  opacity: 0.7;
  transition: transform var(--transition-fast);
}

.menu-dropdown-wrapper.open .dropdown-caret {
  transform: rotate(180deg);
}

.menu-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: rgba(11, 16, 26, 0.97);
  border: 1px solid var(--border-prominent);
  border-radius: var(--radius-md);
  padding: 8px;
  min-width: 250px;
  max-width: 320px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.85), 0 0 16px rgba(0, 210, 255, 0.12);
  display: none;
  flex-direction: column;
  gap: 3px;
  z-index: 2000;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

#dropdownCamerasWrapper .menu-dropdown-menu {
  left: 0;
  right: auto;
}

.menu-dropdown-wrapper.open .menu-dropdown-menu {
  display: flex;
  animation: menuFadeIn 0.14s ease-out forwards;
}

@keyframes menuFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.menu-section-header {
  font-size: 9px;
  font-family: var(--font-mono);
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 5px 8px 3px;
  text-transform: uppercase;
}

.menu-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 0;
}

.menu-item-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 7px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: var(--transition-fast);
  box-sizing: border-box;
}

.menu-item-btn:hover {
  background: var(--bg-control-hover);
  border-color: var(--border-prominent);
  color: var(--accent-primary);
}

.menu-item-btn.active {
  background: rgba(0, 210, 255, 0.12);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  font-weight: 700;
}

.menu-item-btn.highlight {
  border-color: rgba(0, 210, 255, 0.3);
  background: rgba(0, 210, 255, 0.05);
}

.menu-item-btn.highlight:hover {
  background: var(--accent-primary);
  color: #030814;
}

.menu-item-btn .item-content {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-item-btn .item-shortcut {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-muted);
  background: var(--bg-dark);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
  margin-left: 8px;
}

.dropdown-cam-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 200px;
  overflow-y: auto;
}

.rec-action-active {
  color: var(--accent-red) !important;
}

/* Header Camera Fleet Switcher Tabs */
.header-cam-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.cam-tab-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}

.cam-tab-btn:hover {
  background: var(--bg-control-hover);
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.cam-tab-btn.active {
  background: var(--accent-glow);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-glow);
}

.cam-tab-btn .cam-tab-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cam-tab-btn .cam-tab-dot.live {
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
}

.cam-tab-btn .cam-tab-dot.solar {
  background: #facc15;
  box-shadow: 0 0 6px #facc15;
}

.grid-solar-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 16px;
  text-align: center;
  background: radial-gradient(circle, rgba(234, 179, 8, 0.08) 0%, rgba(15, 23, 42, 0.95) 100%);
  box-sizing: border-box;
}

/* Backward compatibility classes */
.tools-dropdown-wrapper {
  position: relative;
  flex-shrink: 0;
}
.tools-trigger-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 11px;
}
.tools-dropdown-menu {
  display: none;
}
.tools-menu-item-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 12px;
  cursor: pointer;
  width: 100%;
}
.tools-menu-item-btn:hover {
  background: var(--bg-control-hover);
  color: var(--accent-primary);
}

/* Perimeter Rails (Tabs along the screen edges) */
.perimeter-rail {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 35;
  pointer-events: auto;
}

.perimeter-rail.left {
  left: 14px;
}

.perimeter-rail.right {
  right: 14px;
}

.perimeter-tab-btn {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(15, 21, 35, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.perimeter-tab-btn:hover {
  background: rgba(24, 32, 50, 0.95);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  transform: scale(1.1);
  box-shadow: 0 0 16px var(--accent-glow);
}

.perimeter-tab-btn.active {
  background: var(--accent-primary);
  color: #030814;
  border-color: var(--accent-primary);
  box-shadow: 0 0 20px var(--accent-glow);
  transform: scale(1.12);
}

.perimeter-tab-btn::before {
  content: attr(data-tooltip);
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  padding: 6px 12px;
  background: rgba(10, 13, 20, 0.95);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--border-prominent);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 50;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
}

.perimeter-rail.left .perimeter-tab-btn::before {
  left: calc(100% + 12px);
  transform: translateY(-50%) translateX(-4px);
}

.perimeter-rail.left .perimeter-tab-btn:hover::before {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.perimeter-rail.right .perimeter-tab-btn::before {
  right: calc(100% + 12px);
  transform: translateY(-50%) translateX(4px);
}

.perimeter-rail.right .perimeter-tab-btn:hover::before {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* Perimeter Sliding Drawers */
.perimeter-drawer {
  position: absolute;
  top: 20px;
  bottom: 80px;
  width: 400px;
  max-width: calc(100vw - 120px);
  background: rgba(14, 20, 32, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-prominent);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 1px rgba(255, 255, 255, 0.2) inset;
  z-index: 34;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

.perimeter-drawer.left-drawer {
  left: 74px;
  transform: translateX(0);
  opacity: 1;
}

.perimeter-drawer.left-drawer.closed {
  transform: translateX(-450px);
  opacity: 0;
  pointer-events: none;
}

.perimeter-drawer.right-drawer {
  right: 74px;
  transform: translateX(0);
  opacity: 1;
}

.perimeter-drawer.right-drawer.closed {
  transform: translateX(450px);
  opacity: 0;
  pointer-events: none;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(17, 24, 39, 0.7);
}

.drawer-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent-primary);
}

.drawer-title-row h3 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-primary);
}

.drawer-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s ease;
}

.drawer-close-btn:hover {
  color: var(--accent-red);
}

.drawer-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.section-title-sm {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

/* =========================================================================
   VIRTUAL ANALOG JOYSTICK
   ========================================================================= */
.joystick-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px;
  background: rgba(17, 24, 39, 0.6);
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
}

.joystick-mode-pill {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 210, 255, 0.15);
  color: var(--accent-primary);
}

.joystick-mount {
  position: relative;
  width: 180px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 0 6px 0;
  touch-action: none;
}

.joystick-base {
  position: relative;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: radial-gradient(circle, #151e33 25%, #080d17 85%);
  border: 2px solid var(--border-prominent);
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.85), 0 0 15px var(--accent-glow) inset;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  cursor: grab;
}

.joystick-base:active {
  cursor: grabbing;
}

.joystick-crosshair {
  position: absolute;
  background: rgba(255, 255, 255, 0.08);
}
.joystick-crosshair.h {
  width: 100%;
  height: 1px;
}
.joystick-crosshair.v {
  height: 100%;
  width: 1px;
}

.joystick-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.12);
}
.joystick-ring.ring-1 {
  width: 60px;
  height: 60px;
}
.joystick-ring.ring-2 {
  width: 115px;
  height: 115px;
}

.compass-marker {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}
.compass-marker.n { top: 6px; }
.compass-marker.s { bottom: 6px; }
.compass-marker.w { left: 8px; }
.compass-marker.e { right: 8px; }

.joystick-thumb {
  position: absolute;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #2a3d5e, #111a2a);
  border: 2px solid var(--accent-primary);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.75), 0 0 14px var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transform: translate(0px, 0px);
}

.thumb-center-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-primary);
  box-shadow: 0 0 8px var(--accent-primary);
}

.joystick-telemetry {
  display: flex;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  background: rgba(10, 15, 26, 0.8);
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  margin-top: 6px;
}

.joystick-telemetry strong {
  color: var(--accent-primary);
}

/* D-Pad in Drawer */
.dpad-section {
  padding: 12px;
  background: rgba(17, 24, 39, 0.5);
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
}

/* =========================================================================
   FLUID HUNDREDTH ZOOM (.00x) SYSTEM
   ========================================================================= */
.bottom-perimeter-bar {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 35;
  background: rgba(14, 20, 32, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-prominent);
  border-radius: 32px;
  padding: 8px 18px;
  display: flex;
  align-items: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 1px rgba(255, 255, 255, 0.15) inset;
  transition: all 0.2s ease;
}

.bottom-perimeter-bar:hover {
  background: rgba(17, 24, 39, 0.98);
  border-color: var(--accent-primary);
  box-shadow: 0 8px 36px rgba(0, 0, 0, 0.7), 0 0 18px var(--accent-glow);
}

.bottom-zoom-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
}

.zoom-label-hud {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--accent-primary);
}

.zoom-micro-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.zoom-micro-btn:hover {
  background: var(--bg-control-hover);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.zoom-slider-track {
  display: flex;
  flex-direction: column;
  width: 200px;
}

.zoom-slider-track input[type="range"] {
  width: 100%;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.zoom-ticks {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 2px;
}

.zoom-readout-pill {
  display: flex;
  align-items: baseline;
  background: rgba(0, 0, 0, 0.6);
  padding: 3px 12px;
  border-radius: 8px;
  border: 1px solid var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-glow);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 800;
  color: #fff;
}

.zoom-readout-pill .zoom-x {
  font-size: 11px;
  color: var(--accent-primary);
  margin-left: 2px;
}

.zoom-reset-pill {
  background: var(--bg-control);
  border: 1px solid var(--border-prominent);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition-fast);
}

.zoom-reset-pill:hover {
  background: var(--accent-primary);
  color: #030814;
}

/* Fluid Zoom Drawer Cluster */
.zoom-cluster-drawer {
  background: rgba(17, 24, 39, 0.5);
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  padding: 12px;
}

.zoom-drawer-val {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--accent-primary);
}

.zoom-fine-buttons {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.mini-zoom-btn {
  flex: 1;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 6px 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: center;
}

.mini-zoom-btn:hover {
  background: var(--bg-control-hover);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.zoom-preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.zoom-chip {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.zoom-chip:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* =========================================================================
   GAMEPAD CONTROLLER HUD & DIAGNOSTICS
   ========================================================================= */
.gamepad-card-status {
  background: rgba(17, 24, 39, 0.6);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
}

.gamepad-model-badge {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-primary);
}

.gamepad-sub-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

.gamepad-visualizer-box {
  background: rgba(10, 15, 26, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px;
}

.gamepad-meters-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stick-meter-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(17, 24, 39, 0.5);
  border-radius: 8px;
  padding: 8px;
  border: 1px solid var(--border-subtle);
}

.meter-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stick-crosshair-area {
  position: relative;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 1px solid var(--border-prominent);
  background: radial-gradient(circle, #101726, #060910);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stick-crosshair-area::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.stick-crosshair-area::after {
  content: '';
  position: absolute;
  height: 100%;
  width: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.stick-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-primary);
  box-shadow: 0 0 8px var(--accent-primary);
  transform: translate(0px, 0px);
  transition: transform 0.05s ease-out;
}

.meter-val {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.triggers-meters-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.trigger-bar-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.trigger-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-secondary);
}

.trigger-bar-track {
  width: 100%;
  height: 8px;
  background: var(--bg-surface);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.trigger-bar-fill {
  height: 100%;
  background: var(--accent-primary);
  transition: width 0.05s ease-out;
}

.gamepad-legend-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin-top: 8px;
}

.gamepad-legend-table th {
  text-align: left;
  padding: 6px 8px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.gamepad-legend-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.btn-chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.btn-chip.xbox {
  background: rgba(16, 124, 65, 0.25);
  color: #107c41;
  border: 1px solid rgba(16, 124, 65, 0.5);
}

.btn-chip.ps {
  background: rgba(0, 55, 145, 0.25);
  color: #5bb2ff;
  border: 1px solid rgba(0, 55, 145, 0.5);
}

/* =========================================================================
   SETTINGS MODAL WITH TABLE OF CONTENTS & INTERACTIVE SITE MAP
   ========================================================================= */
.settings-modal {
  width: 96vw;
  max-width: 1280px;
  height: 88vh;
  display: flex;
  flex-direction: column;
}

.settings-modal-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-lens-icon {
  font-size: 24px;
}

.settings-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  flex: 1;
  overflow: hidden;
  border-top: 1px solid var(--border-subtle);
}

.settings-toc {
  background: var(--bg-surface-elevated);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.toc-search-box {
  padding: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.toc-search-box input {
  width: 100%;
  background: var(--bg-dark);
  border: 1px solid var(--border-prominent);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.toc-list {
  list-style: none;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition-fast);
}

.toc-item:hover {
  background: var(--bg-control-hover);
  color: var(--text-primary);
}

.toc-item.active {
  background: var(--accent-primary);
  color: #030814;
  font-weight: 700;
  box-shadow: 0 0 12px var(--accent-glow);
}

.toc-badge {
  margin-left: auto;
  background: rgba(0, 0, 0, 0.3);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

.settings-content-pane {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg-surface);
}

.settings-panel {
  display: none;
}
.settings-panel.active {
  display: block;
}

.settings-panel-header {
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 14px;
}

.settings-panel-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.settings-panel-header p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Visual Interactive Site Map Diagram */
.sitemap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.sitemap-node-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.sitemap-node-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 14px var(--accent-glow);
}

.sitemap-node-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sitemap-node-icon {
  font-size: 22px;
}

.sitemap-node-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.sitemap-node-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.sitemap-node-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.sitemap-tag {
  background: var(--bg-control);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-primary);
}

/* Theme Picker in Settings */
.theme-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.theme-card-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.theme-card-option:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-glow);
}

.theme-card-option.active {
  border-color: var(--accent-primary);
  background: rgba(0, 210, 255, 0.08);
}

.theme-color-preview {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.theme-meta {
  display: flex;
  flex-direction: column;
}

.theme-meta strong {
  font-size: 13px;
  color: var(--text-primary);
}

.theme-meta span {
  font-size: 11px;
  color: var(--text-muted);
}

/* Diagnostics Card in Settings */
.diagnostics-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.diag-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
}

.diag-row strong {
  font-family: var(--font-mono);
}

.danger-outline-btn {
  background: transparent;
  border: 1px solid var(--accent-red);
  color: var(--accent-red);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition-fast);
}

.danger-outline-btn:hover {
  background: var(--accent-red);
  color: #fff;
  box-shadow: 0 0 12px rgba(255, 59, 92, 0.4);
}

/* ==========================================================================
   Responsive Top Toolbar System (Guaranteed 100% Anti-Stretch & No Overflow)
   ========================================================================== */
@media (max-width: 1250px) {
  .menu-bar {
    gap: 4px;
  }
  .menu-dropdown-trigger {
    padding: 4px 8px;
    font-size: 11px;
  }
}

@media (max-width: 1050px) {
  .brand-subtitle {
    display: none !important;
  }
  .brand-title {
    font-size: 13px !important;
    letter-spacing: 1px !important;
  }
  .status-pill {
    max-width: 105px;
    padding: 2px 6px;
    font-size: 10px;
  }
  .app-header {
    padding: 0 8px;
  }
  .menu-dropdown-trigger {
    padding: 4px 6px;
    font-size: 10.5px;
  }
}

@media (max-width: 820px) {
  .camera-lens-icon {
    width: 26px;
    height: 26px;
  }
  .logo .brand-title {
    display: none;
  }
  .status-pill {
    max-width: 80px;
  }
  .menu-dropdown-trigger span:not(.dropdown-caret):not(#triggerCamName) {
    display: none;
  }
  .menu-dropdown-trigger {
    padding: 5px 7px;
  }
}

@media (min-width: 1440px) {
  .status-details {
    display: inline-block;
  }
  .status-pill {
    max-width: 240px;
  }
}

/* =========================================================================
   GOD'S EYE VIEW: DVR & HISTORY TIMELINE SCRUBBER
   ========================================================================= */
.history-timeline-dock {
  position: absolute;
  bottom: 74px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 140px);
  max-width: 1150px;
  z-index: 34;
  background: rgba(10, 16, 28, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-prominent, rgba(0, 229, 255, 0.35));
  border-radius: 14px;
  padding: 8px 16px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.75), 0 0 1px rgba(255, 255, 255, 0.15) inset;
  transition: all 0.25s cubic-bezier(0.2, 0.9, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-sizing: border-box;
}

.history-timeline-dock.collapsed .timeline-scrubber-body {
  display: none;
}

.history-timeline-dock.collapsed {
  padding: 6px 14px;
}

.timeline-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  gap: 10px;
}

.timeline-left-controls, .timeline-playback-controls, .timeline-right-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.timeline-live-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 82, 82, 0.2);
  border: 1px solid #ff5252;
  color: #ff5252;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.timeline-live-btn.active {
  background: #ff5252;
  color: #fff;
  box-shadow: 0 0 12px rgba(255, 82, 82, 0.5);
}

.live-dot-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  display: inline-block;
  animation: pulse-dot 1.2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.timeline-time-readout {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--text-primary, #fff);
  background: rgba(0, 0, 0, 0.45);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
}

.timeline-time-readout .readout-label {
  color: var(--text-muted, #888);
  margin-right: 4px;
}

.timeline-event-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255, 152, 0, 0.25);
  color: #ff9800;
  border: 1px solid rgba(255, 152, 0, 0.5);
  font-family: var(--font-mono, monospace);
}

.timeline-btn {
  background: var(--bg-surface-elevated, rgba(255, 255, 255, 0.08));
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.15));
  color: var(--text-primary, #fff);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.timeline-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: var(--accent, #00e5ff);
}

.timeline-btn.speed-btn {
  font-family: var(--font-mono, monospace);
  font-weight: 700;
  color: #00e5ff;
}

.timeline-date-select {
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.2));
  color: #fff;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.timeline-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted, #888);
  cursor: pointer;
  font-size: 11px;
  padding: 4px;
}

.timeline-toggle-btn:hover {
  color: #fff;
}

/* Scrubber Track */
.timeline-track-wrapper {
  position: relative;
  width: 100%;
  height: 24px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.timeline-track {
  position: relative;
  width: 100%;
  height: 12px;
  background: rgba(0, 0, 0, 0.65);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  overflow: visible;
}

.timeline-events-layer {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  overflow: hidden;
}

.timeline-incident-block {
  position: absolute;
  top: 0;
  bottom: 0;
  background: linear-gradient(180deg, #ff5252, #d32f2f);
  box-shadow: 0 0 6px rgba(255, 82, 82, 0.6);
  border-radius: 2px;
  cursor: pointer;
  z-index: 2;
}

.timeline-continuous-block {
  position: absolute;
  top: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(0, 229, 255, 0.7), rgba(0, 151, 167, 0.7));
  border-radius: 2px;
  cursor: pointer;
  z-index: 1;
}

.timeline-playhead {
  position: absolute;
  top: -8px;
  bottom: -8px;
  left: 100%;
  width: 2px;
  background: #ff5252;
  box-shadow: 0 0 8px #ff5252;
  z-index: 5;
  pointer-events: none;
  transform: translateX(-50%);
  transition: left 0.1s linear;
}

.playhead-knob {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  background: #ff5252;
  border: 2px solid #fff;
  border-radius: 50%;
}

.timeline-hover-cursor {
  position: absolute;
  top: -6px;
  bottom: -6px;
  width: 1px;
  background: rgba(255, 255, 255, 0.7);
  z-index: 4;
  pointer-events: none;
  transform: translateX(-50%);
}

.timeline-hover-tooltip {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  white-space: nowrap;
}

.timeline-ticks-scale {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono, monospace);
  font-size: 9px;
  color: var(--text-muted, #777);
  padding: 0 2px;
  user-select: none;
}


