:root {
  --bg: #f9f6ef; --surface: #ffffff; --surface-2: #f1ede1; --line: #e4dfd2;
  --ink: #22221a; --ink-2: #55554a; --muted: #7d7c70;
  /* Colores de Bellaflor: verde oliva y crema (como el afiche y el video) */
  --brand: #5c6308; --brand-2: #78801c; --brand-soft: #edeed4;
  --accent: #e86e1e; --accent-soft: #fdebdc;
  --ok: #4a6b12; --ok-soft: #e8efd5; --warn: #9a5b00; --warn-soft: #fdf0d5;
  --bad: #b3261e; --bad-soft: #fbe4e1; --info: #1d5a8c; --info-soft: #e2edf7;
  --radius: 14px; --shadow: 0 1px 2px rgba(34,34,26,.06), 0 4px 14px rgba(34,34,26,.06);
  --nav-h: 64px;
  /* Colores de formas de pago en gráficos (en el orden de las formas) */
  --f0: #5c6308; --f1: #702c92; --f2: #e86e1e; --f3: #a3ab4a; --f4: #3a78b5; --f5: #8a6a3f;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--ink); background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); font-size: 15px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, label { -webkit-tap-highlight-color: transparent; } /* sin el destello azul al tocar en Android */
.stepper button:active { background: var(--line); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
a { color: var(--brand); }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.right { text-align: right; } .center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--brand); color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; display: flex; align-items: center; gap: 12px; }
.topbar .title { font-weight: 600; font-size: 16px; line-height: 1.2; }
.topbar .sub { font-size: 12px; opacity: .8; }
.topbar .avatar { margin-left: auto; width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.16);
  border: 0; color: #fff; font-weight: 600; cursor: pointer; }
main { padding: 16px 16px calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); max-width: 1100px; margin: 0 auto; }
.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line);
  display: flex; padding-bottom: env(safe-area-inset-bottom); overflow-x: auto; }
.nav button { flex: 1; min-width: 68px; height: var(--nav-h); border: 0; background: none; cursor: pointer; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11.5px; position: relative; }
.nav button svg { width: 22px; height: 22px; }
.nav button.on { color: var(--brand); font-weight: 600; }
.nav button.on::before { content: ""; position: absolute; top: 0; left: 25%; right: 25%; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }
.nav .badge { position: absolute; top: 8px; left: calc(50% + 6px); }
@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 220px 1fr; }
  .nav { position: sticky; top: 58px; height: calc(100vh - 58px); flex-direction: column; border-top: 0; border-right: 1px solid var(--line); padding: 12px 8px; overflow: auto; }
  .nav button { flex: 0 0 auto; height: 46px; flex-direction: row; justify-content: flex-start; padding: 0 14px; gap: 12px; font-size: 14.5px; border-radius: 10px; }
  .nav button.on { background: var(--brand-soft); }
  .nav button.on::before { display: none; }
  .nav .badge { position: static; margin-left: auto; }
  main { padding-bottom: 32px; width: 100%; }
}

/* ---------- Componentes ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.card + .card { margin-top: 12px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 22px 2px 10px; }
.section-title:first-child { margin-top: 4px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border-radius: 11px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; text-decoration: none; color: var(--ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:active { background: var(--brand-2); }
.btn.danger { color: var(--bad); border-color: #efc2bd; }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.block { width: 100%; } .btn.sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; }
.btn.lg { min-height: 52px; font-size: 16px; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.field { display: block; }
.field > span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 5px; font-weight: 500; }
.input, select.input, textarea.input { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--surface); outline: none; font-size: 16px; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input.money { text-align: right; font-variant-numeric: tabular-nums; }
.input.pin { letter-spacing: 12px; text-align: center; font-size: 26px; font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 520px) { .grid3 { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-ok { background: var(--ok-soft); color: var(--ok); } .b-warn { background: var(--warn-soft); color: var(--warn); }
.b-bad { background: var(--bad-soft); color: var(--bad); } .b-info { background: var(--info-soft); color: var(--info); }
.b-mute { background: var(--surface-2); color: var(--ink-2); } .b-dot { background: var(--bad); color: #fff; min-width: 20px; justify-content: center; padding: 1px 6px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chip { flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 14px; font-size: 13.5px; cursor: pointer; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); }
.alert { border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.alert.warn { background: var(--warn-soft); color: #6b3f00; } .alert.info { background: var(--info-soft); color: #143f63; }
.alert.bad { background: var(--bad-soft); color: #7d1a14; } .alert.ok { background: var(--ok-soft); color: #3a4a0a; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* Listas */
.list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.item { display: flex; gap: 12px; align-items: center; padding: 13px 16px; border-bottom: 1px solid var(--line); cursor: pointer; background: none; width: 100%; border-left: 0; border-right: 0; border-top: 0; text-align: left; }
.item:last-child { border-bottom: 0; }
.item:active { background: var(--surface-2); }
.item .t { font-weight: 600; } .item .s { font-size: 13px; color: var(--muted); }
.item .amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Saldo */
.balance { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-radius: 18px; padding: 18px; }
.balance .lbl { opacity: .85; font-size: 13px; }
.balance .big { font-size: 40px; font-weight: 700; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.balance .meta { display: flex; gap: 18px; font-size: 13px; opacity: .9; margin-top: 4px; }
.saldos-f { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.saldos-f > div { background: rgba(255,255,255,.14); border-radius: 12px; padding: 8px 10px; display: flex; flex-direction: column; gap: 1px; font-size: 13px; }
.saldos-f strong { font-size: 20px; }
.saldos-f .tiny { opacity: .8; }

/* Venta */
.buyer { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--brand-soft); }
.buyer .ini { width: 42px; height: 42px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; flex: 0 0 auto; }
.prod { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 7px 8px; border-bottom: 1px solid var(--line); }
.prod:last-child { border-bottom: 0; }
.prod.sel { background: var(--brand-soft); border-radius: 10px; }
.prod-acc { display: flex; align-items: center; gap: 6px; }
.quitar { width: 34px; height: 34px; border-radius: 10px; border: 1px solid #efc2bd; background: var(--surface); color: var(--bad); display: grid; place-items: center; cursor: pointer; flex: 0 0 auto; }
.quitar:active { background: var(--bad-soft); }
.prod .n { font-weight: 600; line-height: 1.25; } .prod .p { font-size: 12.5px; color: var(--muted); line-height: 1.3; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.stepper button { width: 40px; height: 36px; border: 0; background: var(--surface-2); font-size: 20px; cursor: pointer; }
/* Toques rápidos: sin zoom por doble toque ni selección del número */
.stepper { touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.stepper span { min-width: 32px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.prod .later { grid-column: 1 / -1; font-size: 13px; min-height: 30px; }
.totalbar { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px); z-index: 5; background: var(--ink); color: #fff;
  border-radius: 14px; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 6px 20px rgba(0,0,0,.18); margin-top: 14px; }
@media (min-width: 900px) { .totalbar { bottom: 12px; } }
.totalbar { gap: 10px; }
.totalbar .big { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pay { display: grid; grid-template-columns: 1fr 130px; gap: 8px; align-items: center; padding: 8px 0; }
.pay label { font-weight: 500; }
/* Hoja de pago: lista de formas de pago con un ícono de acción por fila */
/* Hoja de pago alta: ocupa casi toda la pantalla para que los paneles (QR, PIN, vuelto) quepan sin desplazar */
.modal.alto { height: 92vh; height: 92dvh; display: flex; flex-direction: column; }
@media (min-width: 640px) { .modal.alto { height: min(92vh, 780px); } }
.modal.alto #mbody { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.modal.alto .pago { flex: 1; display: flex; flex-direction: column; }
.modal.alto .pg-foot { margin-top: auto; }
.pago { position: relative; }
.pg-list { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.pg-row { display: grid; grid-template-columns: 1fr 96px 46px; align-items: center; gap: 8px; padding: 10px 10px 10px 8px; border-bottom: 1px solid var(--line); }
.pg-row:last-child { border-bottom: 0; }
.pg-row.off { opacity: .5; }
.pg-name { display: flex; align-items: center; gap: 10px; border: 0; background: none; text-align: left; font: inherit; color: var(--ink); cursor: pointer; padding: 6px 4px; border-radius: 10px; min-width: 0; }
.pg-name:active { background: var(--surface-2); }
.pg-name:disabled { cursor: not-allowed; }
.pg-ic { font-size: 22px; line-height: 1; }
.pg-l { display: block; font-weight: 600; font-size: 15px; }
.pg-s { display: block; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pg-row .input { padding: 10px 8px; }
.pg-act { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); display: grid; place-items: center; cursor: pointer; }
.pg-act:disabled { opacity: .45; cursor: not-allowed; }
.pg-act.on { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.pg-act.pend { color: var(--warn); border-color: #e7c27a; background: var(--warn-soft); }
.pg-act.ok { color: #fff; border-color: var(--ok); background: var(--ok); }
.pg-act.vacio { border: 0; background: none; cursor: default; }
/* Saldo: se aplica solo (primero Regalo, luego Dcto. Rol); la diferencia va a las formas directas */
.pg-sec { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 14px 4px 6px; }
.pg-sec strong { font-size: 15px; color: var(--ink); text-transform: none; letter-spacing: 0; }
.pg-row.pg-saldo { grid-template-columns: 1fr auto; }
.pg-saldo .pg-name { cursor: default; }
.pg-monto { font-weight: 700; font-size: 16px; padding-right: 6px; }
.pg-aprob { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; border: 0; border-top: 1px solid var(--line); font: inherit; font-weight: 600; text-align: left; cursor: pointer; background: var(--surface-2); color: var(--ink-2); }
.pg-aprob.pend { background: var(--warn-soft); color: var(--warn); }
.pg-aprob.ok { background: var(--ok-soft); color: var(--ok); }
.pg-aprob:disabled { cursor: default; }
.pg-aprob .tiny { opacity: .85; font-weight: 500; }
.qr-img { width: 200px; height: 200px; max-width: 60vw; max-height: 60vw; object-fit: cover; object-position: center; background: #fff; border-radius: 12px; padding: 6px; border: 1px solid var(--line); }
/* El panel cubre la hoja de pago sin agrandarla (si no cabe, se desplaza por dentro) */
.pg-over { position: absolute; inset: -4px -2px 0; overflow: auto; z-index: 3; background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.pg-foot { position: sticky; bottom: calc(-18px - env(safe-area-inset-bottom)); display: flex; gap: 8px; margin: 14px -16px calc(-18px - env(safe-area-inset-bottom));
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); z-index: 2; }
@media (max-width: 360px) { .pg-row { grid-template-columns: 1fr 84px 42px; gap: 6px; } .pg-l { font-size: 14px; } .pg-ic { font-size: 19px; } .pg-name { gap: 7px; } .pg-act { width: 40px; height: 40px; } .pg-foot .btn:first-child { padding: 0 10px; font-size: 13px; } }
/* Formas de pago en una línea: nombre + botón "Todo" encima de cada monto */
/* Cada columna mide lo que su encabezado (nombre + "Todo"); la caja ocupa ese ancho (montos de 2-3 dígitos) */
.pays { display: grid; grid-template-columns: repeat(3, max-content); justify-content: space-between; gap: 6px; }
.payc { display: flex; flex-direction: column; gap: 5px; }
.payc .payh { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.payc label { font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.payc .input { width: 0; min-width: 100%; padding: 10px 8px; } /* no agranda la columna: toma el ancho del encabezado */
.todo { border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; font-size: 10px; font-weight: 600; padding: 2px 7px; line-height: 1.3; cursor: pointer; color: var(--brand); }
.todo:disabled { opacity: .4; cursor: not-allowed; }
.todo:active { background: var(--brand-soft); }
@media (max-width: 360px) { .payc label { font-size: 12px; } .todo { padding: 2px 6px; font-size: 9.5px; } .payc .payh { gap: 4px; } }
@media (max-width: 340px) { .pays { gap: 4px; } .payc label { font-size: 11.5px; } .todo { padding: 2px 5px; font-size: 9.5px; } .payc .payh { gap: 3px; } .payc .input { padding: 10px 6px; } }
.linkbtn { border: 0; background: none; color: var(--brand); font-weight: 600; font-size: 12.5px; line-height: 1.15; text-align: right; cursor: pointer; padding: 2px 0; }
.steps-h .remain { font-size: 14px; }
.remain { font-weight: 700; font-variant-numeric: tabular-nums; }
.remain.ok { color: var(--ok); } .remain.bad { color: var(--bad); }
.steps-h { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 10px; }
/* Vender: tarjetas más compactas */
.card.vcard { padding: 12px 14px; }
.card.vcard + .card.vcard { margin-top: 10px; }
.steps-h { margin-bottom: 8px; }
.steps-h .n { width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 13px; }

/* Detalle venta */
.lines { width: 100%; border-collapse: collapse; font-size: 14px; }
.lines td { padding: 7px 0; border-bottom: 1px dashed var(--line); vertical-align: top; }
.lines tr:last-child td { border-bottom: 0; }
.lines .tot td { border-top: 1px solid var(--ink); border-bottom: 0; font-weight: 700; padding-top: 9px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 12px 20px; font-size: 13.5px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.timeline li::after { content: ""; position: absolute; left: 7.5px; top: 16px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }

/* KPIs y gráficos */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.kpi .l { font-size: 12.5px; color: var(--ink-2); }
.kpi .v { font-size: 26px; font-weight: 700; letter-spacing: -.3px; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .d { font-size: 12px; color: var(--muted); margin-top: 2px; }
.bars { display: grid; gap: 10px; }
.bar { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 10px; align-items: center; font-size: 13.5px; }
.bar .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .track { height: 12px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar .fill { height: 100%; background: var(--brand); border-radius: 0 4px 4px 0; min-width: 2px; }
.bar .val { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 72px; text-align: right; color: var(--ink); }
.bar:hover .fill { background: var(--brand-2); }
.split { display: flex; height: 14px; border-radius: 4px; overflow: hidden; gap: 2px; background: var(--surface); }
.split > div { height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.c-saldo { background: #5c6308; } .c-efectivo { background: #e86e1e; } .c-transferencia { background: #3a78b5; }

/* Catálogo por categorías: cuadrícula de 4 por línea */
.cat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.cat-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  min-height: 104px; padding: 12px 6px 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; text-align: center; font: inherit; color: var(--ink); }
.cat-tile:active { background: var(--surface-2); }
.cat-tile:hover { border-color: var(--brand); }
.cat-tile .ic { font-size: 30px; line-height: 1; }
.cat-tile .nm { font-weight: 600; font-size: 13px; line-height: 1.2; hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; max-width: 100%; }
.cat-tile .ct { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
@media (min-width: 700px) { .cat-tile { min-height: 140px; } .cat-tile .ic { font-size: 40px; } .cat-tile .nm { font-size: 15px; } .cat-tile .ct { font-size: 13px; } }
@media (max-width: 360px) { .cat-grid { gap: 6px; } .cat-tile { padding: 10px 3px 8px; min-height: 92px; } .cat-tile .nm { font-size: 11px; } .cat-tile .ct { font-size: 10px; } .cat-tile .ic { font-size: 26px; } }
.cat-tile .av { width: 44px; height: 44px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 16px; letter-spacing: .5px; }
@media (min-width: 700px) { .cat-tile .av { width: 58px; height: 58px; font-size: 20px; } }
@media (max-width: 360px) { .cat-tile .av { width: 38px; height: 38px; font-size: 14px; } }
/* Vender a pantalla fija: pedidos y comprador arriba, solo la lista de productos se desplaza,
   y el total queda fijo justo encima del menú */
/* La página no se desplaza (ni "jalar para recargar"): solo la lista de productos */
html.vender-fijo, body.vender-fijo { overflow: hidden; overscroll-behavior: none; height: var(--app-h, 100vh); }
body.vender-fijo main { display: flex; flex-direction: column; overflow: hidden;
  height: calc(100vh - var(--top-h, 58px)); height: calc(var(--app-h, 100dvh) - var(--top-h, 58px));
  padding-bottom: calc(var(--nav-h) + 10px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { body.vender-fijo main { padding-bottom: 16px; } }
body.vender-fijo main > * { flex: 0 0 auto; }
body.vender-fijo .prod-card { flex: 1 1 auto; min-height: 120px; display: flex; flex-direction: column; overflow: hidden; }
body.vender-fijo #prod-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -4px; padding: 0 4px; }
body.vender-fijo .totalbar { position: static; margin-top: 10px; }
body.vender-fijo #r-comp { max-height: 38vh; overflow-y: auto; }
.prod-h #q-prod { flex: 1; min-width: 0; min-height: 38px; padding: 7px 12px; font-size: 15px; font-weight: 400; margin-left: 6px; }
/* Más compacto para que quepan más productos en celulares pequeños */
body.vender-fijo main { padding-top: 10px; }
body.vender-fijo .ped-bar { margin-bottom: 8px; }
body.vender-fijo .ped { padding: 6px 10px; }
body.vender-fijo .card.vcard + .card.vcard { margin-top: 8px; }
body.vender-fijo .prod-card { padding-top: 10px; padding-bottom: 6px; }
body.vender-fijo .totalbar { margin-top: 8px; padding: 8px 14px; }
body.vender-fijo .totalbar .big { font-size: 20px; }
body.vender-fijo .totalbar .btn.lg { min-height: 46px; }
/* Comprador elegido: una sola línea */
.comp-linea { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.comp-linea .n-paso { width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: 0 0 auto; }
.comp-linea .cl-nombre { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comp-linea .grow { min-width: 0; }
.comp-linea .linkbtn { padding: 4px 0 4px 6px; }
/* Pedidos abiertos (máx. 3) en la pantalla Vender */
.ped-bar { display: flex; gap: 8px; overflow-x: auto; margin: -4px -2px 12px; padding: 4px 2px; scrollbar-width: none; }
.ped { flex: 1 1 0; min-width: 96px; max-width: 220px; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left;
  border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 8px 12px; cursor: pointer; font: inherit; color: var(--ink); box-shadow: var(--shadow); }
.ped .pn { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ped .pt { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ped.on { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft), var(--shadow); }
.ped.e-esperando .pt { color: var(--warn); font-weight: 600; }
.ped.e-aprobada .pt { color: var(--ok); font-weight: 600; }
.ped.e-rechazada .pt { color: var(--bad); font-weight: 600; }
.ped.add { flex: 0 0 auto; min-width: 0; align-items: center; justify-content: center; color: var(--brand); font-weight: 600; font-size: 13.5px; border-style: dashed; box-shadow: none; background: transparent; }
/* Pestañas segmentadas */
.seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 14px; }
.seg button { flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
@media (max-width: 360px) { .seg button { font-size: 12.5px; } }
.backlink { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--brand); font-weight: 600; cursor: pointer; padding: 6px 0; font-size: 14.5px; }

/* Tablas */
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; }
table.t tr:last-child td { border-bottom: 0; }
table.t tfoot td { font-weight: 700; border-top: 2px solid var(--ink); }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(28,28,20,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.modal { background: var(--bg); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); animation: up .2s ease-out; }
@media (min-width: 640px) { .modal-bg { align-items: center; } .modal { border-radius: 20px; } }
.modal .mh { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.modal .x { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--surface-2); font-size: 20px; cursor: pointer; flex: 0 0 auto; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; z-index: 60; transition: .2s; max-width: 92vw; font-size: 14px; pointer-events: none; }
#toast.on { opacity: 1; transform: translateX(-50%); }
#toast.err { background: var(--bad); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 20% 0%, var(--brand-2) 0, var(--brand) 45%, #3d4205 100%); }
.login .card { width: 100%; max-width: 380px; padding: 24px; }
.login .logo { width: 56px; height: 56px; margin-bottom: 12px; }
.success { text-align: center; padding: 10px 0; }
.success .ic { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; margin: 0 auto 10px; }
.cred { font-family: ui-monospace, Consolas, monospace; font-size: 20px; font-weight: 700; background: var(--surface-2); padding: 10px; border-radius: 10px; text-align: center; letter-spacing: 1px; }
.spinner { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media print { .topbar, .nav, .btn { display: none !important; } main { padding: 0; } }

/* Vender: Productos | Solo monto */
.prod-h .seg-modo { flex: 1; margin: 0 0 0 6px; padding: 3px; }
.prod-h .seg-modo button { min-height: 34px; font-size: 14px; }
.monto-box { display: flex; flex-direction: column; gap: 12px; padding-top: 4px; }
.monto-in { font-size: 30px; font-weight: 700; text-align: right; min-height: 60px; font-variant-numeric: tabular-nums; }
