:root {
  --bg: #F6F3F5; --card: #FFFFFF; --ink: #1B1D22; --mute: #6B6F78; --line: #E7E1E4; --chip: #EEE8EB;
  --acc: #BE185D; --acc-ink: #FFFFFF; --acc-soft: #FCE7F3;
  --ok: #15803D; --ok-soft: #DCFCE7; --warn: #B45309; --warn-soft: #FEF3C7; --bad: #B91C1C; --bad-soft: #FEE2E2;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  --r: 14px;
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317; --card: #1B1E24; --ink: #F2F2F4; --mute: #9AA0AA; --line: #2B2F37; --chip: #262A31;
    --acc: #EC4899; --acc-ink: #FFFFFF; --acc-soft: #3B1426;
    --ok: #4ADE80; --ok-soft: #12301D; --warn: #FBBF24; --warn-soft: #362A0C; --bad: #F87171; --bad-soft: #3A1515;
    --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body { font: 16px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
a { color: var(--acc); }
h1 { font-size: 30px; line-height: 1.1; margin: 0; letter-spacing: -.02em; }
h2 { font-size: 17px; margin: 0; }
small { font-size: 13px; }
.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -4px; }
.mute { color: var(--mute); }
.bad { color: var(--bad); }
.okc { color: var(--ok); }
.center { text-align: center; }
.sm { font-size: 13px; }
.mono { font-family: ui-monospace, Menlo, monospace; letter-spacing: .03em; }
.grow { flex: 1; min-width: 0; }
.boot { padding: 40px; text-align: center; color: var(--mute); }

/* ---- estructura ---- */
.shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
header.top { padding: calc(var(--st) + 10px) 16px 8px; background: var(--bg); }
.hrow { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; min-height: 40px; }
.hbtns { display: flex; gap: 8px; align-items: center; }
.eyebrow { font-size: 13px; color: var(--mute); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }
main.main { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 16px 24px; overscroll-behavior: contain; }
body.has-sheet main.main { overflow: hidden; }
.tabbar { display: flex; background: var(--card); border-top: 1px solid var(--line); padding: 4px 4px calc(var(--sb) + 2px); }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 4px; font-size: 11px; font-weight: 600; color: var(--mute); position: relative; }
.tab .i { width: 24px; height: 24px; }
.tab.on { color: var(--acc); }
.tab .dot { position: absolute; top: 2px; left: calc(50% + 8px); background: var(--acc); color: #fff; font-size: 11px; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 5px; }

/* ---- controles ---- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: var(--chip); font-size: 14px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.ibtn { width: 44px; height: 44px; border-radius: 12px; background: var(--card); display: grid; place-items: center; box-shadow: var(--shadow); border: 1px solid var(--line); flex: none; }
.ibtn.on, .ibtn.pri { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 0 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-weight: 600; font-size: 15px; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn.pri { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); }
.btn.bad { color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 36px; padding: 0 10px; font-size: 14px; border-radius: 10px; }
.btn.block { display: flex; width: 100%; margin-top: 10px; }
.btn:disabled { opacity: .45; }
.btn:active, .ibtn:active, .pcard:active, .lrow:active, .chip:active, .mi:active { transform: scale(.98); }
.link { color: var(--acc); font-weight: 600; font-size: 16px; padding: 6px 0; }
.link.bad { color: var(--bad); }
.in { width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; min-height: 46px; -webkit-appearance: none; appearance: none; }
.in:focus { outline: 2px solid var(--acc); outline-offset: -1px; }
.in.ro { color: var(--mute); display: flex; align-items: center; }
textarea.in { resize: vertical; min-height: 70px; }
select.in { background-image: linear-gradient(45deg, transparent 50%, var(--mute) 50%), linear-gradient(135deg, var(--mute) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.field { display: block; margin-top: 12px; }
.field small { display: block; margin-top: 4px; }
.fl { display: block; font-size: 13px; font-weight: 700; color: var(--mute); text-transform: uppercase; letter-spacing: .04em; margin: 16px 0 6px; }
.field .fl { margin-top: 0; }
.req { color: var(--acc); font-size: 11px; }
.inrow { display: flex; gap: 6px; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid2 > .btn { margin-top: 12px; }
.search { display: flex; align-items: center; gap: 8px; flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; min-height: 44px; box-shadow: var(--shadow); color: var(--mute); margin-top: 8px; }
.search input { flex: 1; border: 0; background: transparent; font: inherit; font-size: 16px; color: var(--ink); outline: none; min-width: 0; height: 42px; -webkit-appearance: none; }
.searchrow { display: flex; gap: 8px; align-items: flex-end; }
.searchrow .search { margin-top: 0; }
.searchrow { margin-top: 4px; }
.chips { display: flex; gap: 6px; margin: 10px 0 4px; flex-wrap: wrap; }
.chips.scrollx { flex-wrap: nowrap; overflow-x: auto; margin-left: -16px; margin-right: -16px; padding: 0 16px 2px; scrollbar-width: none; }
.chips.scrollx::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 8px 13px; border-radius: 999px; background: var(--chip); font-size: 14px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.chip .i { width: 16px; height: 16px; }
.chip.on { background: var(--cc, var(--acc)); color: #fff; }
.chip.big { display: flex; width: 100%; padding: 12px 14px; margin-top: 10px; border-radius: 12px; font-size: 15px; background: var(--card); border-color: var(--line); }
.chip.big.on { background: var(--acc-soft); color: var(--acc); border-color: var(--acc); }
.seg { display: flex; background: var(--chip); border-radius: 11px; padding: 3px; margin: 8px 0; }
.seg button { flex: 1; padding: 8px 4px; border-radius: 9px; font-size: 14px; font-weight: 600; text-align: center; color: var(--mute); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.note { display: flex; gap: 10px; align-items: flex-start; width: 100%; padding: 11px 12px; border-radius: 12px; background: var(--chip); font-size: 14px; margin: 8px 0; text-align: left; }
.note.acc { background: var(--acc-soft); color: var(--ink); }
.note.acc > .i { color: var(--acc); }
.note.ok { background: var(--ok-soft); }
.note.warn { background: var(--warn-soft); }
.note.warn > .i { color: var(--warn); }
.note ul { margin: 6px 0 0; padding-left: 18px; }
.note li { margin: 4px 0; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--chip); color: var(--mute); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.empty { text-align: center; color: var(--mute); padding: 30px 16px 14px; }
.empty .i { width: 36px; height: 36px; opacity: .5; }
.empty p { margin: 8px 0 0; }
.stepper { display: inline-flex; align-items: center; gap: 4px; background: var(--chip); border-radius: 12px; padding: 3px; flex: none; }
.stepper b { min-width: 30px; text-align: center; font-size: 17px; }
.sbtn { width: 42px; height: 42px; border-radius: 10px; background: var(--card); font-size: 22px; font-weight: 600; text-align: center; }
.big { font-size: 20px; font-weight: 700; }

/* ---- vender ---- */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; margin-top: 8px; }
.pcard { position: relative; display: flex; flex-direction: column; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); border: 1px solid var(--line); overflow: hidden; min-height: 150px; text-align: left; }
.pcard img, .pcard .ph { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.ph { display: grid; place-items: center; background: color-mix(in srgb, var(--c, #888) 18%, var(--card)); color: var(--c, #888); font-weight: 800; font-size: 20px; letter-spacing: .02em; }
.pcard .pn { font-size: 13px; font-weight: 600; padding: 6px 8px 0; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard .pp { font-size: 14px; font-weight: 800; padding: 2px 8px 8px; margin-top: auto; }
.pcard .stk { position: absolute; top: 6px; right: 6px; background: rgba(255,255,255,.92); color: #1B1D22; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 999px; }
.pcard .stk.low { background: #FEF3C7; color: #92400E; }
.pcard .stk.out { background: #FEE2E2; color: #991B1B; }
.pcard.out { opacity: .55; }
.cartslot:empty { display: none; }
.cartbar { display: flex; align-items: center; gap: 10px; width: calc(100% - 20px); margin: 0 10px 8px; padding: 12px 14px; background: var(--acc); color: #fff; border-radius: 16px; box-shadow: 0 6px 20px rgba(190, 24, 93, .35); font-weight: 600; }
.cb-n { background: rgba(255,255,255,.25); border-radius: 8px; min-width: 28px; height: 28px; display: grid; place-items: center; font-weight: 800; }
.cb-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.cartbar b { font-size: 17px; }
.cb-go { display: flex; align-items: center; font-size: 13px; opacity: .9; }

/* ---- listas ---- */
.list { background: var(--card); border-radius: var(--r); border: 1px solid var(--line); overflow: hidden; margin-top: 8px; box-shadow: var(--shadow); }
.lrow { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.lrow:last-child { border-bottom: 0; }
.lrow b { font-weight: 600; }
.lrow .grow b, .lrow .grow small { display: block; overflow: hidden; text-overflow: ellipsis; }
.lrow small { color: var(--mute); }
.lrow > .i { color: var(--mute); }
.lrow .badge { margin-top: 3px; }
.tl { text-align: left; }
.ra { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; flex: none; }
.thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex: none; font-size: 14px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--acc-soft); color: var(--acc); display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; }
.rank { width: 24px; height: 24px; border-radius: 50%; background: var(--chip); display: grid; place-items: center; font-size: 12px; font-weight: 800; flex: none; }
.swatch { width: 22px; height: 22px; border-radius: 50%; flex: none; display: inline-block; }
.swatch.lg { width: 38px; height: 38px; border: 3px solid transparent; }
.swatch.lg.on { border-color: var(--ink); }
.sumline { margin: 10px 2px 0; color: var(--mute); font-size: 14px; }
.sumline b { color: var(--ink); }
.bar { height: 6px; background: var(--chip); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--acc); border-radius: 3px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; box-shadow: var(--shadow); min-width: 0; }
.stat small { color: var(--mute); font-weight: 600; display: block; }
.stat b { display: block; font-size: 20px; margin: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat span { font-size: 12px; color: var(--mute); }
.menu { background: var(--card); border-radius: var(--r); border: 1px solid var(--line); overflow: hidden; margin: 12px 0; box-shadow: var(--shadow); }
.mi { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; }
.mi:last-child { border-bottom: 0; }
.mi > .i:first-child { color: var(--acc); width: 22px; height: 22px; }
.mi > .i:last-child { color: var(--mute); }
.mi b { display: block; font-weight: 600; }
.mi small { color: var(--mute); display: block; }
.kv { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 4px 12px; margin-top: 10px; }
.kv .tr { padding: 9px 0; border-bottom: 1px solid var(--line); }
.kv .tr:last-child { border-bottom: 0; }
.kv p { margin: 8px 0; }
.tr { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.tr > span:last-child { text-align: right; font-weight: 600; }
.tr.big { font-size: 20px; font-weight: 800; }
.tr.mute { color: var(--mute); font-size: 14px; }
.tr.bad { color: var(--bad); }
.hb { display: grid; grid-template-columns: 1fr 1.2fr auto; gap: 8px; align-items: center; font-size: 14px; padding: 5px 0; }
.hb .bar { margin: 0; }
.hb span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px; }
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.act { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 12px 4px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; font-size: 13px; font-weight: 600; }
.act .i { color: var(--acc); width: 22px; height: 22px; }
.steps { padding-left: 22px; }
.steps li { margin: 10px 0; }
.welcome { max-width: 460px; margin: 0 auto; padding: calc(var(--st) + 40px) 20px calc(var(--sb) + 30px); text-align: center; overflow-y: auto; height: 100dvh; }
.welcome .logo { width: 84px; height: 84px; border-radius: 20px; box-shadow: var(--shadow); }
.welcome h1 { margin: 14px 0 6px; }
.welcome .field, .welcome .note { text-align: left; }

/* ---- ventanas ---- */
.sheet-wrap { position: fixed; inset: 0; z-index: 20; }
.sheet-wrap .backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.35); opacity: 0; transition: opacity .2s; }
.sheet-wrap.in .backdrop { opacity: 1; }
.sheet-wrap.under .backdrop { opacity: 0; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: calc(100dvh - var(--st) - 20px); background: var(--bg); border-radius: 18px 18px 0 0; display: flex; flex-direction: column; transform: translateY(100%); transition: transform .26s cubic-bezier(.2,.8,.2,1); box-shadow: 0 -8px 30px rgba(0,0,0,.18); }
.sheet.full { height: calc(100dvh - var(--st) - 20px); }
.sheet-wrap.in .sheet { transform: none; }
.sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); position: relative; }
.sheet-head::before { content: ''; position: absolute; top: 5px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--line); }
.sheet-head h2 { text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 56vw; }
.sheet-head .link:first-child { justify-self: start; }
.head-r { justify-self: end; }
.sheet-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 16px 20px; overscroll-behavior: contain; }
.sheet-foot { display: flex; gap: 8px; padding: 10px 16px calc(var(--sb) + 10px); border-top: 1px solid var(--line); background: var(--card); }
.sheet-foot[hidden] { display: none; }
.sheet-foot .btn { flex: none; padding: 0 11px; }
.sheet-foot .btn.grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.phead { display: flex; gap: 14px; align-items: center; margin-top: 8px; }
.pimg { width: 92px; height: 92px; border-radius: 14px; object-fit: cover; flex: none; font-size: 26px; }
.phead .price { font-size: 22px; font-weight: 800; margin: 2px 0 4px; }
.bcbox { background: #fff; border-radius: 12px; padding: 10px 20px 4px; margin-top: 12px; display: flex; justify-content: center; }
.bcbox .ean { width: 100%; max-width: 260px; }
.lines { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-top: 8px; }
.line { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.line:last-child { border-bottom: 0; }
.lq { font-weight: 800; color: var(--acc); min-width: 30px; }
.ld { flex: 1; min-width: 0; }
.ld b { display: block; font-weight: 600; }
.ld small { display: block; color: var(--mute); }
.la { font-weight: 700; text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.la s { color: var(--mute); font-weight: 400; font-size: 12px; }
.row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 13px 12px; margin-top: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; text-align: left; }
.row > .i:first-child { color: var(--acc); }
.row > .i:last-child { color: var(--mute); }
.sheet-body > .in { margin-top: 8px; }
.totals { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; margin-top: 10px; display: grid; gap: 6px; }
.due { text-align: center; padding: 14px 10px; background: var(--card); border-radius: var(--r); border: 1px solid var(--line); margin-top: 8px; }
.due small { color: var(--mute); }
.due .amt { font-size: 38px; font-weight: 800; letter-spacing: -.02em; }
.methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mbtn { padding: 12px 4px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-weight: 600; font-size: 14px; text-align: center; }
.mbtn.on { background: var(--acc); color: #fff; border-color: var(--acc); }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.pays { display: grid; gap: 6px; margin-top: 10px; }
.pay { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--ok-soft); border-radius: 12px; }
.pay small { display: block; color: var(--mute); }
.x { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--chip); flex: none; font-weight: 700; }
.x .i { width: 16px; height: 16px; }
.change { margin-top: 10px; padding: 12px; text-align: center; border-radius: 12px; background: var(--warn-soft); font-size: 18px; }
.change.xl { font-size: 26px; }
.rline { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.rline:last-child { border-bottom: 0; }
.rline .grow b, .rline .grow small { display: block; }
.rline .grow small { color: var(--mute); }
.rline label { width: 74px; flex: none; }
.rline label small { color: var(--mute); font-size: 11px; }
.rline .in { padding: 8px; min-height: 40px; text-align: center; }
.photo { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.photo img, .photo .ph { width: 80px; height: 80px; border-radius: 14px; object-fit: cover; }
.photo .ph { --c: #888; }
.dens { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.den { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px 4px 4px 10px; }
.den span { flex: 1; font-weight: 600; font-size: 14px; }
.den .in { width: 70px; min-height: 38px; padding: 6px; text-align: center; border: 0; background: var(--chip); }

/* ---- recibo y etiquetas ---- */
/* El ancho del recibo sale de Ajustes (--tw); la vista previa usa la misma medida que el papel */
.ticket-wrap { margin: 12px auto 0; width: max-content; max-width: 100%; }
.ticket { background: #fff; color: #111; font: var(--tf, 12px)/1.35 ui-monospace, Menlo, "Courier New", monospace; width: calc(var(--tw, 72mm) + 28px); max-width: 100%; padding: 16px 14px; border-radius: 6px; box-shadow: 0 2px 10px rgba(0,0,0,.12); overflow-wrap: anywhere; }
/* Tamaños relativos a la letra elegida (12 px por defecto); todo en negro porque las térmicas no imprimen grises */
.ticket .tr { flex-wrap: wrap; column-gap: 8px; }
.ticket .tc { text-align: center; }
.ticket .tn { font-size: 1.25em; }
.ticket .ttl { letter-spacing: .04em; }
/* Divisor punteado que ocupa siempre todo el ancho del papel (58 u 80 mm) */
.ticket .hr { height: 0; border-top: 1px dashed #000; margin: 6px 0; font-size: 0; line-height: 0; color: transparent; overflow: hidden; }
.ticket .tr > span:last-child { font-weight: 400; }
.ticket .tb { font-weight: 800; font-size: 1.15em; }
.ticket .tb > span:last-child { font-weight: 800; }
.ticket .tsm { font-size: .9em; color: #222; }
.ticket .ti { margin: 3px 0; }
.ticket .tf { font-size: .9em; text-align: center; margin-top: 6px; color: #111; }
.ticket .tlogo { text-align: center; margin: 0 0 6px; }
.ticket .tlogo img { display: inline-block; max-width: 100%; image-rendering: pixelated; }
/* Fila de producto en una sola línea: el nombre se recorta con «…» y el valor queda a la derecha */
.ticket .tr.cut { flex-wrap: nowrap; }
.ticket .tr.cut > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket .tr.cut > span:last-child { flex: none; }
/* Versión resumida (58 mm): menos aire entre renglones */
.ticket.compact { line-height: 1.25; }
.ticket.compact .ti { margin: 1px 0; }
.ticket.compact .hr { margin: 4px 0; }
.ticket.compact .tf { margin-top: 3px; }
.ticket.compact .tbc .c128 { height: 38px; }
/* Copia fuera de pantalla que se dibuja para el PDF: del ancho exacto del rollo, sin sombra ni bordes */
.pdf-render { position: fixed; left: -10000px; top: 0; background: #fff; }
.pdf-render .ticket { width: var(--tp, 80mm); max-width: none; padding: 4mm calc((var(--tp, 80mm) - var(--tw, 72mm)) / 2); box-shadow: none; border-radius: 0; }
.btn.ic { padding: 0 10px; gap: 4px; }
/* WhatsApp */
.btn.wa { background: #25D366; border-color: #25D366; color: #fff; }
.btn.wa:disabled { opacity: .5; }
.wa-prev { background: #ECE5DD; border-radius: 14px; padding: 12px; margin-top: 8px; display: flex; flex-direction: column; align-items: flex-end; }
.wa-prev img { width: 78%; border-radius: 10px 10px 0 0; display: block; }
.wa-bubble { width: 78%; background: #DCF8C6; color: #111; border-radius: 0 0 10px 10px; padding: 8px 10px; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.wa-prev > .mute { width: 78%; padding: 30px 0; background: #fff; border-radius: 10px 10px 0 0; }
.wa-bubble code { font-family: ui-monospace, Menlo, monospace; background: rgba(0,0,0,.06); padding: 0 3px; border-radius: 3px; font-size: 13px; }
.wa-bubble .wq { border-left: 3px solid #8aa; padding-left: 8px; color: #445; margin: 2px 0; }
.wa-bubble .wl { padding-left: 4px; }
.mono-sm { font-family: ui-monospace, Menlo, monospace; font-size: 14px !important; }
.pdf-ready { text-align: center; padding: 12px 0; }
.pdf-ready .i { width: 44px; height: 44px; color: var(--acc); display: block; margin: 0 auto 8px; }
.pdf-ready b { word-break: break-all; }
.logo-prev { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; text-align: center; }
.logo-prev img { max-width: 100%; max-height: 120px; image-rendering: pixelated; }
.astext { position: absolute; left: -9999px; top: 0; width: 320px; }
.astext .tr { display: block; }
.astext .hr { font-size: 12px; line-height: 1.2; color: #000; border: 0; height: auto; }
.astext .tlogo { display: none; }
/* Etiqueta: todo en columna, centrado; el precio en su propia línea y el código de barras abajo a lo ancho */
.label { background: #fff; color: #000; font-family: -apple-system, system-ui, sans-serif; overflow: hidden; display: flex; flex-direction: column; align-items: stretch; text-align: center; padding: 1.2mm 2mm; page-break-after: always; break-after: page; }
.label .lb-name { font-weight: 700; font-size: 7.5pt; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.label .lb-meta { font-size: 5.5pt; color: #333; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.label .lb-price { font-weight: 800; font-size: 11pt; line-height: 1.15; white-space: nowrap; }
.label .lb-bc { flex: 1; min-height: 0; display: flex; justify-content: center; align-items: flex-end; }
.label .lb-bc .ean { width: 100%; height: 100%; }
.l-50x25 { width: 50mm; height: 25mm; }
.l-38x25 { width: 38mm; height: 25mm; }
.l-38x25 .lb-price { font-size: 9.5pt; }
.l-30x20 { width: 30mm; height: 20mm; padding: .8mm 1.2mm; }
.l-30x20 .lb-meta { display: none; }
.l-30x20 .lb-name { font-size: 6pt; }
.l-30x20 .lb-price { font-size: 8.5pt; }
.l-60x40 { width: 60mm; height: 40mm; padding: 2mm 3mm; }
.l-60x40 .lb-name { font-size: 10pt; white-space: normal; max-height: 2.3em; }
.l-60x40 .lb-meta { font-size: 7pt; }
.l-60x40 .lb-price { font-size: 16pt; margin: .5mm 0; }
.ticket .tbc { display: flex; justify-content: center; margin: 8px 0 2px; }
.ticket .tbc .c128 { width: 100%; height: 46px; }
.ticket .vt { font-size: 15px; letter-spacing: .08em; }
.ticket .vval { font-size: 26px; font-weight: 800; margin: 6px 0 2px; }
.ticket .vcode { font-size: 15px; font-weight: 700; letter-spacing: .12em; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 0 4px; font-size: 13px; color: var(--mute); }
.pager .btn:disabled { opacity: .35; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.grid3 .btn { padding: 0 6px; }
.switch { width: 46px; height: 28px; border-radius: 14px; background: var(--line); position: relative; flex: none; transition: background .2s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.switch.on { background: var(--ok); }
.switch.on::after { transform: translateX(18px); }
.lrow:disabled { opacity: .6; }
.wrapall { word-break: break-all; white-space: normal !important; }
.label-prev { display: flex; justify-content: center; padding: 14px; background: var(--chip); border-radius: 12px; }
.label-prev .label { box-shadow: 0 2px 8px rgba(0,0,0,.15); border-radius: 2px; transform: scale(1.6); transform-origin: center; margin: 14mm 0; }
.bc-text { font: 9pt ui-monospace, monospace; }
#print-root { display: none; }

/* ---- lector, bloqueo y aviso ---- */
#scanner { position: fixed; inset: 0; z-index: 60; background: #000; color: #fff; }
#scanner[hidden] { display: none; }
#scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; left: 10%; right: 10%; top: 34%; height: 22%; border: 3px solid rgba(255,255,255,.9); border-radius: 16px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
.scan-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: calc(var(--st) + 12px) 16px 12px; }
.scan-close { background: rgba(255,255,255,.2); color: #fff; padding: 8px 14px; border-radius: 999px; font-weight: 700; }
.scan-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 16px calc(var(--sb) + 16px); }
.scan-msg { text-align: center; font-weight: 600; margin: 0 0 10px; text-shadow: 0 1px 3px #000; }
#lock { position: fixed; inset: 0; z-index: 70; background: var(--bg); display: grid; place-items: center; padding: 20px; }
#lock[hidden] { display: none; }
.lockbox { text-align: center; width: 100%; max-width: 300px; }
.lock-ic .i { width: 40px; height: 40px; color: var(--acc); }
.pindots { display: flex; justify-content: center; gap: 14px; margin: 18px 0 24px; }
.pindots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--acc); }
.pindots i.on { background: var(--acc); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.keypad button { height: 68px; border-radius: 50%; background: var(--card); font-size: 26px; font-weight: 500; text-align: center; box-shadow: var(--shadow); width: 68px; justify-self: center; }
#toast { position: fixed; left: 50%; bottom: calc(var(--sb) + 90px); transform: translate(-50%, 20px); background: #1B1D22; color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: .2s; z-index: 80; max-width: calc(100% - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--bad); }

@media (min-width: 700px) {
  .sheet { left: 50%; right: auto; width: 560px; margin-left: -280px; }
  .pgrid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

@media print {
  body > *:not(#print-root) { display: none !important; }
  html, body { background: #fff; height: auto; }
  #print-root { display: block !important; }
  #print-root.p-ticket .ticket { box-shadow: none; padding: 0; width: var(--tw, 72mm); max-width: none; border-radius: 0; }
  #print-root.p-labels .label { transform: none; }
}
