/* ============================================================================
   LUPER — Control de Buzoneo. Ver _nucleo/marca.md: teal #0E7565, oferta #D4362C,
   Montserrat. Interfaz deliberadamente simple: es una herramienta interna.
   ============================================================================ */

:root {
  --teal: #0E7565;
  --teal-dark: #0a5a4e;
  --rojo: #D4362C;
  --bg: #f4f6f5;
  --card: #ffffff;
  --texto: #1c2b28;
  --texto-suave: #5b6b67;
  --borde: #e0e6e4;
  --pendiente: #94a3b8;
  --excluido: #cbd5e1;
  --sombra: 0 2px 10px rgba(14, 117, 101, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--texto);
  font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body { display: flex; flex-direction: column; min-height: 100vh; }

header.app-header {
  background: var(--teal);
  color: #fff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

header.app-header h1 {
  font-size: 16px;
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.3px;
}

header.app-header .sub { font-size: 12px; opacity: 0.85; }

.btn {
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  font-family: inherit;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.05s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-oferta { background: var(--rojo); color: #fff; }
.btn-outline { background: transparent; color: var(--teal); border: 2px solid var(--teal); }
.btn-ghost { background: transparent; color: var(--texto-suave); }
.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }

.card {
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--sombra);
  padding: 18px;
}

input[type="text"], input[type="tel"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], textarea, select {
  font-family: inherit;
  font-size: 16px;
  padding: 12px 14px;
  border: 2px solid var(--borde);
  border-radius: 10px;
  width: 100%;
  background: #fff;
  color: var(--texto);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--teal); }

label { font-size: 13px; font-weight: 600; color: var(--texto-suave); display: block; margin-bottom: 6px; }

.pantalla-centrada {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.logo-luper {
  color: var(--teal);
  font-weight: 800;
  font-size: 26px;
  letter-spacing: 0.5px;
}
.logo-luper span { color: var(--rojo); }

.tagline { color: var(--texto-suave); font-size: 13px; margin-top: -6px; margin-bottom: 22px; }

.selector-rol {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 360px;
}

.tarjeta-rol {
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--sombra);
  padding: 22px;
  text-align: left;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  color: var(--texto);
  display: block;
}
.tarjeta-rol:hover { border-color: var(--teal); }
.tarjeta-rol .icono { font-size: 28px; }
.tarjeta-rol h2 { font-size: 17px; margin: 8px 0 4px; }
.tarjeta-rol p { font-size: 13px; color: var(--texto-suave); margin: 0; }

#mapa { flex: 1; min-height: 300px; width: 100%; }

.panel-inferior {
  background: var(--card);
  border-top: 1px solid var(--borde);
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.stats-fila {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  text-align: center;
}
.stat-caja { background: var(--bg); border-radius: 10px; padding: 8px 4px; }
.stat-caja .num { font-size: 20px; font-weight: 800; color: var(--teal); }
.stat-caja .num.rojo { color: var(--rojo); }
.stat-caja .etiqueta { font-size: 10.5px; color: var(--texto-suave); text-transform: uppercase; letter-spacing: 0.3px; }

.etiqueta-cp {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--borde);
  color: var(--texto-suave);
  font-weight: 700;
  font-size: 11px;
  padding: 1px 6px;
  box-shadow: none;
}
.etiqueta-cp::before { display: none; }

.pin-marker {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.2);
}
.pin-marker.pendiente { background: var(--pendiente); }
.pin-marker.completado { background: var(--teal); }
.pin-marker.excluido { background: var(--excluido); opacity: 0.6; }

.punto-repartidor {
  width: 22px; height: 22px; border-radius: 50%; border: 3px solid #fff;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.15), 0 0 12px rgba(0,0,0,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: #fff; font-weight: 700;
}

/* Modal simple */
.modal-fondo {
  position: fixed; inset: 0; background: rgba(20, 30, 28, 0.55);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 1000;
}
.modal-fondo.centrado { align-items: center; }
.modal-caja {
  background: #fff; border-radius: 18px 18px 0 0; padding: 22px;
  width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto;
}
.modal-fondo.centrado .modal-caja { border-radius: 18px; }
.modal-caja h3 { margin-top: 0; }
.oculto { display: none !important; }

.fila { display: flex; gap: 10px; }
.fila > * { flex: 1; }

.toast {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  background: var(--texto); color: #fff; padding: 10px 18px; border-radius: 30px;
  font-size: 13px; z-index: 2000; box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  max-width: 90vw; text-align: center;
}
.toast.error { background: var(--rojo); }

/* ---------- Admin ---------- */
.admin-layout { display: flex; flex-direction: column; flex: 1; }
.admin-tabs { display: flex; background: #fff; border-bottom: 1px solid var(--borde); overflow-x: auto; flex-shrink: 0; }
.admin-tab { padding: 13px 16px; font-size: 13.5px; font-weight: 600; color: var(--texto-suave); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.admin-tab.activa { color: var(--teal); border-color: var(--teal); }
.admin-panel { flex: 1; overflow-y: auto; padding: 16px; }
.admin-panel.mapa-panel { padding: 0; display: flex; flex-direction: column; }

.grid-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (min-width: 640px) { .grid-stats { grid-template-columns: repeat(4, 1fr); } }
.tarjeta-stat { background: #fff; border-radius: 14px; padding: 16px; box-shadow: var(--sombra); }
.tarjeta-stat .num { font-size: 26px; font-weight: 800; color: var(--teal); }
.tarjeta-stat .etiqueta { font-size: 12px; color: var(--texto-suave); }

table.tabla-simple { width: 100%; border-collapse: collapse; font-size: 13.5px; background: #fff; border-radius: 10px; overflow: hidden; }
table.tabla-simple th, table.tabla-simple td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--borde); }
table.tabla-simple th { background: var(--bg); font-size: 11.5px; text-transform: uppercase; color: var(--texto-suave); }

.estado-punto { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.estado-punto.online { background: #16a34a; }
.estado-punto.offline { background: #cbd5e1; }

.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.galeria img { width: 100%; height: 120px; object-fit: cover; border-radius: 10px; cursor: pointer; box-shadow: var(--sombra); }

.barra-filtros { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.barra-filtros select { width: auto; padding: 8px 10px; font-size: 13px; }

.leyenda { display: flex; gap: 14px; padding: 10px 16px; background: #fff; border-top: 1px solid var(--borde); font-size: 12px; flex-wrap: wrap; }
.leyenda .item { display: flex; align-items: center; gap: 6px; }

.aviso { background: #fff7ed; border: 1px solid #fdba74; color: #92400e; padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; }

/* ---------- Repartidor: noviembre 2026 ---------- */
.stat-caja .num.naranja { color: #d97706; }
.tarjeta-siguiente { background: var(--bg); border-radius: 12px; padding: 10px 12px; border: 2px solid transparent; }
.tarjeta-siguiente.cerca { border-color: var(--teal); background: #e7f3f1; }
.ts-etiqueta { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.3px; color: var(--texto-suave); }
.ts-direccion { font-weight: 700; font-size: 15px; margin-top: 2px; }
.ts-meta { font-size: 12.5px; color: var(--texto-suave); margin-top: 2px; }
.chip-cola { background: #f59e0b; color: #fff; font-size: 11.5px; font-weight: 700; padding: 4px 8px; border-radius: 20px; white-space: nowrap; }
.chip-reintento { background: #fef3c7; color: #92400e; font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 10px; margin-left: 4px; }
.modal-direccion { font-weight: 700; font-size: 15px; margin: -4px 0 12px; }
.ayuda { font-size: 12px; color: var(--texto-suave); margin: 6px 0 0; }
.opciones-motivo { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.opcion { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 2px solid var(--borde); border-radius: 10px; font-weight: 400; color: var(--texto); font-size: 14px; margin: 0; cursor: pointer; }
.opcion:has(input:checked) { border-color: var(--teal); background: #e7f3f1; }
.opcion input { margin-top: 3px; accent-color: var(--teal); }
.opcion small { color: var(--texto-suave); }
.lista-proximos { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.item-proximo { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; background: var(--bg); border: none; border-radius: 10px; padding: 10px 12px; font-family: inherit; cursor: pointer; }
.ip-dir { font-weight: 700; font-size: 14px; color: var(--texto); }
.ip-meta { font-size: 12px; color: var(--texto-suave); }

/* ---------- Admin: sectores ---------- */
.barra-objetivos { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 14px; }
.objetivo { background: #fff; border-radius: 12px; padding: 12px 14px; box-shadow: var(--sombra); }
.objetivo .titulo { font-size: 12px; color: var(--texto-suave); font-weight: 600; }
.objetivo .cifra { font-size: 20px; font-weight: 800; color: var(--teal); }
.objetivo .cifra small { font-size: 12px; color: var(--texto-suave); font-weight: 600; }
.barra { height: 6px; border-radius: 3px; background: var(--borde); margin-top: 8px; overflow: hidden; }
.barra > span { display: block; height: 100%; background: var(--teal); }
.barra.pasado > span { background: #d97706; }
table.tabla-simple td select, table.tabla-simple td input { padding: 6px 8px; font-size: 13px; width: auto; min-width: 110px; }
table.tabla-simple tr.resaltado td { background: #e7f3f1; }
.estado-sector { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.estado-sector.planificado { background: #e7f3f1; color: var(--teal); }
.estado-sector.reserva { background: var(--bg); color: var(--texto-suave); }
.estado-sector.descartado { background: #fde8e7; color: var(--rojo); }
.leyenda .bola { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.2); }

a { color: var(--teal); }

.barra-mapa { padding: 10px 16px; margin: 0; background: #fff; border-bottom: 1px solid var(--borde); align-items: center; }
.fm-resumen { font-size: 12.5px; color: var(--texto-suave); margin-left: auto; }
