/* R19.0.28: one scrollable middle and a non-shrinking payment footer.
   The client card can grow without pushing any sale action outside the panel.
   Keep IDs/actions in the original shared POS; no duplicate checkout handlers. */
.retail .pos-layout { --nc28-cart-reserve: 156px; }
.retail .sale-cart {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 16px;
  min-height: 0;
  height: calc(100vh - var(--nc28-cart-reserve));
  height: calc(100dvh - var(--nc28-cart-reserve));
  max-height: none;
  min-width: 0;
  overflow: hidden;
}
.retail .sale-cart > header {
  flex: 0 0 auto;
  padding: 14px 18px;
  gap: 12px;
}
.retail .sale-cart > header > div { min-width: 0; }
.retail .sale-cart h2 { font-size: 22px; line-height: 1.3; }
.retail .sale-cart .cart-count { flex-shrink: 0; }
.retail .nc28-cart-scroll {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  scroll-padding-block: 10px;
  overflow-anchor: none;
}
.retail .nc28-cart-scroll:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}
.retail .nc28-cart-scroll .customer-input { margin: 13px 16px; }
.retail .nc28-cart-scroll .customer-input input { min-width: 0; width: 100%; }
.retail .nc28-cart-scroll .nc27-buyer-picker { margin: 0 14px 12px; padding: 12px; }
.retail .nc28-cart-scroll .nc27-buyer-results {
  /* In-flow results remain reachable inside the scroll region, including touch. */
  position: static;
  width: 100%;
  margin-top: 8px;
  max-height: 220px;
  box-shadow: none;
}
.retail .nc28-cart-scroll .cart-items {
  flex: none;
  min-height: 0;
  max-height: none;
  overflow: visible;
  padding: 2px 16px 12px;
}
.retail .nc28-cart-scroll .cart-items .empty-state { padding: 20px 12px; }
.retail .cart-line { min-width: 0; }
.retail .cart-line > div:first-child { min-width: 0; }
.retail .cart-line .line-total { overflow-wrap: anywhere; }
.retail .sale-cart .cart-footer {
  flex: 0 0 auto;
  min-width: 0;
  padding: 12px 16px 13px;
  background: #fff;
}
.retail .sale-cart .cart-footer > div { margin-bottom: 7px; }
.retail .sale-cart .cart-footer > div > b { min-width: 0; overflow-wrap: anywhere; text-align: right; }
.retail .sale-cart .discount-line { margin: 0; gap: 12px; }
.retail .sale-cart .discount-line input { min-height: 34px; }
.retail .sale-cart .cart-total {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 10px;
  margin: 10px 0;
  line-height: 1.25;
}
.retail .sale-cart .cart-total b { font-size: clamp(23px, 1.9vw, 29px); }
.retail .sale-cart #checkoutButton {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  margin: 0;
  min-height: 46px;
  font-size: 14px;
}
.retail .sale-cart .cart-secondary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 10px 0 0;
}
.retail .sale-cart .cart-secondary button {
  min-height: 34px;
  min-width: 0;
  padding: 7px 6px;
  border: 1px solid #dce5f0;
  border-radius: 8px;
  color: #34516f;
  background: #f7f9fd;
  font-size: 11px;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
}
.retail .sale-cart .cart-secondary button:hover:not(:disabled) { background: #edf3fc; border-color: #b8cde5; }
.retail .sale-cart .cart-secondary button[data-action="clear-cart"] { color: #944b47; }
.retail .sale-cart .payment-note { margin: 9px 0 0; font-size: 9px; line-height: 1.4; text-align: center; }
/* No clipping even when text scaling / a short window cannot fit the fixed footer. */
.retail .pos-layout.nc28-pos-flow .sale-cart { position: relative; top: 0; height: auto; min-height: 0; max-height: none; }
.retail .pos-layout.nc28-pos-flow .nc28-cart-scroll { flex: 0 1 auto; max-height: 420px; }
.retail dialog#modal #modalBody .form-actions {
  bottom: -1px;
  padding: 10px 0;
  gap: 10px;
  background: #fff;
}
.retail dialog#modal .split-payment > span { min-width: 0; }
@media (min-width: 981px) and (max-height: 760px) {
  .retail .sale-cart > header { padding: 10px 16px; }
  .retail .sale-cart h2 { font-size: 20px; }
  .retail .sale-cart .cart-footer { padding: 10px 14px; }
  .retail .sale-cart .cart-total { margin: 7px 0; padding-top: 7px; }
  .retail .sale-cart .payment-note { margin-top: 6px; }
}
@media (max-height: 520px) {
  .retail .sale-cart { position: relative; top: 0; height: auto; min-height: 0; max-height: none; }
  .retail .nc28-cart-scroll { flex: 0 1 auto; max-height: 320px; }
}
@media (max-width: 980px) {
  .retail .pos-layout { grid-template-columns: minmax(0, 1fr); }
  .retail .sale-cart { position: relative; top: 0; height: auto; min-height: 0; max-height: none; }
  .retail .nc28-cart-scroll { flex: 0 1 auto; max-height: 420px; }
  .retail .sale-cart .cart-secondary button { min-height: 42px; }
  .retail .sale-cart .cart-total b { font-size: 27px; }
  .retail[data-page="pos"] #content { padding-bottom: 96px; }
  .retail .mobile-cart-button {
    display: block;
    position: fixed;
    right: 16px;
    bottom: max(14px, env(safe-area-inset-bottom));
    max-width: calc(100% - 32px);
    min-height: 46px;
    z-index: 25;
    padding: 12px 18px;
    border-radius: 14px;
    border: 1px solid #ffffff33;
    background: var(--deep);
    color: #fff;
    font-size: 12px;
    box-shadow: 0 6px 20px #17385a29;
  }
  .retail .mobile-cart-button[hidden], .retail:not([data-page="pos"]) .mobile-cart-button { display: none !important; }
}
@media print {
  .retail .sale-cart { position: static; height: auto; max-height: none; overflow: visible; }
  .retail .nc28-cart-scroll { max-height: none; overflow: visible; }
  .retail .sale-cart .cart-secondary, .retail .mobile-cart-button { display: none !important; }
}
/* Optional digital delivery is explicit and expandable, never removed from POS. */
.retail .nc28-buyer-details { margin: 0 14px 10px; border: 1px solid #dce7f5; border-radius: 10px; background: #f5f8fd; }
.retail .nc28-buyer-details > summary { cursor: pointer; padding: 10px 11px; font-size: 11px; font-weight: 650; color: #365777; min-height: 38px; }
.retail .nc28-buyer-details > summary small { font-size: 10px; font-weight: 500; margin-left: 7px; color: #617b96; }
.retail .nc28-buyer-details[open] > summary { border-bottom: 1px solid #dce7f5; }
.retail .nc28-buyer-details .nc27-buyer-picker { border: 0; margin: 0; border-radius: 0 0 10px 10px; background: transparent; }
/* Checkout only: prevent generic form rules from centering/narrowing payment fields. */
.retail dialog#modal .nc28-checkout-form .payment-total { padding: 12px 16px; margin-bottom: 14px; font-size: 23px; }
.retail dialog#modal .nc28-payment-methods { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px 16px; margin-bottom: 14px; }
.retail dialog#modal .nc28-payment-methods .split-payment { display: flex; flex-direction: column; align-items: stretch; gap: 5px; margin: 0; min-width: 0; }
.retail dialog#modal .nc28-payment-methods .split-payment > span { color: #365777; font-size: 12px; font-weight: 650; }
.retail dialog#modal .nc28-payment-methods .r18-payment-input { display: flex; flex-wrap: wrap; align-items: center; width: 100%; gap: 5px; }
.retail dialog#modal .nc28-payment-methods input { flex: 1 1 90px; width: 100%; min-width: 0; }
.retail dialog#modal .nc28-payment-methods .r18-fill-btn { flex: 0 0 auto; min-height: 34px; padding: 7px 9px; font-size: 10px; }
.retail dialog#modal .nc28-checkout-form .change-field { display: grid; grid-template-columns: minmax(0,1fr) minmax(110px,180px); align-items: center; gap: 12px; padding-top: 12px; margin-bottom: 12px; }
.retail dialog#modal .nc28-checkout-form .change-field input:disabled { background: #f2f5fa; color: #6c8095; }
.retail dialog#modal .nc28-checkout-form .payment-remainder { padding: 10px 12px; }
.retail dialog#modal .nc28-checkout-form .r18-ticket-note { font-size: 11px; margin-top: 10px; }
.retail dialog#modal .nc28-checkout-form > .r18-receipt-choice { flex-direction: row; align-items: center; margin: 10px 0; gap: 9px; }
.retail dialog#modal .nc28-checkout-form .hint { font-size: 11px; margin: 10px 0; }
@media(max-width: 540px) {
 .retail dialog#modal .nc28-payment-methods { grid-template-columns: minmax(0,1fr); }
 .retail dialog#modal .nc28-payment-methods .split-payment { display: grid; grid-template-columns: 92px minmax(0,1fr); gap: 8px; align-items: start; }
 .retail dialog#modal .nc28-payment-methods .r18-payment-input { min-width: 0; }
 .retail dialog#modal .nc28-checkout-form .change-field { grid-template-columns: minmax(0,1fr); }
 .retail dialog#modal .nc28-checkout-form .payment-total { font-size: 20px; }
}
