@charset "UTF-8";
:root {
  color-scheme: light;
  --bg: #f8fafc;
  --sidebar: #ffffff;
  --sidebar-border: #edf2f7;
  --panel: #ffffff;
  --panel-alt: #f8fafc;
  --raised: #ffffff;
  --line: #e2e8f0;
  --soft-line: #f1f5f9;
  --text: #0f172a;
  --text-secondary: #334155;
  --muted: #64748b;
  --subtle: #94a3b8;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-border: #c7d2fe;
  --cyan: #0284c7;
  --mint: #10b981;
  --amber: #f59e0b;
  --red: #ef4444;
  --lavender: #8b5cf6;
  --radius: 16px;
  --card-radius: 20px;
  --pill-radius: 9999px;
  --shadow-subtle: 0 1px 3px 0 rgba(15, 23, 42, 0.04), 0 4px 14px -2px rgba(15, 23, 42, 0.03);
  --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.02);
  --shadow-floating: 0 10px 25px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.03);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Reference Image Pastel Accent Variables */
  --pastel-purple-bg: #f5f3ff;
  --pastel-purple-border: #ede9fe;
  --pastel-purple-accent: #6366f1;
  --pastel-purple-text: #312e81;

  --pastel-blue-bg: #f0f9ff;
  --pastel-blue-border: #e0f2fe;
  --pastel-blue-accent: #0284c7;
  --pastel-blue-text: #082f49;

  --pastel-peach-bg: #fff7ed;
  --pastel-peach-border: #ffedd5;
  --pastel-peach-accent: #ea580c;
  --pastel-peach-text: #431407;

  --pastel-green-bg: #f0fdf4;
  --pastel-green-border: #dcfce7;
  --pastel-green-accent: #16a34a;
  --pastel-green-text: #052e16;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13.5px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { color: inherit; cursor: pointer; }
button:disabled { opacity: .55; cursor: not-allowed; }
a { color: inherit; text-decoration: none; }
button, input, select, dialog { outline: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, main:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}
input, select {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  padding: 10px 14px;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: var(--subtle); }
input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}
[hidden] { display: none !important; }

/* SVG Icon System */
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.cyan { color: var(--cyan); }
.mint { color: var(--mint); }
.amber { color: var(--amber); }
.lavender { color: var(--lavender); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.skip-link {
  position: fixed;
  left: 20px;
  top: -80px;
  padding: 12px 20px;
  background: var(--primary);
  color: #ffffff;
  z-index: 1000;
  border-radius: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-floating);
  transition: top .2s;
}
.skip-link:focus { top: 16px; }

/* Typography */
h1, h2, h3, p { margin: 0; }
h1 {
  font-size: 28px;
  letter-spacing: -0.03em;
  font-weight: 650;
  margin: 6px 0 4px;
  line-height: 1.25;
  color: var(--text);
}
h2 {
  font-size: 18px;
  line-height: 1.35;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text);
}
h3 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.04em;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  text-transform: none;
}
.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--subtle);
  flex-shrink: 0;
}
.cyan-dot { background: var(--cyan); }

/* Buttons & Interactive Elements */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  min-height: 40px;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .1s;
}
.button .icon { width: 16px; height: 16px; }
.primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.22);
}
.primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}
.secondary {
  background: #ffffff;
  border-color: var(--line);
  color: var(--text-secondary);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: var(--text);
}
.small-button {
  padding: 6px 12px;
  min-height: 34px;
  font-size: 12px;
  border-radius: 10px;
}
.wide { width: 100%; }
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  padding: 0;
  flex-shrink: 0;
  transition: color .15s, background .15s, border-color .15s;
}
.icon-button:hover {
  color: var(--text);
  background: #f8fafc;
  border-color: #cbd5e1;
}
.text-button {
  border: 0;
  background: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color .15s;
}
.text-button:hover { color: var(--primary-hover); text-decoration: underline; text-underline-offset: 3px; }
.text-button .icon { width: 14px; height: 14px; }
.subtle-badge, .environment-tag {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--muted);
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 6px;
  padding: 3px 8px;
  white-space: nowrap;
}
.count-badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  border: 1px solid var(--line);
  background: #f8fafc;
  padding: 2px 7px;
  border-radius: 9999px;
  color: var(--muted);
  vertical-align: 1px;
  margin-left: 6px;
}

/* Persistent Left Sidebar Navigation (Matching Reference Screenshot) */
#sidebar {
  width: 240px;
  position: fixed;
  inset: 0 auto 0 0;
  background: var(--sidebar);
  border-right: 1px solid var(--sidebar-border);
  padding: 24px 14px 0;
  display: flex;
  flex-direction: column;
  z-index: 40;
  overflow-y: auto;
}
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 4px 22px;
  text-decoration: none;
  padding: 4px 6px;
  text-align: center;
}
.brand-logo {
  display: block;
  width: 100%;
  max-width: 175px;
  height: auto;
  object-fit: contain;
  transition: opacity .15s;
}
.brand:hover .brand-logo { opacity: .9; }
.brand-caption {
  display: block;
  width: 100%;
  text-align: center;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.modal-logo {
  display: block;
  max-width: 170px;
  height: auto;
  object-fit: contain;
}
.nav-label {
  font-size: 11px;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: var(--subtle);
  margin: 0 12px 10px;
  text-transform: uppercase;
}
.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background .15s, color .15s, border-color .15s;
}
.nav-item .icon { width: 18px; height: 18px; color: var(--muted); }
.nav-item:hover {
  color: var(--text);
  background: #f8fafc;
}
/* Pill highlight state matching the reference screenshot */
.nav-item.active {
  color: var(--primary);
  background: var(--pastel-purple-bg);
  border-color: var(--pastel-purple-border);
  font-weight: 600;
}
.nav-item.active .icon { color: var(--primary); }
.nav-count {
  margin-left: auto;
  background: #f1f5f9;
  color: var(--text-secondary);
  min-width: 22px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  border-radius: 9999px;
  padding: 2px 7px;
}
.nav-item.active .nav-count {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.nav-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--subtle);
  margin-left: auto;
}
.sidebar-bottom {
  margin-top: auto;
  padding-top: 24px;
  padding-bottom: 18px;
}
.sandbox-note {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 15px 14px;
  margin: 0 2px 14px;
  background: #f8fafc;
}
.sandbox-note .eyebrow {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--primary);
  gap: 6px;
}
.sandbox-note .dot { width: 5px; height: 5px; background: var(--primary); }
.sandbox-note p {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  margin: 7px 0 10px;
}
.sandbox-note .text-button { font-size: 12px; }
.workspace-user {
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--soft-line);
  padding: 16px 6px 0;
  margin-top: 14px;
}
.user-avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--pastel-blue-bg);
  border: 1px solid var(--pastel-blue-border);
  font-size: 12px;
  font-weight: 600;
  color: var(--cyan);
}
.workspace-user strong { font-size: 12px; display: block; color: var(--text); }
.workspace-user small { font-size: 11px; color: var(--muted); }
.version { margin-left: auto; color: var(--subtle); font-size: 11px; font-weight: 500; }

/* Main Wrapper & Layout */
#main-wrapper {
  margin-left: 240px;
  min-height: 100vh;
  background: var(--bg);
}
#main-content {
  max-width: 1720px;
  margin: auto;
  padding: 28px 36px 40px;
}
.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.page-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}
.page-heading p {
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 2px;
}
.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.review-shortcut {
  background: #ffffff;
}
.review-shortcut-count {
  min-width: 20px;
  padding: 2px 7px;
  border-radius: 9999px;
  background: var(--pastel-purple-bg);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}
.connection-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 9999px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.connection-pill[data-tone=good] { color: #047857; border-color: #a7f3d0; background: #ecfdf5; }
.connection-pill[data-tone=warning] { color: #b45309; border-color: #fde68a; background: #fffbeb; }
.connection-pill[data-tone=error] { color: #b91c1c; border-color: #fecaca; background: #fef2f2; }
.connection-pill[data-tone=good] .dot { background: #10b981; }
.connection-pill[data-tone=warning] .dot { background: #f59e0b; }
.connection-pill[data-tone=error] .dot { background: #ef4444; }
.live-clock {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.mobile-menu { display: none; }

/* Categorized Metric Cards (Soft Pastel Folder-Card Style from Reference Screenshot) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  position: relative;
  border-radius: var(--card-radius);
  padding: 18px 20px;
  overflow: hidden;
  min-height: 132px;
  box-shadow: var(--shadow-card);
  transition: transform .15s, box-shadow .15s;
  display: flex;
  flex-direction: column;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-floating);
}

/* Stat Card 1: Connected Cameras -> Pastel Sky Blue */
.stat-card:nth-child(1) {
  background: linear-gradient(135deg, var(--pastel-blue-bg) 0%, #e0f2fe 100%);
  border: 1px solid var(--pastel-blue-border);
}
.stat-card:nth-child(1) .stat-top span { color: var(--pastel-blue-text); }
.stat-card:nth-child(1) .stat-top .icon { color: var(--pastel-blue-accent); }
.stat-card:nth-child(1) .stat-value strong { color: var(--pastel-blue-text); }
.stat-card:nth-child(1) .stat-value span { color: #0284c7; }
.stat-card:nth-child(1) .stat-footer { color: #0369a1; }

/* Stat Card 2: Active Incidents -> Pastel Lilac / Soft Purple */
.stat-card:nth-child(2) {
  background: linear-gradient(135deg, var(--pastel-purple-bg) 0%, #ede9fe 100%);
  border: 1px solid var(--pastel-purple-border);
}
.stat-card:nth-child(2) .stat-top span { color: var(--pastel-purple-text); }
.stat-card:nth-child(2) .stat-top .icon { color: var(--pastel-purple-accent); }
.stat-card:nth-child(2) .stat-value strong { color: var(--pastel-purple-text); }
.stat-card:nth-child(2) .stat-value span { color: #6366f1; }
.stat-card:nth-child(2) .stat-footer { color: #4338ca; }

/* Stat Card 3: Session Incidents -> Pastel Peach / Warm Cream */
.stat-card:nth-child(3) {
  background: linear-gradient(135deg, var(--pastel-peach-bg) 0%, #ffedd5 100%);
  border: 1px solid var(--pastel-peach-border);
}
.stat-card:nth-child(3) .stat-top span { color: var(--pastel-peach-text); }
.stat-card:nth-child(3) .stat-top .icon { color: var(--pastel-peach-accent); }
.stat-card:nth-child(3) .stat-value strong { color: var(--pastel-peach-text); }
.stat-card:nth-child(3) .stat-value span { color: #ea580c; }
.stat-card:nth-child(3) .stat-footer { color: #c2410c; }

/* Stat Card 4: Processing Rate -> Pastel Mint / Sage Green */
.stat-card:nth-child(4) {
  background: linear-gradient(135deg, var(--pastel-green-bg) 0%, #dcfce7 100%);
  border: 1px solid var(--pastel-green-border);
}
.stat-card:nth-child(4) .stat-top span { color: var(--pastel-green-text); }
.stat-card:nth-child(4) .stat-top .icon { color: var(--pastel-green-accent); }
.stat-card:nth-child(4) .stat-value strong { color: var(--pastel-green-text); }
.stat-card:nth-child(4) .stat-value span { color: #16a34a; }
.stat-card:nth-child(4) .stat-footer { color: #15803d; }

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
}
.stat-top .icon { width: 20px; height: 20px; }
.stat-value {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 12px;
  position: relative;
  z-index: 1;
}
.stat-value strong {
  font-size: 32px;
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.stat-value > span { font-size: 12px; font-weight: 500; }
.stat-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 500;
  margin-top: auto;
  padding-top: 10px;
  position: relative;
  z-index: 1;
}
.stat-footer .dot { width: 6px; height: 6px; }
.stat-decoration { display: none; }
.mini-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  position: absolute;
  right: 18px;
  bottom: 18px;
  height: 24px;
  opacity: .45;
}
.mini-bars i {
  width: 4px;
  background: var(--pastel-green-accent);
  border-radius: 2px;
  height: 10px;
}
.mini-bars i:nth-child(2n) { height: 16px; }
.mini-bars i:nth-child(3n) { height: 12px; }
.mini-bars i:nth-child(4n) { height: 22px; }

/* Workspace Grid (Main Column + Right Incident Rail) */
.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}
.workspace-grid.full-width { grid-template-columns: minmax(0, 1fr); }
.primary-column { min-width: 0; }
.view-section:not([hidden]) ~ .view-section:not([hidden]) { margin-top: 24px; }
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  min-height: 40px;
}
.section-heading p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.section-actions { display: flex; align-items: center; gap: 12px; }
.source-type {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  background: #ffffff;
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 9999px;
}
.segmented-control {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f1f5f9;
  padding: 3px;
}
.segmented-control .icon-button {
  width: 30px;
  height: 28px;
  border: 0;
  background: none;
  border-radius: 7px;
  color: var(--muted);
}
.segmented-control .icon { width: 15px; height: 15px; }
.segmented-control .selected {
  color: var(--text);
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

/* Primary Live Monitoring Feed Focus & Cameras */
.camera-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
}
/* All camera cards share balanced 16:9 widescreen video proportions */
.standby-camera {
  display: flex;
  flex-direction: column;
}
.standby-camera .cam-placeholder {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 220px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px 18px;
  text-align: center;
  background: linear-gradient(150deg, #f8faff 0%, #f1f5f9 100%);
  box-sizing: border-box;
}
.standby-camera .cam-placeholder strong { font-size: 14px; font-weight: 600; color: var(--text); }
.standby-camera .cam-placeholder p { margin: 0; font-size: 12px; color: var(--muted); max-width: 260px; line-height: 1.4; }
.standby-camera .placeholder-icon {
  display: inline-grid !important;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0 0 4px;
  border-radius: 12px;
  color: var(--primary);
  background: var(--pastel-purple-bg);
  border: 1px solid var(--pastel-purple-border);
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.08);
  transition: transform .15s ease, background-color .15s ease;
}
.standby-camera:hover .placeholder-icon {
  transform: scale(1.05);
  background: #ede9fe;
}
.standby-camera .placeholder-icon .icon { width: 20px; height: 20px; }
.standby-camera .add-camera-source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  padding: 6px 14px;
  border-radius: 9999px;
  background: #ffffff;
  border: 1px solid var(--pastel-purple-border);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  transition: all .15s ease;
}
.standby-camera .add-camera-source:hover {
  background: var(--pastel-purple-bg);
  border-color: var(--primary);
  color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(79, 70, 229, 0.12);
}
.standby-camera .camera-footer { color: var(--muted); }

.camera-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  overflow: hidden;
  background: #ffffff;
  box-shadow: var(--shadow-card);
  min-width: 0;
}
.primary-camera {
  border-color: #cbd5e1;
}
.camera-header {
  height: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 18px;
  background: #ffffff;
  border-bottom: 1px solid var(--soft-line);
}
.camera-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.camera-name strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.camera-code {
  font-size: 11px;
  font-weight: 600;
  line-height: 22px;
  min-width: 26px;
  display: inline-block;
  text-align: center;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: var(--text-secondary);
}
.primary-camera .camera-code {
  color: var(--primary);
  border-color: var(--pastel-purple-border);
  background: var(--pastel-purple-bg);
}
.camera-state {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  background: #f8fafc;
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 9999px;
}
.camera-state .dot { width: 6px; height: 6px; }
.camera-state[data-tone=good] { color: #047857; border-color: #a7f3d0; background: #ecfdf5; }
.camera-state[data-tone=good] .dot { background: #10b981; }
.camera-state[data-tone=warning] { color: #b45309; border-color: #fde68a; background: #fffbeb; }
.camera-state[data-tone=warning] .dot { background: #f59e0b; }
.camera-state[data-tone=error] { color: #b91c1c; border-color: #fecaca; background: #fef2f2; }
.camera-state[data-tone=error] .dot { background: #ef4444; }

/* Camera Feed Container: Crisp High-Contrast Video Surface */
.camera-feed-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 220px;
  max-height: 520px;
  background: #090d16;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-sizing: border-box;
}
.camera-feed-box img#liveStream {
  height: 100%;
  width: 100%;
  object-fit: contain;
  display: block;
}
.feed-state {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, #1e293b, #0f172a 85%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 24px;
  gap: 8px;
  z-index: 3;
  color: #ffffff;
}
.feed-state-icon, .placeholder-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  margin-bottom: 8px;
}
.feed-state strong { font-size: 15px; font-weight: 600; }
.feed-state > span:last-of-type { font-size: 12.5px; color: #94a3b8; max-width: 320px; }
.feed-state .button { margin-top: 10px; }
.feed-connect-btn {
  margin-top: 14px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  padding: 10px 18px !important;
  border-radius: 12px !important;
  background: var(--primary) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.45) !important;
  border: 0 !important;
  cursor: pointer;
  transition: all .15s ease;
}
.feed-connect-btn:hover {
  background: var(--primary-hover) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.55) !important;
}
.feed-footer-connect-btn {
  padding: 7px 14px !important;
  font-size: 12px !important;
  border-radius: 10px !important;
  gap: 6px !important;
  min-height: 32px !important;
}
.feed-footer-connect-btn .icon {
  width: 14px !important;
  height: 14px !important;
}

/* Floating Frosted Control Badges */
.feed-caption {
  position: absolute;
  bottom: 14px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #0f172a;
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(226, 232, 240, 0.9);
  padding: 5px 12px;
  border-radius: 9999px;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  font-variant-numeric: tabular-nums;
}
.feed-mode {
  font-size: 10.5px;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.feed-mode::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--primary);
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: 0;
}
.cam-fullscreen-btn {
  position: absolute;
  bottom: 12px;
  right: 14px;
  width: 34px;
  height: 34px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #0f172a;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 50%;
  z-index: 4;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  transition: transform .15s, background .15s;
}
.cam-fullscreen-btn:hover {
  transform: scale(1.05);
  background: #ffffff;
}
.cam-fullscreen-btn .icon { width: 16px; height: 16px; }
.camera-overlay-alerts {
  position: absolute;
  top: 14px;
  left: 16px;
  z-index: 2;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cam-alert-tag {
  background: rgba(239, 68, 68, 0.92);
  border: 1px solid rgba(254, 202, 202, 0.8);
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 9999px;
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}
.camera-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 10px 18px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--soft-line);
}
.camera-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.stop-monitoring-btn {
  padding: 7px 14px !important;
  font-size: 12px !important;
  border-radius: 10px !important;
  gap: 6px !important;
  min-height: 32px !important;
  color: #dc2626 !important;
  border: 1px solid rgba(239, 68, 68, 0.35) !important;
  background: #fff1f2 !important;
  font-weight: 600 !important;
  cursor: pointer;
  transition: all .15s ease;
}
.stop-monitoring-btn:hover {
  background: #fee2e2 !important;
  border-color: #ef4444 !important;
  color: #b91c1c !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}
.stop-monitoring-btn .icon {
  width: 13px !important;
  height: 13px !important;
  color: currentColor;
}
.feed-stop-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 9999px;
  background: rgba(239, 68, 68, 0.9);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  margin-left: 4px;
  backdrop-filter: blur(4px);
  transition: all .15s ease;
}
.feed-stop-badge:hover {
  background: #dc2626;
  transform: scale(1.04);
}
.feed-stop-badge .icon {
  width: 11px;
  height: 11px;
}
.camera-footer > span { display: flex; align-items: center; gap: 6px; }
.source-filename {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block !important;
  color: var(--text-secondary);
  font-weight: 500;
}
.source-context {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}
.source-context .icon { width: 15px; height: 15px; color: var(--primary); }
.source-context a { color: var(--primary); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }

/* Fullscreen mode */
.primary-camera:fullscreen {
  width: 100vw;
  height: 100vh;
  border: 0;
  border-radius: 0;
  background: #000000;
}
.primary-camera:fullscreen .camera-feed-box {
  flex: 1;
  aspect-ratio: auto;
  min-height: 0;
  max-height: none;
}
.primary-camera:fullscreen img { height: 100%; width: 100%; object-fit: contain; }
.primary-camera:fullscreen .camera-header {
  height: 52px;
  background: #ffffff;
}

/* Incident Inbox (Compact Right Rail) */
.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-card);
}
.incident-inbox {
  overflow: hidden;
  position: sticky;
  top: 24px;
  min-height: 620px;
  display: flex;
  flex-direction: column;
}
.inbox-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--soft-line);
}
.inbox-heading h2 { font-size: 15px; font-weight: 650; }
.inbox-icon {
  width: 32px;
  height: 32px;
  background: var(--pastel-purple-bg);
  border: 1px solid var(--pastel-purple-border);
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--primary);
}
.inbox-icon .icon { width: 16px; height: 16px; }
.inbox-count {
  margin-left: auto;
  background: var(--pastel-purple-bg);
  color: var(--primary);
  border: 1px solid var(--pastel-purple-border);
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
}
.inbox-tabs {
  display: flex;
  margin: 16px 18px 0;
  gap: 4px;
  flex-shrink: 0;
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px;
}
.inbox-tabs button {
  width: 50%;
  border: 0;
  border-radius: 8px;
  background: none;
  font-size: 12px;
  font-weight: 500;
  padding: 8px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .15s, color .15s, box-shadow .15s;
}
.inbox-tabs button.selected {
  background: #ffffff;
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.inbox-tabs button span {
  font-size: 10.5px;
  min-width: 18px;
  background: #f1f5f9;
  border-radius: 9999px;
  color: var(--muted);
  padding: 1px 6px;
  font-weight: 600;
}
.inbox-tabs button.selected span {
  background: var(--pastel-purple-bg);
  color: var(--primary);
}
.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  max-height: 640px;
  overflow-y: auto;
}
.alerts-list:empty { display: none; }
.alert-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow-subtle);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.alert-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  border-color: #cbd5e1;
}
.alert-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  justify-content: space-between;
}
.alert-title {
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.4;
  color: var(--text);
}
.live-badge {
  display: inline-block;
  border: 1px solid #fecaca;
  background: #fee2e2;
  color: #dc2626;
  border-radius: 9999px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.alert-card.stale {
  border-left-color: var(--subtle);
  background: #fafbfc;
}
.alert-card.stale .live-badge {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: var(--muted);
}
.alert-cam {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 500;
}
.alert-confidence {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 10px;
}
.alert-confidence strong {
  color: var(--text);
  font-weight: 600;
}
.confidence-track {
  height: 5px;
  border-radius: 9999px;
  background: #f1f5f9;
  margin-top: 6px;
  overflow: hidden;
}
.confidence-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  border-radius: 9999px;
  transition: width .2s;
}
.alert-reasoning {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-top: 9px;
}
.stale-note {
  font-size: 11px;
  margin-top: 6px;
  color: var(--muted);
}
.alert-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.alert-actions button {
  font-size: 11.5px;
  padding: 7px 10px;
  min-height: 32px;
  flex: 1;
  border-radius: 10px;
}
.review-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--mint);
  margin-top: 8px;
  display: block;
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.empty-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  background: var(--pastel-purple-bg);
  border: 1px solid var(--pastel-purple-border);
  border-radius: 18px;
  margin-bottom: 14px;
  color: var(--primary);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.08);
}
.empty-icon .icon { width: 24px; height: 24px; }
.empty-state h3 {
  font-size: 14.5px;
  color: var(--text);
  font-weight: 650;
  margin-bottom: 6px;
}
.empty-state p {
  font-size: 12.5px;
  line-height: 1.6;
  max-width: 280px;
}
.empty-state .text-button { margin-top: 14px; }
.inbox-empty {
  flex: 1;
  justify-content: center;
  min-height: 240px;
  padding: 24px 18px;
}
.inbox-empty p { max-width: 220px; }
.inbox-empty .eyebrow { font-size: 10px; color: var(--subtle); }
.empty-rule { width: 32px; height: 1px; background: var(--line); margin: 20px 0 12px; }
.inbox-footer {
  margin-top: auto;
  padding: 14px 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11.5px;
  border-top: 1px solid var(--soft-line);
  background: #f8fafc;
}
.inbox-footer .icon { width: 15px; height: 15px; color: var(--primary); }

/* Activity & Intelligence (Analytics) */
.bottom-analytics-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.analytics-card {
  padding: 20px;
  min-width: 0;
}
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.analytics-card .panel-heading { margin-bottom: 16px; }
.analytics-card h3 { font-size: 14px; font-weight: 650; }
.analytics-card .subtle-badge { font-size: 11px; }

/* 5-Level Activity Heatmap */
.heatmap-container {
  display: grid;
  grid-template-columns: repeat(18, minmax(0, 1fr));
  grid-template-rows: repeat(4, 16px);
  gap: 4px;
}
.heatmap-cell {
  background: #f1f5f9;
  border-radius: 4px;
  transition: transform .1s;
}
.heatmap-cell:hover { transform: scale(1.15); }
.chart-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  margin-top: 14px;
  font-variant-numeric: tabular-nums;
}
.heatmap-legend { display: flex; align-items: center; gap: 4px; font-size: 11px; }
.heatmap-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: #f1f5f9;
  border-radius: 3px;
}
.heatmap-legend i:nth-of-type(2) { background: #dbeafe; }
.heatmap-legend i:nth-of-type(3) { background: #93c5fd; }
.heatmap-legend i:nth-of-type(4) { background: #818cf8; }
.heatmap-legend i:nth-of-type(5) { background: #4f46e5; }

/* Score Plot Chart */
.score-current {
  font-size: 14px;
  font-weight: 650;
  color: var(--primary);
  background: var(--pastel-purple-bg);
  padding: 2px 9px;
  border-radius: 9999px;
  font-variant-numeric: tabular-nums;
}
.score-plot { display: flex; gap: 12px; height: 80px; }
.chart-scale {
  font-size: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--subtle);
  width: 20px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.chart-container { position: relative; min-width: 0; flex: 1; }
.chart-container svg { height: 100%; width: 100%; overflow: visible; }
.chart-guides {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 4 4;
  vector-effect: non-scaling-stroke;
}
.trend-line {
  fill: none;
  stroke: var(--primary);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.event-summary { padding: 22px; margin-top: 20px; }
.event-breakdown { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.breakdown-row {
  display: grid;
  grid-template-columns: 160px 1fr 40px;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--text-secondary);
}
.breakdown-track { height: 8px; background: #f1f5f9; border-radius: 9999px; overflow: hidden; }
.breakdown-fill { height: 100%; background: linear-gradient(90deg, #6366f1, #818cf8); border-radius: 9999px; }
.breakdown-row strong { text-align: right; font-weight: 600; color: var(--text); }
body[data-view=overview] .event-summary { display: none; }

/* Incident History Destination */
.history-panel, .health-panel, .reserve-panel, .preferences-panel { padding: 26px; }
.history-panel .panel-heading h2, .health-panel h2, .preferences-panel h2 { margin-bottom: 4px; }
.history-filters { display: flex; gap: 14px; margin: 20px 0 18px; }
.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  padding-left: 14px;
  flex: 1;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.search-field .icon { width: 16px; height: 16px; color: var(--muted); }
.search-field input { width: 100%; border: 0; background: none; padding: 10px 12px; font-size: 13px; box-shadow: none; }
.history-filters select { font-size: 13px; min-width: 170px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; white-space: nowrap; }
th {
  color: var(--muted);
  font-weight: 600;
  font-size: 11.5px;
  padding: 12px 14px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 14px;
  border-bottom: 1px solid var(--soft-line);
  color: var(--text-secondary);
}
tr:hover td { background: #f8fafc; }
td strong { font-size: 13px; font-weight: 600; color: var(--text); }
td small { font-size: 11px; display: block; color: var(--muted); margin-top: 2px; }
.table-review {
  font-size: 11px;
  font-weight: 600;
  border-radius: 9999px;
  padding: 4px 10px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}
.table-review.reviewed { color: #166534; background: #dcfce7; border-color: #bbf7d0; }
.table-score { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }

/* Camera Health & Source Verification */
.health-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: #ffffff;
}
.health-source {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  padding: 34px 24px;
  min-width: 0;
  border-right: 1px solid var(--line);
}
.health-source-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  background: #ffffff;
  border: 1px solid var(--pastel-blue-border);
  color: var(--cyan);
  border-radius: 18px;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.1);
}
.health-source-icon .icon { width: 28px; height: 28px; }
.health-source h3 { font-size: 16px; color: var(--text); }
.health-source p { max-width: 100%; overflow-wrap: anywhere; font-size: 12px; color: var(--muted); }
.health-details { padding: 22px 28px; margin: 0; }
.health-details > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--soft-line);
  font-size: 13px;
}
.health-details > div:last-child { border: 0; }
.health-details dt { color: var(--muted); font-weight: 500; }
.health-details dd { margin: 0; text-align: right; color: var(--text); font-weight: 600; }
.status-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--cyan);
  border: 1px solid var(--pastel-blue-border);
  background: #ffffff;
  padding: 4px 12px;
  border-radius: 9999px;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.06);
}
.reserve-panel { margin-top: 20px; }
.reserve-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}
.reserve-grid > div {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f8fafc;
}
.reserve-grid strong { font-size: 13px; font-weight: 600; color: var(--text); }
.reserve-grid > div > span:last-child { margin-left: auto; font-size: 11.5px; color: var(--muted); font-weight: 500; }

/* Preferences Panel */
.preferences-panel { max-width: 960px; }
.preference-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 32px;
  padding: 22px 0;
  border-bottom: 1px solid var(--soft-line);
}
.preference-row:first-of-type { margin-top: 16px; }
.preference-row label { font-size: 13.5px; font-weight: 600; color: var(--text); }
.preference-row p { font-size: 12px; color: var(--muted); margin-top: 4px; }
.preference-row > input, .preference-row > select { width: 280px; font-size: 13px; }
.preference-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 24px;
}

/* Telegram Alert Recipients */
.recipient-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 820px;
  padding: 26px;
}
.recipient-setup {
  border: 1px solid #fed7aa;
  border-radius: 16px;
  padding: 20px;
  background: var(--pastel-peach-bg);
  display: grid;
  gap: 12px;
  color: #7c2d12;
  font-size: 13px;
  line-height: 1.65;
}
.recipient-setup strong { color: #431407; font-size: 14.5px; }
.recipient-setup code {
  display: block;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid #fed7aa;
  border-radius: 10px;
  color: #ea580c;
  font-size: 12.5px;
  overflow-wrap: anywhere;
}
.recipient-setup .inline-command { display: inline; padding: 2px 6px; font-size: 12px; }
.recipient-setup a { color: #ea580c; text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.recipient-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 0 24px; border-bottom: 1px solid var(--line); }
.recipient-actions #recipientLogout { margin-left: auto; }
.recipient-help { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; background: #f8fafc; font-size: 12px; color: var(--muted); }
.recipient-help summary { cursor: pointer; font-weight: 600; color: var(--text-secondary); }
.recipient-help p { margin-top: 10px; line-height: 1.75; }
.recipient-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 24px 0 16px; }
.recipient-list-heading h3 { display: flex; align-items: center; gap: 9px; font-size: 16px; }
.recipient-list-heading p { margin-top: 5px; font-size: 12px; color: var(--muted); }
.recipient-total { display: inline-grid; place-items: center; min-width: 24px; height: 24px; border-radius: 8px; background: var(--pastel-purple-bg); color: var(--primary); font-size: 12px; }
.recipient-channel { font-size: 11px; color: var(--muted); white-space: nowrap; }
.recipient-invite {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
}
.recipient-invite img {
  width: 180px;
  height: 180px;
  padding: 10px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: var(--shadow-subtle);
  border: 1px solid var(--line);
}
.recipient-invite p { margin: 6px 0 12px; }
.recipient-invite div { display: grid; justify-items: start; gap: 8px; }
.recipient-invite a { color: var(--primary); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.recipient-rows { display: grid; gap: 10px; }
.recipient-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.recipient-avatar { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: linear-gradient(135deg, #ede9fe, #e0e7ff); color: #5b21b6; font-size: 16px; font-weight: 650; }
.recipient-identity { display: grid; gap: 5px; min-width: 0; overflow-wrap: anywhere; }
.recipient-identity strong { font-size: 14px; font-weight: 650; }
.recipient-identity > span { color: var(--muted); font-size: 12px; }
.recipient-status { display: inline-flex; align-items: center; gap: 6px; border: 1px solid; border-radius: 999px; padding: 5px 10px; font-size: 11px; font-weight: 600; }
.recipient-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.recipient-status.is-active { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.recipient-status.is-paused { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.recipient-remove { background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 9px; padding: 8px 12px; font-size: 12px; }
.recipient-remove:hover { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.recipient-remove:disabled { opacity: .5; cursor: wait; }
.recipient-connection { display: flex; align-items: center; gap: 8px; margin-top: 20px; padding: 14px 0 0; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.recipient-connection::before { content: ''; flex-shrink: 0; width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; }
.recipient-connection[data-state=connected]::before { background: #10b981; }
.recipient-connection[data-state=error]::before { background: #ef4444; }
.recipient-empty { display: grid; justify-items: center; gap: 10px; padding: 32px 24px; border: 1px dashed var(--line); border-radius: 14px; text-align: center; }
.recipient-empty > .icon { color: var(--primary); width: 28px; height: 28px; }
.recipient-empty strong { font-size: 14px; }
.recipient-empty p { font-size: 12px; line-height: 1.7; color: var(--muted); max-width: 340px; }
.recipient-panel > .form-message:empty { display: none; }
@media(max-width: 600px) {
  .recipient-panel { padding: 20px; }
  .recipient-list-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .recipient-row { grid-template-columns: 42px minmax(0, 1fr) auto; gap: 12px; padding: 16px; }
  .recipient-avatar { width: 42px; height: 42px; }
  .recipient-remove { grid-column: 2 / -1; justify-self: start; }
  .recipient-actions #recipientLogout { margin-left: 0; }
  .recipient-invite { flex-direction: column; align-items: flex-start; }
}

/* Dialogs & Modal Windows */
dialog {
  color: var(--text);
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 24px;
  padding: 28px;
  width: 520px;
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  box-shadow: var(--shadow-floating);
}
dialog::backdrop {
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.modal-header .eyebrow { font-size: 11px; }
.modal-header h2 { font-size: 22px; letter-spacing: -0.025em; margin-top: 6px; }
.modal-header .icon-button { align-self: flex-start; }
.dialog-intro { font-size: 13px; line-height: 1.65; color: var(--muted); margin: 12px 0 20px; }
.modal-tabs {
  display: flex;
  gap: 4px;
  background: #f1f5f9;
  border: 1px solid var(--line);
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 22px;
}
.modal-tab {
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 500;
  flex: 1;
  transition: background .15s, color .15s;
}
.modal-tab.active {
  color: var(--primary);
  background: #ffffff;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
.modal-form { display: flex; flex-direction: column; gap: 14px; }
.modal-form > label { font-size: 12.5px; font-weight: 500; color: var(--text); }
.upload-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 16px;
  background: #f8fafc;
  min-height: 180px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 24px;
  gap: 8px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.upload-zone:hover {
  border-color: var(--primary);
  background: var(--pastel-purple-bg);
}
.upload-zone:focus-within {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}
.upload-zone input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.upload-icon {
  width: 44px;
  height: 44px;
  background: var(--pastel-purple-bg);
  border: 1px solid var(--pastel-purple-border);
  color: var(--primary);
  border-radius: 12px;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}
.upload-zone strong { font-size: 13.5px; font-weight: 600; color: var(--text); max-width: 100%; overflow-wrap: anywhere; }
.upload-zone > span:last-of-type { font-size: 11.5px; color: var(--muted); }
.form-hint {
  font-size: 12px;
  line-height: 1.6;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text-secondary);
}
.form-message {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--primary);
  margin-top: 12px;
  overflow-wrap: anywhere;
  font-weight: 500;
}
.form-message.error { color: #dc2626; }
.form-message.success { color: #16a34a; }
.dialog-footnote {
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
  margin-top: 20px;
  display: flex;
  gap: 8px;
}
.dialog-footnote .icon { width: 15px; height: 15px; color: var(--primary); margin-top: 1px; }
progress { width: 100%; height: 8px; accent-color: var(--primary); margin-top: 16px; border-radius: 9999px; }

/* Incident Review Dialog */
.incident-dialog { width: 620px; }
.incident-snapshot {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: #f1f5f9;
  min-height: 160px;
  display: grid;
  place-items: center;
}
.incident-snapshot img { display: block; width: 100%; max-height: 320px; object-fit: contain; }
#snapshotEmpty { padding: 32px; text-align: center; color: var(--muted); }
#snapshotEmpty .icon { width: 32px; height: 32px; color: var(--subtle); }
#snapshotEmpty p { font-size: 13px; font-weight: 500; color: var(--text); margin: 8px 0 4px; }
#snapshotEmpty span { font-size: 11.5px; }
#snapshotCaption { margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.incident-details { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 20px 0; }
.incident-details dt { font-size: 11.5px; color: var(--muted); }
.incident-details dd { margin: 4px 0 0; font-size: 13px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.review-reason {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
  background: #f8fafc;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.review-disposition { margin-top: 20px; display: flex; flex-direction: column; gap: 8px; }
.review-disposition > label { font-size: 12.5px; font-weight: 600; color: var(--text); }
.review-disposition p { font-size: 11.5px; color: var(--muted); }
.dialog-actions { margin-top: 24px; display: flex; gap: 10px; justify-content: flex-end; }

/* Caution Alert Recipient Overlay Dialog */
.caution-dialog {
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 24px;
  background: #ffffff;
  padding: 0;
  max-width: 520px;
  width: min(520px, calc(100vw - 32px));
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(245, 158, 11, 0.2);
  overflow: hidden;
  animation: cautionDialogFadeIn .2s cubic-bezier(0.16, 1, 0.3, 1);
}
.caution-dialog::backdrop {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
@keyframes cautionDialogFadeIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.caution-dialog-content {
  padding: 26px 28px 24px;
  display: flex;
  flex-direction: column;
}
.caution-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.caution-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
  padding: 5px 12px;
  border-radius: 9999px;
}
.pulse-amber {
  width: 7px;
  height: 7px;
  background: #f59e0b;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.6);
  animation: pulseAmberDot 1.8s infinite;
}
@keyframes pulseAmberDot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}
.caution-icon-wrapper {
  position: relative;
  align-self: flex-start;
  margin-bottom: 14px;
}
.caution-icon-box {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1.5px solid #fde68a;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 18px -4px rgba(245, 158, 11, 0.28);
}
.caution-bell-icon {
  width: 25px;
  height: 25px;
  color: #d97706;
}
.caution-title {
  font-size: 21px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 8px;
  letter-spacing: -0.025em;
  line-height: 1.25;
}
.caution-desc {
  font-size: 13px;
  color: #475569;
  line-height: 1.55;
  margin: 0 0 16px;
}
.caution-desc strong {
  color: #b45309;
}
.caution-callout {
  background: linear-gradient(145deg, #fafbff, #f4f6fb);
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 20px;
}
.caution-callout-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 8px;
}
.amber-icon {
  width: 17px;
  height: 17px;
  color: #d97706;
}
.caution-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.caution-list li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  color: #475569;
  line-height: 1.4;
}
.caution-list li span {
  font-weight: 700;
  font-size: 11px;
}
.caution-list li:nth-child(1) span { color: #16a34a; }
.caution-list li:nth-child(2) span { color: #dc2626; }
.caution-list li:nth-child(3) span { color: #d97706; }
.caution-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}
.caution-setup-btn {
  flex: 1.25;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 12px;
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  color: #ffffff;
  border: 0;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
  transition: transform .15s, box-shadow .15s;
  cursor: pointer;
}
.caution-setup-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.45);
}
.caution-skip-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 12px;
  background: #ffffff;
  color: #475569;
  border: 1px solid #cbd5e1;
  transition: all .15s ease;
  cursor: pointer;
}
.caution-skip-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}
.caution-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 11.5px;
  color: #64748b;
  cursor: pointer;
  user-select: none;
}
.caution-remember input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Judge Onboarding & Quick Tour Dialog */
.guide-dialog { width: 540px; padding: 32px; }
.guide-dialog > .eyebrow { margin-top: 20px; font-size: 11px; color: var(--primary); }
.guide-dialog > h2 { font-size: 32px; line-height: 1.2; letter-spacing: -0.03em; margin-top: 8px; }
.tour-steps {
  list-style: none;
  padding: 0;
  margin: 24px 0 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.tour-steps li { display: flex; gap: 16px; align-items: flex-start; }
.tour-steps li > span {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--primary);
  width: 34px;
  height: 34px;
  background: var(--pastel-purple-bg);
  border: 1px solid var(--pastel-purple-border);
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.tour-steps strong { font-size: 13.5px; font-weight: 650; color: var(--text); }
.tour-steps p { color: var(--muted); font-size: 12.5px; line-height: 1.6; margin-top: 4px; }
.guide-dialog .dialog-footnote { text-align: center; display: block; }

/* Technical Diagnostics Drawer */
.drawer {
  margin: 0 0 0 auto;
  width: 500px;
  height: 100dvh;
  max-height: 100dvh;
  max-width: 100vw;
  border-radius: 0;
  border: 0;
  border-left: 1px solid var(--line);
  padding: 28px;
}
.drawer h3 { font-size: 12px; margin: 24px 0 8px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.code-box {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  font: 11px/1.7 ui-monospace, SFMono-Regular, Consolas, monospace;
  color: var(--text);
}

/* Floating Toast Notification */
.toast {
  position: fixed;
  bottom: 24px;
  left: calc(50% + 120px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border: 1px solid #bbf7d0;
  border-radius: 9999px;
  background: #f0fdf4;
  color: #166534;
  box-shadow: var(--shadow-floating);
  font-size: 13px;
  font-weight: 600;
  max-width: calc(100vw - 40px);
  z-index: 100;
}
.toast .icon { width: 18px; height: 18px; color: #16a34a; }
.noscript-notice {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 18px;
  background: #fee2e2;
  color: #991b1b;
  text-align: center;
  z-index: 100;
  font-weight: 600;
}
.nav-backdrop { display: none; }

/* Scrollbars */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Footer Tools */
.page-footer {
  margin-top: 36px;
  border-top: 1px solid var(--line);
  padding: 18px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  gap: 16px;
}
.footer-tools {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-left: auto;
}
.footer-tools .text-button { font-size: 12px; }

/* Responsive Breakpoints & Device Density Rules */
@media (min-width: 1440px) {
  #main-content { padding: 32px 42px 48px; }
  .stats-grid { gap: 18px; }
  .stat-card { padding: 20px 24px; min-height: 140px; }
  .stat-value strong { font-size: 34px; }
  .workspace-grid { grid-template-columns: minmax(0, 1fr) 350px; gap: 28px; }
}

@media (max-width: 1280px) {
  #sidebar { width: 220px; padding: 22px 10px 0; }
  #main-wrapper { margin-left: 220px; }
  #main-content { padding: 24px 26px 36px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .workspace-grid { grid-template-columns: minmax(0, 1fr) 310px; gap: 20px; }
  .toast { left: calc(50% + 110px); }
}

@media (max-width: 1060px) {
  .workspace-grid { grid-template-columns: minmax(0, 1fr); }
  .incident-inbox { position: static; min-height: 340px; margin-top: 8px; }
  .alerts-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inbox-empty { min-height: 200px; }
  .inbox-empty .empty-rule, .inbox-empty .eyebrow { display: none; }
  .reserve-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  #sidebar {
    transform: translateX(-100%);
    width: 240px;
    transition: transform .25s ease-in-out;
    box-shadow: 4px 0 24px rgba(15, 23, 42, 0.12);
  }
  body.nav-open #sidebar { transform: translateX(0); }
  .nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 0;
    z-index: 35;
  }
  body.nav-open .nav-backdrop { display: block; }
  #main-wrapper { margin-left: 0; }
  .mobile-menu { display: inline-flex; width: 34px; height: 34px; }
  #main-content { padding: 20px 18px 32px; }
  .page-heading { margin-bottom: 20px; gap: 14px; flex-wrap: wrap; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .page-actions .button { font-size: 12px; padding: 8px 12px; }
  .toast { left: 50%; }
  .history-panel, .health-panel, .reserve-panel, .preferences-panel { padding: 18px; }
  .preference-row { flex-direction: column; align-items: stretch; gap: 12px; }
  .preference-row > input, .preference-row > select { width: 100%; }
  .drawer { width: 100vw; max-width: 100vw; }
}

@media (max-width: 390px) {
  /* High-fidelity 390px Mobile Viewport Spec */
  #main-content { padding: 16px 14px 28px; }
  h1 { font-size: 24px; }
  .page-heading p { font-size: 12px; }
  .stats-grid { grid-template-columns: 1fr; gap: 12px; }
  .stat-card { padding: 16px 18px; min-height: 110px; }
  .stat-value strong { font-size: 28px; }
  .camera-header { height: 46px; padding: 0 14px; }
  .camera-name strong { font-size: 13px; }
  .camera-footer { padding: 8px 14px; font-size: 11px; }
  .alerts-list { grid-template-columns: 1fr; }
  .bottom-analytics-row { grid-template-columns: 1fr; gap: 14px; }
  .health-grid { grid-template-columns: 1fr; }
  .health-source { border-right: 0; border-bottom: 1px solid var(--line); padding: 24px 16px; }
  .health-details { padding: 16px; }
  .history-filters { flex-direction: column; }
  .history-filters select { width: 100%; }
  .dialog-actions { flex-direction: column; }
  .dialog-actions .button { width: 100%; }
  dialog { padding: 20px; border-radius: 18px; }
}

/* Overview density. */
@media (min-width: 1061px) {
  body[data-view=overview] #main-content { padding: 28px 26px 12px; }
  body[data-view=overview] .page-heading { margin-bottom: 18px; gap: 16px; }
  body[data-view=overview] .page-heading h1 { font-size: 28px; }
  body[data-view=overview] .page-heading p { font-size: 12px; }
  body[data-view=overview] .page-actions { gap: 8px; }
  body[data-view=overview] .page-actions .button { padding: 10px 12px; font-size: 12px; }
  body[data-view=overview] .workspace-grid { grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; }
  body[data-view=overview] .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
  body[data-view=overview] .stat-card { min-height: 128px; padding: 16px 20px; }
  body[data-view=overview] .stat-top { gap: 12px; }
  body[data-view=overview] .stat-value { margin-top: 10px; flex-wrap: wrap; }
  body[data-view=overview] .stat-footer { flex-wrap: wrap; padding-top: 8px; }
  body[data-view=overview] .mini-bars { display: none; }
  body[data-view=overview] .section-heading { margin-bottom: 12px; }
  body[data-view=overview] .bottom-analytics-row { gap: 14px; }
  body[data-view=overview] .analytics-card { padding: 16px; }
  body[data-view=overview] .analytics-card h3 { font-size: 13px; }
  body[data-view=overview] .analytics-card .subtle-badge { font-size: 9px; }
  body[data-view=overview] .heatmap-container { grid-template-rows: repeat(4, 14px); gap: 3px; }
  body[data-view=overview] .score-plot { height: 65px; }
  body[data-view=overview] .chart-footer { font-size: 10px; margin-top: 10px; }
  body[data-view=overview] .incident-inbox { min-height: 0; height: clamp(440px, calc(100dvh - 195px), 650px); }
  body[data-view=overview] .alerts-list { min-height: 0; flex: 1; }
  body[data-view=overview] .inbox-empty { min-height: 0; padding: 24px 18px; }
  body[data-view=overview] .inbox-empty .empty-icon { flex-shrink: 0; }
  body[data-view=overview] .inbox-empty .empty-rule,
  body[data-view=overview] .inbox-empty .eyebrow { display: none; }
  body[data-view=overview] .page-footer { margin-top: 16px; padding: 12px 0; }
}

/* Shared spacing and a bounded monitoring workspace. Every ancestor of the
   card grid participates in height allocation; card content cannot size rows. */
:root { --card-radius: 16px; }
#sidebar { width: 210px; padding: 20px 12px 0; }
#main-wrapper { margin-left: 210px; }
#main-content { padding: 22px 26px 14px; }
.brand { margin-bottom: 18px; }
.brand-logo { max-width: 155px; }
.brand-caption { display: none; }
.workspace-note { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); padding: 10px 12px; }
.sidebar-bottom { padding-top: 12px; }
.workspace-user { padding-top: 12px; }
.page-heading { align-items: center; margin-bottom: 16px; gap: 16px; }
.page-heading h1 { font-size: 26px; line-height: 1.25; }
.page-heading p { font-size: 12px; margin-top: 5px; }
.page-actions { gap: 8px; }
.page-actions .button { padding: 9px 12px; font-size: 12px; white-space: nowrap; }
.workspace-grid { gap: 18px; grid-template-columns: minmax(0, 1fr) 290px; }
.section-heading { min-height: 32px; margin-bottom: 10px; }
.section-heading h2 { font-size: 16px; }
.camera-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.camera-card { border-radius: var(--card-radius); }
.camera-header { height: 46px; padding: 0 16px; gap: 8px; }
.camera-name { gap: 10px; }
.camera-name strong { font-size: 13px; }
.camera-state { font-size: 11px; padding: 4px 8px; }
.camera-footer { min-height: 40px; padding: 8px 16px; font-size: 11.5px; flex-shrink: 0; gap: 8px; }
.camera-footer .text-button { font-size: 11.5px; white-space: nowrap; }
.source-filename { min-width: 0; flex: 1; }
.standby-camera .cam-placeholder { aspect-ratio: 16 / 9; min-height: 220px; }
.source-context { justify-content: space-between; margin-top: 10px; font-size: 11px; min-height: 22px; }
.source-context span { min-width: 0; }
.feed-caption { left: 12px; bottom: 12px; padding: 5px 10px; font-size: 10.5px; gap: 8px; }
.cam-fullscreen-btn { right: 12px; bottom: 12px; width: 32px; height: 32px; }
.feed-state { padding: 16px; gap: 6px; }
.feed-state-icon { width: 36px; height: 36px; margin-bottom: 2px; }
.feed-state strong { font-size: 14px; }
.feed-state > span:last-of-type { font-size: 11.5px; }
.camera-grid.focus-layout { grid-template-columns: minmax(0, 1fr); }
.camera-grid.focus-layout .standby-camera { display: none; }
.camera-grid.focus-layout .camera-feed-box { aspect-ratio: 16 / 9; max-height: 600px; }
.demo-bar { display: flex; align-items: center; gap: 16px; padding: 10px 14px; border: 1px solid #dce2f8; border-radius: 12px; background: #f0f3ff; margin-bottom: 14px; }
.demo-bar-label { display: flex; gap: 8px; align-items: center; color: #3730a3; font-size: 12px; white-space: nowrap; }
.demo-videos { display: flex; align-items: center; flex: 1; gap: 8px; min-width: 0; overflow-x: auto; }
.demo-item { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border: 1px solid #dce2f8; border-radius: 8px; background: white; font-size: 11px; }
.demo-item button, .demo-item a { color: var(--primary); font-size: 11px; padding: 3px 5px; border: 0; background: none; }
.demo-item a { border-left: 1px solid var(--line); }
.demo-item { flex-shrink: 0; white-space: nowrap; }
.demo-item > span { max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.demo-bar > .text-button { font-size: 11px; white-space: nowrap; }
.service-notice { border: 1px solid #fde68a; background: #fffbeb; color: #92400e; padding: 8px 12px; border-radius: 10px; margin-bottom: 12px; font-size: 12px; overflow-wrap: anywhere; }
.service-notice[data-tone=error] { color: #991b1b; background: #fef2f2; border-color: #fecaca; }
.incident-inbox { min-height: 400px; top: 16px; }
.inbox-heading { padding: 14px; gap: 10px; }
.inbox-heading h2 { font-size: 14px; }
.inbox-tabs { margin: 10px 12px 0; }
.inbox-empty { min-height: 0; padding: 16px; }
.inbox-empty .empty-icon { width: 40px; height: 40px; margin-bottom: 10px; }
.inbox-empty h3 { font-size: 13px; }
.inbox-empty p { font-size: 12px; }
.inbox-footer { padding: 10px; font-size: 10.5px; }
.alerts-list { padding: 12px; }
.alert-card { flex-shrink: 0; }
.page-footer { margin-top: 12px; padding: 8px 0 0; font-size: 10.5px; }
.page-footer .text-button { font-size: 10.5px; }
.footer-tools { gap: 12px; }
.modal-tabs { gap: 4px; }
.modal-tab { padding: 9px 10px; }
.server-camera { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.server-camera summary { cursor: pointer; color: var(--muted); margin-bottom: 10px; }
.server-camera label { display: block; }
#webcamPreview { width: 100%; max-height: 180px; background: #0f172a; border-radius: 10px; object-fit: contain; }
.toast { max-width: min(480px, calc(100vw - 28px)); z-index: 100; }
.toast[data-tone=error] { border-color: #fca5a5; }
.toast[data-tone=incident] { border-color: #f59e0b; }

@media (min-width: 1000px) and (min-height: 620px) {
  body[data-view=monitoring] #main-wrapper { min-height: 100dvh; }
  body[data-view=monitoring] #main-content { min-height: 100%; display: flex; flex-direction: column; }
  body[data-view=monitoring] .page-heading,
  body[data-view=monitoring] .demo-bar,
  body[data-view=monitoring] .service-notice,
  body[data-view=monitoring] .page-footer { flex: 0 0 auto; }
  body[data-view=monitoring] .workspace-grid { align-items: start; }
  body[data-view=monitoring] .incident-inbox { position: sticky; top: 16px; }
  body[data-view=monitoring] .primary-camera:fullscreen { grid-template-rows: 42px minmax(0, 1fr) 34px; }
}
@media (min-width: 1000px) and (max-height: 790px) {
  #main-content { padding: 16px 22px 12px; }
  .page-heading { margin-bottom: 12px; }
  .page-heading h1 { font-size: 24px; }
  .demo-bar { margin-bottom: 12px; padding: 8px 12px; }
  .camera-grid { gap: 14px; }
  .feed-state > span:last-of-type { max-width: 260px; }
}
@media (max-width: 1199px) {
  #sidebar { width: 190px; }
  #main-wrapper { margin-left: 190px; }
  .workspace-grid { grid-template-columns: minmax(0, 1fr) 250px; gap: 14px; }
  .page-heading { flex-wrap: wrap; }
  .page-heading p { display: none; }
  .page-actions { margin-left: auto; }
  .page-actions .button { font-size: 11px; padding: 8px 10px; }
  .camera-state { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 999px) {
  .workspace-grid { grid-template-columns: minmax(0, 1fr); }
  .incident-inbox { position: static; min-height: 260px; }
  .camera-grid { grid-auto-rows: minmax(220px, auto); }
  .demo-bar { flex-wrap: wrap; gap: 10px; }
  .demo-videos { flex-basis: 60%; }
}
@media (max-width: 760px) {
  #sidebar { width: 220px; }
  #main-wrapper { margin-left: 0; }
  #main-content { padding: 16px; }
  .page-heading { gap: 10px; }
  .page-actions { margin-left: 0; }
  .page-heading > div:first-child { display: flex; align-items: center; gap: 10px; }
  .page-footer { flex-wrap: wrap; }
  .footer-tools { margin-left: 0; }
}
@media (max-width: 480px) {
  .camera-grid { grid-template-columns: minmax(0, 1fr); }
  .page-actions .button { min-height: 36px; }
  .camera-header { height: 44px; }
  .demo-videos { flex-basis: 100%; }
  .source-context { flex-wrap: wrap; }
  .section-actions { gap: 6px; }
  .source-type { font-size: 10px; padding: 3px 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

/* Supplied video library */
.demo-bar { display: block; padding: 18px 20px; border-color: #dce2f8; background: radial-gradient(ellipse at top right, #e4e9ff, transparent 65%), #f5f7ff; border-radius: 16px; }
.demo-library-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 14px; }
.demo-eyebrow { color: #6366b8; font-size: 9px; font-weight: 800; letter-spacing: .16em; }
.demo-library-heading h2 { margin: 4px 0; font-size: 18px; color: #202449; }
.demo-library-heading p { margin: 0; font-size: 12px; color: #71768d; }
.demo-library-heading .text-button { font-size: 12px; white-space: nowrap; }
.demo-videos { align-items: stretch; gap: 14px; padding: 2px 2px 8px; scroll-snap-type: x proximity; }
.demo-item { display: block; flex: 0 0 238px; padding: 0; overflow: hidden; border: 1px solid #dde2f0; border-radius: 12px; background: #fff; box-shadow: 0 3px 10px #252d5510; scroll-snap-align: start; white-space: normal; }
.demo-item .demo-preview { display: block; position: relative; width: 100%; height: 126px; padding: 0; overflow: hidden; border: 0; border-radius: 0; background: radial-gradient(ellipse at 25% 20%, #455783, #111d35 75%); color: white; cursor: pointer; }
.demo-preview video { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.demo-preview::after { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent 35%, #080f29b3); pointer-events: none; }
.demo-preview-fallback { position: absolute; inset: 17px auto auto 14px; font-size: 9px; letter-spacing: .14em; color: #b7c8ed; }
.demo-play { position: absolute; z-index: 1; top: 50%; left: 50%; display: grid; place-items: center; width: 42px; height: 42px; padding-left: 3px; border: 1px solid #ffffff70; border-radius: 50%; background: #ffffff26; backdrop-filter: blur(8px); transform: translate(-50%, -50%); font-size: 15px; transition: background .18s, scale .18s; }
.demo-preview-action { position: absolute; z-index: 1; bottom: 10px; left: 13px; font-size: 11px; font-weight: 700; }
.demo-preview:hover .demo-play { background: #6366f1; scale: 1.1; }
.demo-preview:focus-visible { outline: 3px solid #6366f1; outline-offset: -3px; }
.demo-details { display: flex; align-items: center; gap: 10px; padding: 11px 12px; }
.demo-caption { flex: 1; min-width: 0; }
.demo-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: #28304a; }
.demo-description { display: block; margin-top: 4px; font-size: 10px; color: #82889a; }
.demo-item .demo-details a { flex-shrink: 0; border: 0; font-size: 10px; padding: 5px 0 5px 5px; }
@media (max-width: 600px) {
  .demo-bar { padding: 14px; }
  .demo-library-heading { align-items: flex-start; }
  .demo-library-heading p { max-width: 170px; line-height: 1.5; }
  .demo-item { flex-basis: 215px; }
}
