/* BANANA BYTE BOX — sistema visual compartido con BANANA BYTE GRID y la web comercial:
   paleta Brainiac Monkeys (etrusco / siena / papaya / banana / marfil),
   Sora para titulares, Silkscreen para etiquetas pixel, Inter para texto. */
@font-face {
  font-family: 'Material Symbols Rounded';
  font-style: normal;
  font-weight: 400;
  src: url('assets/fonts/material-symbols-rounded.woff2') format('woff2');
  font-display: block;
}

:root {
  --etrusco: #45180c;
  --etrusco-deep: #2a0f07;
  --siena: #a74820;
  --papaya: #d77400;
  --banana: #ffc936;
  --banana-dark: #d9a51c;
  --banana-soft: #fff0bf;
  --marfil: #fff6e5;
  --white: #fffdf9;
  --ink: #1f120c;
  --muted: #6d5a4e;
  --line: #ecdcc4;
  --line-soft: #f4e9d8;
  --ok: #1d7c4d;
  --ok-soft: #dff3e7;
  --bad: #b42318;
  --bad-soft: #fde4df;
  --info: #2f5fb3;
  --info-soft: #e5edfb;

  --radius: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(69, 24, 12, .06), 0 12px 32px rgba(69, 24, 12, .08);
  --shadow-lg: 0 2px 6px rgba(69, 24, 12, .08), 0 30px 70px rgba(69, 24, 12, .18);
  --display: "Sora", "Inter", system-ui, sans-serif;
  --pixel: "Silkscreen", ui-monospace, monospace;
  --text: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --tabbar-h: 68px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--marfil);
  color: var(--ink);
  font: 400 15px/1.5 var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: not-allowed; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -.02em; line-height: 1.15; margin: 0; color: var(--etrusco); }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--papaya); outline-offset: 2px; border-radius: 8px; }

.ms {
  font-family: 'Material Symbols Rounded';
  font-weight: normal; font-style: normal; font-size: 22px; line-height: 1;
  letter-spacing: normal; text-transform: none; white-space: nowrap; direction: ltr;
  display: inline-block; flex: none;
  font-feature-settings: 'liga'; -webkit-font-feature-settings: 'liga';
  font-variation-settings: 'FILL' 0, 'wght' 450, 'GRAD' 0, 'opsz' 24;
  user-select: none;
}
.ms.fill { font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24; }
.pixel { font-family: var(--pixel); letter-spacing: .06em; text-transform: uppercase; }

/* ---------- Layout ---------- */
.app { min-height: 100vh; min-height: 100dvh; }
.sidebar { display: none; }
.main { min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--etrusco);
  color: var(--marfil);
}
.top-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.top-ico { width: 34px; height: 34px; image-rendering: pixelated; }
.crumb { font-family: var(--pixel); font-size: .64rem; letter-spacing: .08em; color: var(--banana); text-transform: uppercase; }
.top-title { font-size: 1.12rem; color: var(--marfil); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.top-actions .search { display: none; }

.icon-btn {
  border: 0; background: rgba(255, 246, 229, .1); color: var(--marfil);
  height: 40px; min-width: 40px; padding: 0 10px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.icon-btn b { font-size: .8rem; font-weight: 700; }
.net-pill b { background: var(--banana); color: var(--etrusco-deep); border-radius: 99px; padding: 1px 7px; }
.net-pill b:empty, .net-pill b.zero { display: none; }
.net-pill.offline { background: var(--bad); }

.offline-banner {
  display: flex; align-items: center; gap: 10px;
  background: var(--banana-soft); color: var(--etrusco); border-bottom: 1px solid #f1d98c;
  padding: 9px 16px; font-size: .86rem; font-weight: 500;
}
.offline-banner .ms { color: var(--siena); font-size: 20px; }

.content { padding: 18px 16px calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom)); max-width: 1280px; margin: 0 auto; outline: none; }

/* Barra de pestañas móvil */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding: 0 6px env(safe-area-inset-bottom);
  background: var(--white); border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(69, 24, 12, .06);
}
.tabbar button {
  border: 0; background: transparent; color: var(--muted);
  display: grid; justify-items: center; gap: 2px; padding: 8px 0 10px;
  font-size: .68rem; font-weight: 600;
}
.tabbar button.active { color: var(--etrusco); }
.tabbar button.active .ms { font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24; color: var(--siena); }
.tabbar .fab {
  justify-self: center; align-self: center;
  width: 60px; height: 60px; border-radius: 20px; padding: 0; place-items: center;
  background: var(--banana); color: var(--etrusco-deep);
  box-shadow: 0 5px 0 var(--banana-dark), 0 10px 22px rgba(69, 24, 12, .2);
  transform: translateY(-14px);
}
.tabbar .fab .ms { font-size: 30px; color: var(--etrusco-deep) !important; }
.tabbar .fab:active { transform: translateY(-11px); box-shadow: 0 2px 0 var(--banana-dark); }

/* ---------- Componentes ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px; border: 0;
  font: 600 .94rem/1 var(--text); text-decoration: none; white-space: nowrap;
  background: var(--white); color: var(--etrusco);
  box-shadow: inset 0 0 0 1.5px var(--line);
  transition: transform .12s ease, background-color .15s ease, box-shadow .15s ease;
}
.btn .ms { font-size: 20px; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:hover:not(:disabled) { box-shadow: inset 0 0 0 1.5px var(--etrusco); }
.btn-primary { background: var(--banana); color: var(--etrusco-deep); box-shadow: 0 4px 0 var(--banana-dark); }
.btn-primary:hover:not(:disabled) { background: #ffd457; box-shadow: 0 4px 0 var(--banana-dark); }
.btn-primary:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 var(--banana-dark); }
.btn-dark { background: var(--etrusco); color: var(--marfil); box-shadow: none; }
.btn-dark:hover:not(:disabled) { background: var(--etrusco-deep); box-shadow: none; }
.btn-danger { color: var(--bad); }
.btn-sm { min-height: 36px; padding: 0 13px; font-size: .84rem; }
.btn-sm .ms { font-size: 18px; }
.btn-block { width: 100%; white-space: normal; line-height: 1.25; text-align: center; padding-block: 10px; }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-ghost:hover:not(:disabled) { background: var(--line-soft); box-shadow: none; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.page-head h2 { font-size: 1.55rem; }
.page-head p { color: var(--muted); margin-top: 4px; font-size: .92rem; }
.eyebrow { font-family: var(--pixel); font-size: .68rem; letter-spacing: .07em; text-transform: uppercase; color: var(--siena); display: inline-flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.eyebrow::before { content: ""; width: 8px; height: 8px; background: var(--banana); box-shadow: 8px 0 0 var(--papaya); margin-right: 8px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 0; }
.card-head h3 { font-size: 1.02rem; }
.card-body { padding: 16px 18px 18px; }
.grid { display: grid; gap: 14px; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .86em; }
.sep { height: 1px; background: var(--line); margin: 14px 0; border: 0; }

/* Hero de inicio */
.hero {
  position: relative; overflow: hidden;
  background: var(--etrusco); color: var(--marfil);
  border-radius: var(--radius); padding: 20px 20px 22px;
  margin-bottom: 14px; min-height: 150px;
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255, 201, 54, .08) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 201, 54, .08) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(ellipse 80% 90% at 85% 40%, #000 15%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 80% 90% at 85% 40%, #000 15%, transparent 70%);
}
.hero > * { position: relative; }
.hero .eyebrow { color: var(--banana); }
.hero h2 { color: var(--marfil); font-size: 1.45rem; max-width: 62%; }
.hero h2 em { font-style: normal; color: var(--banana); }
.hero p { color: #e9d6bf; font-size: .9rem; margin-top: 6px; max-width: 60%; }
.hero .brian { position: absolute; right: 4px; bottom: -40px; width: 128px; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .35)); pointer-events: none; }
.hero .actions { margin-top: 16px; }

.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { padding: 14px; display: grid; gap: 4px; text-align: left; border: 1px solid var(--line); background: var(--white); border-radius: var(--radius-md); box-shadow: var(--shadow); }
button.stat:hover { border-color: var(--siena); }
.stat .lbl { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: var(--muted); font-size: .78rem; font-weight: 600; }
.stat .lbl .ms { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--banana-soft); color: var(--siena); font-size: 19px; }
.stat .val { font-family: var(--display); font-weight: 800; font-size: 1.6rem; color: var(--etrusco); letter-spacing: -.03em; line-height: 1.1; }
.stat .note { font-size: .74rem; color: var(--muted); }
.stat.warn .lbl .ms { background: var(--bad-soft); color: var(--bad); }
.stat.warn .val { color: var(--bad); }

.quick { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.quick button {
  border: 1px solid var(--line); background: var(--white); border-radius: var(--radius-md);
  display: grid; justify-items: center; gap: 6px; padding: 12px 4px; font-size: .74rem; font-weight: 600; color: var(--etrusco);
}
.quick button .ms { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: var(--banana-soft); color: var(--siena); }
.quick button:hover { border-color: var(--siena); }

/* Listas */
.list { display: grid; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 11px 18px;
  border-top: 1px solid var(--line-soft); text-align: left; width: 100%;
  background: transparent; border-left: 0; border-right: 0; border-bottom: 0; color: inherit;
}
.list > .row:first-child { border-top: 0; }
button.row:hover, a.row:hover { background: #fffaf0; }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { color: var(--muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .end { text-align: right; flex: none; }
.row .end .n { font-family: var(--display); font-weight: 700; font-size: 1.02rem; color: var(--etrusco); }
.row .end .u { font-size: .72rem; color: var(--muted); }
.row-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--line-soft); color: var(--siena); flex: none; }
.row-ico.in { background: var(--ok-soft); color: var(--ok); }
.row-ico.out { background: var(--bad-soft); color: var(--bad); }
.row-ico.tr { background: var(--info-soft); color: var(--info); }

.thumb {
  width: 48px; height: 48px; border-radius: 14px; flex: none; object-fit: cover;
  background: var(--banana-soft); border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--siena); overflow: hidden;
}
.thumb .ms { font-size: 24px; }
.thumb.lg { width: 96px; height: 96px; border-radius: 22px; }
.thumb.lg .ms { font-size: 44px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px; font-size: .7rem; font-weight: 700; white-space: nowrap;
  background: var(--line-soft); color: var(--muted);
}
.badge .ms { font-size: 14px; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--banana-soft); color: #835c00; }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.dark { background: var(--etrusco); color: var(--banana); font-family: var(--pixel); font-weight: 400; letter-spacing: .06em; font-size: .62rem; }

.empty { text-align: center; padding: 34px 20px; color: var(--muted); }
.empty img { width: 92px; margin: 0 auto 10px; }
.empty .ms { font-size: 44px; color: var(--siena); margin-bottom: 6px; }
.empty b { display: block; color: var(--etrusco); font-family: var(--display); font-size: 1.05rem; margin-bottom: 4px; }

/* Toolbar y chips */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.input, .field input, .field select, .field textarea, .toolbar select {
  width: 100%; min-height: 46px; padding: 10px 14px;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--white);
  outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, .field input:focus, .field select:focus, .field textarea:focus, .toolbar select:focus { border-color: var(--papaya); box-shadow: 0 0 0 3px rgba(215, 116, 0, .14); }
.search-box { position: relative; flex: 1 1 260px; }
.search-box .ms { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box input { padding-left: 42px; }
.toolbar select { width: auto; flex: 0 1 auto; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin: 0 -16px 12px; padding-inline: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  border: 1.5px solid var(--line); background: var(--white); color: var(--etrusco);
  border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: .84rem; white-space: nowrap; flex: none;
}
.chip.active { background: var(--etrusco); border-color: var(--etrusco); color: var(--banana); }
.chip .c { opacity: .65; margin-left: 4px; font-weight: 500; }

/* Tarjetas de producto */
.plist { display: grid; gap: 10px; }
.pcard {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 10px;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-md);
  text-align: left; width: 100%; color: inherit;
}
.pcard:hover { border-color: var(--siena); }
.pcard .grow { flex: 1; min-width: 0; }
.pcard .t { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .s { color: var(--muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .meta { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.pcard .qty { text-align: right; flex: none; min-width: 64px; }
.pcard .qty .n { font-family: var(--display); font-weight: 800; font-size: 1.25rem; color: var(--etrusco); line-height: 1; }
.pcard .qty .n.low { color: var(--bad); }
.pcard .qty .u { font-size: .7rem; color: var(--muted); }
.pcard .qty .p { font-size: .76rem; font-weight: 600; color: var(--siena); margin-top: 3px; }
.pcard.variant { margin-left: 22px; width: calc(100% - 22px); border-style: dashed; }

.meter { height: 6px; border-radius: 9px; background: var(--line-soft); overflow: hidden; margin-top: 6px; }
.meter span { display: block; height: 100%; background: var(--banana); border-radius: 9px; }
.meter span.low { background: var(--bad); }

/* Ficha de producto */
.detail-hero { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; }
.detail-hero h2 { font-size: 1.35rem; }
.detail-hero .s { color: var(--muted); font-size: .86rem; margin-top: 2px; }
.detail-hero .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.stock-total {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--etrusco); color: var(--marfil); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px;
}
.stock-total .n { font-family: var(--display); font-weight: 800; font-size: 2.1rem; color: var(--banana); line-height: 1; }
.stock-total .l { font-family: var(--pixel); font-size: .64rem; letter-spacing: .07em; color: #e9d6bf; text-transform: uppercase; margin-bottom: 6px; }
.stock-total .r { text-align: right; font-size: .82rem; color: #e9d6bf; }
.op-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.op-grid button {
  border: 1px solid var(--line); background: var(--white); border-radius: var(--radius-md);
  display: grid; justify-items: center; gap: 4px; padding: 11px 4px; font-size: .74rem; font-weight: 650; color: var(--etrusco);
}
.op-grid button .ms { font-size: 24px; }
.op-grid .in .ms { color: var(--ok); }
.op-grid .out .ms { color: var(--bad); }
.op-grid .tr .ms { color: var(--info); }
.op-grid .adj .ms { color: var(--papaya); }
.kv { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 4px 12px; font-size: .88rem; }
.kv dt { color: var(--muted); padding: 7px 0; border-top: 1px solid var(--line-soft); }
.kv dd { margin: 0; padding: 7px 0; border-top: 1px solid var(--line-soft); font-weight: 550; text-align: right; overflow-wrap: anywhere; }
.kv dt:first-of-type, .kv dd:first-of-type { border-top: 0; }

.tabs { display: flex; gap: 4px; background: var(--line-soft); padding: 4px; border-radius: 999px; margin-bottom: 14px; overflow-x: auto; }
.tabs button { flex: 1; border: 0; background: transparent; border-radius: 999px; padding: 8px 12px; font-weight: 600; font-size: .84rem; color: var(--muted); white-space: nowrap; }
.tabs button.active { background: var(--white); color: var(--etrusco); box-shadow: 0 1px 4px rgba(69, 24, 12, .12); }

/* Formularios */
.form { display: grid; gap: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field > .lbl { font-weight: 600; font-size: .84rem; color: var(--etrusco); }
.field small { color: var(--muted); font-size: .76rem; }
.field textarea { min-height: 84px; resize: vertical; }
.field .req { color: var(--bad); }
.input-group { display: flex; gap: 8px; }
.input-group > input, .input-group > select { flex: 1; min-width: 0; }
.input-group .btn { flex: none; min-height: 46px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--white); }
.switch .t { font-weight: 600; font-size: .88rem; }
.switch .s { color: var(--muted); font-size: .76rem; }
.switch input { appearance: none; -webkit-appearance: none; width: 46px; height: 28px; border-radius: 99px; background: var(--line); position: relative; flex: none; transition: background .15s; cursor: pointer; }
.switch input::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, .2); transition: transform .18s ease; }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(18px); }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg label { flex: 1 1 auto; }
.seg input, .field .seg input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; min-height: 0; padding: 0; margin: 0; }
.seg label > span { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 12px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--white); font-weight: 600; font-size: .84rem; cursor: pointer; text-align: center; }
.seg label > span .ms { font-size: 19px; }
.seg input:checked + span { border-color: var(--etrusco); background: var(--etrusco); color: var(--banana); }
.seg input:focus-visible + span { outline: 3px solid var(--papaya); outline-offset: 2px; }
.photo-pick { display: flex; align-items: center; gap: 14px; }
.photo-pick .thumb.lg { cursor: pointer; }
.fieldset-title { font-family: var(--pixel); font-size: .66rem; letter-spacing: .07em; color: var(--siena); text-transform: uppercase; margin-top: 6px; padding-top: 12px; border-top: 1px dashed var(--line); }
.callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--banana-soft); border: 1px solid #f1d98c; color: var(--etrusco); font-size: .84rem; }
.callout .ms { color: var(--siena); font-size: 20px; }
.callout.info { background: var(--info-soft); border-color: #c9d8f3; }
.callout.info .ms { color: var(--info); }
.callout.bad { background: var(--bad-soft); border-color: #f5c3b9; }
.callout.bad .ms { color: var(--bad); }
.preview-calc { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--marfil); border: 1px dashed var(--line); font-size: .88rem; }
.preview-calc b { font-family: var(--display); font-size: 1.1rem; color: var(--etrusco); }

/* Hojas (modales tipo bottom-sheet) */
.sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(42, 15, 7, .55); display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease; }
.sheet {
  width: 100%; max-height: 94dvh; background: var(--marfil); border-radius: 24px 24px 0 0;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  animation: up .24s cubic-bezier(.2, .8, .2, 1);
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 18px 12px; border-bottom: 1px solid var(--line); }
.sheet-head::before { content: ""; position: absolute; left: 50%; transform: translateX(-50%); margin-top: -4px; width: 40px; height: 4px; border-radius: 9px; background: var(--line); }
.sheet-head h3 { font-size: 1.1rem; padding-top: 8px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.sheet-close { flex: none; border: 0; background: var(--line-soft); width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--etrusco); margin-top: 6px; }
.sheet-body { padding: 16px 18px; overflow-y: auto; overscroll-behavior: contain; }
.sheet-foot { display: flex; gap: 8px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--white); }
.sheet-foot { flex-wrap: wrap; }
.sheet-foot .btn { flex: 1 1 auto; min-width: 0; white-space: normal; line-height: 1.2; text-align: center; padding-block: 8px; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Menú "Más" */
.menu-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.menu-grid button { border: 1px solid var(--line); background: var(--white); border-radius: var(--radius-md); padding: 14px 6px; display: grid; justify-items: center; gap: 6px; font-weight: 600; font-size: .8rem; color: var(--etrusco); }
.menu-grid button .ms { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--banana-soft); color: var(--siena); }

/* Escáner */
.scanner { position: relative; background: var(--etrusco-deep); border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3.4; display: grid; place-items: center; color: var(--marfil); margin-bottom: 14px; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner .frame { position: absolute; width: 76%; height: 38%; border-radius: 16px; box-shadow: 0 0 0 999px rgba(42, 15, 7, .45); }
.scanner .frame::before, .scanner .frame::after { content: ""; position: absolute; inset: -3px; border: 3px solid var(--banana); border-radius: 18px; clip-path: polygon(0 0, 22% 0, 22% 100%, 0 100%, 0 0, 78% 0, 100% 0, 100% 100%, 78% 100%, 78% 0); }
.scanner .laser { position: absolute; left: 14%; right: 14%; height: 2px; background: var(--papaya); box-shadow: 0 0 12px var(--papaya); animation: laser 1.8s ease-in-out infinite alternate; }
@keyframes laser { from { top: 34%; } to { top: 64%; } }
.scanner .ph { text-align: center; padding: 20px; z-index: 1; max-width: 300px; }
.scanner .ph .ms { font-size: 48px; color: var(--banana); }
.scanner .ph p { color: #e9d6bf; font-size: .86rem; margin-top: 6px; }
.scanner .hud { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; justify-content: center; gap: 8px; z-index: 2; }
.scanner.live .ph { display: none; }
.scan-result { display: flex; align-items: center; gap: 12px; }

/* Conteo físico */
.count-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line-soft); }
.count-row:first-child { border-top: 0; }
.count-row .grow { flex: 1; min-width: 0; }
.count-row input { width: 86px; min-height: 42px; text-align: center; font-weight: 700; border: 1.5px solid var(--line); border-radius: 10px; background: var(--white); }
.count-row input:focus { border-color: var(--papaya); outline: none; }
.count-row .diff { width: 48px; text-align: right; font-weight: 700; font-size: .86rem; }
.diff.pos { color: var(--ok); }
.diff.neg { color: var(--bad); }

/* Sistemas */
.sys { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--line-soft); }
.sys:first-child { border-top: 0; }
.sys .logo { width: 46px; height: 46px; border-radius: 14px; background: var(--etrusco); display: grid; place-items: center; flex: none; }
.sys .logo img { width: 30px; image-rendering: pixelated; }
.sys .logo .ms { color: var(--banana); }
.sys .grow { flex: 1; min-width: 0; }
.sys .t { font-weight: 650; }
.sys .s { color: var(--muted); font-size: .8rem; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .84rem; }
th { text-align: left; font-family: var(--pixel); font-weight: 400; font-size: .6rem; letter-spacing: .07em; text-transform: uppercase; color: var(--siena); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }

/* Toasts */
.toasts { position: fixed; left: 16px; right: 16px; bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom)); z-index: 80; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; background: var(--etrusco-deep); color: var(--marfil); border-radius: 14px; padding: 12px 16px; font-size: .88rem; box-shadow: var(--shadow-lg); max-width: 440px; animation: up .22s ease; }
.toast .ms { color: var(--banana); }
.toast.error { background: var(--bad); }
.toast.error .ms { color: #fff; }
.toast.ok .ms { color: #7fe0a8; }

.desk-only { display: none; }

/* ---------- Tablet / escritorio ---------- */
@media (min-width: 720px) {
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .quick { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid .full { grid-column: 1 / -1; }
  .hero { padding: 28px 30px 30px; min-height: 190px; }
  .hero h2 { font-size: 2rem; }
  .hero .brian { width: 170px; right: 28px; bottom: -56px; }
  .sheet-backdrop { align-items: center; padding: 24px; }
  .sheet { max-width: 640px; border-radius: 24px; max-height: 90vh; }
  .sheet.wide { max-width: 860px; }
  .sheet-head::before { display: none; }
  .sheet-foot { border-radius: 0 0 24px 24px; justify-content: flex-end; }
  .sheet-foot .btn { flex: 0 0 auto; }
  .plist.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chips { margin-inline: 0; padding-inline: 0; }
}

@media (min-width: 1024px) {
  .app { display: grid; grid-template-columns: 252px minmax(0, 1fr); transition: grid-template-columns .24s cubic-bezier(.2, .8, .2, 1); }
  .sidebar {
    display: flex; flex-direction: column; gap: 18px;
    position: sticky; top: 0; height: 100vh; overflow: hidden;
    background: linear-gradient(180deg, var(--etrusco) 0%, var(--etrusco-deep) 100%); color: var(--marfil); padding: 20px 14px;
  }
  .brand {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 4px 6px 18px; text-align: left;
    background: transparent; border: 0; border-bottom: 1px solid rgba(255, 246, 229, .12); border-radius: 0; color: inherit;
  }
  .brand-badge {
    width: 52px; height: 52px; flex: none; border-radius: 16px; display: grid; place-items: center;
    background: rgba(42, 15, 7, .65); box-shadow: inset 0 0 0 1px rgba(255, 201, 54, .18), 0 6px 14px rgba(0, 0, 0, .25);
    transition: transform .16s ease, box-shadow .16s ease;
  }
  .brand:hover .brand-badge { box-shadow: inset 0 0 0 1.5px var(--banana), 0 6px 14px rgba(0, 0, 0, .25); }
  .brand:active .brand-badge { transform: scale(.94); }
  .brand-ico { width: 36px; height: 36px; image-rendering: pixelated; }
  .brand-txt { display: grid; gap: 3px; white-space: nowrap; }
  .brand-txt b { font-family: var(--display); font-weight: 800; font-size: 1.05rem; color: var(--banana); letter-spacing: .01em; }
  .box-tag { font-family: var(--pixel); font-size: .72rem; letter-spacing: .3em; color: var(--marfil); }
  .side-nav { display: grid; gap: 2px; overflow-y: auto; }
  .side-nav .grp { font-family: var(--pixel); font-size: .58rem; letter-spacing: .1em; color: rgba(255, 201, 54, .7); padding: 14px 12px 6px; text-transform: uppercase; }
  .side-nav button {
    display: flex; align-items: center; gap: 12px; border: 0; background: transparent; color: #e9d6bf;
    padding: 10px 12px; border-radius: 12px; font-weight: 550; font-size: .92rem; text-align: left;
  }
  .side-nav button:hover { background: rgba(255, 246, 229, .07); color: var(--marfil); }
  .side-nav button.active { background: var(--banana); color: var(--etrusco-deep); font-weight: 700; }
  .side-nav button.active .ms { font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24; }
  .side-nav .cnt { margin-left: auto; background: var(--papaya); color: #fff; border-radius: 99px; font-size: .7rem; padding: 1px 8px; font-weight: 700; }
  .side-nav .cnt.zero { display: none; }
  .side-foot { margin-top: auto; display: grid; gap: 10px; padding-top: 14px; border-top: 1px solid rgba(255, 246, 229, .12); }
  .net { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: #e9d6bf; padding: 0 8px; }
  .net .dot { width: 8px; height: 8px; border-radius: 50%; background: #45d483; box-shadow: 0 0 0 3px rgba(69, 212, 131, .2); }
  .net.offline .dot { background: #ff7a59; box-shadow: 0 0 0 3px rgba(255, 122, 89, .2); }
  .who { display: flex; align-items: center; gap: 8px; border: 0; background: rgba(255, 246, 229, .07); color: var(--marfil); border-radius: 12px; padding: 9px 10px; font-weight: 600; font-size: .86rem; text-align: left; }
  .who span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .who .role { font-family: var(--pixel); font-size: .56rem; letter-spacing: .06em; background: var(--banana); color: var(--etrusco-deep); padding: 3px 6px; border-radius: 6px; }

  .topbar { background: rgba(255, 246, 229, .9); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); color: var(--ink); border-bottom: 1px solid var(--line); padding: 14px 32px; }
  .top-ico { display: none; }
  .crumb { color: var(--siena); }
  .top-title { color: var(--etrusco); font-size: 1.3rem; }
  .top-actions .search { display: flex; align-items: center; gap: 8px; width: min(360px, 32vw); padding: 0 14px; min-height: 44px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--white); }
  .top-actions .search:focus-within { border-color: var(--papaya); }
  .top-actions .search .ms { color: var(--muted); }
  .top-actions .search input { border: 0; outline: none; background: transparent; width: 100%; }
  .icon-btn { background: var(--white); color: var(--etrusco); box-shadow: inset 0 0 0 1.5px var(--line); height: 44px; min-width: 44px; }
  .net-pill.offline { background: var(--bad); color: #fff; box-shadow: none; }
  .content { padding: 26px 32px 48px; }
  .tabbar { display: none; }
  .toasts { left: auto; right: 24px; bottom: 24px; justify-items: end; }
  .hide-sm { display: inline-flex; }
  .desk-only { display: block; }
  .dash-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 14px; align-items: start; }
  .detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 14px; align-items: start; }
  .quick { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .scan-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
  .plist.grid-2 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .pcard.variant { margin-left: 0; width: 100%; }
}
@media (max-width: 1023px) { .hide-sm { display: none; } .dash-grid > * + *, .detail-grid > * + * { margin-top: 14px; } }

/* ---------- Escritorio: menú lateral contraído (solo iconos) ---------- */
@media (min-width: 1024px) {
  .side-nav button, .who { position: relative; white-space: nowrap; }
  .app.side-collapsed { grid-template-columns: 88px minmax(0, 1fr); }
  .side-collapsed .sidebar { padding: 20px 12px; }
  .side-collapsed .brand { justify-content: center; padding: 4px 0 18px; }
  .side-collapsed .brand-txt,
  .side-collapsed .side-nav .lbl,
  .side-collapsed .net .lbl,
  .side-collapsed .who-name,
  .side-collapsed .who .role { display: none; }
  .side-collapsed .side-nav .grp { padding: 0; margin: 10px 14px; height: 1px; background: rgba(255, 246, 229, .12); }
  .side-collapsed .side-nav .grp span { display: none; }
  .side-collapsed .side-nav button { justify-content: center; padding: 12px 0; }
  .side-collapsed .side-nav button .ms { font-size: 24px; }
  .side-collapsed .side-nav .cnt { position: absolute; top: 4px; right: 8px; min-width: 18px; padding: 1px 5px; font-size: .62rem; text-align: center; }
  .side-collapsed .net { justify-content: center; padding: 0; }
  .side-collapsed .who { justify-content: center; padding: 10px 0; }

  /* Más aire en pantallas anchas */
  .content { max-width: 1440px; }
}
@media (min-width: 1440px) {
  .stats { gap: 14px; }
}

/* ---------- Barras de desplazamiento con la marca (solo con mouse; el celular usa las suyas) ---------- */
.tabs, .chips { scrollbar-width: none; }
.tabs::-webkit-scrollbar, .chips::-webkit-scrollbar { display: none; }
.tabs button { flex: 1 0 auto; }
@media (pointer: fine) {
  ::-webkit-scrollbar { width: 12px; height: 12px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: #e3c9a0; border-radius: 99px; border: 3px solid var(--marfil); }
  ::-webkit-scrollbar-thumb:hover { background: var(--papaya); }
  ::-webkit-scrollbar-corner { background: transparent; }
  .card ::-webkit-scrollbar-thumb, .sheet-body::-webkit-scrollbar-thumb, .sheet ::-webkit-scrollbar-thumb { border-color: var(--white); }
  .sheet-body::-webkit-scrollbar-thumb { border-color: var(--marfil); }
  .sidebar ::-webkit-scrollbar { width: 8px; }
  .sidebar ::-webkit-scrollbar-thumb { background: rgba(255, 201, 54, .35); border: 2px solid transparent; background-clip: padding-box; }
  .sidebar ::-webkit-scrollbar-thumb:hover { background: var(--banana); background-clip: padding-box; }
  /* Firefox no tiene los pseudoelementos: usa los colores estándar */
  @supports not selector(::-webkit-scrollbar) {
    html, .card, .sheet-body, .table-wrap { scrollbar-width: thin; scrollbar-color: #e3c9a0 transparent; }
    .sidebar * { scrollbar-width: thin; scrollbar-color: rgba(255, 201, 54, .35) transparent; }
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Los textos de filas y tarjetas son <span>: se muestran en bloque. */
.row .t, .row .s, .row .end .n, .row .end .u,
.pcard .t, .pcard .s, .pcard .meta, .pcard .qty .n, .pcard .qty .u, .pcard .qty .p,
.row .grow, .pcard .grow, .stat .val, .stat .note { display: block; }
.pcard .meta { display: flex; }
.toolbar .search-box { flex: 1 1 100%; }
.toolbar select { flex: 1 1 calc(50% - 4px); min-width: 0; }
@media (min-width: 720px) { .toolbar .search-box { flex: 1 1 260px; } .toolbar select { flex: 0 1 auto; min-width: 150px; } }
.plist { grid-template-columns: minmax(0, 1fr); }
.pcard, .row { min-width: 0; }

.toolbar .wide-select { flex: 1 1 100%; }
@media (min-width: 720px) { .toolbar .wide-select { flex: 1 1 240px; } }
.field { align-content: start; }
.count-row .thumb { width: 40px; height: 40px; border-radius: 12px; }

/* Controles de la cámara: zoom, linterna, cambiar cámara */
.cam-tools { position: absolute; top: 12px; right: 12px; z-index: 3; display: flex; gap: 8px; }
.cam-tools:empty { display: none; }
.cam-tools button {
  width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: rgba(42, 15, 7, .62); color: var(--marfil); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  box-shadow: inset 0 0 0 1px rgba(255, 246, 229, .18); font: 700 .86rem/1 var(--text);
}
.cam-tools button.on { background: var(--banana); color: var(--etrusco-deep); }
.cam-hint {
  position: absolute; top: 12px; left: 12px; right: 172px; z-index: 3;
  font-size: .76rem; font-weight: 600; color: var(--marfil); text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}
.scanner:not(.live) .cam-hint { display: none; }

/* Envío de catálogo: filtro de categorías (v1.1) */
.cat-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-check { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: .85rem; cursor: pointer; max-width: 100%; }
.chip-check input { width: 16px !important; height: 16px !important; min-height: 0 !important; flex: none; margin: 0; padding: 0; }
.chip-check span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-check:has(input:checked) { background: var(--banana-soft, #fff3c4); border-color: var(--banana, #ffc936); }

/* Lotes de envío y Sincronizar con GRID paso a paso (v1.2) */
.batch-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 12px; border: 1px dashed #f1d98c; border-radius: var(--radius-sm); background: var(--banana-soft); font-size: .82rem; color: var(--etrusco); }
.batch-row > .ms { color: var(--siena); font-size: 19px; }
.batch-row .grow { flex: 1 1 200px; min-width: 0; }
.batch-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.steps .step { display: flex; gap: 14px; padding: 16px 18px; border-top: 1px solid var(--line-soft); }
.steps .step:first-child { border-top: 0; }
.step-n { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--banana-soft); color: var(--etrusco); border: 1.5px solid #f1d98c; }
.step.ok .step-n { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.step .t { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.step .t .ms { font-size: 19px; color: var(--siena); }
.step .s { font-size: .84rem; margin-top: 3px; }
.step .grow { flex: 1; min-width: 0; }
.sys > .badge { margin-left: auto; }
.sys .grow { flex: 1 1 180px; }
/* iOS acerca la pantalla al enfocar un campo con letra menor a 16 px: en celular, 16 px. */
@media (max-width: 719px) { input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px; } }
.toolbar .date-f { width: auto; flex: 1 1 calc(50% - 4px); min-width: 0; }
@media (min-width: 720px) { .toolbar .date-f { flex: 0 1 170px; } }
@media (max-width: 359px) { .toolbar .date-f { flex-basis: 100%; } }
/* Campo adicional nuevo: nombre arriba; tipo y botón abajo en celulares angostos. */
.cf-add > select { flex: 0 0 112px; }
@media (max-width: 419px) { .cf-add { flex-wrap: wrap; } .cf-add > input { flex: 1 1 100%; } .cf-add > select { flex: 1 1 0; } }
/* Recibir existencias de GRID: emparejar almacenes (v1.2, 1C) */
.wh-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.wh-row .wh-g { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; flex: 1 1 140px; min-width: 0; }
.wh-row .wh-g .ms { color: var(--siena); font-size: 19px; }
.wh-row select { flex: 1 1 180px; min-width: 0; }
@media (max-width: 479px) { .wh-row > .ms { display: none; } .wh-row select { flex-basis: 100%; } }
/* Cámara v1.2: zoom deslizante, tocar para enfocar y diagnóstico */
.cam-zoom { position: absolute; left: 12px; right: 12px; bottom: 70px; z-index: 3; display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-radius: 999px; background: rgba(42, 15, 7, .62); color: var(--marfil); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.cam-zoom[hidden] { display: none; }
.cam-zoom .ms { font-size: 20px; color: var(--banana); }
.cam-zoom input[type=range] { flex: 1; min-width: 0; height: 32px; accent-color: var(--banana); background: transparent; }
.cam-zoom b { font: 700 .82rem/1 var(--text); min-width: 38px; text-align: right; }
.focus-ring { position: absolute; z-index: 3; width: 64px; height: 64px; margin: -32px 0 0 -32px; border: 2px solid var(--banana); border-radius: 50%; pointer-events: none; }
.focus-ring.go { animation: focusring .8s ease-out forwards; }
@keyframes focusring { from { transform: scale(1.4); opacity: 1; } to { transform: scale(.8); opacity: 0; } }
.cam-diag { position: absolute; left: 10px; right: 10px; top: 10px; bottom: 10px; z-index: 4; overflow: auto; padding: 10px 12px; border-radius: 14px; background: rgba(28, 10, 4, .9); color: var(--marfil); font-size: .76rem; line-height: 1.35; }
.cam-diag[hidden] { display: none; }
.cam-diag > div { display: grid; grid-template-columns: 96px 1fr; gap: 8px; padding: 4px 0; border-top: 1px solid rgba(255, 246, 229, .12); }
.cam-diag > div span { color: #e9d6bf; }
.cam-diag > div b { font-weight: 600; overflow-wrap: anywhere; }
.cam-diag .cam-diag-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 0; padding: 0 0 6px; }
.cam-diag .cam-diag-h span { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.cam-diag button { min-height: 36px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--banana); color: var(--etrusco-deep); font: 700 .76rem/1 var(--text); display: inline-flex; align-items: center; }
.cam-diag button[data-d=close] { background: rgba(255, 246, 229, .16); color: var(--marfil); padding: 0 8px; }
.scanner.live video { cursor: crosshair; }
/* Con la cámara activa, en celular el visor es vertical: franja despejada y más fácil de apuntar. */
@media (max-width: 719px) { .scanner.live { aspect-ratio: 3 / 4; max-height: 64vh; } .sheet .scanner.live { max-height: 48vh; } }
/* Lector dentro de un panel (ficha, movimiento): sin botón Detener, el zoom va al borde; la indicación no entra. */
.scanner:not(:has(.hud)) .cam-zoom { bottom: 12px; }
.sheet .cam-hint { display: none; }
/* Protección de datos (v1.3) */
.protect .row { align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 10px 0; }
.protect .row .grow { flex: 1 1 180px; min-width: 0; }
.protect .row .t, .protect .row .s { white-space: normal; overflow: visible; }
.steps-ol { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.steps-ol li { line-height: 1.4; }

/* BX-301: Alta rápida — bloque "Más datos" cerrado por defecto */
.more-box { border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--white); overflow: hidden; }
.more-box > summary { list-style: none; display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 10px 14px; font-weight: 650; color: var(--etrusco); cursor: pointer; }
.more-box > summary::-webkit-details-marker { display: none; }
.more-box > summary::after { content: "expand_more"; font-family: 'Material Symbols Rounded'; font-size: 20px; margin-left: auto; color: var(--siena); transition: transform .18s ease; }
.more-box[open] > summary { border-bottom: 1px solid var(--line-soft); background: var(--marfil); }
.more-box[open] > summary::after { transform: rotate(180deg); }
.more-box .more-body { padding: 14px; }

/* BX-302: Recepción de mercadería */
.rcp-wrap { padding-bottom: 156px; }
.rcp-suggest { position: relative; }
.rcp-drop { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; background: var(--white); border: 1.5px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); max-height: 260px; overflow-y: auto; }
.rcp-drop button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; min-height: 46px; border: 0; border-top: 1px solid var(--line-soft); background: transparent; text-align: left; }
.rcp-drop button:first-child { border-top: 0; }
.rcp-drop button:hover { background: var(--marfil); }
.rcp-row { display: grid; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line-soft); transition: background .3s ease; }
.rcp-row:first-child { border-top: 0; }
.rcp-row.flash, .count-row.flash { background: var(--banana-soft); }
.rcp-row.row-err { background: var(--bad-soft); }
.rcp-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rcp-top .grow { flex: 1; min-width: 0; }
.rcp-ctrl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.qty-step { display: inline-flex; align-items: center; gap: 4px; }
.qty-step .btn { width: 44px; min-width: 44px; min-height: 44px; padding: 0; }
.qty-step input { width: 72px; min-height: 44px; text-align: center; font-weight: 700; border: 1.5px solid var(--line); border-radius: 10px; background: var(--white); padding: 0 6px; }
.rcp-cost { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); }
.rcp-cost input { width: 88px; min-height: 44px; text-align: right; border: 1.5px solid var(--line); border-radius: 10px; background: var(--white); padding: 0 8px; }
.rcp-stock { margin-left: auto; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.rcp-stock b { color: var(--ok); }
.rcp-err-msg { color: var(--bad); font-size: .8rem; font-weight: 600; }
.rcp-bar {
  position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)); z-index: 35;
  background: var(--white); border-top: 1.5px solid var(--line); box-shadow: 0 -6px 24px rgba(69, 24, 12, .1);
  padding: 10px 14px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
}
.rcp-bar-sum { font-size: .84rem; font-weight: 650; color: var(--etrusco); min-width: 0; overflow-wrap: anywhere; }
.rcp-bar-acts { display: flex; gap: 8px; flex: 1 1 auto; justify-content: flex-end; min-width: 0; }
.rcp-bar-acts .btn { min-height: 44px; }
@media (max-width: 479px) {
  .rcp-bar-acts { width: 100%; }
  .rcp-bar-acts .btn { flex: 1 1 0; min-width: 0; white-space: normal; line-height: 1.2; padding: 6px 10px; }
  .rcp-stock { width: 100%; margin-left: 0; }
}
@media (min-width: 1024px) {
  .rcp-wrap { padding-bottom: 96px; }
  .rcp-bar { left: 252px; bottom: 0; padding: 12px 32px; transition: left .24s cubic-bezier(.2, .8, .2, 1); }
  .app.side-collapsed .rcp-bar { left: 88px; }
}

/* BX-303: Conteo con cámara y modo de lectura */
.count-scan-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.count-scan-bar .btn { min-height: 44px; }
.count-scan-bar select { min-height: 44px; flex: 1 1 200px; min-width: 0; }
.count-diff-list { display: grid; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); text-align: left; }
.count-diff-item { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; font-size: .84rem; color: var(--ink); line-height: 1.35; }
.count-diff-item .diff { font-weight: 700; }
