/* میزبان عمومی Stage 7 برای استفاده همان مؤلفه در ویرایشگر، مچ و پیش‌بررسی. */
.wqp-stock-allocation-host {
  position: fixed;
  inset: 0;
  z-index: 100100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  direction: rtl;
  background: rgba(15, 23, 42, .55);
}
.wqp-stock-allocation-host.wqp-allocation-active { display: flex; }
.wqp-stock-allocation-host > .wqp-allocation-workspace {
  width: min(900px, 96vw);
  max-height: min(82vh, 720px);
  border: 1px solid #c3c4c7;
  border-radius: 9px;
  box-shadow: 0 18px 54px rgba(0,0,0,.28);
}
body.wqp-allocation-dialog-open { overflow: hidden; }
@media (max-width: 782px) {
  .wqp-stock-allocation-host { align-items: stretch; padding: 0; }
  .wqp-stock-allocation-host > .wqp-allocation-workspace { width: 100%; max-height: 100vh; border-radius: 0; }
}

/*
 * تخصیص انبار در پنجره انتخاب کالای WQP
 * همه قواعد عمداً به همان پنجره محدود شده‌اند تا روی وردپرس، ووکامرس و پوسته اثر نگذارند.
 */
:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-workspace[hidden] {
  display: none !important;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host).wqp-allocation-active .wqp-modal-body > :not(.wqp-allocation-workspace),
:is(#wqp-product-picker-modal, .wqp-stock-allocation-host).wqp-allocation-active #wqp-pp-mobile-actionbar {
  display: none !important;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-workspace {
  direction: rtl;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-height: min(64vh, 560px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 10px;
  color: #1d2327;
  background: #fff;
  font-size: 13px;
  line-height: 1.55;
  scrollbar-gutter: stable;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-workspace *,
:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-workspace *::before,
:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-workspace *::after {
  box-sizing: border-box;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-live {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 0 8px;
  border-bottom: 1px solid #dcdcde;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-head > div {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  min-width: 0;
  gap: 5px 10px;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-head strong {
  font-size: 14px;
  color: #1d2327;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-head span {
  color: #646970;
  font-size: 12px;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-close {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid #c3c4c7;
  border-radius: 6px;
  background: #fff;
  color: #3c434a;
  font: 22px/30px Arial, sans-serif;
  cursor: pointer;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-item-title {
  min-width: 0;
  margin: 8px 0;
  padding: 7px 9px;
  overflow: hidden;
  color: #1d2327;
  background: #f6f7f7;
  border: 1px solid #dcdcde;
  border-radius: 6px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-requested {
  display: grid;
  grid-template-columns: max-content minmax(92px, 132px) minmax(150px, 1fr);
  align-items: center;
  gap: 6px 9px;
  margin: 8px 0;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-requested label,
:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-input-wrap label {
  color: #3c434a;
  font-weight: 600;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-requested input,
:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-input-wrap input {
  width: 100%;
  min-width: 0;
  height: 34px;
  min-height: 34px;
  margin: 0;
  padding: 4px 8px;
  direction: ltr;
  text-align: center;
  border: 1px solid #8c8f94;
  border-radius: 5px;
  background: #fff;
  color: #1d2327;
  font: inherit;
  font-variant-numeric: tabular-nums;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-requested > span {
  min-width: 0;
  color: #646970;
  font-size: 11px;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-requested .wqp-allocation-requested-error {
  grid-column: 2 / -1;
  min-height: 0;
  color: #b32d2e;
  font-size: 10px;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-requested input[aria-invalid="true"],
:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-input-wrap input[aria-invalid="true"] {
  border-color: #b32d2e;
  box-shadow: 0 0 0 1px #b32d2e;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-warning,
:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-errors,
:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-state {
  display: grid;
  gap: 2px;
  margin: 8px 0;
  padding: 8px 10px;
  border: 1px solid #dba617;
  border-inline-start-width: 4px;
  border-radius: 6px;
  background: #fcf9e8;
  color: #3c434a;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-errors,
:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-state.is-error,
:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-workspace.is-error .wqp-allocation-state {
  border-color: #d63638;
  background: #fcf0f1;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-warning strong,
:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-errors strong,
:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-state strong {
  color: #1d2327;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-warning span,
:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-errors span,
:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-state p {
  margin: 0;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-state-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 132px;
  border-color: #c3c4c7;
  background: #f6f7f7;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid #c3c4c7;
  border-top-color: #2271b1;
  border-radius: 50%;
  animation: wqp-allocation-spin .75s linear infinite;
}

@keyframes wqp-allocation-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  :is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-spinner {
    animation: none;
  }
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-table {
  display: grid;
  gap: 4px;
  max-height: min(36vh, 310px);
  margin: 8px 0 5px;
  padding: 1px;
  overflow: auto;
  overscroll-behavior: contain;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-warehouse-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(92px, 112px) minmax(104px, 132px);
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 5px 7px;
  border: 1px solid #dcdcde;
  border-radius: 5px;
  background: #fff;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-warehouse-row:nth-child(even) {
  background: #f9f9f9;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-warehouse-row.is-zero {
  opacity: .72;
  background: #f6f7f7;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-warehouse-ident {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 6px;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-warehouse-code {
  flex: 0 0 auto;
  min-width: 30px;
  padding: 2px 5px;
  direction: ltr;
  text-align: center;
  color: #2c3338;
  background: #edf4fa;
  border: 1px solid #c5d9ed;
  border-radius: 4px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-warehouse-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-available {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  min-width: 0;
  gap: 5px;
  color: #646970;
  font-size: 11px;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-available strong {
  direction: ltr;
  color: #1d2327;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-input-wrap {
  display: grid;
  grid-template-columns: max-content minmax(62px, 1fr);
  align-items: center;
  gap: 5px;
  min-width: 0;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-input-wrap label {
  font-size: 11px;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-input-error {
  grid-column: 1 / -1;
  min-height: 0;
  color: #b32d2e;
  font-size: 10px;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-empty {
  padding: 12px;
  text-align: center;
  color: #646970;
  border: 1px dashed #c3c4c7;
  border-radius: 5px;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-disclosure {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 3px 7px;
  border: 0;
  background: transparent;
  color: #135e96;
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-totals {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 15px;
  margin-top: 6px;
  padding: 7px 9px;
  border: 1px solid #c3c4c7;
  border-radius: 5px;
  background: #f6f7f7;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-totals span {
  white-space: nowrap;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-totals strong {
  direction: ltr;
  display: inline-block;
  min-width: 38px;
  color: #1d2327;
  font-variant-numeric: tabular-nums;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-totals small {
  color: #646970;
  font-size: 10px;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-actions {
  position: sticky;
  bottom: -10px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 7px;
  margin: 10px -10px -10px;
  padding: 9px 10px;
  background: rgba(255, 255, 255, .97);
  border-top: 1px solid #dcdcde;
  box-shadow: 0 -3px 8px rgba(0, 0, 0, .04);
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-actions .wqp-btn {
  min-height: 34px;
  padding: 5px 11px;
  white-space: nowrap;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-review {
  display: grid;
  gap: 5px;
  margin: 8px 0;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-review-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid #dcdcde;
  border-inline-start-width: 4px;
  border-radius: 5px;
  background: #fff;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-review-row.is-auto_allocated,
:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-review-row.is-ready,
:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-review-row.is-not_applicable {
  border-inline-start-color: #00a32a;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-review-row.is-unmatched,
:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-review-row.is-incomplete,
:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-review-row.is-insufficient,
:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-review-row.is-api_error,
:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-review-row.is-stale,
:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-review-row.is-revision_conflict {
  border-inline-start-color: #dba617;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-review-row.is-invalid,
:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-review-row.is-sent_locked {
  border-inline-start-color: #d63638;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-review-main {
  display: grid;
  min-width: 0;
  gap: 1px;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-review-main strong,
:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-review-main span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-review-main span {
  color: #646970;
  font-size: 11px;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-row-ok,
:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-row-block {
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  white-space: nowrap;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-row-ok {
  color: #006b1b;
  background: #edfaef;
  border: 1px solid #9dd7aa;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-row-block {
  color: #8a5200;
  background: #fcf3d5;
  border: 1px solid #e3bd61;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-pp-allocation-summary {
  min-width: 0;
  color: #646970;
  font-size: 11px;
  white-space: nowrap;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-workspace button:focus-visible,
:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-workspace input:focus-visible,
:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-workspace [tabindex]:focus-visible {
  outline: 3px solid #72aee6;
  outline-offset: 1px;
  box-shadow: 0 0 0 1px #2271b1;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-workspace button[disabled],
:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-workspace input[disabled] {
  cursor: not-allowed;
  opacity: .62;
}

@media (max-width: 980px) {
  :is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-workspace {
    max-height: min(68vh, 590px);
    padding: 8px;
  }

  :is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-warehouse-row {
    grid-template-columns: minmax(135px, 1fr) minmax(82px, 100px) minmax(96px, 118px);
    gap: 5px;
    padding-inline: 5px;
  }

  :is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-actions {
    bottom: -8px;
    margin: 8px -8px -8px;
    padding: 8px;
  }
}

@media (max-width: 680px) {
  :is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-requested {
    grid-template-columns: minmax(0, 1fr) minmax(90px, 118px);
  }

  :is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-requested > span {
    grid-column: 1 / -1;
  }

  :is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-requested .wqp-allocation-requested-error {
    grid-column: 1 / -1;
  }

  :is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-warehouse-row {
    grid-template-columns: minmax(0, 1fr) minmax(92px, 112px);
  }

  :is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-available {
    grid-column: 1 / 2;
    justify-content: flex-start;
  }

  :is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-input-wrap {
    grid-column: 2 / 3;
    grid-row: 1 / 3;
    align-self: stretch;
  }

  :is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-review-row {
    grid-template-columns: minmax(0, 1fr);
  }

  :is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-row-ok,
  :is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-row-block {
    justify-self: start;
  }

  :is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-actions .wqp-btn {
    flex: 1 1 118px;
  }
}

@media (prefers-reduced-motion: reduce) {
  :is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-spinner {
    animation-duration: 1.5s;
  }
}

/* Stage 6 state, retry and accessibility refinements. */
:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-workspace {
  position: relative;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-loading-actions {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-loading-actions .wqp-btn {
  min-height: 34px;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-request-error {
  grid-column: 2 / -1;
  min-height: 1em;
  color: #b32d2e;
  font-size: 10px;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-total-error {
  flex: 1 1 100%;
  min-height: 1em;
  color: #b32d2e;
  font-size: 10px;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-review-note {
  margin: 7px 0 0;
  padding: 7px 9px;
  border: 1px solid #dba617;
  border-inline-start-width: 4px;
  border-radius: 5px;
  background: #fcf9e8;
  color: #5c4a00;
  font-size: 11px;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-review-side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-row-neutral {
  padding: 2px 6px;
  border: 1px solid #c3c4c7;
  border-radius: 999px;
  background: #f6f7f7;
  color: #50575e;
  font-size: 10px;
  white-space: nowrap;
}

:is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-edit {
  min-height: 30px;
  padding: 2px 7px;
  border: 1px solid #8c8f94;
  border-radius: 4px;
  background: #fff;
  color: #135e96;
  cursor: pointer;
  font: inherit;
  font-size: 10px;
}

@media (max-width: 680px) {
  :is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-request-error {
    grid-column: 1 / -1;
  }

  :is(#wqp-product-picker-modal, .wqp-stock-allocation-host) .wqp-allocation-review-side {
    justify-content: flex-start;
  }
}
