:root {
  --glass-bg: rgba(14, 17, 26, 0.58);
  --glass-bg-strong: rgba(12, 15, 24, 0.84);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-highlight: rgba(255, 255, 255, 0.08);
  --text-primary: #f8fafc;
  --text-muted: rgba(226, 232, 240, 0.65);
  --accent-cyan: #00f5d4;
  --accent-green: #22c55e;
  --accent-orange: #ff5722;
  --accent-red: #ef4444;
  --accent-purple: #a855f7;
  --radius-lg: 18px;
  --radius-md: 12px;
  --shadow-soft: 0 16px 40px rgba(0, 0, 0, 0.45);
}

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

html,
body {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #06080f;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

#appRoot {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* Mirrored Video & Drawing Canvas */
#webcamVideo,
#drawingCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: scaleX(-1);
}

#webcamVideo {
  object-fit: cover;
  z-index: 1;
  background: #05070c;
}

#drawingCanvas {
  z-index: 2;
  pointer-events: none;
}

/* Un-mirrored Cursor & Radial Hover HUD Canvas */
#overlayCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
}

/* Shared Glassmorphism */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.glass-pill {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.hidden {
  display: none !important;
}

/* Fallback Camera Overlay */
.fallback-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 8, 15, 0.78);
  backdrop-filter: blur(12px);
  padding: 20px;
}

.fallback-card {
  max-width: 420px;
  padding: 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}

.fallback-icon {
  font-size: 2.4rem;
}

.fallback-card p {
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text-muted);
}

/* TOP UI */
.top-ui {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 10;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.top-ui > * {
  pointer-events: auto;
}

/* Top-Left Instruction Card */
.instruction-card {
  padding: 12px 16px;
  max-width: 285px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan);
}

.brand-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-tag {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(0, 245, 212, 0.16);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 245, 212, 0.35);
}

.instruction-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.instruction-list li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.instruction-list strong {
  color: var(--text-primary);
  font-weight: 600;
}

.badge-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  font-size: 0.68rem;
  font-weight: 700;
  flex-shrink: 0;
}

.right-key {
  background: rgba(34, 197, 94, 0.22);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.4);
}

.left-key {
  background: rgba(255, 87, 34, 0.22);
  color: #fb923c;
  border: 1px solid rgba(255, 87, 34, 0.4);
}

.hover-key {
  background: rgba(0, 245, 212, 0.2);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 245, 212, 0.35);
}

.model-status {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.spinner-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #facc15;
  animation: pulseDot 1.2s ease-in-out infinite;
}

.model-status.ready .spinner-dot {
  background: var(--accent-green);
  animation: none;
  box-shadow: 0 0 8px var(--accent-green);
}

/* Top-Center Live Mode Badge */
.top-center-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 18px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  transition: all 0.2s ease;
}

.mode-led {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #94a3b8;
  transition: all 0.2s ease;
}

.mode-badge.mode-ready {
  color: #e2e8f0;
}

.mode-badge.mode-drawing {
  border-color: rgba(34, 197, 94, 0.65);
  color: #86efac;
  box-shadow: 0 0 22px rgba(34, 197, 94, 0.45), inset 0 0 12px rgba(34, 197, 94, 0.14);
}

.mode-badge.mode-drawing .mode-led {
  background: var(--accent-green);
  box-shadow: 0 0 12px var(--accent-green);
}

.mode-badge.mode-erasing {
  border-color: rgba(255, 87, 34, 0.7);
  color: #fdba74;
  box-shadow: 0 0 22px rgba(255, 87, 34, 0.45), inset 0 0 12px rgba(255, 87, 34, 0.14);
}

.mode-badge.mode-erasing .mode-led {
  background: var(--accent-orange);
  box-shadow: 0 0 12px var(--accent-orange);
}

.live-streaming-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(127, 29, 29, 0.55);
}

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

/* Top-Right Virtual Toolbar */
.virtual-toolbar {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.toolbar-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.toolbar-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 7px;
}

.toolbar-divider {
  width: 1px;
  height: 34px;
  background: var(--glass-border);
}

.toolbar-btn {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.toolbar-btn:hover,
.toolbar-btn.air-hovered {
  transform: scale(1.1);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 14px rgba(0, 245, 212, 0.35);
}

.swatch-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--swatch);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.swatch-btn.active {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.55), 0 0 14px var(--swatch);
  transform: scale(1.12);
}

.size-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.size-btn.active {
  background: rgba(0, 245, 212, 0.18);
  border-color: var(--accent-cyan);
}

.size-dot {
  border-radius: 50%;
  background: #ffffff;
  display: block;
}

.size-dot.sm { width: 5px; height: 5px; }
.size-dot.md { width: 10px; height: 10px; }
.size-dot.lg { width: 16px; height: 16px; }

.clear-btn {
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.clear-btn:hover,
.clear-btn.air-hovered {
  background: rgba(239, 68, 68, 0.28);
  border-color: var(--accent-red);
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.4);
}

/* BOTTOM SNAPCHAT/INSTAGRAM UI */
.bottom-ui {
  position: absolute;
  bottom: 18px;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.bottom-ui > * {
  pointer-events: auto;
}

.carousel-wrapper {
  max-width: min(92vw, 560px);
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 6px;
}

.carousel-wrapper::-webkit-scrollbar {
  display: none;
}

.filter-carousel {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.18s ease;
}

.filter-chip.active {
  border-color: var(--accent-cyan);
  background: rgba(0, 245, 212, 0.16);
  box-shadow: 0 0 16px rgba(0, 245, 212, 0.28);
}

.filter-chip.locked {
  opacity: 0.62;
  cursor: not-allowed;
}

.filter-badge {
  font-size: 0.64rem;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}

.filter-chip.active .filter-badge {
  background: rgba(0, 245, 212, 0.25);
  color: var(--accent-cyan);
}

/* Shutter Button */
.shutter-row {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.recording-timer {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.85);
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.45);
}

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffffff;
  animation: pulseDot 0.9s infinite;
}

.shutter-btn {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: transparent;
  border: 4px solid #ffffff;
  padding: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s ease, border-color 0.2s ease;
}

.shutter-btn:active {
  transform: scale(0.94);
}

.shutter-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #ffffff;
  transition: all 0.2s ease;
}

.shutter-btn.video-mode {
  border-color: rgba(255, 255, 255, 0.92);
}

.shutter-btn.video-mode .shutter-inner {
  background: #ef4444;
}

.shutter-btn.recording {
  border-color: #ef4444;
  animation: shutterPulse 1.2s ease-in-out infinite;
}

.shutter-btn.recording .shutter-inner {
  width: 44%;
  height: 44%;
  border-radius: 7px;
  background: #ef4444;
}

/* Mode Switcher */
.mode-switcher {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
}

.mode-pill-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 6px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.mode-pill-btn.active {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

/* Consent Banner */
.consent-banner {
  position: absolute;
  bottom: 165px;
  right: 18px;
  z-index: 30;
  max-width: 330px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-color: rgba(0, 245, 212, 0.45);
}

.consent-text strong {
  font-size: 0.88rem;
  color: var(--accent-cyan);
}

.consent-text p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.4;
}

.consent-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Buttons */
.primary-btn,
.secondary-btn,
.danger-btn {
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.14s ease, opacity 0.14s ease, box-shadow 0.14s ease;
}

.primary-btn {
  background: linear-gradient(135deg, #00f5d4, #0ea5e9);
  color: #041016;
  box-shadow: 0 6px 20px rgba(0, 245, 212, 0.28);
}

.primary-btn:hover {
  transform: translateY(-1px);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
}

.danger-btn {
  background: rgba(239, 68, 68, 0.88);
  color: #ffffff;
}

.primary-btn.small,
.secondary-btn.small {
  padding: 7px 13px;
  font-size: 0.78rem;
}

.full-width {
  width: 100%;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(4, 6, 12, 0.72);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.nested-modal {
  z-index: 65;
  background: rgba(3, 5, 10, 0.76);
}

.modal-card {
  background: var(--glass-bg-strong);
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 20px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-header h3 {
  font-size: 1.08rem;
  font-weight: 700;
}

.modal-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.icon-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.icon-close-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

/* Capture Preview Modal */
.preview-modal {
  max-width: 620px;
}

.preview-media-box {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 64vh;
  overflow: hidden;
}

.preview-media-box img,
.preview-media-box video {
  max-width: 100%;
  max-height: 58vh;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
}

.modal-footer {
  padding: 12px 20px 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Admin Login Modal */
.login-modal {
  max-width: 390px;
}

.login-form {
  padding: 18px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.field-group input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
}

.field-group input:focus {
  border-color: var(--accent-cyan);
}

.form-error {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.78rem;
}

/* Admin Dashboard Modal */
.dashboard-modal {
  max-width: 1040px;
  height: 86vh;
}

.dashboard-topbar {
  padding: 18px 22px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dashboard-topbar h2 {
  font-size: 1.2rem;
}

.dashboard-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.kpi-grid {
  padding: 14px 22px 6px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.kpi-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  color: var(--text-primary);
}

.kpi-interactive {
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.kpi-interactive:hover {
  border-color: rgba(34, 197, 94, 0.6);
  background: rgba(34, 197, 94, 0.07);
}

.kpi-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.1;
}

.kpi-note {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.online-pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green);
  animation: pulseDot 1.3s infinite;
  display: inline-block;
}

.online-pulse-dot.small {
  width: 7px;
  height: 7px;
}

.dash-controls-row {
  padding: 12px 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dash-tabs,
.sort-mode-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.dash-tab-btn,
.sort-mode-btn {
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border-radius: 9px;
  padding: 7px 13px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dash-tab-btn.active {
  background: rgba(0, 245, 212, 0.16);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.sort-mode-btn {
  padding: 6px 11px;
  font-size: 0.74rem;
}

.sort-mode-btn.active {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.4);
  color: #ffffff;
}

.dash-table-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 12px 22px 22px;
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.dash-table th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 10px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dash-table td {
  padding: 11px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: middle;
}

.visitor-row {
  cursor: pointer;
  transition: background 0.14s ease;
}

.visitor-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.identity-cell {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
  background: #64748b;
}

.status-dot.online {
  background: var(--accent-green);
  box-shadow: 0 0 9px var(--accent-green);
  animation: pulseDot 1.4s infinite;
}

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

.visitor-time-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.mini-btn {
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border-radius: 7px;
  padding: 5px 9px;
  font-size: 0.74rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mini-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.mini-btn.camera-btn {
  border-color: rgba(0, 245, 212, 0.45);
  color: var(--accent-cyan);
  background: rgba(0, 245, 212, 0.1);
}

.mini-btn.delete-btn {
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.inline-edit-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.inline-edit-input {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--accent-cyan);
  border-radius: 6px;
  color: #ffffff;
  padding: 4px 8px;
  font-size: 0.82rem;
  width: 150px;
  outline: none;
}

/* Device Group Accordion */
.device-group-card {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.025);
}

.device-group-header {
  width: 100%;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  padding: 11px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}

.group-count-pill {
  font-size: 0.72rem;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(0, 245, 212, 0.16);
  color: var(--accent-cyan);
}

.empty-state {
  text-align: center;
  padding: 42px 16px;
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* Device Specs Modal */
.specs-modal {
  max-width: 600px;
}

.specs-grid {
  padding: 16px 20px 22px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  overflow-y: auto;
}

.spec-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 12px;
}

.spec-item.full-span {
  grid-column: 1 / -1;
}

.spec-key {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.spec-val {
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--text-primary);
  word-break: break-word;
}

/* Live Camera Viewer Modal */
.live-viewer-modal {
  max-width: 640px;
}

.live-video-box {
  position: relative;
  margin: 16px 20px 20px;
  border-radius: 14px;
  overflow: hidden;
  background: #04060b;
  border: 1px solid var(--glass-border);
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.live-video-box video,
.live-video-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.live-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(6, 8, 15, 0.72);
  font-size: 0.84rem;
  color: var(--text-muted);
}

.spinner-ring {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.16);
  border-top-color: var(--accent-cyan);
  animation: spin 0.9s linear infinite;
}

/* Confirm Delete Modal */
.confirm-modal {
  max-width: 400px;
}

.confirm-text {
  padding: 16px 20px;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.confirm-actions {
  padding: 0 20px 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.82); }
}

@keyframes shutterPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.65); }
  50% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
}

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

@media (max-width: 900px) {
  .top-ui {
    flex-wrap: wrap;
  }
  .instruction-card {
    display: none;
  }
  .virtual-toolbar {
    margin-left: auto;
    gap: 8px;
    padding: 8px 10px;
  }
  .specs-grid,
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}