:root {
  --bg: #f3f5f9; --card: #fff; --text: #0f172a; --muted: #64748b; --line: #e5e9f0;
  --brand: #2f5bea; --brand-ink: #fff; --brand-soft: #eaf0ff; --side: #0b1220; --accent: #ffc43d;
  --ok: #059669; --bad: #dc2626; --warn: #b45309; --yellow: #fff3c4; --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .05);
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -.02em; font-weight: 800; }
h2 { font-size: 17px; margin: 28px 0 12px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
h3 { font-weight: 700; }
p { margin: 6px 0; }
code { background: #eef2ff; padding: 1px 5px; border-radius: 5px; font-size: 13px; }
.ic { flex: none; }

/* Layout con menu lateral */
body.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--side); color: #cbd5e1; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 12px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; padding: 4px 8px 18px; font-size: 13px; line-height: 1.15; letter-spacing: .08em; font-weight: 600; }
.brand:hover { text-decoration: none; }
.brand b { color: var(--accent); font-size: 17px; letter-spacing: .12em; }
.mark { width: 40px; height: 40px; border-radius: 11px; background: linear-gradient(135deg, var(--accent), #ff8a3d); color: var(--side); display: grid; place-items: center; font-weight: 900; font-size: 16px; letter-spacing: 0; }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: #64748b; padding: 14px 10px 6px; font-weight: 600; }
.side nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; color: #cbd5e1; font-weight: 500; }
.side nav a:hover { background: #162033; color: #fff; text-decoration: none; }
.side nav a.on { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(47, 91, 234, .35); }
.side nav a .pill { margin-left: auto; }
.side-foot .link { color: #94a3b8; display: flex; align-items: center; gap: 8px; padding: 10px; }
main { padding: 28px 32px 48px; max-width: 1280px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.pill { background: #ef4444; color: #fff; border-radius: 99px; padding: 1px 8px; font-size: 12px; font-weight: 700; }
.pill.grey { background: #cbd5e1; color: #334155; }

.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small, small { font-size: 13px; }
.right { margin-left: auto; }
.good { color: var(--ok); } .bad { color: var(--bad); } .warn { color: var(--warn); }

.card, .panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card.narrow { max-width: 380px; margin: 14vh auto; padding: 28px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.panel-head h2 { margin: 0; }
.panel-head a { font-size: 13px; font-weight: 600; }

/* Indicadores */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px; align-items: center; color: var(--text); box-shadow: var(--shadow); }
a.kpi:hover { text-decoration: none; border-color: var(--brand); transform: translateY(-1px); }
.kpi-ic { grid-row: span 2; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: #fee2e2; color: #dc2626; }
.kpi-ic.c2 { background: #fef3c7; color: #b45309; } .kpi-ic.c3 { background: #dcfce7; color: #15803d; }
.kpi-ic.c4 { background: var(--brand-soft); color: var(--brand); } .kpi-ic.c5 { background: #f3e8ff; color: #7e22ce; }
.kpi-num { font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.kpi-lbl { font-size: 13px; color: var(--muted); }
.kpi.hot { background: linear-gradient(135deg, #2f5bea, #4f46e5); color: #fff; border: none; }
.kpi.hot .kpi-ic { background: rgba(255, 255, 255, .18); color: #fff; }
.kpi.hot .kpi-lbl { color: #dbe4ff; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.dash-col { display: flex; flex-direction: column; }
.store-row { display: flex; align-items: center; gap: 14px; padding: 12px 8px; border-radius: 10px; color: var(--text); border-bottom: 1px solid var(--line); }
.store-row:last-child { border-bottom: none; }
.store-row:hover { background: #f8fafc; text-decoration: none; }
.store-main { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.bar { display: flex; height: 8px; border-radius: 99px; background: #eef2f7; overflow: hidden; }
.bar span { height: 100%; }
.bar .b2 { opacity: .35; }
.store-count { text-align: right; display: flex; flex-direction: column; line-height: 1.1; }
.store-count b { font-size: 22px; }
.store-count small { color: var(--muted); font-size: 11px; }
.avatar { width: 40px; height: 40px; border-radius: 12px; color: #fff; display: inline-grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; letter-spacing: .02em; }
.avatar.sm { width: 28px; height: 28px; border-radius: 8px; font-size: 11px; }
.avatar.lg { width: 52px; height: 52px; border-radius: 14px; font-size: 18px; }
.who { display: inline-flex; align-items: center; gap: 10px; }
.who.big h1 { margin: 0; }
.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut { width: 120px; height: 120px; flex: none; }
.mini-sale { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.mini-sale:last-child { border-bottom: none; }
.mini-sale img, .mini-sale .ph-empty { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); background: #f1f5f9; flex: none; }
.mini-sale > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.mini-sale b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.status { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.s-por_imprimir { background: #fee2e2; color: #b91c1c; } .s-impresa { background: #fef3c7; color: #92400e; }
.s-despachada { background: #dcfce7; color: #166534; } .s-cancelada { background: #f1f5f9; color: #475569; }

/* Tablas y formularios */
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
th { background: #f8fafc; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
tr:hover td { background: #fafbfd; }
td.actions { display: flex; gap: 6px; flex-wrap: wrap; }
input, select, textarea, button, .btn { font: inherit; padding: 9px 12px; border: 1px solid #d6dce6; border-radius: 10px; background: #fff; color: inherit; }
input:focus, select:focus, textarea:focus { outline: 3px solid #c7d5ff; border-color: var(--brand); }
button, .btn { cursor: pointer; display: inline-flex; align-items: center; gap: 7px; background: #fff; font-weight: 500; }
button:hover, .btn:hover { background: #f1f5f9; text-decoration: none; }
.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 600; box-shadow: 0 2px 8px rgba(47, 91, 234, .25); }
.primary:hover { background: #2348c9; }
.danger { color: var(--bad); }
button.link { border: none; background: none; padding: 0; color: var(--brand); box-shadow: none; }
button.link.danger { color: var(--bad); }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 500; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 15px; }
label input, label select, label textarea { color: var(--text); font-size: 15px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filters input[name=q], .filters input[name=code] { flex: 1; min-width: 240px; padding: 11px 14px; font-size: 16px; }
.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; border: 1px solid; font-weight: 500; }
.flash.ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.flash.error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.flash.info { background: var(--brand-soft); border-color: #c7d5ff; color: #1e3a8a; }
.tag { display: inline-flex; align-items: center; font-size: 12px; padding: 2px 9px; border-radius: 99px; background: #eef2f7; color: #334155; font-weight: 600; }
.tag.ok { background: #dcfce7; color: var(--ok); }
.tag.bad { background: #fee2e2; color: var(--bad); }
.tag.warn { background: var(--yellow); color: #7c4a03; }
.tag.store { background: #0f172a; color: #fff; }
.tag.direct { background: #ede9fe; color: #5b21b6; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; background: #e9edf4; padding: 4px; border-radius: 12px; width: fit-content; }
.tabs a { padding: 8px 14px; color: var(--muted); border-radius: 9px; font-weight: 600; font-size: 14px; display: inline-flex; gap: 6px; align-items: center; }
.tabs a.on { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.tabs a:hover { text-decoration: none; color: var(--text); }
.thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: #fff; display: block; }
.thumb.lg { width: 84px; height: 84px; }
.thumb.empty { font-size: 10px; color: var(--muted); display: flex; align-items: center; justify-content: center; text-align: center; background: #f1f5f9; }
.photo-lg { max-width: 100%; max-height: 340px; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; }
.product-line { display: flex; gap: 14px; align-items: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 800; background: #f8fafc; font-size: 16px; }
.items-table input { width: 100%; }

/* Lista de etiquetas */
.bulk-bar { position: sticky; top: 12px; z-index: 5; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: #0f172a; color: #fff; padding: 10px 14px; border-radius: 14px; margin-bottom: 14px; box-shadow: 0 8px 24px rgba(15, 23, 42, .18); }
.bulk-bar label.check { color: #fff; }
.bulk-bar select { color: var(--text); }
.bulk-bar button:not(.primary):not(.link), .bulk-bar .btn:not(.primary) { color: var(--text); }
.bulk-bar .link { color: #fca5a5; }
.sales { display: grid; grid-template-columns: repeat(auto-fill, minmax(520px, 1fr)); gap: 14px; }
.sale { position: relative; display: flex; flex-direction: row; gap: 16px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--store, #94a3b8); border-radius: var(--radius); padding: 14px; color: var(--text); font-size: 15px; cursor: pointer; box-shadow: var(--shadow); transition: box-shadow .15s, transform .15s; }
.sale:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(15, 23, 42, .08); }
.sale:has(.pick:checked) { border-color: var(--brand); border-left-color: var(--store, var(--brand)); box-shadow: 0 0 0 3px #c7d5ff; background: #f8faff; }
.sale .pick { position: absolute; top: 12px; right: 12px; width: 22px; height: 22px; accent-color: var(--brand); }
.sale-photos { display: flex; gap: 6px; flex-wrap: wrap; max-width: 280px; flex: none; }
.sale-photos .ph { position: relative; }
.sale-photos img, .sale-photos .empty { width: 136px; height: 136px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: #f8fafc; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); }
.sale-photos .ph + .ph img, .sale-photos .ph + .ph .empty { width: 88px; height: 88px; }
.sale-photos .qty { position: absolute; right: 6px; bottom: 6px; background: #dc2626; color: #fff; font-weight: 800; border-radius: 8px; padding: 1px 8px; font-size: 17px; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); }
.sale-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; padding-right: 26px; }
.sale-head { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.item b { font-size: 16px; }
.loc { background: var(--yellow); padding: 1px 6px; border-radius: 6px; font-weight: 700; white-space: nowrap; }
.link-form { display: inline-flex; gap: 4px; margin-top: 4px; }
.link-form input, .link-form button { padding: 5px 9px; font-size: 13px; }

/* Mapa de bodega */
.shelf { display: flex; gap: 10px; align-items: stretch; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.shelf:last-child { border-bottom: none; }
.shelf-name { width: 130px; font-weight: 700; display: flex; align-items: center; }
.slot { position: relative; display: inline-flex; flex-direction: column; gap: 0; min-width: 130px; padding: 8px 10px 8px 14px; border: 1px dashed #cbd5e1; border-radius: 10px; font-size: 13px; color: var(--muted); cursor: pointer; background: #fafbfc; }
.slot.rented { border: 1px solid color-mix(in srgb, var(--store) 40%, white); background: color-mix(in srgb, var(--store) 10%, white); color: var(--text); }
.slot.rented::before { content: ''; position: absolute; left: 0; top: 6px; bottom: 6px; width: 4px; border-radius: 0 4px 4px 0; background: var(--store); }
.slot.estante { background: color-mix(in srgb, var(--store) 20%, white); }
.slot:has(input:checked) { outline: 3px solid var(--brand); }
.slot b { font-size: 14px; color: var(--text); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 6px 0 12px; }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.legend i.free { border: 1px dashed #94a3b8; background: #fafbfc; }
.legend i.full { background: #cbd5e1; }

body.login { background: radial-gradient(circle at 20% 10%, #1e3a8a, var(--side) 60%); display: block; }
body.login h1 b { color: var(--brand); }

@media (max-width: 900px) {
  body.app { grid-template-columns: minmax(0, 1fr); }
  .side, main { min-width: 0; }
  .side .store-badge { padding: 6px 10px; margin: 0; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; gap: 8px; }
  .brand { padding: 0 8px 0 0; }
  .mark { width: 34px; height: 34px; }
  .side nav { flex-direction: row; overflow-x: auto; flex-basis: 100%; order: 3; min-width: 0; max-width: 100%; }
  .nav-group { display: none; }
  .side nav a { white-space: nowrap; padding: 8px 10px; }
  .side-foot { margin-left: auto; }
  main { padding: 18px 16px 40px; }
  .dash-grid, .two-col { grid-template-columns: minmax(0, 1fr); }
  .mini-sale .timeline-status { display: none; }
  .sales { grid-template-columns: 1fr; }
  .sale { flex-wrap: wrap; }
  .sale-photos img, .sale-photos .empty { width: 100px; height: 100px; }
  table { font-size: 13px; display: block; overflow-x: auto; }
  .bulk-bar { top: 0; }
}

/* Preparacion */
.chip-stat { background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 6px 14px; font-size: 14px; color: var(--muted); box-shadow: var(--shadow); }
.chip-stat b { color: var(--text); font-size: 16px; }
.chip-stat.ok b { color: var(--ok); }
.scan-box { display: flex; align-items: center; gap: 12px; background: var(--card); border: 2px solid var(--brand); border-radius: 18px; padding: 14px 18px; margin-bottom: 18px; box-shadow: 0 6px 24px rgba(47, 91, 234, .12); color: var(--brand); }
.scan-box input { flex: 1; border: none; font-size: 22px; padding: 10px 4px; min-width: 0; }
.scan-box input:focus { outline: none; }
.scan-box.compact { padding: 8px 14px; border-width: 1px; box-shadow: var(--shadow); }
.scan-box.compact input { font-size: 17px; padding: 6px 4px; }
.scan-box.verify { margin: 0; border-color: var(--ok); color: var(--ok); }
.big-alert { font-size: 18px; padding: 16px 20px; }
.big-alert.danger { background: #dc2626; color: #fff; font-size: 28px; font-weight: 900; text-align: center; border-radius: 16px; margin-bottom: 16px; letter-spacing: .04em; }
.prep { background: var(--card); border: 1px solid var(--line); border-top: 6px solid var(--store); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); }
.prep-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.prep-head h2 { margin: 0; font-size: 20px; }
.prep-head p { margin: 2px 0 0; }
.prep-tags { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.units { background: #0f172a; color: #fff; border-radius: 10px; padding: 4px 12px; }
.units b { font-size: 20px; }
.prep-items { display: flex; flex-direction: column; gap: 12px; }
.prep-item { display: grid; grid-template-columns: 180px 90px 1fr 120px; gap: 18px; align-items: center; border: 2px solid var(--line); border-radius: 16px; padding: 12px; transition: background .2s, border-color .2s; }
.prep-item.ok { border-color: var(--ok); background: #ecfdf5; }
.prep-photo img, .prep-photo span { width: 180px; height: 180px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: #f8fafc; display: grid; place-items: center; color: var(--muted); }
.prep-qty { text-align: center; line-height: 1; }
.prep-qty b { font-size: 64px; font-weight: 900; }
.prep-qty small { display: block; color: var(--muted); }
.prep-info h3 { margin: 0 0 6px; font-size: 22px; }
.prep-info p { margin: 4px 0; font-size: 16px; }
.loc.big { font-size: 20px; padding: 2px 10px; }
.prep-check { text-align: center; display: flex; flex-direction: column; gap: 6px; }
.prep-check .count { font-size: 24px; font-weight: 800; }
.prep-check .state { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 99px; background: #fee2e2; color: #b91c1c; }
.prep-item.ok .state { background: var(--ok); color: #fff; }
.verify-bar { margin-top: 18px; display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.verify-msg { grid-column: 1 / -1; font-size: 18px; font-weight: 700; padding: 10px 14px; border-radius: 12px; background: #f1f5f9; color: var(--muted); grid-row: 2; }
.verify-msg.ok { background: #dcfce7; color: #166534; }
.verify-msg.bad { background: #dc2626; color: #fff; }
.big-btn { font-size: 18px; padding: 14px 22px; }
.cam-modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .75); display: grid; place-items: center; z-index: 50; padding: 16px; }
.cam-box { background: var(--card); border-radius: 18px; padding: 16px; width: min(480px, 100%); text-align: center; }
#cam-reader { width: 100%; border-radius: 12px; overflow: hidden; }
@media (max-width: 900px) {
  .prep-item { grid-template-columns: 110px 1fr; }
  .prep-photo img, .prep-photo span { width: 110px; height: 110px; }
  .prep-qty { grid-column: 1; grid-row: 2; }
  .prep-qty b { font-size: 44px; }
  .prep-info { grid-column: 2; grid-row: 1 / span 2; }
  .prep-check { grid-column: 1 / -1; flex-direction: row; justify-content: center; align-items: center; }
  .prep-info h3 { font-size: 18px; }
  .verify-bar { grid-template-columns: 1fr; }
  .verify-msg { grid-row: auto; }
  .scan-box input { font-size: 17px; }
  .prep-tags { margin-left: 0; }
}
.cam-modal[hidden] { display: none; }
.login-brand { justify-content: center; padding: 0 0 18px; color: var(--text); }
body.login .card.narrow { display: flex; flex-direction: column; gap: 14px; }
code.pw { font-size: 18px; padding: 3px 8px; background: #fff; border: 1px solid #a7f3d0; letter-spacing: .05em; }
.preview-bar { background: #fef3c7; color: #92400e; padding: 10px 16px; border-radius: 12px; margin-bottom: 16px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-weight: 600; }
.side .store-badge { display: flex; align-items: center; gap: 10px; padding: 12px 10px; margin: 0 0 6px; background: #162033; border-radius: 12px; color: #fff; }
.side .store-badge small { display: block; color: #94a3b8; font-weight: 500; }
.space-hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.space-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); text-align: center; }
.space-card b { display: block; font-size: 52px; font-weight: 900; line-height: 1.1; color: var(--brand); }
.timeline-status { display: flex; gap: 4px; align-items: center; }
.timeline-status span { height: 6px; width: 28px; border-radius: 99px; background: #e2e8f0; }
.timeline-status span.on { background: var(--ok); }
.timeline-status.cancel span { background: #fecaca; }

/* Cobros por canal */
.channel-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 22px; }
.channel-card { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.channel-card.rent { border-left-color: #7e22ce; }
.channel-card.total { background: linear-gradient(135deg, #2f5bea, #4f46e5); color: #fff; border: none; }
.channel-card.total .cc-name, .channel-card.total .cc-amt { color: #dbe4ff; }
.cc-name { font-size: 13px; color: var(--muted); font-weight: 600; }
.cc-qty { margin: 4px 0 2px; } .cc-qty b { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.cc-amt { font-size: 14px; font-weight: 600; }
.scroll-x { overflow-x: auto; max-width: 100%; }
.billing-weeks td, .billing-weeks th { white-space: nowrap; }
.type-row { display: grid; grid-template-columns: 1.4fr 1fr 2fr 70px auto auto; gap: 10px; align-items: end; }
.type-row .logi { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; }
.type-row .logi label { flex-direction: row; gap: 4px; align-items: center; font-weight: 400; }
@media (max-width: 800px) { .type-row { grid-template-columns: 1fr; } }
.type-row .logi-box[hidden] { display: none; }
.pw-card { border: 2px solid var(--ok); background: #f0fdf4; margin-bottom: 14px; }
.pw-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 10px 0 14px; font-size: 16px; align-items: center; }
.pw-grid code.pw { font-size: 22px; font-weight: 800; letter-spacing: .04em; }

/* Aviso de ingreso: catalogo con fotos */
.cat-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 16px 0 12px; }
.cat-tools input { flex: 1 1 320px; min-width: 0; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.cat-item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: grid; gap: 4px; align-content: start; box-shadow: var(--shadow); }
.cat-item.on { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.cat-item img, .cat-noph { width: 100%; aspect-ratio: 4/3; object-fit: contain; border-radius: 8px; background: #f1f5f9; }
.cat-noph { display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.cat-name { font-size: 14px; line-height: 1.25; }
.cat-bc { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; letter-spacing: .03em; }
.cat-item .tag.warn { width: fit-content; }
.cat-qty { display: grid; grid-template-columns: 38px 1fr 38px; gap: 6px; margin-top: 6px; }
.cat-qty button { height: 38px; padding: 0; font-size: 20px; font-weight: 700; }
.cat-qty input { text-align: center; font-weight: 800; font-size: 16px; padding: 6px 4px; min-width: 0; }
.cat-bar { position: sticky; bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 14px; margin: 16px 0 24px; box-shadow: 0 8px 24px rgba(15, 23, 42, .18); }
.cat-item[hidden] { display: none; }
.inbound-alert { border-left: 4px solid var(--brand); }

/* Recepcion con conteo por escaneo */
.rec-summary { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.rec-summary b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.rec-bar { height: 12px; background: #eef2f7; border-radius: 99px; overflow: hidden; }
.rec-bar span { display: block; height: 100%; width: 0; background: var(--ok); transition: width .2s; }
@media (max-width: 700px) { .rec-summary { grid-template-columns: 1fr; } }
.rec-ask[hidden], .rec-msg[hidden] { display: none; }
.rec-ask.done { background: #dcfce7; color: #166534; border: 2px solid #16a34a; font-size: 1.05em; }
.rec-msg { padding: 10px 14px; border-radius: 10px; font-weight: 700; margin: -6px 0 12px; }
.rec-msg.good { background: #dcfce7; color: #166534; } .rec-msg.warn { background: var(--yellow); color: #7c4a03; } .rec-msg.bad { background: #fee2e2; color: #991b1b; }
.rec-ask { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--yellow); color: #7c4a03; padding: 12px 14px; border-radius: 10px; margin: -6px 0 12px; font-weight: 700; }
tr.rec-row.done { background: #f0fdf4; } tr.rec-row.over { background: #fffbeb; } tr.rec-row.part { background: #fff; }
/* Venta directa: cliente arriba, catalogo abajo */
.ds-client { display: grid; gap: 12px; }
.ds-client-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.ds-client-head h2, .ds-h2 { margin: 0; font-size: 18px; }
.ds-h2 { margin-top: 22px; }
.ds-paste { display: grid; gap: 8px; }
.ds-paste textarea { width: 100%; font: inherit; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.ds-filled { background: #f0fdf4; border-color: #86efac !important; }
.ds-stock { color: #166534; }
.cat-item.empty { opacity: .55; }
.ds-paste[hidden] { display: none; }
.cat-bar .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.45); }
.cat-bar .btn:disabled { opacity: .45; }
@media (max-width: 600px) { .cat-bar #ds-another { display: none; } .cat-bar { padding: 8px 12px; } }
/* Catalogo: selector cuadricula / listado */
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.view-toggle button { border: 0; border-radius: 0; background: transparent; padding: 8px 12px; font-weight: 700; color: var(--muted); box-shadow: none; }
.view-toggle button.on { background: var(--brand); color: #fff; }
.cat-grid.list { grid-template-columns: 1fr; gap: 6px; }
.cat-grid.list .cat-item { grid-template-columns: 56px minmax(0, 1fr) auto auto 150px; align-items: center; column-gap: 14px; padding: 8px 12px; }
.cat-grid.list .cat-item > img, .cat-grid.list .cat-noph { width: 56px; height: 56px; aspect-ratio: auto; grid-row: span 2; }
.cat-grid.list .cat-name { grid-column: 2; }
.cat-grid.list .cat-item > small { grid-column: 2; }
.cat-grid.list .cat-item > small.ds-stock, .cat-grid.list .cat-item > small.tag, .cat-grid.list .cat-item > small.cat-bc { grid-column: 3; grid-row: 1 / span 2; }
.cat-grid.list .cat-item > small.muted:not(:nth-of-type(1)) { grid-column: 4; grid-row: 1 / span 2; }
.cat-grid.list .cat-qty { grid-column: 5; grid-row: 1 / span 2; margin: 0; }
@media (max-width: 600px) {
  .cat-grid.list .cat-item { grid-template-columns: 48px minmax(0, 1fr) 128px; }
  .cat-grid.list .cat-item > img, .cat-grid.list .cat-noph { width: 48px; height: 48px; grid-row: span 3; }
  .cat-grid.list .cat-item > small.ds-stock, .cat-grid.list .cat-item > small.tag, .cat-grid.list .cat-item > small.cat-bc, .cat-grid.list .cat-item > small.muted:not(:nth-of-type(1)) { grid-column: 2; grid-row: auto; }
  .cat-grid.list .cat-qty { grid-column: 3; grid-row: 1 / span 3; }
}
/* Preparacion: preparada o despachada */
#done-form { display: grid; gap: 6px; justify-items: end; grid-column: 1 / -1; }
.done-choice .big-btn { white-space: nowrap; }
.done-choice { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; border-radius: 14px; }
.done-choice.ask { outline: 3px solid #16a34a; outline-offset: 6px; }
.dispatch-btn { background: #16a34a; color: #fff; border-color: #16a34a; }
.dispatch-btn:hover { background: #15803d; }
@media (max-width: 760px) { #done-form, .done-choice { justify-items: stretch; justify-content: stretch; } .done-choice .big-btn { flex: 1 1 100%; } }
.big-alert.already { background: #f59e0b; color: #1f1300; border-radius: 16px; margin-bottom: 16px; text-align: center; display: grid; gap: 8px; }
.already-title { font-size: 26px; font-weight: 900; letter-spacing: .03em; }
.prep.dim { opacity: .6; }
.verify-bar[hidden] { display: none; }
.day-filter { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.day-filter input { width: auto; }
.day-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin-bottom: 12px; }
/* Etiquetas: vista tabla (despachadas, canceladas, busquedas) */
.view-switch { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ltable-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.ltable-wrap[hidden], .sales[hidden], .ldetail[hidden] { display: none; }
.ltable { width: 100%; border-collapse: collapse; font-size: 13px; }
.ltable th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); background: transparent; }
.ltable td { padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.lrow { cursor: pointer; }
.lrow:hover, .lrow.open { background: var(--brand-soft, #eef2ff); }
.lrow:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.lph { white-space: nowrap; width: 1%; }
.lph img, .lph-empty { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; background: #f1f5f9; border: 2px solid var(--card); position: relative; vertical-align: middle; display: inline-block; }
.lph img + img { margin-left: -22px; }
.nowrap { white-space: nowrap; }
.lprod { min-width: 200px; max-width: 340px; }
.lbuyer { min-width: 140px; }
.ldetail > td { background: var(--bg); padding: 10px; }
.ldetail .sale { margin: 0; }
@media (max-width: 760px) {
  .ltable tr:first-child { display: none; }
  .ltable, .ltable tbody { display: block; }
  .lrow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
  .lrow td { border: 0; padding: 0; }
  .lrow .lph { grid-row: 1 / span 3; }
  .lrow td:nth-child(2) { grid-column: 3; grid-row: 1; font-size: 12px; color: var(--muted); text-align: right; }
  .lrow td:nth-child(3) { grid-column: 2; grid-row: 1; }
  .lrow td:nth-child(4) { grid-column: 2; grid-row: 2; }
  .lrow td:nth-child(5) { display: none; }
  .lrow td:nth-child(6) { grid-column: 2; grid-row: 3; max-width: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
  .lrow td:nth-child(7) { grid-column: 3; grid-row: 2; text-align: right; }
  .lrow td:nth-child(8) { grid-column: 3; grid-row: 3; text-align: right; }
  .ldetail { display: block; } .ldetail > td { display: block; }
}
.ltable .tag, .ltable .lstore { white-space: nowrap; }
.ltable { table-layout: auto; }
.lsale { white-space: nowrap; }
.lsale small { font-weight: 600; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lprod { min-width: 180px; max-width: 300px; }
@media (max-width: 760px) { .lrow td:nth-child(6) .clamp2 { -webkit-line-clamp: 1; } }
.ltable-wrap { max-width: 100%; }
/* Portal: Mi stock */
.st-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.st-kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 2px; color: inherit; text-decoration: none; box-shadow: var(--shadow); }
.st-kpi b { font-size: 24px; font-variant-numeric: tabular-nums; }
.st-kpi span { font-size: 12px; color: var(--muted); }
.st-kpi.good b { color: #15803d; } .st-kpi.blue b { color: var(--brand); } .st-kpi.warn b { color: #b45309; } .st-kpi.bad b { color: #dc2626; }
a.st-kpi:hover { border-color: var(--brand); }
.st-filters { flex-wrap: wrap; }
.st-chips { display: flex; gap: 6px; flex-wrap: wrap; flex-basis: 100%; }
.st-chip { font-size: 13px; font-weight: 700; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); color: var(--muted); text-decoration: none; }
.st-chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.st-table { overflow-x: auto; }
.st-disp b { font-size: 20px; }
.st-agotado .st-disp b { color: #dc2626; } .st-bajo .st-disp b { color: #b45309; }
.st-pill { font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.st-pill.ok { background: #dcfce7; color: #166534; } .st-pill.bajo { background: #fef3c7; color: #92400e; } .st-pill.agotado { background: #fee2e2; color: #b91c1c; } .st-pill.nuevo { background: #ede9fe; color: #5b21b6; }
.st-act { white-space: nowrap; text-align: right; }
.st-act .btn.sm { padding: 5px 10px; font-size: 13px; margin-right: 8px; }
.link-sm { font-size: 13px; font-weight: 700; }
@media (max-width: 760px) {
  .st-table table tr:first-child { display: none; }
  .st-table table, .st-table tbody { display: block; }
  .st-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; column-gap: 10px; row-gap: 2px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
  .st-row td { border: 0; padding: 0; }
  .st-ph { grid-row: 1 / span 3; } .st-name { grid-column: 2; }
  .st-disp { grid-column: 3; grid-row: 1 / span 2; text-align: right; }
  .st-res, .st-cam { display: none; }
  .st-sold { grid-column: 2; font-size: 12px; } .st-sold::before { content: "Vendidas 30 días: "; color: var(--muted); }
  .st-est { grid-column: 3; grid-row: 3; text-align: right; }
  .st-act { grid-column: 2 / span 2; text-align: left; margin-top: 4px; }
}
/* Mi stock: lista que se abre con el detalle */
.acc-list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.acc-item + .acc-item { border-top: 1px solid var(--line); }
.acc-head { all: unset; box-sizing: border-box; width: 100%; cursor: pointer; display: grid; grid-template-columns: 48px minmax(0, 1fr) auto auto 18px; gap: 14px; align-items: center; padding: 10px 14px; }
.acc-head:hover, .acc-item.open .acc-head { background: var(--brand-soft, #eef2ff); }
.acc-head:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.acc-ph img, .acc-ph .thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 10px; display: grid; place-items: center; background: #f1f5f9; font-size: 10px; }
.acc-name { display: grid; min-width: 0; } .acc-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-num { display: grid; text-align: right; line-height: 1.1; } .acc-num b { font-size: 22px; font-variant-numeric: tabular-nums; } .acc-num small { font-size: 11px; }
.st-agotado .acc-num b, .st-agotado .acc-disp { color: #dc2626; } .st-bajo .acc-num b, .st-bajo .acc-disp { color: #b45309; }
.acc-chev { color: var(--muted); transition: transform .15s; } .acc-item.open .acc-chev { transform: rotate(90deg); }
.acc-body { background: var(--bg); padding: 14px 14px 16px 76px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; border-top: 1px solid var(--line); }
.acc-body[hidden] { display: none; }
.acc-box { display: grid; gap: 6px; align-content: start; font-size: 13px; }
.acc-k { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 48px; }
.spark i { flex: 1; background: var(--brand); border-radius: 2px 2px 0 0; min-width: 2px; }
.spark i.zero { background: var(--line); }
.acc-grid { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; } .acc-grid b { text-align: right; font-variant-numeric: tabular-nums; }
.acc-mv { font-size: 13px; }
.acc-actions { display: flex; align-items: flex-end; justify-content: flex-end; }
.acc-empty { padding: 16px; margin: 0; }
@media (max-width: 600px) {
  .acc-head { grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; }
  .acc-head .st-pill { grid-column: 2; justify-self: start; } .acc-chev { display: none; }
  .acc-num { grid-row: 1 / span 2; grid-column: 3; }
  .acc-body { padding-left: 14px; }
  .acc-actions { justify-content: stretch; } .acc-actions .btn { flex: 1; text-align: center; }
}
@media (max-width: 600px) { .acc-ph { grid-row: 1 / span 2; } }
.tipo-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.tipo-chips .st-chip b { margin-left: 4px; font-variant-numeric: tabular-nums; }

/* Botones en fila (encabezados de pagina) */
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
/* Carga de productos desde Excel */
.imp-steps { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-bottom: 18px; }
.imp-steps .card h3 { margin: 0 0 6px; font-size: 15px; }
.imp-steps .num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 99px; background: #0f172a; color: #fff; font-size: 13px; font-weight: 700; margin-right: 6px; }
.imp-sum { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0 14px; }
.imp-sum span { padding: 8px 14px; border-radius: 12px; background: #f1f5f9; font-weight: 600; }
.imp-sum b { font-size: 20px; margin-right: 4px; }
.imp-sum .ok { background: #dcfce7; color: #166534; } .imp-sum .upd { background: #dbeafe; color: #1e40af; } .imp-sum .err { background: #fee2e2; color: #b91c1c; }
.imp-table td small.bad { display: block; }
.imp-table tr.st-error { background: #fff5f5; }
.imp-table tr.st-igual td { color: #94a3b8; }
.imp-scroll { overflow-x: auto; }
.imp-confirm { position: sticky; bottom: 0; background: #fff; padding: 12px 0; border-top: 1px solid #e2e8f0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Inicio del portal: envios de la semana con desglose */
.home-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.5fr); }
.home-kpis .kpi { align-content: center; }
.week-kpi { display: flex; flex-direction: column; justify-content: center; align-items: stretch; gap: 8px; }
.week-kpi .wk-top { display: flex; align-items: center; gap: 12px; }
.week-kpi .wk-top small { color: #c7d2fe; }
.wk-list { display: flex; flex-direction: column; gap: 3px; border-top: 1px solid rgba(255,255,255,.2); padding-top: 6px; }
.wk-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: #e0e7ff; }
.wk-row b { color: #fff; }
.wk-cost { font-size: 12px; color: #c7d2fe; }
.wk-cost b { color: #fff; }
.bars7 { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 120px; align-items: end; }
.bar7 { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.bar7 i { width: 70%; max-width: 28px; background: #c7d2fe; border-radius: 6px 6px 2px 2px; }
.bar7.today i { background: var(--brand); }
.bar7 b { font-size: 12px; }
.bar7 small { font-size: 11px; color: var(--muted); text-transform: capitalize; }
.top-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.top-row:last-child { border-bottom: none; }
.top-row img, .top-row .ph-empty { background: #f1f5f9; display: inline-block; width: 32px; height: 32px; border-radius: 6px; object-fit: cover; flex: none; }
.top-n { width: 18px; color: var(--muted); font-weight: 700; }
.top-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1100px) { .home-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .home-kpis .week-kpi { grid-column: 1 / -1; } }
@media (max-width: 640px) { .home-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; } .home-kpis .kpi:not(.week-kpi) { grid-template-columns: 1fr; padding: 12px; } .home-kpis .kpi:not(.week-kpi) .kpi-ic { display: none; } }
/* Aviso de ingreso: escanear con lector o camara y lista de productos del aviso */
.scan-btn { background: var(--brand); color: #fff; border: 0; border-radius: 10px; padding: 10px 14px; font-weight: 700; white-space: nowrap; }
.scan-btn:hover { background: #2449c7; }
.scan-msg { margin: -4px 0 12px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.usb-ok { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--ok); background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 999px; padding: 4px 10px; }
.usb-ok i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; }
.scan-list { background: var(--card); border: 2px solid var(--brand); border-radius: var(--radius); box-shadow: var(--shadow); margin: 0 0 16px; overflow: hidden; }
.scan-list h3 { margin: 0; padding: 12px 16px; font-size: 15px; display: flex; justify-content: space-between; align-items: center; gap: 8px; background: var(--brand-soft); }
.scan-list h3 small { font-weight: 600; color: var(--muted); }
.sl-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) 132px 30px; gap: 12px; align-items: center; padding: 8px 16px; border-top: 1px solid var(--line); }
.sl-row img, .sl-noph { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: #f1f5f9; }
.sl-noph { display: grid; place-items: center; font-size: 10px; color: var(--muted); text-align: center; }
.sl-row b { font-size: 14px; display: block; }
.sl-row small { color: var(--muted); font-size: 12px; }
.sl-row.new { background: #ecfdf5; }
.tagnew { display: inline-block; background: var(--ok); color: #fff; font-size: 11px; font-weight: 800; border-radius: 6px; padding: 1px 6px; margin-left: 4px; }
.sl-row.bad { background: #fef2f2; grid-template-columns: 48px minmax(0, 1fr) auto; }
.sl-row.bad b { color: var(--bad); }
.sl-row.bad .ic { width: 48px; height: 48px; border-radius: 8px; background: #fee2e2; color: var(--bad); display: grid; place-items: center; font-size: 22px; font-weight: 800; }
.sl-row.bad .row { display: flex; gap: 8px; align-items: center; }
.sl-row .x { border: 0; background: none; color: var(--muted); font-size: 18px; padding: 0; box-shadow: none; justify-content: center; }
.sl-qty { display: grid; grid-template-columns: 34px 1fr 34px; gap: 4px; }
.sl-qty button { height: 34px; padding: 0; font-size: 18px; font-weight: 700; justify-content: center; }
.sl-qty input { text-align: center; font-weight: 800; font-size: 16px; padding: 4px; min-width: 0; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); top: 18px; background: #065f46; color: #fff; padding: 10px 18px; border-radius: 12px; font-weight: 700; font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); z-index: 50; max-width: calc(100vw - 32px); text-align: center; }
.toast.bad { background: #991b1b; }
.toast[hidden], .cam[hidden], .scan-list[hidden], .scan-btn[hidden] { display: none; }
.cam { background: #0b1220; border-radius: var(--radius); padding: 10px; margin: 0 0 14px; color: #fff; max-width: 520px; }
.cam #cam-reader { border-radius: 10px; overflow: hidden; background: #1e293b; min-height: 160px; }
.cam-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; }
.cam-foot button { background: #fff; color: #0f172a; border: 0; border-radius: 8px; padding: 8px 12px; font-weight: 700; }
.cat-toggle { display: none; margin: 0 0 12px; font-weight: 600; }
.cat-title { margin: 8px 0 10px; font-size: 16px; }
.cat-title small { font-weight: 500; }
@media (max-width: 600px) {
  .scan-btn { width: 100%; justify-content: center; padding: 14px; font-size: 16px; }
  .sl-row { grid-template-columns: 44px minmax(0, 1fr) 24px; padding: 10px 12px; row-gap: 6px; }
  .sl-row img, .sl-noph { width: 44px; height: 44px; }
  .sl-row .sl-qty { grid-column: 2; grid-row: 2; width: 140px; }
  .sl-row .x { grid-column: 3; grid-row: 1; }
  .sl-row.bad { grid-template-columns: 44px minmax(0, 1fr); }
  .sl-row.bad .ic { width: 44px; height: 44px; }
  .sl-row.bad .row { grid-column: 2; }
  .scan-list h3 { flex-direction: column; align-items: flex-start; gap: 2px; }
  .toast { top: auto; bottom: 90px; font-size: 13px; }
  .cat-toggle { display: inline-flex; }
  .cat-title { display: none; }
  .cat-grid.m-hide { display: none; }
}
/* Respaldos */
.table-wrap { overflow-x: auto; }
.panel[hidden] { display: none; }
.primary.danger-bg { background: #dc2626; border-color: #dc2626; box-shadow: none; }
.primary.danger-bg:hover { background: #b91c1c; }
.bk-act { text-align: right; white-space: nowrap; }
.bk-confirm input { max-width: 260px; margin-top: 6px; }
.bk-file { max-width: 100%; }
/* Ventas canceladas por devolver al anaquel */
.cancel-alerts { background: #fff7ed; border: 2px solid #f97316; border-radius: var(--radius); padding: 16px; margin-bottom: 18px; }
.cancel-alerts h2 { margin: 0 0 10px; color: #9a3412; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.cancel-card { background: #fff; border: 1px solid #fed7aa; border-radius: 10px; padding: 12px 14px; margin-top: 10px; }
.cancel-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cancel-card p { margin: 8px 0 4px; }
.cancel-items { margin: 0 0 10px; padding-left: 20px; }
.cancel-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
/* Sin stock antes de imprimir */
.tag.nostock { background: #dc2626; color: #fff; font-weight: 800; letter-spacing: .03em; }
.sale.short { outline: 2px solid #dc2626; outline-offset: -1px; }
.short-line { color: #b91c1c; font-weight: 700; }
/* Portal: aviso de mercaderia recibida */
.inb-received { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; border-radius: var(--radius); padding: 12px 16px; margin-bottom: 14px; }
.inb-received.diff { background: #fffbeb; border-color: #fcd34d; color: #92400e; }
.inb-received .ir-ic { width: 30px; height: 30px; border-radius: 50%; background: #059669; color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; }
.inb-received.diff .ir-ic { background: #d97706; }
.inb-received .ir-text { flex: 1 1 260px; }
.inb-received .ir-act { display: flex; gap: 12px; align-items: center; }
.be-in { width: 110px; text-align: right; }
.nowrap { white-space: nowrap; }

/* Clientes del mes */
.month-nav form { margin: 0; }
.clients td { vertical-align: middle; }
.clients .num { text-align: right; white-space: nowrap; }
.clients .share-h { width: 26%; }
.sbar { height: 9px; background: #eef2f7; border-radius: 9px; overflow: hidden; margin-bottom: 2px; }
.sbar i { display: block; height: 100%; border-radius: 9px; }
.bad-txt { color: var(--bad) !important; font-weight: 600; }
@media (max-width: 760px) {
  .clients .share-h, .clients .share, .clients .hide-m { display: none; }
  .clients th, .clients td { padding: 10px 8px; white-space: normal; }
  .clients .who .avatar { display: none; } .clients .who b { font-size: 14px; }
  .clients td:first-child { max-width: 120px; } .clients th { font-size: 11px; }
  .clients .num { white-space: nowrap; }
}

/* Estado de cuenta */
.acc-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.acc-head h1 { margin: 0; }
.acc-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; align-items: start; margin-bottom: 18px; }
.acc-form-wrap { padding: 0; }
.acc-form-wrap summary { cursor: pointer; padding: 14px 16px; list-style: none; }
.acc-form-wrap summary::-webkit-details-marker { display: none; }
.acc-form-wrap.pay summary { color: var(--brand); }
.acc-form-wrap[open] { grid-column: 1 / -1; }
.acc-form-wrap .acc-form { padding: 0 16px 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.acc-form-wrap .acc-docs, .acc-form-wrap .acc-form > p, .acc-form-wrap .acc-form > label.chk { grid-column: 1 / -1; }
.acc td { vertical-align: top; }
.acc .num { text-align: right; white-space: nowrap; }
.acc tr.pay td { background: #f0fdf4; }
.acc tr.open td { color: var(--muted); }
.ok-txt { color: var(--ok); }
.inv-form input { width: 84px; padding: 5px 7px; font-size: 13px; }
form.inline { display: inline; margin-left: 6px; }
.acc-form { display: grid; gap: 10px; margin-bottom: 14px; }
.acc-form h3 { margin: 0; }
.acc-form label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.acc-form label.chk, .acc-docs label.chk { display: flex; flex-direction: row; gap: 8px; align-items: flex-start; color: var(--text); font-size: 14px; }
.chk input[type=checkbox] { width: auto; flex: none; margin-top: 3px; padding: 0; }
.acc-docs { display: grid; gap: 6px; max-height: 220px; overflow-y: auto; padding: 8px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }
.print-only { display: none; }
@media (max-width: 760px) {
  .acc .hide-m { display: none; }
  .acc th, .acc td { padding: 9px 6px; }
}
@media print {
  .side, .noprint, .flash { display: none !important; }
  body.app { display: block; } main { padding: 0 !important; }
  .print-only { display: inline; }
}

/* Carga inicial */
.il-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.il-scan { display: grid; gap: 14px; }
.il-step { display: flex; gap: 12px; align-items: flex-start; }
.il-n { width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; }
.il-loc { font-size: 20px; font-weight: 800; padding: 6px 14px; border-radius: 10px; background: #f1f5f9; color: var(--muted); }
.il-loc.on { background: var(--brand-soft); color: var(--brand); }
.il-input { display: flex; gap: 8px; margin-top: 6px; }
.il-input input { flex: 1; min-width: 0; font-size: 17px; padding: 12px 14px; }
.il-step-in { width: 70px; padding: 4px 8px; }
.il-msg { margin: 0; padding: 10px 12px; border-radius: 10px; background: #f8fafc; font-weight: 600; }
.il-msg.ok { background: #ecfdf5; color: #065f46; } .il-msg.bad { background: #fef2f2; color: #991b1b; } .il-msg.warn { background: var(--yellow); color: #7c4a03; }
.il-qty { width: 90px; text-align: right; font-weight: 700; }
.il-table td { vertical-align: middle; }
.il-locs { display: grid; gap: 6px; margin-top: 8px; max-height: 340px; overflow-y: auto; }
.il-locbtn { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 8px 12px; }
.il-locbtn span { font-size: 12px; color: var(--muted); }
.il-locbtn.on { border-color: var(--brand); background: var(--brand-soft); }
.il-grid > div, .il-step > div, .il-scan > * { min-width: 0; }
@media (max-width: 900px) { .il-grid { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .il-step { gap: 8px; } .il-n { display: none; } .il-input .btn { padding: 8px 10px; } .il-qty { width: 70px; } }

/* Etiquetas: listado con seleccion */
.ltable .lpick { width: 34px; padding-right: 0; }
.ltable .lpick input { width: 20px; height: 20px; cursor: pointer; }
.lrow.short td { background: #fef2f2; }
.ltable-hint[hidden] { display: none; }
/* Codigos de barra del producto */
.lbl-bar { gap: 12px; align-items: center; flex-wrap: wrap; margin: 4px 0 10px; }
.codes-card { margin-top: 12px; }
.codes-card .code-main svg { max-width: 100%; height: auto; background: #fff; }
.codes-card .alt-code { justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; background: #f1f5f9; border-radius: 8px; margin-bottom: 6px; }
.codes-card details summary { cursor: pointer; }
.codes-card label.row { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.codes-card label.row input { width: auto; }
/* Pantalla Imprimir: tienda y metodo arriba, casilla por venta y "Marcar todas" */
.pr-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 320px)); gap: 12px; margin: 14px 0; }
.pr-filters label { gap: 0; }
.pr-filters select { width: 100%; font-size: 15px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.pf-label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 6px; }
.pr-sub { margin: 0 0 8px; }
.pr-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pr-bar select { font-size: 15px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); }
.pr-bar #pr-sheet { margin-left: auto; }
@media (max-width: 600px) { .pr-bar > * { flex: 1 1 100%; text-align: center; } .pr-bar #pr-sheet { margin-left: 0; } }
.pr-main h3 + p:empty { display: none; }
.pr-kind { margin: 12px 0 8px; font-weight: 600; }
.pr-btns { align-items: center; }
.pr-main h3:not(:first-child) { margin-top: 18px; }
.pr-all { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--card); border: 2px solid var(--brand); border-radius: var(--radius); padding: 12px 16px; margin: 16px 0 10px; }
.pr-all input, .pr-pick { width: 20px; height: 20px; accent-color: var(--brand); }
.sale .pr-pick { flex: none; align-self: flex-start; margin: 4px 2px 0 0; }
.sale:has(.pr-pick:not(:checked)) { opacity: .55; }
@media (max-width: 600px) {
  .pr-btns .btn { flex: 1 1 100%; text-align: center; }
}
.pr-bar [hidden] { display: none; }
/* Recepcion: rechazar unidades o el aviso completo */
.btn.danger { color: var(--bad); border-color: #fecaca; }
.btn.danger:hover { background: #fef2f2; }
button.danger-btn { background: var(--bad); color: #fff; border-color: var(--bad); font-weight: 700; }
button.danger-btn:hover { background: #b91c1c; }
.rec-st-cell .rej-toggle { display: block; margin-top: 6px; font-size: 12px; }
.rec-st-cell .rej-toggle[hidden] { display: none; }
tr.rec-row.rej { box-shadow: inset 4px 0 0 var(--bad); }
tr.rej-row td { background: #fef2f2; border-top: none; }
tr.rej-row[hidden] { display: none; }
.rej-box { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.rej-box > b { flex-basis: 100%; color: #991b1b; }
.rej-box label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: #7f1d1d; }
.rej-box label.grow { flex: 1 1 220px; }
.rej-box .rej-in { width: 90px; }
.rej-box > small { flex-basis: 100%; }
.rej-all { margin-top: 14px; background: #fef2f2; border: 2px solid #fecaca; border-radius: var(--radius); padding: 14px 16px; }
.rej-all[hidden] { display: none; }
.rej-all h3 { margin: 0 0 4px; color: #991b1b; }
.inb-received.rej { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.inb-received.rej .ir-ic { background: #dc2626; }
.rej-note { color: var(--bad); }
/* Movimiento de stock: stock actual del producto y ajuste por ubicacion */
.product-line .grow { flex: 1 1 auto; min-width: 0; }
.mv-stock { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.mv-chip { background: #eef2f7; border-radius: 99px; padding: 3px 10px; font-size: 13px; }
.mv-chip b { font-size: 15px; margin-left: 3px; }
.mv-chip.total { background: #0f172a; color: #fff; }
.mv-help { margin: 4px 0 10px; }
.adj-table td { vertical-align: middle; }
.adj-table input.adj-qty { width: 120px; font-size: 18px; font-weight: 700; }
.adj-table .adj-moved { display: block; color: #b45309; font-weight: 600; margin-top: 4px; }
.adj-table .adj-moved[hidden] { display: none; }
.adj-table tr.adj-new td { background: #f8fafc; }
.adj-table select { max-width: 100%; }
@media (max-width: 700px) {
  .adj-table { display: table; table-layout: fixed; width: 100%; min-width: 0; }
  .adj-table th:nth-child(1), .adj-table td:nth-child(1) { width: 46%; }
  .adj-table th:nth-child(2), .adj-table td:nth-child(2) { width: 14%; padding-left: 2px; padding-right: 2px; }
  .adj-table select { width: 100%; font-size: 14px; padding-left: 6px; padding-right: 2px; }
  .adj-table input.adj-qty { width: 100%; }
  .adj-table th { font-size: 11px; }
}

/* Conteo de inventario por anaquel */
.cc-map .slot { cursor: pointer; min-width: 0; width: 150px; text-decoration: none; }
.cc-map .slot span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-map .slot.st-ok { border: 1px solid #86efac; background: #f0fdf4; color: #166534; }
.cc-map .slot.st-dif { border: 1px solid #fca5a5; background: #fef2f2; color: #991b1b; }
.cc-map .slot.st-now { border: 2px solid var(--brand); background: var(--brand-soft); color: var(--brand); }
.legend i.ok { background: #bbf7d0; } .legend i.dif { background: #fecaca; } .legend i.now { background: var(--brand-soft); border: 2px solid var(--brand); } .legend i.pend { border: 1px dashed #94a3b8; background: #fafbfc; }
.cc-row-ok td { background: #f0fdf4; } .cc-row-bad td { background: #fef2f2; } .cc-row-warn td { background: #fffbeb; } .cc-row-pend td { color: var(--muted); }
.cc-dif { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; } .cc-dif.ok { color: #15803d; } .cc-dif.bad { color: #dc2626; } .cc-dif.warn { color: #b45309; }
.cc-progress { height: 10px; background: #e2e8f0; border-radius: 99px; overflow: hidden; margin: 8px 0 4px; } .cc-progress i { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.cc-choice { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 10px 0 14px; }
.cc-choice label { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 2px; cursor: pointer; background: #fff; }
.cc-choice label:has(input:checked) { border: 2px solid var(--brand); background: var(--brand-soft); }
.cc-choice input { position: absolute; opacity: 0; pointer-events: none; }
.cc-choice b { font-size: 15px; } .cc-choice span { font-size: 12px; color: var(--muted); }
.cc-thumb { width: 38px; height: 38px; border-radius: 8px; background: #e2e8f0; object-fit: cover; flex: none; }
.cc-prod { display: flex; gap: 10px; align-items: center; }
.cc-note { font-size: 12px; margin-top: 3px; color: #b45309; }
.cc-full { width: 100%; justify-content: center; display: flex; }
.cc-sum { position: sticky; top: 14px; }
@media (max-width: 900px) { .cc-choice { grid-template-columns: 1fr 1fr; } .cc-sum { position: static; } }
@media (max-width: 700px) {
  .cc-table thead { display: none; }
  .cc-table, .cc-table tbody { display: block; }
  .cc-table tr { display: grid; grid-template-columns: auto auto 1fr; gap: 6px 12px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .cc-table td { border: none; padding: 0; background: transparent !important; }
  .cc-table tr.cc-row-ok { background: #f0fdf4; } .cc-table tr.cc-row-bad { background: #fef2f2; } .cc-table tr.cc-row-warn { background: #fffbeb; }
  .cc-table td:first-child { grid-column: 1 / -1; }
  .cc-table td.cc-sys::before { content: 'Sistema '; color: var(--muted); font-size: 12px; }
  .cc-table td.cc-sys { text-align: left; }
  .cc-table td.cc-d { text-align: right; }
  .cc-table .il-qty { width: 80px; }
}
.cc-choice .avatar { color: #fff; }
