/* ==========================================================================
   NEUMORPHIC DESIGN SYSTEM FOR FLEET TRACKER
   Smooth soft shadows, extruded surfaces, recessed wells, convex/concave states,
   tactile buttons, and futuristic glowing indicators.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200');

:root {
  /* Dark Neumorphic Palette (Default) */
  --bg-color: #1a1d24;
  --surface-color: #1a1d24;
  --surface-recessed: #14171d;
  --surface-raised: #222630;
  --border-subtle: rgba(255, 255, 255, 0.06);

  /* Brand Palette from Guidelines */
  --brand-red: #ee252f;
  --brand-orange: #fbb040;
  --brand-grey: #c5c6c8;

  /* Neumorphic Shadows - Dark */
  --neu-flat: 6px 6px 14px #101217, -6px -6px 14px #242831;
  --neu-flat-sm: 3px 3px 7px #101217, -3px -3px 7px #242831;
  --neu-flat-lg: 10px 10px 24px #0e1014, -10px -10px 24px #262a34;
  --neu-pressed: inset 4px 4px 8px #101217, inset -4px -4px 8px #242831;
  --neu-pressed-sm: inset 2px 2px 5px #101217, inset -2px -2px 5px #242831;
  --neu-convex: linear-gradient(145deg, #1c2027, #171a20);
  --neu-concave: linear-gradient(145deg, #171a20, #1c2027);

  /* Primary Accent: Bright Red #ee252f */
  --primary-color: #ee252f;
  --primary-gradient: linear-gradient(135deg, #ee252f, #c71822);
  --primary-glow: 0 0 16px rgba(238, 37, 47, 0.5);
  --primary-container: rgba(238, 37, 47, 0.16);

  --text-main: #f8fafc;
  --text-muted: #c5c6c8;
  --text-dim: #8b929e;

  --success-color: #10b981;
  --success-glow: 0 0 14px rgba(16, 185, 129, 0.5);
  --success-bg: rgba(16, 185, 129, 0.14);

  /* Secondary Accent: Bright Orange #fbb040 */
  --warning-color: #fbb040;
  --warning-glow: 0 0 14px rgba(251, 176, 64, 0.5);
  --warning-bg: rgba(251, 176, 64, 0.16);

  --danger-color: #ee252f;
  --danger-glow: 0 0 18px rgba(238, 37, 47, 0.7);
  --danger-bg: rgba(238, 37, 47, 0.18);

  --radius-xs: 8px;
  --radius-s: 12px;
  --radius-m: 16px;
  --radius-l: 22px;
  --radius-pill: 50px;

  --transition-smooth: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font-mono: 'JetBrains Mono', monospace;
}

/* Light Neumorphic Theme */
body.light-theme {
  --bg-color: #f2f4f7;
  --surface-color: #f2f4f7;
  --surface-recessed: #e5e8ee;
  --surface-raised: #ffffff;
  --border-subtle: rgba(255, 255, 255, 0.8);

  /* Neumorphic Shadows - Light */
  --neu-flat: 7px 7px 16px #d1d5dd, -7px -7px 16px #ffffff;
  --neu-flat-sm: 4px 4px 8px #d1d5dd, -4px -4px 8px #ffffff;
  --neu-flat-lg: 12px 12px 28px #c5cad4, -12px -12px 28px #ffffff;
  --neu-pressed: inset 4px 4px 8px #d1d5dd, inset -4px -4px 8px #ffffff;
  --neu-pressed-sm: inset 2px 2px 5px #d1d5dd, inset -2px -2px 5px #ffffff;
  --neu-convex: linear-gradient(145deg, #ffffff, #dadee6);
  --neu-concave: linear-gradient(145deg, #dadee6, #ffffff);

  --primary-color: #ee252f;
  --primary-gradient: linear-gradient(135deg, #ee252f, #d61822);
  --primary-glow: 0 4px 14px rgba(238, 37, 47, 0.35);
  --primary-container: rgba(238, 37, 47, 0.12);

  --text-main: #1e2229;
  --text-muted: #5c626e;
  --text-dim: #8b929e;

  --success-color: #059669;
  --success-glow: 0 2px 10px rgba(5, 150, 105, 0.3);
  --success-bg: rgba(5, 150, 105, 0.12);

  --warning-color: #e09422;
  --warning-glow: 0 2px 10px rgba(251, 176, 64, 0.4);
  --warning-bg: rgba(251, 176, 64, 0.15);

  --danger-color: #ee252f;
  --danger-glow: 0 2px 14px rgba(238, 37, 47, 0.4);
  --danger-bg: rgba(238, 37, 47, 0.14);
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
  transition: background-color var(--transition-smooth), color var(--transition-smooth);
}

/* ---------------- TOAST NOTIFICATIONS ---------------- */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 320px;
  background-color: var(--surface-color);
  border-radius: var(--radius-m);
  padding: 14px 18px;
  box-shadow: var(--neu-flat-lg);
  border-left: 5px solid var(--primary-color);
  display: flex;
  align-items: center;
  gap: 14px;
  animation: neu-toast-in 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--text-main);
  font-size: 13.5px;
  font-weight: 500;
}

.toast.warning {
  border-left-color: var(--warning-color);
}

.toast.danger {
  border-left-color: var(--danger-color);
}

@keyframes neu-toast-in {
  from {
    opacity: 0;
    transform: translateX(60px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

/* ---------------- NEUMORPHIC TOP APPBAR ---------------- */
.mui-appbar {
  height: 72px;
  background-color: var(--surface-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1000;
  box-shadow: var(--neu-flat);
  position: relative;
}

.appbar-brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

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

.logo-icon {
  font-size: 28px;
  color: var(--primary-color);
  background: var(--surface-color);
  box-shadow: var(--neu-flat-sm);
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 8px rgba(238, 37, 47, 0.45));
}

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

.brand-text .title {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 1px;
  color: var(--text-main);
}

.brand-text .subtitle {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.2px;
}

/* Neumorphic Inset Search Bar */
.appbar-search {
  flex: 0 1 380px;
  position: relative;
  display: flex;
  align-items: center;
}

.appbar-search input {
  width: 100%;
  background-color: var(--surface-color);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  box-shadow: var(--neu-pressed);
  padding: 11px 18px 11px 44px;
  color: var(--text-main);
  font-size: 13.5px;
  outline: none;
  font-family: inherit;
  transition: box-shadow var(--transition-smooth), border-color var(--transition-smooth);
}

.appbar-search input:focus {
  border-color: var(--primary-color);
  box-shadow: var(--neu-pressed), 0 0 0 2px var(--primary-container);
}

.appbar-search input::placeholder {
  color: var(--text-muted);
}

.appbar-search .search-icon {
  position: absolute;
  left: 15px;
  color: var(--text-muted);
  font-size: 20px;
  pointer-events: none;
}

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

/* Neumorphic Action Chips & Badges */
.stat-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  background-color: var(--surface-color);
  box-shadow: var(--neu-flat-sm);
  color: var(--text-main);
}

.stat-chip.online-chip {
  color: var(--success-color);
  box-shadow: var(--neu-pressed-sm);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--success-color);
  box-shadow: var(--success-glow);
}

.dot.pulse {
  animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Neumorphic Buttons */
.mui-icon-btn {
  background-color: var(--surface-color);
  border: none;
  color: var(--text-main);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--neu-flat-sm);
  transition: transform var(--transition-smooth), box-shadow var(--transition-smooth), color var(--transition-smooth);
}

.mui-icon-btn:hover {
  box-shadow: var(--neu-flat);
  color: var(--primary-color);
  transform: translateY(-1px);
}

.mui-icon-btn:active {
  box-shadow: var(--neu-pressed-sm);
  transform: translateY(1px);
}

.mui-icon-btn.highlight {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: var(--neu-flat-sm), var(--primary-glow);
}

.mui-icon-btn.highlight:active {
  box-shadow: var(--neu-pressed-sm);
}

.mui-chip-btn {
  background-color: var(--surface-color);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--neu-flat-sm);
  transition: all var(--transition-smooth);
  font-family: inherit;
}

.mui-chip-btn span.material-symbols-outlined {
  font-size: 18px;
}

.mui-chip-btn:hover {
  box-shadow: var(--neu-flat);
  color: var(--primary-color);
  transform: translateY(-1px);
}

.mui-chip-btn:active {
  box-shadow: var(--neu-pressed-sm);
  transform: translateY(1px);
}

/* ---------------- MAIN WORKSPACE ---------------- */
.main-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Neumorphic Sidebar Drawer */
.mui-drawer {
  width: 370px;
  background-color: var(--surface-color);
  box-shadow: var(--neu-flat);
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-smooth);
  z-index: 500;
  position: relative;
}

.mui-drawer.collapsed {
  margin-left: -370px;
}

.drawer-header {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-header h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.drawer-header .badge {
  background-color: var(--surface-color);
  color: var(--primary-color);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  box-shadow: var(--neu-pressed-sm);
}

/* Neumorphic Recessed Filter Tabs */
.mui-tabs {
  display: flex;
  margin: 0 16px 12px 16px;
  background-color: var(--surface-color);
  border-radius: var(--radius-pill);
  box-shadow: var(--neu-pressed-sm);
  padding: 4px;
  gap: 4px;
}

.tab-btn {
  flex: 1;
  padding: 9px 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
  border-radius: var(--radius-pill);
  transition: all var(--transition-smooth);
  font-family: inherit;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  background-color: var(--surface-color);
  color: var(--primary-color);
  box-shadow: var(--neu-flat-sm);
}

/* Scrollable Device Cards Container */
.device-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.device-list::-webkit-scrollbar {
  width: 6px;
}

.device-list::-webkit-scrollbar-thumb {
  background-color: var(--surface-recessed);
  border-radius: 4px;
  box-shadow: var(--neu-flat-sm);
}

/* Neumorphic Vehicle Card */
.device-card {
  background-color: var(--surface-color);
  border-radius: var(--radius-m);
  padding: 16px;
  cursor: pointer;
  box-shadow: var(--neu-flat-sm);
  border: 1px solid var(--border-subtle);
  transition: transform var(--transition-smooth), box-shadow var(--transition-smooth), border-color var(--transition-smooth);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

.device-card:hover {
  box-shadow: var(--neu-flat);
  transform: translateY(-2px);
  border-color: rgba(238, 37, 47, 0.35);
}

.device-card:active {
  box-shadow: var(--neu-pressed-sm);
  transform: translateY(1px);
}

.device-card.selected {
  box-shadow: var(--neu-pressed);
  border-color: var(--primary-color);
  background: var(--neu-convex);
}

.device-card.speeding {
  border-color: var(--danger-color);
  box-shadow: var(--neu-flat-sm), var(--danger-glow);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Neumorphic Badges */
.status-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: var(--neu-flat-sm);
}

.status-badge.active {
  background-color: var(--success-bg);
  color: var(--success-color);
  box-shadow: var(--neu-pressed-sm);
}

.status-badge.idle {
  background-color: var(--warning-bg);
  color: var(--warning-color);
  box-shadow: var(--neu-pressed-sm);
}

.status-badge.offline {
  background-color: var(--surface-recessed);
  color: var(--text-muted);
  box-shadow: var(--neu-pressed-sm);
}

.status-badge.speeding-badge {
  background-color: var(--danger-bg);
  color: var(--danger-color);
  box-shadow: var(--neu-pressed-sm), var(--danger-glow);
}

.status-badge.on-scene {
  background: linear-gradient(135deg, rgba(0, 230, 118, 0.28), rgba(0, 176, 255, 0.18));
  border: 1px solid rgba(0, 230, 118, 0.65);
  color: #00e676;
  font-weight: 800;
  box-shadow: 0 0 10px rgba(0, 230, 118, 0.4);
  animation: pulseScene 2s infinite ease-in-out;
}

@keyframes pulseScene {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 230, 118, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(0, 230, 118, 0); }
}

.card-metrics {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.metric-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
}

.metric-item .material-symbols-outlined {
  font-size: 16px;
  color: var(--primary-color);
}

/* ---------------- MAP WORKSPACE ---------------- */
.map-workspace {
  flex: 1;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
}

/* ---------------- LEAFLET CUSTOM MAP MARKERS ---------------- */
.custom-map-marker {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-raised, #222630);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.25s ease;
  cursor: pointer;
  border: 2.5px solid var(--primary-color);
}

.marker-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: #ffffff;
  transition: transform 0.25s ease;
}

.marker-icon-wrap svg {
  display: block;
  width: 22px;
  height: 22px;
}

.custom-map-marker.active {
  border-color: #10b981;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.6);
}

.custom-map-marker.active .marker-icon-wrap {
  color: #10b981;
}

.custom-map-marker.idle {
  border-color: #fbb040;
  box-shadow: 0 0 16px rgba(251, 176, 64, 0.6);
}

.custom-map-marker.idle .marker-icon-wrap {
  color: #fbb040;
}

.custom-map-marker.speeding {
  border-color: #ee252f;
  box-shadow: 0 0 20px rgba(238, 37, 47, 0.8);
  animation: pulse-ring 1s infinite;
}

.custom-map-marker.speeding .marker-icon-wrap {
  color: #ee252f;
}

.custom-map-marker.offline {
  border-color: #64748b;
  opacity: 0.7;
}

.custom-map-marker.offline .marker-icon-wrap {
  color: #94a3b8;
}

/* In Chase 3D mode, the vehicle is rendered as a 3D Three.js model directly on the road.
   The 2D DOM marker transforms into a ground projection neon tracking ring beneath the 3D car. */
.maplibre-vehicle-marker.chase-3d-active {
  pointer-events: auto;
}
.maplibre-vehicle-marker.chase-3d-active .custom-map-marker {
  width: 54px;
  height: 54px;
  background: radial-gradient(circle, rgba(0, 229, 255, 0.3) 0%, rgba(0, 229, 255, 0.08) 55%, transparent 75%) !important;
  border: 2px dashed rgba(0, 229, 255, 0.9) !important;
  box-shadow: 0 0 25px rgba(0, 229, 255, 0.7), inset 0 0 15px rgba(0, 229, 255, 0.4) !important;
  border-radius: 50% !important;
  animation: chase-ground-halo 1.8s infinite ease-in-out;
}
.maplibre-vehicle-marker.chase-3d-active .marker-heading-pointer,
.maplibre-vehicle-marker.chase-3d-active .marker-icon-wrap {
  display: none !important;
}

@keyframes chase-ground-halo {
  0%, 100% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.15);
    opacity: 1;
  }
}

.marker-heading-pointer {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 9px solid var(--primary-color);
}

.map-overlay-controls {
  position: absolute;
  right: 24px;
  bottom: 34px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 800;
}

/* Neumorphic FAB Buttons */
.mui-fab {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: var(--surface-color);
  color: var(--primary-color);
  border: none;
  box-shadow: var(--neu-flat);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-smooth);
}

.mui-fab:hover {
  box-shadow: var(--neu-flat-lg);
  color: #fff;
  background: var(--primary-gradient);
  transform: translateY(-2px) scale(1.04);
}

.mui-fab:active {
  box-shadow: var(--neu-pressed);
  transform: translateY(1px) scale(0.98);
}

.mui-fab.secondary {
  color: var(--text-main);
  background-color: var(--surface-color);
}

.mui-fab.secondary:hover {
  background-color: var(--surface-color);
  color: var(--primary-color);
}

/* TRIP REPLAY CONTROLLER BAR (Neumorphic Pill Floating Widget) */
.trip-replay-bar {
  position: absolute;
  bottom: 34px;
  left: 50%;
  transform: translateX(-50%);
  width: 620px;
  max-width: 90vw;
  background-color: var(--surface-color);
  border-radius: var(--radius-pill);
  padding: 12px 24px;
  box-shadow: var(--neu-flat-lg);
  border: 1px solid var(--border-subtle);
  z-index: 860;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  animation: neu-slide-up 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.replay-info .icon {
  color: var(--primary-color);
  font-size: 26px;
  filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.4));
}

.replay-title {
  font-size: 13.5px;
  font-weight: 700;
  display: block;
}

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

.replay-controls {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Replay Action Buttons */
.mui-icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface-color);
  color: var(--text-main);
  border: none;
  box-shadow: var(--neu-flat-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  z-index: 10;
  transition: all var(--transition-smooth);
}

.mui-icon-btn:hover {
  box-shadow: var(--neu-flat);
  color: var(--primary-color);
  transform: translateY(-2px);
}

.mui-icon-btn:active {
  box-shadow: var(--neu-pressed);
  transform: translateY(1px);
}

.mui-icon-btn.highlight {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: var(--neu-flat-sm), var(--primary-glow);
}

.mui-icon-btn.highlight:hover {
  box-shadow: var(--neu-flat), 0 0 16px rgba(238, 37, 47, 0.7);
  transform: scale(1.08);
}

.mui-icon-btn.highlight:active {
  box-shadow: var(--neu-pressed);
  transform: scale(0.96);
}

.mui-chip-btn {
  background: var(--surface-color);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--neu-flat-sm);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-smooth);
}

.mui-chip-btn:hover {
  color: var(--primary-color);
  box-shadow: var(--neu-flat);
}

/* Neumorphic Recessed Slider */
.mui-slider {
  flex: 1;
  height: 8px;
  -webkit-appearance: none;
  background: var(--surface-color);
  box-shadow: var(--neu-pressed);
  border-radius: var(--radius-pill);
  outline: none;
  cursor: pointer;
}

.mui-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-gradient);
  box-shadow: var(--neu-flat-sm), var(--primary-glow);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.mui-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* ---------------- NEUMORPHIC DEVICE DETAIL CARD ---------------- */
.device-detail-card {
  position: absolute;
  left: 24px;
  bottom: 24px;
  width: 400px;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  overflow-x: hidden;
  background-color: var(--surface-color);
  border-radius: var(--radius-l);
  padding: 18px 20px;
  box-shadow: var(--neu-flat-lg);
  border: 1px solid var(--border-subtle);
  z-index: 850;
  display: none;
  animation: neu-slide-up 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.device-detail-card::-webkit-scrollbar {
  width: 5px;
}

.device-detail-card::-webkit-scrollbar-track {
  background: transparent;
}

.device-detail-card::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

.device-detail-card::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.26);
}

@keyframes neu-slide-up {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.close-card-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  background: var(--surface-color);
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--neu-flat-sm);
  cursor: pointer;
  transition: all var(--transition-smooth);
}

.close-card-btn:hover {
  color: var(--danger-color);
  box-shadow: var(--neu-flat);
}

.close-card-btn:active {
  box-shadow: var(--neu-pressed-sm);
}

.detail-header {
  margin-bottom: 18px;
}

.detail-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.detail-id {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 2px;
  display: inline-block;
}

.mui-chip.status-chip-badge {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  box-shadow: var(--neu-pressed-sm);
}

.telemetry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

/* Neumorphic Recessed Telemetry Wells */
.telemetry-item {
  background-color: var(--surface-color);
  box-shadow: var(--neu-pressed);
  padding: 10px 12px;
  border-radius: var(--radius-m);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all var(--transition-smooth);
}

.telemetry-item.full-width {
  grid-column: span 2;
}

.toll-plaza-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 62px;
  overflow-y: auto;
  margin-top: 6px;
  padding-right: 4px;
}

.toll-plaza-chip-list::-webkit-scrollbar {
  width: 4px;
}

.toll-plaza-chip-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 999px;
}

.toll-plaza-chip-list::-webkit-scrollbar-thumb {
  background: rgba(0, 230, 118, 0.35);
  border-radius: 999px;
}

.toll-plaza-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 230, 118, 0.08);
  border: 1px solid rgba(0, 230, 118, 0.28);
  color: #69f0ae;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--font-mono);
  line-height: 1.3;
  white-space: nowrap;
}

.toll-plaza-chip .toll-chip-count {
  background: rgba(0, 230, 118, 0.22);
  color: #00e676;
  font-weight: 800;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 10px;
}

.telemetry-item .icon {
  color: var(--primary-color);
  font-size: 22px;
  background: var(--surface-color);
  box-shadow: var(--neu-flat-sm);
  padding: 6px;
  border-radius: 50%;
}

.telemetry-item .label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.telemetry-item .value {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
  font-family: var(--font-mono);
}

.card-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.card-actions-secondary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.card-actions-secondary .mui-button {
  padding: 9px 10px;
  font-size: 12px;
  width: 100%;
}

/* Neumorphic Action Buttons */
.mui-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 12.5px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  box-shadow: var(--neu-flat-sm);
  transition: all var(--transition-smooth);
  font-family: inherit;
  white-space: nowrap;
}

.mui-button span.material-symbols-outlined {
  font-size: 16px;
}

.mui-button:hover {
  box-shadow: var(--neu-flat);
  transform: translateY(-2px);
}

.mui-button:active {
  box-shadow: var(--neu-pressed);
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: var(--neu-flat-sm), var(--primary-glow);
}

.btn-primary:hover {
  box-shadow: var(--neu-flat), 0 0 20px rgba(238, 37, 47, 0.65);
}

.btn-secondary {
  background-color: var(--surface-color);
  color: var(--text-main);
  box-shadow: var(--neu-flat-sm);
}

.btn-secondary:hover {
  color: var(--primary-color);
  box-shadow: var(--neu-flat);
}

.btn-danger {
  background-color: var(--surface-color);
  color: var(--danger-color);
  box-shadow: var(--neu-flat-sm);
}

.btn-danger:hover {
  box-shadow: var(--neu-flat), var(--danger-glow);
  color: #fff;
  background-color: var(--danger-color);
}

.btn-success {
  background-color: var(--surface-color);
  color: #00e676;
  border: 1px solid rgba(0, 230, 118, 0.35);
  box-shadow: var(--neu-flat-sm);
}

.btn-success:hover {
  box-shadow: var(--neu-flat), 0 0 16px rgba(0, 230, 118, 0.4);
  color: #fff;
  background-color: #00c853;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  min-height: 32px;
}

.btn-sm span.material-symbols-outlined {
  font-size: 15px;
}

/* ---------------- NEUMORPHIC MODALS ---------------- */
.mui-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(10, 12, 16, 0.65);
  backdrop-filter: blur(8px);
  z-index: 2500;
  display: none;
  align-items: center;
  justify-content: center;
}

.mui-modal-backdrop.active {
  display: flex;
}

.mui-modal {
  width: 820px;
  max-width: 94vw;
  background-color: var(--surface-color);
  border-radius: var(--radius-l);
  box-shadow: var(--neu-flat-lg);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  animation: neu-modal-in 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.mui-modal.large {
  width: 960px;
  max-width: 95vw;
}

.mui-modal.small {
  width: 460px;
}

/* Geofence Form & Modal Specific Styling */
.geofence-create-card {
  background: var(--surface-color);
  padding: 18px 20px;
  border-radius: var(--radius-m);
  box-shadow: var(--neu-pressed-sm);
  border: 1px solid var(--border-subtle);
  margin-bottom: 24px;
}

.form-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 14px;
}

.form-card-title span.material-symbols-outlined {
  color: var(--primary-color);
  font-size: 20px;
}

.geofence-form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  align-items: flex-end;
}

.geofence-form-grid .form-group.full-width {
  grid-column: span 4;
}

.geofence-form-grid .form-group.span-2 {
  grid-column: span 2;
}

.geofence-form-grid .form-group {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.geofence-form-grid .form-group label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.geofence-form-grid .form-group input {
  width: 100%;
}

.geofence-form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.add-zone-btn {
  height: 42px;
  padding: 0 24px;
  min-width: 160px;
  white-space: nowrap;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 20px 0 12px 0;
}

.section-title-row h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.section-badge {
  background-color: var(--surface-color);
  color: var(--primary-color);
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  box-shadow: var(--neu-pressed-sm);
  border: 1px solid var(--border-subtle);
}

.table-container {
  overflow-x: auto;
  width: 100%;
}

@media (max-width: 768px) {
  .geofence-form-grid {
    grid-template-columns: 1fr;
  }
  .geofence-form-grid .form-group.span-2,
  .geofence-form-grid .form-group.full-width {
    grid-column: span 1;
  }
}

@keyframes neu-modal-in {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  padding: 22px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 19px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-header h2 span.material-symbols-outlined {
  color: var(--primary-color);
}

.modal-close-btn {
  background: var(--surface-color);
  box-shadow: var(--neu-flat-sm);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
}

.modal-body {
  padding: 10px 28px 28px 28px;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-thumb {
  background-color: var(--surface-recessed);
  border-radius: 4px;
  box-shadow: var(--neu-flat-sm);
}

/* Neumorphic Metrics Cards */
.analytics-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 18px;
  margin-bottom: 24px;
}

.metric-card {
  background-color: var(--surface-color);
  padding: 20px 16px;
  border-radius: var(--radius-m);
  box-shadow: var(--neu-flat-sm);
  border: 1px solid var(--border-subtle);
  text-align: center;
  transition: transform var(--transition-smooth);
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--neu-flat);
}

.metric-card .icon {
  font-size: 30px;
  margin-bottom: 8px;
}

.metric-card .icon.blue { color: var(--primary-color); }
.metric-card .icon.green { color: var(--success-color); }
.metric-card .icon.red { color: var(--danger-color); }

.metric-card .val {
  font-size: 24px;
  font-weight: 800;
  font-family: var(--font-mono);
}

.metric-card .lbl {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

/* Neumorphic Recessed Table */
.mui-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
  margin-top: 14px;
}

.mui-table th {
  padding: 12px 14px;
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12.5px;
  border: none;
}

.mui-table td {
  padding: 14px;
  text-align: left;
  font-size: 13px;
  background-color: var(--surface-color);
  box-shadow: var(--neu-flat-sm);
  border: none;
}

.mui-table tr td:first-child {
  border-top-left-radius: var(--radius-s);
  border-bottom-left-radius: var(--radius-s);
}

.mui-table tr td:last-child {
  border-top-right-radius: var(--radius-s);
  border-bottom-right-radius: var(--radius-s);
}

/* Neumorphic Form Controls */
.form-group {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

.form-group input,
.form-group select {
  padding: 12px 16px;
  border-radius: var(--radius-s);
  background-color: var(--surface-color);
  box-shadow: var(--neu-pressed);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  outline: none;
  font-size: 13.5px;
  font-family: inherit;
  transition: all var(--transition-smooth);
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary-color);
  box-shadow: var(--neu-pressed), 0 0 0 2px var(--primary-container);
}

.modal-footer {
  margin-top: 24px;
}

/* ---------------- MAP AUTO-FOLLOW ACTIVE BUTTON STYLES ---------------- */
.mui-fab.active-follow {
  background: var(--primary-gradient);
  color: #ffffff;
  box-shadow: var(--neu-flat), var(--primary-glow);
  border: 2px solid #ffffff;
}

@keyframes pulse-danger {
  from { transform: scale(1); }
  to { transform: scale(1.18); }
}

.dark-theme .leaflet-tile-pane {
  filter: brightness(0.72) invert(1) contrast(1.2) hue-rotate(180deg);
}

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 14px;
  color: var(--text-muted);
}

.spin {
  animation: spin 1.2s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
  font-size: 28px;
  color: var(--primary-color);
}

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

/* ---------------- HISTORICAL PLAYBACK & DATE FILTER STYLES ---------------- */

/* Floating Active History Banner */
.history-active-banner {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  background: var(--surface-color);
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  box-shadow: var(--neu-flat), 0 0 20px rgba(0, 229, 255, 0.25);
  border: 1px solid rgba(0, 229, 255, 0.4);
  backdrop-filter: blur(12px);
  animation: neu-toast-in 0.35s ease;
}

.history-banner-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #00e5ff;
  box-shadow: 0 0 10px #00e5ff;
  animation: banner-pulse 1.4s infinite;
  flex-shrink: 0;
}

@keyframes banner-pulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 16px #00e5ff; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.history-active-banner .icon {
  font-size: 22px;
  color: #00e5ff;
  flex-shrink: 0;
}

.history-banner-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.history-banner-info .top-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.history-banner-info .top-row strong {
  font-size: 13px;
  color: var(--text-main);
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.history-banner-info .range-badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(0, 229, 255, 0.15);
  color: #00e5ff;
  font-weight: 600;
  white-space: nowrap;
}

.history-banner-info .dist-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--surface-secondary);
  color: var(--text-main);
  font-weight: 700;
  white-space: nowrap;
}

.history-banner-info .bottom-row {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 420px;
}

.history-banner-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.history-banner-actions .btn-sm {
  padding: 6px 12px;
  font-size: 11px;
  height: 30px;
  border-radius: 15px;
}

/* Preset Chips */
.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.preset-chip {
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--surface-color);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--neu-flat-sm);
  transition: all 0.2s ease;
}

.preset-chip:hover {
  color: var(--text-main);
  border-color: #00e5ff;
}

.preset-chip.active {
  background: linear-gradient(135deg, #00b0ff, #00e5ff);
  color: #0d1117;
  border-color: #00e5ff;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.4);
  font-weight: 700;
}

/* History Metrics Preview Grid */
.history-metrics-preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  background: var(--surface-secondary);
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.preview-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}

.preview-metric .lbl {
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}

.preview-metric .val {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.preview-metric .val.highlight {
  color: #00e5ff;
  font-size: 16px;
}

.history-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.history-actions-grid .mui-button {
  padding: 11px 14px;
  font-size: 12.5px;
  font-weight: 600;
  justify-content: center;
  gap: 6px;
}

/* History Map Endpoint Markers */
.history-endpoint-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  pointer-events: auto;
  z-index: 10;
  transform: translateY(-50%);
  animation: neu-toast-in 0.3s ease;
}

.history-endpoint-marker .marker-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2.5px solid #ffffff;
}

.history-endpoint-marker .marker-dot.green {
  background: #00e676;
  box-shadow: 0 0 14px #00e676;
}

.history-endpoint-marker .marker-dot.red {
  background: #ff1744;
  box-shadow: 0 0 14px #ff1744;
}

.history-endpoint-marker .marker-label {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.6px;
  padding: 2px 7px;
  border-radius: 6px;
  margin-top: 3px;
  background: rgba(13, 17, 23, 0.92);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(4px);
}

@media (max-width: 768px) {
  .history-active-banner {
    width: 92%;
    left: 4%;
    transform: none;
    flex-wrap: wrap;
    padding: 8px 12px;
  }
  .history-metrics-preview {
    grid-template-columns: repeat(2, 1fr);
  }
  .history-actions-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Speed Alarm Pulsing & Glowing Animations */
.device-card.speeding {
  border: 1px solid #ff1744 !important;
  box-shadow: 0 0 16px rgba(255, 23, 68, 0.4), inset 0 0 12px rgba(255, 23, 68, 0.15) !important;
  animation: speedPulseGlow 1.2s infinite alternate !important;
}

.status-badge.speeding-badge {
  background: linear-gradient(135deg, #ff1744, #d50000);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 0 10px rgba(255, 23, 68, 0.6);
  animation: speedBadgePulse 0.8s infinite alternate;
}

@keyframes speedPulseGlow {
  0% {
    box-shadow: 0 0 8px rgba(255, 23, 68, 0.3);
  }
  100% {
    box-shadow: 0 0 22px rgba(255, 23, 68, 0.8), inset 0 0 16px rgba(255, 23, 68, 0.25);
  }
}

@keyframes speedBadgePulse {
  0% {
    transform: scale(1);
  }
  100% {
    transform: scale(1.08);
  }
}

/* ==========================================================================
   TOMTOM LIVE TRAFFIC FLOW & INCIDENTS OVERLAY
   ========================================================================== */

/* Active Traffic Toolbar Button */
.mui-fab.active-traffic {
  background: linear-gradient(135deg, #00e676, #00b0ff) !important;
  color: #0d1117 !important;
  box-shadow: 0 0 16px rgba(0, 230, 118, 0.6) !important;
}

/* Active Snap-to-Roads Toolbar Button */
#snap-roads-toggle-btn.active {
  background: rgba(0, 230, 118, 0.18) !important;
  border: 1.5px solid #00e676 !important;
  box-shadow: 0 0 14px rgba(0, 230, 118, 0.5) !important;
}
#snap-roads-toggle-btn.active span {
  color: #00e676 !important;
}

/* High-performance pre-mounted traffic layer */
.traffic-flow-layer {
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  will-change: opacity;
  pointer-events: none;
}

/* Vector Road Flow Polyline Glow */
.traffic-flow-polyline {
  filter: drop-shadow(0 0 6px rgba(0, 230, 118, 0.6));
  stroke-dasharray: 8, 4;
  animation: trafficPulse 2s linear infinite;
}

@keyframes trafficPulse {
  to {
    stroke-dashoffset: -24;
  }
}

/* Traffic Quota Warning Banner */
.traffic-quota-banner {
  position: absolute;
  top: 75px;
  right: 18px;
  z-index: 1050;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(30, 20, 15, 0.94);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 87, 34, 0.4);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: fadeIn 0.3s ease;
  max-width: 320px;
}

.traffic-quota-banner .icon {
  color: #ff9100;
  font-size: 24px;
}

.traffic-quota-banner .quota-msg {
  display: flex;
  flex-direction: column;
  font-size: 12px;
}

.traffic-quota-banner .quota-msg strong {
  color: #ffab40;
  font-weight: 600;
}

.traffic-quota-banner .quota-msg span {
  color: var(--text-secondary);
  font-size: 11px;
}


/* Traffic Legend Card */
.traffic-legend-card {
  position: absolute;
  top: 18px;
  right: 65px;
  background: rgba(26, 29, 36, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-m, 16px);
  padding: 12px 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  color: var(--text-main, #fff);
  font-family: 'Plus Jakarta Sans', sans-serif;
  animation: fadeIn 0.25s ease-out;
  min-width: 175px;
  pointer-events: auto;
}

body.light-theme .traffic-legend-card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  color: #1e2229;
}

.traffic-legend-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

body.light-theme .traffic-legend-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.traffic-legend-header .icon {
  font-size: 16px;
  color: #00e676;
}

.traffic-legend-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.traffic-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 500;
}

.traffic-legend-item .color-indicator {
  width: 18px;
  height: 6px;
  border-radius: 3px;
  display: inline-block;
  flex-shrink: 0;
}

.traffic-legend-item .color-indicator.green {
  background: #00c853; /* Free Flow */
  box-shadow: 0 0 6px rgba(0, 200, 83, 0.6);
}

.traffic-legend-item .color-indicator.yellow {
  background: #ffab00; /* Slow */
  box-shadow: 0 0 6px rgba(255, 171, 0, 0.6);
}

.traffic-legend-item .color-indicator.orange {
  background: #ff6d00; /* Heavy */
  box-shadow: 0 0 6px rgba(255, 109, 0, 0.6);
}

.traffic-legend-item .color-indicator.red {
  background: #d50000; /* Gridlock */
  box-shadow: 0 0 6px rgba(213, 0, 0, 0.6);
}

.traffic-legend-item .color-indicator.incident {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f50057;
  border: 2px solid #fff;
  box-shadow: 0 0 6px rgba(245, 0, 87, 0.6);
}

@media (max-width: 768px) {
  .traffic-legend-card {
    top: auto;
    bottom: 85px;
    right: 14px;
    padding: 10px 12px;
  }
}

/* Strict 5km Fleet Vicinity Badge */
.traffic-proximity-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(0, 230, 118, 0.12);
  border: 1px solid rgba(0, 230, 118, 0.35);
  color: #00e676;
  padding: 5px 10px;
  border-radius: var(--radius-xs, 8px);
  font-size: 10.5px;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: 0.4px;
  box-shadow: 0 0 10px rgba(0, 230, 118, 0.15);
}

.traffic-proximity-badge .icon {
  font-size: 14px;
  color: #00e676;
}

body.light-theme .traffic-proximity-badge {
  background: rgba(0, 200, 83, 0.1);
  border: 1px solid rgba(0, 200, 83, 0.4);
  color: #008938;
}

/* Vehicle Detail Card Traffic Item */
#detail-traffic-item {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 10px;
  margin-top: 4px;
}

#detail-traffic-item .value {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-main);
}

/* Vehicle Detail Card GPS Drift Item */
#detail-drift-item {
  border-top: 1px solid rgba(0, 229, 255, 0.15);
  padding-top: 10px;
  margin-top: 4px;
  background: rgba(0, 229, 255, 0.04);
  border-radius: var(--radius-m);
}

#detail-drift-item .value {
  font-size: 11.5px;
  line-height: 1.4;
  color: #00e5ff;
}

body.light-theme #detail-drift-item {
  border-top: 1px solid rgba(0, 184, 212, 0.3);
  background: rgba(0, 184, 212, 0.06);
}

body.light-theme #detail-drift-item .value {
  color: #00838f;
}

/* Edit Vehicle Action Buttons */
.edit-header-btn {
  background: rgba(0, 229, 255, 0.08) !important;
  border: 1px solid rgba(0, 229, 255, 0.25) !important;
  transition: all 0.2s ease !important;
}

.edit-header-btn:hover {
  background: rgba(0, 229, 255, 0.2) !important;
  border-color: #00e5ff !important;
  transform: scale(1.08);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.4) !important;
}

#edit-vehicle-btn {
  border-color: rgba(0, 229, 255, 0.35) !important;
  color: #00e5ff !important;
}

#edit-vehicle-btn:hover {
  background: rgba(0, 229, 255, 0.12) !important;
  border-color: #00e5ff !important;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.3) !important;
}

/* ==========================================================================
   SMART FLEET DISPATCH & PROXIMITY RECOMMENDER STYLES
   ========================================================================== */

/* Header Dispatch Button */
.dispatch-chip-btn {
  background: linear-gradient(135deg, rgba(124, 77, 255, 0.15), rgba(0, 229, 255, 0.15)) !important;
  border-color: rgba(124, 77, 255, 0.4) !important;
  color: #b388ff !important;
  transition: all 0.25s ease !important;
}

.dispatch-chip-btn:hover {
  background: linear-gradient(135deg, rgba(124, 77, 255, 0.3), rgba(0, 229, 255, 0.25)) !important;
  border-color: #7c4dff !important;
  box-shadow: 0 0 16px rgba(124, 77, 255, 0.4) !important;
}

.dispatch-chip-btn.active {
  background: linear-gradient(135deg, #7c4dff, #00e5ff) !important;
  color: #0d1117 !important;
  font-weight: 700 !important;
  border-color: transparent !important;
  box-shadow: 0 0 20px rgba(124, 77, 255, 0.6) !important;
}

/* Floating Action Button (FAB) */
#dispatch-toggle-fab.active-dispatch {
  background: linear-gradient(135deg, #7c4dff, #00e5ff) !important;
  color: #0d1117 !important;
  box-shadow: 0 0 20px rgba(124, 77, 255, 0.7) !important;
}

/* Dispatch Mode Cursor on Map */
#map.dispatch-mode-active {
  cursor: crosshair !important;
}

#map.dispatch-mode-active .leaflet-interactive {
  cursor: crosshair !important;
}

#map.flag-area-mode-active,
#map.flag-area-mode-active .maplibregl-canvas {
  cursor: crosshair !important;
}

/* Flag Area Mode Top Banner */
.flag-area-active-banner {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(22, 25, 38, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 145, 0, 0.55);
  border-radius: var(--radius-m, 16px);
  padding: 10px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(255, 145, 0, 0.25);
  animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.flag-area-active-banner .icon {
  font-size: 26px;
  color: #ff9100;
  animation: pulseRotate 2s infinite ease-in-out;
}

.flag-banner-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff9100;
  box-shadow: 0 0 12px #ff9100;
  animation: pulseDot 1.5s infinite;
}

.flag-banner-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.flag-banner-info .top-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.flag-banner-info strong {
  font-size: 13.5px;
  color: var(--text-main, #ffffff);
  letter-spacing: 0.3px;
}

.flag-badge {
  background: rgba(255, 145, 0, 0.2);
  border: 1px solid rgba(255, 145, 0, 0.5);
  color: #ffb74d;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-pill, 9999px);
  text-transform: uppercase;
}

.flag-banner-info .sub-text {
  font-size: 11.5px;
  color: #a0aec0;
}

.flag-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Flag Area Dropped Pin Marker */
.flag-area-drop-pin {
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  cursor: pointer;
  transform-origin: bottom center;
  animation: dropBounce 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.flag-area-drop-pin .pin-icon {
  font-size: 38px;
  color: #ff9100;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.85));
}

@keyframes dropBounce {
  0% { transform: translateY(-30px) scale(0.6); opacity: 0; }
  70% { transform: translateY(4px) scale(1.08); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* Dispatch Target Mode Top Banner */
.dispatch-active-banner {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(22, 25, 38, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(124, 77, 255, 0.5);
  border-radius: var(--radius-m, 16px);
  padding: 10px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(124, 77, 255, 0.25);
  animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.dispatch-active-banner .icon {
  font-size: 26px;
  color: #00e5ff;
  animation: pulseRotate 2s infinite ease-in-out;
}

.dispatch-banner-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #7c4dff;
  box-shadow: 0 0 12px #7c4dff;
  animation: pulseDot 1.5s infinite;
}

.dispatch-banner-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dispatch-banner-info .top-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dispatch-banner-info strong {
  font-size: 13.5px;
  color: var(--text-main);
  letter-spacing: 0.3px;
}

.dispatch-badge {
  background: rgba(124, 77, 255, 0.2);
  border: 1px solid rgba(124, 77, 255, 0.4);
  color: #b388ff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  text-transform: uppercase;
}

.dispatch-banner-info .bottom-row {
  font-size: 11.5px;
  color: var(--text-secondary);
}

.dispatch-banner-actions {
  margin-left: 8px;
}

/* Dispatch Location Search Box & Autocomplete */
.dispatch-search-wrapper {
  position: relative;
  width: 100%;
  min-width: 320px;
  max-width: 440px;
}

.dispatch-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 13, 20, 0.85);
  border: 1px solid rgba(0, 229, 255, 0.35);
  border-radius: 10px;
  padding: 6px 12px;
  box-shadow: inset 2px 2px 5px #0a0d14, inset -2px -2px 5px #1c2230;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dispatch-search-box:focus-within {
  border-color: #00e5ff;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.4), inset 2px 2px 5px #0a0d14;
}

.dispatch-search-box .search-icon {
  font-size: 18px;
  color: #00e5ff;
}

.dispatch-search-box input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 12.5px;
  font-family: inherit;
}

.dispatch-search-box input::placeholder {
  color: var(--text-dim);
}

.search-clear-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.search-clear-btn:hover {
  color: var(--text-main);
}

.dispatch-search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: rgba(18, 22, 34, 0.97);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(0, 229, 255, 0.3);
  border-radius: 12px;
  max-height: 250px;
  overflow-y: auto;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.7), 0 0 16px rgba(0, 229, 255, 0.15);
  z-index: 1200;
}

.search-result-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.15s ease;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: rgba(0, 229, 255, 0.1);
}

.search-result-item .pin-icon {
  font-size: 18px;
  color: #ff1744;
  margin-top: 2px;
  flex-shrink: 0;
}

.search-result-item .info strong {
  display: block;
  font-size: 12.5px;
  color: var(--text-main);
}

.search-result-item .info small {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.25;
}

.search-result-loading, .search-result-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px;
  font-size: 12px;
  color: var(--text-muted);
  justify-content: center;
}

/* Modal Search Box */
.dispatch-modal-search {
  position: relative;
  margin-bottom: 16px;
}

.dispatch-search-box.modal-search {
  padding: 8px 14px;
  border-radius: 12px;
}

.dispatch-search-box.modal-search input {
  font-size: 13.5px;
}

/* Unified Floating Top HUD & Banner Stack (Auto-stacks with zero overlap) */
.map-top-hud-stack {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  max-width: min(680px, calc(100% - 140px));
  width: max-content;
  transition: all 0.25s ease;
}

.map-top-hud-stack > div {
  pointer-events: auto;
  position: static !important;
  top: auto !important;
  left: auto !important;
  transform: none !important;
  margin: 0 !important;
}

/* Floating Active Mission HUD on Map */
.active-mission-hud {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(14, 18, 28, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid rgba(0, 229, 255, 0.5);
  border-radius: var(--radius-m, 16px);
  padding: 10px 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 229, 255, 0.2);
  animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: calc(100vw - 40px);
  transition: all 0.3s ease;
}

.active-mission-hud.on-scene {
  border-color: rgba(0, 230, 118, 0.75);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.65), 0 0 24px rgba(0, 230, 118, 0.35);
}

.active-mission-hud.on-scene .icon {
  color: #00e676 !important;
}

.active-mission-hud.on-scene .mission-hud-pulse {
  background: #00e676 !important;
  box-shadow: 0 0 14px #00e676 !important;
}

.hud-badge.on-scene {
  background: rgba(0, 230, 118, 0.25) !important;
  border-color: rgba(0, 230, 118, 0.7) !important;
  color: #00e676 !important;
}

.hud-eta.on-scene {
  background: rgba(0, 230, 118, 0.2) !important;
  border: 1px solid rgba(0, 230, 118, 0.5);
  color: #00e676 !important;
  font-weight: 800;
  border-radius: var(--radius-pill, 9999px);
  padding: 1px 8px;
}

.active-mission-hud .icon {
  font-size: 26px;
  color: #00e5ff;
}

.mission-hud-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #00e5ff;
  box-shadow: 0 0 12px #00e5ff;
  animation: pulseDot 1.5s infinite;
}

.mission-hud-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mission-hud-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-badge {
  background: rgba(0, 229, 255, 0.18);
  border: 1px solid rgba(0, 229, 255, 0.5);
  color: #00e5ff;
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mission-hud-top strong {
  font-size: 13.5px;
  color: var(--text-main);
}

.hud-eta {
  font-size: 11.5px;
  color: #00e676;
  font-weight: 700;
}

.mission-hud-target {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.mission-hud-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Floating Route Preview HUD on Map (When previewing routes / panel hidden) */
.dispatch-preview-hud {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(14, 18, 28, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid rgba(255, 171, 0, 0.55);
  border-radius: var(--radius-m, 16px);
  padding: 10px 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(255, 171, 0, 0.25);
  animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: calc(100vw - 40px);
}

.dispatch-preview-hud .icon {
  font-size: 24px;
  color: #ffab00;
}

.preview-hud-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffab00;
  box-shadow: 0 0 12px #ffab00;
  animation: pulseDot 1.5s infinite;
}

.preview-hud-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.preview-hud-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-badge.preview {
  background: rgba(255, 171, 0, 0.18);
  border: 1px solid rgba(255, 171, 0, 0.5);
  color: #ffab00;
}

.preview-hud-target {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.preview-hud-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Detail Card Mission Status Bar */
.detail-mission-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(135deg, rgba(124, 77, 255, 0.14), rgba(0, 229, 255, 0.08));
  border: 1px solid rgba(124, 77, 255, 0.35);
  border-radius: var(--radius-m, 14px);
  padding: 12px 14px;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: fadeIn 0.3s ease;
  transition: all 0.3s ease;
}

.detail-mission-bar.on-scene {
  background: linear-gradient(135deg, rgba(0, 230, 118, 0.18), rgba(0, 176, 255, 0.12));
  border-color: rgba(0, 230, 118, 0.65);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3), 0 0 20px rgba(0, 230, 118, 0.25);
}

.detail-mission-bar.on-scene .mission-badge-icon {
  color: #00e676 !important;
}

.detail-mission-bar.on-scene .lbl {
  color: #00e676 !important;
}

.detail-mission-bar.on-scene .dest-pin-icon {
  color: #00e676 !important;
}

.detail-mission-bar.on-scene .sub-val {
  color: #00e676 !important;
}

.detail-mission-eta-pill.on-scene {
  background: rgba(0, 230, 118, 0.25) !important;
  border-color: #00e676 !important;
  color: #ffffff !important;
  font-weight: 800;
  box-shadow: 0 0 10px rgba(0, 230, 118, 0.45);
}

.detail-mission-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mission-badge-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mission-badge-icon {
  font-size: 17px;
  color: #00e5ff;
}

.detail-mission-bar .lbl {
  font-size: 10px;
  text-transform: uppercase;
  color: #b388ff;
  font-weight: 800;
  letter-spacing: 0.6px;
}

.detail-mission-eta-pill {
  background: rgba(0, 230, 118, 0.12);
  border: 1px solid rgba(0, 230, 118, 0.35);
  color: #00e676;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.detail-mission-body {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 9px 11px;
}

.dest-pin-icon {
  font-size: 19px;
  color: #ff5252;
  flex-shrink: 0;
  margin-top: 1px;
}

.dest-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.detail-mission-bar .val {
  font-size: 12.5px;
  color: var(--text-main);
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}

.detail-mission-bar .sub-val {
  font-size: 11px;
  color: #00e5ff;
  font-weight: 600;
}

.mission-actions-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.mission-action-btn {
  width: 100%;
  justify-content: center;
}

/* Detail Card Environmental Hazard Zone Bar */
.detail-hazard-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-radius: var(--radius-m, 14px);
  padding: 12px 14px;
  margin-bottom: 16px;
  animation: fadeIn 0.3s ease;
  transition: all 0.3s ease;
}

.detail-hazard-bar.flood {
  background: linear-gradient(135deg, rgba(0, 176, 255, 0.22), rgba(0, 229, 255, 0.09));
  border: 1px solid rgba(0, 229, 255, 0.45);
  box-shadow: 0 4px 16px rgba(0, 229, 255, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.detail-hazard-bar.landslide {
  background: linear-gradient(135deg, rgba(255, 109, 0, 0.22), rgba(255, 171, 0, 0.09));
  border: 1px solid rgba(255, 109, 0, 0.5);
  box-shadow: 0 4px 16px rgba(255, 109, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.detail-hazard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hazard-badge-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hazard-badge-icon {
  font-size: 18px;
}

.detail-hazard-bar.flood .hazard-badge-icon {
  color: #00e5ff;
}

.detail-hazard-bar.landslide .hazard-badge-icon {
  color: #ff9100;
}

.detail-hazard-bar .lbl {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.6px;
}

.detail-hazard-bar.flood .lbl {
  color: #80d8ff;
}

.detail-hazard-bar.landslide .lbl {
  color: #ffb74d;
}

.detail-hazard-severity-pill {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-pill, 9999px);
  white-space: nowrap;
  letter-spacing: 0.4px;
}

.detail-hazard-severity-pill.moderate {
  background: rgba(255, 215, 64, 0.16);
  border: 1px solid rgba(255, 215, 64, 0.45);
  color: #ffd740;
}

.detail-hazard-severity-pill.high {
  background: rgba(255, 109, 0, 0.22);
  border: 1px solid rgba(255, 109, 0, 0.55);
  color: #ff9100;
}

.detail-hazard-severity-pill.extreme {
  background: rgba(255, 23, 68, 0.26);
  border: 1px solid rgba(255, 23, 68, 0.65);
  color: #ff1744;
  animation: pulseHazardGlow 1.6s infinite alternate ease-in-out;
}

@keyframes pulseHazardGlow {
  from { box-shadow: 0 0 4px rgba(255, 23, 68, 0.4); }
  to { box-shadow: 0 0 12px rgba(255, 23, 68, 0.85); }
}

.detail-hazard-body {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 8px 12px;
}

.hazard-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.detail-hazard-bar .val {
  font-size: 12.5px;
  color: var(--text-main, #ffffff);
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}

.detail-hazard-bar .sub-val {
  font-size: 11px;
  font-weight: 500;
}

.detail-hazard-bar.flood .sub-val {
  color: #40c4ff;
}

.detail-hazard-bar.landslide .sub-val {
  color: #ffab40;
}

/* Zone category badges in table */
.zone-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.zone-type-badge.geofence {
  background: rgba(238, 37, 47, 0.15);
  color: #ff5252;
  border: 1px solid rgba(238, 37, 47, 0.35);
}
.zone-type-badge.hazard_flood {
  background: rgba(0, 176, 255, 0.16);
  color: #00e5ff;
  border: 1px solid rgba(0, 229, 255, 0.4);
}
.zone-type-badge.hazard_landslide {
  background: rgba(255, 109, 0, 0.18);
  color: #ff9100;
  border: 1px solid rgba(255, 109, 0, 0.45);
}

/* Dispatch Target Marker Popup */
.dispatch-target-popup {
  padding: 4px;
  font-family: inherit;
}

.dispatch-target-popup h4 {
  margin: 0 0 6px 0;
  font-size: 13.5px;
  color: #0d1117;
  display: flex;
  align-items: center;
  gap: 4px;
}

.dispatch-target-popup p {
  margin: 4px 0;
  font-size: 11.5px;
  color: #333;
}

/* Dispatch Target Map Marker */
.dispatch-target-pin {
  position: relative;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dispatch-target-pin .pin-core {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff1744, #d50000);
  border: 2.5px solid #ffffff;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(255, 23, 68, 0.7);
  z-index: 2;
  font-size: 18px;
}

.dispatch-target-pin .pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid rgba(255, 23, 68, 0.8);
  animation: radarPing 1.8s infinite cubic-bezier(0, 0, 0.2, 1);
  pointer-events: none;
}

@keyframes radarPing {
  0% {
    width: 28px;
    height: 28px;
    opacity: 1;
  }
  100% {
    width: 70px;
    height: 70px;
    opacity: 0;
  }
}

/* Dispatch Target Pin - ON SCENE state */
.dispatch-target-pin.on-scene .pin-core {
  background: linear-gradient(135deg, #00e676, #00b0ff) !important;
  box-shadow: 0 4px 18px rgba(0, 230, 118, 0.85), 0 0 25px rgba(0, 230, 118, 0.5) !important;
  border-color: #ffffff !important;
  color: #0b0f19 !important;
}

.dispatch-target-pin.on-scene .pulse-ring {
  border-color: rgba(0, 230, 118, 0.95) !important;
  animation: radarPingOnScene 1.5s infinite cubic-bezier(0, 0, 0.2, 1) !important;
}

@keyframes radarPingOnScene {
  0% {
    width: 28px;
    height: 28px;
    opacity: 1;
    box-shadow: 0 0 10px rgba(0, 230, 118, 0.8);
  }
  100% {
    width: 82px;
    height: 82px;
    opacity: 0;
  }
}

.dispatch-on-scene-tag {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: #00e676;
  color: #05140b;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: var(--radius-pill, 9999px);
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6), 0 0 12px rgba(0, 230, 118, 0.6);
  display: flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 0.4px;
  z-index: 10;
  animation: dropBounce 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Vehicle Map Marker On Scene Halo */
.custom-map-marker.on-scene,
.custom-map-marker.vehicle-on-scene {
  border-color: #00e676 !important;
  box-shadow: 0 0 20px rgba(0, 230, 118, 0.9), inset 0 0 8px rgba(0, 230, 118, 0.4) !important;
  animation: onSceneMarkerPulse 1.8s infinite ease-in-out;
}

.custom-map-marker.on-scene .marker-heading-pointer,
.custom-map-marker.vehicle-on-scene .marker-heading-pointer {
  border-bottom-color: #00e676 !important;
}

.marker-on-scene-indicator {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #00e676;
  border: 2px solid #ffffff;
  box-shadow: 0 0 8px #00e676;
  z-index: 5;
  animation: pulseDot 1.2s infinite;
}

@keyframes onSceneMarkerPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 16px rgba(0, 230, 118, 0.8);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 0 26px rgba(0, 230, 118, 1);
  }
}

/* Animated Route Line from Vehicle to Destination */
.dispatch-route-polyline {
  stroke-dasharray: 10, 8;
  animation: dispatchFlow 1.8s linear infinite;
  filter: drop-shadow(0 0 8px rgba(0, 229, 255, 0.6));
}

@keyframes dispatchFlow {
  from {
    stroke-dashoffset: 36;
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* Side-Docked Non-Blocking Dispatch Panel (Google Maps Style) */
#dispatch-modal.mui-modal-backdrop {
  background-color: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  pointer-events: none !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  padding: 0 !important;
  z-index: 2200;
}

#dispatch-modal .dispatch-modal {
  position: absolute;
  left: 20px;
  top: 72px;
  width: 440px !important;
  max-width: calc(100vw - 40px) !important;
  max-height: calc(100vh - 100px);
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  pointer-events: auto !important;
  background: rgba(14, 18, 28, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid rgba(0, 229, 255, 0.35);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7), 0 0 30px rgba(0, 229, 255, 0.15);
  border-radius: var(--radius-l, 18px);
  margin: 0 !important;
  animation: neu-slide-right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  transition: max-height 0.25s ease, transform 0.25s ease;
}

#dispatch-modal .modal-header {
  flex-shrink: 0;
  padding: 18px 24px 14px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

#dispatch-modal .modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 22px 14px 22px;
  max-height: none !important;
}

@keyframes neu-slide-right {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Minimized Compact View */
#dispatch-modal .dispatch-modal.minimized .dispatch-target-card,
#dispatch-modal .dispatch-modal.minimized .dispatch-section-header,
#dispatch-modal .dispatch-modal.minimized .dispatch-alt-title,
#dispatch-modal .dispatch-modal.minimized .dispatch-alt-list,
#dispatch-modal .dispatch-modal.minimized .modal-footer,
#dispatch-modal .dispatch-modal.minimized .dispatch-modal-search,
#dispatch-modal .dispatch-modal.minimized .dispatch-vehicle-meta,
#dispatch-modal .dispatch-modal.minimized .dispatch-metrics-grid {
  display: none !important;
}

#dispatch-modal .dispatch-modal.minimized {
  max-height: 290px;
}

#dispatch-modal .dispatch-modal-footer,
.dispatch-modal-footer {
  flex-shrink: 0;
  padding: 14px 20px 16px 20px !important;
  margin-top: 0 !important;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(10, 14, 22, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 10px !important;
  border-bottom-left-radius: var(--radius-l, 18px);
  border-bottom-right-radius: var(--radius-l, 18px);
  box-sizing: border-box !important;
}

.dispatch-modal-footer .btn-danger {
  background: rgba(244, 67, 54, 0.12) !important;
  border: 1px solid rgba(244, 67, 54, 0.4) !important;
  color: #ff5252 !important;
  padding: 7px 14px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  border-radius: 20px !important;
  box-shadow: none !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}

.dispatch-modal-footer .btn-danger:hover {
  background: rgba(244, 67, 54, 0.25) !important;
  color: #fff !important;
}

.dispatch-modal-footer .btn-secondary {
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  color: var(--text-main) !important;
  padding: 7px 14px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  border-radius: 20px !important;
  box-shadow: none !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}

.dispatch-modal-footer .btn-secondary:hover {
  background: rgba(0, 229, 255, 0.15) !important;
  border-color: rgba(0, 229, 255, 0.5) !important;
  color: #00e5ff !important;
}

.dispatch-modal-footer .material-symbols-outlined {
  font-size: 16px !important;
}

@media (max-width: 768px) {
  #dispatch-modal .dispatch-modal {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: 12px;
    width: auto !important;
    max-height: 52vh;
  }
}

.icon-dispatch {
  color: #00e5ff;
}

.dispatch-target-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-m, 14px);
  padding: 12px 16px;
  margin-bottom: 20px;
}

.dispatch-target-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 23, 68, 0.15);
  border: 1px solid rgba(255, 23, 68, 0.4);
  color: #ff1744;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dispatch-target-details {
  flex: 1;
  min-width: 0;
}

.target-label {
  font-size: 10.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.target-address {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  margin: 2px 0;
  line-height: 1.3;
}

.target-coords {
  font-size: 11px;
  color: var(--text-muted);
  font-family: monospace;
}

.dispatch-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.dispatch-section-header .material-symbols-outlined {
  font-size: 18px;
  color: #00e5ff;
}

/* #1 Best Match Hero Card */
.dispatch-hero-card {
  background: linear-gradient(135deg, rgba(22, 29, 46, 0.95), rgba(16, 20, 32, 0.95));
  border: 1.5px solid rgba(0, 229, 255, 0.5);
  border-radius: var(--radius-m, 16px);
  padding: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 24px rgba(0, 229, 255, 0.15);
  position: relative;
  overflow: hidden;
}

.dispatch-hero-badge {
  position: absolute;
  top: 14px;
  right: 16px;
  background: linear-gradient(135deg, #00e5ff, #7c4dff);
  color: #0d1117;
  font-size: 10px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.dispatch-vehicle-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.dispatch-vehicle-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(0, 229, 255, 0.1);
  border: 1px solid rgba(0, 229, 255, 0.3);
  color: #00e5ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

.dispatch-vehicle-info h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 4px 0;
}

.dispatch-vehicle-meta {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Dispatch Metrics Pill Grid */
.dispatch-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.dispatch-metric-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}

.dispatch-metric-box .val {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.dispatch-metric-box .val.highlight {
  color: #00e5ff;
}

.dispatch-metric-box .val.eta {
  color: #00e676;
}

.dispatch-metric-box .lbl {
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Dispatch Hero Action Buttons */
.dispatch-hero-actions {
  display: flex;
  gap: 10px;
}

.dispatch-confirm-btn {
  flex: 1;
  background: linear-gradient(135deg, #00e5ff, #00b0ff) !important;
  color: #0d1117 !important;
  font-weight: 700 !important;
  font-size: 13.5px !important;
  padding: 12px 18px !important;
  border-radius: 12px !important;
  border: none !important;
  box-shadow: 0 6px 18px rgba(0, 229, 255, 0.4) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.dispatch-confirm-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 229, 255, 0.6) !important;
}

/* Alternative Vehicle Items List */
.dispatch-alt-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dispatch-alt-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 10px 14px;
  transition: all 0.2s ease;
}

.dispatch-alt-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}

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

.dispatch-alt-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.dispatch-alt-info strong {
  font-size: 13px;
  color: var(--text-main);
  display: block;
}

.dispatch-alt-info span {
  font-size: 11px;
  color: var(--text-muted);
}

.dispatch-alt-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dispatch-alt-stats {
  text-align: right;
}

.dispatch-alt-stats .dist {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.dispatch-alt-stats .eta {
  font-size: 11px;
  color: #00e676;
}

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

@keyframes pulseRotate {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ---------------- MULTI-ROUTE CHOICES (GOOGLE MAPS STYLE) ---------------- */
.dispatch-route-options-wrap {
  margin-bottom: 16px;
}

.dispatch-route-options-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #b388ff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dispatch-route-options-header .header-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dispatch-route-options-header .header-hint {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: none;
  font-weight: 500;
}

.dispatch-route-cards-list {
  display: flex;
  gap: 8px;
  width: 100%;
}

.dispatch-route-card {
  flex: 1 1 0;
  min-width: 0;
  background: rgba(255, 255, 255, 0.03);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 9px 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  user-select: none;
}

.dispatch-route-card:hover {
  background: rgba(0, 229, 255, 0.06);
  border-color: rgba(0, 229, 255, 0.4);
  transform: translateY(-2px);
}

.dispatch-route-card.active {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.15), rgba(124, 77, 255, 0.12));
  border-color: #00e5ff;
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.3), inset 0 0 8px rgba(0, 229, 255, 0.08);
  transform: translateY(-1px);
}

.route-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.route-card-title-group {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.route-radio-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.dispatch-route-card.active .route-radio-dot {
  background: #00e5ff;
  border-color: #00e5ff;
  box-shadow: 0 0 8px #00e5ff;
}

.route-name {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.route-badge {
  font-size: 8.5px;
  font-weight: 800;
  padding: 1.5px 5px;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.route-badge.fastest {
  background: rgba(0, 230, 118, 0.18);
  border: 1px solid rgba(0, 230, 118, 0.5);
  color: #00e676;
}

.route-diff-pill {
  font-size: 8.5px;
  font-weight: 700;
  padding: 1.5px 5px;
  border-radius: 5px;
  background: rgba(255, 171, 0, 0.15);
  border: 1px solid rgba(255, 171, 0, 0.4);
  color: #ffab00;
  white-space: nowrap;
  flex-shrink: 0;
}

.route-card-metrics {
  display: flex;
  align-items: baseline;
  gap: 5px;
  flex-wrap: wrap;
}

.route-time {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
}

.dispatch-route-card.active .route-time {
  color: #00e5ff;
}

.route-dist {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.route-card-traffic {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 9.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.route-card-traffic span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-card-traffic .icon {
  font-size: 12px;
  color: #00e676;
  flex-shrink: 0;
}

.route-card-traffic.delayed .icon {
  color: #ffab00;
}

@media (max-width: 440px) {
  .dispatch-route-cards-list {
    flex-direction: column;
  }
}

/* On-Map Alternative Polylines & Callout Pill Markers */
.dispatch-route-polyline {
  filter: drop-shadow(0 0 8px rgba(0, 229, 255, 0.6));
  cursor: pointer;
}

.dispatch-alt-route-polyline {
  cursor: pointer;
  transition: all 0.2s ease;
}

.dispatch-alt-route-polyline:hover {
  stroke: #00e5ff !important;
  stroke-opacity: 0.9 !important;
  stroke-width: 6px !important;
}

.dispatch-route-pill-container {
  display: flex !important;
  align-items: center;
  justify-content: center;
  overflow: visible !important;
  background: transparent !important;
  border: none !important;
}

.dispatch-route-callout-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.65);
  pointer-events: auto;
  transition: all 0.15s ease;
  background: rgba(22, 27, 34, 0.95);
  color: #94a3b8;
  border: 1.5px solid #475569;
}

.dispatch-route-callout-pill:hover {
  transform: scale(1.08);
  border-color: #00e5ff;
  color: #fff;
}

.dispatch-route-callout-pill.active {
  background: rgba(10, 16, 28, 0.96);
  color: #00e5ff;
  border: 2px solid #00e5ff;
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.6);
  transform: scale(1.05);
}

.dispatch-route-callout-pill .pill-icon {
  font-size: 14px;
}

/* ---------------- MAPLIBRE GL HARDWARE-ACCELERATED MAP STYLES ---------------- */
.maplibregl-map {
  font-family: inherit;
}

.maplibregl-ctrl-top-right {
  top: 16px !important;
  right: 16px !important;
}

.maplibregl-ctrl-group {
  background: rgba(18, 22, 34, 0.9) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
}

.maplibregl-ctrl-group button {
  background-color: transparent !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  width: 34px !important;
  height: 34px !important;
}

.maplibregl-ctrl-group button:last-child {
  border-bottom: none !important;
}

.maplibregl-ctrl-group button span {
  filter: invert(1) brightness(1.8) !important;
}

.maplibregl-ctrl-group button:hover {
  background-color: rgba(255, 255, 255, 0.12) !important;
}

/* MapLibre Dark Popups */
.maplibregl-popup-content {
  background: rgba(16, 20, 30, 0.96) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
  color: var(--text-main, #f0f4f8) !important;
  border: 1px solid rgba(0, 229, 255, 0.45) !important;
  border-radius: 12px !important;
  padding: 12px 14px !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 20px rgba(0, 229, 255, 0.2) !important;
  font-family: inherit !important;
  font-size: 12px !important;
  line-height: 1.5 !important;
}

.maplibregl-popup-anchor-bottom .maplibregl-popup-tip {
  border-top-color: rgba(16, 20, 30, 0.96) !important;
}
.maplibregl-popup-anchor-top .maplibregl-popup-tip {
  border-bottom-color: rgba(16, 20, 30, 0.96) !important;
}
.maplibregl-popup-anchor-left .maplibregl-popup-tip {
  border-right-color: rgba(16, 20, 30, 0.96) !important;
}
.maplibregl-popup-anchor-right .maplibregl-popup-tip {
  border-left-color: rgba(16, 20, 30, 0.96) !important;
}

.maplibregl-popup-close-button {
  color: #94a3b8 !important;
  font-size: 16px !important;
  padding: 4px 8px !important;
  right: 2px !important;
  top: 2px !important;
}

.maplibregl-popup-close-button:hover {
  color: #fff !important;
  background: transparent !important;
}

.maplibre-vehicle-marker {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  will-change: transform;
}

#map.dispatch-mode-active,
#map.dispatch-mode-active canvas {
  cursor: crosshair !important;
}

/* 3D View Toggle Button & Badge */
.map-3d-badge {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.5px;
  font-family: inherit;
  color: inherit;
}

#map-3d-btn.active {
  background: rgba(0, 229, 255, 0.22) !important;
  color: #00e5ff !important;
  border-color: #00e5ff !important;
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.55) !important;
}

#map-3d-btn.active .map-3d-badge {
  color: #00e5ff !important;
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.7);
}

/* ---------------- CINEMATIC 3D CHASE CAMERA ---------------- */
#chase-cam-btn {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#chase-cam-btn.active {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.3), rgba(0, 150, 255, 0.4)) !important;
  color: #00e5ff !important;
  border-color: #00e5ff !important;
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.6) !important;
  animation: chase-pulse 2s infinite ease-in-out;
}

@keyframes chase-pulse {
  0% { box-shadow: 0 0 8px rgba(0, 229, 255, 0.4); }
  50% { box-shadow: 0 0 20px rgba(0, 229, 255, 0.85); }
  100% { box-shadow: 0 0 8px rgba(0, 229, 255, 0.4); }
}

/* Floating Chase Camera HUD Indicator */
.chase-cam-indicator {
  position: absolute;
  top: 18px;
  right: 80px;
  z-index: 1005;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(13, 17, 23, 0.88);
  border: 1px solid rgba(0, 229, 255, 0.5);
  border-radius: 20px;
  padding: 6px 14px;
  color: #00e5ff;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 4px 18px rgba(0, 229, 255, 0.35);
  backdrop-filter: blur(10px);
  animation: fadeInDown 0.3s ease;
}

.chase-cam-indicator .rec-dot {
  width: 9px;
  height: 9px;
  background: #ff1744;
  border-radius: 50%;
  box-shadow: 0 0 8px #ff1744;
  animation: rec-blink 1s infinite alternate;
}

@keyframes rec-blink {
  from { opacity: 0.3; }
  to { opacity: 1; }
}

/* ---------------- 3D ROUTE ELEVATION PROFILE & SLOPE HEATMAP HUD ---------------- */
.elevation-profile-hud {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: min(880px, calc(100% - 100px));
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(0, 229, 255, 0.35);
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 24px rgba(0, 229, 255, 0.15);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 998;
  padding: 12px 18px 14px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
}

.elevation-profile-hud.minimized {
  width: auto;
  min-width: 320px;
  padding: 8px 16px;
}

.elevation-profile-hud.minimized .elevation-hud-chart-container,
.elevation-profile-hud.minimized .elevation-hud-legend {
  display: none !important;
}

/* SMART COLLISION-AVOIDANCE: When Vehicle Detail Card is open, shift HUD cleanly to the right */
body:has(#detail-card:not([style*="display: none"])) .elevation-profile-hud,
body.detail-card-open .elevation-profile-hud {
  left: 444px !important;
  right: 84px !important;
  transform: none !important;
  width: auto !important;
  max-width: 860px !important;
}

body:has(#detail-card:not([style*="display: none"])) .elevation-profile-hud.minimized,
body.detail-card-open .elevation-profile-hud.minimized {
  width: auto !important;
  right: auto !important;
}

/* On smaller screens where 400px card + elevation HUD cannot fit side-by-side */
@media (max-width: 1049px) {
  body:has(#detail-card:not([style*="display: none"])) .elevation-profile-hud,
  body.detail-card-open .elevation-profile-hud {
    bottom: auto !important;
    top: 72px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    right: auto !important;
    width: min(720px, calc(100vw - 32px)) !important;
    z-index: 999;
  }
}

.elevation-hud-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.elevation-hud-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: 0.3px;
}

.elevation-hud-title .icon {
  color: #00e5ff;
  font-size: 20px;
}

.elevation-hud-stats {
  display: flex;
  align-items: center;
  gap: 8px;
}

.elev-stat-pill {
  font-size: 11px;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 9px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.elev-stat-pill strong {
  color: #00e5ff;
  font-weight: 700;
}

.elev-stat-pill strong.slope-pill {
  color: #ffd600;
}

.elevation-hud-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: #94a3b8;
}

.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 3px;
}

.legend-dot.green { background: #00e676; box-shadow: 0 0 6px rgba(0, 230, 118, 0.6); }
.legend-dot.yellow { background: #ffd600; box-shadow: 0 0 6px rgba(255, 214, 0, 0.6); }
.legend-dot.red { background: #ff1744; box-shadow: 0 0 6px rgba(255, 23, 68, 0.6); }

.elevation-hud-chart-container {
  position: relative;
  width: 100%;
  height: 115px;
  margin-top: 10px;
  overflow: visible;
}

.elevation-profile-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  cursor: crosshair;
}

.elevation-scrubber-tooltip {
  position: absolute;
  top: -38px;
  left: 0;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid #00e5ff;
  color: #f1f5f9;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5), 0 0 8px rgba(0, 229, 255, 0.4);
  z-index: 10;
}

/* ---------------- NATIONWIDE PHILIPPINE SIMULATOR ---------------- */
.sim-chip-btn {
  border-color: rgba(0, 229, 255, 0.4) !important;
  color: #00e5ff !important;
}

.sim-chip-btn:hover {
  background: rgba(0, 229, 255, 0.15) !important;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.4) !important;
}

.sim-chip-btn.running {
  background: rgba(0, 229, 255, 0.25) !important;
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.6) !important;
  border-color: #00e5ff !important;
  animation: pulse-sim-btn 2s infinite ease-in-out;
}

@keyframes pulse-sim-btn {
  0% { transform: scale(1); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

.sim-modal {
  max-width: 580px;
  width: 90%;
  background: var(--surface-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--neu-flat-lg), 0 0 28px rgba(0, 229, 255, 0.2);
  border: 1px solid rgba(0, 229, 255, 0.3);
}

.sim-speed-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.sim-speed-chips .mui-chip-btn {
  flex: 1;
  text-align: center;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  background: var(--surface-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
}

.sim-speed-chips .mui-chip-btn.active {
  background: linear-gradient(135deg, #00b0ff, #00e5ff);
  color: #0d1117;
  font-weight: 700;
  border-color: #00e5ff;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.5);
}

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

/* ---------------- INTERACTIVE VEHICLE PLACEMENT MODE ---------------- */
#map.placement-mode-active,
#map.placement-mode-active canvas {
  cursor: crosshair !important;
}

.placement-active-banner {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1001;
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(0, 229, 255, 0.55);
  border-radius: 16px;
  padding: 10px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 22px rgba(0, 229, 255, 0.28);
  animation: fadeInDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.placement-active-banner .icon {
  font-size: 26px;
  color: #00e5ff;
}

.placement-banner-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #00e5ff;
  box-shadow: 0 0 12px #00e5ff;
  animation: pulseDot 1.5s infinite;
}

.placement-banner-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.placement-banner-info .top-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.placement-banner-info strong {
  font-size: 13.5px;
  color: #f1f5f9;
  letter-spacing: 0.3px;
}

.placement-badge {
  background: rgba(0, 229, 255, 0.2);
  border: 1px solid rgba(0, 229, 255, 0.5);
  color: #00e5ff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.3px;
}

.placement-banner-info .bottom-row {
  font-size: 11.5px;
  color: #94a3b8;
}

#relocate-vehicle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

#relocate-vehicle-btn:hover {
  border-color: #00e5ff;
  color: #00e5ff;
}

/* Responsive adjustments for Top HUD Stack */
@media (max-width: 768px) {
  .map-top-hud-stack {
    top: 10px;
    max-width: calc(100vw - 20px);
    gap: 8px;
  }
  .active-mission-hud,
  .dispatch-preview-hud,
  .dispatch-active-banner,
  .placement-active-banner,
  .history-active-banner {
    padding: 8px 12px;
    gap: 10px;
    font-size: 12px;
  }
  .active-mission-hud .mission-hud-target,
  .dispatch-preview-hud .preview-hud-target {
    max-width: 140px;
  }
}

/* ---------------- 3D VEHICLE STUDIO & PAINT CUSTOMIZER ---------------- */
.vehicle-3d-card,
.mui-modal.vehicle-3d-card {
  max-width: 1060px;
  width: 95vw;
  max-height: 90vh;
  margin: auto;
  display: flex;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(0, 229, 255, 0.35);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(0, 229, 255, 0.2);
  border-radius: 20px;
  overflow: hidden;
  padding: 0;
}

.vehicle-3d-header {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.7);
}

.studio-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(0, 229, 255, 0.15);
  border: 1px solid rgba(0, 229, 255, 0.45);
  color: #00e5ff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: 0.8px;
  margin-bottom: 4px;
}

.studio-badge .material-symbols-outlined {
  font-size: 14px;
}

.vehicle-3d-header h2 {
  font-size: 18px;
  margin: 0;
  color: var(--text-main);
  font-weight: 700;
}

.vehicle-3d-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
}

.vehicle-3d-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 480px;
}

@media (max-width: 860px) {
  .vehicle-3d-body {
    flex-direction: column;
    overflow-y: auto;
  }
}

/* 3D Viewport on Left */
.vehicle-3d-viewport-wrap {
  flex: 1.35;
  position: relative;
  background: radial-gradient(circle at 50% 50%, #1e293b 0%, #0b1120 70%, #020617 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 380px;
  overflow: hidden;
}

.vehicle-3d-canvas-container {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

.vehicle-3d-canvas-container canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  outline: none;
}

/* Floating Viewport Controls */
.viewport-floating-controls {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  gap: 8px;
  z-index: 10;
  flex-wrap: wrap;
}

.viewport-ctrl-btn {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.viewport-ctrl-btn:hover {
  background: rgba(30, 41, 59, 0.95);
  color: #f1f5f9;
  border-color: rgba(0, 229, 255, 0.4);
}

.viewport-ctrl-btn.active {
  background: rgba(0, 229, 255, 0.18);
  border-color: #00e5ff;
  color: #00e5ff;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.25);
}

.viewport-ctrl-btn .material-symbols-outlined {
  font-size: 15px;
}

.viewport-hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 11px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  white-space: nowrap;
}

.viewport-hint .material-symbols-outlined {
  font-size: 14px;
  color: #00e5ff;
}

/* Controls Panel on Right */
.vehicle-3d-controls-panel {
  flex: 1;
  padding: 20px 24px;
  background: rgba(15, 23, 42, 0.92);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  max-height: calc(90vh - 70px);
}

.studio-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.studio-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #94a3b8;
}

.studio-section-title .material-symbols-outlined {
  font-size: 16px;
  color: #00e5ff;
}

/* Chassis Chips */
.chassis-switch-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.chassis-chip {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 8px 12px;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chassis-chip:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(0, 229, 255, 0.4);
  color: #f1f5f9;
}

.chassis-chip.active {
  background: rgba(0, 229, 255, 0.15);
  border-color: #00e5ff;
  color: #00e5ff;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.2);
}

.chassis-chip .material-symbols-outlined {
  font-size: 18px;
}

/* Swatches Grid */
.paint-swatches-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.paint-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  position: relative;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  padding: 0;
  outline: none;
}

.paint-swatch:hover {
  transform: translateY(-2px) scale(1.06);
  border-color: #ffffff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.paint-swatch.active {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px #00e5ff, 0 0 16px rgba(0, 229, 255, 0.5);
  transform: scale(1.08);
}

.paint-swatch.active::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* Custom Color Input */
.custom-color-picker-row {
  display: flex;
  align-items: center;
  margin-top: 4px;
}

.custom-color-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 14px;
  border-radius: 10px;
  width: 100%;
  transition: border-color 0.2s;
}

.custom-color-label:hover {
  border-color: rgba(0, 229, 255, 0.4);
}

.custom-color-label input[type="color"] {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.color-hex-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  color: #00e5ff;
}

.color-picker-hint {
  font-size: 11px;
  color: #94a3b8;
  margin-left: auto;
}

/* Paint Finish Chips */
.paint-finish-options {
  display: flex;
  gap: 8px;
}

.finish-chip {
  flex: 1;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px 10px;
  color: #cbd5e1;
  font-size: 11.5px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.finish-chip:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(0, 229, 255, 0.4);
  color: #f1f5f9;
}

.finish-chip.active {
  background: rgba(0, 229, 255, 0.15);
  border-color: #00e5ff;
  color: #00e5ff;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
}

.finish-chip .material-symbols-outlined {
  font-size: 18px;
}

/* Telemetry Specs Grid */
.studio-specs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  background: rgba(2, 6, 23, 0.5);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

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

.spec-label {
  font-size: 10.5px;
  color: #64748b;
  text-transform: uppercase;
  font-weight: 600;
}

.spec-val {
  font-size: 12.5px;
  color: #e2e8f0;
  font-weight: 700;
}

/* Footer Actions */
.studio-footer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ==================== HARDWARE ENROLLMENT & VERIFICATION MODAL ==================== */
.enrollment-modal {
  max-width: 520px !important;
  border-radius: 16px;
  background: linear-gradient(180deg, #131b2e 0%, #0d121f 100%) !important;
  border: 1px solid rgba(0, 229, 255, 0.25) !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(0, 229, 255, 0.15) !important;
}

.modal-header-titles {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-subtitle {
  font-size: 12px;
  color: #94a3b8;
  margin: 0;
}

.enrollment-step-card {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
  transition: all 0.3s ease;
}

.enrollment-step-card.disabled {
  opacity: 0.45;
  pointer-events: none;
  filter: grayscale(0.5);
}

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

.step-num {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  background: rgba(0, 229, 255, 0.15);
  color: #00e5ff;
  border: 1px solid rgba(0, 229, 255, 0.3);
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.5px;
}

.step-title {
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
}

.input-with-action {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.input-prefix-icon {
  position: absolute;
  left: 12px;
  color: #64748b;
  font-size: 20px;
  pointer-events: none;
}

.input-with-action input {
  padding-left: 40px !important;
  flex: 1;
}

.verify-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  background: rgba(0, 229, 255, 0.12) !important;
  border: 1px solid rgba(0, 229, 255, 0.35) !important;
  color: #00e5ff !important;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.verify-action-btn:hover {
  background: rgba(0, 229, 255, 0.22) !important;
  border-color: #00e5ff !important;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.3);
}

.verify-action-btn.loading {
  opacity: 0.7;
  pointer-events: none;
}

/* Verification Feedback Box */
.verify-feedback-box {
  margin-top: 12px;
  padding: 12px;
  border-radius: 10px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.3s ease;
}

.verify-feedback-box.status-info {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #cbd5e1;
}

.verify-feedback-box.status-loading {
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.3);
  color: #00e5ff;
}

.verify-feedback-box.status-success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #10b981;
}

.verify-feedback-box.status-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

.verify-feedback-box.status-warning {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #f59e0b;
}

.verify-feedback-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 12.5px;
}

.feedback-desc {
  font-size: 11.5px;
  line-height: 1.4;
  color: inherit;
  opacity: 0.95;
}

.feedback-telemetry-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.telemetry-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
}

.telemetry-chip .material-symbols-outlined {
  font-size: 14px;
  color: #00e5ff;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Unclaimed Hardware Tracker Alert Banner */
.unclaimed-alert-banner {
  margin: 10px 12px 6px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(255, 171, 0, 0.16), rgba(255, 109, 0, 0.08));
  border: 1px solid rgba(255, 171, 0, 0.45);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(255, 171, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  animation: pulse-glow-amber 2.5s infinite ease-in-out;
  cursor: pointer;
  transition: all 0.25s ease;
}

.unclaimed-alert-banner:hover {
  background: linear-gradient(135deg, rgba(255, 171, 0, 0.22), rgba(255, 109, 0, 0.14));
  transform: translateY(-1px);
}

@keyframes pulse-glow-amber {
  0%, 100% { box-shadow: 0 4px 16px rgba(255, 171, 0, 0.12); border-color: rgba(255, 171, 0, 0.45); }
  50% { box-shadow: 0 4px 24px rgba(255, 171, 0, 0.28); border-color: rgba(255, 171, 0, 0.8); }
}

.unclaimed-alert-content {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.unclaimed-pulse-icon {
  font-size: 22px;
  color: #ffab00;
  flex-shrink: 0;
}

.unclaimed-alert-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.unclaimed-alert-text strong {
  font-size: 12px;
  color: #ffab00;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unclaimed-alert-text span {
  font-size: 11px;
  color: var(--text-secondary, #94a3b8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unclaimed-claim-btn {
  background: #ffab00;
  color: #0f172a;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.unclaimed-claim-btn:hover {
  background: #ffd600;
  transform: translateY(-1px);
}

/* Security Authorization PIN Modal & Animations */
.security-pin-modal {
  animation: modalScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes inputShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.input-shake {
  animation: inputShake 0.45s ease-in-out !important;
  border-color: #ff1744 !important;
  box-shadow: 0 0 12px rgba(255, 23, 68, 0.5) !important;
}

/* ==================== OTA CELLULAR FIRMWARE MANAGEMENT ==================== */

.ota-modal {
  animation: modalScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.ota-section-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-m, 12px);
  padding: 14px 16px;
  transition: all 0.2s ease;
}

.ota-section-card:hover {
  border-color: rgba(0, 229, 255, 0.25);
  background: rgba(255, 255, 255, 0.035);
}

.ota-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #00e5ff;
}

.ota-current-status-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 42px;
}

.ota-dropzone {
  margin-top: 10px;
  border: 2px dashed rgba(0, 229, 255, 0.3);
  background: rgba(0, 229, 255, 0.02);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ota-dropzone:hover, .ota-dropzone.dragover {
  border-color: #00e5ff;
  background: rgba(0, 229, 255, 0.08);
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.15);
}

.ota-dropzone .text {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  color: var(--text-main);
}

.ota-dropzone .text .sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.ota-safeguard-box {
  background: rgba(0, 230, 118, 0.05);
  border: 1px solid rgba(0, 230, 118, 0.25);
  border-radius: 10px;
  padding: 12px 14px;
}

/* OTA Status Chips */
.ota-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.ota-status-chip.idle {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary, #94a3b8);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.ota-status-chip.downloading,
.ota-status-chip.in-flight {
  background: rgba(0, 229, 255, 0.15);
  color: #00e5ff;
  border: 1px solid rgba(0, 229, 255, 0.6);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.25);
  animation: pulseGlow 1.8s infinite ease-in-out;
}

.ota-status-chip.rebooting {
  background: rgba(255, 171, 0, 0.15);
  color: #ffab00;
  border: 1px solid rgba(255, 171, 0, 0.6);
  box-shadow: 0 0 10px rgba(255, 171, 0, 0.25);
  animation: pulseGlow 1.8s infinite ease-in-out;
}

.ota-status-chip.success {
  background: rgba(0, 230, 118, 0.15);
  color: #00e676;
  border: 1px solid rgba(0, 230, 118, 0.5);
}

.ota-status-chip.failed {
  background: rgba(255, 23, 68, 0.15);
  color: #ff1744;
  border: 1px solid rgba(255, 23, 68, 0.5);
}

@keyframes pulseGlow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.03); }
}

.modal-subtitle {
  font-size: 12px;
  color: #94a3b8;
  margin: 0;
}

.enrollment-step-card {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
  transition: all 0.3s ease;
}

.enrollment-step-card.disabled {
  opacity: 0.45;
  pointer-events: none;
  filter: grayscale(0.5);
}

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

.step-num {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  background: rgba(0, 229, 255, 0.15);
  color: #00e5ff;
  border: 1px solid rgba(0, 229, 255, 0.3);
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.5px;
}

.step-title {
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
}

.input-with-action {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.input-prefix-icon {
  position: absolute;
  left: 12px;
  color: #64748b;
  font-size: 20px;
  pointer-events: none;
}

.input-with-action input {
  padding-left: 40px !important;
  flex: 1;
}

.verify-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  background: rgba(0, 229, 255, 0.12) !important;
  border: 1px solid rgba(0, 229, 255, 0.35) !important;
  color: #00e5ff !important;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.verify-action-btn:hover {
  background: rgba(0, 229, 255, 0.22) !important;
  border-color: #00e5ff !important;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.3);
}

.verify-action-btn.loading {
  opacity: 0.7;
  pointer-events: none;
}

/* Verification Feedback Box */
.verify-feedback-box {
  margin-top: 12px;
  padding: 12px;
  border-radius: 10px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.3s ease;
}

.verify-feedback-box.status-info {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #cbd5e1;
}

.verify-feedback-box.status-loading {
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.3);
  color: #00e5ff;
}

.verify-feedback-box.status-success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #10b981;
}

.verify-feedback-box.status-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

.verify-feedback-box.status-warning {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #f59e0b;
}

.verify-feedback-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 12.5px;
}

.feedback-desc {
  font-size: 11.5px;
  line-height: 1.4;
  color: inherit;
  opacity: 0.95;
}

.feedback-telemetry-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.telemetry-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
}

.telemetry-chip .material-symbols-outlined {
  font-size: 14px;
  color: #00e5ff;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Unclaimed Hardware Tracker Alert Banner */
.unclaimed-alert-banner {
  margin: 10px 12px 6px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(255, 171, 0, 0.16), rgba(255, 109, 0, 0.08));
  border: 1px solid rgba(255, 171, 0, 0.45);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(255, 171, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  animation: pulse-glow-amber 2.5s infinite ease-in-out;
  cursor: pointer;
  transition: all 0.25s ease;
}

.unclaimed-alert-banner:hover {
  background: linear-gradient(135deg, rgba(255, 171, 0, 0.22), rgba(255, 109, 0, 0.14));
  transform: translateY(-1px);
}

@keyframes pulse-glow-amber {
  0%, 100% { box-shadow: 0 4px 16px rgba(255, 171, 0, 0.12); border-color: rgba(255, 171, 0, 0.45); }
  50% { box-shadow: 0 4px 24px rgba(255, 171, 0, 0.28); border-color: rgba(255, 171, 0, 0.8); }
}

.unclaimed-alert-content {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.unclaimed-pulse-icon {
  font-size: 22px;
  color: #ffab00;
  flex-shrink: 0;
}

.unclaimed-alert-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.unclaimed-alert-text strong {
  font-size: 12px;
  color: #ffab00;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unclaimed-alert-text span {
  font-size: 11px;
  color: var(--text-secondary, #94a3b8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unclaimed-claim-btn {
  background: #ffab00;
  color: #0f172a;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.unclaimed-claim-btn:hover {
  background: #ffd600;
  transform: translateY(-1px);
}

/* Security Authorization PIN Modal & Animations */
.security-pin-modal {
  animation: modalScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes inputShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.input-shake {
  animation: inputShake 0.45s ease-in-out !important;
  border-color: #ff1744 !important;
  box-shadow: 0 0 12px rgba(255, 23, 68, 0.5) !important;
}
