/* ==========================================================================
   Purchase Return Center V1 — master-detail workspace (Render/CSS/
   Component rework only; see PurchaseReturnCenterPage.js /
   PurchaseReturnWorkspace.js / components/PurchaseReturn*.js). No backend,
   no API — pure UI Prototype, mirrors the Receipt Center V1 architecture
   (receipt-center.css) so the module reuses one Shell/Design System.
   ==========================================================================
   Reuses shared Foundation classes untouched (.card, .inventory-page-shell,
   .inventory-page-header, .prototype-banner, .item-page-actions,
   .inventory-btn-*, .icon-btn, .status-badge, .inventory-badge-*,
   .status-badge-info, .drawer-tabs/.drawer-tab, .drawer-footer-meta/
   -actions, .field-grid, .inventory-section-card, .item-movement-timeline
   family, .item-tab-note, .profile-summary-row, .dialog-overlay/-panel,
   .po-permission-panel family, .inventory-empty-state, .query-field,
   .supplier-search-card). Every new Purchase-Return-Center-specific class
   below uses a self-contained "prt-" prefix, matching the module-
   independence convention used throughout this session's Prototype phases.
   ========================================================================== */:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-page-shell {
  gap: 0;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-fixed-block {
  flex-shrink: 0;
  margin-bottom: var(--ids-space-4);
}/* ---- KPI row (section 五): six soft-tone tiles ---- */:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--ids-space-3);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-kpi-card {
  display: flex;
  align-items: center;
  gap: var(--ids-space-3);
  background: var(--color-white);
  border: 1px solid var(--ids-border-soft);
  border-radius: var(--ids-radius-lg);
  padding: var(--ids-space-3);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--ids-radius-md);
  background: #eef6fb;
  color: var(--color-navy);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-kpi-card-warning .prt-kpi-icon { background: #fff6e5; color: #8a5a00; }:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-kpi-card-info .prt-kpi-icon { background: #e6f0fa; color: #1c5d8c; }:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-kpi-card-purple .prt-kpi-icon { background: #f1eafb; color: #6b3fa0; }:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-kpi-card-cyan .prt-kpi-icon { background: #e2f6f6; color: #0f7a7a; }:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-kpi-card-success .prt-kpi-icon { background: #e3f5f1; color: #0e6d61; }:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-kpi-card-danger .prt-kpi-icon { background: #fbe8e6; color: #b3382c; }:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-kpi-icon .inv-icon {
  width: 18px;
  height: 18px;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-kpi-value {
  font-size: var(--ids-font-lg);
  font-weight: 700;
  color: var(--color-navy);
  line-height: 1.2;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-kpi-label {
  font-size: var(--ids-font-xs);
  color: var(--color-text);
  margin-top: 2px;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-kpi-sub {
  font-size: 11px;
  color: var(--color-text-muted);
}

@media (max-width: 1280px) {:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}/* ---- Status badge tones not covered by the shared inventory-badge-*
   family (section 十八: 9 statuses, soft purple/cyan for two of them) ---- */:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-badge-purple { background: #f1eafb; color: #6b3fa0; }:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-badge-cyan { background: #e2f6f6; color: #0f7a7a; }/* ---- Search / filter row (section 六) ---- */:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-filter-card {
  padding: var(--ids-space-3) var(--ids-space-4);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-filter-row {
  display: flex;
  align-items: flex-end;
  gap: var(--ids-space-3);
  flex-wrap: wrap;
}/* ---- Two-pane workspace (section 八): ~58/42, both panes scroll
   independently. Below 1366px the right panel becomes a CSS-only overlay
   Drawer covering the list — no separate Drawer component needed. ---- */:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-workspace {
  display: flex;
  gap: var(--ids-space-4);
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
}/* INVENTORY-PHASE3-UAT-FIX-PACK-002 §1.2: the右側 Detail used to be whatever
   42% happened to be, which left it too narrow to read. The detail panel is
   now the fixed-size partner (480–520px) and the list absorbs the remainder,
   so the detail never shrinks below a usable width and never needs a
   horizontal scrollbar. */:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-list-panel {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  padding-right: 2px;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-panel {
  flex: 0 0 clamp(480px, 36%, 520px);
  width: clamp(480px, 36%, 520px);
  min-width: 480px;
  max-width: 520px;
  height: 100%;
  background: var(--color-white);
  border: 1px solid var(--ids-border-soft);
  border-radius: var(--ids-radius-lg);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-panel-inner {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-workspace-backdrop {
  display: none;
}

@media (max-width: 1366px) {:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-list-panel {
    flex: 1 1 100%;
    max-width: 100%;
  }:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-panel {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 92%;
    max-width: 560px;
    height: 100%;
    border-radius: 0;
    box-shadow: -8px 0 24px rgba(18, 43, 68, 0.16);
    z-index: 60;
  }:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-panel.has-selection {
    display: flex;
  }:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-workspace-backdrop.visible {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(18, 43, 68, 0.35);
    z-index: 55;
  }
}/* ---- Left: Return Card List (section 七) ---- */:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-card-grid {
  display: flex;
  flex-direction: column;
  gap: var(--ids-space-3);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--color-white);
  border: 1px solid var(--ids-border-soft);
  border-radius: var(--ids-radius-lg);
  padding: var(--ids-space-4);
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-card:hover {
  border-color: var(--color-teal);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-card.active {
  border-color: var(--color-teal);
  box-shadow: 0 0 0 2px rgba(18, 137, 122, 0.15);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ids-space-2);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-card-no {
  font-size: var(--ids-font-md);
  font-weight: 700;
  color: var(--color-navy);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-card-ref {
  font-size: var(--ids-font-xs);
  color: var(--color-text-muted);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-card-supplier-row, :is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-card-date-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: var(--ids-font-sm);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-card-label {
  color: var(--color-text-muted);
  font-size: var(--ids-font-xs);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-card-value {
  color: var(--color-text);
  font-weight: 600;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-card-progress {
  display: flex;
  align-items: center;
  gap: var(--ids-space-2);
  margin-top: 2px;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-card-progress-track {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--ids-surface-muted);
  overflow: hidden;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-card-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--color-teal);
  transition: width 200ms ease;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-card-progress-pct {
  font-size: var(--ids-font-xs);
  font-weight: 600;
  color: var(--color-text);
  width: 36px;
  text-align: right;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-card-meta {
  display: flex;
  align-items: baseline;
  gap: var(--ids-space-2);
  font-size: var(--ids-font-xs);
  color: var(--color-text-muted);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-card-meta strong {
  font-size: var(--ids-font-sm);
  color: var(--color-navy);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 2px;
  padding-top: 6px;
  border-top: 1px solid var(--ids-border-soft);
}/* ---- Right: Workspace header / tabs (section 八) ---- */:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-ws-header {
  padding: var(--ids-space-4) var(--ids-space-5) var(--ids-space-3);
  flex-shrink: 0;
  border-bottom: 1px solid var(--ids-border-soft);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-ws-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--ids-space-3);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-ws-header-identity {
  display: flex;
  align-items: flex-start;
  gap: var(--ids-space-2);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-ws-title {
  font-size: var(--ids-font-lg);
  font-weight: 700;
  color: var(--color-navy);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-ws-status-row {
  margin-top: 4px;
  font-size: var(--ids-font-sm);
  color: var(--color-text);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-ws-header-actions {
  display: flex;
  align-items: center;
  gap: var(--ids-space-2);
  flex-shrink: 0;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-ws-header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ids-space-4);
  margin-top: var(--ids-space-3);
  font-size: var(--ids-font-xs);
  color: var(--color-text);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-ws-meta-label {
  color: var(--color-text-muted);
  margin-right: 4px;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-ws-tabs {
  flex-shrink: 0;
  padding: 0 var(--ids-space-4);
  overflow-x: auto;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-ws-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: var(--ids-space-4) var(--ids-space-5);
  display: flex;
  flex-direction: column;
  gap: var(--ids-space-4);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-ws-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ids-space-3);
  padding: var(--ids-space-3) var(--ids-space-5);
  border-top: 1px solid var(--ids-border-soft);
  box-shadow: 0 -4px 12px rgba(18, 43, 68, 0.04);
}/* ---- 退貨品項明細 (section 十) ---- */:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-items-actions {
  display: flex;
  align-items: center;
  gap: var(--ids-space-2);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-item-card-list {
  display: flex;
  flex-direction: column;
  gap: var(--ids-space-4);
  margin-top: var(--ids-space-3);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-item-card {
  border: 1px solid var(--ids-border-soft);
  border-radius: var(--ids-radius-md);
  padding: var(--ids-space-4);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-item-card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--ids-space-3);
  margin-bottom: var(--ids-space-3);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-item-card-header input[type="checkbox"] {
  margin-top: 3px;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-item-card-name {
  font-size: var(--ids-font-sm);
  font-weight: 700;
  color: var(--color-text);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-item-card-code {
  font-size: var(--ids-font-xs);
  color: var(--color-text-muted);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-item-remaining {
  margin-top: var(--ids-space-3);
  padding-top: var(--ids-space-2);
  border-top: 1px dashed var(--ids-border-soft);
  font-size: var(--ids-font-sm);
  color: var(--color-text-muted);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-item-remaining strong {
  color: var(--color-navy);
}/* ---- Batch entries — compact two/three-line cards, not a dense
   multi-column table (workspace panel is only ~42% of the page width). ---- */:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-batch-entries {
  display: flex;
  flex-direction: column;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-batch-entry {
  padding: var(--ids-space-2) 0;
  border-bottom: 1px solid var(--ids-border-soft);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-batch-entry:last-child {
  border-bottom: none;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-batch-row1 {
  display: flex;
  align-items: center;
  gap: var(--ids-space-2);
  margin-bottom: 6px;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-batch-lot {
  font-size: var(--ids-font-sm);
  font-weight: 600;
  color: var(--color-text);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-batch-exp {
  font-size: var(--ids-font-xs);
  color: var(--color-text-muted);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-batch-row2 {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--ids-space-2);
  margin-bottom: 6px;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-batch-mini {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 11px;
  color: var(--color-text-muted);
  min-width: 64px;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-batch-mini strong {
  font-size: var(--ids-font-sm);
  font-weight: 600;
  color: var(--color-text);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-batch-mini-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 110px;
  min-width: 96px;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-batch-mini-field label {
  font-size: 11px;
  color: var(--color-text-muted);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-batch-row3 {
  display: flex;
  align-items: center;
  gap: var(--ids-space-2);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-batch-row3 label {
  font-size: 11px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-batch-field {
  width: 100%;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--ids-border-soft);
  border-radius: var(--ids-radius-sm);
  font-size: var(--ids-font-sm);
  box-sizing: border-box;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-batch-row3 .prt-batch-field {
  flex: 1;
}/* ---- 金額摘要 (section 十二) ---- */:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-amount-summary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ids-space-5);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-amount-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-amount-label {
  font-size: 11px;
  color: var(--color-text-muted);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-amount-value {
  font-size: var(--ids-font-lg);
  font-weight: 700;
  color: var(--color-navy);
}/* ---- 原始進貨 Tab (section 十三) ---- */:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-readonly-table {
  display: flex;
  flex-direction: column;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-readonly-row {
  padding: var(--ids-space-2) 0;
  border-bottom: 1px solid var(--ids-border-soft);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-readonly-row:last-child {
  border-bottom: none;
}/* ---- 物流追蹤 Tab timeline (section 十四) ---- */:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-logistics-steps {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ids-space-4);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-logistics-step {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--ids-font-sm);
  color: var(--color-text-muted);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-logistics-step .inv-icon {
  width: 16px;
  height: 16px;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-logistics-step.done {
  color: #0e6d61;
  font-weight: 600;
}/* ---- 附件 Tab (section 十六) ---- */:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-attachment-list {
  display: flex;
  flex-direction: column;
  gap: var(--ids-space-2);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-attachment-row {
  display: flex;
  align-items: center;
  gap: var(--ids-space-2);
  padding: var(--ids-space-2) var(--ids-space-3);
  border: 1px solid var(--ids-border-soft);
  border-radius: var(--ids-radius-sm);
  font-size: var(--ids-font-sm);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-attachment-name {
  font-weight: 600;
  color: var(--color-text);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-attachment-type {
  color: var(--color-text-muted);
  font-size: var(--ids-font-xs);
}/* ---- Text tone helpers ---- */:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-text-success { color: #0e6d61; }:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-text-warning { color: #8a5a00; }:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-text-danger { color: #b3382c; }:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-text-info { color: #1c5d8c; }/* ---- 新增採購退貨單 Dialog (INVENTORY-PURCHASE-RETURN-CREATE-DIALOG-UAT-FIX-001) ----
   Root cause of the unusable quantity field: this rule used to set `width`
   only. The base `#inventoryOverlayRoot .dialog-panel` carries
   `max-width: min(92vw, 480px)`, which has the same specificity and is never
   overridden by a `width` declaration — so the panel rendered at 480px no
   matter what width was requested here. Both must be set together, exactly
   the way .si-dialog-panel already does it in inventory-overlay-portal.css.
   ---- */:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-dialog {
  width: min(1100px, calc(100vw - 48px));
  max-width: min(1100px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}/* Header and footer are fixed; only the body between them scrolls. */:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-dialog .dialog-header {
  flex: 0 0 auto;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-dialog .dialog-footer {
  flex: 0 0 auto;
  position: static;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-dialog-body {
  display: flex;
  flex-direction: column;
  gap: var(--ids-space-3);
  flex: 1 1 auto;
  min-height: 0;
  /* was `overflow: hidden` — the body could never scroll, so anything past
     the fold was simply unreachable. */
  overflow-y: auto;
  overflow-x: hidden;
}/* Supplier / PO summary — its own block instead of a line crammed above the table. */:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-create-summary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ids-space-2) var(--ids-space-5);
  padding: var(--ids-space-3);
  background: var(--ids-surface-muted);
  border: 1px solid var(--ids-border-soft);
  border-radius: var(--ids-radius-md);
  font-size: var(--ids-font-sm);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-create-summary-item {
  display: flex;
  gap: 6px;
  align-items: baseline;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-create-summary-label {
  color: var(--color-text-muted);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-create-summary-value {
  font-weight: 600;
  color: var(--color-text);
}/* The detail table is the only horizontally scrolling region; the dialog
   itself must never be pushed wider than the viewport by it. */:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-table-scroll {
  overflow-x: auto;
  overflow-y: visible;
  border: 1px solid var(--ids-border-soft);
  border-radius: var(--ids-radius-md);
  max-width: 100%;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-search {
  position: relative;
  flex-shrink: 0;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-search input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--ids-border-soft);
  border-radius: var(--ids-radius-sm);
  font-size: var(--ids-font-sm);
  box-sizing: border-box;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-search .supplier-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
}/* The dialog renders a real <table>. The previous rules made the <table> a
   flex column and every <tr> an 11-track CSS grid left over from the
   prototype's <div> markup — with only 9 cells the 品項 `1.4fr` track
   collapsed to ~20px, 本次退貨數量 landed in a 64px track, and the header
   <tr> (no such class) stayed `display: table-row`, so header and data
   columns could never line up. Column widths now come from <colgroup> +
   table-layout: fixed, which also guarantees header/data alignment. */:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-table {
  display: table;
  width: 100%;
  /* Wider than the dialog on purpose: the .prt-source-table-scroll wrapper
     scrolls instead of the columns being squeezed to unusable widths. */
  min-width: 1010px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: var(--ids-font-xs);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: var(--ids-space-2) var(--ids-space-3);
  text-align: left;
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--ids-surface-muted);
  border-bottom: 1px solid var(--ids-border-soft);
  white-space: nowrap;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-row {
  display: table-row;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-row > td {
  padding: var(--ids-space-2) var(--ids-space-3);
  vertical-align: middle;
  border-bottom: 1px solid var(--ids-border-soft);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-table tbody tr:last-child > td {
  border-bottom: none;
}/* Numeric cells must never wrap into a vertical stack. */:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}/* 品名可兩行截斷，item code 另起一行必須完整可見。 */:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-item-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.35;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-item-code {
  display: block;
  color: var(--color-text-muted);
  white-space: nowrap;
}/* Quantity / reason inputs must fill their column, never overflow it. */:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-row input[data-line-qty],
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-row input[data-line-reason] {
  width: 100%;
  min-width: 0;
  height: 34px;
  box-sizing: border-box;
  padding: 0 8px;
  border: 1px solid var(--ids-border-soft);
  border-radius: var(--ids-radius-sm);
  font-size: var(--ids-font-sm);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-row input[data-line-qty] {
  text-align: right;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-row input[data-line-qty]:disabled {
  background: var(--ids-surface-muted);
  cursor: not-allowed;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-row input[data-line-qty].is-invalid {
  border-color: #b3382c;
  background: #fdf2f1;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-row.is-selected > td {
  background: rgba(28, 93, 140, 0.05);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-line-error {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: #b3382c;
  white-space: nowrap;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-header-row {
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--ids-surface-muted);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-header-row .prt-source-cell {
  white-space: normal;
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-cell-name {
  font-weight: 600;
  color: var(--color-text);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-row.is-added {
  background: var(--ids-surface-muted);
  color: var(--color-text-muted);
}:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-added-tag {
  font-size: 11px;
  color: #0e6d61;
  font-weight: 600;
}/* No longer its own vertical scroll region: .prt-source-dialog-body is the
   single scrolling area between the fixed header and footer. Two nested
   scrollers is the exact problem inventory-overlay-portal.css already
   documents for .si-dialog-body. */:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-source-body {
  min-height: 0;
}/* ---- 送出前確認 Dialog (section 十九) ---- */:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-submit-confirm-dialog {
  width: min(560px, 92vw);
  max-height: 86vh;
}

/* ---- INVENTORY-PHASE3-UAT-FIX-PACK-002 §1.1 數量 Stepper ----
   [-] 2 [+]. The item's own setting decides the step (integer by default),
   so ordinary use cannot produce a value like 1.02; the native number
   spinners are hidden because they step by the browser's own rules, not the
   item's. ---- */
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-qty-stepper {
  display: flex;
  align-items: stretch;
  width: 100%;
  border: 1px solid var(--ids-border-soft);
  border-radius: var(--ids-radius-sm);
  overflow: hidden;
  background: var(--color-white);
}
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-qty-stepper.is-invalid {
  border-color: #b3382c;
  background: #fdf2f1;
}
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-qty-step-btn {
  flex: 0 0 30px;
  border: none;
  background: var(--ids-surface-muted);
  color: var(--color-text);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  user-select: none;
}
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-qty-step-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-qty-stepper input[data-line-qty] {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  height: 32px;
  border: none;
  border-left: 1px solid var(--ids-border-soft);
  border-right: 1px solid var(--ids-border-soft);
  border-radius: 0;
  text-align: center;
  font-size: var(--ids-font-sm);
  background: transparent;
}
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-qty-stepper input[data-line-qty]::-webkit-outer-spin-button,
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-qty-stepper input[data-line-qty]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-qty-stepper input[data-line-qty] {
  -moz-appearance: textfield;
  appearance: textfield;
}
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-qty-stepper input[data-line-qty]:disabled {
  background: var(--ids-surface-muted);
  cursor: not-allowed;
}

/* ---- INVENTORY-PHASE3-UAT-FIX-PACK-002 §1.2 ----
   The Detail panel is now a fixed 480–520px column, which is narrower than
   the two-column field-grid and the multi-span header meta were laid out for.
   「避免水平捲軸」: everything inside the panel wraps instead of overflowing. */
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-panel,
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-panel-inner,
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-ws-body {
  overflow-x: hidden;
  min-width: 0;
}
/* ---- INVENTORY-PHASE3-UAT-AND-WORKFLOW-FIX-001 §2 / §3 ----
   The rules above used to force `grid-template-columns: 1fr` here and pin
   EVERY .field-group to `grid-column: 1 / -1`. That collapsed 基本資料 into a
   single tall stack of full-width rows — the cramped, hard-to-scan panel the
   manual UAT reported. The panel is ≥480px wide in every desktop layout, so
   it comfortably holds the design system's normal two columns; only
   .full-width (備註 and other long text) still spans both.

   `minmax(0, 1fr)` rather than `1fr` so a long unbroken value shrinks its own
   column instead of widening the grid — that is what keeps §2.9/§3.6's
   「不得產生水平捲軸」 true without giving up the second column. */
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-panel .field-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  align-items: start;
}
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-panel .field-grid .field-group {
  min-width: 0;
}
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-panel .field-grid .field-group.full-width {
  grid-column: 1 / -1;
}
/* Label above value, never beside it, with the same vertical rhythm in every
   field (§7.4) and a uniform control height (§7.5). */
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-panel .field-grid .field-group {
  display: flex;
  flex-direction: column;
}
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-panel .field-grid .field-group label {
  display: block;
  margin-bottom: 4px;
  line-height: 1.4;
}
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-panel .field-grid .field-group input,
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-panel .field-grid .field-group select {
  height: 32px;
  width: 100%;
}
/* §2.7 / §3 — below the panel's own comfortable two-column width (it becomes
   a 92%-of-viewport drawer under 1366px) fall back to a single column. */
@media (max-width: 720px) {
  :is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-panel .field-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
/* §2.3 / §3.2 — the header meta chips had the label and the value jammed onto
   one line with 4px between them ("需求倉庫主倉"). Stack them like every other
   field so label and value are never mistaken for one string. */
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-panel .prt-ws-header-meta > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-panel .prt-ws-header-meta .prt-ws-meta-label {
  margin-right: 0;
}
/* §2.8 — the header's action buttons keep their own row and never squeeze the
   title, whatever the field layout does below them. */
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-panel .prt-ws-header-top {
  flex-wrap: wrap;
  gap: var(--ids-space-2);
}
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-panel .prt-ws-header-identity {
  min-width: 0;
  flex: 1 1 auto;
}
/* Item-card labels ran straight into their values ("需求數量5") because
   .prt-card-label carried no spacing at all. */
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-panel .prt-card-label {
  margin-right: 6px;
}
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-panel input,
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-panel select {
  max-width: 100%;
  box-sizing: border-box;
}
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-panel .prt-ws-header-meta,
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-panel .prt-ws-header-actions,
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-panel .prt-amount-summary,
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-panel .prt-logistics-steps,
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-panel .prt-batch-row1,
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-panel .prt-batch-row2,
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-panel .prt-batch-row3 {
  flex-wrap: wrap;
  min-width: 0;
}
/* The 原進貨資訊 table is the one thing that legitimately needs more width
   than the panel — it scrolls inside its own region rather than pushing the
   panel wider. */
:is(#inventoryHostRoot, #inventoryOverlayRoot) .prt-panel .prt-source-readonly-table {
  display: block;
  overflow-x: auto;
  max-width: 100%;
}
