/* Product editing keeps labels next to their inputs at every viewport. */
[data-editor="COMMERCE_CATALOG"] .editor-table { overflow: visible; }
[data-editor="COMMERCE_CATALOG"] .editor-table-head { display: none; }
[data-editor="COMMERCE_CATALOG"] .product-grid.editor-row {
  min-width: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start;
  gap: 18px; border: 1px solid var(--line, #e1e3e7); border-radius: 16px;
  background: var(--surface, #fff); padding: 20px; margin-block: 16px;
}
.advanced-product-field { display: grid; gap: 7px; min-width: 0; font-size: 13px; font-weight: 600; }
.advanced-product-field > span { color: var(--text-muted, #626978); line-height: 1.45; }
.advanced-product-field > input, .advanced-product-field > select, .advanced-product-field > textarea { width: 100%; min-width: 0; }
.product-grid .product-name-controls, .product-grid .product-kind-controls { min-width: 0; display: grid; gap: 12px; }
.product-grid .advanced-product-field[data-control="description"], .product-grid .product-media-control { grid-column: 1 / -1; }
.product-grid .product-media-control { min-width: 0; padding: 15px; border-radius: 12px; background: #f6f7f9; }
.product-grid .product-media-control input[type="file"] { max-width: 100%; }
.product-grid .advanced-product-field[data-control="cardForm"]:has(select:disabled),
.product-grid .advanced-product-field[data-control="gradingAgencyCode"]:has(input:disabled),
.product-grid .advanced-product-field[data-control="grade"]:has(input:disabled),
.product-grid .advanced-product-field[data-control="certificationNumber"]:has(input:disabled) { display: none; }
.product-grid .editor-check { justify-content: flex-start; gap: 8px; min-height: 44px; }
.product-grid .editor-remove { justify-self: end; min-height: 44px; }
.advanced-media-preview { display: flex; flex-wrap: wrap; gap: 8px; }
.advanced-media-preview:empty { display: none; }
.advanced-media-preview img { width: 76px; height: 76px; object-fit: contain; background: #fff; border: 1px solid #dedfe5; border-radius: 8px; }
.advanced-media-ids summary { font-size: 12px; cursor: pointer; color: #626978; }
.catalog-readiness-result { white-space: pre-line; overflow-wrap: anywhere; line-height: 1.7; padding: 16px; border-radius: 12px; border-left: 4px solid #1c8051; background: #eff8f3; }
.catalog-readiness-result[data-status="error"] { border-color: #c71032; background: #fff1f3; }
#catalog-activation-form select { min-width: 0; width: 100%; }
.staff-role-grid > .panel { min-width: 0; }
.staff-role-grid .staff-table-wrap { max-width: 100%; }
.order-certificate-evidence, .order-certificate-review, .order-certificate-review-item { min-width: 0; overflow-wrap: anywhere; }
.order-certificate-evidence { margin-top: 14px; text-align: left; }
.order-certificate-fields { display: grid; gap: 8px; margin: 0 0 10px; }
.order-certificate-fields dt { color: var(--muted, #626978); font-size: 12px; }
.order-certificate-fields dd { margin: 3px 0 0; font-weight: 700; white-space: pre-wrap; overflow-wrap: anywhere; }
.order-certificate-copy { min-height: 44px; margin-bottom: 10px; white-space: normal; }
.order-certificate-copy-value { width: 100%; min-width: 0; margin: 8px 0; }
.order-certificate-photos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.order-certificate-photo { min-width: 0; margin: 0; }
.order-certificate-photo-button { display: grid; place-items: center; width: 100%; min-height: 44px; padding: 6px; border: 1px solid var(--line, #e1e3e7); border-radius: 8px; background: #f7f7f8; cursor: zoom-in; }
.order-certificate-photo-button img { display: block; width: 100%; height: 160px; object-fit: contain; }
.order-certificate-photo-button img[hidden] { display: none; }
.order-certificate-photo figcaption, .order-certificate-photo-error { margin: 6px 0; font-size: 12px; line-height: 1.6; }
.order-certificate-photo-error { color: var(--muted, #626978); grid-column: 1 / -1; }
.order-certificate-review { margin: 16px 0 20px; padding: 12px; border: 1px solid var(--line, #e1e3e7); border-radius: 9px; }
.order-certificate-review > h3 { margin: 0 0 10px; font-size: 16px; }
.order-certificate-order-identity { font-size: 12px; line-height: 1.6; }
.order-certificate-review-item { padding: 14px 0; border-top: 1px solid var(--line, #e1e3e7); }
.order-certificate-review-item > p { margin: 6px 0; }
.order-certificate-preview { width: min(900px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; padding: 16px; }
.order-certificate-preview h3 { font-size: 15px; overflow-wrap: anywhere; }
.order-certificate-preview > img { display: block; width: 100%; height: min(68dvh, 760px); object-fit: contain; margin-bottom: 14px; }
.order-certificate-preview > img[hidden] { display: none; }
.order-line-mobile-label { display: none; }
#warehouse-scan-form input { min-width: 0; max-width: 100%; overflow-x: auto; }
#warehouse-scan-form .warehouse-scan-identity-field { min-width: 0; overflow-x: clip; }
.warehouse-scan-full-identity { white-space: normal; overflow-wrap: anywhere; user-select: text; }
@media (max-width: 720px) {
  .order-lines-table.has-certificate-lines { display: block; min-width: 0; width: 100%; }
  .order-lines-table.has-certificate-lines caption { display: block; width: 100%; }
  .order-lines-table.has-certificate-lines thead { display: none; }
  .order-lines-table.has-certificate-lines tbody, .order-lines-table.has-certificate-lines tr { display: block; min-width: 0; width: 100%; }
  .order-lines-table.has-certificate-lines tr + tr { border-top: 2px solid var(--line, #e1e3e7); }
  .order-lines-table.has-certificate-lines td { display: block; min-width: 0; width: auto; padding: 10px 12px; }
  .order-lines-table.has-certificate-lines td:nth-child(n+2) { display: grid; grid-template-columns: minmax(60px, .8fr) minmax(0, 1.2fr); gap: 12px; text-align: left; }
  .order-lines-table.has-certificate-lines .order-line-mobile-label { display: block; color: var(--muted, #626978); }
}
@media (max-width: 600px) {
  [data-editor="COMMERCE_CATALOG"] .product-grid.editor-row { grid-template-columns: minmax(0, 1fr); padding: 14px; gap: 14px; }
  .product-grid .editor-remove { justify-self: stretch; }
}

/* Keep advanced text editing legible on touch screens without disabling zoom. */
@media (hover: none) and (pointer: coarse) {
  [data-editor] .editor-row input:not([type="file"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  [data-editor] .editor-row select,
  [data-editor] .editor-row textarea,
  [data-editor] .editor-inline-field input:not([type="file"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  [data-editor] .editor-inline-field select { font-size: 16px; }
}
