/* Pedidos por teléfono — Moto Reyes (22-oct-2026) */
:root {
  --azul: #1f4e79; --azul-2: #2b6cb0; --naranja: #f97316; --verde: #15803d; --rojo: #b91c1c;
  --ambar: #b45309; --fondo: #f1f5f9; --tarjeta: #ffffff; --borde: #d6dde6; --texto: #1e293b;
  --suave: #64748b; --radio: 12px; --sombra: 0 1px 3px rgba(15, 23, 42, .12);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--fondo);
  color: var(--texto); font-size: 16px; line-height: 1.35; -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; }
button { cursor: pointer; border: 0; border-radius: 10px; padding: 10px 14px; background: #e2e8f0; color: var(--texto); }
button:disabled { opacity: .45; cursor: default; }
button.primario { background: var(--azul); color: #fff; font-weight: 600; }
button.naranja { background: var(--naranja); color: #fff; font-weight: 600; }
button.verde { background: var(--verde); color: #fff; font-weight: 600; }
button.rojo { background: #fee2e2; color: var(--rojo); font-weight: 600; }
button.chico { padding: 6px 10px; font-size: 14px; }
input, select { border: 1px solid var(--borde); border-radius: 10px; padding: 10px 12px; background: #fff; width: 100%; }
input:focus, select:focus { outline: 2px solid var(--azul-2); outline-offset: 1px; }

header.barra {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px;
  background: var(--azul); color: #fff; padding: 10px 14px; box-shadow: var(--sombra);
}
header.barra h1 { font-size: 18px; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header.barra .pill { background: rgba(255, 255, 255, .16); color: #fff; border-radius: 999px; padding: 6px 12px; font-size: 14px; }
.red { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, .16); white-space: nowrap; }
.red.mal { background: #fbbf24; color: #111; }

main, .contenido { max-width: 1100px; margin: 0 auto; padding: 14px; }
.tarjeta { background: var(--tarjeta); border-radius: var(--radio); box-shadow: var(--sombra); padding: 14px; margin-bottom: 14px; }
.centro { max-width: 420px; margin: 40px auto; }
h2 { font-size: 18px; margin: 0 0 10px; color: var(--azul); }
h3 { font-size: 16px; margin: 0; }
.suave { color: var(--suave); font-size: 14px; }
.fila { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fila > * { flex: 0 0 auto; }
.fila .crece { flex: 1 1 180px; }
.error { color: var(--rojo); font-weight: 600; }

/* Botones de nombres / sedes */
.rejilla { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.rejilla button { padding: 16px 10px; font-size: 17px; font-weight: 600; background: #fff; border: 2px solid var(--borde); }
.rejilla button:active { transform: scale(.97); }
.rejilla.sedes { gap: 8px; }
.sedes button { background: var(--azul); color: #fff; border: 0; min-height: 50px; padding: 8px 6px; font-size: 16px; line-height: 1.15; }
.sedes.nohay button { background: var(--rojo); }
.sedes button .n { display: inline-block; margin-left: 6px; font-size: 12px; font-weight: 600; background: rgba(255, 255, 255, .22); border-radius: 999px; padding: 1px 7px; white-space: nowrap; }

/* Pedidos / Bodega */
.modos { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: #e2e8f0; padding: 4px; border-radius: 12px; margin-bottom: 10px; }
.modos button { background: transparent; font-weight: 700; padding: 9px 6px; }
.modos button.activo { background: var(--azul); color: #fff; box-shadow: var(--sombra); }
.modo-bodega .modos button.activo { background: var(--verde); }
.modo-bodega #producto, .modo-bodega #resultados { display: none !important; }
.bodega .prod { padding: 10px 0; border-bottom: 1px solid #eef2f6; display: flex; flex-direction: column; gap: 4px; }
.bodega .prod:last-child { border-bottom: 0; }
.bodega .prod .cab { display: flex; align-items: baseline; gap: 8px; }
.bodega .prod .cab b { font-size: 18px; flex: 1 1 auto; word-break: break-all; }
.bodega ul { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.bodega li { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; background: #f8fafc; border-radius: 8px; padding: 6px 10px; }
.bodega li .ub { grid-column: 1 / -1; color: var(--suave); font-size: 13px; }
.cant { font-weight: 800; font-variant-numeric: tabular-nums; }
.cant.ok { color: var(--verde); } .cant.bajo { color: var(--ambar); } .cant.cero { color: var(--rojo); }
.bodega .pedir { align-self: flex-start; margin-top: 4px; }
.existencia { font-size: 13px; color: var(--suave); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 17px; }
.cierre { margin: 8px 0 0; padding: 8px 10px; border-radius: 8px; background: #fef3c7; color: #92400e; font-size: 14px; font-weight: 600; }

/* Cámara */
.camara { position: relative; background: #000; border-radius: var(--radio); overflow: hidden; aspect-ratio: 4 / 3; max-height: 42vh; width: 100%; }
.camara video { width: 100%; height: 100%; object-fit: cover; display: block; }
.camara .mira { position: absolute; left: 8%; right: 8%; top: 38%; height: 24%; border: 3px solid rgba(255, 255, 255, .85); border-radius: 10px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .25); pointer-events: none; }
.camara .mira::after { content: ""; position: absolute; left: 4%; right: 4%; top: 50%; height: 2px; background: #ef4444; animation: barrido 1.6s ease-in-out infinite alternate; }
@keyframes barrido { from { transform: translateY(-14px); } to { transform: translateY(14px); } }
.camara.pausada .mira::after { animation: none; background: #94a3b8; }
.camara .botones { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 6px; }
.camara .botones button { background: rgba(15, 23, 42, .7); color: #fff; }
.camara .msg { position: absolute; left: 0; right: 0; top: 0; padding: 8px; color: #fff; font-size: 14px; text-align: center; background: linear-gradient(rgba(0,0,0,.6), transparent); }

/* Producto */
.con-producto .camara, .con-producto #form-codigo { display: none; }
.producto .cod { font-size: 26px; font-weight: 800; letter-spacing: .5px; }
.producto .desc { font-size: 17px; margin: 2px 0 4px; }
.producto #instruccion { margin: 6px 0; }
.producto .pista { color: var(--ambar); font-size: 14px; min-height: 18px; }
.producto .sinverif { color: var(--ambar); font-weight: 600; }
.cantidad { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.cantidad input { font-size: 30px; font-weight: 800; text-align: center; height: 52px; padding: 4px; caret-color: transparent; }
.teclado { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.teclado button { padding: 10px 0; font-size: 20px; font-weight: 700; background: #e2e8f0; min-height: 44px; }
.teclado button:active { background: #cbd5e1; transform: scale(.96); }
.teclado button.borrar { background: #fde68a; }
.caja-nohay { display: flex; align-items: center; gap: 8px; margin: 8px 0; padding: 8px 10px; border-radius: 10px; background: #fef2f2; color: var(--rojo); font-weight: 600; }
.caja-nohay input { width: 22px; height: 22px; flex: 0 0 auto; }

/* Listas */
ul.lineas { list-style: none; margin: 8px 0 0; padding: 0; }
ul.lineas li { display: grid; grid-template-columns: 48px 1fr auto; gap: 8px; align-items: center; padding: 8px 4px; border-bottom: 1px solid #eef2f6; }
ul.lineas li .h { color: var(--suave); font-size: 13px; }
ul.lineas li .t { font-size: 15px; } ul.lineas li .t b { font-weight: 700; }
ul.lineas li .q { font-weight: 800; font-size: 17px; }
ul.lineas li.cola .q::after { content: " ⏳"; }
ul.lineas li.mal { background: #fef2f2; }
ul.lineas li.nohay .q { color: var(--rojo); }
ul.lineas .etq { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 999px; margin-left: 4px; vertical-align: 1px; }
ul.lineas .etq.ok { background: #dcfce7; color: var(--verde); } ul.lineas .etq.wo { background: #e0e7ff; color: #3730a3; }
.resultados button { display: block; width: 100%; text-align: left; background: #fff; border-bottom: 1px solid #eef2f6; border-radius: 0; }

/* Avisos */
#avisos { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 520px); pointer-events: none; }
.aviso { padding: 12px 14px; border-radius: 10px; color: #fff; background: #0f172a; box-shadow: 0 4px 14px rgba(0,0,0,.25); font-weight: 600; }
.aviso.ok { background: var(--verde); } .aviso.mal { background: var(--rojo); } .aviso.info { background: var(--azul); }

.pie { text-align: center; color: var(--suave); font-size: 12px; margin: 24px 0; }
