/* Capa móvil · Facturar (POS). Dueño: agente POS (23-sep-2026). Toda regla cuelga de html.mv.
   Especificación: qa/diseno/movil/variante_bc — estilo_pos.css (buscador, listas de precios, barra del carrito,
   totales) y estilo_listas_pos.css (fila de producto y línea del carrito), con los tokens --mv-* del núcleo.
   Capas: barra del carrito 240 (bajo las barras 242) · velo/hoja 257/258 (núcleo) · #modal 260 · #toast 300.
   movil_pos.js pone html.mv-pos-on mientras la pantalla móvil del POS está activa (#main, con el POS de
   escritorio, queda oculto pero vivo) y html.mv-pos-carro cuando el carrito tiene productos. */

/* ── 1 · raíz: el POS de escritorio sigue en #main, oculto (posEmitir/posTotales leen sus controles) ── */
html.mv.mv-pos-on[data-mv-pagina="facturar"] #main{ display:none !important; }
html.mv:not([data-mv-pagina="facturar"]) .mv-pos{ display:none !important; }
html.mv .mv-pos{
  padding:8px 16px 16px; color:var(--mv-tx);
  font-family:'Inter',system-ui,-apple-system,'Segoe UI',Roboto,sans-serif; line-height:1.5; font-variant-numeric:tabular-nums;
}
html.mv .mv-pos :where(h2,h3,p){ margin:0; }
html.mv .mv-pos [hidden],html.mv .mv-pos-hoja [hidden]{ display:none !important; }
html.mv .mv-pos :focus-visible{ outline:2px solid var(--mv-pri); outline-offset:2px; }
html.mv .mv-pos-cod{ font-variant-numeric:normal; }
html.mv .mv-pos-h::before{ content:none; display:none; }
/* con la barra del carrito, el final de la lista no queda debajo de ella */
html.mv.mv-pos-on.mv-pos-carro .content{ padding-bottom:calc(var(--mv-nav-h) + var(--mv-bot) + 96px + var(--mv-pos-vc,0px)); }

/* ── 2 · cabecera pegajosa: buscador grande + listas de precios (estilo_pos.css .pos-cab/.busc/.lp) ── */
html.mv .mv-pos-cab{
  position:sticky; top:calc(var(--mv-barra-h) + var(--mv-top)); z-index:5;
  background:var(--mv-bg); margin:-8px -16px 0; padding:8px 16px 0; transition:background-color .2s linear;
}
html.mv.mv-alzada .mv-pos-cab{ background:var(--mv-s1); }
html.mv .mv-busc.mv-pos-busc{ margin-top:0; }
html.mv .mv-pos-busc .mv-ib{ color:var(--mv-tx); }
html.mv .mv-pos-lp{ display:flex; align-items:center; gap:8px; overflow-x:auto; margin:4px -16px 0; padding:0 16px; scrollbar-width:none; }
html.mv .mv-pos-lp::-webkit-scrollbar{ display:none; }
html.mv .mv-pos-lp-t{ font-size:.8125rem; line-height:1.125rem; color:var(--mv-tx2); font-weight:550; white-space:nowrap; }
/* con productos en el carrito la lista no se puede cambiar (pos.js:1211): se ven deshabilitadas */
html.mv .mv-pos-lp.bloq .mv-chipb .mv-chip{ opacity:.38; }
html.mv .mv-pos-lp.bloq .mv-chipb[aria-checked="true"] .mv-chip{ opacity:.62; }
html.mv .mv-pos-n{ font-size:.8125rem; line-height:1.125rem; color:var(--mv-tx3); padding:4px 0 8px; }
html.mv .mv-pos-nota{ margin:0 0 12px; }

/* ── 3 · fila de producto (estilo_listas_pos.css .lx-f.prod): 64 px, precio + «en el carrito», agregar 48 ── */
html.mv .mv-fila.mv-pos-prod{ padding:8px 12px 8px 16px; min-height:64px; }
html.mv .mv-fila.mv-pos-prod.en{ background:var(--mv-sel-fila); }
html.mv .mv-pos-prod .mv-pos-bajo{ color:var(--mv-av); font-weight:600; }
html.mv .mv-pos-prod .mv-pos-agot{ color:var(--mv-er); font-weight:600; }
html.mv .mv-fila-v>small.mv-pos-enc{ display:flex; align-items:center; justify-content:flex-end; gap:4px; color:var(--mv-pri); font-weight:600; }
html.mv .mv-pos-agr{ width:48px; height:48px; display:grid; place-items:center; border-radius:50%; flex:none; margin-left:-4px; }
html.mv .mv-pos-agr.mv-tap::after{ inset:4px; border-radius:50%; }
html.mv .mv-pos-agr-c{ width:40px; height:40px; border-radius:50%; display:grid; place-items:center; background:var(--mv-pri-cont); color:var(--mv-on-pri-cont); }
html.mv .mv-pos-vacio{ padding-top:32px; }
html.mv #mvPosMas .mv-ver-mas{ margin-top:0; }
html.mv .mv-pos-completo{ margin-top:32px; text-align:center; }
html.mv .mv-pos-completo .mv-btn{ width:100%; }
html.mv .mv-pos-completo p{ margin-top:8px; font-size:.8125rem; line-height:1.125rem; color:var(--mv-tx3); }

/* ── 4 · barra del carrito sobre la barra inferior (estilo_pos.css .carro) ── */
html.mv .mv-pos-barra{
  position:fixed; left:12px; right:12px; z-index:240;
  bottom:calc(var(--mv-nav-h) + var(--mv-bot) + 8px + var(--mv-pos-vc,0px));
  height:64px; border-radius:16px; background:var(--mv-carro-bg); color:#FFFFFF;
  display:flex; align-items:center; padding-right:8px; box-shadow:var(--mv-sombra-2);
  opacity:0; visibility:hidden; pointer-events:none; transform:translateY(calc(100% + 16px));
  transition:transform .3s var(--mv-e-std),opacity .2s linear,visibility 0s linear .3s;
}
html.mv.mv-pos-carro .mv-pos-barra{ transform:none; opacity:1; visibility:visible; pointer-events:auto; transition-delay:0s; }
html.mv .mv-pos-barra-i{ flex:1; height:100%; display:flex; align-items:center; gap:12px; padding:0 8px 0 12px; border-radius:16px 0 0 16px; text-align:left; min-width:0; color:#FFFFFF; }
html.mv .mv-pos-barra-n{ min-width:36px; height:36px; padding:0 8px; border-radius:18px; background:rgba(255,255,255,.12); display:grid; place-items:center; flex:none; }
html.mv .mv-pos-barra-t{ min-width:0; }
html.mv .mv-pos-barra-t small{ display:block; font-size:.75rem; line-height:1rem; color:rgba(255,255,255,.74); white-space:nowrap; }
html.mv .mv-pos-barra-t b{ display:block; font-size:1.0625rem; line-height:1.375rem; font-weight:700; letter-spacing:-.015em; white-space:nowrap; }
html.mv .mv-pos-cobrar{ height:48px; padding:0 20px; border-radius:24px; background:var(--mv-lha-azul); color:#0F172A; font-weight:700; font-size:.9375rem; flex:none; }
html.mv .mv-pos-cobrar:disabled{ opacity:.5; cursor:default; }
/* el snackbar (#toast, z 300) sube por encima de la barra del carrito; el aviso de pedidos va arriba */
html.mv.mv-pos-on.mv-pos-carro[data-mv-pagina="facturar"] #toast{ bottom:calc(var(--mv-nav-h) + var(--mv-bot) + 84px + var(--mv-pos-vc,0px)); }
/* con la hoja del carrito abierta, el snackbar queda justo encima de su pie (el botón de cobrar/emitir) */
html.mv.mv-pos-on.mv-bloqueo[data-mv-pagina="facturar"] #toast{ bottom:calc(var(--mv-bot) + var(--mv-pos-kb,0px) + 88px); }
html.mv[data-mv-pagina="facturar"] .cotToast{
  top:calc(var(--mv-barra-h) + var(--mv-top) + 8px); bottom:auto; left:12px; right:12px; max-width:none; border-radius:12px;
}

/* ── 5 · hoja del carrito: sube con el teclado virtual (movil_pos.js mide visualViewport) ── */
html.mv .mv-hoja.mv-pos-hoja{ bottom:var(--mv-pos-kb,0px); max-height:calc(100% - 40px - var(--mv-top) - var(--mv-pos-kb,0px)); }
html.mv .mv-hoja.mv-pos-hoja.mv-hoja-completo{ height:calc(100% - 40px - var(--mv-top) - var(--mv-pos-kb,0px)); }
html.mv .mv-pos-hoja .mv-hoja-pie .mv-btn-texto{ padding:0 12px; }

/* línea del carrito (estilo_listas_pos.css .lx-f.lin): stepper 128 × 48, % de 48 de toque, subtotal a la derecha */
html.mv .mv-fila.mv-pos-lin{ display:block; padding:12px calc(var(--lx-x) - 12px) 12px var(--lx-x); }
html.mv .mv-pos-lin-cab{ display:flex; align-items:flex-start; gap:4px; }
html.mv .mv-pos-lin-cab .mv-fila-t{ padding-top:2px; }
html.mv .mv-pos-lin-cab .mv-fila-t>b{ white-space:normal; }
html.mv .mv-pos-lin-cab .mv-ib{ margin:-8px 0 -12px; color:var(--mv-tx2); }
html.mv .mv-pos-lin-ctl{ display:flex; align-items:center; gap:8px; margin-top:4px; padding-right:12px; }
html.mv .mv-pos-stp{ position:relative; display:flex; align-items:center; width:128px; height:48px; flex:none; }
html.mv .mv-pos-stp::before,html.mv .mv-pos-dsc::before{
  content:''; position:absolute; inset:4px 0; pointer-events:none; box-shadow:inset 0 0 0 1px var(--mv-borde); transition:box-shadow .12s linear;
}
html.mv .mv-pos-stp::before{ border-radius:20px; }
html.mv .mv-pos-st{ width:44px; height:48px; display:grid; place-items:center; flex:none; color:var(--mv-pri); border-radius:50%; }
html.mv .mv-pos-st.mv-tap::after{ inset:6px 4px; border-radius:50%; }
html.mv .mv-pos-st-c{ width:36px; height:36px; border-radius:50%; display:grid; place-items:center; }
html.mv .mv-pos-st:disabled{ color:var(--mv-tx3); opacity:.5; cursor:default; }
html.mv .mv-pos-stp input,html.mv .mv-pos-dsc input{
  min-width:0; min-height:0; height:40px; border:0; border-radius:0; background:none; box-shadow:none; padding:0; margin:0;
  font-family:inherit; font-size:1rem; color:var(--mv-tx); outline:none; caret-color:var(--mv-pri); font-variant-numeric:tabular-nums;
}
html.mv .mv-pos-stp input{ width:40px; flex:1; text-align:center; font-weight:650; }
html.mv .mv-pos-stp input:focus-visible,html.mv .mv-pos-dsc input:focus-visible{ outline:none; border-color:transparent; }
html.mv .mv-pos-dsc{
  position:relative; display:flex; align-items:center; gap:4px; height:48px; padding:0 10px 0 12px; flex:none; cursor:text;
  font-size:.8125rem; line-height:1.125rem; color:var(--mv-tx2);
}
html.mv .mv-pos-dsc::before{ border-radius:12px; }
html.mv .mv-pos-dsc input{ width:32px; text-align:right; font-weight:600; }
html.mv .mv-pos-dsc i{ font-style:normal; font-size:.875rem; }
html.mv .mv-pos-stp:focus-within::before,html.mv .mv-pos-dsc:focus-within::before{ box-shadow:inset 0 0 0 2px var(--mv-pri); }
html.mv .mv-pos-stp.inv::before,html.mv .mv-pos-dsc.inv::before{ box-shadow:inset 0 0 0 2px var(--mv-er); }
html.mv .mv-pos-lin-tot{ margin-left:auto; text-align:right; white-space:nowrap; }
html.mv .mv-pos-lin-tot b{ display:block; font-size:.9375rem; line-height:1.25rem; font-weight:650; letter-spacing:-.01em; }
html.mv .mv-pos-lin-tot small{ display:block; margin-top:2px; font-size:.75rem; line-height:1rem; color:var(--mv-tx2); }
html.mv .mv-pos-lin-av{ display:flex; align-items:center; gap:6px; margin-top:4px; font-size:.8125rem; line-height:1.125rem; font-weight:600; color:var(--mv-av); }
/* viales y presentaciones: el desglose y la modalidad del vial suelto; precio editable (flete / autorizado) */
html.mv .mv-pos-lin-det{ display:flex; align-items:center; flex-wrap:wrap; gap:0 8px; margin-top:2px; font-size:.8125rem; line-height:1.125rem; color:var(--mv-tx2); }
html.mv .mv-pos-seg{ display:inline-flex; }
html.mv .mv-pos-segb{ height:48px; display:flex; align-items:center; }
html.mv .mv-pos-segb>span{
  height:32px; display:flex; align-items:center; padding:0 12px; font-size:.8125rem; font-weight:600; color:var(--mv-tx2);
  box-shadow:inset 0 0 0 1px var(--mv-borde);
}
html.mv .mv-pos-segb:first-child>span{ border-radius:16px 0 0 16px; }
html.mv .mv-pos-segb:last-child>span{ border-radius:0 16px 16px 0; margin-left:-1px; }
html.mv .mv-pos-segb[aria-pressed="true"]>span{ background:var(--mv-pri-cont); color:var(--mv-on-pri-cont); box-shadow:none; }
html.mv .mv-pos-lin-pr{ margin-top:2px; }
html.mv .mv-pos-dsc.mv-pos-pr{ display:inline-flex; }
html.mv .mv-pos-dsc.mv-pos-pr input{ width:88px; }
html.mv .mv-pos-dsc.mv-pos-pr::before{ box-shadow:inset 0 0 0 1px var(--mv-av); }

/* totales (estilo_pos.css .tot): subtotal, descuentos, IVA, retenciones y total */
html.mv .mv-pos-tot{ padding:14px 8px 4px; }
html.mv .mv-pos-tot-f{ display:flex; justify-content:space-between; gap:12px; font-size:.875rem; line-height:1.75rem; color:var(--mv-tx2); }
html.mv .mv-pos-tot-f>span:last-child{ white-space:nowrap; }
html.mv .mv-pos-tot-f.g{
  margin-top:6px; padding-top:10px; border-top:1px solid var(--mv-linea);
  color:var(--mv-tx); font-size:1.25rem; line-height:1.75rem; font-weight:700; letter-spacing:-.018em;
}
html.mv .mv-pos-auth{ margin:12px 8px 0; }
html.mv .mv-pos-auth-acc{ display:flex; flex-wrap:wrap; gap:0 4px; margin:8px 0 0; }
html.mv .mv-pos-auth-acc .mv-btn-texto{ height:48px; }

/* ── 6 · paso «Cobrar» (no está en la muestra: se diseña con las piezas de BC) ── */
html.mv .mv-pos-sec{ margin-top:4px; }
html.mv .mv-pos-sec+.mv-pos-sec{ margin-top:12px; }
html.mv .mv-pos-hoja .mv-pos-sec .mv-sub-h{ margin:12px 8px 8px; }
html.mv .mv-pos-hoja .mv-pos-sec:first-child .mv-sub-h{ margin-top:0; }
html.mv .mv-pos-campo{ margin-top:12px; }
html.mv .mv-pos-cli-sel{ display:flex; align-items:center; gap:12px; min-height:64px; padding:4px 0 4px 8px; }
html.mv .mv-avatar.mv-pos-cli-av{ width:40px; height:40px; flex:none; font-size:.875rem; }
html.mv .mv-pos-cli-t{ flex:1; min-width:0; }
html.mv .mv-pos-cli-t b{ display:block; font-size:.9375rem; line-height:1.25rem; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
html.mv .mv-pos-cli-t small{ display:block; margin-top:2px; font-size:.8125rem; line-height:1.125rem; color:var(--mv-tx2); }
html.mv .mv-busc.mv-pos-cli-busc{ margin-top:0; }
html.mv .mv-pos-falta .mv-busc{ box-shadow:0 0 0 2px var(--mv-er); }
html.mv .mv-pos-falta .mv-sub-h{ color:var(--mv-er); }
html.mv .mv-pos-ayuda{ font-size:.8125rem; line-height:1.125rem; color:var(--mv-tx2); padding:10px 8px 0; }
html.mv .mv-pos-cli-res .mv-lista{ margin-top:4px; }
html.mv .mv-pos-rets{ margin-top:12px; }
html.mv .mv-pos-op-t{ flex:1; min-width:0; }
html.mv .mv-pos-op-v{ flex:none; font-size:.875rem; color:var(--mv-tx2); font-variant-numeric:tabular-nums; white-space:nowrap; }
html.mv .mv-opcion[aria-checked="true"] .mv-pos-op-v{ color:var(--mv-tx); font-weight:600; }
html.mv .mv-pos-fila2{ display:flex; align-items:flex-start; gap:12px; }
html.mv .mv-pos-fila2>.mv-campo{ flex:1; min-width:0; }
html.mv .mv-pos-fila2>.mv-pos-medio{ flex:1.35; }
html.mv .mv-pos-fila2>.mv-ib{ margin:4px -8px 0 -4px; color:var(--mv-tx2); }
html.mv .mv-pos-valor input{ text-align:right; font-variant-numeric:tabular-nums; }
html.mv .mv-pos-pago+.mv-pos-pago{ margin-top:16px; }
html.mv .mv-pos-saldo{ display:flex; align-items:center; gap:6px; margin:10px 8px 0; font-size:.8125rem; line-height:1.125rem; font-weight:600; }
html.mv .mv-pos-saldo.ok{ color:var(--mv-ok); } html.mv .mv-pos-saldo.av{ color:var(--mv-av); } html.mv .mv-pos-saldo.er{ color:var(--mv-er); }
html.mv .mv-pos-pago-add{ margin-top:4px; height:48px; }
html.mv .mv-pos-pv{ min-height:60px; }
html.mv .mv-pos-gira{ transform:rotate(180deg); }
html.mv .mv-pos-pv-c{ padding-bottom:4px; }
html.mv .mv-pos-hoja #mvPosEnvio{ margin-top:16px; }

/* ── 7 · modales del POS en el teléfono (#modal, z 260, encima de la hoja): cierre de 48 px y formularios a
       una columna (crear tercero, generar código). movil.css no toca .modal. ── */
html.mv[data-mv-pagina="facturar"] #modal .x{ width:48px; height:48px; top:4px; right:4px; }
html.mv[data-mv-pagina="facturar"] #modal .mbox{ border-radius:24px; }
html.mv[data-mv-pagina="facturar"] #modal .grid[style*="1fr 1fr"]{ grid-template-columns:minmax(0,1fr) !important; }
html.mv[data-mv-pagina="facturar"] #modal .grid[style*="1fr 1fr"]>div[style*="grid-column"]{ grid-column:auto !important; }
html.mv[data-mv-pagina="facturar"] #modal .btn{ min-height:48px; }
html.mv[data-mv-pagina="facturar"] #modal pre{ max-width:100%; }

/* ── 8 · movimiento reducido: sin desplazamientos ── */
@media (prefers-reduced-motion: reduce){
  html.mv .mv-pos-barra{ transform:none; transition:opacity .15s linear,visibility 0s linear .15s; }
  html.mv.mv-pos-carro .mv-pos-barra{ transition-delay:0s; }
  html.mv .mv-pos-cab{ transition:none; }
}
