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

html, body {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

input, textarea, select {
  -webkit-user-select: auto;
  user-select: auto;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

#app {
  display: flex;
  height: 100vh;
  width: 100vw;
  position: relative;
}

/* Sidebar */
#sidebar {
  width: 340px;
  background: #1e293b;
  border-right: 1px solid #334155;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  z-index: 1000;
  position: relative;
  height: 100%;
}

#sidebar.closed {
  transform: translateX(-100%);
  position: absolute;
}

#sidebar.open {
  transform: translateX(0);
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid #334155;
  background: #0f172a;
}

.sidebar-header h1 {
  font-size: 1.4rem;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 10px;
}

.subtitle {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 4px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 15px;
}

.stat-card {
  background: #0f172a;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  border: 1px solid #334155;
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: #f8fafc;
}

.stat-card.online .stat-value { color: #22c55e; }
.stat-card.moving .stat-value { color: #9333ea; }
.stat-card.realenti .stat-value { color: #facc15; }
.stat-card.stopped .stat-value { color: #f59e0b; }

.stat-label {
  font-size: 0.75rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.platform-filters {
  display: flex;
  gap: 8px;
  padding: 0 15px 10px;
}

.filter-btn {
  flex: 1;
  background: #334155;
  border: none;
  color: #cbd5e1;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.filter-btn:hover { background: #475569; }
.filter-btn.active { background: #0ea5e9; color: #fff; }

.vehicle-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 15px 15px;
}

.vehicle-list::-webkit-scrollbar { width: 6px; }
.vehicle-list::-webkit-scrollbar-track { background: transparent; }
.vehicle-list::-webkit-scrollbar-thumb { background: #475569; border-radius: 3px; }

.vehicle-item {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 10px;
}

.vehicle-item:hover { border-color: #0ea5e9; background: #1e293b; }
.vehicle-item.active { border-color: #0ea5e9; background: #1e293b; }
.vehicle-item.hidden { display: none; }

.vehicle-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.vehicle-icon.tadeo { background: #3b82f620; color: #3b82f6; border: 2px solid #3b82f6; }
.vehicle-icon.detektor { background: #f59e0b20; color: #f59e0b; border: 2px solid #f59e0b; }

.vehicle-info {
  flex: 1;
  min-width: 0;
}

.vehicle-placa {
  font-weight: 600;
  font-size: 0.95rem;
  color: #f8fafc;
}

.vehicle-meta {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 2px;
  display: flex;
  gap: 8px;
}

.vehicle-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  align-self: center;
}

.vehicle-status.online { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.vehicle-status.offline { background: #ef4444; }
.vehicle-status.moving { background: #9333ea; box-shadow: 0 0 6px #9333ea; animation: pulse 1.5s infinite; }
.vehicle-status.realenti { background: #facc15; box-shadow: 0 0 6px #facc15; animation: blink-yellow 0.8s infinite; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(59, 130, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

@keyframes blink-red {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@keyframes blink-yellow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.8); border-color: #facc15; }
  50% { box-shadow: 0 0 8px 2px rgba(250, 204, 21, 0.3); border-color: #fde047; }
}

.marker-blink-red {
  animation: blink-red 0.6s infinite;
}

.loading {
  text-align: center;
  padding: 20px;
  color: #64748b;
}

.sidebar-footer {
  padding: 12px 15px;
  border-top: 1px solid #334155;
  background: #0f172a;
  font-size: 0.75rem;
  color: #64748b;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.connection-status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
}

.connection-status.connected .dot { background: #22c55e; }
.connection-status.error .dot { background: #ef4444; }

/* Map */
#map {
  flex: 1;
  position: relative;
  z-index: 1;
}

/* Toggle */
.sidebar-toggle {
  position: absolute;
  top: 15px;
  left: 15px;
  z-index: 1100;
  background: #1e293b;
  border: 1px solid #334155;
  color: #e2e8f0;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

/* Search Bar */
.search-bar {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 420px;
  z-index: 1100;
  display: flex;
  align-items: center;
}

.search-bar i {
  position: absolute;
  left: 12px;
  color: #64748b;
  z-index: 1;
}

.search-bar input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #1e293be6;
  backdrop-filter: blur(4px);
  color: #e2e8f0;
  font-size: 0.9rem;
}

.search-bar input:focus {
  outline: none;
  border-color: #0ea5e9;
}

/* Legend / Status Filters */
.map-legend {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  background: #1e293be6;
  backdrop-filter: blur(4px);
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.8rem;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  max-width: 95vw;
  overflow-x: auto;
  flex-wrap: nowrap;
}

.map-legend::-webkit-scrollbar { height: 4px; }
.map-legend::-webkit-scrollbar-track { background: transparent; }
.map-legend::-webkit-scrollbar-thumb { background: #475569; border-radius: 2px; }

.speed-limit-box {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #cbd5e1;
  font-size: 0.8rem;
  white-space: nowrap;
  border-right: 1px solid #475569;
  padding-right: 10px;
  margin-right: 2px;
  flex-shrink: 0;
}

.speed-limit-box input {
  width: 50px;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid #475569;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 0.8rem;
  text-align: center;
}

.speed-limit-box input:focus {
  outline: none;
  border-color: #0ea5e9;
}

.filter-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid #475569;
  color: #cbd5e1;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-chip:hover { border-color: #94a3b8; }
.filter-chip.active {
  background: #0ea5e9;
  border-color: #0ea5e9;
  color: #fff;
}

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

.legend-dot.speed-high { background: #ef4444; }
.legend-dot.moving { background: #9333ea; }
.legend-dot.realenti { background: #facc15; animation: blink-yellow 0.8s infinite; }
.legend-dot.online { background: #3b82f6; }
.legend-dot.offline { background: #6b7280; }

/* Toast */
.toast {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1200;
  background: #1e293b;
  border: 1px solid #334155;
  border-left: 4px solid #0ea5e9;
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 0.9rem;
  max-width: 320px;
  transform: translateX(400px);
  transition: transform 0.3s ease;
  pointer-events: none;
}

.toast.show { transform: translateX(0); }

/* ========================
   Popups (Google Maps + Leaflet)
   ======================== */

.popup-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #38bdf8;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.popup-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid #334155;
  min-width: 240px;
}

.popup-row:last-child { border-bottom: none; }

.popup-label { color: #94a3b8; font-size: 0.8rem; }
.popup-value { font-weight: 600; }

.platform-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.platform-badge.tadeo { background: #3b82f620; color: #3b82f6; }
.platform-badge.detektor { background: #f59e0b20; color: #f59e0b; }

/* Google Maps InfoWindow custom */
.gm-style .gm-style-iw-c {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  border-radius: 10px !important;
  border: 1px solid #334155 !important;
  padding: 0 !important;
}

.gm-style .gm-style-iw-d {
  overflow: auto !important;
  padding: 12px 16px !important;
  font-size: 0.9rem !important;
  line-height: 1.5 !important;
}

.gm-style .gm-style-iw-t::after {
  background: #1e293b !important;
  border: 1px solid #334155 !important;
}

/* Leaflet custom */
.leaflet-popup-content-wrapper {
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 10px;
  border: 1px solid #334155;
}

.leaflet-popup-tip {
  background: #1e293b;
  border: 1px solid #334155;
}

.leaflet-popup-content {
  margin: 12px 16px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.vehicle-marker-icon {
  background: transparent !important;
  border: none !important;
}

/* Google Maps Marker Labels */
.vehicle-label {
  background: rgba(15, 23, 42, 0.9) !important;
  padding: 2px 8px !important;
  border-radius: 4px !important;
  border: 1px solid rgba(255,255,255,0.2) !important;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8) !important;
  white-space: nowrap !important;
}

/* Right Panel */
#right-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 280px;
  height: 100%;
  background: #1e293be6;
  backdrop-filter: blur(6px);
  border-left: 1px solid #334155;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  z-index: 1000;
}

#right-panel.hidden {
  transform: translateX(100%);
}

#right-panel.visible {
  transform: translateX(0);
}

.right-panel-header {
  padding: 16px;
  border-bottom: 1px solid #334155;
  background: #0f172a;
  font-weight: 600;
  font-size: 0.95rem;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.right-panel-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.right-panel-list::-webkit-scrollbar { width: 5px; }
.right-panel-list::-webkit-scrollbar-track { background: transparent; }
.right-panel-list::-webkit-scrollbar-thumb { background: #475569; border-radius: 3px; }

.rp-item {
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0f172a;
  border: 1px solid #334155;
  transition: all 0.15s;
}

.rp-item:hover {
  background: #1e293b;
  border-color: #0ea5e9;
}

.rp-item.good {
  color: #22c55e;
}

.rp-item.over-limit {
  color: #ef4444;
  font-weight: 700;
  border-color: #ef4444;
  background: #ef444410;
}

.rp-item.realenti {
  color: #facc15;
  font-weight: 700;
  border-color: #facc15;
  background: #facc1520;
  position: relative;
  overflow: hidden;
}

.rp-item.realenti::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: 2px solid #facc15;
  border-radius: 6px;
  animation: blink-border 1s infinite;
  pointer-events: none;
}

@keyframes blink-border {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.rp-placa {
  font-weight: 600;
}

.rp-speed {
  font-size: 0.8rem;
  opacity: 0.9;
}

/* ========================
   RESPONSIVE
   ======================== */
@media (max-width: 1024px) {
  #sidebar {
    position: absolute;
    height: 100%;
    z-index: 1000;
  }
  #right-panel {
    width: 260px;
    z-index: 1000;
  }
}

@media (max-width: 768px) {
  #sidebar {
    width: 85vw;
    max-width: 320px;
  }
  #right-panel {
    width: 85vw;
    max-width: 320px;
    z-index: 1200;
  }
  .sidebar-toggle {
    top: 10px;
    left: 10px;
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
  .search-bar {
    top: 10px;
    left: 52px;
    right: 10px;
    transform: none;
    width: auto;
    max-width: none;
  }
  .search-bar input {
    padding: 8px 10px 8px 32px;
    font-size: 0.85rem;
  }
  .search-bar i {
    left: 10px;
    font-size: 0.8rem;
  }
  .map-legend {
    bottom: 10px;
    padding: 6px 8px;
    gap: 6px;
    max-width: 98vw;
  }
  .speed-limit-box {
    padding-right: 8px;
    font-size: 0.75rem;
  }
  .speed-limit-box input {
    width: 40px;
    padding: 3px 4px;
    font-size: 0.75rem;
  }
  .filter-chip {
    padding: 5px 10px;
    font-size: 0.75rem;
  }
  .stats-grid {
    padding: 10px;
    gap: 8px;
  }
  .stat-value {
    font-size: 1.3rem;
  }
  .leaflet-popup-content-wrapper {
    max-width: 260px;
  }
}

@media (max-width: 380px) {
  #sidebar {
    width: 90vw;
  }
  #right-panel {
    width: 90vw;
  }
  .search-bar {
    left: 48px;
  }
  .map-legend {
    gap: 4px;
    padding: 5px 6px;
  }
  .filter-chip {
    padding: 4px 8px;
    font-size: 0.7rem;
  }
  .legend-dot {
    width: 8px;
    height: 8px;
  }
}

/* Animaciones de parpadeo para marcadores */
.vehicle-marker-blink {
  animation: marker-blink 0.6s infinite;
}

@keyframes marker-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Fix para click/active azul */
button, .vehicle-item, .rp-item, .filter-chip, .filter-btn, .sidebar-toggle {
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

button:focus, .vehicle-item:focus, .rp-item:focus, .filter-chip:focus, .filter-btn:focus, .sidebar-toggle:focus {
  outline: none;
  box-shadow: none;
}

button:active, .vehicle-item:active, .rp-item:active, .filter-chip:active, .filter-btn:active, .sidebar-toggle:active {
  background-color: transparent;
  -webkit-tap-highlight-color: transparent;
}

.vehicle-item, .rp-item, .filter-chip, .filter-btn, .sidebar-toggle {
  -webkit-user-select: none;
  user-select: none;
}

/* ========================
   PANEL GEOCERCAS
   ======================== */

.geo-panel-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
}
.geo-panel-overlay.active {
  display: flex;
}

.geo-panel-overlay.geo-save-overlay {
  align-items: flex-end;
  justify-content: flex-end;
  padding: 20px;
  background: rgba(0,0,0,0.25);
  pointer-events: none;
}

.geo-panel-overlay.geo-save-overlay .geo-panel {
  pointer-events: auto;
  margin: 0 0 0 auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
}

.geo-panel {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  width: 420px;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
}

.geo-panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid #334155;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0f172a;
}

.geo-panel-header h2 {
  font-size: 1.1rem;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 8px;
}

.geo-panel-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
}
.geo-panel-close:hover { color: #fff; }

.geo-panel-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}

.geo-form-group {
  margin-bottom: 12px;
}
.geo-form-group label {
  display: block;
  font-size: 0.8rem;
  color: #94a3b8;
  margin-bottom: 4px;
}
.geo-form-group input,
.geo-form-group select {
  width: 100%;
  padding: 8px 10px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #e2e8f0;
  font-size: 0.9rem;
}
.geo-form-group input:focus,
.geo-form-group select:focus {
  outline: none;
  border-color: #0ea5e9;
}

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

.geo-vertex-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #334155;
  border-radius: 6px;
  background: #0f172a;
}
.geo-vertex-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid #1e293b;
  font-size: 0.8rem;
}
.geo-vertex-item:last-child {
  border-bottom: none;
}
.geo-vertex-item span {
  color: #64748b;
  min-width: 20px;
}
.geo-vertex-item input {
  flex: 1;
  padding: 4px 6px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 4px;
  color: #e2e8f0;
  font-size: 0.75rem;
  width: auto;
}
.geo-vertex-item input:focus {
  outline: none;
  border-color: #0ea5e9;
}
.geo-vertex-item button {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  padding: 2px 4px;
  font-size: 0.8rem;
}
.geo-vertex-item button:hover {
  color: #dc2626;
}

.geo-vertex-marker {
  cursor: move !important;
}

.geo-btn {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.geo-btn-primary {
  background: #0ea5e9;
  color: #fff;
}
.geo-btn-primary:hover { background: #0284c7; }
.geo-btn-danger {
  background: #ef4444;
  color: #fff;
}
.geo-btn-danger:hover { background: #dc2626; }
.geo-btn-secondary {
  background: #334155;
  color: #e2e8f0;
}
.geo-btn-secondary:hover { background: #475569; }
.geo-btn-success {
  background: #22c55e;
  color: #fff;
}
.geo-btn-success:hover { background: #16a34a; }

.geo-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.geo-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.geo-item {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.2s;
  position: relative;
}
.geo-item:hover {
  border-color: #0ea5e9;
}
.geo-item.active {
  border-color: #38bdf8;
  background: #0c2e4a;
}
.geo-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.geo-item-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: #f8fafc;
}
.geo-item-meta {
  font-size: 0.75rem;
  color: #94a3b8;
  display: flex;
  gap: 10px;
}
.geo-item-actions {
  display: flex;
  gap: 6px;
}
.geo-item-actions button {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 2px 6px;
}
.geo-item-actions button:hover { color: #fff; }

.geo-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}
.geo-badge-inicio { background: #22c55e; color: #fff; }
.geo-badge-fin { background: #f59e0b; color: #fff; }
.geo-badge-circular { background: #3b82f6; color: #fff; }
.geo-badge-poligono { background: #9333ea; color: #fff; }

.geo-draw-hint {
  background: #0c2e4a;
  border: 1px solid #0ea5e9;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  color: #38bdf8;
  display: none;
}
.geo-draw-hint.active { display: block; }

/* Menu contextual del mapa */
.map-context-menu {
  position: fixed;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 6px 0;
  min-width: 220px;
  z-index: 5000;
  display: none;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  overflow: hidden;
}
.map-context-menu.active {
  display: block;
}
.ctx-item {
  padding: 10px 16px;
  color: #e2e8f0;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.15s;
}
.ctx-item:hover {
  background: #0c2e4a;
  color: #38bdf8;
}
.ctx-item.disabled {
  color: #64748b;
  cursor: not-allowed;
}
.ctx-item.disabled:hover {
  background: transparent;
}
.ctx-separator {
  height: 1px;
  background: #334155;
  margin: 6px 0;
}

/* Tabs */
.geo-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid #334155;
}
.geo-tab {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.85rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.geo-tab.active {
  color: #38bdf8;
  border-bottom-color: #38bdf8;
}
.geo-tab-content {
  display: none;
}
.geo-tab-content.active {
  display: block;
}

/* Selector de geocerca en proyectos */
.proj-assign-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}
.proj-assign-row .geo-form-group label {
  font-size: 0.7rem;
}
.proj-assign-row select {
  width: 100%;
  padding: 6px 8px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 4px;
  color: #e2e8f0;
  font-size: 0.8rem;
}

/* Boton flotante geocercas */
.geo-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #0ea5e9;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}
.geo-fab:hover { background: #0284c7; }

.dashboard-fab {
  bottom: 80px;
  background: #10b981;
}
.dashboard-fab:hover { background: #059669; }

@media (max-width: 768px) {
  .geo-panel { width: 95vw; }
  .geo-fab { bottom: 70px; right: 10px; width: 44px; height: 44px; }
  .dashboard-fab { bottom: 120px; right: 10px; width: 44px; height: 44px; }
  .geo-panel-overlay.geo-save-overlay {
    padding: 10px;
  }
  .geo-panel-overlay.geo-save-overlay .geo-panel {
    width: 100% !important;
    max-width: 100%;
  }
}

.geo-tooltip,
.leaflet-tooltip.geo-tooltip {
  background: #0f172a !important;
  border: 1px solid #334155 !important;
  color: #e2e8f0 !important;
  border-radius: 6px !important;
  padding: 4px 8px !important;
  font-size: 0.85rem !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5) !important;
  z-index: 4000 !important;
}
.geo-tooltip:before,
.leaflet-tooltip-left.geo-tooltip:before,
.leaflet-tooltip-right.geo-tooltip:before {
  border-left-color: #334155 !important;
  border-right-color: #334155 !important;
}
.leaflet-tooltip-top.geo-tooltip:before {
  border-top-color: #334155 !important;
}
.leaflet-tooltip-bottom.geo-tooltip:before {
  border-bottom-color: #334155 !important;
}

/* Viajes Programados */
.viajes-progress-bar {
  background: rgba(30,41,59,0.8);
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}

.viajes-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.viajes-progress-fill.complete { background: #10b981; }
.viajes-progress-fill.partial { background: #f59e0b; }
.viajes-progress-fill.started { background: #3b82f6; }

.viajes-resumen-card {
  background: rgba(15,23,42,0.5);
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid rgba(148,163,184,0.1);
}

.viajes-resumen-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.viajes-resumen-title {
  font-weight: 600;
  color: #e2e8f0;
  font-size: 0.85rem;
}

.viajes-resumen-count {
  font-size: 0.75rem;
  color: #94a3b8;
}

.viajes-resumen-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 0.7rem;
  color: #94a3b8;
}
