/* Stock · app para almacenes y kioscos.
   Layout: barra superior con el negocio y el estado de conexión; contenido de una columna pensado para el celular;
   barra inferior de navegación (en computadora pasa arriba, como pestañas). Identidad: azul petróleo + ámbar. */
:root {
  --bg: #F3F6F8;
  --surface: #FFFFFF;
  --surface-2: #F7F9FA;
  --ink: #13202B;
  --muted: #586774;
  --faint: #8794A0;
  --line: #DEE5EA;
  --line-strong: #C6D1D9;
  --brand: #0E6B7E;
  --brand-dark: #0A5262;
  --brand-soft: #E3F1F3;
  --amber: #C98516;
  --amber-soft: #FDF3E1;
  --ok: #1E8E5A;
  --danger: #C8382E;
  --shadow: 0 1px 2px rgba(19, 32, 43, .05), 0 10px 28px rgba(19, 32, 43, .08);
  --f-display: 'Sora', 'Segoe UI', system-ui, sans-serif;
  --f-body: 'Figtree', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--f-body);
  padding-left: max(14px, env(safe-area-inset-left, 0px)); padding-right: max(14px, env(safe-area-inset-right, 0px));
  padding-block: 0 calc(88px + env(safe-area-inset-bottom, 0px));
}
body.locked { overflow: hidden; }
h1, h2, h3 { font-family: var(--f-display); margin: 0; line-height: 1.15; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: 1.55rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 8px; }
.muted { color: var(--muted); } .fine { color: var(--faint); font-size: .82rem; }
.num { font-variant-numeric: tabular-nums; }
.ic { width: 20px; height: 20px; flex: none; }
.wrap { max-width: 980px; margin: 0 auto; }

/* Botones y campos */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 14px; border: 1px solid transparent; font-weight: 600; text-decoration: none; white-space: nowrap; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-brand { background: var(--brand); color: #fff; } .btn-brand:hover:not(:disabled) { background: var(--brand-dark); }
.btn-ghost { background: var(--surface); border-color: var(--line-strong); }
.btn-danger { background: transparent; border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); color: var(--danger); }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: .9rem; border-radius: 11px; }
.btn-block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: .84rem; font-weight: 600; color: var(--muted); }
.input { width: 100%; min-height: 50px; padding: 10px 14px; border-radius: 13px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 1rem; }
.input:focus { outline: 2px solid color-mix(in srgb, var(--brand) 50%, transparent); outline-offset: 0; border-color: var(--brand); }
.input.big { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.check input { width: 22px; height: 22px; accent-color: var(--brand); flex: none; }
.grid2 { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid2 .full { grid-column: 1 / -1; }
.err { color: var(--danger); font-size: .9rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; }
.card .btn { white-space: normal; text-align: center; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; font-size: .93rem; }
.alert-warn { background: var(--amber-soft); border: 1px solid color-mix(in srgb, var(--amber) 35%, var(--line)); }
.alert-info { background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--line)); }
.alert-err { background: color-mix(in srgb, var(--danger) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--line)); }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.chip.bajo { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 40%, var(--line)); color: #8A5A08; }
.chip.cero { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); color: var(--danger); }
.chip.pend { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 30%, var(--line)); color: var(--brand-dark); }
.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 28px 16px; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: 16px; background: var(--surface); }
.empty .ic { width: 30px; height: 30px; color: var(--faint); }
.empty b { color: var(--ink); }
.loading { display: grid; place-items: center; padding: 40px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Barra superior */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; margin: 0 calc(-1 * max(14px, env(safe-area-inset-right, 0px))) 14px calc(-1 * max(14px, env(safe-area-inset-left, 0px))); padding: 10px max(14px, env(safe-area-inset-right, 0px)) 10px max(14px, env(safe-area-inset-left, 0px)); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--bg); }
.top-in { max-width: 980px; margin: 0 auto; display: flex; align-items: center; gap: 10px; }
.marca { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.marca-ic { width: 38px; height: 38px; border-radius: 11px; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; font-family: var(--f-display); font-weight: 700; }
.marca b { display: block; font-family: var(--f-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.marca small { color: var(--muted); font-size: .78rem; }
.marca > div { min-width: 0; }
.estado { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: .8rem; font-weight: 600; white-space: nowrap; }
.estado i { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); }
.estado.off i { background: var(--amber); }
.estado.sync i { background: var(--brand); animation: pulso 1s ease-in-out infinite; }
@keyframes pulso { 50% { opacity: .3; } }
.tabs-desk { display: none; }

/* Barra inferior */
.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--surface); border-top: 1px solid var(--line); padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); }
.bn { display: grid; justify-items: center; gap: 2px; border: 0; background: none; padding: 6px 2px; font-size: .74rem; color: var(--muted); border-radius: 10px; }
.bn .ic { width: 24px; height: 24px; }
.bn.on { color: var(--brand); font-weight: 700; }

/* Inicio */
.saludo { display: grid; gap: 4px; margin-bottom: 14px; }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; display: grid; gap: 2px; min-width: 0; }
.kpi span { color: var(--muted); font-size: .78rem; }
.kpi b { font-family: var(--f-display); font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.acciones { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.accion { display: flex; gap: 14px; align-items: center; text-align: left; padding: 16px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); }
.accion:hover { border-color: var(--brand); }
.accion .a-ic { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.accion b { display: block; }
.accion small { color: var(--muted); }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }

/* Listado de productos */
.buscar { display: flex; gap: 8px; }
.buscar .input { flex: 1; min-width: 0; }
.cats { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.cats button { white-space: nowrap; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 6px 13px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.cats button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.lista { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.fila { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; width: 100%; text-align: left; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line); background: none; }
.fila:last-child { border-bottom: 0; }
.fila:hover { background: var(--surface-2); }
.fila b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fila .precio { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.fila small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fila .der { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }

/* Escáner y carga continua */
.cam { position: relative; border-radius: 20px; overflow: hidden; background: #0B1218; width: 100%; height: min(42vh, 72vw, 420px); }
.cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam .mira { position: absolute; left: 12%; right: 12%; top: 38%; height: 24%; border: 2px solid rgba(255, 255, 255, .85); border-radius: 14px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .28); pointer-events: none; }
.cam .mira::after { content: ""; position: absolute; left: 6px; right: 6px; top: 50%; height: 2px; background: #FF5A4E; box-shadow: 0 0 10px #FF5A4E; animation: barrido 1.6s ease-in-out infinite; }
@keyframes barrido { 50% { transform: translateY(-14px); } }
.cam .cam-msg { position: absolute; inset: auto 0 0 0; padding: 10px 14px; color: #fff; font-size: .86rem; background: linear-gradient(transparent, rgba(0, 0, 0, .6)); }
.cam .cam-btns { position: absolute; top: 10px; right: 10px; display: flex; gap: 8px; }
.cam .cam-btns button { width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .45); color: #fff; display: grid; place-items: center; }
.cam.pausa video { filter: blur(2px) brightness(.6); }
.contador { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.leido { font-family: var(--f-display); font-weight: 700; font-size: 1.1rem; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.sugerencia { font-size: .86rem; color: var(--brand-dark); }
.sugerencia:empty { display: none; }
.sugerencia .btn { margin: 6px 0 2px; }
.sugerencia small { display: block; color: var(--muted); font-size: .8rem; }

/* Venta */
.cam.cam-sm { height: min(26vh, 52vw, 260px); }
.chip.ok { background: color-mix(in srgb, var(--ok) 11%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); color: var(--ok); }
.hoy { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 14px 16px; border-radius: 18px; border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--line)); background: var(--brand-soft); }
.hoy > span:first-child { display: grid; }
.hoy b { font-family: var(--f-display); font-size: 1.6rem; line-height: 1.2; }
.hoy small { color: var(--muted); font-size: .8rem; }
.rapidos { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(46%, 150px), 1fr)); gap: 8px; }
.rapidos button { display: grid; gap: 2px; text-align: left; padding: 10px 12px; min-height: 58px; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--surface); min-width: 0; }
.rapidos b { font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rapidos small { color: var(--muted); font-variant-numeric: tabular-nums; }
.carrito .item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.carrito .item:last-child { border-bottom: 0; }
.carrito .item.nuevo { animation: destello 1.2s; }
@keyframes destello { from { background: var(--amber-soft); } }
.it-n { display: grid; min-width: 0; }
.it-n b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.it-n small { color: var(--muted); font-variant-numeric: tabular-nums; }
.it-t { min-width: 64px; text-align: right; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 12px; overflow: hidden; }
.stepper button { width: 40px; height: 40px; border: 0; background: var(--surface-2); display: grid; place-items: center; }
.stepper button.q { width: auto; min-width: 40px; padding: 0 6px; background: var(--surface); font-weight: 700; font-variant-numeric: tabular-nums; }
.stepper button.q.peso { font-size: .85rem; }
.cobrar-bar { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); z-index: 15; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 18px; background: var(--ink); color: #fff; box-shadow: var(--shadow); }
.cobrar-bar > div { flex: 1; display: grid; min-width: 0; }
.cobrar-bar small { color: rgba(255, 255, 255, .7); font-size: .78rem; }
.cobrar-bar b { font-family: var(--f-display); font-size: 1.45rem; line-height: 1.15; }
.cobrar-bar .btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .35); }
.cobrar-bar .btn-brand { background: var(--amber); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button { min-height: 42px; border: 0; border-radius: 10px; background: none; font-weight: 600; color: var(--muted); font-size: .9rem; padding: 0 6px; }
.seg button.on { background: var(--surface); color: var(--brand-dark); box-shadow: 0 1px 3px rgba(19, 32, 43, .15); }
.billetes { display: flex; flex-wrap: wrap; gap: 6px; }
.billetes button { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; font-variant-numeric: tabular-nums; }
.total-grande { display: grid; justify-items: center; gap: 2px; padding: 12px; border-radius: 16px; background: var(--surface-2); }
.total-grande span { color: var(--muted); font-size: .85rem; }
.total-grande b { font-family: var(--f-display); font-size: 2.2rem; line-height: 1.1; }
.total-grande small { color: var(--faint); font-size: .8rem; min-height: 1em; }
.vuelto-g { background: var(--amber-soft); }
.vuelto { font-size: 1.05rem; text-align: center; min-height: 1.5em; }
.hecha { display: grid; justify-items: center; gap: 4px; padding: 6px 0; text-align: center; }
.hecha .ic { width: 52px; height: 52px; padding: 10px; border-radius: 50%; background: color-mix(in srgb, var(--ok) 14%, var(--surface)); color: var(--ok); }
.hecha b { font-family: var(--f-display); font-size: 1.8rem; }
.hecha span { color: var(--muted); }
.botones { display: flex; flex-wrap: wrap; gap: 8px; }
.botones .btn { flex: 1 1 140px; }
.enlace-texto { display: block; text-align: center; font-size: .86rem; color: var(--brand-dark); padding: 4px 0; }
details summary { cursor: pointer; color: var(--brand-dark); font-weight: 600; font-size: .92rem; }
.fila.anulada b, .fila.anulada .precio { text-decoration: line-through; color: var(--faint); }

/* Perfil: logo del negocio y fotos del equipo */
img.marca-ic { object-fit: cover; background: #fff; border: 1px solid var(--line); }
.saludo.con-foto { display: flex; align-items: center; gap: 12px; }
.foto { width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center; object-fit: cover; background: var(--brand-soft); color: var(--brand-dark); font-family: var(--f-display); font-weight: 700; font-size: 1.1rem; }
.perfil { display: flex; align-items: center; gap: 14px; min-width: 0; }
.perfil > div { display: grid; min-width: 0; }
.perfil b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perfil small { color: var(--muted); }
.logo-g { width: 72px; height: 72px; border-radius: 18px; flex: none; display: grid; place-items: center; object-fit: cover; background: var(--brand); color: #fff; font-family: var(--f-display); font-weight: 700; font-size: 1.8rem; border: 1px solid var(--line); }
.logo-g.redondo { border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); }
.fila.persona { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; }
.fila.persona > span { display: grid; min-width: 0; }
.fila.persona .ic { color: var(--faint); }
label.btn input[type=file] { display: none; }

/* Caja */
.cuentas { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; margin: 0; }
.cuentas dt { color: var(--muted); }
.cuentas dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.cuentas .tot { border-top: 1px solid var(--line); padding-top: 8px; color: var(--ink); font-weight: 700; font-size: 1.08rem; }

/* Ticket impreso (solo se ve al imprimir) */
#print-root { display: none; }
@media print {
  body { padding: 0; background: #fff; }
  body > *:not(#print-root) { display: none !important; }
  body::before { display: none; }
  #print-root { display: block; }
  .tk { width: 72mm; font: 12px/1.35 'Courier New', monospace; color: #000; }
  .tk p { margin: 0 0 2px; }
  .tk-neg { display: block; font-size: 15px; text-align: center; margin-bottom: 4px; }
  .tk table { width: 100%; border-collapse: collapse; margin: 6px 0; border-block: 1px dashed #000; }
  .tk td { padding: 2px 0; vertical-align: top; }
  .tk td:last-child { text-align: right; white-space: nowrap; padding-left: 6px; }
  .tk-r { display: flex; justify-content: space-between; }
  .tk-t { font-weight: 700; font-size: 14px; }
}

/* Modal */
.ov { position: fixed; inset: 0; z-index: 50; background: rgba(10, 16, 22, .5); display: grid; place-items: center; padding: 12px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: calc(100dvh - 24px); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--surface); border-radius: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.m-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.m-body { overflow-y: auto; padding: 16px 18px; display: grid; gap: 14px; align-content: start; }
.m-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 12px 18px 16px; border-top: 1px solid var(--line); }
.m-foot .grow { flex: 1; }
.hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: .88rem; }
.hist li { display: grid; grid-template-columns: 92px 1fr auto; gap: 8px; }
.hist li span:first-child { color: var(--muted); }

/* Ingreso */
.login { max-width: 400px; margin: 10vh auto 0; display: grid; gap: 18px; }
.login .marca-ic { width: 56px; height: 56px; border-radius: 16px; font-size: 1.5rem; }
/* Marca de la plataforma (Bohe Stock): en el ingreso y al pie de «Más». */
.marca-bohe { display: flex; align-items: center; gap: 12px; }
.marca-bohe img { width: 46px; height: auto; }
.marca-bohe b { font-family: var(--f-display); font-size: 1.5rem; color: #0B1F33; letter-spacing: -.02em; }
.marca-bohe b span { color: #2F6B7F; }
.firma { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--faint); font-size: .8rem; padding: 8px 0; }
.firma img { width: 16px; height: auto; opacity: .8; }

#toast-root { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 70; display: grid; gap: 8px; width: min(440px, calc(100% - 28px)); pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow); font-size: .92rem; display: flex; gap: 10px; align-items: center; animation: fade .2s; }
.toast.err { background: var(--danger); }

@media (min-width: 860px) {
  body { padding-bottom: 32px; }
  .bottom { display: none; }
  .tabs-desk { display: flex; gap: 4px; }
  .tabs-desk button { border: 0; background: none; padding: 8px 14px; border-radius: 999px; font-weight: 600; color: var(--muted); }
  .tabs-desk button.on { background: var(--brand-soft); color: var(--brand-dark); }
  .modal { border-radius: 22px; }
  #toast-root { bottom: 24px; }
}
@media (max-width: 859px) {
  .modal { align-self: end; border-radius: 22px 22px 16px 16px; }
}
@media (max-width: 420px) {
  .estado span { display: none; }
  .kpi b { font-size: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
