/* Farmacia Lucía · sistema de caja (demo). Pensado para personas mayores en teléfonos de gama baja:
   letra grande, botones grandes, pocas cosas por pantalla, sin fuentes descargadas ni librerías. */
:root {
  --verde: #0A6B45;
  --verde-osc: #064A30;
  --verde-tinte: #DDF1E6;
  --sol: #FFC83D;
  --sol-tinte: #FFF0C2;
  --ink: #14211A;
  --ink-2: #45544B;
  --fondo: #EEF2EC;
  --papel: #FFFFFF;
  --linea: #D3DCD5;
  --rojo: #B3261E;
  --rojo-tinte: #FCE4E1;
  --ambar: #7A4300;
  --azul: #1D4FB0;
  --azul-tinte: #E2EBFF;
  --radio: 14px;
  --tabs: 4.4rem;
  --seguro-abajo: env(safe-area-inset-bottom, 0px);
  font-size: 112.5%;                       /* 18px: la letra normal ya es grande */
}
:root.letra-grande { font-size: 131.25%; } /* 21px */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overscroll-behavior-y: none; }
body {
  margin: 0; background: var(--fondo); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem; line-height: 1.45; font-variant-numeric: tabular-nums;
  min-height: 100dvh; overflow-x: hidden;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.5rem; line-height: 1.15; letter-spacing: -0.01em; }
h2 { font-size: 1.2rem; line-height: 1.2; }
h3 { font-size: 1.05rem; line-height: 1.25; }
button, input, select { font: inherit; color: inherit; }
input, select { font-size: max(16px, 1.1rem); }
button { cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none; border: 0; background: none; padding: 0; }
a { color: inherit; touch-action: manipulation; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 1.5em; height: 1.5em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid var(--azul); outline-offset: 3px; }
.noscript { padding: 2rem 1rem; font-size: 1.2rem; }

/* ---------- barra de arriba ---------- */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .5rem;
  padding: calc(.5rem + env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) .5rem max(12px, env(safe-area-inset-left, 0px));
  background: var(--verde); color: #fff;
}
.marca { display: flex; align-items: center; gap: .6rem; min-height: 48px; text-align: left; min-width: 0; }
.marca .logo { width: 2.3rem; height: 2.3rem; flex: none; }
.marca span { display: grid; line-height: 1.1; min-width: 0; }
.marca b { font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 440px) { .quien .ic { display: none; } .quien { font-size: .9rem; padding: 0 .75rem; } }
.marca small { font-size: .8rem; font-weight: 600; color: var(--sol); }
.quien {
  margin-left: auto; display: flex; align-items: center; gap: .35rem; min-height: 48px; padding: 0 .85rem;
  border: 2px solid rgba(255,255,255,.75); border-radius: 999px; font-weight: 700; font-size: .95rem; white-space: nowrap;
}
.quien .ic { width: 1.25em; height: 1.25em; }
.quien:active { background: var(--verde-osc); }

/* ---------- contenido ---------- */
main { display: block; padding: 1rem max(16px, env(safe-area-inset-left, 0px)) calc(var(--tabs) + var(--seguro-abajo) + 1.5rem); max-width: 44rem; margin: 0 auto; outline: none; }
.sin-sesion main { padding-bottom: 2rem; }
.sin-sesion .tabs, .sin-sesion .barra-venta { display: none; }
.con-barra main { padding-bottom: calc(var(--tabs) + var(--seguro-abajo) + 6.5rem); }
.vista > * + * { margin-top: 1rem; }
.rejilla > * + *, .rejilla-2 > * + * { margin-top: 1.5rem; }
.titulo { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.titulo h1 { flex: 1 1 auto; }
.sub { color: var(--ink-2); font-size: 1rem; }
.nota { color: var(--ink-2); font-size: .9rem; }
.chico { font-size: .9rem; color: var(--ink-2); }
.neg { color: var(--rojo); }
.pos { color: var(--verde); }
.fuerte { font-weight: 800; }

/* ---------- botones: se ven como botones (borde y sombra sólida), se hunden al tocarlos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 3.4rem; padding: .55rem 1.1rem;
  border: 2px solid var(--ink); border-radius: var(--radio); background: var(--papel); color: var(--ink);
  font-weight: 700; font-size: 1.05rem; line-height: 1.15; text-align: center; text-decoration: none;
  box-shadow: 0 3px 0 var(--ink); transition: transform 90ms ease-out, box-shadow 90ms ease-out;
}
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.btn.prin { background: var(--verde); color: #fff; border-color: var(--verde-osc); box-shadow: 0 3px 0 var(--verde-osc); }
.btn.prin:active { box-shadow: 0 0 0 var(--verde-osc); }
.btn.sol { background: var(--sol); }
.btn.peligro { color: var(--rojo); border-color: var(--rojo); box-shadow: 0 3px 0 var(--rojo); }
.btn.peligro.lleno { background: var(--rojo); color: #fff; }
.btn.grande { min-height: 4.2rem; font-size: 1.25rem; border-radius: 16px; }
.btn.ancho { display: flex; width: 100%; }
.btn[disabled] { opacity: .45; box-shadow: none; transform: none; cursor: not-allowed; }
.btn .ic { width: 1.35em; height: 1.35em; }
.enlace { display: inline-flex; align-items: center; gap: .3rem; min-height: 48px; font-weight: 700; color: var(--verde); text-decoration: underline; text-underline-offset: 3px; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.pila > * + * { margin-top: .75rem; }

/* ---------- tarjetas y filas ---------- */
.tarjeta { background: var(--papel); border: 2px solid var(--linea); border-radius: 16px; padding: 1rem; }
.tarjeta.sin { padding: 0; overflow: hidden; }
.tarjeta > header { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .9rem 1rem .4rem; }
.lista { list-style: none; margin: 0; padding: 0; }
.fila {
  display: flex; align-items: center; gap: .75rem; width: 100%; min-height: 4.4rem; padding: .8rem 1rem; text-align: left;
  border-top: 2px solid var(--fondo); background: var(--papel);
}
.lista > li:first-child > .fila, .lista > .fila:first-child { border-top: 0; }
button.fila:active { background: var(--verde-tinte); }
.fila .que { flex: 1 1 auto; min-width: 0; display: grid; gap: .15rem; }
.fila .que b { font-size: 1.08rem; line-height: 1.2; overflow-wrap: anywhere; }
.fila .que span { color: var(--ink-2); font-size: .92rem; }
.fila .cuanto { flex: none; text-align: right; display: grid; gap: .15rem; justify-items: end; }
.fila .cuanto b { font-size: 1.12rem; }
.fila .cuanto span { font-size: .88rem; color: var(--ink-2); }
.fila > .ic { color: var(--ink-2); width: 1.3em; height: 1.3em; }
.vacio { padding: 1.25rem 1rem; color: var(--ink-2); }

.pill { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .85rem; font-weight: 700; line-height: 1.5; white-space: nowrap; }
.pill.rojo { background: var(--rojo-tinte); color: var(--rojo); }
.pill.ambar { background: var(--sol-tinte); color: var(--ambar); }
.pill.verde { background: var(--verde-tinte); color: var(--verde-osc); }
.pill.azul { background: var(--azul-tinte); color: var(--azul); }

/* ---------- inicio ---------- */
.saludo h1 { font-size: 1.6rem; }
.hoy { background: var(--verde); color: #fff; border-radius: 18px; padding: 1.1rem 1.1rem 1.2rem; display: grid; gap: .25rem; }
.hoy .lbl { font-weight: 600; color: #CFEBDB; }
.hoy .monto { font-size: 2.3rem; font-weight: 800; line-height: 1.05; letter-spacing: -0.02em; }
.hoy .det { color: #E6F5EC; }
.hoy.azul { background: var(--azul); }
.hoy.azul .lbl, .hoy.azul .det { color: #E6EDFF; }
.alertas { display: grid; gap: .75rem; }
.mas-grande { font-size: 1.2em; }
.sin-sesion .quien { visibility: hidden; }
.alerta {
  display: flex; align-items: center; gap: .85rem; width: 100%; min-height: 5rem; padding: .9rem 1rem; text-align: left;
  border-radius: 16px; border: 2px solid transparent;
}
.alerta .num { flex: none; min-width: 2.9rem; height: 2.9rem; padding: 0 .4rem; border-radius: 12px; display: grid; place-items: center; font-size: 1.35rem; font-weight: 800; background: var(--papel); }
.alerta .txt { flex: 1 1 auto; display: grid; gap: .1rem; min-width: 0; }
.alerta .txt b { font-size: 1.08rem; line-height: 1.2; }
.alerta .txt span { font-size: .92rem; }
.alerta > .ic { width: 1.3em; height: 1.3em; }
.alerta.ambar { background: var(--sol-tinte); border-color: #F2D27A; color: #4A2A00; }
.alerta.ambar .num { color: var(--ambar); }
.alerta.rojo { background: var(--rojo-tinte); border-color: #F3B8B1; color: #5C120D; }
.alerta.rojo .num { color: var(--rojo); }
.alerta.azul { background: var(--azul-tinte); border-color: #B9CCF5; color: #13306B; }
.alerta.azul .num { color: var(--azul); }
.alerta.verde { background: var(--verde-tinte); border-color: #A9D9BE; color: var(--verde-osc); }
.alerta:active { filter: brightness(.96); }

/* ---------- vender ---------- */
.buscador { position: relative; display: block; }
.buscador .ic { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--ink-2); pointer-events: none; }
.buscador input {
  width: 100%; min-height: 3.8rem; padding: .6rem 3.4rem .6rem 3.1rem; border: 2px solid var(--ink); border-radius: 16px; background: var(--papel);
  font-size: max(16px, 1.15rem); -webkit-appearance: none; appearance: none;
}
.buscador input::placeholder { color: #6B7A71; }
.buscador input:focus { outline: 3px solid var(--sol); outline-offset: 0; border-color: var(--verde); }
.buscador .limpiar { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); width: 3rem; height: 3rem; display: grid; place-items: center; border-radius: 12px; color: var(--ink-2); }
.buscador .limpiar .ic { position: static; transform: none; }
.fila .que .precio-l { color: var(--ink); font-size: .95rem; }
.prod .precio { font-size: 1.15rem; font-weight: 800; color: var(--verde-osc); }
input[type="search"]::-webkit-search-cancel-button, input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.prod .stock-bajo { color: var(--rojo); font-weight: 700; }
.agregar { flex: none; width: 3.2rem; height: 3.2rem; display: grid; place-items: center; border-radius: 14px; background: var(--verde); color: #fff; }
.agregar .ic { width: 1.6rem; height: 1.6rem; stroke-width: 2.6; }
.en-venta { background: var(--verde-tinte) !important; }
.en-venta .agregar { background: var(--sol); color: var(--ink); }

.barra-venta {
  position: fixed; z-index: 15; left: 0; right: 0; bottom: calc(var(--tabs) + var(--seguro-abajo)); padding: .6rem max(12px, env(safe-area-inset-left, 0px));
  background: var(--fondo);
}
.barra-venta .btn { max-width: 44rem; margin: 0 auto; justify-content: space-between; min-height: 4rem; font-size: 1.15rem; }
.barra-venta .cuenta { display: grid; text-align: left; line-height: 1.15; }
.barra-venta .cuenta small { font-weight: 600; font-size: .85rem; opacity: .9; }

/* paso: cantidad con – y + grandes */
.paso { display: grid; grid-template-columns: 4rem 1fr 4rem; align-items: center; gap: .5rem; }
.paso button { height: 4rem; border-radius: 16px; border: 2px solid var(--ink); background: var(--papel); display: grid; place-items: center; box-shadow: 0 3px 0 var(--ink); }
.paso button:active { transform: translateY(3px); box-shadow: none; }
.paso button .ic { width: 1.8rem; height: 1.8rem; stroke-width: 2.6; }
.paso output, .paso input { text-align: center; font-size: 2.1rem; font-weight: 800; line-height: 1; }
.paso input { width: 100%; min-width: 0; height: 4rem; border: 2px solid var(--linea); border-radius: 14px; background: var(--papel); padding: 0; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; border: 2px solid var(--ink); border-radius: 16px; overflow: hidden; background: var(--papel); }
.seg button { min-height: 3.4rem; padding: .4rem .5rem; font-weight: 700; line-height: 1.15; border-left: 2px solid var(--ink); }
.seg button:first-child { border-left: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.seg button small { display: block; font-weight: 600; font-size: .85rem; }

/* cobrar */
.linea-venta { display: grid; grid-template-columns: 1fr auto; gap: .2rem .75rem; padding: .85rem 1rem; border-top: 2px solid var(--fondo); }
.linea-venta:first-child { border-top: 0; }
.linea-venta b { font-size: 1.05rem; line-height: 1.2; overflow-wrap: anywhere; }
.linea-venta .monto { font-weight: 800; font-size: 1.1rem; text-align: right; }
.linea-venta .acc { grid-column: 1 / -1; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.mini { min-height: 3rem; padding: 0 .9rem; border-radius: 12px; border: 2px solid var(--linea); background: var(--papel); font-weight: 700; display: inline-flex; align-items: center; gap: .3rem; }
.mini:active { background: var(--fondo); }
.mini.quitar { color: var(--rojo); border-color: #EFC2BC; margin-left: auto; }
.total { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 1rem; background: var(--ink); color: #fff; border-radius: 16px; }
.total span { font-size: 1.15rem; font-weight: 700; }
.total b { font-size: 2.1rem; font-weight: 800; letter-spacing: -0.02em; }
.pagos { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.pago { min-height: 4.4rem; border: 2px solid var(--ink); border-radius: 16px; background: var(--papel); font-weight: 800; font-size: 1.1rem; box-shadow: 0 3px 0 var(--ink); display: grid; place-items: center; padding: .4rem; line-height: 1.15; }
.pago small { display: block; font-weight: 600; font-size: .82rem; color: var(--ink-2); }
.pago[aria-pressed="true"] { background: var(--sol); }
.pago[aria-pressed="true"] small { color: var(--ink); }
.pago:active { transform: translateY(3px); box-shadow: none; }
.billetes { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.billete { min-height: 3.6rem; border-radius: 14px; border: 2px solid var(--verde); background: var(--verde-tinte); color: var(--verde-osc); font-weight: 800; font-size: 1.05rem; }
.billete[aria-pressed="true"] { background: var(--verde); color: #fff; }
.campo { display: grid; gap: .35rem; }
.campo > span { font-weight: 700; }
.campo input, .campo select {
  width: 100%; min-height: 3.6rem; padding: .5rem .9rem; border: 2px solid var(--ink); border-radius: 14px; background: var(--papel); font-size: max(16px, 1.15rem);
}
.campo input.num { font-size: 1.5rem; font-weight: 800; }
.campo input:focus, .campo select:focus { outline: 3px solid var(--sol); outline-offset: 0; border-color: var(--verde); }
.vuelto { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 1rem; border-radius: 16px; background: var(--sol); }
.vuelto span { font-weight: 800; font-size: 1.2rem; }
.vuelto b { font-size: 2.3rem; font-weight: 800; letter-spacing: -0.02em; }
.vuelto.falta { background: var(--rojo-tinte); color: var(--rojo); }
.vuelto.falta b { font-size: 1.5rem; }
.check { display: flex; gap: .8rem; align-items: flex-start; padding: 1rem; border-radius: 16px; border: 2px solid #E6B84A; background: var(--sol-tinte); font-weight: 700; }
.check input { width: 1.7rem; height: 1.7rem; flex: none; accent-color: var(--verde); margin: 0; }
.listo { text-align: center; display: grid; justify-items: center; gap: .6rem; padding: 1.25rem 0 .5rem; }
.listo .sello { width: 5.5rem; height: 5.5rem; border-radius: 50%; background: var(--verde); color: #fff; display: grid; place-items: center; animation: sello 260ms ease-out both; }
.listo .sello .ic { width: 3.2rem; height: 3.2rem; stroke-width: 3; }
@keyframes sello { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }

/* filtros de productos */
.filtros { display: flex; gap: .5rem; overflow-x: auto; padding: 2px 2px 6px; margin: 0 -2px; scrollbar-width: none; }
.filtros::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 3rem; padding: 0 1rem; border-radius: 999px; border: 2px solid var(--ink); background: var(--papel); font-weight: 700; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; }
.chip .n { display: inline-block; min-width: 1.6em; margin-left: .3rem; padding: 0 .35rem; border-radius: 999px; background: var(--sol); color: var(--ink); font-size: .85rem; }

/* ficha y lotes */
.dato { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .7rem 0; border-top: 2px solid var(--fondo); }
.dato:first-child { border-top: 0; }
.dato span { color: var(--ink-2); }
.dato b { text-align: right; }
.gran-numero { font-size: 2.2rem; font-weight: 800; line-height: 1.05; letter-spacing: -0.02em; }

/* caja */
.gaveta { background: var(--sol); border-radius: 18px; padding: 1.1rem; display: grid; gap: .2rem; color: #2B1C00; }
.gaveta .lbl { font-weight: 700; }
.gaveta .monto { font-size: 2.4rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.05; }
.cuentas .dato b { font-size: 1.05rem; }
.cuentas .dato.suma { border-top: 3px solid var(--ink); font-weight: 800; }
.cuentas .dato.suma span { color: var(--ink); font-weight: 800; }
.rapidos { display: flex; flex-wrap: wrap; gap: .5rem; }
#cRap { display: grid; grid-template-columns: repeat(auto-fit, minmax(2.8rem, 1fr)); }
#cRap .chip { padding: 0; }

/* reporte: barras en CSS, sin librerías */
.barras { display: grid; grid-template-columns: repeat(7, 1fr); gap: .4rem; align-items: end; height: 11rem; padding-top: 1.6rem; }
.barra { position: relative; display: grid; align-items: end; height: 100%; }
.barra i { display: block; background: var(--verde); border-radius: 8px 8px 3px 3px; min-height: 3px; }
.barra.hoy-b i { background: var(--sol); border: 2px solid var(--ink); }
.barra em { position: absolute; left: 50%; transform: translateX(-50%); font-style: normal; font-size: .72rem; font-weight: 700; white-space: nowrap; color: var(--ink-2); }
.dias { display: grid; grid-template-columns: repeat(7, 1fr); gap: .4rem; text-align: center; font-weight: 700; font-size: .85rem; color: var(--ink-2); margin-top: .35rem; }
.compara { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.compara > div { background: var(--papel); border: 2px solid var(--linea); border-radius: 16px; padding: .9rem 1rem; display: grid; gap: .15rem; }
.compara b { font-size: 1.35rem; font-weight: 800; }
.ranking .fila { min-height: 3.6rem; }
.medidor { height: .7rem; border-radius: 999px; background: var(--fondo); overflow: hidden; margin-top: .35rem; }
.medidor i { display: block; height: 100%; background: var(--verde); border-radius: 999px; }

/* ---------- entrar ---------- */
.entrar { max-width: 28rem; margin: 0 auto; padding: 1.5rem 0 1rem; display: grid; gap: 1rem; text-align: center; justify-items: center; }
.logo-grande { width: 4.5rem; height: 4.5rem; }
.quienes { display: grid; gap: .9rem; width: 100%; margin-top: .5rem; }
.persona {
  display: flex; align-items: center; gap: 1rem; width: 100%; min-height: 5.6rem; padding: .9rem 1.1rem; text-align: left;
  background: var(--papel); border: 2px solid var(--ink); border-radius: 18px; box-shadow: 0 4px 0 var(--ink);
}
.persona:active { transform: translateY(4px); box-shadow: none; }
.persona .ini { width: 3.4rem; height: 3.4rem; border-radius: 50%; display: grid; place-items: center; background: var(--sol); font-weight: 800; font-size: 1.4rem; flex: none; }
.persona:nth-child(2) .ini { background: var(--verde-tinte); color: var(--verde-osc); }
.persona b { display: block; font-size: 1.3rem; }
.persona b + span { color: var(--ink-2); }
.persona.prueba { border-style: dashed; box-shadow: 0 4px 0 var(--azul); border-color: var(--azul); }
.persona.prueba .ini { background: var(--azul-tinte); color: var(--azul); }
.campo input.pin { text-align: center; letter-spacing: .6em; font-size: 2rem; }
.pin-mal { min-height: 1.5em; margin: .4rem 0 0; color: var(--rojo); font-weight: 700; }
.huella { display: grid; justify-items: center; gap: .9rem; padding: .5rem 0 0; text-align: center; }
.huella .dedo { width: 7rem; height: 7rem; border-radius: 50%; display: grid; place-items: center; background: var(--verde-tinte); color: var(--verde); border: 3px solid var(--verde); }
.huella .dedo .ic { width: 4rem; height: 4rem; stroke-width: 1.6; }
.huella.leyendo .dedo { animation: latido 900ms ease-in-out infinite; }
@keyframes latido { 50% { transform: scale(1.06); } }

/* ---------- pestañas abajo (en el teléfono, al alcance del pulgar) ---------- */
.tabs {
  position: fixed; z-index: 16; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr);
  min-height: calc(var(--tabs) + var(--seguro-abajo)); padding: 0 env(safe-area-inset-right, 0px) var(--seguro-abajo) env(safe-area-inset-left, 0px);
  background: var(--papel); border-top: 2px solid var(--linea);
}
.tabs button { display: grid; justify-items: center; align-content: center; gap: .15rem; min-width: 0; padding: .35rem 1px .45rem; color: var(--ink-2); font-weight: 700; font-size: clamp(13px, 3.9vw, 16px); line-height: 1.1; position: relative; }
.tabs button .ic { width: 1.7rem; height: 1.7rem; }
.tabs button span { white-space: nowrap; }
.tabs button { isolation: isolate; }
.tabs button[aria-current="page"] { color: var(--ink); }
.tabs button[aria-current="page"]::before { content: ""; position: absolute; inset: .3rem 6% .3rem; background: var(--sol); border-radius: 14px; z-index: -1; }
.tabs button:active { background: var(--fondo); }

/* ---------- hoja que sube desde abajo (diálogo) ---------- */
dialog#hoja {
  margin: auto 0 0; padding: 0; width: 100%; max-width: 100%; max-height: 92dvh; border: 0; border-radius: 22px 22px 0 0;
  background: var(--papel); color: var(--ink); overscroll-behavior: contain;
}
dialog#hoja[open] { animation: sube 200ms ease-out; }
dialog#hoja::backdrop { background: rgba(10, 20, 15, .55); }
@keyframes sube { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.hoja { padding: 1rem max(16px, env(safe-area-inset-left, 0px)) calc(1.25rem + var(--seguro-abajo)); display: grid; gap: 1rem; }
.hoja > header { display: flex; align-items: flex-start; gap: .75rem; }
.hoja > header h2 { flex: 1 1 auto; font-size: 1.35rem; padding-top: .4rem; }
.hoja > header .cerrar { flex: none; width: 3.2rem; height: 3.2rem; border-radius: 14px; display: grid; place-items: center; background: var(--fondo); }
.hoja > header .cerrar .ic { width: 1.6rem; height: 1.6rem; }
.hoja .pregunta { font-size: 1.2rem; font-weight: 700; }

/* ---------- aviso corto, con "Deshacer" ---------- */
.aviso {
  position: fixed; z-index: 30; left: 12px; right: 12px; bottom: calc(var(--tabs) + var(--seguro-abajo) + .75rem); max-width: 30rem; margin: 0 auto;
  display: flex; align-items: center; gap: .75rem; padding: .8rem .8rem .8rem 1rem; border-radius: 16px; background: var(--ink); color: #fff; font-weight: 700;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.aviso span { flex: 1 1 auto; }
.aviso button { flex: none; min-height: 3rem; padding: 0 1rem; border-radius: 12px; background: var(--sol); color: var(--ink); font-weight: 800; }
.sin-sesion .aviso { bottom: 1rem; }
.con-barra .aviso { bottom: calc(var(--tabs) + var(--seguro-abajo) + 5.6rem); }

/* ---------- pantallas muy chicas (320–360 px) ---------- */
@media (max-width: 360px) {
  :root { font-size: 106.25%; }               /* 17px */
  :root.letra-grande { font-size: 118.75%; }  /* 19px */
  main { padding-left: 12px; padding-right: 12px; }
  .marca small { display: none; }
  .marca b { font-size: 1rem; }
  .quien { padding: 0 .65rem; }
  .hoy .monto, .gaveta .monto, .vuelto b { font-size: 2rem; }
  .total b { font-size: 1.8rem; }
  .billetes { grid-template-columns: repeat(2, 1fr); }
  .paso { grid-template-columns: 3.6rem 1fr 3.6rem; }
}

/* ---------- con mouse ---------- */
@media (hover: hover) and (pointer: fine) {
  .btn:hover, .pago:hover, .persona:hover { filter: brightness(.97); }
  button.fila:hover { background: #F6FAF7; }
  .tabs button:hover { color: var(--ink); }
  .chip:hover, .mini:hover { background: var(--fondo); }
  .chip[aria-pressed="true"]:hover { background: var(--ink); }
}

/* ---------- computadora: las secciones pasan a la izquierda ---------- */
@media (min-width: 960px) {
  :root { --lado: 15rem; }
  body:not(.sin-sesion) main { margin-left: var(--lado); max-width: none; padding: 1.5rem 2.5rem 3rem; }
  .con-barra main { padding-bottom: 3rem; }
  .tabs {
    top: 0; bottom: 0; right: auto; width: var(--lado); grid-template-columns: 1fr; grid-auto-rows: 4rem; align-content: start; gap: .35rem;
    padding: 5.6rem .75rem 1rem; border-top: 0; border-right: 2px solid var(--linea); z-index: 10;
  }
  .tabs button { grid-auto-flow: column; justify-content: start; gap: .75rem; padding: 0 1rem; font-size: 1.05rem; border-radius: 14px; }
  .tabs button[aria-current="page"]::before { inset: 0; }
  .vista { max-width: 62rem; }
  .vista[data-vista="inicio"] .rejilla { display: grid; grid-template-columns: 1.1fr 1fr; gap: 1rem; align-items: start; }
  .rejilla > * { margin: 0 !important; }
  .vista[data-vista="vender"] .rejilla { display: grid; grid-template-columns: minmax(0, 1fr) 24rem; gap: 1.25rem; align-items: start; }
  .ticket-lado { position: sticky; top: 5.5rem; }
  .barra-venta { display: none !important; }
  .solo-tel { display: none !important; }
  .rejilla-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
  .rejilla-2 > * { margin: 0 !important; }
  dialog#hoja { margin: auto; max-width: 34rem; border-radius: 22px; max-height: 88vh; }
  .aviso { bottom: 1.5rem; left: calc(var(--lado) + 1rem); }
}
@media (max-width: 959px) { .solo-pc { display: none !important; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print { .top, .tabs, .barra-venta, .aviso { display: none !important; } main { padding: 0; margin: 0 !important; } }

/* ---------- ajustes después de revisar en 320–1440 px ---------- */
.hoja h2:focus { outline: none; }
dialog#hoja { overflow-y: auto; }
/* el botón principal de cada hoja queda siempre a la vista, abajo, donde llega el pulgar */
.pie { position: sticky; bottom: calc(-1.25rem - var(--seguro-abajo)); margin: 0 -16px calc(-1.25rem - var(--seguro-abajo)); padding: .75rem 16px calc(1rem + var(--seguro-abajo)); background: var(--papel); box-shadow: 0 -8px 14px -10px rgba(0,0,0,.25); display: grid; gap: .6rem; }
.btn[disabled] { opacity: 1; background: #E4E9E5; color: #4F5D54; border-color: #C5CEC8; box-shadow: none; }
.linea-venta .acc { display: grid; grid-template-columns: 1fr 1fr; }
.mini.quitar { margin-left: 0; }
.linea-venta .acc .mini { justify-content: center; }
.compara b { white-space: nowrap; }
.filtros { flex-wrap: wrap; overflow: visible; }
.ticket-lado .dato span { color: var(--ink); }
.ticket-lado .dato small { color: var(--ink-2); }
/* las filas que no se ven todavía no se dibujan: listas largas más rápidas en teléfonos lentos */
.lista > .fila, .lista > li > .fila { content-visibility: auto; contain-intrinsic-size: auto 4.6rem; }
/* filtros de productos: tres botones iguales, el número debajo; nunca se esconde ninguno */
.filtros { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; overflow: visible; padding: 0; margin: 0; }
.filtro { min-height: 3.9rem; padding: .3rem .25rem; border-radius: 14px; border: 2px solid var(--ink); background: var(--papel); display: grid; place-items: center; gap: 0; line-height: 1.15; }
.filtro span { font-weight: 700; font-size: .95rem; white-space: nowrap; }
.filtro b { font-size: 1.15rem; font-weight: 800; }
.filtro[data-f="acaban"] b { color: var(--rojo); }
.filtro[data-f="vencen"] b { color: var(--ambar); }
.filtro[aria-pressed="true"] { background: var(--ink); color: #fff; }
.filtro[aria-pressed="true"] b { color: var(--sol); }
