/* =========================================================
   Envíos Aprisa · estilos del sistema
   Azul de marca #1B1464 · Rojo de marca #ED2224
   ========================================================= */
:root {
  --azul: #1B1464;
  --azul-hondo: #120D4A;
  --azul-suave: #E8E7F5;
  --rojo: #ED2224;
  --rojo-hondo: #C8161A;
  --fondo: #F3F3F9;
  --blanco: #FFFFFF;
  --tinta: #1A1740;
  --gris: #66658A;
  --linea: #DDDCEB;
  --radio: 14px;
  --titulo: "Baloo 2", "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  --texto: "Nunito Sans", "Segoe UI", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--texto); color: var(--tinta); background: var(--fondo); }
h1, h2, h3 { font-family: var(--titulo); line-height: 1.1; margin: 0; }
a { color: inherit; }
img { max-width: 100%; }
svg { fill: currentColor; }
:focus-visible { outline: 3px solid var(--rojo); outline-offset: 2px; }

/* ---------- Botones ---------- */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 700 15px/1 var(--texto); padding: 12px 18px; border-radius: 999px;
  border: 2px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, transform .1s;
}
.boton:active { transform: translateY(1px); }
.boton-rojo { background: var(--rojo); color: #fff; }
.boton-rojo:hover { background: var(--rojo-hondo); }
.boton-azul { background: var(--azul); color: #fff; }
.boton-azul:hover { background: var(--azul-hondo); }
.boton-claro { background: #fff; color: var(--azul); border-color: var(--linea); }
.boton-claro:hover { border-color: var(--azul); }
.boton-ancho { width: 100%; }
.boton.chico { padding: 7px 12px; font-size: 13px; }

/* ---------- Campos ---------- */
.campo { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; min-width: 0; }
.campo > span { font-weight: 700; font-size: 13px; color: var(--azul); }
input, select, textarea {
  font: 15px var(--texto); color: var(--tinta); width: 100%;
  padding: 11px 13px; border: 2px solid var(--linea); border-radius: 10px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 3px var(--azul-suave); }
textarea { resize: vertical; }
.fila { display: flex; gap: 12px; flex-wrap: wrap; }
.fila > .campo { flex: 1 1 140px; }
.w-20 { flex-basis: 90px !important; } .w-25 { flex: 0 1 110px !important; }
.w-40 { flex-basis: 180px !important; } .w-50 { flex-basis: 200px !important; }
.w-60 { flex: 2 1 240px !important; } .w-75 { flex: 3 1 220px !important; }
.con-boton, .con-ojo { display: flex; gap: 8px; position: relative; }
.ojo { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--gris); cursor: pointer; padding: 6px; }
.ojo svg { width: 20px; height: 20px; }
.ayuda { font-size: 13px; color: var(--gris); margin: 0; }
.ayuda.ok { color: #13784A; font-weight: 700; }
.ayuda.claro { color: #C9C8EA; margin-top: 10px; }

/* ---------- Avisos ---------- */
.aviso { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-weight: 600; border-left: 5px solid; }
.aviso ul { margin: 6px 0 0; padding-left: 20px; font-weight: 400; }
.aviso-ok { background: #E6F6EE; color: #0E5E3A; border-color: #1BA160; }
.aviso-error { background: #FDECEC; color: #8E1013; border-color: var(--rojo); }

/* =========================================================
   ACCESO (login / instalación)
   ========================================================= */
.acceso { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; background: #fff; }
.acceso.solo { grid-template-columns: 1fr; background: var(--fondo); }
.acceso-marca {
  position: relative; overflow: hidden; background: var(--azul); color: #fff;
  display: flex; align-items: center; padding: 8vw 6vw;
}
.lineas-velocidad { position: absolute; inset: 0; }
.lineas-velocidad span {
  position: absolute; left: -10%; height: 10px; border-radius: 0 10px 10px 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.14));
  top: calc(8% + var(--i) * 10%); width: var(--w, 40%);
  animation: rafaga 2.6s cubic-bezier(.3,.7,.3,1) calc(var(--i) * .12s) 1 both;
}
@keyframes rafaga { from { transform: translateX(-60%); opacity: 0; } to { transform: none; opacity: 1; } }
.acceso-lema { position: relative; max-width: 520px; }
.lema-grande { font: 800 clamp(44px, 6vw, 84px)/.95 var(--titulo); margin: 0 0 20px; letter-spacing: -1px; }
.lema-chico { font-size: 18px; color: #C9C8EA; margin: 0; max-width: 38ch; }
.sonrisa-grande { position: absolute; left: 10%; right: 10%; bottom: 9%; width: 80%; height: 70px; fill: var(--rojo); }

.acceso-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.tarjeta-acceso { width: 100%; max-width: 380px; }
.acceso.solo .tarjeta-acceso { background: #fff; padding: 32px; border-radius: 20px; box-shadow: 0 10px 40px rgba(27,20,100,.1); max-width: 440px; }
.acceso-logo { display: block; width: 240px; margin: 0 0 28px; }
.tarjeta-acceso h1 { font-size: 30px; color: var(--azul); margin-bottom: 20px; }
.tarjeta-acceso .ayuda { margin: -10px 0 18px; }
.enlace-rastreo { display: block; margin-top: 22px; text-align: center; color: var(--azul); font-weight: 700; }

@media (max-width: 820px) {
  .acceso { grid-template-columns: 1fr; }
  .acceso-marca { min-height: 230px; padding: 40px 24px 70px; }
  .lema-chico { display: none; }
  .sonrisa-grande { bottom: 16px; height: 40px; }
}

/* =========================================================
   PANEL
   ========================================================= */
.panel { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.lateral {
  background: var(--azul); color: #fff; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; padding: 16px 14px;
}
.lateral-logo { display: block; background: #fff; border-radius: 12px; padding: 10px 12px; margin-bottom: 22px; }
.lateral-logo img { display: block; width: 100%; }
.menu { display: flex; flex-direction: column; gap: 3px; }
.menu-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px;
  text-decoration: none; font-weight: 600; color: #D3D2F0;
}
.menu-item svg { width: 20px; height: 20px; flex: none; }
.menu-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.menu-item.activo { background: #fff; color: var(--azul); }
.menu-item.destacado { background: var(--rojo); color: #fff; margin: 6px 0; }
.menu-item.destacado:hover { background: var(--rojo-hondo); }
.menu-item.destacado.activo { box-shadow: inset 0 0 0 2px #fff; }
.lateral-usuario {
  margin-top: auto; display: flex; align-items: center; gap: 10px;
  padding: 12px 8px 4px; border-top: 1px solid rgba(255,255,255,.15); font-size: 13px;
}
.lateral-usuario strong { display: block; }
.lateral-usuario span { color: #B3B1DE; font-size: 12px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--rojo); display: grid; place-items: center; font: 800 18px var(--titulo); flex: none; }
.salir { margin-left: auto; color: #B3B1DE; padding: 6px; }
.salir:hover { color: #fff; }
.salir svg { width: 20px; height: 20px; }

.contenido { padding: 24px clamp(16px, 3vw, 36px) 48px; min-width: 0; }
.barra { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.barra-titulo { position: relative; padding-bottom: 12px; }
.barra-titulo h1 { font-size: clamp(26px, 3vw, 34px); color: var(--azul); }
.sonrisa { position: absolute; left: 0; bottom: 0; width: 100%; min-width: 90px; height: 12px; fill: var(--rojo); }
.busqueda-rapida { margin-left: auto; width: min(340px, 100%); }
.busqueda-rapida input { border-radius: 999px; padding-left: 18px; }
.boton-menu { display: none; background: var(--azul); color: #fff; border: 0; border-radius: 10px; padding: 8px; cursor: pointer; }
.boton-menu svg { width: 24px; height: 24px; display: block; }

.bloque { background: #fff; border-radius: var(--radio); padding: 20px 22px; border: 1px solid var(--linea); margin-bottom: 20px; min-width: 0; }
.bloque h2 { font-size: 21px; color: var(--azul); margin-bottom: 14px; }
.bloque-cabeza { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.bloque-cabeza h2 { margin: 0; }
fieldset.bloque { margin-inline: 0; }
legend { font: 700 21px var(--titulo); color: var(--azul); padding: 0; float: left; width: 100%; margin-bottom: 14px; }
legend + * { clear: both; }

.rejilla-2 { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
.rejilla-2 > .bloque, .columna > .bloque:last-child { margin-bottom: 0; }
.columna { display: flex; flex-direction: column; gap: 20px; }
.columna > .bloque { margin: 0; }

/* ---------- Resumen ---------- */
.resumen { display: grid; grid-template-columns: 1.3fr repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.dato { background: #fff; border: 1px solid var(--linea); border-radius: var(--radio); padding: 18px 20px; display: flex; flex-direction: column; }
.dato span { font-weight: 700; font-size: 13px; color: var(--gris); }
.dato strong { font: 800 40px/1.1 var(--titulo); color: var(--azul); margin: 4px 0 2px; }
.dato .dato-dinero { font-size: 30px; }
.dato small { color: var(--gris); }
.dato-principal { background: var(--azul); border-color: var(--azul); color: #fff; position: relative; overflow: hidden; }
.dato-principal span, .dato-principal small { color: #C9C8EA; }
.dato-principal strong { color: #fff; font-size: 52px; }
.dato-principal::after { content: ""; position: absolute; right: -30px; bottom: -40px; width: 160px; height: 80px; border-radius: 0 0 160px 160px; border: 10px solid var(--rojo); border-top: 0; opacity: .9; }

/* ---------- Tablas ---------- */
.tabla-scroll { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th { text-align: left; font-size: 12px; color: var(--gris); font-weight: 700; padding: 8px 10px; border-bottom: 2px solid var(--linea); white-space: nowrap; }
.tabla td { padding: 11px 10px; border-bottom: 1px solid var(--linea); vertical-align: middle; }
.tabla tbody tr { cursor: default; }
.tabla tbody tr[onclick] { cursor: pointer; }
.tabla tbody tr:hover { background: #FAFAFE; }
.tabla tr.inactivo td { color: #A5A4C0; }
.der { text-align: right !important; }
.nowrap { white-space: nowrap; }
.sub { display: block; color: var(--gris); font-size: 12px; }
.fuerte { font-weight: 700; }
.guia { font: 700 15px var(--titulo); color: var(--azul); text-decoration: none; letter-spacing: .3px; }
.guia:hover { color: var(--rojo); }
.enlace { color: var(--azul); font-weight: 700; }
.icono { color: var(--gris); display: inline-flex; padding: 4px; }
.icono:hover { color: var(--azul); }
.icono svg { width: 20px; height: 20px; }

.vacio { text-align: center; padding: 30px 10px; color: var(--gris); }
.vacio p { margin: 0 0 14px; }

.paginacion { display: flex; gap: 6px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.paginacion a { min-width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; text-decoration: none; font-weight: 700; color: var(--azul); }
.paginacion a.actual { background: var(--azul); color: #fff; }

/* ---------- Estados ---------- */
.estado { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.estado.grande { font-size: 15px; padding: 6px 16px; }
.st-recibido  { background: var(--azul-suave); color: var(--azul); }
.st-bodega    { background: #FFF3D6; color: #8A5A00; }
.st-transito  { background: #DDEBFF; color: #0B4AA8; }
.st-reparto   { background: #F1E3FF; color: #6A1DB3; }
.st-entregado { background: #DDF5E8; color: #0E6B40; }
.st-devuelto  { background: #FFE6DA; color: #A33C06; }
.st-anulado   { background: #EEEEF2; color: #77768F; text-decoration: line-through; }

.lista-estados { list-style: none; margin: 0; padding: 0; }
.lista-estados a { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--linea); text-decoration: none; }
.lista-estados li:last-child a { border: 0; }
.lista-estados strong { font: 800 22px var(--titulo); color: var(--azul); }

/* ---------- Gráfica ---------- */
.grafica { display: flex; align-items: flex-end; gap: 8px; height: 160px; }
.barra-g { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.barra-g .relleno { width: 100%; max-width: 34px; min-height: 3px; background: var(--azul); border-radius: 8px 8px 3px 3px; }
.barra-g:last-child .relleno { background: var(--rojo); }
.barra-g .valor { font-weight: 700; font-size: 12px; color: var(--azul); }
.barra-g .etq { font-size: 12px; color: var(--gris); margin-top: 4px; }

/* ---------- Filtros ---------- */
.filtros { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.filtros .campo { margin: 0; flex: 1 1 160px; }
.filtros .campo:first-child { flex: 3 1 260px; }

/* ---------- Nuevo envío ---------- */
.form-columnas { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.form-cobro { position: sticky; top: 20px; }
.cobro { background: var(--azul); color: #fff; border-color: var(--azul); }
.cobro h2 { color: #fff; }
.cobro .campo > span { color: #C9C8EA; }
.cobro .ayuda { color: #B3B1DE; margin-top: 10px; text-align: center; }
.liquidacion { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; margin: 6px 0 18px; padding-top: 14px; border-top: 1px dashed rgba(255,255,255,.3); }
.liquidacion dt { color: #C9C8EA; } .liquidacion dd { margin: 0; text-align: right; font-weight: 700; }
.liquidacion .total { font: 800 30px/1.2 var(--titulo); color: #fff; padding-top: 8px; }
dt.total { font-size: 20px !important; align-self: end; }
.ruta { display: flex; align-items: flex-end; gap: 10px; }
.ruta .campo { flex: 1; }
.ruta-flecha { padding-bottom: 26px; color: var(--rojo); }
.ruta-flecha svg, .ficha-ruta svg { width: 44px; height: 14px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Ficha de envío ---------- */
.ficha-cabeza { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; border-left: 6px solid var(--rojo); }
.ficha-guia { font: 800 34px/1 var(--titulo); color: var(--azul); margin: 0 0 4px; letter-spacing: .5px; }
.ficha-ruta { font: 700 18px var(--titulo); margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.ficha-ruta svg { color: var(--rojo); }
.ficha-acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.datos-dobles { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.datos-dobles p { margin: 0 0 3px; }
.datos-dobles .nombre { font-weight: 700; font-size: 17px; }
.datos-dobles > div + div { border-left: 1px dashed var(--linea); padding-left: 24px; }
.detalles { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; margin: 0; }
.detalles dt { color: var(--gris); font-weight: 600; }
.detalles dd { margin: 0; }
.detalles .fuerte { font-size: 17px; }
.acciones { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

.linea-tiempo { list-style: none; margin: 0; padding: 0 0 0 22px; position: relative; }
.linea-tiempo::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--linea); }
.linea-tiempo li { position: relative; padding-bottom: 18px; }
.linea-tiempo li::before { content: ""; position: absolute; left: -22px; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--azul); }
.linea-tiempo li:first-child::before { background: var(--rojo); border-color: var(--rojo); }
.linea-tiempo strong { display: block; color: var(--azul); }
.linea-tiempo span, .linea-tiempo small { display: block; color: var(--gris); font-size: 13px; }
.linea-tiempo p { margin: 4px 0 0; }

.menu-fila { position: relative; }
.menu-fila summary { list-style: none; }
.menu-fila summary::-webkit-details-marker { display: none; }
.menu-fila > div { position: absolute; right: 0; top: 110%; z-index: 5; background: #fff; border: 1px solid var(--linea); border-radius: 12px; padding: 12px; width: 260px; box-shadow: 0 10px 30px rgba(27,20,100,.15); display: grid; gap: 10px; }
.menu-fila form { display: flex; gap: 6px; }
.menu-fila input { padding: 7px 10px; font-size: 13px; }

/* =========================================================
   RASTREO PÚBLICO
   ========================================================= */
.publico { background: var(--fondo); }
.publico-cabeza { display: flex; justify-content: space-between; align-items: center; padding: 16px clamp(16px, 4vw, 48px); background: #fff; }
.publico-cabeza img { height: 46px; display: block; }
.rastreo-hero { background: var(--azul); color: #fff; padding: 48px clamp(16px, 4vw, 48px) 70px; position: relative; overflow: hidden; }
.rastreo-hero::after { content: ""; position: absolute; left: 50%; bottom: -70px; transform: translateX(-50%); width: min(900px, 120%); height: 110px; border-radius: 0 0 50% 50%; border-bottom: 14px solid var(--rojo); }
.rastreo-hero h1 { font-size: clamp(36px, 5vw, 60px); margin-bottom: 22px; max-width: 900px; margin-inline: auto; }
.rastreo-form, .rastreo-hero .aviso, .rastreo-hero .ayuda { max-width: 900px; margin-inline: auto; }
.rastreo-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.rastreo-form .campo { margin: 0; flex: 2 1 240px; }
.rastreo-form .campo + .campo { flex: 1 1 160px; }
.rastreo-form .campo > span { color: #C9C8EA; }
.rastreo-form input { font-size: 18px; padding: 14px 16px; border: 0; }
.rastreo-form .boton { padding: 16px 28px; font-size: 17px; }
.rastreo-hero .aviso { margin-top: 16px; }
.rastreo-resultado { max-width: 900px; margin: 30px auto; padding: 0 16px; }
.res-cabeza { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.res-cabeza p { margin: 0; }
.progreso { list-style: none; display: flex; justify-content: space-between; margin: 30px 0 10px; padding: 0; position: relative; font-size: 13px; font-weight: 700; color: var(--gris); }
.progreso::before, .progreso::after { content: ""; position: absolute; top: 10px; left: 10%; height: 4px; border-radius: 4px; }
.progreso::before { right: 10%; background: var(--linea); }
.progreso::after { width: calc(80% * var(--avance)); background: var(--rojo); }
.progreso li { flex: 1; text-align: center; position: relative; z-index: 1; }
.progreso li span { display: block; width: 24px; height: 24px; margin: 0 auto 8px; border-radius: 50%; background: #fff; border: 4px solid var(--linea); }
.progreso li.hecho { color: var(--azul); }
.progreso li.hecho span { border-color: var(--rojo); background: var(--rojo); }
.progreso li.actual span { box-shadow: 0 0 0 6px rgba(237,34,36,.18); }
.publico-pie { text-align: center; color: var(--gris); padding: 30px 16px; font-size: 13px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .resumen { grid-template-columns: 1fr 1fr; }
  .rejilla-2, .form-columnas { grid-template-columns: 1fr; }
  .form-cobro { position: static; }
}
@media (max-width: 860px) {
  .panel { grid-template-columns: 1fr; }
  .lateral { position: fixed; z-index: 20; left: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .lateral.abierto { transform: none; box-shadow: 0 0 0 100vmax rgba(18,13,74,.4); }
  .boton-menu { display: block; }
  .busqueda-rapida { margin-left: 0; width: 100%; }
  .datos-dobles { grid-template-columns: 1fr; }
  .datos-dobles > div + div { border-left: 0; padding-left: 0; border-top: 1px dashed var(--linea); padding-top: 16px; }
  .detalles { grid-template-columns: 1fr; gap: 0; }
  .detalles dd { margin-bottom: 10px; }
  .progreso { font-size: 11px; }
}
@media (max-width: 520px) {
  .resumen { grid-template-columns: 1fr; }
  .ruta { flex-direction: column; align-items: stretch; gap: 0; }
  .ruta-flecha { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
