.modalWide {
  max-width: 920px;
  overflow-x: hidden;
}

.body {
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  overflow-x: hidden;
}

.section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.sectionTitle {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.sectionHint {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
  margin-top: -4px;
}

.empty {
  font-size: 13px;
  color: var(--text-muted);
  padding: 12px 0;
}

.itemList {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
}

.itemRow {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) 120px auto;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.55);
  min-width: 0;
}

.itemThumb {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.itemThumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

.itemThumbPlaceholder {
  width: 100%;
  height: 100%;
  background: rgba(148, 163, 184, 0.1);
}

.itemInfo {
  min-width: 0;
}

.itemTitle {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.25;
}

.itemFa {
  font-size: 12px;
  color: var(--text-secondary);
  direction: rtl;
  text-align: left;
  unicode-bidi: plaintext;
  line-height: 1.25;
}

.itemVariant {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
  line-height: 1.25;
}

.itemPriceCol {
  text-align: right;
  padding-right: 4px;
}

.itemPrice {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.itemActions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.qtyControls {
  display: flex;
  align-items: center;
  gap: 2px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  padding: 1px;
  background: rgba(255, 255, 255, 0.7);
}

.qtyBtn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--text-secondary);
  transition: background 0.2s, color 0.2s;
}

.qtyBtn:hover:not(:disabled) {
  background: rgba(var(--primary-rgb) / 0.1);
  color: var(--primary);
}

.qtyBtn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.qtyValue {
  min-width: 22px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.itemsTotal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
}

.itemsTotalLabel {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.itemsTotalPrice {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.searchWrap {
  position: relative;
}

.searchIcon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.searchInput {
  width: 100%;
  height: var(--field-height);
  padding: var(--field-padding-y) 12px var(--field-padding-y) 36px;
  font-size: var(--field-font-size);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.75);
  color: var(--text-primary);
}

.searchInput:focus {
  outline: none;
  border-color: rgba(var(--primary-rgb) / 0.5);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb) / 0.12);
}

.selectedCustomer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(var(--primary-rgb) / 0.35);
  background: rgba(var(--primary-rgb) / 0.08);
  font-size: 13px;
  color: var(--text-primary);
}

.selectedCustomer span {
  flex: 1;
  min-width: 0;
}

.clearCustomerBtn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-muted);
  flex-shrink: 0;
}

.clearCustomerBtn:hover {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-primary);
}

.customerList {
  list-style: none;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.85);
  max-height: 180px;
  overflow-y: auto;
  overflow-x: hidden;
}

.customerEmpty {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-muted);
}

.customerOption {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  text-align: left;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  transition: background 0.15s;
}

.customerOption:last-child {
  border-bottom: none;
}

.customerOption:hover {
  background: rgba(var(--primary-rgb) / 0.08);
}

.error {
  font-size: 13px;
  color: #ef4444;
}

.success {
  font-size: 13px;
  color: #16a34a;
}

.cartActions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 16px;
  margin-top: 8px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.secondaryBtn {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  background: rgba(var(--primary-dark-rgb) / 0.06);
  border: 1px solid rgba(var(--primary-dark-rgb) / 0.18);
  border-radius: var(--radius-sm);
  transition: background 0.2s, transform 0.15s;
}

.secondaryBtn:hover:not(:disabled) {
  background: rgba(var(--primary-dark-rgb) / 0.12);
  transform: translateY(-1px);
}

.secondaryBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.backBtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: color 0.2s;
}

.backBtn:hover {
  color: var(--primary);
}

.paymentSummary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(255, 255, 255, 0.55);
  font-size: 13px;
  color: var(--text-secondary);
}

.paymentSummary strong {
  color: var(--text-primary);
  font-weight: 700;
}

.paymentSummaryBalanced {
  color: #16a34a;
}

.paymentSummaryUnbalanced {
  color: #b45309;
}

.paymentDuplicator {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  overflow-x: hidden;
}

.paymentRowGroup {
  min-width: 0;
}

.paymentGridHeader,
.paymentGridRow {
  display: grid;
  grid-template-columns: minmax(128px, 0.85fr) minmax(0, 2fr) minmax(112px, 0.8fr) 32px;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.paymentGridHeader span:nth-child(2) {
  grid-column: 2;
}

.paymentDetailsCell {
  min-width: 0;
  min-height: var(--field-height);
}

.removeCell {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.transferFieldsInline {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.paymentAmountCell {
  min-width: 0;
}

.paymentGridHeader {
  padding-bottom: 6px;
}

.paymentGridHeader span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.paymentGridRow {
  padding: 8px 0;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.paymentGridRow select:focus,
.paymentGridRow input:focus,
.transferFieldsInline input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-dark-rgb) / 0.12);
}

.paymentGridRow select,
.paymentGridRow input,
.transferFieldsInline input {
  width: 100%;
  padding: var(--field-padding-y) var(--field-padding-x);
  font-size: var(--field-font-size);
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
  min-height: var(--field-height);
  min-width: 0;
}

.paymentGridRow select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: var(--select-padding-end);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--select-arrow-offset) center;
  background-size: var(--select-arrow-size);
  cursor: pointer;
}

.addPaymentBtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  margin-top: 10px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.addPaymentBtn:hover:not(:disabled) {
  background: rgba(var(--primary-rgb) / 0.1);
}

.addPaymentBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .paymentGridHeader {
    display: none;
  }

  .paymentGridRow {
    grid-template-columns: minmax(0, 1fr) 32px;
    grid-template-areas:
      'method remove'
      'details details'
      'amount amount';
    gap: 8px;
    padding: 10px 0;
  }

  .paymentGridRow select {
    grid-area: method;
  }

  .paymentDetailsCell {
    grid-area: details;
  }

  .paymentAmountCell {
    grid-area: amount;
  }

  .paymentGridRow .removeCell {
    grid-area: remove;
    justify-self: end;
  }
}

@media (max-width: 640px) {
  .transferFieldsInline {
    grid-template-columns: 1fr;
  }

  .itemRow {
    grid-template-columns: 52px minmax(0, 1fr);
    grid-template-areas:
      'thumb info'
      'price actions';
    gap: 8px;
    padding: 6px 8px;
  }

  .itemThumb {
    width: 52px;
    height: 52px;
    grid-area: thumb;
  }

  .itemInfo {
    grid-area: info;
  }

  .itemPriceCol {
    grid-area: price;
    text-align: left;
    padding-right: 0;
  }

  .itemActions {
    grid-area: actions;
    justify-self: end;
  }
}
