/* ---------- Carrito de productos ---------- */
.cart { display: flex; flex-direction: column; }
.cart-search { position: relative; padding: 14px; border-bottom: 1px solid var(--line); }
.cart-search > svg { position: absolute; left: 28px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-3); pointer-events: none; z-index: 1; }
.cart-search .cart-q { width: 100%; height: 50px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); padding: 0 16px 0 44px; font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s, background .15s; }
.cart-search .cart-q:focus { background: var(--surface); border-color: var(--brand-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-2) 14%, transparent); }
.cart-items { display: flex; flex-direction: column; }
.cart-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 38px 20px; color: var(--ink-3); text-align: center; }
.cart-empty svg { width: 28px; height: 28px; opacity: .6; }

.ci { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto 112px 32px; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); transition: background .4s; }
.ci:last-child { border-bottom: 0; }
.ci.flash { background: var(--brand-softer); }
.ci .thumb { width: 52px; height: 52px; border-radius: 12px; }
.ci-main { min-width: 0; }
.ci-name { font-weight: 600; font-size: 14.5px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ci-sub { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.ci-price { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 8px; font-size: 12.5px; }
.money-in, .pct-in { display: inline-flex; align-items: center; height: 34px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 0 10px; gap: 4px; transition: border-color .15s, box-shadow .15s; }
.money-in:focus-within, .pct-in:focus-within { border-color: var(--brand-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 14%, transparent); }
.money-in span, .pct-in span { color: var(--ink-3); font-size: 13px; }
.money-in input { width: 84px; border: 0; outline: 0; background: transparent; font-size: 14px; font-weight: 560; font-variant-numeric: tabular-nums; }
.pct-in input { width: 38px; border: 0; outline: 0; background: transparent; font-size: 14px; text-align: right; }
.link-btn { border: 0; background: none; color: var(--accent); font-weight: 560; font-size: 12.5px; cursor: pointer; padding: 4px 2px; }
.ci-qty { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.ci-uom { font-size: 11.5px; color: var(--ink-3); }
.stepper { display: inline-flex; align-items: center; height: 40px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.stepper button { width: 38px; height: 100%; border: 0; background: transparent; color: var(--ink-2); display: grid; place-items: center; cursor: pointer; }
.stepper button:hover { background: var(--surface-3); color: var(--ink); }
.stepper button:active { background: var(--brand-soft); }
.stepper button svg { width: 16px; height: 16px; }
.stepper input { width: 64px; height: 100%; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; font-size: 15px; font-weight: 600; outline: 0; background: transparent; font-variant-numeric: tabular-nums; }
.stepper input::placeholder { font-size: 11.5px; font-weight: 500; color: var(--ink-4); }
.ci-total { text-align: right; font-weight: 650; font-size: 15px; font-variant-numeric: tabular-nums; }
.ci-total.pos { color: var(--ok); } .ci-total.neg { color: var(--bad); }
.ci-x { width: 32px; height: 32px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-4); display: grid; place-items: center; cursor: pointer; }
.ci-x:hover { background: var(--bad-soft); color: var(--bad); }
.ci-x svg { width: 16px; height: 16px; }

/* Sin flechas en campos numéricos */
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- Formulario de documento ---------- */
.doc-form { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.doc-form .side { position: sticky; top: 76px; display: grid; gap: 12px; }
.party-card { padding: 16px 18px; display: grid; gap: 8px; overflow: visible; }
.party-card .lbl { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.party-card .input { height: 48px; font-size: 15px; border-radius: 12px; }
.summary { padding: 18px 20px; display: grid; gap: 4px; }
.summary .row { display: flex; justify-content: space-between; color: var(--ink-2); font-variant-numeric: tabular-nums; padding: 3px 0; }
.summary .grand { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line); margin-top: 8px; padding-top: 12px; }
.summary .grand span:first-child { font-weight: 600; }
.summary .grand b { font-size: 28px; font-weight: 650; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.summary .count { font-size: 12.5px; color: var(--ink-3); }
.side .btn.big { height: 50px; font-size: 15px; border-radius: 14px; }
.mobile-bar { display: none; }

@media (max-width: 1100px) { .doc-form { grid-template-columns: 1fr; } .doc-form .side { position: static; } }
@media (max-width: 640px) {
  .ci { grid-template-columns: 48px minmax(0, 1fr) auto; grid-template-areas: "img main x" "qty qty total"; gap: 10px 12px; padding: 14px; }
  .ci .thumb { grid-area: img; width: 48px; height: 48px; }
  .ci-main { grid-area: main; } .ci-x { grid-area: x; align-self: start; }
  .ci-qty { grid-area: qty; flex-direction: row; justify-content: flex-start; gap: 8px; }
  .ci-total { grid-area: total; align-self: center; font-size: 16px; }
  .stepper { height: 44px; } .stepper button { width: 44px; } .stepper input { width: 70px; }
  .cart-search { padding: 12px; } .cart-search > svg { left: 26px; }
  .doc-form .side .btn.big.desk { display: none; }
  .mobile-bar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; gap: 12px; align-items: center; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(16px); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(0,0,0,.06); }
  .mobile-bar .mt { flex: 1; min-width: 0; line-height: 1.2; }
  .mobile-bar .mt span { font-size: 12px; color: var(--ink-3); display: block; }
  .mobile-bar .mt b { font-size: 20px; font-variant-numeric: tabular-nums; }
  .mobile-bar .btn { height: 48px; padding: 0 22px; border-radius: 14px; font-size: 15px; }
  .content.has-bar { padding-bottom: 100px; }
}

/* ---------- Ajuste rápido ---------- */
.quick-adjust { display: grid; gap: 16px; margin-top: 12px; }
.quick-adjust .big-step { display: flex; justify-content: center; }
.quick-adjust .stepper { height: 56px; border-radius: 16px; }
.quick-adjust .stepper button { width: 56px; } .quick-adjust .stepper input { width: 120px; font-size: 22px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { padding: 8px 14px; border: 1px solid var(--line); border-radius: 99px; cursor: pointer; font-size: 13px; font-weight: 560; color: var(--ink-2); }
.chips input { display: none; }
.chips label:has(input:checked) { border-color: var(--brand); background: var(--brand-softer); color: var(--ink); }
.diff-note { text-align: center; font-size: 14px; color: var(--ink-3); min-height: 20px; }
.diff-note b.pos { color: var(--ok); } .diff-note b.neg { color: var(--bad); }

/* Tipo de producto: tres opciones grandes */
.type-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.type-pick label { display: flex; flex-direction: column; gap: 2px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.type-pick label b { font-size: 13.5px; } .type-pick label span { font-size: 12px; color: var(--ink-3); }
.type-pick input { display: none; }
.type-pick label:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent); }
@media (max-width: 560px) { .type-pick { grid-template-columns: 1fr; } }
