:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  --pc-bg-page: #f7f8fc;
  --pc-surface: #ffffff;
  --pc-surface-subtle: #fbfaff;
  --pc-brand: #6d28d9;
  --pc-brand-subtle: #faf5ff;
  --pc-text: #1f2937;
  --pc-text-secondary: #6b7280;
  --pc-text-muted: #8b8fa3;
  --pc-border: #e5e7eb;
  --pc-border-brand: #ddd6fe;
  --pc-border-brand-strong: #c4b5fd;
  --pc-success: #34a853;
  --pc-processing: #f4b400;
}

#single-mode {
  padding: 0;
}

#single-mode > .card {
  display: none;
}

body:has(#single-mode:not(.hidden) .product-creation-page) main {
  max-width: none;
  padding: 0;
  min-width: 0;
  overflow-x: hidden;
}

.product-creation-page {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 100dvh;
  color: var(--pc-text);
  background: var(--pc-bg-page);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

.pc-topbar {
  box-sizing: border-box;
  height: 56px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--pc-surface);
  border-bottom: 1px solid var(--pc-border);
  color: var(--pc-text);
}

.pc-topbar-title { font-size: 20px; font-weight: 750; line-height: 24px; }
.pc-topbar-actions { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 500; color: var(--pc-text-secondary); }
.pc-cost, .pc-connection, .pc-bell { display: inline-flex; align-items: center; justify-content: center; min-height: 32px; padding: 7px 12px; border: 1px solid var(--pc-border); border-radius: 12px; background: var(--pc-surface); line-height: 18px; }
.pc-cost { color: var(--pc-brand); background: var(--pc-brand-subtle); }
.pc-connection { color: var(--pc-text); }
.pc-bell { padding-inline: 12px; }
.pc-avatar { min-width: 32px; min-height: 32px; display: grid; place-items: center; border-radius: 9999px; background: var(--pc-brand); color: white; font-size: 13px; font-weight: 500; }

.pc-page-content { box-sizing: border-box; padding: 16px 18px 22px; }
.pc-tabs { display: flex; align-items: flex-start; gap: 16px; height: 56px; margin-bottom: 12px; }
.pc-tab { height: 56px; min-width: 148px; padding: 10px 28px; border: 0; border-radius: 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; background: transparent; color: var(--pc-text-muted); font: inherit; font-size: 15px; font-weight: 400; line-height: 20px; text-align: left; cursor: pointer; }
.pc-tab small { color: inherit; font-size: 12px; font-weight: 400; line-height: 16px; letter-spacing: 0; }
.pc-tab.is-active { background: var(--pc-surface); color: var(--pc-brand); box-shadow: 0 2px 8px #ddd; }

.pc-main-grid { display: grid; grid-template-columns: minmax(0, 1.58fr) minmax(300px, .92fr); align-items: start; gap: 14px; }
.pc-left-column, .pc-right-column { display: flex; min-width: 0; flex-direction: column; gap: 14px; }
.pc-card { box-sizing: border-box; background: var(--pc-surface); border: 1px solid var(--pc-border); border-radius: 16px; }

.pc-upload-panel { width: 100%; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.pc-card-heading { margin: 0; font-size: 20px; line-height: 24px; font-weight: 750; letter-spacing: 0; }
.pc-card-desc { margin: 0; color: var(--pc-text-muted); font-size: 14px; line-height: 20px; }
.pc-upload-panel .pc-card-desc { margin-top: -3px; }
.pc-upload-fields { display: grid; gap: 8px; }
.pc-upload-field { display: grid; gap: 5px; color: var(--pc-text-secondary); font-size: 13px; line-height: 18px; font-weight: 600; }
.pc-upload-field input { box-sizing: border-box; width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid var(--pc-border); border-radius: 10px; outline: none; color: var(--pc-text); background: var(--pc-surface); font: inherit; font-weight: 400; }
.pc-upload-field input::placeholder { color: var(--pc-text-muted); opacity: 1; }
.pc-upload-field input:focus { border-color: var(--pc-brand); box-shadow: 0 0 0 3px var(--pc-brand-subtle); }
.pc-dropzone { box-sizing: border-box; width: 100%; height: 140px; margin-top: 0; padding: 16px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 6px; background: var(--pc-surface-subtle); border: 2px dashed var(--pc-border-brand-strong); border-radius: 15px; text-align: center; cursor: pointer; transition: background .15s, border-color .15s; }
.pc-dropzone.is-dragging, .pc-dropzone.has-files { background: var(--pc-brand-subtle); border-color: var(--pc-brand); }
#pc-file-input { display: none !important; }
.pc-drop-icon { color: var(--pc-brand); font-size: 28px; line-height: 32px; }
.pc-drop-title { font-size: 16px; line-height: 20px; font-weight: 750; }
.pc-drop-copy { color: var(--pc-text-muted); font-size: 13px; line-height: 18px; }
.pc-upload-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 0; }
.pc-button { min-width: 0; min-height: 40px; padding: 10px 14px; border: 1px solid transparent; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font: inherit; font-size: 14px; font-weight: 500; line-height: 20px; cursor: pointer; transition: transform .15s, background .15s; }
.pc-button:active { transform: translateY(1px); }
.pc-button:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.pc-button--secondary { color: var(--pc-text); background: var(--pc-surface); border-color: var(--pc-border); }
.pc-button--primary { color: #fff; background: var(--pc-brand); border-color: var(--pc-brand); }
.pc-button--primary:hover:not(:disabled) { background: #5d3bea; }

.pc-generated-card { width: 100%; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.pc-content-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pc-content-tile { box-sizing: border-box; height: 76px; padding: 10px; display: flex; flex-direction: column; gap: 3px; border: 1px solid var(--pc-border-brand); border-radius: 12px; background: var(--pc-brand-subtle); }
.pc-content-icon { height: 16px; color: var(--pc-brand); font-size: 15px; line-height: 16px; }
.pc-content-label { color: var(--pc-brand); font-size: 13px; line-height: 18px; font-weight: 400; }
.pc-content-subtitle { color: var(--pc-text-secondary); font-size: 12px; line-height: 16px; }

.pc-workflow { width: 100%; padding: 0; }
.pc-workflow-title-row { display: flex; align-items: flex-start; justify-content: space-between; padding: 16px 16px 12px; }
.pc-workflow-subtitle { margin: 2px 0 0; color: var(--pc-text-muted); font-size: 12px; line-height: 16px; }
.pc-workflow-status { color: var(--pc-brand); font-size: 12px; font-weight: 700; }
.pc-workflow-list { position: relative; margin: 0; padding: 0; list-style: none; }
.pc-workflow-step { position: relative; min-height: 42px; display: grid; grid-template-columns: 24px 1fr auto; column-gap: 8px; align-items: center; padding: 7px 16px; }
.pc-step-index { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--pc-border); border-radius: 50%; color: var(--pc-text-muted); background: var(--pc-surface); font-size: 10px; font-weight: 400; }
.pc-step-copy { display: flex; flex-direction: column; gap: 1px; }
.pc-step-name { color: var(--pc-text); font-size: 13px; line-height: 16px; font-weight: 500; }
.pc-step-subtitle { color: var(--pc-text-muted); font-size: 10px; line-height: 12px; }
.pc-step-status { color: var(--pc-text-muted); font-size: 11px; line-height: 14px; }
.pc-workflow-step.is-complete .pc-step-index { color: #fff; border-color: var(--pc-brand); background: var(--pc-brand); font-size: 0; }
.pc-workflow-step.is-complete .pc-step-index::after { content: "✓"; font-size: 13px; }
.pc-workflow-step.is-complete .pc-step-name { color: var(--pc-text); }
.pc-workflow-step.is-complete .pc-step-status { color: var(--pc-success); }
.pc-workflow-step.is-current .pc-step-index { color: var(--pc-processing); border-color: var(--pc-processing); background: var(--pc-surface); }
.pc-workflow-step.is-current .pc-step-name { color: var(--pc-text); font-weight: 700; }
.pc-workflow-step.is-current .pc-step-status { color: var(--pc-brand); font-weight: 700; }
.pc-workflow-step.is-failed .pc-step-index { color: #fff; border-color: #d14343; background: #d14343; }
.pc-workflow-step.is-failed .pc-step-status { color: #d14343; font-weight: 700; }
.pc-workflow-step.is-failed .pc-step-name { color: #d14343; font-weight: 700; }
.pc-task-workspace { width: 100%; margin-top: 14px; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid var(--pc-border); border-radius: 16px; background: var(--pc-surface); }
.pc-task-main { flex: 1; min-width: 0; }
.pc-evidence-review { margin-top: 16px; display: grid; gap: 12px; }
.pc-evidence-review h3, .pc-evidence-item h4 { margin: 4px 0; }
.pc-evidence-item { padding: 14px; border: 1px solid #f0b8a8; border-radius: 12px; background: #fff8f5; }
.pc-evidence-item dl { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 10px 0; font-size: 12px; }
.pc-evidence-item dt { font-weight: 700; }.pc-evidence-item dd { margin: 0; overflow-wrap: anywhere; }
.pc-evidence-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pc-evidence-actions input { min-width: 220px; padding: 9px 10px; border: 1px solid var(--pc-border); border-radius: 8px; }
.pc-task-workspace h2 { margin: 2px 0; font-size: 16px; line-height: 20px; font-weight: 750; }
.pc-task-workspace p { margin: 0; color: var(--pc-text-muted); font-size: 13px; }
.pc-workspace-kicker { color: var(--pc-brand); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.pc-workspace-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.pc-workspace-error { color: #d14343 !important; }
.pc-upload-feedback { margin: -4px 0 0; color: var(--pc-text-muted); font-size: 12px; line-height: 16px; }
.pc-upload-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.pc-upload-item { min-width: 0; display: grid; grid-template-columns: 34px 1fr auto; gap: 7px; align-items: center; padding: 7px; border: 1px solid var(--pc-border); border-radius: 10px; background: var(--pc-surface-subtle); }
.pc-upload-item img, .pc-file-icon { width: 34px; height: 34px; border-radius: 7px; object-fit: cover; background: var(--pc-brand-subtle); color: var(--pc-brand); display: grid; place-items: center; font-size: 10px; font-weight: 700; }
.pc-upload-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }
.pc-upload-item small { grid-column: 2; color: var(--pc-text-muted); font-size: 10px; }
.pc-upload-file-actions { display: flex; gap: 3px; }
.pc-upload-file-actions button { width: 24px; height: 24px; padding: 0; border: 1px solid var(--pc-border); border-radius: 6px; background: white; color: var(--pc-text-secondary); cursor: pointer; }
.pc-upload-file-actions button:last-child { color: #c33434; }
.pc-upload-progress { display: grid; grid-template-columns: 1fr minmax(90px, 2fr) auto; align-items: center; gap: 8px; color: var(--pc-text-secondary); font-size: 12px; }
.pc-upload-progress progress { width: 100%; accent-color: var(--pc-brand); }

/* Bulk Product Upload is intentionally a separate workspace.  These rules do
   not alter the single-product upload controls or the existing task workflow. */
.pc-bulk-upload-panel { gap: 12px; }
.pc-bulk-heading-row, .pc-queue-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.pc-bulk-capacity, .pc-queue-summary { flex: 0 0 auto; padding: 5px 9px; border-radius: 999px; color: var(--pc-brand); background: var(--pc-brand-subtle); border: 1px solid var(--pc-border-brand); font-size: 12px; font-weight: 650; white-space: nowrap; }
.pc-bulk-folder-picker { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px; border: 1px solid var(--pc-border-brand); border-radius: 12px; background: var(--pc-surface-subtle); }
.pc-bulk-folder-picker strong { color: var(--pc-text); font-size: 14px; }
.pc-bulk-folder-picker p { margin: 3px 0 0; color: var(--pc-text-muted); font-size: 12px; line-height: 18px; }
.pc-bulk-folder-picker code { color: var(--pc-brand); font: inherit; font-weight: 650; }
#pc-bulk-folder-input { display: none !important; }
.pc-bulk-product-list { display: grid; gap: 7px; }
.pc-inbox-delete { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding-top: 3px; color: var(--pc-text-muted); font-size: 12px; line-height: 18px; }
.pc-button--danger { color: #fff; background: #c33434; border-color: #c33434; }
.pc-button--danger:hover:not(:disabled) { background: #a12626; border-color: #a12626; }
.pc-bulk-list-title { display: flex; justify-content: space-between; gap: 10px; margin-top: 2px; color: var(--pc-text-secondary); font-size: 12px; }
.pc-bulk-list-title strong { color: var(--pc-text); font-size: 13px; }
.pc-bulk-product-item { display: grid; grid-template-columns: 25px minmax(130px, .65fr) minmax(210px, 1.35fr) 30px; align-items: center; gap: 9px; padding: 9px; border: 1px solid var(--pc-border); border-radius: 11px; background: var(--pc-surface-subtle); }
.pc-bulk-item-index { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; color: var(--pc-brand); background: var(--pc-brand-subtle); font-size: 11px; font-weight: 700; }
.pc-bulk-item-copy { min-width: 0; display: grid; gap: 2px; }
.pc-bulk-item-copy strong { overflow: hidden; color: var(--pc-text); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.pc-bulk-item-copy small { color: var(--pc-text-muted); font-size: 11px; }
.pc-bulk-source-tag { display: inline-flex; align-items: center; margin-right: 5px; padding: 1px 5px; border: 1px solid var(--pc-border-brand); border-radius: 999px; color: var(--pc-brand); background: var(--pc-brand-subtle); font-size: 10px; font-weight: 700; line-height: 14px; }
.pc-bulk-item-source { display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: center; gap: 7px; color: var(--pc-text-secondary); font-size: 11px; }
.pc-bulk-item-source input { min-width: 0; height: 32px; padding: 6px 8px; border: 1px solid var(--pc-border); border-radius: 8px; color: var(--pc-text); background: #fff; font: inherit; }
.pc-icon-button { width: 28px; height: 28px; padding: 0; border: 1px solid var(--pc-border); border-radius: 7px; color: #b44040; background: #fff; font-size: 17px; line-height: 1; }
.pc-bulk-empty { padding: 13px; border: 1px dashed var(--pc-border-brand-strong); border-radius: 11px; color: var(--pc-text-muted); background: var(--pc-surface-subtle); font-size: 12px; line-height: 18px; }
.pc-batch-queue { width: 100%; margin-top: 14px; padding: 18px; overflow: hidden; }
.pc-queue-heading { align-items: center; margin-bottom: 12px; }
.pc-queue-heading .pc-card-desc { margin-top: 3px; font-size: 12px; }
.pc-queue-scroll { overflow-x: auto; border: 1px solid var(--pc-border); border-radius: 11px; }
.pc-queue-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.pc-queue-col-product { width: 16%; }
.pc-queue-col-images { width: 7%; }
.pc-queue-col-source { width: 36%; }
.pc-queue-col-source-status { width: 12%; }
.pc-queue-col-actions { width: 23%; }
.pc-queue-col-details { width: 6%; }
.pc-queue-table th, .pc-queue-table td { padding: 10px; border-bottom: 1px solid var(--pc-border); color: var(--pc-text-secondary); font-size: 12px; line-height: 17px; text-align: left; vertical-align: middle; }
.pc-queue-table th { color: var(--pc-text-muted); background: var(--pc-surface-subtle); font-size: 11px; font-weight: 650; white-space: nowrap; }
.pc-queue-table tr:last-child td { border-bottom: 0; }
.pc-queue-table td strong { color: var(--pc-text); font-weight: 650; }
.pc-queue-table a { color: var(--pc-brand); text-decoration: none; white-space: nowrap; }
.pc-link-button { border: 0; background: transparent; color: var(--pc-brand); cursor: pointer; font: inherit; padding: 0 6px 0 0; white-space: nowrap; }
.pc-link-button:hover { text-decoration: underline; }
.pc-source-cell { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-status-pill { display: inline-flex; padding: 3px 7px; border-radius: 999px; color: var(--pc-text-muted); background: #f1f2f3; white-space: nowrap; font-size: 11px; }
.pc-status-pill.is-working { color: #7c5200; background: #fff0c2; }
.pc-status-pill.is-done { color: #166534; background: #dcfce7; }
.pc-status-pill.is-warning { color: #9a3412; background: #ffedd5; }
.pc-queue-actions, .pc-queue-row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.pc-queue-actions { justify-content: flex-end; }
.pc-item-source-field { display: grid; min-width: 0; gap: 4px; color: var(--pc-text-muted); font-size: 11px; font-weight: 650; }
.pc-item-source-field input { width: 100%; min-width: 0; height: 34px; padding: 7px 9px; border: 1px solid var(--pc-border); border-radius: 8px; color: var(--pc-text); background: #fff; font: inherit; font-weight: 400; }
.pc-item-source-field input:disabled { color: var(--pc-text-muted); background: var(--pc-surface-subtle); }
.pc-task-detail-cell { text-align: right !important; }
.pc-task-detail-trigger { padding: 3px 4px; border: 0; border-radius: 6px; color: var(--pc-text-muted); background: transparent; font: inherit; font-size: 11px; line-height: 17px; cursor: pointer; }
.pc-task-detail-trigger:hover, .pc-task-detail-trigger:focus-visible { color: var(--pc-text-secondary); background: var(--pc-surface-subtle); }
.pc-task-detail-unavailable { color: var(--pc-text-muted); }
.pc-task-detail-popover { width: min(460px, calc(100vw - 32px)); margin: 0; padding: 12px; border: 1px solid var(--pc-border); border-radius: 10px; color: var(--pc-text); background: var(--pc-surface); box-shadow: 0 10px 30px rgba(0, 0, 0, .14); }
.pc-task-detail-popover::backdrop { background: transparent; }
.pc-task-detail-popover code { display: block; margin: 4px 0 10px; overflow-wrap: anywhere; color: var(--pc-text-secondary); font-size: 12px; line-height: 18px; }
.pc-task-detail-label { color: var(--pc-text-muted); font-size: 11px; font-weight: 650; }
.pc-task-copy-button { min-height: 32px; padding: 6px 10px; font-size: 12px; }
.pc-queue-empty { padding: 22px !important; color: var(--pc-text-muted) !important; text-align: center; }
.pc-workflow-step.is-review .pc-step-index { color: #7c5200; border-color: #f4b400; background: #fff8df; }
.pc-workflow-step.is-review .pc-step-status { color: #7c5200; font-weight: 700; }

@media (max-width: 1100px) {
  body:has(#single-mode:not(.hidden) .product-creation-page) main { padding: 0; }
  .pc-bulk-product-item { grid-template-columns: 25px 1fr 30px; }
  .pc-bulk-item-source { grid-column: 2 / 3; grid-template-columns: 92px minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .pc-bulk-heading-row, .pc-queue-heading { align-items: flex-start; flex-direction: column; }
  .pc-bulk-folder-picker { align-items: flex-start; flex-direction: column; }
  .pc-bulk-product-item { grid-template-columns: 25px minmax(0, 1fr) 30px; }
  .pc-bulk-item-source { grid-column: 1 / -1; grid-template-columns: 1fr; }
}
