/* Portal Gino Empresas — azul GINO, amarillo del trazo del logo, tipografia Barlow (señalética de ruta). */
:root {
  --azul: #1a3faf;
  --azul-profundo: #0f2a78;
  --amarillo: #f5c400;
  --fondo: #eef1f7;
  --tinta: #18233f;
  --tinta-suave: #5b6683;
  --linea: #d6dcea;
  --blanco: #ffffff;
  --verde: #1b7f3b;
  --rojo: #b42318;
  --gris: #a7afc2;
  --radio: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fondo); color: var(--tinta);
  font: 400 15px/1.5 "Barlow", system-ui, sans-serif;
}
h1, h2 { font-family: "Barlow Condensed", "Barlow", sans-serif; font-weight: 700; margin: 0; letter-spacing: .01em; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--amarillo); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Barra superior ---------- */
.barra {
  display: flex; align-items: center; gap: 28px; padding: 0 24px; height: 60px;
  background: var(--azul-profundo); color: var(--blanco);
}
.marca { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.marca img { display: block; }
.marca span { font: 700 20px/1 "Barlow Condensed", sans-serif; }
.areas { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.area {
  color: #c9d3f2; text-decoration: none; padding: 18px 12px 15px; white-space: nowrap;
  border-bottom: 3px solid transparent; font-weight: 500;
}
.area:hover { color: var(--blanco); }
.area.activa { color: var(--blanco); border-bottom-color: var(--amarillo); }
.area.deshabilitada { color: #7083bb; cursor: default; }
.usuario { display: flex; gap: 14px; align-items: center; white-space: nowrap; font-size: 14px; }
.usuario a { color: var(--amarillo); text-decoration: none; font-weight: 600; }

/* ---------- Login ---------- */
.pantalla-login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: var(--azul-profundo) linear-gradient(160deg, var(--azul) 0%, var(--azul-profundo) 70%);
}
.login {
  width: 100%; max-width: 360px; background: var(--blanco); border-radius: 14px; padding: 32px 28px 28px;
  box-shadow: 0 24px 60px rgba(4, 16, 60, .35);
}
.login-logo { display: block; margin: 0 auto 8px; }
.login h1 { text-align: center; font-size: 30px; color: var(--azul-profundo); }
.login-sub { text-align: center; margin: 0 0 20px; color: var(--tinta-suave); }
.login label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 6px; }
.login input {
  width: 100%; padding: 11px 12px; border: 1px solid var(--linea); border-radius: 8px; font: inherit; background: #f8f9fc;
}
.login input:focus { outline: none; border-color: var(--azul); background: var(--blanco); box-shadow: 0 0 0 3px rgba(26, 63, 175, .15); }
.login button {
  width: 100%; margin-top: 22px; padding: 12px; border: 0; border-radius: 8px;
  background: var(--azul); color: var(--blanco); font-weight: 600; font-size: 16px;
}
.login button:hover { background: var(--azul-profundo); }
.login-error { margin: 14px 0 0; color: var(--rojo); font-weight: 500; }

/* ---------- Ventas ---------- */
.ventas { max-width: 1400px; margin: 0 auto; padding: 24px; }
.titulo { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.titulo h1 { font-size: 36px; line-height: 1; color: var(--azul-profundo); }
.fecha { margin: 4px 0 0; color: var(--tinta-suave); font-size: 16px; }
.estado-carga { display: flex; align-items: center; gap: 12px; color: var(--tinta-suave); font-size: 14px; }
.estado-carga .error { color: var(--rojo); font-weight: 600; }
.boton-sec {
  border: 1px solid var(--azul); color: var(--azul); background: var(--blanco);
  padding: 7px 14px; border-radius: 8px; font-weight: 600;
}
.boton-sec:hover { background: #eef2fd; }

/* Cifras del dia: una sola franja dividida, no tarjetas sueltas */
.cifras {
  display: grid; grid-template-columns: repeat(5, 1fr); background: var(--blanco);
  border: 1px solid var(--linea); border-radius: var(--radio); margin-bottom: 18px; overflow: hidden;
}
.cifra { padding: 14px 18px; border-left: 1px solid var(--linea); }
.cifra:first-child { border-left: 0; background: var(--azul); color: var(--blanco); }
.cifra b { display: block; font: 700 30px/1.1 "Barlow Condensed", sans-serif; font-variant-numeric: tabular-nums; }
.cifra span { font-size: 14px; color: var(--tinta-suave); }
.cifra:first-child span { color: #c9d3f2; }
.cifra.verde b { color: var(--verde); }
.cifra.rojo b { color: var(--rojo); }

/* Tablero: vendedores + mapa */
.tablero { display: grid; grid-template-columns: minmax(340px, 5fr) 7fr; gap: 18px; margin-bottom: 18px; }
.panel-vendedores, .panel-mapa, .detalle {
  background: var(--blanco); border: 1px solid var(--linea); border-radius: var(--radio);
}
.panel-cab { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 10px; gap: 12px; flex-wrap: wrap; }
.panel-cab h2 { font-size: 22px; }
.leyenda { display: flex; gap: 12px; font-size: 13px; color: var(--tinta-suave); }
.leyenda i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.p-cliente { background: var(--azul); } .p-compro { background: var(--verde); } .p-nocompro { background: var(--rojo); } .p-pend { background: var(--gris); }

.vendedores { list-style: none; margin: 0; padding: 0 8px 8px; max-height: 560px; overflow-y: auto; }
.vendedor {
  display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 8px;
  padding: 12px 10px; border-top: 1px solid var(--linea); color: inherit;
}
.vendedores li:first-child .vendedor { border-top: 0; }
.vendedor:hover { background: #f5f7fc; }
.vendedor[aria-pressed="true"] { background: #eef2fd; box-shadow: inset 4px 0 0 var(--azul); }
.v-fila { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.v-nombre { font-weight: 600; font-size: 16px; }
.v-monto { font: 700 20px/1 "Barlow Condensed", sans-serif; font-variant-numeric: tabular-nums; }
.v-sub { font-size: 13px; color: var(--tinta-suave); margin-top: 2px; }
.v-sub .alerta { color: var(--rojo); font-weight: 600; }

/* La franja de ruta: cada cliente es una parada sobre la linea del camino */
.ruta { position: relative; margin-top: 10px; height: 14px; display: flex; align-items: center; gap: 3px; }
.ruta::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: var(--linea); }
.ruta i { position: relative; flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: var(--gris); border: 2px solid var(--blanco); }
.ruta i.c { background: var(--verde); } .ruta i.n { background: var(--rojo); }
.ruta-barra { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: #e6eaf3; margin-top: 12px; }
.ruta-barra .c { background: var(--verde); } .ruta-barra .n { background: var(--rojo); }

.panel-mapa { overflow: hidden; display: flex; flex-direction: column; }
#mapa { flex: 1; min-height: 520px; }
.mapa-nota { margin: 0; padding: 8px 14px; font-size: 13px; color: var(--tinta-suave); border-top: 1px solid var(--linea); }
.pin { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--blanco); color: var(--blanco);
  display: flex; align-items: center; justify-content: center; font: 700 12px/1 "Barlow", sans-serif;
  box-shadow: 0 2px 6px rgba(0,0,0,.35); }

/* Pestañas y tablas */
.pestanas { display: flex; gap: 4px; padding: 6px 10px 0; border-bottom: 1px solid var(--linea); overflow-x: auto; }
.pestanas button {
  background: none; border: 0; padding: 12px 14px 10px; color: var(--tinta-suave); font-weight: 600;
  border-bottom: 3px solid transparent; white-space: nowrap;
}
.pestanas button[aria-selected="true"] { color: var(--azul-profundo); border-bottom-color: var(--amarillo); }
[role="tabpanel"] { padding: 6px 16px 16px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--tinta-suave); padding: 10px 8px; border-bottom: 1px solid var(--linea); white-space: nowrap; }
td { padding: 10px 8px; border-bottom: 1px solid #edf0f6; vertical-align: top; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.etiqueta { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 10px; background: #fff4cc; color: #7a5b00; margin-left: 6px; }
.barra-rank { height: 6px; background: var(--azul); border-radius: 3px; margin-top: 4px; }
.vacio { padding: 26px 8px; color: var(--tinta-suave); }

@media (max-width: 1000px) {
  .tablero { grid-template-columns: 1fr; }
  #mapa { min-height: 360px; }
  .cifras { grid-template-columns: repeat(2, 1fr); }
  .cifra { border-left: 0; border-top: 1px solid var(--linea); }
  .cifra:first-child { grid-column: 1 / -1; border-top: 0; }
}
@media (max-width: 640px) {
  .barra { gap: 12px; padding: 0 12px; }
  .marca span, .usuario span { display: none; }
  .ventas { padding: 16px 12px; }
  .titulo h1 { font-size: 30px; }
}

/* ---------- Sub-menu de area ---------- */
.subnav { display: flex; gap: 6px; margin: -6px 0 18px; flex-wrap: wrap; }
.subnav a {
  text-decoration: none; color: var(--tinta-suave); font-weight: 600; padding: 7px 14px; border-radius: 20px;
  border: 1px solid var(--linea); background: var(--blanco);
}
.subnav a.activa { background: var(--azul); border-color: var(--azul); color: var(--blanco); }

/* ---------- Configuracion de vendedores ---------- */
.aviso { padding: 10px 14px; border-radius: 8px; margin: 0 0 16px; font-weight: 500; }
.aviso.ok { background: #e6f4ea; color: var(--verde); }
.aviso.error { background: #fdecea; color: var(--rojo); }
.fichas { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 16px; }
.ficha { background: var(--blanco); border: 1px solid var(--linea); border-radius: var(--radio); padding: 16px 18px; }
.ficha-todos { grid-column: 1 / -1; border: 2px solid var(--azul); }
.ficha header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 6px; }
.ficha h2 { font-size: 22px; color: var(--azul-profundo); }
.ficha header p { margin: 0; color: var(--tinta-suave); font-size: 13px; }
.estado-ficha { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 12px; background: #eef1f7; color: var(--tinta-suave); white-space: nowrap; }
.estado-ficha.propia { background: #fff4cc; color: #7a5b00; }
.ficha fieldset { border: 0; border-top: 1px solid var(--linea); margin: 10px 0 0; padding: 10px 0 0; }
.ficha legend { font: 700 15px/1 "Barlow Condensed", sans-serif; letter-spacing: .03em; text-transform: uppercase; color: var(--azul); padding: 0 6px 0 0; }
.ficha label { display: block; margin: 6px 0; }
.ficha input[type=number] { width: 80px; padding: 5px 8px; border: 1px solid var(--linea); border-radius: 6px; font: inherit; text-align: right; }
.ficha input[type=checkbox], .ficha input[type=radio] { width: 17px; height: 17px; vertical-align: -3px; margin-right: 6px; accent-color: var(--azul); }
.ficha .numero { padding-left: 26px; color: var(--tinta-suave); }
.ficha .numero.apagado { opacity: .4; }
.ficha footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.ficha .pie { font-size: 12px; color: var(--tinta-suave); }
.ficha button { margin-left: auto; border: 0; background: var(--azul); color: var(--blanco); font-weight: 600; padding: 9px 16px; border-radius: 8px; }
.ficha button:hover { background: var(--azul-profundo); }
@media (max-width: 640px) { .fichas { grid-template-columns: 1fr; } }

/* ---------- Usuarios ---------- */
.dos-columnas { display: grid; grid-template-columns: minmax(0, 7fr) minmax(320px, 5fr); gap: 18px; align-items: start; }
.campo { width: 100%; padding: 8px 10px; border: 1px solid var(--linea); border-radius: 8px; font: inherit; margin-top: 4px; }
.campo[readonly] { background: #f3f5fa; color: var(--tinta-suave); }
.grilla-check { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0 10px; }
@media (max-width: 1000px) { .dos-columnas { grid-template-columns: 1fr; } }

/* ---------- Clientes ---------- */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.clientes { display: grid; grid-template-columns: minmax(280px, 4fr) minmax(0, 9fr); gap: 18px; align-items: start; }
.buscador { padding: 12px; }
.resultados { list-style: none; margin: 10px 0 0; padding: 0; max-height: 640px; overflow-y: auto; }
.resultados button { display: block; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--linea); padding: 10px 6px; color: inherit; }
.resultados button:hover { background: #f5f7fc; }
.resultados b { display: block; }
.resultados span { font-size: 13px; color: var(--tinta-suave); }
.ficha-cliente { background: var(--blanco); border: 1px solid var(--linea); border-radius: var(--radio); padding: 16px 18px; min-height: 300px; }
.ficha-cab { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.ficha-cab h2 { font-size: 26px; color: var(--azul-profundo); }
.ficha-cab p { margin: 2px 0 0; color: var(--tinta-suave); }
.periodo { display: flex; gap: 4px; align-self: flex-start; }
.periodo button { border: 1px solid var(--linea); background: var(--blanco); border-radius: 16px; padding: 5px 11px; font-weight: 600; color: var(--tinta-suave); }
.periodo button[aria-pressed="true"] { background: var(--azul); border-color: var(--azul); color: var(--blanco); }
.cifras-cliente { margin-bottom: 14px; }
.cifras-cliente .cifra:first-child { background: #e3f0ff; color: var(--azul-profundo); }
.cifras-cliente .cifra:first-child span { color: var(--azul); }
.ficha-cuerpo { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 16px; align-items: start; }
.mapa-cliente { height: 420px; border-radius: 8px; border: 1px solid var(--linea); position: sticky; top: 12px; }
.linea-tiempo { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 3px solid var(--linea); }
.linea-tiempo li { position: relative; padding: 2px 0 16px 12px; }
.linea-tiempo li::before { content: ""; position: absolute; left: -27px; top: 4px; width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--blanco); background: var(--gris); box-shadow: 0 0 0 1px var(--linea); }
.linea-tiempo .lt-pedido::before { background: var(--verde); }
.linea-tiempo .lt-no_compra::before { background: var(--rojo); }
.lt-cab b { display: block; font-size: 15px; }
.lt-cab span { font-size: 13px; color: var(--tinta-suave); }
.lt-monto { font: 700 22px/1.2 "Barlow Condensed", sans-serif; margin-top: 4px; }
.lt-monto small { font: 400 13px "Barlow", sans-serif; color: var(--tinta-suave); }
.lt-motivo { margin-top: 4px; }
.linea-tiempo details { margin-top: 4px; }
.linea-tiempo summary { cursor: pointer; color: var(--azul); font-weight: 600; font-size: 14px; }
.linea-tiempo a { color: var(--azul); font-weight: 600; font-size: 14px; }
.dist { display: inline-block; margin-top: 4px; font-size: 12px; color: var(--tinta-suave); background: #eef1f7; border-radius: 10px; padding: 1px 8px; }
.dist.lejos { background: #fdecea; color: var(--rojo); font-weight: 600; }
@media (max-width: 1000px) { .clientes, .ficha-cuerpo { grid-template-columns: 1fr; } .mapa-cliente { position: static; height: 300px; } }

/* ---------- Ruta paso a paso (monitoreo) ---------- */
.ruta-detalle { border-top: 1px solid var(--linea); padding: 12px 14px; max-height: 420px; overflow-y: auto; }
.rd-cab b { display: block; font-size: 16px; }
.rd-cab span { font-size: 13px; color: var(--tinta-suave); }
.rd-lista { list-style: none; margin: 10px 0 0; padding: 0; }
.rd-lista li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid #edf0f6; }
.rd-n { flex: 0 0 26px; height: 26px; border-radius: 50%; background: #eef1f7; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; }
.rd-cli { flex: 1; min-width: 0; }
.rd-cli b { font-size: 14px; }
.rd-cli span { display: block; font-size: 13px; color: var(--tinta-suave); }
.rd-lista a { font-size: 13px; font-weight: 600; color: var(--azul); text-decoration: none; }
.chip { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 10px; background: #eef1f7; color: var(--tinta-suave); white-space: nowrap; }
.chip.c { background: #e6f4ea; color: var(--verde); }
.chip.n { background: #fdecea; color: var(--rojo); }

.leyenda-mapa { margin: 8px 0 0; flex-wrap: wrap; }
.mapa-cliente { position: static; }
