/* ==========================================================================
   Carrito, cobro y comprobante — mismos tokens de app.css
   Teléfono (360–430 px): carrito y Cobrar a pantalla completa, con el pie fijo
   (subtotal, descuentos, total y la acción principal) en la zona del pulgar.
   Todo lo tocable mide 48 px o más.
   ========================================================================== */

/* ---------- Hojas a pantalla completa (carrito y Cobrar en el teléfono) ---------- */
.sheet.sheet-full {
  top: 0; max-height: none; height: 100%;
  border-radius: 0;
  padding-top: var(--safe-top);
  padding-bottom: 0;                       /* el pie de cada pantalla ya respeta la zona segura */
  transform: translateX(100%);
}
.sheet.sheet-full.is-open { transform: none; }
.head-full {
  flex: none;
  min-height: 64px; padding: var(--s1) var(--s3) var(--s1) var(--s1);
  border-bottom: 1px solid var(--line);
}
.head-text { flex: 1; min-width: 0; }
.head-full h2 { font-size: var(--fs-xl); font-weight: 800; }
.head-full h2:focus { outline: none; }
.head-full h2:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.head-full .cart-counts { line-height: 1.3; }

/* ---------- Carrito: una zona que se desplaza y un pie fijo ---------- */
.cart-host { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.cart-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.cart-lines { list-style: none; margin: 0; padding: 0; }
.cart-empty { display: grid; justify-items: center; gap: var(--s2); padding: var(--s8) var(--s5); text-align: center; color: var(--ink-2); }
.cart-empty svg.ic { width: 40px; height: 40px; }
.cart-empty .state-title { color: var(--ink); }
.cart-panel { position: relative; }        /* el menú ⋮ se posiciona dentro del panel */

/* Fila tocable con etiqueta, valor y acción (cliente, quién atiende, descuento general) */
.row-btn {
  display: flex; align-items: center; gap: var(--s3);
  width: 100%; min-height: 64px; padding: var(--s2) var(--s4);
  border: 0; background: transparent; color: var(--ink); text-align: left;
  touch-action: manipulation;
}
.row-btn:active { background: var(--surface-2); }
.row-btn:focus-visible { outline-offset: -3px; border-radius: var(--r-md); }
.row-btn > svg:first-child { color: var(--ink-2); }
.row-btn .grow { flex: 1; min-width: 0; display: grid; gap: 1px; }
.row-label { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
.row-value {
  font-weight: 700; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.row-act { flex: none; font-size: var(--fs-sm); font-weight: 700; color: var(--accent-ink); }
.cart-client { border-bottom: 1px solid var(--line); }

/* Avisos: stock y autorización de descuentos */
.cart-warn {
  display: flex; align-items: flex-start; gap: var(--s2);
  margin: var(--s2) var(--s4); padding: var(--s2) var(--s3);
  border-radius: var(--r-md); background: var(--warn-soft); color: var(--ink); font-size: var(--fs-sm);
}
.cart-warn svg.ic { width: 20px; height: 20px; color: var(--warn); flex: none; margin-top: 1px; }
.cart-auth {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s1) var(--s3); align-items: start;
  margin: var(--s3) var(--s4) var(--s2); padding: var(--s3) var(--s4);
  border-radius: var(--r-md); background: var(--warn-soft); box-shadow: inset 0 0 0 1px var(--warn-icon);
}
.cart-auth > svg { color: var(--warn); margin-top: 1px; }
.cart-auth-title { margin: 0; font-weight: 800; }
.cart-auth-text { margin: 0; font-size: var(--fs-sm); color: var(--ink); }
.cart-auth .btn { grid-column: 2; justify-self: start; margin-top: var(--s2); }

/* ---------- Línea del carrito ----------
   Nombre completo (hasta 3 renglones) con el menú ⋮ visible; − [cantidad] + y el total
   abajo; +5 … +100 aparecen mientras se edita la cantidad. Deslizar a la izquierda elimina. */
.cl {
  position: relative; overflow: hidden;
  border-bottom: 1px solid var(--line);
  content-visibility: auto; contain-intrinsic-size: auto 148px;
}
.cl-swipe {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: flex-end; gap: var(--s2);
  padding-right: var(--s6);
  background: var(--crit-soft); color: var(--crit); font-weight: 800;
  opacity: 0;
}
.cl.is-swiping .cl-swipe, .cl.swipe-armed .cl-swipe { opacity: 1; }
.cl.swipe-armed .cl-swipe { background: var(--crit); color: var(--surface); }
.cl-inner {
  position: relative;
  padding: var(--s3) var(--s2) var(--s3) var(--s4);
  background: var(--surface);
  touch-action: pan-y;                      /* el gesto horizontal llega a la app; el vertical desplaza */
  transition: transform .2s var(--ease);
}
.cl.is-swiping .cl-inner { transition: none; }
.cl.flash .cl-inner { animation: cl-added .6s var(--ease); }
@keyframes cl-added { from { background: var(--ok-soft); } to { background: var(--surface); } }
.cl-head { display: flex; align-items: flex-start; gap: var(--s1); }
.cl-head .p-name { flex: 1; min-width: 0; padding-top: 2px; -webkit-line-clamp: 3; }
.cl-more { margin: -6px 0 -6px 0; color: var(--ink-2); }
.cl-inner > .p-meta { margin: 0 var(--s8) 0 0; }
.cl-warn { display: flex; gap: 6px; align-items: flex-start; margin: 6px 0 0; font-size: var(--fs-sm); color: var(--warn); font-weight: 600; }
.cl-warn svg.ic { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.cl-disc { display: flex; gap: 6px; align-items: center; margin: 4px 0 0; font-size: var(--fs-sm); color: var(--ok); font-weight: 700; }
.cl-disc svg.ic { width: 18px; height: 18px; flex: none; }
.cl-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s3);
  margin-top: var(--s2); padding-right: var(--s2);
}
.cl-total { margin: 0 0 0 auto; font-weight: 800; font-size: var(--fs-lg); white-space: nowrap; }
.stepper { flex: none; display: flex; align-items: center; gap: 2px; padding: 2px; border-radius: var(--r-pill); background: var(--surface-2); }
.step {
  width: var(--tap); height: var(--tap);
  display: grid; place-items: center;
  border: 0; border-radius: var(--r-pill); background: transparent; color: var(--ink);
  touch-action: manipulation;
}
.step:active { background: var(--surface-3); }
.step[data-remove] { color: var(--crit); }
.step-input {
  width: 76px; height: var(--tap); padding: 0 4px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink);
  font-size: var(--fs-lg); font-weight: 800; text-align: center;   /* 17 px: el teléfono no hace zoom al enfocar */
}
.step-input:focus { outline: 3px solid var(--focus); outline-offset: 1px; }
.cl-quick { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s2); margin: var(--s3) var(--s2) 0 0; }
.cl-err { margin: var(--s2) var(--s2) 0 0; font-size: var(--fs-sm); color: var(--crit); font-weight: 700; }

/* Menú ⋮ de la línea */
.line-menu {
  position: absolute; z-index: 6;
  width: max-content; min-width: 232px; max-width: calc(100% - 16px);
  padding: var(--s1) 0;
  border-radius: var(--r-md); background: var(--surface);
  box-shadow: 0 0 0 1px var(--line-strong), var(--float-shadow);
}
.line-menu .menu-item { min-height: var(--tap-lg); padding: var(--s2) var(--s4); gap: var(--s3); }
.menu-item.is-danger, .menu-item.is-danger > svg:first-child { color: var(--crit); }

/* Pie: subtotal, descuentos y total siempre a la vista */
.cart-foot {
  flex: none;
  padding: var(--s3) var(--s4) calc(var(--s3) + var(--safe-bottom));
  border-top: 1px solid var(--line); background: var(--surface);
  box-shadow: var(--foot-shadow);
}
.cart-panel .cart-foot { padding-bottom: var(--s4); }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 2px var(--s4); margin: 0 0 var(--s3); font-size: var(--fs-sm); }
.totals dt { color: var(--ink-2); }
.totals dd { margin: 0; text-align: right; font-weight: 700; }
.totals dd.is-disc { color: var(--ok); }
.totals .grand { font-size: var(--fs-xl); font-weight: 800; color: var(--ink); }
.cart-foot-actions { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s3); }
.cart-foot-actions .btn-primary { min-height: var(--tap-lg); font-size: var(--fs-lg); border-radius: var(--r-lg); }

/* ---------- Descuento ---------- */
.desc-ctx { display: grid; gap: 2px; margin: 0 0 var(--s4); }
.desc-ctx strong { line-height: 1.3; }
.desc-ctx span { font-size: var(--fs-sm); color: var(--ink-2); }
.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; margin: 0 0 var(--s4); border-radius: var(--r-pill); background: var(--surface-2); }
.seg-btn { min-height: var(--tap); border: 0; border-radius: var(--r-pill); background: transparent; color: var(--ink-2); font-weight: 700; touch-action: manipulation; }
.seg-btn[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--raised-shadow), inset 0 0 0 1px var(--line-strong); }
.d-valor { font-size: 1.5rem; font-weight: 800; text-align: right; }
#desc-body .chips { margin-top: 0; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.desc-result { margin: var(--s3) 0 0; font-weight: 700; }
.desc-result:empty, .desc-perm:empty { display: none; }
.desc-perm { display: flex; gap: var(--s2); align-items: flex-start; margin: var(--s2) 0 0; font-size: var(--fs-sm); color: var(--ink-2); }
.desc-perm.is-warn { padding: var(--s2) var(--s3); border-radius: var(--r-md); background: var(--warn-soft); color: var(--ink); font-weight: 700; }
.desc-perm.is-warn svg.ic { width: 20px; height: 20px; flex: none; color: var(--warn); }
#sheet-desc .sheet-actions, #sheet-pin .sheet-actions { margin-top: var(--s4); }
#sheet-desc .sheet-actions .btn-primary, #sheet-pin .sheet-actions .btn-primary { flex: 2 1 auto; min-height: var(--tap-lg); border-radius: var(--r-lg); font-size: var(--fs-lg); }

/* ---------- PIN de gerente ---------- */
.pin-ctx { margin: 0 0 var(--s3); font-size: var(--fs-sm); color: var(--ink-2); }
.demo-hint { margin: 0 0 var(--s3); padding: var(--s2) var(--s3); border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink); }
.pin-who { margin-bottom: var(--s2); }
.pin-who .chips { margin-top: 0; }
.pin-field { display: grid; gap: var(--s2); }
.pin-field label { font-weight: 700; font-size: var(--fs-sm); }
.pin-input {
  width: 100%; min-height: 64px; padding: 0 var(--s4);
  border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--ground); color: var(--ink);
  font-size: 2rem; font-weight: 800; letter-spacing: 0.4em; text-align: center;
}
.pin-input:focus { outline: 3px solid var(--focus); outline-offset: 1px; }
.pin-keypad { margin-top: var(--s3); }
.key-ok { background: var(--accent); color: var(--on-accent); }
.key-ok:active { background: var(--accent-press); }

/* ---------- Listas para elegir (cliente, quién atiende) ---------- */
.opt-list { list-style: none; margin: 0 calc(var(--s5) * -1); padding: 0; }
.opt-list li + li { border-top: 1px solid var(--line); }
.opt-row {
  display: flex; align-items: center; gap: var(--s3);
  width: 100%; min-height: 64px; padding: var(--s2) var(--s5);
  border: 0; background: transparent; color: var(--ink); text-align: left;
  touch-action: manipulation;
}
.opt-row:active { background: var(--surface-2); }
.opt-row:focus-visible { outline-offset: -3px; border-radius: var(--r-md); }
.opt-row > svg:first-child { color: var(--ink-2); }
.opt-row[aria-pressed="true"] { background: var(--accent-soft); }
.opt-row .grow { flex: 1; min-width: 0; }
.opt-title { display: block; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.opt-sub { display: block; font-size: var(--fs-sm); color: var(--ink-2); overflow-wrap: anywhere; }
.opt-check { color: var(--accent-ink); }
.warn-text { color: var(--warn); font-weight: 700; }
/* Cliente: buscador arriba y «Nuevo cliente» abajo, fijos; la lista se desplaza entre ambos */
#cliente-body { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; padding-bottom: 0; }
.cli-search { flex: none; padding-bottom: var(--s2); }
.cli-search .search-field { min-height: var(--tap-lg); }
.cli-search .search-field input { min-height: var(--tap-lg); }
.cli-results { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 calc(var(--s5) * -1); padding: 0 var(--s5); }
#cli-results .results-meta { padding-inline: 0; }
.cli-new { flex: none; padding: var(--s3) 0 var(--s4); border-top: 1px solid var(--line); }
#cliente-body > .cli-form { flex: 1; min-height: 0; overflow-y: auto; margin: 0 calc(var(--s5) * -1); padding: 0 var(--s5) var(--s4); }
.cli-form .sheet-actions { margin-top: var(--s4); }

/* ---------- Cobrar ---------- */
#sheet-cobrar .sheet-body { display: flex; flex-direction: column; flex: 1; min-height: 0; padding: 0; overflow: hidden; }
.cobrar { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.cobrar-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--s2) var(--s4) var(--s5); scroll-padding-block: var(--s4); }
.cobrar-scroll .cart-auth, .cobrar-scroll .cart-warn { margin-inline: 0; }
.pay-rows { margin: var(--s2) calc(var(--s4) * -1) var(--s4); border-block: 1px solid var(--line); }
.cobrar-scroll .pay-total { padding: var(--s1) 0 var(--s3); }
.cobrar-scroll > .cart-warn, .cobrar-scroll > .note { margin-top: 0; }
@container app (max-height: 700px) {
  .cobrar-scroll .pay-total .amount { font-size: 2rem; }
  .cobrar-scroll .pay-meta { display: none; }
}
.pay-rows > * + * { border-top: 1px solid var(--line); }
.row-field { display: grid; gap: var(--s2); padding: var(--s3) var(--s4); }
.row-field label { font-weight: 700; font-size: var(--fs-sm); }
.methods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
.method {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 72px; padding: var(--s2);
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink);
  font-weight: 700; text-align: center; line-height: 1.2;
  cursor: pointer; touch-action: manipulation;
}
.method input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.method svg.ic { color: var(--ink-2); }
.method:active { background: var(--surface-2); }
.method:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.method.is-on { border: 2px solid var(--accent); padding: calc(var(--s2) - 1px); background: var(--accent-soft); color: var(--accent-ink); }
.method.is-on svg.ic { color: var(--accent-ink); }
.method-detail { margin: var(--s4) 0; }
.method-detail:empty { display: none; }
.method-detail > .help:first-child { margin-top: 0; }
.method-detail > .help + .field { margin-top: var(--s3); }
#c-cash { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s2); margin: 0 0 var(--s2); }
#c-cash .chip { justify-content: center; padding: 0 var(--s2); }
.pay-change.is-short { color: var(--crit); }
.pay-change:empty { display: none; }
.credit-box {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s1) var(--s3); align-items: start;
  margin-bottom: var(--s3); padding: var(--s3) var(--s4);
  border-radius: var(--r-md); background: var(--surface-2);
}
.credit-box p { margin: 0; }
.credit-box .help { margin-top: 2px; }
.credit-box.is-err { background: var(--crit-soft); }
.credit-box.is-err > svg { color: var(--crit); }
.credit-box .btn { margin-top: var(--s2); }
.btn-split { width: 100%; margin: 0 0 var(--s4); }
.split { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.split-row { padding: var(--s3); border-radius: var(--r-md); box-shadow: inset 0 0 0 1px var(--line-strong); }
.split-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "metodo quitar" "monto monto"; gap: var(--s2); align-items: center; }
.split-head select { grid-area: metodo; }
.split-head input { grid-area: monto; }
.split-head .icon-btn { grid-area: quitar; }
.split-row .field { margin: var(--s2) 0 0; }
.split-auto { margin: var(--s1) 0 0; }
.split-state { margin: var(--s3) 0; font-weight: 800; color: var(--ok); }
.split-state.is-short { color: var(--crit); }
.split-state:empty { display: none; }
.cobrar-foot {
  flex: none;
  padding: var(--s3) var(--s4) calc(var(--s3) + var(--safe-bottom));
  border-top: 1px solid var(--line); background: var(--surface);
  box-shadow: var(--foot-shadow);
}
.foot-line { display: flex; justify-content: space-between; gap: var(--s3); font-size: var(--fs-sm); color: var(--ink-2); }
.foot-line strong { color: var(--ink); font-weight: 700; }
.foot-line strong.is-disc { color: var(--ok); }
.foot-grand { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); margin: 2px 0 var(--s2); font-size: var(--fs-xl); font-weight: 800; }
.foot-change { margin: 0 0 var(--s2); padding: var(--s2) var(--s3); border-radius: var(--r-md); background: var(--ok-soft); color: var(--ink); text-align: center; }
.foot-change strong { font-size: var(--fs-xl); font-weight: 800; }
.cobrar-foot .field-error { margin: 0 0 var(--s2); }

/* ---------- Venta registrada ---------- */
.venta.is-done .venta-done { padding-bottom: 0; }
.done-card { gap: var(--s3); }
.done-card.is-arming { pointer-events: none; }    /* un doble toque en Confirmar no cae aquí */
.done-hero {
  width: 100%; display: grid; justify-items: center; gap: var(--s1);
  padding: var(--s5) var(--s4) var(--s4); border-radius: var(--r-lg); background: var(--ok-soft);
}
.done-icon { background: var(--ok); color: var(--surface); }
.done-card h2 { margin: var(--s1) 0 0; }
.done-num { margin: 0; color: var(--ink-2); }
.done-num strong { color: var(--ink); }
.done-card > .amount { justify-content: center; }
.done-change-big {
  width: 100%; margin: 0; padding: var(--s3) var(--s4);
  border-radius: var(--r-md); background: var(--surface); box-shadow: inset 0 0 0 2px var(--ok);
  font-size: var(--fs-lg); font-weight: 700;
}
.done-change-big strong { display: block; font-size: var(--fs-2xl); font-weight: 800; }
.done-pay { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: var(--fs-sm); color: var(--ink-2); }
.done-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); width: 100%; }
.done-tools .btn { min-height: var(--tap-lg); }
.done-detail { margin-top: 0; }
.done-actions {
  position: sticky; bottom: 0; z-index: 1;
  padding: var(--s3) 0 calc(var(--s4) + var(--safe-bottom));
  background: linear-gradient(to bottom, transparent, var(--ground) 16px);
}
.done-back { width: 100%; margin-bottom: var(--s2); }
@container app (max-height: 700px) {
  .done-hero { padding: var(--s3) var(--s4); gap: 2px; }
  .done-icon { width: 52px; height: 52px; }
  .done-icon svg.ic { width: 30px; height: 30px; }
  .done-card h2 { font-size: var(--fs-xl); }
}

/* ---------- Comprobante (no fiscal) ---------- */
.recibo-preview { display: flex; justify-content: center; padding: var(--s2) 0 var(--s3); }
.recibo {
  width: 100%; max-width: 320px; padding: var(--s4);
  background: var(--papel); color: var(--papel-tinta);
  font-family: var(--font-code); font-size: 12.5px; line-height: 1.35; text-align: left;
  border-radius: 4px; box-shadow: 0 0 0 1px var(--line), var(--paper-shadow);
}
.recibo p { margin: 0; }
.rc-center { text-align: center; }
.rc-strong { font-weight: 700; }
.rc-sep { height: 0; margin: 6px 0 !important; border-top: 1px dashed var(--papel-tinta); }
.rc-lines { list-style: none; margin: 0; padding: 0; }
.rc-lines li + li { margin-top: 4px; }
.rc-row { display: flex; justify-content: space-between; gap: 8px; }
.rc-row > span:last-child { white-space: nowrap; }
.rc-total { font-weight: 700; font-size: 1.15em; }
/* Copia para imprimir: fuera de la vista; al imprimir es lo único visible */
.recibo-print { position: fixed; left: -10000px; top: 0; }
.recibo-print .recibo { max-width: none; padding: 0; font-size: 11px; box-shadow: none; border-radius: 0; }
@media print {
  html.printing-recibo, html.printing-recibo body { height: auto !important; min-height: 0 !important; background: var(--papel) !important; }
  html.printing-recibo body { display: block !important; margin: 0; }
  html.printing-recibo body > :not(#recibo) { display: none !important; }
  html.printing-recibo #recibo { display: block !important; position: static; }
}

/* ---------- Ventana ancha: carrito y Cobrar como diálogo ---------- */
@container app (min-width: 840px) or ((min-width: 600px) and (max-height: 560px)) {
  .sheet.sheet-full {
    top: 50%; bottom: auto; left: 50%; right: auto;
    width: min(560px, calc(100% - 64px)); height: min(800px, calc(100% - 48px));
    border-radius: 20px; padding-top: 0;
    transform: translate(-50%, -46%); opacity: 0;
  }
  .sheet.sheet-full.is-open { transform: translate(-50%, -50%); opacity: 1; }
  .head-full { padding-left: var(--s2); }
}
/* Diálogo en teléfono horizontal: casi todo el alto */
@container app (min-width: 600px) and (max-height: 560px) {
  .sheet.sheet-full { height: calc(100% - 16px); }
}
/* Poco alto (teclado del teléfono abierto): pie más compacto; el cambio se ve junto al campo */
@container app (max-height: 560px) {
  .cobrar-foot .btn-xl { min-height: var(--tap-lg); }
  .foot-change { display: none; }
  /* Con el teclado del teléfono abierto, mientras se escribe una cantidad el pie solo muestra los totales */
  .cart-host:has(.step-input:focus) .cart-foot-actions { display: none; }
  .cart-host:has(.step-input:focus) .totals { margin-bottom: 0; }
}
/* 360 px y menos: el pie cede espacio a la lista */
@container app (max-width: 374px) {
  .cart-foot-actions .btn-ghost { padding-inline: var(--s3); }
  .cl-quick { gap: 6px; }
}

@media (forced-colors: active) {
  .method.is-on { border-color: Highlight; }
  .seg-btn[aria-pressed="true"], .chip[aria-pressed="true"], .opt-row[aria-pressed="true"] { outline: 2px solid Highlight; outline-offset: -2px; }
  .line-menu, .step-input, .pin-input, .split-row { border: 1px solid CanvasText; }
  .cl.swipe-armed .cl-swipe { forced-color-adjust: none; background: Mark; color: MarkText; }
}

/* ==========================================================================
   Venta central (V031): tarjeta registrada o procesada, confirmación del servidor, ventas del equipo,
   devoluciones e impresora
   ========================================================================== */
/* ---------- Tarjeta en Cobrar ---------- */
.card-help { display: flex; gap: var(--s2); align-items: flex-start; }
.card-help svg.ic { flex: none; width: 20px; height: 20px; margin-top: 1px; }
.method-detail .field-row > .field, .split-row .field-row > .field { flex: 1; min-width: 0; }
.card-ok { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3); border-radius: var(--r-md); background: var(--ok-soft); }
.card-ok > svg.ic { flex: none; width: 24px; height: 24px; color: var(--ok); }
.card-ok p { margin: 0 0 2px; }
.card-ok.is-prueba, .card-proc.is-prueba { box-shadow: inset 0 0 0 2px var(--warn); }
.card-prueba { display: flex; gap: var(--s2); align-items: center; margin: var(--s2) 0; padding: var(--s2) var(--s3); border-radius: var(--r-sm); background: var(--warn-soft); font-weight: 700; font-size: var(--fs-sm); }
.card-prueba svg.ic { flex: none; width: 18px; height: 18px; color: var(--warn-icon); }
.card-proc { margin-top: var(--s3); padding: var(--s3); border-radius: var(--r-md); background: var(--surface-2); }
.card-proc-t { display: flex; gap: var(--s2); align-items: center; margin: 0 0 var(--s2); }
.card-proc-t svg.ic { width: 20px; height: 20px; }
.card-proc .btn { width: 100%; }

/* ---------- Venta registrada: guardada en el equipo / confirmada por el servidor ---------- */
.done-sync { align-items: flex-start; }
.done-sync > div { display: grid; gap: 2px; }
.done-sync-t { margin: 0; font-weight: 800; }
.done-sync-x { margin: 0; display: flex; gap: var(--s1); align-items: flex-start; }
.done-sync-x svg.ic { width: 16px; height: 16px; margin-top: 2px; flex: none; }
.done-sync .btn { justify-self: start; margin-top: var(--s2); }
.done-sync[data-state="err"] { background: var(--crit-soft); }
.done-sync[data-state="err"] > svg.ic { color: var(--crit); }
.done-num-central { margin: 2px 0 0; font-weight: 800; font-size: var(--fs-lg); color: var(--ok); }
.done-more { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s2); width: 100%; }
.rc-nota { font-size: .9em; color: var(--papel-tinta); }
.rc-der { text-align: right; }

/* ---------- Encabezado de Vender: ventas del equipo y en espera ---------- */
.venta-ventas { position: relative; flex: none; }
.venta-ventas .badge { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill);
  background: var(--warn); color: var(--surface); font-size: var(--fs-xs); font-weight: 800; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--surface); }

/* ---------- Ventas de este equipo ---------- */
.vq-sec { margin: 0 0 var(--s4); }
.vq-h { display: flex; gap: var(--s2); align-items: center; margin: var(--s4) 0 var(--s2); font-size: var(--fs-md); font-weight: 800; }
.vq-h svg.ic { width: 20px; height: 20px; }
.vq-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.vq-dia { margin: var(--s3) 0 0; font-size: var(--fs-sm); font-weight: 800; color: var(--ink-2); }
.vq-row { display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: var(--tap-lg); padding: var(--s2) var(--s3);
  border: 0; border-radius: var(--r-md); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); font: inherit; text-align: left; }
button.vq-row { cursor: pointer; }
@media (hover: hover) { button.vq-row:hover { background: var(--surface-2); } }
button.vq-row[aria-disabled="true"] { opacity: .55; }
.vq-row .grow { display: grid; gap: 2px; min-width: 0; flex: 1; }
.vq-t, .vq-m { margin: 0; display: block; }
.vq-m { font-size: var(--fs-sm); color: var(--ink-2); overflow-wrap: anywhere; }
.vq-esp { background: var(--warn-soft); box-shadow: none; }
.vq-chip { display: inline-flex; align-items: center; gap: 4px; justify-self: start; margin-top: 2px; padding: 2px 8px 2px 6px; border-radius: var(--r-pill);
  background: var(--off-soft); font-size: var(--fs-xs); font-weight: 700; }
.vq-chip svg.ic { width: 14px; height: 14px; }
.vq-chip[data-tono="ok"] { background: var(--ok-soft); }
.vq-chip[data-tono="ok"] svg.ic { color: var(--ok); }
.vq-chip[data-tono="warn"] { background: var(--warn-soft); }
.vq-chip[data-tono="warn"] svg.ic { color: var(--warn-icon); }
.vq-chip[data-tono="err"] { background: var(--crit-soft); }
.vq-chip[data-tono="err"] svg.ic { color: var(--crit); }
.vq-q { margin: var(--s2) 0 var(--s3); }
.vq-back { display: inline-flex; align-items: center; gap: var(--s1); min-height: var(--tap); margin-bottom: var(--s2); }
.vq-estado { display: flex; gap: var(--s3); align-items: flex-start; margin: 0 0 var(--s3); padding: var(--s3); border-radius: var(--r-md); background: var(--off-soft); }
.vq-estado > svg.ic { flex: none; width: 24px; height: 24px; }
.vq-estado[data-tono="ok"] { background: var(--ok-soft); }
.vq-estado[data-tono="warn"] { background: var(--warn-soft); }
.vq-estado[data-tono="err"] { background: var(--crit-soft); }
.vq-estado .btn { margin-top: var(--s2); }
#ventas-body .done-tools { margin: 0 0 var(--s3); grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
#ventas-body .recibo-preview { margin-top: var(--s2); }

/* ---------- Devolución ---------- */
.sheet-body.dv-body { display: flex; flex-direction: column; flex: 1; min-height: 0; padding: 0; overflow: hidden; }
.dv-body > :not(.dv-scroll):not(.dv-foot) { margin-inline: var(--s4); }
.dv-body > :first-child:not(.dv-scroll) { margin-top: var(--s3); }
.dv-body:not(:has(.dv-scroll)) { overflow-y: auto; padding-bottom: calc(var(--s5) + var(--safe-bottom)); }
.dv-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--s3) var(--s4) var(--s5); }
.dv-venta { margin: var(--s2) 0 var(--s3); padding: var(--s3); border-radius: var(--r-md); background: var(--surface-2); }
/* «Elegir otra venta»: un enlace con su objetivo táctil de 48 dp */
.dv-body .link-btn[data-dv="otra"] { display: inline-flex; align-items: center; gap: var(--s1); min-height: var(--tap); min-width: var(--tap); }
.dv-ls { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.dv-l { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3); border-radius: var(--r-md); box-shadow: inset 0 0 0 1px var(--line); }
.dv-l.is-on { box-shadow: inset 0 0 0 2px var(--accent); }
.dv-l.is-sin { background: var(--ground); }
.dv-p { display: grid; gap: 2px; min-width: 0; }
.dv-n { font-weight: 700; overflow-wrap: anywhere; }
.dv-step { display: flex; align-items: center; gap: var(--s1); }
.dv-step .icon-btn[aria-disabled="true"] { opacity: .45; }
.dv-q { min-width: 44px; text-align: center; font-size: var(--fs-lg); font-weight: 800; }
.dv-extra { grid-column: 1 / -1; display: grid; gap: var(--s2); }
.dv-extra .field { margin: 0; }
.dv-foot .btn-xl { margin-top: var(--s1); }
.dv-listo { padding: var(--s4) 0 var(--s6); }
.dv-listo h3 { margin: var(--s2) 0 0; font-size: var(--fs-xl); font-weight: 800; }
.dv-listo h3:focus { outline: none; }
.dv-listo h3:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.dv-listo .done-sync[data-state="err"] { background: var(--crit-soft); }

/* ---------- Impresora ---------- */
.imp-estado { display: flex; gap: var(--s3); align-items: center; margin: 0 0 var(--s3); padding: var(--s3); border-radius: var(--r-md); background: var(--off-soft); }
.imp-estado > svg.ic { flex: none; width: 28px; height: 28px; }
.imp-estado[data-state="ok"] { background: var(--ok-soft); }
.imp-estado[data-state="ok"] > svg.ic { color: var(--ok); }
.imp-titulo { margin: 0; font-weight: 800; }
.imp-estado .help { margin: 0; }
.imp-acc { flex-wrap: wrap; }
.imp-acc .btn { flex: 1 1 200px; }
#imp-body .check-row { margin: var(--s2) 0; }
@media (prefers-reduced-motion: reduce) { .done-sync[data-state="sync"] svg { animation: none; } }

/* ---------- Disponibilidad y precio (V041; js/disponibilidad.js) ---------- */
#dp-body .fcard { margin: 0 0 var(--s3); }
.dp-prod { margin: 0 0 var(--s3); font-weight: 800; }
.dp-prod .code { margin-left: var(--s1); }
.dp-lead { margin: 0 0 var(--s3); font-size: var(--fs-sm); color: var(--ink-2); }
.dp-precio { margin: 0 0 var(--s2); font-size: var(--fs-xl); font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.dp-un { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.dp-cifras { margin: 0 0 var(--s1); font-size: var(--fs-sm); font-weight: 600; }
.dp-sub { margin: 0; font-size: var(--fs-sm); color: var(--ink-2); }
.dp-warn { display: flex; gap: var(--s2); align-items: flex-start; margin: var(--s2) 0 var(--s3); font-size: var(--fs-sm); font-weight: 600; color: var(--warn); }
.dp-warn svg.ic { width: 20px; height: 20px; flex: none; }
.dp-suc { margin: var(--s3) 0 var(--s2); font-size: var(--fs-sm); font-weight: 800; color: var(--ink-2); }
.dp-bods, .dp-lineas { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.dp-bod, .dp-l { display: grid; gap: 2px; padding: var(--s2) var(--s3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.dp-bod.is-aqui { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.dp-l.is-off { background: var(--surface-2); color: var(--ink-2); }
.dp-bod-h { display: flex; gap: var(--s2); align-items: center; justify-content: space-between; flex-wrap: wrap; }
.dp-bod-n, .dp-l-n { font-weight: 700; }
.dp-aqui { display: inline-block; margin-left: var(--s1); padding: 1px 6px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent-ink); font-size: var(--fs-xs); font-weight: 700; }
.dp-l-s { font-size: var(--fs-sm); color: var(--ink-2); }
.dp-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 6px; border-radius: var(--r-pill); background: var(--off-soft); font-size: var(--fs-xs); font-weight: 700; }
.dp-chip svg.ic { width: 14px; height: 14px; }
.dp-chip[data-tono="ok"] { background: var(--ok-soft); }
.dp-chip[data-tono="ok"] svg.ic { color: var(--ok); }
.dp-chip[data-tono="warn"] { background: var(--warn-soft); }
.dp-chip[data-tono="warn"] svg.ic { color: var(--warn-icon); }
.dp-chip[data-tono="err"] { background: var(--crit-soft); }
.dp-chip[data-tono="err"] svg.ic { color: var(--crit); }
.dp-pie { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; margin: var(--s2) 0 0; font-size: var(--fs-sm); color: var(--ink-2); }
.dp-cupo-f { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--s2); align-items: center; }
.dp-cupo-f .help { grid-column: 1 / -1; margin: 0; }
.dp-cupo-f .input { min-width: 0; }
