/* =====================================================================
   JEANO Gestión — estilos. Tema claro, letra grande, botones táctiles.
   Mobile-first (360 px); desde 960 px aparece el menú lateral.
   ===================================================================== */
:root {
  color-scheme: light;
  --bg: #f8f5ee;          /* crema */
  --surface: #ffffff;
  --surface-2: #f2eee4;
  --ink: #1c2421;         /* texto principal (contraste 15:1 sobre blanco) */
  --muted: #55605b;       /* texto secundario (6,6:1) */
  --line: #ddd7ca;
  --line-strong: #b9b1a1;
  --brand: #0b6e4f;       /* verde (6,1:1 con blanco) */
  --brand-dark: #08563d;
  --brand-soft: #e2f1ea;
  --accent: #b45309;      /* naranja para destacar (5,0:1) */
  --accent-soft: #fdf0dc;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn-ink: #7a4b00;
  --warn-soft: #fff4d6;
  --info-ink: #1d4f91;
  --info-soft: #e6effb;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(28, 36, 33, .06), 0 4px 14px rgba(28, 36, 33, .06);
  --tap: 52px;
  --nav-h: 68px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { font-size: 18px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  line-height: 1.45; min-height: 100vh; min-height: 100dvh;
}
body.modal-open { overflow: hidden; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
a { color: var(--brand); }
.num, .money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.lead { font-size: 1.1rem; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 1.3em; height: 1.3em; flex: none; vertical-align: middle; }

:focus-visible { outline: 3px solid #1d6fd8; outline-offset: 2px; border-radius: 6px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: var(--tap); padding: .6rem 1.1rem; border-radius: var(--radius-sm);
  border: 2px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; touch-action: manipulation;
  transition: background .12s, transform .06s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.outline-danger { color: var(--danger); border-color: var(--danger); }
.btn.ghost { background: var(--surface); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.soft { background: var(--brand-soft); border-color: transparent; color: var(--brand-dark); }
.btn.big { min-height: 64px; font-size: 1.2rem; padding: .8rem 1.4rem; }
.btn.block { width: 100%; }
.btn.sm { min-height: 44px; padding: .35rem .8rem; font-size: .95rem; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px;
  border-radius: 12px; border: 0; background: transparent; color: var(--ink); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; }
.btn-row > .btn { flex: 1 1 auto; }

/* ---------- Formularios ---------- */
label, .label { display: block; font-weight: 600; margin-bottom: .3rem; }
.field { margin-bottom: 1rem; }
.field .hint { font-size: .85rem; color: var(--muted); margin-top: .25rem; }
input, select, textarea {
  width: 100%; min-height: var(--tap); padding: .55rem .8rem; font: inherit; color: var(--ink);
  background: #fff; border: 2px solid var(--line-strong); border-radius: var(--radius-sm);
}
textarea { min-height: 90px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: 3px solid rgba(11, 110, 79, .25); outline-offset: 0; }
input[aria-invalid="true"] { border-color: var(--danger); }
.field-err { color: var(--danger); font-size: .9rem; margin-top: .3rem; font-weight: 600; }
input[type=checkbox], input[type=radio] { width: 24px; height: 24px; min-height: 0; accent-color: var(--brand); }
.check { display: flex; align-items: center; gap: .6rem; min-height: 48px; font-weight: 500; cursor: pointer; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .8rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 .8rem; }
@media (max-width: 420px) { .grid3 { grid-template-columns: 1fr 1fr; } }
.money-input { font-size: 1.5rem; font-weight: 700; text-align: right; }

/* Selector segmentado (radios grandes) */
.seg { display: flex; flex-wrap: wrap; gap: .5rem; border: 0; padding: 0; margin: 0 0 1rem; }
.seg legend { font-weight: 600; margin-bottom: .4rem; padding: 0; }
.seg label { margin: 0; flex: 1 1 0; min-width: max-content; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span {
  display: flex; align-items: center; justify-content: center; text-align: center; min-height: var(--tap);
  padding: .4rem .8rem; border: 2px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; font-weight: 600; cursor: pointer;
}
.seg input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid #1d6fd8; outline-offset: 2px; }
.seg input:disabled + span { opacity: .5; cursor: not-allowed; }

/* ---------- Estructura general ---------- */
.app { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .5rem;
  min-height: 60px; padding: .3rem .5rem .3rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 1.2rem; margin: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sync-pill {
  display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; font-weight: 600; padding: .3rem .6rem;
  border-radius: 999px; background: var(--warn-soft); color: var(--warn-ink); border: 0; cursor: pointer; min-height: 36px; white-space: nowrap;
}
/* Sucursal de este equipo (solo si el comercio tiene varias) */
.branch-chip {
  display: inline-flex; align-items: center; gap: .35rem; max-width: 42vw; min-height: 36px; padding: .3rem .7rem;
  border-radius: 999px; border: 2px solid var(--brand); background: #fff; color: var(--brand-dark);
  font: inherit; font-size: .85rem; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.branch-chip span { overflow: hidden; text-overflow: ellipsis; }
/* En el celu, con el chip de sucursal, el estado de la nube queda solo con el ícono (el texto sigue en el título del botón) */
@media (max-width: 559px) {
  .topbar.has-branch { gap: .35rem; }
  .topbar.has-branch h1 { min-width: 5.5em; }
  .topbar.has-branch .branch-chip { max-width: 38vw; }
  .topbar.has-branch .sync-pill span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
.branch-pick { justify-content: flex-start; text-align: left; gap: .75rem; }
.branch-tag { display: inline-block; font-size: .78rem; font-weight: 700; color: var(--brand-dark); background: var(--brand-soft); border-radius: 999px; padding: .05rem .5rem; }
.sync-pill.ok { background: var(--brand-soft); color: var(--brand-dark); }
.sync-pill.err { background: var(--danger-soft); color: var(--danger); }
.main { flex: 1; padding: 1rem 1rem calc(var(--nav-h) + 1.5rem); width: 100%; max-width: 1200px; margin: 0 auto; }
.banner-slot { width: 100%; max-width: 1200px; margin: 0 auto; padding: 1rem 1rem 0; }
.banner-slot:empty { display: none; }
.banner-slot .notice { margin: 0; }
.banner-slot .btn-row { margin-top: .5rem; }

/* Barra inferior (celular) */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a, .bottomnav button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: var(--nav-h);
  font: inherit; font-size: .75rem; font-weight: 600; color: var(--muted); text-decoration: none; background: none; border: 0; cursor: pointer;
}
.bottomnav .ico { width: 26px; height: 26px; }
.bottomnav [aria-current="page"] { color: var(--brand); }
.bottomnav [aria-current="page"] .ico { stroke-width: 2.6; }

/* Menú lateral (PC) y cajón (celu) */
.sidenav { display: none; }
.drawer-wrap { position: fixed; inset: 0; background: rgba(20, 24, 22, .4); z-index: 50; }
.drawer {
  position: absolute; top: 0; bottom: 0; left: 0; width: min(320px, 86vw); background: var(--surface); padding: 1rem .75rem;
  overflow-y: auto; box-shadow: var(--shadow);
}
.navlist { list-style: none; margin: 0; padding: 0; }
.navlist a, .navlist button {
  display: flex; align-items: center; gap: .8rem; min-height: 54px; padding: .5rem .9rem; border-radius: 12px; width: 100%;
  color: var(--ink); text-decoration: none; font: inherit; font-weight: 600; background: none; border: 0; cursor: pointer; text-align: left;
}
.navlist a:hover, .navlist button:hover { background: var(--surface-2); }
.navlist a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-dark); }
.brand { display: flex; align-items: center; gap: .6rem; padding: .3rem .6rem 1rem; }
.brand img { width: 40px; height: 40px; border-radius: 10px; }
.brand b { display: block; font-size: 1.05rem; }
.brand small { color: var(--muted); font-size: .8rem; }
.nav-user { border-top: 1px solid var(--line); margin-top: .75rem; padding-top: .75rem; }

@media (min-width: 960px) {
  .app { flex-direction: row; }
  .sidenav {
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; width: 250px; flex: none;
    background: var(--surface); border-right: 1px solid var(--line); padding: 1rem .75rem; overflow-y: auto;
  }
  .content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .bottomnav, .topbar .menu-btn { display: none; }
  .main { padding: 1.5rem 2rem 2rem; }
  .banner-slot { padding: 1.5rem 2rem 0; }
}

/* ---------- Tarjetas y listas ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card h2 { font-size: 1.1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .6rem; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.stack > * + * { margin-top: .75rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.row {
  display: flex; align-items: center; gap: .75rem; padding: .7rem .2rem; border-bottom: 1px solid var(--line); min-height: 60px;
}
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; overflow-wrap: anywhere; }
.row .sub { font-size: .85rem; color: var(--muted); }
button.row { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); font: inherit; color: inherit; text-align: left; cursor: pointer; }
button.row:hover { background: var(--surface-2); }
.empty { text-align: center; color: var(--muted); padding: 1.5rem 1rem; }

.badge { display: inline-block; font-size: .78rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px; background: var(--surface-2); color: var(--ink); white-space: nowrap; }
.badge.ok { background: var(--brand-soft); color: var(--brand-dark); }
.badge.warn { background: var(--warn-soft); color: var(--warn-ink); }
.badge.err { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info-ink); }

.notice { padding: .8rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; border-left: 5px solid; }
.notice-info { background: var(--info-soft); border-color: var(--info-ink); color: #163b6b; }
.notice-warn { background: var(--warn-soft); border-color: #c98a00; color: var(--warn-ink); }
.notice-error { background: var(--danger-soft); border-color: var(--danger); color: #7d1810; }
.notice-ok { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); }
.notice p:last-child { margin: 0; }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1rem; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.stat .k { font-size: .85rem; color: var(--muted); font-weight: 600; }
.stat .v { font-size: clamp(1.1rem, 5.2vw, 1.45rem); font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat.hero { grid-column: 1 / -1; background: var(--brand); color: #fff; border-color: var(--brand); }
.stat.hero .k { color: #d9f0e6; }
.stat.hero .v { font-size: 2.2rem; }

.chips { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .25rem; margin-bottom: .75rem; scrollbar-width: thin; }
.chip { flex: none; min-height: 44px; padding: .3rem 1rem; border-radius: 999px; border: 2px solid var(--line-strong); background: #fff; font: inherit; font-weight: 600; cursor: pointer; color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { background: var(--surface-2); font-weight: 700; position: sticky; top: 0; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 800; background: var(--surface-2); }

/* Barras simples (reportes) — una sola serie, el valor va en texto */
.bars { list-style: none; margin: 0; padding: 0; }
.bars li { margin-bottom: .7rem; }
.bars .lbl { display: flex; justify-content: space-between; gap: .5rem; font-weight: 600; font-size: .95rem; }
.bars .track { height: 12px; background: var(--surface-2); border-radius: 6px; margin-top: .25rem; overflow: hidden; }
.bars .fill { height: 100%; background: var(--brand); border-radius: 0 4px 4px 0; min-width: 4px; }
.bars .sub-lbl { font-size: .85rem; color: var(--muted); }

/* ---------- Vender ---------- */
.pos { display: grid; gap: 1rem; }
@media (min-width: 960px) {
  .pos { grid-template-columns: minmax(0, 1fr) 400px; align-items: start; }
  .pos .cart-panel { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); display: flex; flex-direction: column; }
  .pos .cart-panel .cart-list { overflow-y: auto; }
  .pay-bar { display: none !important; }
}
.searchbox { position: relative; }
.searchbox .ico { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.searchbox input { min-height: 60px; font-size: 1.15rem; padding-left: 3rem; border-radius: var(--radius); }
.results { margin-top: .5rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); max-height: 55vh; overflow-y: auto; }
.result {
  display: flex; align-items: center; gap: .75rem; width: 100%; min-height: 60px; padding: .5rem .9rem; border: 0; border-bottom: 1px solid var(--line);
  background: none; font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.result:hover, .result:focus-visible { background: var(--brand-soft); }
.result .grow { flex: 1; min-width: 0; }
.result .title { font-weight: 600; overflow-wrap: anywhere; }
.result .price { font-weight: 800; font-size: 1.1rem; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
@media (min-width: 600px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1200px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile {
  display: flex; flex-direction: column; justify-content: space-between; gap: .3rem; min-height: 92px; padding: .7rem .8rem;
  background: #fff; border: 2px solid var(--line); border-radius: var(--radius); font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.tile:hover { border-color: var(--brand); }
.tile .t { font-weight: 600; font-size: .95rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.tile .p { font-weight: 800; font-size: 1.1rem; color: var(--brand-dark); }
.tile.libre { border-style: dashed; border-color: var(--line-strong); background: var(--surface-2); }
.cart-panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.cart-panel .card-head { padding: .8rem 1rem 0; }
.cart-list { list-style: none; margin: 0; padding: 0 1rem; }
.cart-item { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.cart-item .top { display: flex; gap: .5rem; align-items: flex-start; }
.cart-item .name { flex: 1; font-weight: 600; overflow-wrap: anywhere; }
.cart-item .sub { font-weight: 800; white-space: nowrap; }
.cart-item .ctrl { display: flex; align-items: center; gap: .4rem; margin-top: .4rem; }
.cart-item .unit { color: var(--muted); font-size: .85rem; margin-left: auto; }
.qty-btn { width: 48px; height: 48px; border-radius: 12px; border: 2px solid var(--line-strong); background: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink); }
.qty-val { min-width: 64px; height: 48px; border-radius: 10px; border: 2px solid var(--line); background: var(--surface-2); font: inherit; font-weight: 700; text-align: center; cursor: pointer; padding: 0 .5rem; color: var(--ink); }
.cart-totals { padding: .8rem 1rem 1rem; }
.cart-totals .line { display: flex; justify-content: space-between; gap: .5rem; }
.cart-totals .total { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.cart-opts { display: flex; gap: .5rem; flex-wrap: wrap; margin: .6rem 0; }
.cart-opts .btn { flex: 1 1 140px; }
.pay-bar {
  position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); z-index: 25; display: flex; align-items: center; gap: .75rem;
  padding: .6rem 1rem; background: #fff; border-top: 2px solid var(--brand); box-shadow: 0 -4px 14px rgba(0, 0, 0, .08);
}
.pay-bar .tot { flex: 1; min-width: 0; }
.pay-bar .tot small { display: block; color: var(--muted); font-size: .8rem; font-weight: 600; }
.pay-bar .tot b { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.pay-bar .btn { min-width: 140px; }
.has-paybar .main { padding-bottom: calc(var(--nav-h) + 110px); }

/* Cobro */
.pay-total { text-align: center; padding: .5rem 0 1rem; }
.pay-total .v { font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.methods { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; margin-bottom: 1rem; }
@media (min-width: 560px) { .methods { grid-template-columns: repeat(3, 1fr); } }
.pay-line { display: flex; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.pay-line .m { flex: 0 0 38%; font-weight: 700; }
.pay-line input { flex: 1; text-align: right; font-weight: 700; font-size: 1.2rem; }
.quick-bills { display: flex; flex-wrap: wrap; gap: .4rem; margin: .25rem 0 1rem; }
.quick-bills .btn { flex: 1 1 22%; min-height: 48px; padding: .3rem .4rem; font-size: .95rem; }
.change-box { text-align: center; border-radius: var(--radius); padding: .8rem; margin: .5rem 0 1rem; background: var(--surface-2); }
.change-box .k { font-weight: 700; color: var(--muted); }
.change-box .v { font-size: 2.2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.change-box.ok { background: var(--brand-soft); }
.change-box.ok .v { color: var(--brand-dark); }
.change-box.miss { background: var(--danger-soft); }
.change-box.miss .v { color: var(--danger); }

/* ---------- Ingreso ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: flex; align-items: flex-start; justify-content: center; padding: 1.5rem 1rem; }
.login-box { width: 100%; max-width: 520px; }
.login-logo { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.25rem; }
.login-logo img { width: 56px; height: 56px; border-radius: 14px; }
.login-logo b { font-size: 1.4rem; display: block; }
.users-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
.user-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; min-height: 110px; padding: .8rem;
  border-radius: var(--radius); border: 2px solid var(--line); background: #fff; font: inherit; cursor: pointer; color: var(--ink);
}
.user-btn:hover { border-color: var(--brand); }
.avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.3rem; }
.user-btn b { font-size: 1.05rem; }
.user-btn small { color: var(--muted); }
.pin-dots { display: flex; justify-content: center; gap: .9rem; margin: 1rem 0; }
.pin-dots i { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--ink); }
.pin-dots i.on { background: var(--ink); }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; max-width: 340px; margin: 0 auto; }
.pinpad button { min-height: 68px; font: inherit; font-size: 1.6rem; font-weight: 700; border-radius: var(--radius); border: 2px solid var(--line); background: #fff; cursor: pointer; color: var(--ink); }
.pinpad button:active { background: var(--brand-soft); }
.steps { display: flex; gap: .4rem; margin-bottom: 1rem; }
.steps i { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.steps i.on { background: var(--brand); }

/* ---------- Ventanas ---------- */
.modal-wrap {
  position: fixed; inset: 0; z-index: 100; background: rgba(20, 24, 22, .45); display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: var(--surface); width: 100%; max-height: 94vh; max-height: 94dvh; display: flex; flex-direction: column;
  border-radius: 18px 18px 0 0; box-shadow: 0 -6px 30px rgba(0, 0, 0, .2);
}
@media (min-width: 640px) {
  .modal-wrap { align-items: center; padding: 1rem; }
  .modal { max-width: 560px; border-radius: 18px; }
  .modal.wide { max-width: 860px; }
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .7rem .6rem .5rem 1.1rem; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 1.2rem; }
.modal-body { padding: 1rem 1.1rem; overflow-y: auto; flex: 1; }
.modal-foot { display: flex; flex-wrap: wrap; gap: .6rem; padding: .75rem 1.1rem calc(.75rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.modal-foot .btn { flex: 1 1 140px; }
/* Con una ventana abierta los avisos van arriba para no tapar el contenido */
body.modal-open #toasts { top: 12px; bottom: auto; }

/* ---------- Avisos flotantes ---------- */
#toasts { position: fixed; z-index: 200; left: 50%; transform: translateX(-50%); bottom: calc(150px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: .5rem; width: min(92vw, 460px); pointer-events: none; }
.toast { padding: .55rem .9rem; font-size: .95rem; text-align: center; border-radius: 12px; font-weight: 600; box-shadow: var(--shadow); background: var(--ink); color: #fff; transition: opacity .3s; }
.toast-ok { background: var(--brand-dark); }
.toast-error { background: var(--danger); }
.toast-warn { background: #7a4b00; }
.toast.out { opacity: 0; }

/* ---------- Ticket (vista previa e impresión) ---------- */
.ticket { font-family: "Courier New", ui-monospace, monospace; font-size: 13px; line-height: 1.35; color: #000; background: #fff; width: 100%; max-width: 300px; margin: 0 auto; padding: 8px; border: 1px dashed var(--line-strong); }
.ticket .c { text-align: center; }
.ticket .b { font-weight: 700; }
.ticket .big { font-size: 17px; font-weight: 700; }
.ticket hr { border: 0; border-top: 1px dashed #000; margin: 6px 0; }
.ticket .ln { display: flex; justify-content: space-between; gap: 6px; }
.ticket .ln span:last-child { white-space: nowrap; }
.ticket .it { margin-bottom: 3px; }
.ticket .qr { display: flex; justify-content: center; margin: 6px 0; }
.ticket .qr img, .ticket .qr canvas { width: 120px; height: 120px; }
#print-area { display: none; }

@media print {
  @page { margin: 0; }
  body { background: #fff; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; }
  #print-area .ticket { border: 0; max-width: none; padding: 2mm; }
  #print-area.w58 .ticket { width: 54mm; font-size: 11px; }
  #print-area.w80 .ticket { width: 76mm; font-size: 12.5px; }
  #print-area.a4 .ticket { width: auto; max-width: 180mm; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Orden de la pantalla Vender: en celu el carrito va entre la búsqueda y los más vendidos */
.pos { grid-template-areas: "search" "cart" "quick"; }
.pos-search { grid-area: search; }
.pos .cart-panel { grid-area: cart; }
.pos-quick { grid-area: quick; }
@media (min-width: 960px) {
  .pos { grid-template-areas: "search cart" "quick cart"; grid-template-rows: auto 1fr; }
}
@media (max-width: 959px) { .pos .cart-panel.is-empty { display: none; } }
a.chip { display: inline-flex; align-items: center; text-decoration: none; }

@media (min-width: 960px) { #toasts { bottom: 24px; } }

/* ---------- Escanear con la cámara ---------- */
.searchbox .scan-btn { position: absolute; right: .3rem; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; color: var(--brand-dark); background: var(--brand-soft); }
.searchbox .scan-btn .ico { position: static; transform: none; color: inherit; width: 26px; height: 26px; }
.searchbox.has-scan input { padding-right: 3.8rem; }
.field-scan { display: flex; gap: .4rem; align-items: stretch; }
.field-scan input { flex: 1; min-width: 0; }
.field-scan .scan-btn { width: var(--tap); height: auto; min-height: var(--tap); flex: none; color: var(--brand-dark); background: var(--brand-soft); border: 2px solid transparent; }
.field-scan .scan-btn .ico { width: 26px; height: 26px; }
body.scan-open { overflow: hidden; }
.scan-wrap { position: fixed; inset: 0; z-index: 150; display: flex; flex-direction: column; background: var(--bg); }
.scan-head { padding: .6rem 1rem .5rem; padding-top: calc(.6rem + env(safe-area-inset-top)); background: var(--surface); border-bottom: 1px solid var(--line); }
.scan-head h2 { margin: 0; font-size: 1.25rem; }
.scan-hint { margin: .2rem 0 0; color: var(--muted); font-size: .95rem; }
.scan-view { position: relative; flex: 1; min-height: 0; background: #1c2421; overflow: hidden; }
.scan-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame {
  position: absolute; left: 50%; top: 50%; width: min(86%, 520px); height: min(42%, 260px); transform: translate(-50%, -50%);
  border-radius: 16px; box-shadow: 0 0 0 100vmax rgba(20, 24, 22, .45); outline: 4px solid #fff; outline-offset: 0;
}
.scan-wrap.hit .scan-frame { outline-color: #3ddc97; }
.scan-laser { position: absolute; left: 6%; right: 6%; top: 50%; height: 3px; background: #ff3b30; box-shadow: 0 0 8px #ff3b30; border-radius: 2px; animation: scan-laser 1.6s ease-in-out infinite alternate; }
@keyframes scan-laser { from { transform: translateY(-38px); } to { transform: translateY(38px); } }
@media (prefers-reduced-motion: reduce) { .scan-laser { animation: none; } }
.scan-state { position: absolute; left: 0; right: 0; top: 1rem; text-align: center; color: #fff; font-weight: 700; text-shadow: 0 1px 3px #000; }
.scan-error { position: absolute; inset: 0; overflow-y: auto; background: var(--surface); padding: 1.1rem; }
.scan-error h3 { margin: 0 0 .6rem; font-size: 1.25rem; color: var(--danger); }
.scan-steps { padding-left: 1.2rem; }
.scan-steps li { margin-bottom: .5rem; }
.scan-foot { background: var(--surface); border-top: 1px solid var(--line); padding: .6rem 1rem calc(.75rem + env(safe-area-inset-bottom)); display: grid; gap: .55rem; }
.scan-msg { margin: 0; min-height: 1.6em; font-weight: 700; text-align: center; border-radius: 10px; padding: .2rem .5rem; }
.scan-msg.ok { background: var(--brand-soft); color: var(--brand-dark); }
.scan-msg.warn { background: var(--warn-soft); color: var(--warn-ink); }
.scan-msg.error { background: var(--danger-soft); color: var(--danger); }
.scan-type label { display: block; font-weight: 600; margin-bottom: .25rem; }
.scan-type-row { display: flex; gap: .5rem; }
.scan-type-row input { flex: 1; min-width: 0; font-size: 1.2rem; }
.scan-multi { justify-content: center; }
.scan-btns { display: flex; flex-wrap: wrap; gap: .5rem; }
.scan-btns .btn { flex: 1 1 120px; }
.scan-btns .btn[aria-pressed="true"] { background: var(--warn-soft); border-color: var(--accent); }
/* Mientras la cámara está abierta, los avisos van en la línea de mensajes de la propia ventana */
body.scan-open #toasts { display: none; }

/* ---------- Contar stock (góndola) ---------- */
a.btn { text-decoration: none; }
.ct-diff { align-self: center; flex: none; min-width: 3.2rem; text-align: center; font-weight: 800; font-size: 1.15rem; border-radius: 10px; padding: .2rem .5rem; background: var(--surface-2); font-variant-numeric: tabular-nums; }
.ct-diff.down { background: var(--danger-soft); color: var(--danger); }
.ct-diff.up { background: var(--brand-soft); color: var(--brand-dark); }
.ct-resume { display: grid; gap: .6rem; margin-bottom: 1rem; }
.ct-sys { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; padding: .6rem .8rem; background: var(--surface-2); border-radius: var(--radius-sm); }
.ct-sys b { font-size: 1.3rem; }
.ct-already { margin: .6rem 0 0; padding: .5rem .8rem; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn-ink); }
.ct-qty-label { display: block; font-weight: 700; margin: .9rem 0 .3rem; font-size: 1.1rem; }
.ct-qty { font-size: 2.6rem !important; font-weight: 800; text-align: center; min-height: 76px !important; font-variant-numeric: tabular-nums; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-top: .6rem; }
.keypad .key { min-height: 62px; font: inherit; font-size: 1.7rem; font-weight: 700; border-radius: 12px; border: 2px solid var(--line-strong); background: #fff; color: var(--ink); cursor: pointer; }
.keypad .key:active { background: var(--brand-soft); }
@media (max-height: 700px) { .keypad .key { min-height: 52px; } }

/* ---------- Devoluciones / notas de crédito y remitos (renglones con cantidad) ---------- */
.ret-line { padding: .7rem .5rem; border-bottom: 1px solid var(--line); border-radius: 10px; }
.ret-line.on { background: var(--brand-soft); }
.ret-line .top { display: flex; gap: .5rem; align-items: flex-start; }
.ret-line .name { flex: 1; font-weight: 600; overflow-wrap: anywhere; }
.ret-line .top .money { font-weight: 800; white-space: nowrap; }
.ret-line .ctrl { display: flex; align-items: center; gap: .4rem; margin-top: .4rem; flex-wrap: wrap; }
.ret-line .qty-val { width: 84px; }

/* ---------- Tablero "Hoy" ---------- */
.stats.dash .stat.hero .v { font-size: clamp(2rem, 9vw, 2.8rem); }
.hero-sub { font-size: 1rem; color: #e8f6ef; margin-top: .1rem; }
.cmps { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.cmp { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .9rem; background: rgba(255, 255, 255, .16); }
.cmp.up { background: #e2f1ea; color: var(--brand-dark); }
.cmp.down { background: var(--danger-soft); color: var(--danger); }
.dash-grid { display: grid; grid-template-columns: 1fr; gap: 0 1rem; }
@media (min-width: 900px) { .dash-grid { grid-template-columns: 1fr 1fr; } }
.todos { list-style: none; margin: 0; padding: 0; }
.todo { display: flex; align-items: center; gap: .6rem; padding: .6rem .7rem; border-radius: 10px; margin-bottom: .5rem; border-left: 5px solid; }
.todo .grow { flex: 1; min-width: 0; }
.todo .sub { display: block; font-size: .85rem; color: var(--muted); }
.todo.err { background: var(--danger-soft); border-color: var(--danger); }
.todo.warn { background: var(--warn-soft); border-color: #c98a00; }
.todo.info { background: var(--info-soft); border-color: var(--info-ink); }
.ok-line { color: var(--brand-dark); font-weight: 600; margin: 0; }
.hours { display: flex; align-items: flex-end; gap: 3px; height: 110px; padding-top: .3rem; }
.hours .h { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.hours .b { width: 100%; background: var(--brand); border-radius: 4px 4px 0 0; }
.hours span { font-size: .72rem; color: var(--muted); margin-top: .15rem; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--info-ink); text-decoration: underline; cursor: pointer; min-height: 0; }

/* Tira "Hoy" arriba de Vender (dueño y encargado) */
.hoy-strip { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem .7rem; padding: .55rem .9rem; margin-bottom: .75rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; box-shadow: var(--shadow); }
.hoy-strip .k { font-weight: 700; color: var(--muted); }
.hoy-strip b { font-size: 1.2rem; }
.hoy-strip .cmp { background: var(--surface-2); }
.hoy-strip .cmp.up { background: var(--brand-soft); }
.hoy-strip .go { margin-left: auto; font-weight: 700; color: var(--brand-dark); }
