.product-operator-workbench { min-width: 0; color: #111827; }
.product-operator-markets, .product-operator-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem; }
.product-operator-markets { justify-content: flex-start; }
.product-operator-markets [aria-current="page"] { border-color: #6366f1; background: #eef2ff; color: #4338ca; }
.product-operator-summary { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,22rem),1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.product-operator-summary article { padding: 1rem; background: #fff; border: 1px solid #e5e7eb; border-radius: .5rem; }
.product-operator-facts { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: .75rem; margin-top: .75rem; }
.product-operator-facts dt { font-size: .75rem; color: #6b7280; }
.product-operator-facts dd { font-size: .95rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.product-operator-table { width: 100%; border-collapse: collapse; font-size: .8125rem; background: #fff; }
.product-operator-table th, .product-operator-table td { padding: .65rem .5rem; border-bottom: 1px solid #e5e7eb; text-align: right; font-variant-numeric: tabular-nums; }
.product-operator-table thead th { color: #4b5563; font-weight: 500; background: #f9fafb; white-space: nowrap; }
.product-operator-table th:nth-child(2), .product-operator-table th[scope="row"] { text-align: left; }
.product-operator-table th[scope="row"] { max-width: 16rem; }
.product-operator-table small { display: block; color: #6b7280; font-weight: 400; margin-top: .2rem; }
.product-operator-table button + button { margin-left: .5rem; }
.product-operator-editor { background: #fff; padding: 1.25rem; border: 1px solid #e2e8f0; border-radius: .75rem; margin-top: 1.25rem; font-size: .875rem; }
.product-operator-action-row { display: grid; grid-template-columns: minmax(9rem,.7fr) minmax(16rem,1.3fr); align-items: end; gap: 1rem; padding-bottom: 1.25rem; border-bottom: 1px solid #e2e8f0; }
.product-operator-selection-count { align-self: center; font-size: 1rem; color: #0f172a; }
.product-operator-fields:not([hidden]) { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1rem; margin-top: 1.25rem; }
.product-operator-preorder-rows { display: grid; grid-column: 1 / -1; gap: .75rem; }
.product-operator-preorder-row { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(7rem,.7fr) minmax(9rem,.8fr); align-items: center; gap: .75rem; padding: .75rem; border: 1px solid #e2e8f0; border-radius: .625rem; background: #f8fafc; }
.product-operator-preorder-row[hidden] { display: none; }
.product-operator-preorder-held { color: #475569; font-size: .75rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.product-operator-field { display: flex; flex-direction: column; gap: .45rem; min-width: 0; color: #334155; font-weight: 600; }
.product-operator-field > span { font-size: .8125rem; }
.product-operator-field .form-input { width: 100%; min-height: 2.75rem; border-color: #cbd5e1; background: #fff; }
.product-operator-field .form-input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgb(99 102 241 / .12); }
.product-operator-help { grid-column: 1 / -1; margin: 0; padding-top: .25rem; font-size: .75rem; line-height: 1.6; color: #64748b; }
.product-operator-treatment { grid-column: 1 / -1; border: 1px solid #c7d2fe; border-radius: .625rem; background: #eef2ff; padding: .875rem 1rem; }
.product-operator-checkbox { display: flex; align-items: flex-start; gap: .75rem; color: #1e293b; cursor: pointer; }
.product-operator-checkbox input[type="checkbox"] { width: 1.125rem; height: 1.125rem; margin-top: .1rem; accent-color: #4f46e5; flex: 0 0 auto; }
.product-operator-checkbox span { display: grid; gap: .2rem; }
.product-operator-checkbox strong { font-size: .875rem; }
.product-operator-checkbox small { color: #475569; font-size: .75rem; line-height: 1.5; font-weight: 400; }
.product-operator-submit { margin-top: 1.25rem; min-height: 2.75rem; }
.product-operator-editor input, .product-operator-editor select { max-width: 100%; }
.product-operator-workbench button:focus-visible, .product-operator-workbench a:focus-visible { outline: 2px solid #6366f1; outline-offset: 3px; }
@media(max-width: 1023px) {
  .product-operator-facts { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .product-operator-table thead { display: none; }
  .product-operator-table, .product-operator-table tbody { display: block; }
  .product-operator-table tr { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); border: 1px solid #e5e7eb; border-radius: .5rem; padding: .75rem; margin-bottom: .75rem; gap: .5rem; }
  .product-operator-table td, .product-operator-table th[scope="row"] { border: 0; padding: 0; text-align: left; max-width: none; }
  .product-operator-table th[scope="row"] { grid-column: 1 / -1; grid-row: 1; padding-right: 2rem; }
  .product-operator-table td:first-child { grid-column: 2; grid-row: 1; justify-self: end; z-index: 1; }
  .product-operator-table td[data-label]:not(:first-child)::before { content: attr(data-label); display: block; font-size: .75rem; color: #6b7280; }
  .product-operator-field, .product-operator-editor .form-input { width: 100%; }
  .product-operator-toolbar label { width: 100%; }
  .product-operator-toolbar select { min-width: 0; width: 100%; }
}

@media(max-width: 639px) {
  .product-operator-editor { padding: 1rem; }
  .product-operator-action-row, .product-operator-fields:not([hidden]) { grid-template-columns: minmax(0,1fr); }
  .product-operator-preorder-row { grid-template-columns: minmax(0,1fr); }
  .product-operator-help, .product-operator-treatment { grid-column: 1; }
  .product-operator-submit { width: 100%; }
}

/* Keep the selection rail, numeric columns and actions aligned across SKUs. */
.product-operator-channel { display: flex; align-items: center; gap: .75rem; white-space: nowrap; font-size: .8125rem; flex-shrink: 0; }
.product-operator-channel select { width: 12rem; }
.product-operator-table { table-layout: fixed; border: 1px solid #e5e7eb; }
.product-operator-table th, .product-operator-table td { vertical-align: middle; padding: .85rem .65rem; }
.product-operator-table td:first-child, .product-operator-table thead th:first-child { text-align: center; }
.product-operator-table td:nth-child(3), .product-operator-table thead th:nth-child(3) { text-align: center; }
.product-operator-table tr:hover { background: #fafaff; }
.product-operator-table td:last-child { white-space: nowrap; }
.product-operator-table td:last-child button { font-size: .75rem; }
.product-operator-facts dd { margin: .25rem 0 0; line-height: 1.4; }
.product-operator-facts > div + div { border-left: 1px solid #f0f1f3; padding-left: 1rem; }
.product-operator-toolbar { margin-bottom: .75rem; }
.product-operator-markets .btn-secondary { min-height: 2.25rem; display: inline-flex; align-items: center; }
[data-admin-workbench="market-product-show"] .admin-workbench-header { align-items: center; }
@media(max-width: 1023px) {
  .product-operator-table { border: 0; background: transparent; }
  .product-operator-table colgroup { display: none; }
  .product-operator-table tr { background: #fff; }
  .product-operator-table th, .product-operator-table td { padding: 0; }
  .product-operator-table td:nth-child(3), .product-operator-table td:first-child { text-align: left; }
  .product-operator-facts > div + div { padding-left: 0; border-left: 0; }
  .product-operator-channel select { width: 100%; }
  .product-operator-channel { width: 100%; }
  [data-admin-workbench="market-product-show"] .admin-workbench-header { align-items: flex-start; }
}

/* SKU 售價與數量：一格一值的寬表。視覺沿用庫存工作台，左欄固定、橫向捲動。 */
.product-sku-grid-shell { width: 100%; max-width: 100%; max-height: calc(100vh - 22rem); overflow: auto; border: 1px solid #d8dee8; border-radius: .4rem; background: #fff; }
.product-sku-grid { table-layout: fixed; width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; color: #1e293b; font-size: 12.5px; }
.product-sku-grid th { position: sticky; top: 0; z-index: 4; height: 32px; padding: .25rem .4rem; border-right: 1px solid #e2e8f0; border-bottom: 1px solid #cbd5e1; background: #f8fafc; color: #475569; font-size: 11px; font-weight: 650; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-sku-grid thead tr:nth-child(2) th { top: 32px; }
.product-sku-grid thead th.is-readonly { background: #f1f5f9; color: #64748b; }
.product-sku-grid-groups th { height: 32px; background: #eef2f7; color: #334155; text-align: center; }
.product-sku-grid-groups th:last-child { background: #f1f5f9; color: #475569; }
.product-sku-grid td { height: 42px; padding: .2rem .3rem; border-right: 1px solid #eef2f7; border-bottom: 1px solid #e5e7eb; background: #fff; white-space: nowrap; }
.product-sku-grid tbody tr:hover td { background: #fafaff; }
.product-sku-grid :is(th, td):first-child { position: sticky; left: 0; z-index: 3; box-shadow: 2px 0 0 #cbd5e1; }
.product-sku-grid thead th:first-child { z-index: 7; }
.product-sku-grid-identity { background: #fff; vertical-align: middle; }
.product-sku-grid-identity small { display: block; color: #94a3b8; font-size: 10px; font-weight: 400; margin-top: .15rem; }
.product-sku-grid-cell.is-number { text-align: right; font-variant-numeric: tabular-nums; }
.product-sku-grid-cell.is-center { text-align: center; }
.product-sku-grid-cell.is-readonly { padding-right: .5rem; color: #475569; background: #f8fafc; }
.product-sku-grid-cell.is-shared { background: #fbfaf7; }
.product-sku-grid-cell.is-warning { background: #fffbeb; }
.product-sku-grid-input { width: 100%; height: 30px; padding: 0 .35rem; border: 1px solid transparent; border-radius: .25rem; background: transparent; color: inherit; font: inherit; }
.product-sku-grid-cell.is-number .product-sku-grid-input { text-align: right; }
.product-sku-grid-input:hover:not(:disabled) { border-color: #cbd5e1; background: #fff; }
.product-sku-grid-input:focus { outline: none; border-color: #6366f1; background: #fff; box-shadow: 0 0 0 3px rgb(99 102 241 / .12); }
.product-sku-grid-input:disabled { color: #94a3b8; cursor: not-allowed; }
.product-sku-grid-check { width: 1.05rem; height: 1.05rem; accent-color: #4f46e5; }
.product-sku-grid td.is-dirty { background: #eef2ff; box-shadow: inset 3px 0 0 #6366f1; }
.product-sku-grid-stock-link { color: #2563eb; text-decoration: underline; text-underline-offset: 2px; }

.product-sku-grid-savebar { position: sticky; bottom: 1rem; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; padding: .75rem 1rem; border: 1px solid #c7d2fe; border-radius: .75rem; background: #fff; box-shadow: 0 12px 30px rgb(15 23 42 / .15); }
/* `display: flex` 會蓋掉瀏覽器對 [hidden] 的 display: none —— 沒有這行，
   儲存列其實從來沒有真的被隱藏過。 */
.product-sku-grid-savebar[hidden] { display: none; }
.product-sku-grid-savebar strong { font-size: .875rem; color: #0f172a; }
.product-sku-grid-savebar-actions { display: flex; gap: .5rem; }

.product-sku-grid-review { position: fixed; inset: 0; z-index: 70; display: flex; justify-content: flex-end; }
.product-sku-grid-review[hidden] { display: none; }
.product-sku-grid-review-backdrop { position: absolute; inset: 0; background: rgb(2 6 23 / .35); cursor: default; }
.product-sku-grid-review-panel { position: relative; z-index: 1; display: flex; flex-direction: column; width: 100%; max-width: 32rem; height: 100%; padding: 1.5rem; border-left: 1px solid #e5e7eb; background: #f8fafc; overflow-y: auto; }
.product-sku-grid-review-body { flex: 1; margin-top: 1rem; border: 1px solid #e2e8f0; border-radius: .75rem; background: #fff; overflow-y: auto; }
.product-sku-grid-review-row { padding: .65rem .85rem; border-bottom: 1px solid #f1f5f9; font-size: .8125rem; }
.product-sku-grid-review-row > div { display: flex; align-items: center; gap: .5rem; color: #0f172a; }
.product-sku-grid-review-row span { color: #64748b; font-size: .75rem; }
.product-sku-grid-review-row p { margin: .25rem 0 0; color: #334155; }
.product-sku-grid-review-shared { margin-left: auto; padding: .1rem .4rem; border-radius: 999px; background: #fef3c7; color: #92400e; font-size: .6875rem; font-style: normal; }
.product-sku-grid-review-note { margin-top: .75rem; padding: .6rem .75rem; border-radius: .5rem; background: #fef9c3; color: #854d0e; font-size: .75rem; line-height: 1.6; }
.product-sku-grid-swatch { display: inline-block; width: .7rem; height: .7rem; margin-right: .15rem; border: 1px solid #cbd5e1; border-radius: .2rem; vertical-align: -1px; }
/* 橫向捲到右段時左邊只剩 SKU 欄，整列點亮避免在錯的列打字。 */
.product-sku-grid tbody tr:focus-within td { background: #f5f7ff; }
.product-sku-grid tbody tr:focus-within .product-sku-grid-identity { background: #eef2ff; }
.product-sku-grid tbody tr:focus-within td.is-dirty, .product-sku-grid td.is-dirty { background: #eef2ff; box-shadow: inset 3px 0 0 #6366f1; }
/* 共用日期控制項塞進格子：時區提示改在欄位標題，保留清除鈕。 */
.product-sku-grid-datetime { gap: 0; }
.product-sku-grid-datetime .admin-datetime-field__hint, .product-sku-grid-datetime .admin-datetime-field__presets { display: none; }
.product-sku-grid-datetime .admin-datetime-field__visible { height: 30px; padding: 0 2.4rem 0 .35rem; border: 1px solid transparent; border-radius: .25rem; background: transparent; font-size: inherit; }
.product-sku-grid-datetime .admin-datetime-field__visible:hover:not(:disabled) { border-color: #cbd5e1; background: #fff; }
.product-sku-grid-datetime .admin-datetime-field__visible:focus { border-color: #6366f1; background: #fff; box-shadow: 0 0 0 3px rgb(99 102 241 / .12); }
.product-sku-grid-datetime .admin-datetime-field__clear { right: .25rem; font-size: .625rem; }
/* 只賣現貨時整組預購欄位唯讀：淡化並收掉清除鈕，避免按了才知道不行。 */
.product-sku-grid-cell.is-inactive { background: #f8fafc; }
.product-sku-grid-cell.is-inactive .product-sku-grid-input:disabled,
.product-sku-grid-cell.is-inactive .product-sku-grid-check:disabled { color: #cbd5e1; opacity: .55; }
.product-sku-grid-datetime.is-locked .admin-datetime-field__clear { display: none; }
/* 商品層級旗標：控制項在表頭，資料列留空，避免看起來能逐 SKU 設定。 */
.product-sku-grid-product-flag { white-space: normal; vertical-align: top; }
.product-sku-grid-product-flag label { display: inline-flex; align-items: center; gap: .3rem; font-weight: 650; cursor: pointer; }
.product-sku-grid-product-flag small { display: block; margin-top: .1rem; color: #94a3b8; font-size: 10px; font-weight: 400; }
