/* =========================================================================
   mec.css - Estilos Oficiales para MEC (Monitoreos en Carretera) - RegSin 3
   Layout Maestro:
    1. Ribbon Superior Comprimido y Fijo (Buscador + Ejemplos rápidos + Stats)
    2. Ribbon Secundario Comprimido y Fijo (Info Colaborador + Vehículos con Marbetes en la misma fila)
    3. Split 30% Izquierdo (Secciones y Controles) / 70% Derecho (Detalles y Visualizador)
   ========================================================================= */

:root {
  --mec-wine-dark: #190208;
  --mec-wine-base: #330511;
  --mec-wine-ruby: #881337;
  --mec-wine-accent: #be123c;
  --mec-gold-accent: #b45309;
  --mec-gold-bg: #fef3c7;
  --mec-green-status: #10b981;
  --mec-amber-status: #f59e0b;
  --mec-red-status: #ef4444;
  --mec-blue-status: #0284c7;
}

/* Contenedor Raíz de MEC (Ocupa todo el alto visible de la vista sin desbordamiento global) */
.mec-root-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: #f1f5f9;
  color: #0f172a;
  box-sizing: border-box;
}

/* =========================================================================
   1. ENCABEZADO SUPERIOR TIPO RIBBON COMPRIMIDO Y FIJO ARRIBA
   ========================================================================= */
.mec-ribbon-top {
  position: sticky;
  top: 0;
  z-index: 60;
  height: 44px;
  min-height: 44px;
  max-height: 44px;
  background: linear-gradient(180deg, #3d0715 0%, #24030b 100%);
  border-bottom: 1px solid #52091c;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.85rem;
  gap: 0.75rem;
  color: #ffffff;
  flex-shrink: 0;
  overflow-x: auto;
}

.mec-ribbon-top::-webkit-scrollbar { height: 3px; }
.mec-ribbon-top::-webkit-scrollbar-thumb { background: #881337; border-radius: 4px; }

.mec-ribbon-brand {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.mec-ribbon-badge {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.45rem;
  border-radius: 5px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.mec-ribbon-title {
  font-size: 0.82rem;
  font-weight: 800;
  color: #fff1f2;
  white-space: nowrap;
}

/* Buscador Comprimido dentro del Ribbon */
.mec-ribbon-search {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.mec-ribbon-search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.mec-ribbon-search-icon {
  position: absolute;
  left: 0.55rem;
  color: #94a3b8;
  pointer-events: none;
}

.mec-ribbon-search-input {
  width: 220px;
  height: 28px;
  padding: 0 1.6rem 0 2rem;
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 600;
  color: #0f172a;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  outline: none;
  transition: all 0.2s ease;
}

.mec-ribbon-search-input:focus {
  width: 250px;
  border-color: #f43f5e;
  box-shadow: 0 0 0 2px rgba(244, 63, 94, 0.25);
}

.mec-ribbon-search-clear {
  position: absolute;
  right: 0.4rem;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mec-ribbon-search-clear:hover { color: #0f172a; }

.mec-ribbon-btn-search {
  height: 28px;
  padding: 0 0.65rem;
  background: linear-gradient(180deg, #be123c 0%, #9f1239 100%);
  color: #ffffff;
  border: 1px solid #881337;
  border-radius: 6px;
  font-family: var(--font-main);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.mec-ribbon-btn-search:hover {
  background: linear-gradient(180deg, #e11d48 0%, #be123c 100%);
}

/* Pastillas de Ejemplos Rápidos Comprimidas */
.mec-ribbon-chips {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  overflow-x: auto;
}

.mec-ribbon-chip {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  color: #fed7aa;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.mec-ribbon-chip:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: #fda4af;
  color: #ffffff;
  transform: translateY(-1px);
}

/* Stats Rápidos a la derecha del Ribbon Superior */
.mec-ribbon-tools {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: auto;
  flex-shrink: 0;
}

.mec-ribbon-stat-pill {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.mec-ribbon-stat-pill:hover {
  background: rgba(255, 255, 255, 0.15);
}

.mec-ribbon-stat-pill.active {
  background: #be123c;
  border-color: #fda4af;
}

.mec-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
  animation: mecPulse 1.8s infinite;
}

@keyframes mecPulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

/* =========================================================================
   2. RIBBON SECUNDARIO COMPRIMIDO Y FIJO (INFORMACIÓN DEL SOCIO Y VEHÍCULOS EN LA MISMA FILA)
   ========================================================================= */
.mec-ribbon-secondary {
  position: sticky;
  top: 44px;
  z-index: 50;
  height: 52px;
  min-height: 52px;
  max-height: 52px;
  background: #ffffff;
  border-bottom: 1.5px solid #cbd5e1;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.85rem;
  gap: 1rem;
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.mec-ribbon-secondary::-webkit-scrollbar { height: 3px; }
.mec-ribbon-secondary::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* 2.1 Elemento Izquierdo de la misma fila: Información del Socio */
.mec-sec-colab-zone {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 320px;
  max-width: 480px;
  flex-shrink: 0;
  border-right: 1.5px dashed #cbd5e1;
  padding-right: 0.85rem;
}

.mec-sec-avatar {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: linear-gradient(135deg, #3d0715 0%, #881337 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.mec-sec-colab-details {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  overflow: hidden;
}

.mec-sec-name-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.mec-sec-name {
  font-size: 0.84rem;
  font-weight: 800;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.mec-sec-socio-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  color: #991b1b;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
}

.mec-sec-meta-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: #475569;
  white-space: nowrap;
}

.mec-sec-meta-row span {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

/* 2.2 Elemento Derecho de la misma fila: Vehículos Registrados con Marbete */
.mec-sec-vehicles-zone {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  padding: 0.15rem 0;
}

.mec-sec-vehicle-card {
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
  background: #f8fafc;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.mec-sec-vehicle-card:hover {
  border-color: #94a3b8;
  background: #ffffff;
  transform: translateY(-1px);
}

.mec-sec-vehicle-card.selected {
  border-color: #be123c;
  background: #fff1f2;
  box-shadow: 0 0 0 1px #be123c;
}

.mec-sec-plates {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #0f172a;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
}

.mec-sec-vehicle-card.selected .mec-sec-plates {
  border-color: #be123c;
  color: #881337;
  background: #ffffff;
}

.mec-sec-veh-desc {
  font-size: 0.74rem;
  font-weight: 700;
  color: #1e293b;
}

.mec-sec-marbete-pill {
  font-size: 0.68rem;
  font-weight: 800;
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
}

.mec-sec-empty-hint {
  font-size: 0.75rem;
  color: #94a3b8;
  font-style: italic;
  white-space: nowrap;
}

/* =========================================================================
   3. CUERPO PRINCIPAL: PANEL IZQUIERDO 30% / PANEL DERECHO 70%
   ========================================================================= */
.mec-main-split {
  display: flex;
  flex: 1;
  width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

/* 3.1 PANEL IZQUIERDO: 30% DEL ANCHO DISPONIBLE */
.mec-panel-left {
  width: 30%;
  min-width: 310px;
  max-width: 420px;
  flex-shrink: 0;
  background: #f8fafc;
  border-right: 1.5px solid #cbd5e1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-sizing: border-box;
}

.mec-panel-left::-webkit-scrollbar { width: 5px; }
.mec-panel-left::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* Menú de Secciones Vertical/Segmentado en el Panel Izquierdo */
.mec-sections-menu {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.65rem 0.75rem;
  background: #ffffff;
  border-bottom: 1.5px solid #e2e8f0;
}

.mec-sec-menu-btn {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  padding: 0.45rem 0.65rem;
  font-family: var(--font-main);
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.15s ease;
  text-align: left;
}

.mec-sec-menu-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.mec-sec-menu-btn.active {
  background: linear-gradient(135deg, #3d0715 0%, #881337 100%);
  border-color: #52091c;
  color: #ffffff;
  box-shadow: 0 2px 5px rgba(136, 19, 55, 0.25);
}

.mec-sec-menu-btn-left {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.mec-sec-menu-badge {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.1rem 0.35rem;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.1);
}

.mec-sec-menu-btn.active .mec-sec-menu-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Área de Controles del Panel Izquierdo */
.mec-left-controls-body {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

.mec-group-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.mec-group-title {
  font-size: 0.78rem;
  font-weight: 800;
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 0.35rem;
}

.mec-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.mec-field-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mec-field-input,
.mec-field-select {
  height: 32px;
  padding: 0 0.55rem;
  font-family: var(--font-main);
  font-size: 0.8rem;
  color: #0f172a;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  outline: none;
  transition: all 0.15s ease;
}

.mec-field-input:focus,
.mec-field-select:focus {
  background: #ffffff;
  border-color: #be123c;
  box-shadow: 0 0 0 2px rgba(190, 18, 60, 0.15);
}

.mec-chips-tiny {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  margin-top: 0.15rem;
}

.mec-chip-tiny {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mec-chip-tiny:hover {
  background: #e2e8f0;
  color: #be123c;
  border-color: #fca5a5;
}

/* Selector Segmentado de Novedad (Sin Novedad vs Escribir Comentario) */
.mec-novedad-tabs {
  display: flex;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 2px;
  gap: 3px;
}

.mec-novedad-tab {
  flex: 1;
  padding: 0.35rem 0.45rem;
  font-family: var(--font-main);
  font-size: 0.74rem;
  font-weight: 700;
  text-align: center;
  border-radius: 5px;
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  color: #64748b;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}

.mec-novedad-tab:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.mec-novedad-tab.active.sin-novedad {
  color: #065f46;
  background: #ecfdf5;
  border-color: #a7f3d0;
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.15);
  font-weight: 800;
}

.mec-novedad-tab.active.comentario {
  color: #9f1239;
  background: #fff1f2;
  border-color: #fecdd3;
  box-shadow: 0 1px 3px rgba(190, 18, 60, 0.15);
  font-weight: 800;
}

/* Botón Principal de Emisión en Panel Izquierdo */
.mec-btn-primary-emit {
  height: 40px;
  background: linear-gradient(180deg, #be123c 0%, #9f1239 100%);
  color: #ffffff;
  border: 1px solid #881337;
  border-radius: 7px;
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  box-shadow: 0 2px 6px rgba(190, 18, 60, 0.35);
  transition: all 0.2s ease;
}

.mec-btn-primary-emit:hover {
  background: linear-gradient(180deg, #e11d48 0%, #be123c 100%);
  transform: translateY(-1px);
}

/* 3.2 PANEL DERECHO: 70% DEL ANCHO DISPONIBLE (DETALLES Y VISUALIZADOR) */
.mec-panel-right {
  width: 70%;
  flex: 1;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 0.85rem 1rem;
  box-sizing: border-box;
}

.mec-panel-right::-webkit-scrollbar { width: 5px; }
.mec-panel-right::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* Contenedor de Detalle Activo */
.mec-detail-pane {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  height: 100%;
}

/* =========================================================================
   DETALLE 1: REPORTE OFICIAL (POR DEFECTO)
   ========================================================================= */
.mec-report-canvas-card {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.mec-report-canvas-header {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1.5px solid #e2e8f0;
  padding: 0.6rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mec-report-canvas-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.mec-report-canvas-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.mec-btn-tool {
  height: 28px;
  padding: 0 0.55rem;
  border-radius: 5px;
  font-family: var(--font-main);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.15s ease;
}

.mec-btn-tool.wa {
  background: #25d366;
  color: #ffffff;
  border: 1px solid #16a34a;
}

.mec-btn-tool.wa:hover { background: #22c55e; }

.mec-btn-tool.outline {
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.mec-btn-tool.outline:hover { background: #f8fafc; border-color: #94a3b8; }

.mec-report-paper-view {
  flex: 1;
  padding: 1.25rem 1.5rem;
  background: #ffffff;
  color: #1e293b;
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 0.88rem;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-y: auto;
  border-bottom: 1px solid #f1f5f9;
}

/* =========================================================================
   DETALLE 2: TRACKING Y MAPA INTERACTIVO
   ========================================================================= */
.mec-tracking-map-container {
  flex: 1;
  height: 100%;
  min-height: 520px;
  width: 100%;
  border-radius: 9px;
  overflow: hidden;
  border: 1.5px solid #cbd5e1;
  position: relative;
  display: flex;
}

#mec-route-map {
  height: 100%;
  width: 100%;
  z-index: 10;
}

/* Panel Desplegable Lateral de Checkpoints (Slide-over Drawer a la Derecha) */
.mec-checkpoints-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: 90%;
  z-index: 1050;
  background: #ffffff;
  border-left: 1.5px solid #cbd5e1;
  box-shadow: -6px 0 24px rgba(0, 0, 0, 0.16);
  display: flex;
  flex-direction: column;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateX(100%);
}

.mec-checkpoints-drawer.open {
  transform: translateX(0);
}

.mec-drawer-header {
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mec-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem;
}

.mec-drawer-footer {
  padding: 0.65rem 0.85rem;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Control Flotante de Cobertura Celular sobre el Mapa */
.mec-map-coverage-control {
  position: absolute;
  top: 12px;
  left: 56px;
  z-index: 990;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(6px);
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  padding: 0.45rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: 330px;
  font-family: var(--font-main);
  transition: all 0.2s ease;
}

.mec-coverage-pills {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.mec-cov-pill {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid #cbd5e1;
  background: #f1f5f9;
  color: #475569;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.mec-cov-pill.active.g5 {
  background: #ecfdf5;
  border-color: #10b981;
  color: #065f46;
  font-weight: 800;
}

.mec-cov-pill.active.g4 {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
  font-weight: 800;
}

.mec-cov-pill.active.g3 {
  background: #fffbeb;
  border-color: #f59e0b;
  color: #b45309;
  font-weight: 800;
}

.mec-cov-pill.active.sombra {
  background: #fef2f2;
  border-color: #ef4444;
  color: #b91c1c;
  font-weight: 800;
}

.mec-cov-pill.active.bts {
  background: #f0fdf4;
  border-color: #0284c7;
  color: #0369a1;
  font-weight: 800;
}

/* Switcher de Mapa Base (Calles / Relieve Topográfico / Satelital) */
.mec-basemap-switcher {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 990;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(6px);
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  padding: 0.22rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.mec-basemap-btn {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.22rem 0.5rem;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.mec-basemap-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.mec-basemap-btn.active {
  background: #1e293b;
  color: #ffffff;
  border-color: #0f172a;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.mec-shadow-focus-btn {
  font-size: 0.64rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.mec-shadow-focus-btn:hover {
  background: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
}

/* Badges y Pines de Precisión para Zonas de Sombra */
.mec-shadow-badge {
  font-family: var(--font-main);
  font-size: 9px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 12px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1.5px solid #fff;
  cursor: pointer;
}

.mec-shadow-badge.start {
  background: #dc2626;
  color: #ffffff;
}

.mec-shadow-badge.end {
  background: #16a34a;
  color: #ffffff;
}

/* Torre Celular Radiobase (BTS) */
.mec-bts-pin {
  font-family: var(--font-main);
  background: #0f172a;
  color: #38bdf8;
  border: 1.5px solid #38bdf8;
  font-size: 8.5px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.mec-bts-pin:hover {
  background: #1e293b;
  border-color: #7dd3fc;
  color: #ffffff;
  transform: scale(1.05);
}

/* Tooltip / Popup enriquecido */
.mec-shadow-popup {
  font-family: var(--font-main);
  font-size: 11px;
  color: #1e293b;
  min-width: 250px;
  max-width: 320px;
  line-height: 1.35;
}

.mec-shadow-popup h4 {
  font-size: 12px;
  font-weight: 800;
  color: #b91c1c;
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0 0 4px 0;
  border-bottom: 1px solid #fee2e2;
  padding-bottom: 4px;
}

.mec-shadow-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
  margin: 6px 0;
  background: #f8fafc;
  padding: 6px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.mec-shadow-stat-item {
  font-size: 10px;
}

.mec-shadow-stat-item .label {
  color: #64748b;
  font-weight: 600;
  display: block;
  font-size: 9px;
}

.mec-shadow-stat-item .value {
  color: #0f172a;
  font-weight: 800;
}

.mec-corridors-bar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  padding: 0.35rem 0;
}

/* Línea de Tiempo de Checkpoints */
.mec-timeline-box {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 260px;
  overflow-y: auto;
}

.mec-timeline-row {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  position: relative;
}

.mec-timeline-row::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 20px;
  bottom: -12px;
  width: 2px;
  background: #e2e8f0;
}

.mec-timeline-row:last-child::before { display: none; }

.mec-timeline-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #be123c;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  flex-shrink: 0;
  z-index: 2;
}

.mec-timeline-icon.close {
  background: #10b981;
}

.mec-timeline-bubble {
  flex: 1;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

/* =========================================================================
   DETALLE 3: GARITAS FRONTERIZAS (CBP LIVE)
   ========================================================================= */
.mec-garitas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
}

.mec-garita-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: all 0.15s ease;
}

.mec-garita-card:hover {
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.mec-garita-card.priority {
  border-color: #fca5a5;
  background: linear-gradient(180deg, #fff5f5 0%, #ffffff 50%);
}

.mec-garita-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.35rem;
}

.mec-garita-name {
  font-size: 0.84rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
}

.mec-garita-corridor {
  font-size: 0.68rem;
  color: #64748b;
  margin-top: 0.15rem;
}

.mec-garita-pill {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  white-space: nowrap;
}

.mec-garita-pill.green { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.mec-garita-pill.yellow { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.mec-garita-pill.orange { background: #ffedd5; color: #9a3412; border: 1px solid #fed7aa; }
.mec-garita-pill.red { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

.mec-garita-lanes-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.4rem;
  text-align: center;
}

.mec-garita-lane-val {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 800;
}

.mec-garita-lane-val.green { color: #059669; }
.mec-garita-lane-val.orange { color: #d97706; }
.mec-garita-lane-val.red { color: #dc2626; }

/* Responsive adjustments */
@media (max-width: 900px) {
  .mec-main-split {
    flex-direction: column;
    overflow-y: auto;
  }
  .mec-panel-left {
    width: 100%;
    max-width: 100%;
    border-right: none;
    border-bottom: 1.5px solid #cbd5e1;
  }
  .mec-panel-right {
    width: 100%;
  }
  .mec-ribbon-secondary {
    height: auto;
    min-height: 52px;
    max-height: none;
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem;
  }
  .mec-sec-colab-zone {
    border-right: none;
    border-bottom: 1px dashed #cbd5e1;
    padding-bottom: 0.35rem;
  }
}


/* Barra Flotante de Señal en Ruta (Principio a Fin) */
.mec-route-signal-bar {
  position: absolute;
  bottom: 10px;
  left: 12px;
  right: 12px;
  z-index: 980;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.14);
  padding: 0.45rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-family: var(--font-main);
  transition: all 0.25s ease;
  max-width: 860px;
  margin: 0 auto;
}

.mec-signal-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.mec-signal-badge-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

/* Tira Proporcional de Señal */
.mec-signal-strip {
  display: flex;
  width: 100%;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.08);
}

.mec-strip-seg {
  height: 100%;
  transition: opacity 0.15s ease, filter 0.15s ease;
  cursor: pointer;
  position: relative;
}

.mec-strip-seg:hover {
  filter: brightness(1.15);
  box-shadow: 0 0 4px rgba(0,0,0,0.3);
  z-index: 2;
}

.mec-strip-seg.g5 {
  background: #10b981;
}

.mec-strip-seg.g4 {
  background: #2563eb;
}

.mec-strip-seg.g3 {
  background: #f59e0b;
}

.mec-strip-seg.sombra {
  background: repeating-linear-gradient(
    45deg,
    #dc2626,
    #dc2626 4px,
    #991b1b 4px,
    #991b1b 8px
  );
}

.mec-signal-details-drawer {
  transition: all 0.2s ease;
  overflow: hidden;
}

.mec-signal-details-drawer.collapsed {
  display: none;
}

/* Mojoneras Kilométricas sobre la Carretera (Solo en la ruta activa) */
.mec-km-milestone-marker {
  background: transparent !important;
  border: none !important;
}

.mec-km-milestone-pill {
  font-family: var(--font-mono, monospace);
  font-size: 8.5px;
  font-weight: 800;
  background: rgba(15, 23, 42, 0.90);
  color: #f8fafc;
  padding: 1px 4.5px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 1.5px 5px rgba(0,0,0,0.35);
  white-space: nowrap;
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.mec-km-milestone-pill:hover {
  transform: scale(1.18);
  background: #0284c7;
  color: #ffffff;
  border-color: #ffffff;
  z-index: 1000;
}

.mec-km-milestone-pill.sombra {
  background: #dc2626;
  border-color: #fecaca;
  color: #ffffff;
}

/* Pines arrastrables de Ruta (Inicio, Fin y Vía/Desvío) */
.mec-route-drag-pin {
  cursor: grab;
  transition: transform 0.15s ease;
}

.mec-route-drag-pin:active {
  cursor: grabbing;
  transform: scale(1.2);
}

.mec-route-drag-handle {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9.5px;
  font-weight: 800;
  cursor: grab;
  transition: all 0.15s ease;
}

.mec-route-drag-handle:hover {
  transform: scale(1.25);
  box-shadow: 0 0 10px rgba(0,0,0,0.55);
}

.mec-route-drag-handle.via {
  background: #f59e0b;
  color: #ffffff;
}

.mec-route-drag-handle.via.diverted {
  background: #ea580c;
}

.mec-route-drag-handle.origin {
  background: #10b981;
  color: #ffffff;
}

.mec-route-drag-handle.dest {
  background: #be123c;
  color: #ffffff;
}


/* ============================================================
   PINES Y MARCADORES DE CHECKPOINTS EN EL MAPA (MEC TRACKING)
   ============================================================ */
.mec-cp-marker-wrapper {
  background: transparent !important;
  border: none !important;
}

.mec-cp-pin {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.35));
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mec-cp-pin:hover {
  transform: scale(1.22);
  z-index: 999 !important;
}

.mec-cp-pin-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #1e293b;
  color: #ffffff;
  padding: 2.5px 6.5px;
  border-radius: 9999px;
  border: 2px solid #ffffff;
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.mec-cp-pin-num {
  letter-spacing: -0.3px;
}

.mec-cp-pin-icon {
  font-size: 9.5px;
}

/* Checkpoint sin novedad (Ok) */
.mec-cp-pin .mec-cp-pin-badge {
  background: #0f766e;
  border-color: #5eead4;
}

/* Checkpoint con novedad / comentario */
.mec-cp-pin.novedad .mec-cp-pin-badge {
  background: #b91c1c;
  border-color: #fca5a5;
  color: #fff;
}

/* Checkpoint activo / último avance */
.mec-cp-pin.latest .mec-cp-pin-badge {
  background: #be123c;
  border-color: #ffffff;
  box-shadow: 0 0 0 2px #be123c, 0 4px 10px rgba(190, 18, 60, 0.45);
}

/* Efecto Pulse Ripple para la posición actual del viajero */
.mec-cp-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(190, 18, 60, 0.35);
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: cpPulse 1.8s infinite ease-out;
  z-index: -1;
}

@keyframes cpPulse {
  0% {
    transform: translate(-50%, -50%) scale(0.6);
    opacity: 0.9;
  }
  70% {
    transform: translate(-50%, -50%) scale(1.8);
    opacity: 0;
  }
  100% {
    transform: translate(-50%, -50%) scale(2.2);
    opacity: 0;
  }
}

/* Marcadores de Terminales (Origen y Destino) */
.mec-terminal-marker {
  background: transparent !important;
  border: none !important;
}

.mec-terminal-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  border-radius: 6px;
  font-family: var(--font-main, sans-serif);
  font-size: 10px;
  font-weight: 800;
  color: #ffffff;
  border: 1.5px solid #ffffff;
  box-shadow: 0 2px 7px rgba(0,0,0,0.3);
  white-space: nowrap;
}

.mec-terminal-badge.origin {
  background: #059669;
}

.mec-terminal-badge.dest {
  background: #e11d48;
}

/* Tarjeta Popup de Checkpoint */
.mec-cp-popup-card {
  font-family: var(--font-main, sans-serif);
  padding: 2px;
}

.mec-cp-popup-header {
  background: #0f766e;
  color: #ffffff;
  padding: 6px 10px;
  border-radius: 6px 6px 0 0;
  margin: -14px -14px 8px -14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mec-cp-popup-header.novedad {
  background: #be123c;
}

.mec-cp-latest-tag {
  font-size: 8px;
  background: #ffffff;
  color: #be123c;
  font-weight: 900;
  padding: 1px 4px;
  border-radius: 3px;
  letter-spacing: 0.4px;
}

.mec-cp-popup-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: #334155;
}

.mec-cp-popup-field {
  display: flex;
  align-items: center;
  gap: 5px;
}

.mec-cp-popup-novedad {
  margin-top: 4px;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 10.5px;
}

.mec-cp-popup-novedad.ok {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.mec-cp-popup-novedad.has-issue {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

/* Línea de tiempo interactiva */
.mec-timeline-row.cursor-pointer {
  transition: all 0.15s ease;
  border-radius: 8px;
  padding: 2px;
}

.mec-timeline-row.cursor-pointer:hover {
  background: #f8fafc;
  transform: translateX(3px);
}

/* Marcadores de Checkpoints Arrastrables */
.mec-cp-marker-wrapper {
  cursor: grab !important;
}

.mec-cp-marker-wrapper:active {
  cursor: grabbing !important;
}

/* Indicador de zona activa para soltar checkpoint en el mapa */
.mec-map-drop-active {
  outline: 3px dashed #be123c !important;
  outline-offset: -6px;
  box-shadow: inset 0 0 40px rgba(190, 18, 60, 0.25) !important;
}

/* Píldoras de arrastre */
#mec-drag-add-cp-pill, #mec-drawer-drag-cp-pill {
  user-select: none;
  -webkit-user-drag: element;
}

#mec-drag-add-cp-pill:hover, #mec-drawer-drag-cp-pill:hover {
  filter: brightness(1.05);
}

/* Acciones en cada fila de checkpoint en la bitácora */
.mec-cp-row-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  opacity: 0.85;
  transition: opacity 0.15s ease;
}

.mec-timeline-row:hover .mec-cp-row-actions {
  opacity: 1;
}

.mec-cp-action-btn {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.mec-cp-action-btn.edit {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}

.mec-cp-action-btn.edit:hover {
  background: #fef3c7;
  color: #b45309;
  border-color: #fcd34d;
}

.mec-cp-action-btn.delete {
  background: #f1f5f9;
  color: #94a3b8;
  border-color: #cbd5e1;
}

.mec-cp-action-btn.delete:hover {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}
