/* Sistema de la ferretería (demo): claro, azul y etiquetas amarillas. Primero para el celu. */
:root {
  --fondo: #f1f3f6; --blanco: #fff; --tinta: #12161c; --mute: #5b6472;
  --azul: #1f4fff; --azul-2: #1438c9; --amarillo: #ffd84d; --verde: #12924b; --naranja: #e07b00; --rojo: #c8322b;
  --borde: rgba(18, 22, 28, .1); --borde-2: rgba(18, 22, 28, .2);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --titulos: "Roboto Condensed", "Arial Narrow", sans-serif;
  --letra: "Roboto", system-ui, sans-serif;
  --mono: "Roboto Mono", ui-monospace, monospace;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--letra); font-size: 16px; line-height: 1.5; color: var(--tinta); background: var(--fondo); -webkit-font-smoothing: antialiased; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--azul); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: fixed; top: -100px; left: 1rem; z-index: 999; padding: .6rem 1rem; background: var(--azul); color: #fff; border-radius: 8px; }
.skip-link:focus { top: 1rem; }

.top { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: .6rem; padding: .5rem 1rem; background: rgba(255, 255, 255, .97); border-bottom: 1px solid var(--borde); }
.volver { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; font-size: 1.3rem; border: 1px solid var(--borde-2); flex-shrink: 0; }
.top-tit { display: flex; align-items: baseline; gap: .4rem; white-space: nowrap; }
.top-tit b { font-family: var(--titulos); font-weight: 800; font-size: 1.45rem; text-transform: uppercase; }
.top-tit small { color: var(--azul); font-weight: 700; font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; }
.top-demo { margin-left: auto; font-size: .76rem; font-weight: 700; background: var(--amarillo); padding: .2rem .55rem; border-radius: 999px; white-space: nowrap; }
.top-reset { min-height: 44px; padding: .4rem .7rem; font-size: .82rem; font-weight: 500; color: var(--mute); border: 1px solid var(--borde-2); border-radius: 10px; white-space: nowrap; }
.chico-solo { display: none; }
@media (max-width: 420px) { .chico-oculto { display: none; } .chico-solo { display: inline; } .top { gap: .45rem; padding-inline: .75rem; } }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(4, 1fr); background: rgba(255, 255, 255, .98); border-top: 1px solid var(--borde-2); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { position: relative; min-height: 64px; display: grid; justify-items: center; align-content: center; gap: .2rem; font-size: .78rem; font-weight: 500; color: var(--mute); }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tabs button[aria-current="page"] { color: var(--azul); font-weight: 700; }
.badge { position: absolute; top: 8px; left: calc(50% + 6px); min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--rojo); color: #fff; font-style: normal; font-size: .76rem; font-weight: 700; display: grid; place-items: center; }

.vista { width: min(1160px, 100% - 2rem); margin: 1.2rem auto 2rem; outline: none; }
.vista > section { animation: entra .35s var(--ease); }
@keyframes entra { from { opacity: 0; transform: translateY(8px); } }
.v-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.v-tit { font-family: var(--titulos); font-weight: 800; font-size: 2rem; text-transform: uppercase; line-height: 1; margin-bottom: 1rem; }
.v-head .v-tit { margin: 0; }
.v-tit span { color: var(--azul); font-size: 1.1rem; }
.v-sub { color: var(--mute); margin: -.4rem 0 1rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 46px; padding: .55rem 1rem; border-radius: 10px; font-family: var(--titulos); font-weight: 700; font-size: 1.02rem; text-transform: uppercase; transition: transform .2s, background .2s, border-color .2s, opacity .2s; }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-azul { background: var(--azul); color: #fff; }
.btn-line { border: 1.5px solid var(--borde-2); background: var(--blanco); }
.btn-wa { background: #25d366; color: #06210f; }
.btn-sm { min-height: 44px; font-size: .95rem; }
.btn-block { width: 100%; }
.link { color: var(--azul); font-weight: 700; font-size: .9rem; min-height: 44px; padding: 0 .3rem; }

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin-bottom: .8rem; }
.kpi { padding: .9rem; border-radius: 14px; background: var(--blanco); border: 1px solid var(--borde); display: grid; gap: .1rem; }
.kpi p { font-size: .82rem; color: var(--mute); }
.kpi b { font-family: var(--titulos); font-weight: 800; font-size: 1.7rem; line-height: 1.05; font-variant-numeric: tabular-nums; }
.kpi small { font-size: .78rem; color: var(--mute); }
.kpi-ok b { color: var(--verde); }
.sube { color: var(--verde) !important; font-weight: 700; }
.baja { color: var(--rojo) !important; font-weight: 700; }
.caja { padding: 1rem; border-radius: 16px; background: var(--blanco); border: 1px solid var(--borde); margin-bottom: .8rem; min-width: 0; }
.c-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.c-tit { font-family: var(--titulos); font-weight: 800; font-size: 1.15rem; text-transform: uppercase; margin-bottom: .7rem; }
.c-head .c-tit { margin: 0; }
.c-tit small { font-family: var(--letra); font-weight: 400; text-transform: none; color: var(--mute); font-size: .82rem; }
.c-sub { font-size: .86rem; font-weight: 700; color: var(--mute); margin: .9rem 0 .5rem; }
.dos { display: grid; gap: .8rem; margin-bottom: .8rem; }
.dos .caja { margin: 0; }
.grafico svg { width: 100%; height: auto; overflow: visible; }
.grafico .barra { fill: url(#g-azul); }
.grafico .barra-hoy { fill: var(--amarillo); stroke: var(--tinta); stroke-width: 1; }
.grafico text { fill: var(--mute); font-size: 9px; font-family: var(--letra); }
.grafico .barra, .grafico .barra-hoy { transform-box: fill-box; transform-origin: bottom; animation: crece .7s var(--ease) backwards; }
@keyframes crece { from { transform: scaleY(0); } }
.stock-nums { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.stock-nums p { padding: .65rem .7rem; border-radius: 10px; background: var(--fondo); display: grid; }
.stock-nums small { font-size: .76rem; color: var(--mute); line-height: 1.25; }
.stock-nums b { font-family: var(--titulos); font-weight: 800; font-size: 1.3rem; white-space: nowrap; }
.stock-nums .alerta b { color: var(--naranja); }
.stock-nums .mal b { color: var(--rojo); }
.medios { list-style: none; padding: 0; display: grid; gap: .35rem; }
.medios li { display: grid; grid-template-columns: 110px 1fr auto; gap: .6rem; align-items: center; font-size: .86rem; }
.medios i { display: block; height: 10px; border-radius: 5px; background: var(--azul); width: var(--w); min-width: 4px; }
.medios b { font-family: var(--mono); font-weight: 500; font-size: .8rem; }
.ranking { list-style: none; padding: 0; display: grid; gap: .4rem; counter-reset: r; }
.ranking li { display: grid; grid-template-columns: 28px 1fr auto; gap: .6rem; align-items: center; padding: .55rem .6rem; border-radius: 10px; background: var(--fondo); font-size: .9rem; }
.ranking li::before { counter-increment: r; content: counter(r); width: 26px; height: 26px; border-radius: 7px; background: var(--tinta); color: #fff; display: grid; place-items: center; font-family: var(--titulos); font-weight: 800; font-size: .9rem; }
.ranking small { color: var(--mute); display: block; font-size: .78rem; }
.ranking b { font-family: var(--mono); font-weight: 500; font-size: .84rem; }

/* Vender */
.vender { display: grid; gap: .8rem; margin-bottom: .8rem; }
.vender > * { min-width: 0; }
.buscar { display: flex; gap: .5rem; }
input, select { font: inherit; font-size: 16px; color: var(--tinta); background: var(--blanco); border: 1.5px solid var(--borde-2); border-radius: 10px; padding: .55rem .75rem; min-height: 46px; width: 100%; min-width: 0; }
input[type="number"] { font-family: var(--mono); }
input:focus, select:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 3px rgba(31, 79, 255, .16); }
.buscar input { font-size: 1.1rem; min-height: 54px; border-width: 2px; border-color: var(--tinta); }
.buscar .btn { flex-shrink: 0; min-height: 54px; }
.sugerencias { list-style: none; padding: 0; margin: .4rem 0 0; display: grid; gap: .3rem; }
.sugerencias button { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: .2rem .6rem; align-items: center; text-align: left; min-height: 52px; padding: .45rem .7rem; border-radius: 10px; background: var(--blanco); border: 1px solid var(--borde); }
.sugerencias small { grid-column: 1; color: var(--mute); font-size: .78rem; font-family: var(--mono); }
.sugerencias b { grid-column: 2; grid-row: 1 / span 2; font-family: var(--titulos); font-weight: 800; font-size: 1.1rem; background: var(--amarillo); padding: .2rem .5rem; border-radius: 4px; }
.sugerencias .sin { opacity: .55; }
.ayuda { font-size: .82rem; color: var(--mute); margin-top: .5rem; }
.ticket { border: 2px solid var(--tinta); }
.ticket-lista { list-style: none; padding: 0; display: grid; gap: .4rem; }
.ticket-lista li { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "n p" "c x"; gap: .3rem .6rem; align-items: center; padding: .5rem 0; border-bottom: 1px dashed var(--borde-2); animation: entra .25s var(--ease); }
.tl-n { grid-area: n; font-size: .92rem; }
.tl-p { grid-area: p; font-family: var(--mono); font-weight: 500; }
.tl-c { grid-area: c; display: inline-flex; align-items: center; gap: .3rem; }
.tl-c button, .tl-x { width: 40px; height: 40px; border-radius: 10px; border: 1.5px solid var(--borde-2); font-size: 1.15rem; font-weight: 700; }
.tl-c b { min-width: 2.5ch; text-align: center; font-family: var(--mono); }
.tl-c small { color: var(--mute); font-size: .78rem; margin-left: .3rem; }
.tl-x { grid-area: x; justify-self: end; color: var(--mute); border: 0; }
.ticket-vacio { color: var(--mute); padding: .6rem 0; }
.ticket-total { display: flex; justify-content: space-between; align-items: baseline; padding: .7rem 0; }
.ticket-total b { font-family: var(--titulos); font-weight: 800; font-size: 2.1rem; }
.opciones { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.opciones input { position: absolute; opacity: 0; pointer-events: none; width: auto; min-height: 0; }
.opciones span { display: inline-flex; align-items: center; min-height: 42px; padding: .35rem .8rem; border-radius: 999px; border: 1.5px solid var(--borde-2); font-weight: 500; font-size: .9rem; cursor: pointer; }
.opciones input:checked + span { background: var(--tinta); color: #fff; border-color: var(--tinta); }
.opciones input:focus-visible + span { outline: 2px solid var(--azul); outline-offset: 2px; }
.post-venta { margin-top: .7rem; padding: .8rem; border-radius: 12px; background: rgba(18, 146, 75, .1); border: 1px solid rgba(18, 146, 75, .4); display: grid; gap: .5rem; animation: entra .3s var(--ease); }
.post-venta p { font-weight: 700; color: var(--verde); }

/* Listas */
.filas { list-style: none; padding: 0; display: grid; gap: .45rem; }
.fila { display: grid; grid-template-columns: 1fr auto; gap: .25rem .8rem; align-items: center; padding: .7rem .8rem; border-radius: 12px; background: var(--blanco); border: 1px solid var(--borde); }
.fila-n { font-weight: 500; line-height: 1.3; min-width: 0; }
.fila-sub { grid-column: 1; font-size: .8rem; color: var(--mute); }
.fila-sub code { font-family: var(--mono); }
.fila-der { grid-column: 2; grid-row: 1 / span 2; display: grid; justify-items: end; gap: .3rem; }
.fila-der b { font-family: var(--mono); font-weight: 500; font-size: .9rem; }
.fila-acc { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .4rem; }
.mini { min-height: 40px; padding: .3rem .75rem; border-radius: 9px; font-size: .84rem; font-weight: 700; border: 1.5px solid var(--borde-2); background: var(--blanco); }
.mini.azul { background: var(--azul); color: #fff; border-color: var(--azul); }
.cant-stock { font-size: .8rem; font-weight: 700; padding: .15rem .55rem; border-radius: 999px; white-space: nowrap; }
.cs-ok { background: rgba(18, 146, 75, .12); color: var(--verde); }
.cs-bajo { background: rgba(224, 123, 0, .15); color: #a75c00; }
.cs-sin { background: rgba(200, 50, 43, .12); color: var(--rojo); }
.vacio { color: var(--mute); text-align: center; padding: 1.2rem; }
.buscar-stock input { min-height: 48px; }
.chips { display: flex; gap: .4rem; overflow-x: auto; padding: .7rem 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex-shrink: 0; min-height: 40px; padding: .35rem .85rem; border-radius: 999px; border: 1.5px solid var(--borde-2); background: var(--blanco); font-size: .86rem; font-weight: 500; }
.chips button em { font-style: normal; opacity: .7; }
.chips button[aria-pressed="true"] { background: var(--tinta); color: #fff; border-color: var(--tinta); }
details.caja summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; min-height: 44px; margin: 0; }
details.caja summary::-webkit-details-marker { display: none; }
details.caja summary::after { content: "+"; font-size: 1.5rem; color: var(--azul); }
details.caja[open] summary::after { content: "−"; }
details.caja[open] summary { margin-bottom: .6rem; }
.aumento-form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; }
.aumento-form .campo { flex: 1 1 200px; margin: 0; }
.aumento-form .campo.chico { flex: 0 1 120px; }
.campo { display: grid; gap: .25rem; margin-bottom: .7rem; min-width: 0; }
.campo > span, .campo > label { font-size: .8rem; font-weight: 700; color: var(--mute); }
.planilla-acc { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.subir { cursor: pointer; }
.dos-col { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }

/* Pedidos */
.pedidos { display: grid; gap: .8rem; }
.pedido { padding: 1rem; border-radius: 16px; background: var(--blanco); border: 1px solid var(--borde); }
.pedido-cab { display: flex; justify-content: space-between; gap: .6rem; align-items: baseline; flex-wrap: wrap; margin-bottom: .6rem; }
.pedido-cab h2 { font-family: var(--titulos); font-weight: 800; font-size: 1.3rem; text-transform: uppercase; }
.pedido-cab small { color: var(--mute); }
.pedido ul { list-style: none; padding: 0; display: grid; gap: .35rem; margin-bottom: .8rem; }
.pedido li { display: grid; grid-template-columns: 1fr 84px; gap: .6rem; align-items: center; font-size: .9rem; padding: .3rem 0; border-bottom: 1px dashed var(--borde); }
.pedido li small { display: block; color: var(--mute); font-size: .78rem; }
.pedido-acc { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }

/* Ventana y avisos */
.hoja { position: fixed; inset: 0; z-index: 80; display: grid; align-items: end; }
.hoja-fondo { position: absolute; inset: 0; background: rgba(18, 22, 28, .6); }
.hoja-caja { position: relative; width: 100%; max-width: 560px; max-height: 90svh; overflow-y: auto; margin-inline: auto; padding: 1.4rem 1.2rem calc(1.2rem + env(safe-area-inset-bottom)); background: var(--blanco); border-radius: 20px 20px 0 0; animation: sube .4s var(--ease); }
@keyframes sube { from { transform: translateY(40px); opacity: 0; } }
.hoja-x { position: absolute; top: .5rem; right: .5rem; width: 44px; height: 44px; border-radius: 50%; font-size: 1.6rem; color: var(--mute); }
.h-tit { font-family: var(--titulos); font-weight: 800; font-size: 1.5rem; text-transform: uppercase; line-height: 1.1; padding-right: 2.5rem; margin-bottom: .3rem; }
.h-sub { color: var(--mute); margin-bottom: 1rem; font-size: .9rem; }
.h-precio { font-family: var(--mono); font-size: .9rem; margin: -.3rem 0 .8rem; }
.h-acc { display: grid; gap: .5rem; }
.camara video { width: 100%; border-radius: 12px; background: #000; aspect-ratio: 4 / 3; object-fit: cover; }
.error { color: var(--rojo); font-size: .9rem; margin-bottom: .6rem; }
.toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 90; transform: translateX(-50%); max-width: calc(100% - 2rem); padding: .75rem 1.1rem; border-radius: 12px; background: var(--tinta); color: #fff; font-weight: 700; box-shadow: 0 16px 40px -10px rgba(0, 0, 0, .5); }

@media (hover: hover) {
  .tabs button:hover { color: var(--tinta); }
  .sugerencias button:hover { border-color: var(--azul); }
}
@media (min-width: 720px) {
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dos { grid-template-columns: 1.3fr 1fr; }
  .fila { grid-template-columns: 1fr auto auto; }
  .fila-acc { grid-column: 3; grid-row: 1 / span 2; justify-content: flex-end; }
  .hoja { align-items: center; padding: 1rem; }
  .hoja-caja { border-radius: 20px; }
}
@media (min-width: 960px) {
  body { padding-bottom: 0; }
  .tabs { position: sticky; top: 61px; bottom: auto; display: flex; justify-content: center; gap: .3rem; border-top: 0; border-bottom: 1px solid var(--borde); background: rgba(255, 255, 255, .97); padding: .3rem 0; }
  .tabs button { min-height: 48px; grid-auto-flow: column; gap: .5rem; padding: 0 1.1rem; border-radius: 10px; font-size: .92rem; }
  .tabs button[aria-current="page"] { background: rgba(31, 79, 255, .08); }
  .badge { position: static; margin-left: .2rem; }
  .vender { grid-template-columns: 1.1fr .9fr; align-items: start; }
  .ticket { position: sticky; top: 132px; }
  .pedidos { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .toast { bottom: 1.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  .vista > section, .grafico .barra, .grafico .barra-hoy, .hoja-caja, .ticket-lista li, .post-venta { animation: none; }
}
