* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --fondo: #f2f2f7; --tarjeta: #fff; --texto: #111; --gris: #8e8e93; --linea: #eee; --azul: #3390ec;
  --verde: #34c759; --amarillo: #ff9f0a; --rojo: #ff3b30; --neutro: #c7c7cc;
}
body {
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--fondo); color: var(--texto); font-size: 14px;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
main { padding: 14px; max-width: 640px; margin: 0 auto; }
a { color: inherit; text-decoration: none; }
h1 { font-size: 22px; }
h2 { font-size: 13px; color: var(--gris); text-transform: uppercase; letter-spacing: .4px; margin: 14px 4px 6px; }
.sub { color: var(--gris); font-size: 12.5px; margin: 2px 0 12px; }
.tarjeta { background: var(--tarjeta); border-radius: 14px; padding: 14px; margin-bottom: 10px; }
.tarjeta.lista { padding: 2px 12px; }
.cargando, .vacio { text-align: center; color: var(--gris); padding: 48px 12px; }
.error { background: #ffe5e3; color: #a3241b; border-radius: 14px; padding: 14px; margin-top: 12px; }

.grande { display: flex; align-items: baseline; gap: 8px; }
.grande b { font-size: 34px; }
.grande span { color: var(--gris); }
.barra-estados { display: flex; height: 12px; border-radius: 6px; overflow: hidden; margin: 10px 0 8px; background: var(--fondo); }
.leyenda { display: flex; justify-content: space-between; font-size: 12.5px; color: #3a3a3c; gap: 6px; }
.punto { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; flex-shrink: 0; }
.completo, .ok { background: var(--verde); }
.detalles, .aviso { background: var(--amarillo); }
.grave, .falta { background: var(--rojo); }
.neutro { background: var(--neutro); }

.fila { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--linea); }
.fila:last-child { border: 0; }
.fila .texto { flex: 1; min-width: 0; }
.fila .texto b { display: block; font-size: 14.5px; }
.fila .texto span { font-size: 12.5px; color: var(--gris); }
.flecha { color: var(--neutro); font-size: 18px; }
.icono { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.fondo-rojo { background: #ffe5e3; }
.fondo-amarillo { background: #fff1dc; }

.medidor { display: grid; grid-template-columns: 128px 1fr 36px; align-items: center; gap: 8px; font-size: 13px; padding: 5px 0; }
.medidor .pista { height: 9px; background: var(--fondo); border-radius: 5px; overflow: hidden; }
.medidor .pista i { display: block; height: 100%; background: var(--amarillo); border-radius: 5px; }
.medidor b { text-align: right; }

.buscador { width: 100%; border: 0; background: #e4e4ea; border-radius: 10px; padding: 10px 12px; font-size: 16px; }
.chips { display: flex; gap: 6px; margin: 10px 0 6px; flex-wrap: wrap; }
.chip { background: #fff; border: 1px solid #e0e0e6; border-radius: 16px; padding: 5px 10px; font-size: 12.5px; cursor: pointer; }
.chip.activo { background: var(--azul); border-color: var(--azul); color: #fff; font-weight: 600; }
.contador { font-size: 12.5px; color: var(--gris); margin: 6px 4px 8px; }

.producto { display: flex; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--linea); }
.producto:last-child { border: 0; }
.miniatura { width: 52px; height: 52px; border-radius: 10px; background: #eef1f6; object-fit: cover; flex-shrink: 0; }
.producto .info { flex: 1; min-width: 0; }
.nombre { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta { font-size: 12px; color: var(--gris); margin: 2px 0 5px; }
.etiquetas { display: flex; gap: 4px; flex-wrap: wrap; }
.etiqueta { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: #ffe5e3; color: #c4271d; }
.estado-punto { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; }

.portada { display: flex; gap: 12px; }
.portada .foto { width: 84px; height: 84px; border-radius: 12px; object-fit: cover; background: #eef1f6; flex-shrink: 0; }
.portada b { font-size: 15px; line-height: 1.25; display: block; }
.portada .sku { font-size: 12px; color: var(--gris); margin: 3px 0 6px; }
.cifras { display: flex; gap: 12px; font-size: 12.5px; flex-wrap: wrap; }
.sello { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 7px; }
.sello.completo { background: #eafaef; color: #1d7a37; }
.sello.detalles { background: #fff1dc; color: #b86e00; }
.sello.grave { background: #ffe5e3; color: #c4271d; }

.canales { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 10px 0; }
.canal { border-radius: 9px; padding: 7px 9px; font-size: 12.5px; background: #eafaef; overflow-wrap: anywhere; }
.canal b { display: block; font-size: 13px; }
.canal span { display: block; color: #6b6b70; font-size: 11.5px; margin-top: 2px; }
.canal.fallo { background: #ffe5e3; }
.canal.espera { background: #fff1dc; }

.boton { display: block; text-align: center; padding: 11px 6px; border-radius: 12px; font-weight: 600; font-size: 14px; background: var(--azul); color: #fff; margin-top: 10px; cursor: pointer; }
.nota { font-size: 11.5px; color: var(--gris); text-align: center; margin-top: 8px; }

.segmentos { display: flex; background: #e4e4ea; border-radius: 9px; padding: 2px; margin-bottom: 10px; }
.segmentos button { flex: 1; border: 0; background: none; padding: 6px; font-size: 13px; border-radius: 7px; color: #3a3a3c; }
.segmentos button.activo { background: #fff; font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.lienzo-inpage { max-height: 62vh; overflow-y: auto; border-radius: 14px; border: 1px solid #e5e5ea; background: #fff; }
.lienzo-inpage img { width: 100%; display: block; }
.punto-lista { display: flex; gap: 9px; padding: 8px 0; border-bottom: 1px solid var(--linea); font-size: 13.5px; line-height: 1.35; }
.punto-lista:last-child { border: 0; }
.punto-lista span { color: var(--gris); font-size: 12px; display: block; }

.envio { display: grid; grid-template-columns: 100px 1fr 70px; align-items: center; gap: 8px; font-size: 12.5px; padding: 4px 0; }
.envio .pista { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--fondo); }
.envio .n { text-align: right; color: #3a3a3c; }
.envio .n b { color: var(--rojo); }

.naranjo { background: #ff9f0a; }
.amarillo { background: #ffd60a; }
.leyenda.rejilla { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; font-size: 12px; }
.pista-canal { display: flex; height: 7px; border-radius: 4px; overflow: hidden; background: var(--fondo); margin: 5px 0 4px; }
.pista-canal i, .barra-estados i { display: block; height: 100%; }
.cifra { text-align: right; font-weight: 700; font-size: 15px; min-width: 48px; }
.cifra span { display: block; font-weight: 400; font-size: 11px; color: var(--gris); }
.propia { font-size: 11px; color: var(--azul); font-weight: 600; margin-left: 4px; }
.cajas { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.caja { border-radius: 10px; padding: 7px 6px; font-size: 11px; line-height: 1.25; color: #3a3a3c; }
.caja b { display: block; font-size: 18px; }
.caja.falta { background: #ffe5e3; }
.caja.naranjo { background: #fff1dc; }
.caja.amarillo { background: #fff8d6; }
.caja.neutro { background: var(--fondo); }
.medidor .pista i.falta { background: var(--rojo); }

.pestanas {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: #fff; border-top: 1px solid #e5e5ea;
  padding-bottom: env(safe-area-inset-bottom);
}
.pestanas a { flex: 1; text-align: center; font-size: 11px; color: var(--gris); padding: 8px 0 10px; }
.pestanas a i { display: block; font-style: normal; font-size: 20px; }
.pestanas a.activa { color: var(--azul); }
