/* ========================= */
/* APP LAYOUT                */
/* ========================= */
#app {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  margin: 0;
}

/* ========================= */
/* NAVBAR TOP                */
/* ========================= */
.navbar-top {
  display: flex;
  align-items: center;
  padding: 0 20px;
  height: 52px;
  background: #fff;
  flex-shrink: 0;
  gap: 12px;
  position: relative;
  z-index: 10;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #111827;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  text-decoration: none;
  flex-shrink: 0;
}
.navbar-brand svg { color: #2563eb; }

.navbar-sep {
  width: 1px;
  height: 20px;
  background: #e5e7eb;
  flex-shrink: 0;
}

.navbar-spacer { flex: 1; }

.navbar-form {
  display: flex;
  align-items: center;
  align-self: center;
  gap: 8px;
  flex-shrink: 0;
  margin: 0;
}

.navbar-input {
  display: block;
  height: 34px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0 12px;
  font-size: 13px;
  color: #111827;
  width: 155px;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
  align-self: center;
}
.navbar-input::placeholder { color: #9ca3af; }
.navbar-input:focus {
  outline: none;
  border-color: #a5b4fc;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.08);
  background: #fff;
}
.navbar-input-wide { width: 215px; }

.navbar-btn-add {
  height: 34px;
  background: #22c55e;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
  flex-shrink: 0;
  box-sizing: border-box;
}
.navbar-btn-add:hover { background: #16a34a; }

.navbar-right {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.navbar-link {
  color: #6b7280;
  text-decoration: none;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  font-weight: 500;
}
.navbar-link:hover { background: #f3f4f6; color: #111827; }

.navbar-logout {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

/* ========================= */
/* TOTALES FLOTANTE          */
/* ========================= */
.totales-flotante {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 450;
  pointer-events: none;
}
.totales-flotante-inner {
  display: flex;
  gap: 6px;
  align-items: center;
  background: rgba(255,255,255,0.95);
  border-radius: 12px;
  padding: 6px 10px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.15);
  pointer-events: all;
  flex-wrap: wrap;
  justify-content: center;
}
.camion-chip {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 20px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  white-space: nowrap;
}
.camion-chip.excedido {
  background: #fef2f2;
  border-color: #fca5a5;
}
.chip-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.camion-chip.naranja .chip-dot  { background: orange; }
.camion-chip.violeta .chip-dot  { background: #8A2BE2; }
.camion-chip.verde   .chip-dot  { background: green; }
.camion-chip.rojo    .chip-dot  { background: #DC143C; }
.camion-chip.azul    .chip-dot  { background: #1E90FF; }
.chip-patente { font-weight: 700; color: #1e293b; margin-right: 2px; }
.chip-cajones { font-weight: 700; color: #1e293b; }
.chip-cajones.excedido { color: #dc2626; }
.chip-unit   { color: #94a3b8; font-size: 10px; }
.chip-sep    { color: #cbd5e1; }
.chip-max    { color: #94a3b8; }
.chip-clientes { color: #475569; font-weight: 600; }
.chip-tiempo { color: #475569; }
.chip-ruta-btn {
  position: relative;
  background: none;
  border: none;
  padding: 0 2px;
  font-size: 13px;
  color: #6b7280;
  cursor: pointer;
  opacity: 0.7;
  line-height: 1;
  transition: opacity 0.15s, transform 0.15s, color 0.15s;
}
.chip-ruta-btn:hover {
  opacity: 1;
  color: #111111;
  transform: scale(1.15);
}
.chip-ruta-corona {
  position: absolute;
  top: -4px;
  right: -5px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #D4A017;
  color: #fff;
  font-size: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 0 0 1px #fff;
}

/* ── MODAL RUTA WSP ──────────────────── */
.modal-ruta-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-ruta-overlay.hidden { display: none; }

.modal-ruta-box {
  background: #fff;
  border-radius: 14px;
  width: 360px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-ruta-header {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #111111;
  color: #fff;
  padding: 14px 20px;
  font-size: 0.95rem;
  font-weight: 700;
}
.modal-ruta-header i { font-size: 1.1rem; }

.modal-ruta-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-ruta-info {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.5;
  color: #6b7280;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
}

.modal-ruta-seccion {
  border-top: 1px solid #f3f4f6;
  padding-top: 10px;
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.modal-ruta-seccion-titulo {
  font-size: 0.7rem;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.modal-ruta-campo {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.modal-ruta-campo label {
  font-size: 0.75rem;
  color: #6b7280;
  font-weight: 600;
}
.modal-ruta-campo input {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s;
}
.modal-ruta-campo input:focus {
  border-color: #111111;
  box-shadow: 0 0 0 2px rgba(17,17,17,0.15);
}
.modal-ruta-campo input[readonly] { background: #f9fafb; }

.modal-ruta-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  color: #9ca3af;
  background: #f9fafb;
  border-radius: 6px;
  padding: 6px 10px;
  word-break: break-all;
}

.modal-ruta-acciones {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 14px 20px;
  border-top: 1px solid #f3f4f6;
}
.btn-ruta-cancelar {
  background: #f3f4f6;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.82rem;
  cursor: pointer;
  color: #374151;
}
.btn-ruta-confirmar {
  background: #111111;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  color: #ffffff;
}
.btn-ruta-confirmar:hover { background: #000000; color: #ffffff; }
.btn-ruta-enviar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #25d366;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  transition: background 0.15s;
}
.btn-ruta-enviar:hover { background: #1ebe5d; }

/* ── PREVIEW MENSAJE WHATSAPP (upsell plan Pro) ──────────────────── */
.wsp-bubble-preview {
  background: #e5ddd5;
  border-radius: 10px;
  padding: 14px 14px 16px;
}
.wsp-bubble-eyebrow {
  font-size: 10px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.wsp-bubble {
  background: #dcf8c6;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: #111111;
  line-height: 1.5;
  max-width: 90%;
}

/* ── MODALES DE ALERTA (marca) ──────────────────── */
.modal-brand-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-brand-box {
  background: #fff;
  border-radius: 14px;
  width: 400px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-brand-header {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #111111;
  color: #fff;
  padding: 16px 20px;
  font-size: 1rem;
  font-weight: 700;
}
.modal-brand-header i { font-size: 1.1rem; }
.modal-brand-header.danger { background: #B3261E; }
.modal-brand-header.warning { background: #B45309; }

.modal-brand-body {
  padding: 18px 20px;
  font-size: 0.85rem;
  color: #374151;
  line-height: 1.5;
}

.modal-brand-lista {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f9fafb;
  margin: 0;
  padding: 4px;
  list-style: none;
}
.modal-brand-lista li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  font-size: 0.82rem;
  color: #1f2937;
  border-bottom: 1px solid #eef1f5;
}
.modal-brand-lista li:last-child { border-bottom: none; }

.btn-copiar-cliente {
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 4px 7px;
  cursor: pointer;
  color: #6b7280;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.btn-copiar-cliente:hover { background: #F3F4F6; color: #111111; }

.modal-brand-acciones {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid #f3f4f6;
}

.btn-brand-cerrar {
  background: #111111;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-brand-cerrar:hover { background: #000000; }
.btn-ruta-enviar:disabled { background: #a7f3d0; cursor: default; }
.chip-global {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  padding: 3px 8px;
  border-radius: 20px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  white-space: nowrap;
}

/* ========================= */
/* CHOFERES (tab)            */
/* ========================= */
.panel-choferes-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.chofer-fila {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 8px 12px;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid #eef1f5;
  border-left: 3px solid #e2e8f0;
  background: #fff;
  box-shadow: none;
  transition: background 0.1s;
}
.chofer-fila:last-child { border-bottom: none; }
.chofer-fila:hover { background: #f8fafc; }

.chofer-patente {
  font-size: 12px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0;
  flex: 0 0 90px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chofer-input {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  background: white;
  color: #374151;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.chofer-input:focus {
  outline: none;
  border-color: #111111;
  box-shadow: 0 0 0 2px rgba(17,17,17,0.15);
}
.chofer-tiempo-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.chofer-tiempo-campo {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 140px;
  min-width: 0;
}
.chofer-tiempo-campo:nth-child(4) { flex: 0 1 110px; }
.chofer-tiempo-label {
  font-size: 10px;
  color: #94a3b8;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.chofer-acciones {
  display: flex;
  gap: 6px;
  padding: 8px 0 4px;
  flex-wrap: wrap;
}

.agregar-cliente-panel {
  border-top: 1px solid #e5e7eb;
  padding: 10px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.agregar-cliente-panel form {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.agregar-cliente-titulo {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0;
}
/* Panel overlay sobre el mapa */
.mapa-wrapper {
  position: relative;
  z-index: 1;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

#map {
  position: absolute !important;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  min-height: unset !important;
  border-radius: 0 !important;
  border: none !important;
  z-index: 1;
}

/* ========================= */
/* PANEL INFERIOR            */
/* ========================= */
.panel-inferior {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 400;
  height: 36vh;
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-inferior-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}
.panel-inferior-sep {
  width: 1px;
  align-self: stretch;
  background: #e5e7eb;
  margin: 2px 2px;
}

.panel-link-sutil {
  font-size: 11px;
  color: #9ca3af;
  text-decoration: underline;
  white-space: nowrap;
}
.panel-link-sutil:hover { color: #111111; }

.panel-inferior-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 14px 0;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}
.tab-inferior {
  background: none;
  border: none;
  padding: 8px 12px;
  margin-bottom: -1px;
  font-size: 12.5px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.tab-inferior:hover { color: #111111; }
.tab-inferior.active { color: #111111; border-bottom-color: #111111; }

.panel-inferior-body {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

.tab-contenido {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px;
  overflow: hidden;
}
.tab-contenido.hidden { display: none; }

.panel-filtros-color {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.panel-filtros-color .filtro-color {
  padding: 4px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  background: white;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.panel-filtros-color .filtro-color:hover { background: #f3f4f6; }
.panel-filtros-color .filtro-color.active { background: #1e293b; color: white; border-color: #1e293b; }
.panel-btn {
  border: none;
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: filter 0.15s, background 0.15s, box-shadow 0.15s;
}
.panel-btn:hover { filter: brightness(0.95); }

/* Guardar — acción de soporte */
.panel-btn-save {
  background: #fff;
  color: #111111;
  border: 1px solid #D1D5DB;
}
.panel-btn-save:hover { background: #F3F4F6; }

/* Ruta inteligente — la acción destacada, acento ámbar de marca */
.panel-btn-opt {
  background: #F59E0B;
  color: white;
  box-shadow: 0 1px 3px rgba(245,158,11,0.35);
}
.panel-btn-opt:hover { background: #D97706; }

/* Trazar ruta — acción primaria, negro de marca */
.panel-btn-draw {
  background: #111111;
  color: white;
  box-shadow: 0 1px 3px rgba(17,17,17,0.3);
}
.panel-btn-draw:hover { background: #000000; }

/* Limpiar trazo — acción neutral */
.panel-btn-clear {
  background: #fff;
  color: #6b7280;
  border: 1px solid #e5e7eb;
}
.panel-btn-clear:hover { background: #f3f4f6; color: #374151; }

/* Botones ícono-solo (info, agregar parada) */
.panel-btn-ghost {
  background: #fff;
  color: #111111;
  border: 1px solid #e5e7eb;
  width: 30px;
  justify-content: center;
  padding: 7px;
}
.panel-btn-ghost:hover { background: #F3F4F6; border-color: #D1D5DB; }

/* Lista de clientes dentro del panel */
.clientes-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

/* Acciones superiores ya no se usan, ocultar si queda */
.acciones-superiores { display: none; }

/* Filtros viejos ya no se usan */
.filtro-fecha, .filtros-fijos { display: none; }

.filtros-fijos {
    padding: 18px;
    background-color: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    min-width: 250px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px; /* Espaciado entre elementos internos de filtros-fijos */
}


.filtros-fijos button {
    padding: 8px 15px;
    margin: 4px; /* Pequeño margen entre botones de filtro de color */
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #f0f0f0;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.filtros-fijos button:hover {
    background-color: #e0e0e0;
    border-color: #bbb;
}

.filtros-fijos button.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

#filtro-clientes {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    width: calc(100% - 30px); /* Ajuste para padding */
    margin: 15px 0 20px 0;
    box-sizing: border-box; /* Incluir padding en el ancho */
}

.color-filter-buttons {
    margin-bottom: 10px; /* Espacio debajo de los botones de color */
}

.filtro-fecha {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  margin: 15px 25px;
  background: #f9fafb;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
}

/* ============================= */
/* CONTENEDOR DE BOTONES SUPERIORES */
/* ============================= */

.acciones-superiores {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}




/* ============================= */
/* MODALES DE BOOTSTRAP POR ENCIMA DE */
/* los paneles propios (Configuración, parada extra, etc.) */
/* que usan z-index fijos altos (9999/10000) — si no, un  */
/* modal de Bootstrap abierto arriba de esos paneles queda */
/* tapado y no se puede clickear.                           */
/* ============================= */
.modal {
  z-index: 15000 !important;
}
.modal-backdrop {
  z-index: 14999 !important;
}
