/* ============================================
   ROBOGUARD - Seamless Borderless Flat CSS
   Single pure white baseline, zero internal section borders.
   ============================================ */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: pan-x pan-y;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

body {
  font-family: var(--font-family-base);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* ---- App Layout ---- */
.layout {
  display: flex;
  height: calc(100vh - var(--header-height) - 34px);
  width: 100vw;
  overflow: hidden;
}

.layout__sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background-color: var(--color-bg-primary);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  z-index: var(--z-panel);
}

.layout__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  background-color: var(--color-bg-canvas);
}

/* ---- Header (Dark Tactical Mission Bar) ---- */
.header {
  height: var(--header-height);
  width: 100vw;
  background-color: var(--color-bg-glass);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  flex-shrink: 0;
  backdrop-filter: blur(12px);
  z-index: 100;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.header__brand-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.header__menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--color-icon-dark);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
}

.header__menu-btn .material-symbols-outlined {
  font-size: 22px;
}

.header__title {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.02em;
}

.header__theme-btn {
  height: 28px;
  width: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  color: var(--color-icon-dark);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.header__theme-btn:hover {
  background: var(--color-brand-light);
  color: var(--color-brand);
  border-color: var(--color-brand);
  box-shadow: 0 0 8px var(--color-brand-glow);
}

.header__theme-btn .material-symbols-outlined {
  font-size: 18px;
}

.header__reset-btn {
  height: 28px;
  width: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-danger);
  border: 1px solid rgba(220, 38, 38, 0.4);
  background: rgba(220, 38, 38, 0.12);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.header__reset-btn:hover {
  background: var(--color-danger);
  color: #FFFFFF !important;
  border-color: var(--color-danger);
  box-shadow: 0 0 8px var(--color-danger-glow);
}

.header__reset-btn:hover .material-symbols-outlined {
  color: #FFFFFF !important;
}

.header__reset-btn .material-symbols-outlined {
  font-size: 18px;
  color: var(--color-danger);
}

/* ---- Mobile Menu Drawer (Off-canvas) ---- */
.menu-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1500;
  display: flex;
}

.menu-drawer__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
}

.menu-drawer__content {
  position: relative;
  width: 260px;
  max-width: 80vw;
  height: 100%;
  background-color: var(--color-bg-primary);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  z-index: 1501;
  padding: var(--space-3);
  padding-left: calc(var(--space-3) + var(--sal));
  padding-top: calc(var(--space-3) + var(--sat));
}

.menu-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-2);
}

.menu-drawer__brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--color-text-primary);
}

.menu-drawer__close {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: var(--font-size-md);
  cursor: pointer;
  padding: 4px 8px;
}

.menu-drawer__items {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.menu-drawer__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border: none;
  background: none;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.menu-drawer__item .material-symbols-outlined {
  font-size: 22px;
  color: var(--color-icon-dark);
}

.menu-drawer__item:hover,
.menu-drawer__item--active {
  background-color: var(--color-brand-light);
  color: var(--color-brand);
}

.menu-drawer__item:hover .material-symbols-outlined,
.menu-drawer__item--active .material-symbols-outlined {
  color: var(--color-brand);
}


.header__status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header .telemetry__item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--color-border);
  font-size: var(--font-size-xs);
  font-family: var(--font-family-mono);
  color: var(--color-text-secondary);
  transition: all 0.2s ease;
}

.header .telemetry__item:hover {
  background: var(--color-bg-surface);
  border-color: var(--color-border-glow);
  color: var(--color-text-primary);
}

.header .telemetry__label {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--color-text-muted);
}

.header .telemetry__icon {
  font-size: 13px !important;
  color: var(--color-brand);
}

.header .telemetry__value {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-primary);
}

.header .telemetry__subtext {
  color: var(--color-text-muted);
  font-size: 9.5px;
}

/* ---- Panel Sections (Adaptive Theme Robotics Cards) ---- */
.panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  background-color: var(--color-bg-primary);
  transition: background-color 0.25s ease;
}

/* Custom Sleek Scrollbar */
.panel::-webkit-scrollbar,
.patrol__waypoint-list::-webkit-scrollbar,
.log-panel::-webkit-scrollbar,
.modal__body::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

.panel::-webkit-scrollbar-track,
.patrol__waypoint-list::-webkit-scrollbar-track,
.log-panel::-webkit-scrollbar-track,
.modal__body::-webkit-scrollbar-track {
  background: transparent;
}

.panel::-webkit-scrollbar-thumb,
.patrol__waypoint-list::-webkit-scrollbar-thumb,
.log-panel::-webkit-scrollbar-thumb,
.modal__body::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}

.panel::-webkit-scrollbar-thumb:hover,
.patrol__waypoint-list::-webkit-scrollbar-thumb:hover,
.log-panel::-webkit-scrollbar-thumb:hover,
.modal__body::-webkit-scrollbar-thumb:hover {
  background: var(--color-brand);
}

.panel__section {
  padding: 8px 12px;
  margin: 4px 8px;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  flex-shrink: 0;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.panel__section:hover {
  background: var(--color-bg-surface);
  border-color: var(--color-border-subtle);
}

.panel__scrollable {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  padding: 8px 12px;
  margin: 4px 8px;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.panel__scrollable:hover {
  background: var(--color-bg-surface);
}

/* ---- Toolbar Header / Quick Controls ---- */
.toolbar-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
  padding: 2px 4px;
  background: transparent;
  border-bottom: 1px solid var(--color-border);
  border-radius: 0;
  transition: border-color 0.2s ease;
}

.toolbar-actions .cmd-btn--icon {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  border-radius: var(--radius-sm);
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  color: var(--color-icon-dark);
  transition: all 0.2s ease;
}

.toolbar-actions .cmd-btn--icon:hover {
  background: var(--color-brand-light);
  border-color: var(--color-brand);
  color: var(--color-brand);
  box-shadow: 0 0 8px var(--color-brand-glow);
}

.toolbar-actions .cmd-btn--icon .material-symbols-outlined {
  font-size: 18px;
}

.cmd-btn--warning .material-symbols-outlined {
  color: var(--color-warning);
}

/* ---- Lighting Dropdown Menu ---- */
.lighting-dropdown {
  position: relative;
  display: inline-flex;
}

.lighting-dropdown__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 120;
  display: none;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--color-bg-surface, #0d1117);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md, 6px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.75), 0 0 10px rgba(0, 255, 102, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: lightingDropdownAnim 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

.lighting-dropdown--open .lighting-dropdown__menu {
  display: flex !important;
}

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

/* ---- Telemetry Bar (Bottom Strip) ---- */
.telemetry {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 var(--space-4);
  height: 34px;
  background-color: var(--color-bg-glass);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
  overflow-x: auto;
  box-sizing: border-box;
  backdrop-filter: blur(10px);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.telemetry__item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  white-space: nowrap;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 2px 7px;
  transition: all 0.15s ease;
}

.telemetry__item:hover {
  background: var(--color-bg-surface);
  border-color: var(--color-border-glow);
}

.telemetry__label {
  font-size: 10px;
  font-weight: 700;
  color: var(--color-text-muted);
  letter-spacing: 0.03em;
}

.telemetry__value {
  font-family: var(--font-family-mono);
  color: var(--color-text-primary);
  font-weight: 700;
  font-size: 11px;
}

/* Status LEDs with Tactical Glow */
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-circle);
  display: inline-block;
  background-color: var(--color-danger);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  margin-left: 2px;
}

.status-dot--online {
  background-color: var(--color-success);
  box-shadow: 0 0 8px rgba(0, 255, 102, 0.7);
}

.status-dot--offline {
  background-color: var(--color-danger);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

/* ---- Action Buttons & Grid ---- */
.cmd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: none;
  background: none;
  font-family: var(--font-family-base);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  outline: none;
}

.cmd-btn .material-symbols-outlined {
  font-size: 24px;
  color: var(--color-icon-dark);
  transition: color 0.2s ease, text-shadow 0.2s ease, transform 0.15s ease;
}

.cmd-btn:hover .material-symbols-outlined {
  color: var(--color-brand);
  text-shadow: 0 0 10px rgba(37, 99, 235, 0.45);
  transform: scale(1.1);
}

.cmd-btn:active .material-symbols-outlined {
  transform: scale(0.95);
}

/* Filled / Standard Button Modifiers (Homologated Design System) */
.cmd-btn--primary {
  background: var(--color-brand);
  border: 1px solid var(--color-brand);
  color: #FFFFFF !important;
  border-radius: var(--radius-md);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15), 0 0 10px var(--color-border-glow);
  transition: all 0.2s ease;
}

.cmd-btn--primary:hover {
  background: var(--color-brand-hover);
  border-color: var(--color-brand-hover);
  color: #FFFFFF !important;
}

.cmd-btn--primary .material-symbols-outlined {
  color: #FFFFFF !important;
}

.cmd-btn--danger {
  background: rgba(220, 38, 38, 0.12);
  border: 1px solid rgba(220, 38, 38, 0.4);
  color: var(--color-danger) !important;
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: all 0.2s ease;
}

.cmd-btn--danger:hover {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: #FFFFFF !important;
  box-shadow: 0 0 12px rgba(220, 38, 38, 0.45);
}

.cmd-btn--danger:hover .material-symbols-outlined {
  color: #FFFFFF !important;
}

.cmd-btn--warning {
  background: rgba(217, 119, 6, 0.12);
  border: 1px solid rgba(217, 119, 6, 0.4);
  color: var(--color-warning) !important;
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: all 0.2s ease;
}

.cmd-btn--warning:hover {
  background: var(--color-warning);
  border-color: var(--color-warning);
  color: #FFFFFF !important;
  box-shadow: 0 0 12px rgba(217, 119, 6, 0.45);
}

.cmd-btn--warning:hover .material-symbols-outlined {
  color: #FFFFFF !important;
}

.cmd-btn--secondary {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary) !important;
  border-radius: var(--radius-md);
  font-weight: 500;
  transition: all 0.2s ease;
}

.cmd-btn--secondary:hover {
  background: var(--color-bg-hover);
  border-color: var(--color-brand);
  color: var(--color-brand) !important;
}

.cmd-btn--secondary .material-symbols-outlined {
  color: var(--color-icon-dark);
}

.cmd-btn--secondary:hover .material-symbols-outlined {
  color: var(--color-brand);
}

/* Icon / Toolbar Modifiers */
.cmd-btn--icon.cmd-btn--primary,
.cmd-btn--icon.cmd-btn--active {
  background: none;
  border: none;
  box-shadow: none;
}

.cmd-btn--icon.cmd-btn--primary .material-symbols-outlined,
.cmd-btn--icon.cmd-btn--active .material-symbols-outlined {
  color: var(--color-brand) !important;
}

.cmd-btn--icon.cmd-btn--danger {
  background: none;
  border: none;
  box-shadow: none;
}

.cmd-btn--icon.cmd-btn--danger .material-symbols-outlined {
  color: var(--color-danger) !important;
}

.cmd-btn--icon.cmd-btn--warning {
  background: none;
  border: none;
  box-shadow: none;
}

.cmd-btn--icon.cmd-btn--warning .material-symbols-outlined {
  color: var(--color-warning) !important;
}

/* Police Beacon Dual-Color Strobe Effect */
.cmd-btn--police-active {
  animation: policePulse 0.8s infinite ease-in-out !important;
  border-radius: var(--radius-md);
}

@keyframes policePulse {
  0%, 45% {
    background: rgba(239, 68, 68, 0.25) !important;
    border: 1px solid #EF4444 !important;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.6) !important;
  }
  50%, 95% {
    background: rgba(59, 130, 246, 0.25) !important;
    border: 1px solid #3B82F6 !important;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.6) !important;
  }
}

.cmd-btn--icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: var(--radius-md);
  aspect-ratio: 1 / 1;
  background: none;
  border: none;
  outline: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.cmd-btn--icon .material-symbols-outlined {
  font-size: 20px;
}

.cmd-grid--actions {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  justify-items: center;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
}

.cmd-grid__divider {
  width: 1px;
  height: 20px;
  background-color: var(--color-border);
  margin: 0 auto;
}

/* ---- Controls Row: Joystick + Speed Slider ---- */
.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-1) 0;
}

/* Analog Joystick */
.joystick-container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.joystick {
  position: relative;
  width: var(--joystick-size);
  height: var(--joystick-size);
  border-radius: var(--radius-circle);
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  cursor: grab;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.joystick:hover {
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.08), 0 0 10px rgba(37, 99, 235, 0.2);
}

.joystick:active,
.joystick--active {
  cursor: grabbing;
  border-color: var(--color-brand);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.12), 0 0 14px rgba(37, 99, 235, 0.35);
}

.joystick__stick {
  position: absolute;
  width: var(--joystick-stick-size);
  height: var(--joystick-stick-size);
  border-radius: var(--radius-circle);
  background: radial-gradient(circle at 35% 35%, var(--color-brand) 0%, var(--color-brand-hover) 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4), 0 0 6px rgba(37, 99, 235, 0.2);
  pointer-events: none;
  transition: transform 0.05s ease-out, box-shadow 0.2s ease, background 0.2s ease;
}

.joystick:hover .joystick__stick {
  background: radial-gradient(circle at 35% 35%, var(--color-brand-light) 0%, var(--color-brand-hover) 100%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 12px rgba(59, 130, 246, 0.45);
}

.joystick--active .joystick__stick {
  background: radial-gradient(circle at 35% 35%, var(--color-brand-light) 0%, var(--color-brand) 100%);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.55), 0 0 16px rgba(96, 165, 250, 0.6);
}

.panel__section--motion {
  padding-bottom: var(--space-3);
}

/* Speed Slider */
.speed-vertical {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: var(--joystick-size);
  padding: 0;
}

.speed-vertical__header {
  font-size: var(--font-size-xs);
  font-family: var(--font-family-mono);
  font-weight: var(--font-weight-semibold);
  color: var(--color-brand);
  text-align: center;
  min-height: 16px;
}

.speed-vertical__label--led {
  color: var(--color-warning);
}

.speed-vertical__track {
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.speed-vertical__input {
  writing-mode: vertical-lr;
  direction: rtl;
  width: 28px;
  height: 100px;
  cursor: pointer;
  accent-color: var(--color-brand);
  touch-action: none;
}

.speed-vertical__input::-webkit-slider-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
}

.speed-vertical__input::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
}

.speed-vertical__input--led {
  accent-color: var(--color-warning);
}

.speed-vertical__tag {
  font-size: 9px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  margin-top: 2px;
  font-family: var(--font-family-mono);
}

.speed-vertical__tag--led {
  color: var(--color-warning);
}

.speed-vertical__label--obs {
  color: var(--color-danger);
}

.speed-vertical__input--obs {
  accent-color: var(--color-danger);
}

.speed-vertical__tag--obs {
  color: var(--color-danger);
}

/* ---- Log Feed ---- */
.log {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-relaxed);
  color: var(--color-text-secondary);
  user-select: text;
  -webkit-user-select: text;
}

.log__entry {
  padding: var(--space-1) 0;
  user-select: text;
  -webkit-user-select: text;
}

.log__time {
  color: var(--color-text-muted);
  margin-right: var(--space-2);
}

.log__msg--info {
  color: var(--color-text-secondary);
}

.log__msg--success {
  color: var(--color-success);
}

.log__msg--warn {
  color: var(--color-warning);
}

.log__msg--error {
  color: var(--color-danger);
}

/* ---- Patrol Waypoints List ---- */
.patrol {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.patrol__info {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}

.patrol__mode-select {
  background-color: var(--color-bg-surface);
  color: var(--color-brand);
  border: 1px solid var(--color-border-input) /* FIX-A11Y */;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-family: var(--font-family-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}

.patrol__mode-select:hover {
  border-color: var(--color-brand);
  background-color: var(--color-bg-hover);
  box-shadow: 0 0 8px var(--color-border-glow);
}

.patrol__mode-select:focus {
  border-color: var(--color-brand);
  box-shadow: 0 0 0 2px var(--color-border-glow);
}

.patrol__mode-select option {
  background-color: var(--color-bg-primary);
  color: var(--color-text-primary);
}

.patrol__preset-bar {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-bottom: var(--space-2);
  width: 100%;
}

.patrol__preset-select {
  flex: 1;
  min-width: 0;
  height: 32px;
  background-color: transparent;
  color: var(--color-text-primary);
  border: 1px solid var(--color-border-input) /* FIX-A11Y */;
  border-radius: var(--radius-md);
  padding: 0 28px 0 10px;
  font-family: var(--font-family-base);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.patrol__preset-select:hover {
  border-color: var(--color-brand);
  background-color: var(--color-bg-hover);
}

.patrol__preset-select:focus {
  border-color: var(--color-brand);
  box-shadow: 0 0 0 2px var(--color-border-glow);
}

.patrol__preset-select option {
  background-color: var(--color-bg-primary);
  color: var(--color-text-primary);
}

.patrol__preset-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border: none;
  background: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
}

.patrol__preset-btn .material-symbols-outlined {
  font-size: 22px;
  color: var(--color-icon-dark);
  transition: color 0.2s ease, text-shadow 0.2s ease, transform 0.15s ease;
}

.patrol__preset-btn:hover .material-symbols-outlined {
  color: var(--color-brand);
  text-shadow: 0 0 10px rgba(37, 99, 235, 0.45);
  transform: scale(1.1);
}

.patrol__preset-btn:active .material-symbols-outlined {
  transform: scale(0.95);
}

.patrol__preset-btn--delete .material-symbols-outlined {
  color: var(--color-danger);
}

.patrol__preset-btn--delete:hover .material-symbols-outlined {
  color: #B91C1C;
  text-shadow: 0 0 10px rgba(220, 38, 38, 0.5);
  transform: scale(1.1);
}

.patrol__preset-btn--map .material-symbols-outlined,
#btn-open-floorplan .material-symbols-outlined {
  color: var(--color-brand);
}

.patrol__preset-btn--map:hover .material-symbols-outlined,
#btn-open-floorplan:hover .material-symbols-outlined {
  color: var(--color-brand-hover);
  text-shadow: 0 0 10px rgba(37, 99, 235, 0.55);
}

.patrol__header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}

.patrol__waypoint-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  max-height: 120px;
  overflow-y: auto;
}

.patrol__waypoint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  background-color: transparent;
  border: 1px solid var(--color-border);
  font-size: var(--font-size-xs);
  font-family: var(--font-family-mono);
  gap: 4px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

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

.patrol__waypoint--active {
  background-color: rgba(34, 197, 94, 0.16) !important;
  border-color: #22C55E !important;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
}

.patrol__waypoint--active .patrol__waypoint-index {
  color: #22C55E !important;
  font-weight: 700;
}

.patrol__waypoint--active .patrol__waypoint-coords {
  color: #FFFFFF !important;
  font-weight: 600;
}

.patrol__waypoint-index {
  color: var(--color-text-muted);
  min-width: 20px;
}

.patrol__waypoint-coords {
  color: var(--color-text-secondary);
  flex: 1;
}

.patrol__action-badge {
  background: rgba(56, 189, 248, 0.2);
  color: #38BDF8;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  margin-left: 4px;
}

.patrol__waypoint-action-btn {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  transition: color 0.2s ease;
}

.patrol__waypoint-action-btn:hover {
  color: #38BDF8;
}

.patrol__waypoint-remove {
  cursor: pointer;
  color: var(--color-text-muted);
  border: none;
  background: none;
  font-size: var(--font-size-sm);
}

.patrol__waypoint-remove:hover {
  color: var(--color-danger);
}

.patrol__actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-1);
  width: 100%;
}

.patrol__actions .cmd-btn--icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border: none;
  background: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.patrol__actions .cmd-btn--icon .material-symbols-outlined {
  font-size: 20px;
}

/* ---- Log Activity Panel ---- */
.log-panel {
  position: relative;
}

.log-panel__header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: var(--space-1);
  position: sticky;
  top: 0;
  z-index: 5;
}

.log-panel__copy-btn {
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-icon-dark);
  transition: all 0.15s ease;
}

.log-panel__copy-btn:hover {
  background: var(--color-brand-light);
  border-color: var(--color-brand);
  color: var(--color-brand);
  box-shadow: 0 0 8px var(--color-brand-glow);
}

.log-panel__copy-btn .material-symbols-outlined {
  font-size: 15px;
}

/* ---- Viewer Overlay Controls ---- */
.viewer__overlay {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 100;
  display: flex;
  gap: 6px;
  pointer-events: auto;
}

.viewer-btn-hud {
  background: rgba(2, 14, 8, 0.75);
  color: #00FF66;
  border: 1px solid rgba(0, 255, 102, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  text-shadow: 0 0 6px rgba(0, 255, 102, 0.6);
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  border-radius: var(--radius-sm);
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: var(--font-family-mono);
  outline: none;
  transition: all 0.2s ease;
  pointer-events: auto;
  user-select: none;
  touch-action: manipulation;
}

.viewer-btn-hud:hover {
  background: rgba(0, 255, 102, 0.2);
  color: #FFFFFF;
  border-color: #00FF66;
  box-shadow: 0 0 10px rgba(0, 255, 102, 0.4);
}

.viewer-select-profile {
  position: relative;
  z-index: 101;
  background: rgba(2, 14, 8, 0.85);
  border: 1px solid rgba(0, 255, 102, 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  color: #00FF66;
  font-family: var(--font-family-mono);
  text-shadow: 0 0 4px rgba(0, 255, 102, 0.4);
  cursor: pointer;
  outline: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.2s ease;
  pointer-events: auto;
  user-select: auto;
  touch-action: manipulation;
  -webkit-appearance: menulist;
  appearance: menulist;
}

.viewer-select-profile:hover,
.viewer-select-profile:focus {
  background: rgba(0, 255, 102, 0.25);
  color: #FFFFFF;
  border-color: #00FF66;
  box-shadow: 0 0 12px rgba(0, 255, 102, 0.5);
}

.viewer-select-profile option {
  background: #020a06;
  color: #00FF66;
  font-family: var(--font-family-mono);
  padding: 6px 10px;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-thumb {
  background-color: var(--color-border);
  border-radius: var(--radius-sm);
}

/* ---- Mobile Navigation Bar (Bottom Tabs for Mobile) ---- */
.mobile-nav {
  display: none;
}

/* ---- Responsive Optimization (Móviles & Tablets) ---- */
@media (max-width: 768px) {
  body {
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    display: flex;
    flex-direction: column;
  }

  /* Header móvil en 2 líneas: 1ª Línea Título Centrado, 2ª Línea KPIs superiores con estilo homogéneo */
  .header {
    height: auto;
    min-height: calc(var(--header-height-mobile) + var(--sat));
    padding: 4px var(--space-2);
    padding-top: calc(4px + var(--sat));
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 4px;
    border-bottom: 1px solid var(--color-border);
    overflow: visible;
    background-color: var(--color-bg-primary);
    flex-shrink: 0;
  }

  .header__title {
    font-size: 0.8125rem;
    font-weight: 700;
    white-space: nowrap;
    text-align: center;
    color: var(--color-text-primary);
    letter-spacing: 0.01em;
    padding: 0;
  }

  .header__status {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-left: 4px;
    padding-right: 4px;
    padding-bottom: 2px;
  }

  .header__status::-webkit-scrollbar {
    display: none;
  }

  /* Estilo uniforme para KPIs superiores e inferiores */
  .header .telemetry__item {
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 2px 6px;
    font-size: 9.5px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
    color: var(--color-text-secondary);
  }

  /* Layout móvil: Cámara ARRIBA (45% altura), panel de controles ABAJO */
  .layout {
    display: flex;
    flex-direction: column-reverse;
    flex: 1 1 0%;
    height: auto;
    min-height: 0;
    position: relative;
    overflow: hidden;
  }

  .layout__main {
    flex: 0 0 45%;
    height: 45%;
    min-height: 160px;
    max-height: 50%;
    width: 100%;
    display: flex !important;
    flex-direction: column;
    position: relative;
    border-bottom: 1px solid var(--color-border);
    background-color: #000000;
  }

  .layout__sidebar {
    flex: 1 1 55%;
    height: 55%;
    min-height: 0;
    width: 100%;
    position: relative !important;
    display: flex !important;
    flex-direction: column;
    background-color: var(--color-bg-primary);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 10;
  }

  /* En modo pestaña "Cámara", expandir video al 100% */
  .layout.tab-cam-fullscreen .layout__main {
    flex: 1 1 100%;
    height: 100%;
    max-height: 100%;
    border-bottom: none;
  }

  .layout.tab-cam-fullscreen .layout__sidebar {
    display: none !important;
  }

  /* Mobile Bottom Navigation Bar (Barra fija inferior permanente) */
  .mobile-nav {
    display: flex !important;
    position: relative;
    align-items: center;
    justify-content: space-around;
    height: calc(var(--mobile-nav-height) + var(--sab));
    padding-bottom: var(--sab);
    background-color: var(--color-bg-primary);
    border-top: 1px solid var(--color-border);
    z-index: 999;
    flex-shrink: 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
  }

  .mobile-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 10px;
    font-weight: var(--font-weight-medium);
    gap: 3px;
    cursor: pointer;
    transition: color 0.15s ease, transform 0.1s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-nav__item .material-symbols-outlined {
    font-size: 22px;
    transition: transform 0.15s ease, color 0.15s ease;
  }

  .mobile-nav__item:active {
    transform: scale(0.92);
  }

  .mobile-nav__item--active {
    color: var(--color-brand);
    font-weight: var(--font-weight-semibold);
  }

  .mobile-nav__item--active .material-symbols-outlined {
    color: var(--color-brand);
    transform: translateY(-1px);
  }

  /* Controles táctiles y Joystick en móvil */
  .control-row {
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-1) 0;
  }

  .joystick {
    width: 120px;
    height: 120px;
  }

  .joystick__stick {
    width: 42px;
    height: 42px;
  }

  .speed-vertical {
    height: 120px;
  }

  .speed-vertical__track {
    height: 100px;
  }

  .speed-vertical__input {
    width: 20px;
    height: 90px;
  }

  /* Toolbar de acciones rápidas - Estilo plano original */
  .toolbar-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-1) var(--space-2);
    margin-bottom: var(--space-1);
    background: none;
    border: none;
  }

  .toolbar-actions .cmd-btn--icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    background: none;
    border: none;
    box-shadow: none;
  }

  .toolbar-actions .cmd-btn--icon .material-symbols-outlined {
    font-size: 22px;
    color: var(--color-icon-dark);
  }

  /* Grilla de acciones de control: 2 Líneas exactas bien distribuidas (6 columnas x 2 filas = 12 botones) */
  .cmd-grid--actions {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    justify-content: center;
    align-items: center;
    gap: var(--space-1);
    padding: 0 var(--space-2);
  }

  /* Estilo plano original consistente para todos los botones de comando (sin cajas grises) */
  .cmd-btn--icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: var(--radius-md);
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .cmd-btn--icon .material-symbols-outlined {
    font-size: 24px;
    color: var(--color-icon-dark);
    transition: color 0.15s ease, transform 0.15s ease;
  }

  .cmd-btn--icon:active {
    background: none;
    border: none;
  }

  .cmd-btn--icon:active .material-symbols-outlined {
    transform: scale(0.9);
    color: var(--color-brand);
  }

  /* Acciones de patrulla */
  .patrol__actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2px;
    width: 100%;
  }

  .patrol__actions .cmd-btn--icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .patrol__actions .cmd-btn--icon .material-symbols-outlined {
    font-size: 20px;
  }

  /* Minimapa radar flotante ultra compacto en móvil (85px x 85px) */
  .hud-minimap {
    width: 85px !important;
    height: 85px !important;
    bottom: 6px !important;
    right: 6px !important;
    border-radius: var(--radius-sm) !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5) !important;
    z-index: 25;
  }

  /* Multi-Cam MFD Sub-Panel en móvil (Ultra compacto sobre el minimapa) */
  .hud-cam-pip {
    width: 170px !important;
    bottom: 96px !important;
    right: 6px !important;
    padding: 4px 6px !important;
    z-index: 26;
  }

  .hud-cam-pip__header {
    font-size: 8.5px !important;
    margin-bottom: 2px !important;
  }

  .hud-cam-pip__toggle {
    font-size: 8px !important;
    padding: 1px 5px !important;
  }

  .hud-cam-pip__streams {
    gap: 4px !important;
    margin-top: 3px !important;
  }

  .hud-cam-pip__badge {
    font-size: 6.5px !important;
    padding: 0 3px !important;
    top: 2px !important;
    left: 2px !important;
  }

  .hud-minimap--hidden {
    display: none !important;
  }

  .hud-jet__heading-tape {
    top: 3px;
    font-size: 7.5px;
  }

  .hud-jet__speed-tape {
    left: 4px;
    padding: 2px 3px;
    font-size: 7.5px;
  }

  .hud-jet__bottom {
    bottom: 3px;
    padding: 2px 4px;
    font-size: 7px;
    gap: 4px;
  }

  /* Mini KPIs inferiores: Fijos siempre abajo justo arriba del menú inferior, con scroll táctil suave si excede el ancho */
  .telemetry {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 3px 4px;
    padding: 4px var(--space-2);
    background-color: var(--color-bg-primary);
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
    z-index: 50;
    width: 100%;
    box-sizing: border-box;
    max-height: 52px;
    overflow-y: auto;
  }

  .telemetry .telemetry__item {
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 2px 4px;
    flex: 1 1 calc(16.66% - 4px);
    min-width: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 8.5px;
    gap: 2px;
    box-sizing: border-box;
    white-space: nowrap;
    color: var(--color-text-secondary);
  }

  /* Overlay de controles de video en móvil */
  .viewer__overlay {
    top: 6px;
    right: 6px;
    gap: 4px;
    z-index: 100;
  }

  .viewer-btn-hud {
    font-size: 9px;
    padding: 3px 6px;
    min-height: 24px;
  }

  .viewer-select-profile {
    font-size: 9px;
    padding: 3px 6px;
    max-width: 125px;
    min-height: 24px;
    -webkit-appearance: menulist;
    appearance: menulist;
  }

  /* Chat Modal a pantalla completa en móvil con terminal responsiva y switch de vista */
  .chat-modal__content {
    width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    border: none !important;
  }

  .chat-modal__header {
    padding-top: var(--sat);
    height: calc(var(--header-height) + var(--sat));
    padding-left: calc(var(--space-2) + var(--sal));
    padding-right: calc(var(--space-2) + var(--sar));
    gap: 4px;
  }

  .chat-modal__title-group {
    gap: 4px;
    overflow: hidden;
  }

  .chat-modal__model-select {
    max-width: 110px;
    font-size: 11px;
    padding: 2px 4px;
  }

  .chat-modal__body {
    flex-direction: column;
  }

  .chat-modal__col-chat {
    min-width: 100%;
    flex: 1;
  }

  .chat-modal__col-terminal {
    min-width: 100%;
    flex: 1;
    max-height: min(28vh, 160px);
    border-left: none;
    border-top: 1px solid var(--color-border);
  }

  /* Modo Sólo Terminal en Móvil */
  .chat-modal--view-terminal .chat-modal__col-chat {
    display: none !important;
  }
  .chat-modal--view-terminal .chat-modal__col-terminal {
    display: flex !important;
    max-height: 100% !important;
    flex: 1 !important;
  }

  /* Modo Sólo Chat en Móvil */
  .chat-modal--view-chat .chat-modal__col-terminal {
    display: none !important;
  }
  .chat-modal--view-chat .chat-modal__col-chat {
    display: flex !important;
    flex: 1 !important;
  }

  .chat-modal__input-row {
    padding-bottom: calc(var(--space-3) + var(--sab));
  }

  .chat-terminal__input-bar {
    padding-bottom: calc(6px + var(--sab));
  }

  .modal__content {
    width: 95vw !important;
    max-width: 95vw !important;
    max-height: 90dvh !important;
    padding: var(--space-3) !important;
    margin: 0 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    box-sizing: border-box;
  }

  .modal__close {
    min-width: 38px;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
  }

  .modal-player-video {
    max-height: 200px !important;
    object-fit: contain;
  }

  .gps-map-container {
    height: 240px !important;
  }

  .siren-bank {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }

  .siren-card-btn {
    padding: 6px 10px !important;
    font-size: 11px !important;
  }

  .voice-chip {
    font-size: 10px !important;
    padding: 4px 8px !important;
  }

  /* Floorplan Editor Modal Fullscreen en Móvil */
  .floorplan-modal__dialog {
    width: 100vw !important;
    height: 100dvh !important;
    max-width: 100vw !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    border: none !important;
  }

  .floorplan-inspector {
    width: 190px !important;
    top: var(--space-2) !important;
    right: var(--space-2) !important;
    padding: var(--space-2) !important;
    font-size: 10px !important;
    max-height: calc(100% - 100px);
    overflow-y: auto;
  }

  .floorplan-modal__header {
    padding: var(--space-2) !important;
    padding-top: calc(var(--space-2) + var(--sat)) !important;
  }

  .floorplan-modal__footer {
    padding: 0 var(--space-2) !important;
    padding-bottom: var(--sab) !important;
  }
}

/* ===================================================
   MOBILE LANDSCAPE OPTIMIZATIONS (Móvil Apaisado / Horizontal)
   =================================================== */
@media (max-width: 950px) and (orientation: landscape) {
  body {
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
  }

  /* Header en Móvil Apaisado: 1 SOLA LÍNEA ULTRA COMPACTA con botón Hamburguesa */
  .header {
    height: calc(36px + var(--sat)) !important;
    min-height: calc(36px + var(--sat)) !important;
    padding: 0 var(--space-2) !important;
    padding-top: var(--sat) !important;
    padding-left: calc(var(--space-2) + var(--sal)) !important;
    padding-right: calc(var(--space-2) + var(--sar)) !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: var(--space-2) !important;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
    overflow: hidden;
  }

  .header__brand-row {
    display: flex !important;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
  }

  .header__menu-btn {
    display: inline-flex !important;
  }

  .header__title {
    font-size: 0.75rem !important;
    font-weight: 700;
    white-space: nowrap;
    text-align: left !important;
  }

  .header__status {
    display: flex !important;
    align-items: center;
    justify-content: flex-end !important;
    gap: 4px !important;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0 !important;
  }

  .header__status::-webkit-scrollbar {
    display: none;
  }

  .header .telemetry__item {
    font-size: 8.5px !important;
    padding: 1px 4px !important;
    gap: 2px !important;
  }

  /* En apaisado: OCULTAR barra inferior de pestañas (se navega con Hamburguesa) */
  .mobile-nav {
    display: none !important;
  }

  /* Layout en Apaisado: Split Horizontal (Cámara a la izquierda 55%, Controles a la derecha 45%) */
  .layout {
    display: flex !important;
    flex-direction: row !important;
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: auto !important;
    width: 100vw !important;
    position: relative;
    overflow: hidden;
  }

  .layout__main {
    flex: 0 0 55% !important;
    width: 55% !important;
    height: 100% !important;
    max-height: 100% !important;
    border-bottom: none !important;
    border-right: 1px solid var(--color-border) !important;
  }

  .layout__sidebar {
    flex: 0 0 45% !important;
    width: 45% !important;
    height: 100% !important;
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-right: var(--sar);
  }

  /* Pantalla completa de cámara en landscape */
  .layout.tab-cam-fullscreen .layout__main {
    flex: 1 0 100% !important;
    width: 100% !important;
    border-right: none !important;
  }

  .layout.tab-cam-fullscreen .layout__sidebar {
    display: none !important;
  }

  /* Controles y Joystick optimizados para landscape */
  .control-row {
    padding: 2px 0 !important;
    gap: 8px !important;
  }

  .joystick {
    width: 105px !important;
    height: 105px !important;
  }

  .joystick__stick {
    width: 36px !important;
    height: 36px !important;
  }

  .speed-vertical {
    height: 105px !important;
  }

  .speed-vertical__track {
    height: 85px !important;
  }

  .speed-vertical__input {
    width: 18px !important;
    height: 75px !important;
  }

  .toolbar-actions {
    padding: 1px 4px !important;
    margin-bottom: 2px !important;
  }

  .toolbar-actions .cmd-btn--icon {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    min-height: 30px !important;
  }

  .toolbar-actions .cmd-btn--icon .material-symbols-outlined {
    font-size: 18px !important;
  }

  /* Botones de acción en Landscape (6 columnas x 2 filas compactas) */
  .cmd-grid--actions {
    grid-template-columns: repeat(6, 1fr) !important;
    gap: 2px !important;
    padding: 0 4px !important;
  }

  .cmd-btn--icon {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
  }

  .cmd-btn--icon .material-symbols-outlined {
    font-size: 20px !important;
  }

  /* Minimapa radar flotante en landscape */
  .hud-minimap {
    width: 75px !important;
    height: 75px !important;
    bottom: 4px !important;
    right: 4px !important;
  }

  /* Multi-Cam MFD Sub-Panel en landscape */
  .hud-cam-pip {
    width: 140px !important;
    bottom: 82px !important;
    right: 4px !important;
    padding: 3px 5px !important;
  }

  .hud-cam-pip__header {
    font-size: 7.5px !important;
  }

  .hud-cam-pip__toggle {
    font-size: 7px !important;
    padding: 0 4px !important;
  }

  .hud-cam-pip__streams {
    gap: 3px !important;
    margin-top: 2px !important;
  }

  /* Telemetría inferior fija en apaisado: Ultra compacta al fondo en 1-2 líneas */
  .telemetry {
    padding: 2px var(--space-2) !important;
    padding-bottom: calc(2px + var(--sab)) !important;
    padding-left: calc(var(--space-2) + var(--sal)) !important;
    padding-right: calc(var(--space-2) + var(--sar)) !important;
    height: auto !important;
    max-height: 34px !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    gap: 3px !important;
    align-items: center !important;
    justify-content: flex-start !important;
  }

  .telemetry::-webkit-scrollbar {
    display: none;
  }

  .telemetry .telemetry__item {
    font-size: 8px !important;
    padding: 1px 4px !important;
    min-width: unset !important;
    flex: 0 0 auto !important;
  }

  /* Modales en Móvil Horizontal / Apaisado */
  .modal__content {
    width: 90vw !important;
    max-width: 90vw !important;
    max-height: 94dvh !important;
    padding: var(--space-2) var(--space-3) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .modal__header {
    margin-bottom: var(--space-2) !important;
    padding-bottom: var(--space-1) !important;
  }

  .modal__close {
    min-width: 34px;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .modal-player-video {
    max-height: 160px !important;
    object-fit: contain;
  }

  .gps-map-container {
    height: 170px !important;
  }

  .siren-bank {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 4px !important;
    margin-top: 4px !important;
    margin-bottom: 6px !important;
  }

  .siren-card-btn {
    padding: 4px 8px !important;
    font-size: 10px !important;
  }

  .voice-chip {
    font-size: 9px !important;
    padding: 3px 6px !important;
  }
}





/* ---- Video Viewer Canvas ---- */
.viewer {
  flex: 1;
  position: relative;
  background-color: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  width: 100%;
  height: 100%;
}

.viewer__video-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.viewer__placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  color: var(--color-text-muted);
  text-align: center;
  user-select: none;
  pointer-events: none;
  z-index: 5;
  width: 100%;
  max-width: 320px;
  padding: 0 var(--space-4);
  box-sizing: border-box;
}

.viewer__placeholder-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-circle);
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-icon-dark);
  margin-bottom: 2px;
}

.viewer__placeholder-icon .material-symbols-outlined {
  font-size: 28px;
  color: rgba(148, 163, 184, 0.6);
}

.viewer__placeholder-text {
  font-size: var(--font-size-xs);
  font-family: var(--font-family-mono);
  color: rgba(148, 163, 184, 0.7);
  letter-spacing: 0.03em;
  line-height: 1.4;
}

.viewer__video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background-color: #000000;
  display: block;
}

/* Smart Lighting Cyclic Mode Badge */
.light-mode-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  font-size: 8px;
  font-family: 'JetBrains Mono', monospace, sans-serif;
  font-weight: 800;
  padding: 1px 3px;
  border-radius: 3px;
  line-height: 1;
  pointer-events: none;
}

.light-mode-badge--off {
  background: rgba(148, 163, 184, 0.25);
  color: #94a3b8;
}

.light-mode-badge--robot {
  background: rgba(34, 197, 94, 0.35);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.4);
}

.light-mode-badge--hikvision {
  background: rgba(6, 182, 212, 0.35);
  color: #22d3ee;
  border: 1px solid rgba(34, 211, 238, 0.4);
}

.light-mode-badge--all {
  background: rgba(245, 158, 11, 0.35);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.4);
}

/* Voice PTT Recording Pulse */
.cmd-btn--recording {
  background: rgba(239, 68, 68, 0.35) !important;
  border-color: #ef4444 !important;
  color: #ffffff !important;
  animation: voice-pulse 1s infinite alternate;
}

@keyframes voice-pulse {
  0% { box-shadow: 0 0 4px rgba(239, 68, 68, 0.4); }
  100% { box-shadow: 0 0 14px rgba(239, 68, 68, 0.9); }
}

/* Sirens Quick Launcher Bank */
.siren-bank {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 10px;
  margin-bottom: 12px;
}

.siren-card-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.siren-card-btn:hover {
  background: var(--color-bg-surface);
  border-color: var(--color-brand);
  transform: translateY(-1px);
}

.siren-card-btn--danger:hover {
  border-color: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

/* ---- Floating Tactical Voice HUD Subtitle Toast ---- */
.voice-hud-toast {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  background: rgba(10, 15, 29, 0.94);
  border: 1px solid var(--color-hud-green, #00FF66);
  border-radius: var(--radius-md, 8px);
  box-shadow: 0 0 25px rgba(0, 255, 102, 0.35), 0 8px 32px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 92vw;
  width: auto;
  min-width: 280px;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--font-family-mono, monospace);
  color: #FFFFFF;
}

.voice-hud-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.voice-hud-toast--listening {
  border-color: #38BDF8;
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.45);
}

.voice-hud-toast--listening .voice-hud-toast__icon {
  color: #38BDF8;
  animation: pulse-glow 1.2s infinite ease-in-out;
}

.voice-hud-toast--recognizing {
  border-color: #FFB000;
  box-shadow: 0 0 25px rgba(255, 176, 0, 0.4);
}

.voice-hud-toast--recognizing .voice-hud-toast__icon {
  color: #FFB000;
}

.voice-hud-toast--response {
  border-color: #00FF66;
  box-shadow: 0 0 25px rgba(0, 255, 102, 0.45);
}

.voice-hud-toast--response .voice-hud-toast__icon {
  color: #00FF66;
}

.voice-hud-toast--error {
  border-color: #EF4444;
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.45);
}

.voice-hud-toast--error .voice-hud-toast__icon {
  color: #EF4444;
}

.voice-hud-toast__icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-hud-toast__icon {
  font-size: 26px !important;
}

.voice-hud-toast__content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.voice-hud-toast__title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-secondary, #94A3B8);
}

.voice-hud-toast__message {
  font-size: 13.5px;
  font-weight: 600;
  color: #FFFFFF;
  line-height: 1.35;
}

.voice-hud-toast__close {
  cursor: pointer;
  padding: 4px;
  font-size: 14px;
  color: var(--color-text-muted, #64748B);
  transition: color 0.15s;
}

.voice-hud-toast__close:hover {
  color: #FFFFFF;
}

/* ---- GPS Modal & Radar Glow ---- */
#badge-gps {
  cursor: pointer;
}

#badge-gps:hover {
  border-color: #00FF66 !important;
  box-shadow: 0 0 10px rgba(0, 255, 102, 0.35);
}

.gps-dialog .telemetry-card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: all 0.15s ease;
}

.gps-dialog .telemetry-card:hover {
  border-color: var(--color-brand);
  background: var(--color-bg-hover);
}

.gps-dialog .telemetry-card__label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-text-muted);
  letter-spacing: 0.04em;
}

.gps-dialog .telemetry-card__value {
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-family-mono);
  color: var(--color-text-primary);
}

/* ---- Obstacle Avoidance Button Feedback (Cyan Active / Red Disabled) ---- */
#btn-obstacle-toggle.cmd-btn--active {
  background: rgba(0, 229, 255, 0.16) !important;
  color: #00E5FF !important;
  border-color: #00E5FF !important;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.45) !important;
}

#btn-obstacle-toggle.cmd-btn--disabled-alert {
  background: rgba(255, 59, 48, 0.18) !important;
  color: #FF3B30 !important;
  border-color: #FF3B30 !important;
  box-shadow: 0 0 12px rgba(255, 59, 48, 0.45) !important;
}



/* ============================================================
   FIX-F06 / FIX-A11Y — Keyboard focus visibility
   The app is piloted with the keyboard (WASD / space / arrows), so every
   interactive control must show where the focus is (WCAG 2.4.7). These
   rules use :focus-visible, which is why they do not fight the existing
   `outline: none` (that one still removes the ring for mouse clicks).
   ============================================================ */
.cmd-btn:focus-visible,
.cmd-btn--icon:focus-visible,
.patrol__mode-select:focus-visible,
.patrol__preset-select:focus-visible,
.viewer-btn-hud:focus-visible,
.viewer-select-profile:focus-visible,
.header__theme-btn:focus-visible,
.header__menu-btn:focus-visible,
.hud-cam-pip__toggle:focus-visible,
.hud-minimap__layer-btn:focus-visible,
.menu-drawer__item:focus-visible,
.menu-drawer__close:focus-visible,
.modal__close:focus-visible,
.chat-terminal__chip:focus-visible,
.floorplan-tool-btn:focus-visible,
.patrol__preset-btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--color-brand, #2563EB);
  outline-offset: 2px;
  /* Second ring so the indicator stays visible over both the light panels
     and the dark video/HUD surfaces. */
  box-shadow: 0 0 0 4px var(--color-brand-glow, rgba(37, 99, 235, 0.30));
}

/* Controls that live inside an `overflow: hidden` container would have their
   external ring clipped, so they get an inset variant instead. */
.traffic-input:focus-visible,
.chat-terminal__cmd-input:focus-visible,
.traffic-unit-select:focus-visible {
  outline-offset: -2px;
  box-shadow: inset 0 0 0 2px var(--color-brand, #2563EB);
}

/* ============================================================
   FIX-A11Y — Respect the user's reduced-motion preference (WCAG 2.3.3).
   Continuous decorative animations are disabled; nothing that conveys
   state (blinking danger indicators) is removed, only slowed/stopped.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .cmd-btn:hover,
  .cmd-btn:active {
    transform: none !important;
  }
}
