.stock-summary {
  margin-top: 6px;
}

.stock-summary .stock-code {
  display: block;
  margin-bottom: 6px;
  color: #65748b;
  font-weight: 700;
}

.stock-summary .stock-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.stock-summary .stock-measure {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid #d8e2f0;
  border-radius: 999px;
  background: #f5f8fc;
  color: #40516a;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

.sunat-line-options .line-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.line-type-badge {
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.line-type-normal { background: #edf3fb; color: #40516a; }
.line-type-free { background: #e7f8ee; color: #16704b; }
.free-help { flex-basis: 100%; color: #65748b; }

/* Carrito compacto: los datos funcionales no cambian; solo se reorganiza la presentación. */
.cart-global-help { margin-left: auto; color: #718198; font-size: 10px; font-weight: 600; }

@media (min-width: 901px) {
  .cart {
    max-height: calc(100vh - 292px);
    min-height: 0;
    overflow-y: auto;
    scrollbar-gutter: stable;
    padding: 10px 12px 12px;
  }

  .cart.empty { min-height: 300px; }
  .cart-header { display: none; }

  .cart-row {
    display: grid;
    grid-template-columns: 78px 82px 92px minmax(122px, 1fr) 94px;
    grid-template-areas:
      "product product product product product"
      "unit quantity price discount total";
    gap: 7px;
    margin: 7px 0 0;
    padding: 7px 10px !important;
    padding-right: 82px !important;
    border-radius: 10px;
  }

  .cart-row > :first-child { grid-area: product; min-width: 0; padding-right: 4px; }
  .cart-row > .unit-select { grid-area: unit; }
  .cart-row > .qty-input { grid-area: quantity; }
  .cart-row > .price-input { grid-area: price; }
  .cart-row > .discount-editor { grid-area: discount; }
  .cart-row > .total-input { grid-area: total; }

  .cart-row strong { font-size: 13px; line-height: 1.2; }
  .cart-row .unit-select,
  .cart-row .qty-input,
  .cart-row .price-input,
  .cart-row .discount-input,
  .cart-row .discount-type,
  .cart-row .total-input { height: 34px; font-size: 12px; }
  .cart-row .total-input { font-size: 13px; }

  .remove-product { top: 8px; right: 8px; min-width: 62px; height: 28px; padding: 0 7px; font-size: 10px; }
  .remove-product span[aria-hidden=true] { font-size: 15px; }

  .stock-summary { margin-top: 3px; }
  .stock-summary .stock-code { display: inline; margin: 0 6px 0 0; font-size: 10px; }
  .stock-summary .stock-badges { display: inline-flex; gap: 4px; vertical-align: middle; }
  .stock-summary .stock-measure { min-height: 21px; padding: 3px 6px; font-size: 9px; }

  .sunat-line-options { display: flex; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 4px 7px; margin-top: 4px; }
  .sunat-affectation { display: flex; align-items: center; gap: 4px; }
  .sunat-line-options select,
  .sunat-affectation .tax-affectation { width: 142px; height: 23px; font-size: 9px; }
  .sunat-help { font-size: 8px; }
  .line-actions { display: inline-flex; gap: 5px; }
  .free-label { font-size: 9px; }
  .line-type-badge,
  .free-badge { min-height: 19px; padding: 2px 5px; font-size: 8px; }
  .duplicate-free { height: 23px; padding: 0 7px; font-size: 9px; }
  .free-help { display: none; }
  .physical-dispatch { flex-basis: auto; display: inline-block; margin: 0 0 0 7px; padding: 3px 6px; border-left-width: 2px; font-size: 9px; line-height: 1.2; }
  .stock-alert { margin-top: 4px; padding: 4px 6px; font-size: 9px; }

  .checkout { position: sticky; top: 20px; align-self: start; max-height: calc(100vh - 40px); overflow-y: auto; }
}

@media (max-width: 900px) {
  .cart-global-help { width: 100%; margin: 3px 0 0; }
}
