:root {
  --bg: #f6f4f1;
  --panel: #ffffff;
  --line: #e4e0da;
  --line-strong: #cfc9c0;
  --text: #24211d;
  --muted: #6f6a62;
  --faint: #9a948a;
  --accent: #b3405f;
  --accent-ink: #ffffff;
  --accent-soft: #f8e7ec;
  --ok: #2f7a3e;
  --ok-soft: #e6f3e8;
  --warn: #8a5a00;
  --warn-soft: #fbf0d9;
  --bad: #b3261e;
  --bad-soft: #fbe6e4;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1a18; --panel: #252321; --line: #3a3733; --line-strong: #4d4944;
    --text: #f1eee9; --muted: #b3ada4; --faint: #857f76;
    --accent: #e0708e; --accent-ink: #1b1a18; --accent-soft: #3d2730;
    --ok: #7fcf8e; --ok-soft: #22352a; --warn: #f0c46a; --warn-soft: #3a3020; --bad: #f2948c; --bad-soft: #3d2422;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel);
}
textarea { height: auto; padding: 8px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
button {
  height: 40px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
}
button:hover { border-color: var(--faint); }
button:active { transform: scale(0.98); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.ghost { border-color: transparent; background: transparent; }
button.icon { width: 32px; height: 32px; padding: 0; }
button[disabled] { opacity: 0.55; cursor: progress; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ----- Estructura ----- */
.topbar { display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 16px; }
.brand span { color: var(--accent); }
.demo-badge { background: var(--warn-soft); color: var(--warn); font-size: 12px; padding: 2px 8px; border-radius: 6px; }
.stats { display: flex; gap: 18px; margin-left: auto; font-size: 13px; color: var(--muted); }
.stats b { color: var(--text); font-size: 15px; }
.seller { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }

main { max-width: 1280px; margin: 0 auto; padding: 16px 20px 40px; display: flex; flex-direction: column; gap: 12px; }

.scanbar { display: flex; gap: 8px; position: relative; }
.scanbar .field { position: relative; flex: 1; }
.scanbar .field input { height: 48px; font-size: 17px; padding-left: 44px; }
.scanbar .field svg { position: absolute; left: 14px; top: 14px; color: var(--muted); }
.scanbar button { height: 48px; }
.scan-status { min-height: 20px; font-size: 14px; color: var(--muted); }
.scan-status.ok { color: var(--ok); }
.scan-status.warn { color: var(--warn); }
.scan-status.bad { color: var(--bad); }

.results {
  position: absolute; top: 52px; left: 0; right: 0; z-index: 20; background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: var(--radius); max-height: 360px; overflow: auto; box-shadow: 0 8px 24px rgb(0 0 0 / 0.12);
}
.result { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--line); }
.result:last-child { border-bottom: 0; }
.result:hover, .result.active { background: var(--accent-soft); }
.result .name { flex: 1; min-width: 0; }
.thumb { width: 40px; height: 40px; border-radius: 8px; background: var(--bg); object-fit: cover; flex: none; }

.held { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip {
  height: 34px; padding: 0 12px; border-radius: 999px; font-size: 13px; border: 1px solid var(--line-strong); background: var(--panel);
}
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 860px) { .workspace { grid-template-columns: 1fr; } .stats { margin-left: 0; width: 100%; } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }

/* ----- Carrito ----- */
.cart-head, .line { display: grid; grid-template-columns: 44px minmax(0, 1fr) 128px 96px 32px; gap: 10px; align-items: center; }
.cart-head { font-size: 12px; color: var(--muted); padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.line { padding: 8px 0; border-bottom: 1px solid var(--line); }
.line.flash { animation: flash 0.9s ease-out; }
@keyframes flash { from { background: var(--ok-soft); } to { background: transparent; } }
.line .meta { font-size: 12px; color: var(--muted); }
.line .meta .low { color: var(--warn); }
.qty { display: flex; align-items: center; gap: 4px; justify-content: center; }
.qty input { width: 52px; height: 32px; text-align: center; padding: 0 4px; }
.right { text-align: right; }
.empty { text-align: center; padding: 48px 0; color: var(--faint); }
@media (max-width: 560px) {
  .cart-head { display: none; }
  main { padding: 12px 12px 32px; }
  .topbar { padding: 10px 12px; }
  .line { grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "img name del" "img qty total"; row-gap: 6px; }
  .line .thumb { grid-area: img; align-self: start; }
  .line .del { justify-self: end; }
  .line .info { grid-area: name; }
  .line .qty { grid-area: qty; justify-content: flex-start; }
  .line .total { grid-area: total; }
  .line .del { grid-area: del; }
}

/* ----- Panel de cobro ----- */
.side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 12px; }
.side label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 4px; }
.customer-box { position: relative; }
.customer-picked { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex: none; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check input { width: 18px; height: 18px; }
.totals { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.totals div { display: flex; justify-content: space-between; }
.totals .grand { font-size: 22px; font-weight: 700; }
.actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 8px; }
.actions.three { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); }
.actions button { min-height: 48px; height: auto; padding: 6px 10px; white-space: normal; line-height: 1.2; }
.notice { border-radius: var(--radius); padding: 10px 12px; font-size: 14px; }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice a { color: inherit; }

.segmented { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.segmented button { border: 0; border-radius: 0; height: 38px; font-size: 14px; }
.segmented button + button { border-left: 1px solid var(--line-strong); }
.segmented button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.customer-form { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.customer-form label { font-size: 12px; margin-bottom: 2px; }
.customer-form input, .customer-form select { height: 36px; }
.customer-picked .grow { flex: 1; min-width: 0; }
.customer-picked .warn { color: var(--warn); }
.payments { display: flex; flex-direction: column; gap: 8px; }
.payments-head { display: flex; justify-content: space-between; align-items: center; }
.payments-head label { margin: 0; }
.pay-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 32px; gap: 6px; align-items: center; }
.pay-row input[readonly] { background: var(--bg); color: var(--muted); }
.change { height: 40px; display: flex; align-items: center; font-size: 18px; font-weight: 700; color: var(--ok); }
.change.short { color: var(--bad); }
details summary { cursor: pointer; }

.disc { color: var(--ok); }
.line s { color: var(--faint); }
button.link { height: auto; padding: 0; border: 0; background: none; color: var(--accent); font-size: 12px; text-decoration: underline; }
.disc-row { display: grid; grid-template-columns: 160px 90px minmax(0, 1fr) auto auto; gap: 6px; padding: 8px 0 10px 54px; border-bottom: 1px solid var(--line); }
.disc-row input, .disc-row select, .disc-row button { height: 34px; font-size: 13px; }
@media (max-width: 700px) { .disc-row { grid-template-columns: 1fr 1fr; padding-left: 0; } }
.nav-link { color: var(--accent); font-weight: 600; text-decoration: none; margin-right: 6px; }
#module-links { display: inline-flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.nav-link.current { text-decoration: underline; text-underline-offset: 4px; }
.cart-tools { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.cart-tools button { height: 30px; }
.loc { display: inline-block; font-weight: 700; color: var(--text); background: var(--warn-soft); border-radius: 6px; padding: 0 6px; font-size: 12px; letter-spacing: 0.02em; }
.loc.none { font-weight: 400; color: var(--faint); background: transparent; padding: 0; }
.quote-card { width: min(520px, 100%); max-height: 90vh; overflow: auto; }
.quote-card label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 4px; }
.rate { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rate .grow { flex: 1; min-width: 0; }
.rate b { font-size: 17px; }

/* ----- Cámara ----- */
.overlay { position: fixed; inset: 0; background: rgb(0 0 0 / 0.6); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.camera-card { background: var(--panel); border-radius: 14px; padding: 14px; width: min(480px, 100%); display: flex; flex-direction: column; gap: 10px; }
#camera-view { width: 100%; border-radius: 10px; overflow: hidden; background: #000; min-height: 240px; }

.confirm-card { width: min(460px, 100%); gap: 12px; }
.confirm-title { font-size: 18px; }
.confirm-warning { background: var(--warn-soft); color: var(--warn); border-radius: var(--radius); padding: 10px 12px; font-size: 14px; }
.confirm-summary { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.confirm-summary div { display: flex; justify-content: space-between; gap: 12px; }
.confirm-summary .grand { font-size: 20px; font-weight: 700; border-top: 1px solid var(--line); padding-top: 6px; margin-top: 4px; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.confirm-actions button { min-height: 46px; }

/* ----- Cotización para el cliente (pensada para captura de pantalla: siempre en claro) ----- */
.client-quote-btn { width: 100%; border-style: dashed; color: var(--accent); font-weight: 600; }
.cq-wrap { width: min(620px, 100%); max-height: 96vh; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.cq-tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: #fff; font-size: 14px; }
.cq-card { background: #ffffff; color: #24211d; border-radius: 18px; padding: 26px 28px; font-size: 16px; line-height: 1.4; }
.cq-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; border-bottom: 2px solid #f3d9e1; padding-bottom: 14px; margin-bottom: 14px; }
.cq-brand { font-size: 26px; font-weight: 800; letter-spacing: -0.01em; }
.cq-brand span { color: #b3405f; }
.cq-sub { font-size: 13px; color: #6f6a62; }
.cq-title { text-align: right; }
.cq-title b { display: block; font-size: 18px; color: #b3405f; }
.cq-to { font-size: 15px; margin-bottom: 12px; }
.cq-item { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid #eee8e1; }
.cq-item img, .cq-item .cq-ph { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; background: #f6f4f1; }
.cq-item .cq-name { font-size: 15px; }
.cq-item .cq-qty { font-size: 13px; color: #6f6a62; }
.cq-price { text-align: right; font-weight: 700; white-space: nowrap; }
.cq-price small { display: block; font-weight: 400; font-size: 12px; color: #6f6a62; }
.cq-lines { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.cq-lines div { display: flex; justify-content: space-between; gap: 12px; }
.cq-lines small { color: #6f6a62; font-size: 12px; }
.cq-lines b { text-align: right; }
.cq-lines b small { display: block; font-weight: 400; }
.cq-tools button { color: var(--text); }
.cq-min { margin-top: 12px; border-radius: 10px; padding: 10px 12px; font-size: 14px; background: #fbf0d9; color: #8a5a00; }
.cq-min.ok { background: #e6f3e8; color: #2f7a3e; }
.cq-total { margin-top: 12px; background: #b3405f; color: #fff; border-radius: 14px; padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; }
.cq-total span { font-size: 18px; font-weight: 600; }
.cq-total b { font-size: 30px; font-weight: 800; }
.cq-total small { display: block; text-align: right; font-size: 13px; font-weight: 400; opacity: 0.9; }
.cq-notes { margin-top: 14px; font-size: 13px; color: #6f6a62; display: flex; flex-direction: column; gap: 3px; }

/* ----- Login ----- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login form { width: min(360px, 100%); display: flex; flex-direction: column; gap: 12px; }
.login h1 { margin: 0 0 4px; font-size: 22px; }
#shipping-title.stale { color: var(--bad); font-weight: 600; }
.totals .vemin { border-radius: var(--radius); padding: 6px 10px; font-size: 13px; background: var(--warn-soft); color: var(--warn); }
.totals .vemin.ok { background: var(--ok-soft); color: var(--ok); }
.totals .usd { display: flex; justify-content: space-between; color: var(--accent); }
.fee-line { background: var(--accent-soft); border-radius: 8px; padding-left: 6px; padding-right: 6px; }
.fee-thumb { display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--accent); }

/* ---------- Menú lateral del ERP ---------- */
:root { --sidebar: 232px; --sidebar-mini: 68px; }
body.has-sidebar { padding-left: var(--sidebar); transition: padding-left .15s; }
body.has-sidebar.sidebar-mini { padding-left: var(--sidebar-mini); }
/* El menú lateral reemplaza los enlaces, el nombre y el Salir de la barra superior. */
body.has-sidebar #module-links, body.has-sidebar #seller-name, body.has-sidebar .topbar #logout { display: none; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 40; display: flex; flex-direction: column;
  background: var(--panel); border-right: 1px solid var(--line); padding: 12px 10px; transition: width .15s, transform .2s; }
.sidebar-mini .sidebar { width: var(--sidebar-mini); }
.sb-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 6px 14px; }
.sb-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-size: 17px; white-space: nowrap; }
.sb-brand b { color: var(--accent); }
.sb-logo { flex: 0 0 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; }
.sb-collapse { border: 0; background: transparent; color: var(--muted); padding: 4px; height: auto; cursor: pointer; border-radius: 6px; }
.sb-collapse:hover { background: var(--bg); }
.sidebar-mini .sb-collapse svg { transform: rotate(180deg); }
.sb-links { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.sb-link { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px; color: var(--muted); text-decoration: none;
  font-weight: 600; font-size: 14px; white-space: nowrap; border: 0; background: transparent; width: 100%; height: auto; cursor: pointer; text-align: left; }
.sb-link svg { flex: 0 0 20px; }
.sb-link:hover { background: var(--bg); color: var(--text); }
.sb-link.current { background: var(--accent-soft); color: var(--accent); }
.sb-foot { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 6px 10px; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; }
.sb-avatar { flex: 0 0 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; }
.sidebar-mini .sb-text, .sidebar-mini .sb-collapse { display: none; }
.sidebar-mini .sb-head { justify-content: center; }
.sidebar-mini .sb-link, .sidebar-mini .sb-user { justify-content: center; padding-left: 0; padding-right: 0; }
.sidebar-mini .sb-brand:hover + .sb-collapse, .sidebar-mini .sb-head:hover .sb-collapse { display: inline-flex; }
.sb-toggle { display: none; border: 0; background: transparent; padding: 4px; height: auto; color: var(--text); cursor: pointer; }
.sb-backdrop { display: none; }
@media (max-width: 900px) {
  body.has-sidebar, body.has-sidebar.sidebar-mini { padding-left: 0; }
  .sidebar, .sidebar-mini .sidebar { width: 260px; transform: translateX(-100%); box-shadow: 0 0 30px rgba(0,0,0,.15); }
  .sidebar-open .sidebar { transform: none; }
  .sidebar-mini .sb-text { display: inline; }
  .sidebar-mini .sb-link, .sidebar-mini .sb-user { justify-content: flex-start; padding-left: 12px; }
  .sb-collapse { display: none; }
  .sb-toggle { display: inline-flex; }
  .sidebar-open .sb-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 35; }
}
.sb-logout { justify-content: flex-start; }
.sidebar-mini .sb-logout { justify-content: center; }

/* Cotización guardada y puntuación del cliente */
.cq-save { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: #fff; font-size: 13px; }
.cq-save button { color: var(--text); }
.cq-save button.primary { color: #fff; }
.cq-who { display: flex; gap: 6px; flex-wrap: wrap; }
.cq-who input { height: 36px; width: 170px; }
.cq-msg a { color: #fff; text-decoration: underline; }
.cbadge { display: inline-block; font-size: 11px; line-height: 1.6; padding: 0 7px; border-radius: 999px; background: var(--bg); color: var(--muted); white-space: nowrap; vertical-align: middle; margin-left: 2px; }
.cbadge.vip { background: #fbf0d9; color: #8a5a00; font-weight: 700; }
.cbadge.red { background: var(--bad-soft, #fde8e6); color: var(--bad, #b3261e); font-weight: 700; }

/* Facturación distinta del cliente */
.billing-box { display: flex; flex-direction: column; gap: 6px; }

/* Resumen del cliente: lo que falta y confirmar datos */
.cust-warn { color: var(--bad, #b3261e); font-weight: 600; }
.cust-confirm { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.cust-confirm button { height: 30px; padding: 0 10px; border-color: var(--line-strong); }
.customer-form input.missing, .customer-form select.missing { border-color: var(--bad, #b3261e); box-shadow: 0 0 0 2px var(--bad-soft, #fde8e6); }
.cf-address-block { display: flex; flex-direction: column; gap: 8px; }
.cf-add-address { align-self: flex-start; color: var(--accent); }

/* Barra del POS: colas de trabajo */
.stats .stat-link { color: var(--muted); text-decoration: none; border-radius: 999px; padding: 0 8px; }
.stats a.stat-link[href]:hover { background: var(--bg); }
.stats .stat-link.stat-warn b { color: var(--warn); }
.stats .stat-link.stat-alert { background: var(--bad-soft, #fde8e6); color: var(--bad, #b3261e); font-weight: 600; }
.stats .stat-link.stat-alert b { color: var(--bad, #b3261e); }

/* Aviso de la mañana: muchos pedidos por preparar */
.prep-alert { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 0 0 12px; padding: 12px 16px; border-radius: 12px;
  background: var(--bad-soft, #fde8e6); color: var(--bad, #b3261e); border: 1px solid var(--bad, #b3261e); font-size: 15px; }
.prep-alert span { color: var(--text); }
.prep-alert button { margin-left: auto; border-color: var(--bad, #b3261e); color: var(--bad, #b3261e); background: var(--panel); }

.prep-alert.late-alert { background: var(--warn-soft, #fbf0d9); color: var(--warn, #8a5a00); border-color: var(--warn, #8a5a00); }
.prep-alert.late-alert button { border-color: var(--warn, #8a5a00); color: var(--warn, #8a5a00); }

/* Domicilios Cartago (POS) */
.stats .stat-btn { height: auto; border: 0; background: none; font: inherit; font-size: 13px; color: var(--muted); padding: 0 8px; cursor: pointer; }
.dl-card { background: var(--panel); color: var(--text); border-radius: 14px; width: min(720px, 100%); max-height: 88vh; overflow: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.dl-head { display: flex; justify-content: space-between; align-items: center; font-size: 18px; }
.dl-card h3 { margin: 10px 0 2px; font-size: 14px; }
.dl-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--line); }
.dl-row .grow { flex: 1; min-width: 200px; }
.dl-row.late { background: var(--bad-soft, #fde8e6); border-radius: 8px; padding: 8px; }
.dl-cod { display: inline-block; margin-top: 2px; font-size: 12px; font-weight: 700; padding: 0 7px; border-radius: 999px; background: var(--ok-soft, #e6f3e8); color: var(--ok, #2f7a3e); }
.dl-fee { display: flex; flex-direction: column; gap: 2px; color: var(--muted); }
.dl-fee input { height: 32px; width: 110px; }
.dl-call { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.dl-call a.button { height: 38px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius); display: inline-flex; align-items: center; text-decoration: none; color: var(--text); background: var(--panel); }
.dl-call a.button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.dl-call a[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.l-sent { color: var(--ok, #2f7a3e); font-weight: 600; }

.dl-lines { margin-top: 6px; display: flex; flex-direction: column; }
.dl-item { display: grid; grid-template-columns: 44px 36px minmax(0, 1fr); gap: 8px; align-items: center; padding: 5px 0; border-top: 1px solid var(--line); font-size: 13px; }
.dl-item img, .dl-ph { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--bg); display: block; }
.dl-item small { display: block; color: var(--muted); font-size: 12px; }
.dl-qty { text-align: right; font-size: 15px; }

/* Empaque en la tienda con la pistola */
.dl-pack { flex-basis: 100%; display: flex; flex-direction: column; gap: 6px; margin-top: 6px; padding: 10px; border: 1px dashed var(--line-strong); border-radius: 10px; }
.dl-scan { display: flex; gap: 6px; }
.dl-scan input { flex: 1; height: 40px; }
.dl-item.ok { background: var(--ok-soft, #e6f3e8); border-radius: 6px; }
.dl-pack-actions { display: flex; justify-content: space-between; gap: 8px; }
.bf { display: flex; flex-direction: column; gap: 4px; color: var(--bad, #b3261e); }
.bf .small { color: var(--text); }
.bf-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.bf-btns button { border-color: var(--line-strong); color: var(--text); }

/* Cierres de caja pendientes (quien recibe cierres) */
.closings-alert ul { flex-basis: 100%; margin: 0; padding-left: 20px; color: var(--text); }
.closings-alert .prep-alert-go { margin-left: auto; font-weight: 600; color: var(--warn, #8a5a00); }
.closings-alert .prep-alert-go + button { margin-left: 0; }

/* Permisos y vacaciones */
.absence-alert { background: var(--bg); color: var(--text); border-color: var(--line-strong); }
.absence-alert.mine { background: var(--accent-soft, #f6e3e8); border-color: var(--accent); color: var(--text); flex-direction: column; align-items: stretch; }
.absence-alert ul { flex-basis: 100%; margin: 0; padding-left: 20px; }
.absence-alert button { border-color: var(--line-strong); color: var(--text); }
.abs-item { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.abs-item + .abs-item { border-top: 1px solid var(--line); padding-top: 8px; }
.abs-tasks { flex-basis: 100%; white-space: pre-line; background: var(--panel); border-radius: 8px; padding: 8px 10px; font-size: 14px; }
.sb-borrowed { color: var(--muted); font-weight: 400; }

/* Avisos generales */
.notice-alert { background: var(--panel); color: var(--text); border: 2px solid var(--accent); flex-direction: column; align-items: stretch; }
.notice-alert button { border-color: var(--accent); color: var(--accent); }
.notice-alert .important b { color: var(--bad); }
.notice-when { font-weight: 600; color: var(--accent); }

/* Ventana emergente de solicitudes para aprobar */
.erp-popup { position: fixed; inset: 0; z-index: 1000; background: rgba(20, 16, 14, 0.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.erp-popup-card { background: var(--panel); color: var(--text); border-radius: 16px; padding: 18px 20px; width: min(520px, 100%); max-height: 85vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); display: flex; flex-direction: column; gap: 12px; border-top: 5px solid var(--accent); }
.erp-popup-card h2 { margin: 0; font-size: 19px; }
.erp-popup-item { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); }
.erp-popup-item span { font-size: 14px; }
.erp-popup-item a.primary { align-self: flex-start; margin-top: 4px; display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 10px; background: var(--accent); color: var(--accent-ink, #fff); text-decoration: none; font-weight: 600; }
.erp-popup-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
/* Cambiar mi PIN (encima de cualquier otro aviso) */
.erp-pin { position: fixed; inset: 0; z-index: 1100; background: rgba(20, 16, 14, 0.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.pin-card { width: min(420px, 100%); }
.pin-card label { display: flex; flex-direction: column; gap: 4px; }
.pin-card p { margin: 0; }
.sb-user[role=button] { cursor: pointer; border-radius: 10px; }
.sb-user[role=button]:hover { background: var(--accent-soft); }

/* Venta de Mercado Libre en el POS */
.ml-box { display: flex; flex-direction: column; gap: 8px; background: #fff8d6; border-radius: 12px; padding: 10px 12px; }
.ml-price { display: flex; align-items: center; gap: 6px; font-size: 13px; margin-top: 4px; }
.ml-price input { width: 120px; height: 32px; }

/* Venta cruzada en el POS (curso con la máquina) */
.cross-sell { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.cross-item { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: #eef6ff; border: 1px solid #c9defa; border-radius: 12px; padding: 8px 12px; font-size: 14px; }
.cross-item span { flex: 1; min-width: 200px; }

/* Pieza de un combo (Kit Cinch) en Pedidos y Logística */
.kit-tag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 999px; background: #fdf0f6; color: #8a2457; white-space: nowrap; }
/* Pausas activas (panel del administrador en Avisos) */
#p-admin input[type=checkbox] { width: auto; height: auto; }
#p-days label { display: inline-flex; align-items: center; gap: 4px; margin: 0 10px 4px 0; }
#p-admin ul { padding-left: 18px; margin: 6px 0; }

/* Avisos con tarea: ya hecha */
.task-done { color: var(--ok, #2f7a3e); }

/* Tareas de otras personas (administrador): un cuadro por responsable */
.task-boxes { display: flex; flex-direction: column; gap: 8px; }
.task-box { flex-direction: column; align-items: flex-start; border-left: 5px solid var(--accent); }
.task-box ul { margin: 4px 0; padding-left: 18px; font-size: 14px; }
.task-box.all-done { border-left-color: var(--ok, #2f7a3e); }

/* Uso del ERP por usuario (Usuarios) */
.u-usage { border-top: 1px solid var(--line); padding: 8px 0; display: flex; flex-direction: column; gap: 4px; }
.u-chip { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft, #f6e7ee); margin: 2px 4px 2px 0; }
.u-chip.obs { background: #fff4d6; color: #8a5a00; }

/* Venta sugerida: combo que conviene al cliente */
.combo-item { background: #fff7e6; border-color: #f3d9a4; }

/* Cuadro de Venezuela (mismas cuentas del carrito de la tienda) */
.ve-box { margin-top: 12px; border: 1px solid #ead7dc; border-radius: 12px; padding: 12px 14px; background: #fdf6f7; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: #3a3a3a; }
.ve-title { font-weight: 700; }
.ve-row { display: flex; justify-content: space-between; gap: 12px; }
.ve-row > span:last-child { text-align: right; }
.ve-row small { display: block; color: #7a7a7a; font-size: 12px; }
.ve-now { border-top: 2px solid rgba(0, 0, 0, .2); padding-top: 8px; font-size: 16px; }
.ve-now b { font-size: 20px; color: #b3405f; }
.ve-sub { margin-top: 8px; padding-top: 8px; border-top: 1px dashed rgba(0, 0, 0, .25); font-weight: 700; }
.ve-arrival { border-top: 1px solid rgba(0, 0, 0, .15); padding-top: 6px; font-weight: 700; }
.ve-note { font-size: 12px; color: #6b6b6b; }
.ve-warn { background: #fff3cd; border: 1px solid #e0c97f; border-radius: 8px; padding: 8px 10px; font-size: 13px; }
/* Datos de la cotización para entidad: el formulario va sobre fondo oscuro, los campos con letra oscura */
.cq-save input { color: var(--text); background: #fff; }
/* Cliente mayorista en el Punto de venta */
.ws-tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: #e7f0fb; color: #1d4f8a; vertical-align: middle; }
