/* ════════════════════════════════════════════
   全局 & 重置
════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
.hidden { display: none !important; }

:root {
  --bg: #f0f2f5;
  --surface: #ffffff;
  --border: #e2e8f0;
  --border-mid: #cbd5e1;
  --text: #1e293b;
  --text-muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --ai: #7c3aed;
  --ai-hover: #6d28d9;
  --ai-light: #f5f3ff;
  --danger: #dc2626;
  --success: #16a34a;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,.12);
}

body {
  font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ════════════════════════════════════════════
   顶部导航
════════════════════════════════════════════ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 54px;
  box-shadow: var(--shadow);
}

.topbar-left { display: flex; align-items: center; gap: 10px; }
.logo { font-size: 16px; font-weight: 700; color: var(--text); }
.version { font-size: 11px; color: var(--text-muted); background: var(--bg); padding: 2px 6px; border-radius: 4px; }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid;
}
.badge-off { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.badge-on  { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }

/* ════════════════════════════════════════════
   按钮
════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-ai  { background: var(--ai); color: #fff; }
.btn-ai:hover:not(:disabled) { background: var(--ai-hover); }
.btn-ghost {
  background: transparent;
  border-color: var(--border-mid);
  color: var(--text);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg); border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-danger { background: var(--danger); color: #fff; }
.full-width { width: 100%; justify-content: center; }
.ml-auto { margin-left: auto; }

/* 行内翻译按钮 */
.btn-translate {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  background: var(--ai-light);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  align-self: center;
}
.btn-translate.top { align-self: flex-start; margin-top: 6px; }
.btn-translate:hover { background: #ede9fe; border-color: var(--ai); }

/* ════════════════════════════════════════════
   操作栏
════════════════════════════════════════════ */
.action-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 0;
}

.action-status {
  flex-basis: 100%;
  font-size: 13px;
  color: var(--text-muted);
  margin-left: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 10px 12px;
  line-height: 1.45;
}
.action-status:empty {
  display: none;
}
.action-status.info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}
.action-status.ok {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}
.action-status.warn {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}
.action-status.err {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

/* ════════════════════════════════════════════
   主容器 & 布局
════════════════════════════════════════════ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px 60px;
}

.form-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 860px) {
  .form-layout { grid-template-columns: 1fr; }
}

.col-left, .col-right { display: flex; flex-direction: column; gap: 16px; }

/* ════════════════════════════════════════════
   卡片
════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.subsection-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}

.req { color: var(--danger); }

/* ════════════════════════════════════════════
   双语输入组
════════════════════════════════════════════ */
.bilingual-group { display: flex; flex-direction: column; gap: 8px; }
.mt-16 { margin-top: 16px; }

.bi-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bi-row-top { align-items: flex-start; }

.bi-lang {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}
.bi-lang.zh { background: #fef3c7; color: #92400e; }
.bi-lang.ru { background: #dbeafe; color: #1e40af; }

.bi-input, .bi-textarea {
  flex: 1;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.bi-input:focus, .bi-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.bi-textarea { resize: vertical; }

/* ════════════════════════════════════════════
   字段网格
════════════════════════════════════════════ */
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-item { display: flex; flex-direction: column; gap: 5px; }
.field-item label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.field-item input,
.field-item select {
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s;
  font-family: inherit;
}
.field-item input:focus,
.field-item select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.price-rule-preview {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  background: #fbfffd;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.7;
}
.price-rule-preview b {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}
.price-rule-preview span {
  display: inline-flex;
  margin-right: 12px;
  white-space: nowrap;
}

/* ════════════════════════════════════════════
   弹窗通用
════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-backdrop.hidden { display: none; }

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
}
.modal-wide { max-width: 760px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}
.modal-close {
  border: none;
  background: none;
  font-size: 16px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 4px;
}
.modal-close:hover { background: var(--bg); }

.modal-body { padding: 20px; }
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

/* 设置弹窗 */
.form-section { margin-bottom: 20px; }
.form-section:last-child { margin-bottom: 0; }
.section-label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px; }

.field-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.field-row label { width: 80px; font-size: 12px; font-weight: 600; color: var(--text); flex-shrink: 0; }
.field-row input { flex: 1; border: 1px solid var(--border-mid); border-radius: var(--radius-sm); padding: 7px 10px; font-size: 13px; font-family: inherit; }
.field-row input:focus { outline: none; border-color: var(--primary); }

/* ════════════════════════════════════════════
   分类选择弹窗
════════════════════════════════════════════ */
.cat-modal-body { padding: 0; }

.cat-search-row {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.cat-search-input {
  width: 100%;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
}
.cat-search-input:focus { outline: none; border-color: var(--primary); }

.cat-columns {
  display: flex;
  height: 400px;
  overflow: hidden;
}
.cat-col {
  flex: 1;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 8px 0;
}
.cat-col:last-child { border-right: none; }

.cat-item {
  padding: 9px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  border-left: 3px solid transparent;
  transition: background .1s;
}
.cat-item:hover { background: var(--bg); }
.cat-item.active { background: var(--primary-light); color: var(--primary); border-left-color: var(--primary); font-weight: 600; }
.cat-item.leaf { color: var(--success); }
.cat-item .arrow { color: var(--text-muted); font-size: 10px; }

.cat-loading { padding: 40px; text-align: center; color: var(--text-muted); width: 100%; }

.cat-selected {
  padding: 10px 12px;
  background: var(--primary-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
  line-height: 1.4;
}

/* ════════════════════════════════════════════
   分类属性表单
════════════════════════════════════════════ */
.card-title #attr-count { margin-left: auto; }
.attr-loading { padding: 16px; text-align: center; color: var(--text-muted); font-size: 13px; }
.attr-error { padding: 12px; background: #fef2f2; color: var(--danger); border-radius: var(--radius-sm); font-size: 13px; }
.attr-empty { padding: 12px; text-align: center; color: var(--text-muted); font-size: 13px; }

.attr-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.attr-stat {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  padding: 10px 12px;
  min-height: 58px;
}
.attr-stat.warn { background: #fff7ed; border-color: #fed7aa; }
.attr-stat.ok { background: #f0fdf4; border-color: #bbf7d0; }
.attr-stat.quiet { background: #f8fafc; }
.attr-stat-num {
  display: block;
  font-size: 20px;
  font-weight: 750;
  line-height: 1.1;
  color: var(--text);
}
.attr-stat.warn .attr-stat-num { color: #c2410c; }
.attr-stat.ok .attr-stat-num { color: var(--success); }
.attr-stat-label {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.attr-group { margin-bottom: 16px; }
.attr-group-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.attr-group-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 10px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
}
.attr-group-head .attr-group-label {
  margin-bottom: 4px;
  padding-bottom: 0;
  border-bottom: 0;
}
.attr-group-sub {
  margin: -6px 0 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.attr-group-head .attr-group-sub { margin: 0; }
.attr-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}

.required-package-panel {
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  background: #fffaf5;
}
.required-core-panel {
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  background: #fffaf5;
}
.required-core-panel.is-complete {
  border-color: #bbf7d0;
  background: #fbfffd;
}
.required-package-panel.is-complete {
  border-color: #bbf7d0;
  background: #fbfffd;
}
.required-checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.required-check-item {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 6px;
  min-height: 28px;
  padding: 5px 8px;
  border: 1px solid #fed7aa;
  border-radius: var(--radius-sm);
  background: #fff;
  color: #9a3412;
  font-size: 12px;
  font-weight: 600;
}
.required-check-item.ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}
.required-check-item span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.required-check-action {
  margin-left: auto;
  border: 1px solid #fed7aa;
  border-radius: var(--radius-sm);
  background: #fff;
  color: #9a3412;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
.required-check-action:hover {
  border-color: #fb923c;
  background: #fffbeb;
}
.required-core-field.is-missing label,
.required-package-field.is-missing label { color: #b91c1c; }
.required-core-field.is-missing input,
.required-package-field.is-missing input {
  border-color: #ef4444;
  background: #fff5f5;
}
.required-core-field.is-filled input,
.required-package-field.is-filled input {
  border-color: #22c55e;
  background: #fbfffd;
}

.attr-import-panel {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fafcff;
}
.attr-import-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.attr-import-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.attr-import-toolbar-tip {
  font-size: 12px;
  color: var(--text-muted);
}
.attr-import-input {
  width: 100%;
  min-height: 110px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.65;
  resize: vertical;
  font-family: "SF Mono", "Fira Code", monospace;
}
.attr-import-input.paste-ready {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37,99,235,.12);
}
.attr-import-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37,99,235,.1);
}
.attr-import-actions {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.attr-import-tip {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.attr-field {
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.attr-field.is-dict {
  padding: 10px;
  border: 1px solid #f59e0b;
  border-radius: var(--radius-sm);
  background: #fffbeb;
}
.attr-field.is-matched {
  border-color: #22c55e;
  background: #f0fdf4;
}
.attr-field.is-unmatched,
.attr-field.is-missing {
  border-color: #ef4444;
  background: #fff5f5;
}
.attr-field.is-pending-match label,
.attr-field.is-missing label { color: #9a3412; }
.attr-field.is-unmatched label { color: #b91c1c; }
.attr-field.is-missing .attr-input,
.attr-field.is-pending-match .attr-input { border-color: #f59e0b; background: #fffaf5; }
.attr-field.is-filled .attr-input,
.attr-field.is-matched .attr-input { border-color: #22c55e; background: #fbfffd; }
.attr-field.is-unmatched .attr-input {
  border-color: #ef4444;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(239, 68, 68, .14);
}
.attr-field-merge-card {
  padding: 12px;
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  background: #fffaf5;
}
.attr-field-merge-card.is-filled {
  border-color: #bbf7d0;
  background: #fbfffd;
}
.attr-field label {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.attr-label-text {
  min-width: 0;
}
.attr-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 1px solid var(--border-mid);
  border-radius: 50%;
  color: var(--text-muted);
  background: #fff;
  font-size: 11px;
  line-height: 1;
  cursor: help;
}
.attr-tooltip {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 30;
  display: none;
  width: min(360px, 90vw);
  padding: 8px 10px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  background: #111827;
  color: #fff;
  box-shadow: var(--shadow-md);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.55;
}
.attr-help:hover + .attr-tooltip,
.attr-help:focus + .attr-tooltip {
  display: block;
}

.attr-input {
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
}
.attr-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,.1); }
.attr-merge-note {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}
.attr-merge-note b {
  color: var(--text);
}
.attr-merge-flow {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: var(--radius-sm);
  background: #dcfce7;
  color: #15803d;
  padding: 2px 8px;
  font-weight: 700;
}
.attr-merge-autofill {
  border: 1px solid #fed7aa;
  border-radius: var(--radius-sm);
  background: #fff;
  color: #9a3412;
  padding: 3px 8px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}
.attr-merge-autofill:hover {
  border-color: #fb923c;
  background: #fffbeb;
}

.attr-filled-optional {
  padding: 12px;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  background: #fbfffd;
}
.attr-priority-optional {
  padding: 12px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  background: #eff6ff;
}
.attr-optional {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f8fafc;
  overflow: hidden;
}
.attr-optional summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.attr-optional summary::-webkit-details-marker { display: none; }
.attr-optional summary::before {
  content: '▶';
  flex: 0 0 auto;
  font-size: 10px;
  color: var(--text-muted);
}
.attr-optional[open] summary::before { content: '▼'; }
.attr-optional summary span:last-child {
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}
.attr-optional-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px 12px;
}
.attr-search {
  width: min(360px, 100%);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
}
.attr-search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,.1); }
.attr-optional-body { padding-top: 8px; }
.attr-optional .attr-optional-body { padding: 0 14px 14px; }
.cat-placeholder { color: var(--text-muted); font-weight: 400; }
.mt-8 { margin-top: 8px; }

@media (max-width: 980px) {
  .attr-overview {
    grid-template-columns: 1fr;
  }
  .attr-fields-grid {
    grid-template-columns: 1fr;
  }
  .required-checklist {
    grid-template-columns: 1fr;
  }
  .attr-optional-tools {
    align-items: stretch;
    flex-direction: column;
  }
  .attr-search {
    width: 100%;
  }
}

/* ════════════════════════════════════════════
   图片区
════════════════════════════════════════════ */
/* 文件夹加载按钮 */
.folder-btn {
  font-size: 14px;
  padding: 10px 14px;
  margin-bottom: 8px;
}

.folder-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.6;
}
.folder-hint b { color: var(--text); }

/* 手动添加折叠区 */
.manual-section {
  margin-bottom: 10px;
}
.manual-section summary {
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  list-style: none;
}
.manual-section summary::-webkit-details-marker { display: none; }
.manual-section summary::before { content: '▶ '; font-size: 10px; }
.manual-section[open] summary::before { content: '▼ '; }
.manual-section summary:hover { background: var(--bg); color: var(--primary); }
.manual-body { padding-top: 10px; }

/* 图片分组 */
.img-group-section { margin-bottom: 14px; }
.img-group-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
}

.img-url-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.img-url-field { flex: 1; border: 1px solid var(--border-mid); border-radius: var(--radius-sm); padding: 7px 10px; font-size: 13px; font-family: inherit; }
.img-url-field:focus { outline: none; border-color: var(--primary); }

.upload-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 20px;
  border: 2px dashed var(--border-mid);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  transition: border-color .15s, background .15s;
  margin-bottom: 10px;
}
.upload-drop:hover, .upload-drop.drag-over { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.upload-icon { font-size: 24px; margin-bottom: 2px; }
.upload-sub { font-size: 11px; }

/* ── 批量粘贴 URL 面板 ── */
.url-paste-panel {
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--bg-light, #fafbfc);
  margin-bottom: 12px;
}
.url-paste-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 8px;
}
.url-paste-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.url-paste-group {
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  background: #fff;
}
.url-paste-input {
  width: 100%;
  min-height: 58px;
  padding: 6px 8px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  resize: vertical;
  box-sizing: border-box;
}
.url-paste-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  gap: 8px;
}
.url-paste-hint {
  font-size: 11px;
  color: var(--text-muted);
  flex: 1;
}
.url-paste-hint.warn { color: #d97706; }

.img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
}

.img-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid transparent;
  background: var(--bg);
}
.img-thumb:first-child { border-color: var(--primary); }
.img-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.img-thumb-del {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,.6);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s;
}
.img-thumb:hover .img-thumb-del { opacity: 1; }
.img-main-badge {
  position: absolute;
  bottom: 3px;
  left: 3px;
  background: var(--primary);
  color: #fff;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 700;
}
.img-uploading {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: var(--bg);
}

/* ════════════════════════════════════════════
   多规格 SKU
════════════════════════════════════════════ */
.variant-hint {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  padding: 12px 0;
}
.variant-import-panel {
  padding: 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: #fafcff;
}
.variant-import-panel-right {
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}
.variant-import-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}
.variant-import-input {
  width: 100%;
  min-height: 110px;
  padding: 10px 12px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  font: 12px/1.6 "SF Mono", "Fira Code", monospace;
  resize: vertical;
  background: #fff;
}
.variant-import-input-right {
  min-height: 180px;
}
.variant-import-input:focus {
  outline: none;
  border-color: var(--primary);
}
.variant-import-actions {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.variant-import-preview {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.variant-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.variant-flow-step {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  padding: 10px 12px;
  min-width: 0;
}
.variant-flow-step.done {
  border-color: #bbf7d0;
  background: #fbfffd;
}
.variant-flow-step.warn {
  border-color: #fed7aa;
  background: #fffaf5;
}
.variant-flow-kicker {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}
.variant-flow-step strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  color: var(--text);
}
.variant-flow-step small {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--text-muted);
}

.variant-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 88px 88px 72px 28px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.variant-row input {
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-size: 13px;
  width: 100%;
  font-family: inherit;
}
.variant-row input:focus { outline: none; border-color: var(--primary); }
.variant-name-wrap {
  min-width: 0;
}
.variant-meta {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.variant-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  overflow: hidden;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 11px;
}
.variant-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.variant-thumb-empty {
  border-style: dashed;
}
.variant-thumb-fallback {
  font-size: 22px;
  opacity: .5;
  display: flex;
  align-items: center;
  justify-content: center;
}
.variant-del {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--danger);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}
.variant-del:hover { background: #fef2f2; }
.variant-header {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 88px 88px 72px 28px;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

@media (max-width: 980px) {
  .variant-flow {
    grid-template-columns: 1fr;
  }
}

/* ════════════════════════════════════════════
   结果区
════════════════════════════════════════════ */
.result-content {
  font-size: 13px;
  line-height: 1.7;
}
.result-ok { color: var(--success); font-weight: 600; }
.result-err { color: var(--danger); font-weight: 600; }
.result-task { font-family: monospace; font-size: 12px; background: var(--bg); padding: 8px; border-radius: 6px; margin-top: 8px; word-break: break-all; }
.upload-watch {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  padding: 12px;
}
.upload-watch-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.upload-watch-head strong {
  display: block;
  font-size: 14px;
  color: var(--text);
}
.upload-watch-head span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
}
.upload-watch-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.upload-watch-grid div {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 8px;
  min-width: 0;
}
.upload-watch-grid span {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}
.upload-watch-grid b {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text);
  overflow-wrap: anywhere;
}
.upload-watch-progress {
  height: 6px;
  margin-top: 10px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}
.upload-watch-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width .2s;
}
.upload-watch-status {
  margin-top: 10px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 10px;
  color: var(--text);
}
.upload-watch-status.ok { background: #f0fdf4; color: #166534; }
.upload-watch-status.err { background: #fef2f2; color: #991b1b; }
.upload-watch-status.wait { background: #fff7ed; color: #9a3412; }
.upload-watch-items {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}
.upload-watch-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.72);
  padding: 8px;
}
.upload-watch-item b,
.upload-watch-item span {
  display: block;
  overflow-wrap: anywhere;
}
.upload-watch-item span { color: inherit; opacity: .86; }
.upload-watch-error {
  margin-top: 4px;
  color: var(--danger);
  overflow-wrap: anywhere;
}
.upload-watch-muted {
  margin-top: 4px;
  color: var(--text-muted);
}
.error-locate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.error-locate-btn {
  border-color: #fca5a5;
  background: #fff;
  color: #991b1b;
}
.error-locate-btn:hover {
  border-color: #ef4444;
  background: #fef2f2;
}
.locate-pulse {
  animation: locatePulse 1.2s ease-in-out 2;
}
@keyframes locatePulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
  }
  35%, 70% {
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .22), 0 0 0 8px rgba(37, 99, 235, .12);
  }
}

/* ════════════════════════════════════════════
   上货历史
════════════════════════════════════════════ */
.history-count { font-size: 11px; color: var(--text-muted); margin-left: 2px; }
.history-list { max-height: 60vh; overflow-y: auto; }
.history-empty { padding: 40px; text-align: center; color: var(--text-muted); font-size: 13px; }
.history-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light, #eee);
  gap: 12px;
}
.history-row:hover { background: var(--primary-light, #f6f8fa); }
.history-main { flex: 1; min-width: 0; }
.history-title {
  font-size: 13px; font-weight: 500; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.history-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.history-status {
  font-size: 11px; padding: 2px 8px; border-radius: 10px; white-space: nowrap;
}
.history-status.ok { background: #dcfce7; color: #166534; }
.history-status.wait { background: #ffedd5; color: #9a3412; }
.history-status.err { background: #fee2e2; color: #991b1b; }
.history-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.history-check-btn {
  padding: 3px 8px;
  font-size: 11px;
}
.history-detail-btn {
  padding: 3px 8px;
  font-size: 11px;
  border-color: #fecaca;
  color: #991b1b;
  background: #fff7f7;
}
.history-task-panel {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  padding: 8px;
}
.history-task-panel-error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}
.history-task-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}
.history-task-detail {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text);
  overflow-wrap: anywhere;
}
.history-task-summary {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text);
  overflow-wrap: anywhere;
}
.history-task-detail small {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
}
.history-task-item {
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 7px;
}
.history-task-item b,
.history-task-item span,
.history-task-item em,
.history-task-item small {
  display: block;
  overflow-wrap: anywhere;
}
.history-task-item b { color: var(--text); }
.history-task-item span { margin-top: 2px; color: var(--text-muted); }
.history-task-item em {
  margin-top: 4px;
  color: var(--danger);
  font-style: normal;
}
.history-task-error + .history-task-error {
  margin-top: 6px;
}
.history-task-item.ok { border-color: #bbf7d0; background: #f0fdf4; }
.history-task-item.err { border-color: #fecaca; background: #fef2f2; }
.history-task-item.wait { border-color: #fed7aa; background: #fff7ed; }

@media (max-width: 640px) {
  .upload-watch-head,
  .upload-watch-grid {
    grid-template-columns: 1fr;
  }
  .upload-watch-head {
    display: grid;
  }
  .history-row,
  .history-side {
    display: grid;
    align-items: stretch;
  }
}

/* 仓库弹窗 */
.modal-toolbar { display: flex; gap: 8px; align-items: center; }
.modal-toolbar input {
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 13px;
  width: 240px;
  font-family: inherit;
}
.modal-toolbar input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.warehouse-status {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border, #eee);
  background: var(--bg);
}

.warehouse-list { max-height: 65vh; overflow-y: auto; }

.warehouse-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border, #eee);
  align-items: center;
}
.warehouse-row:hover { background: var(--primary-light, #f6f8fa); }
.warehouse-thumb {
  width: 56px; height: 56px;
  border-radius: 6px; overflow: hidden;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.warehouse-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.warehouse-thumb-fallback { font-size: 22px; opacity: .5; }
.warehouse-main { min-width: 0; }
.warehouse-title {
  font-size: 13px; font-weight: 500; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.warehouse-meta {
  font-size: 11px; color: var(--text-muted); margin-top: 3px;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.warehouse-meta code {
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}
.warehouse-tag {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 8px;
  white-space: nowrap;
}
.warehouse-tag-archived { background: #fef2f2; color: #991b1b; }
.warehouse-tag-hidden   { background: #fffbeb; color: #92400e; }
.warehouse-tag-onsale   { background: #f0fdf4; color: #15803d; }

.warehouse-side { text-align: right; min-width: 100px; }
.warehouse-price { font-size: 13px; font-weight: 600; color: var(--text); }
.warehouse-stock { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.warehouse-stock-zero { color: var(--danger); font-weight: 500; }

/* 草稿夹缩略图 + 操作按钮 */
.history-thumb {
  width: 48px; height: 48px; flex-shrink: 0;
  border-radius: 6px; overflow: hidden;
  background: var(--primary-light, #f6f8fa);
  display: flex; align-items: center; justify-content: center;
}
.history-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.history-thumb-fallback { font-size: 20px; opacity: 0.5; }
.history-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* 1688 来源链接(基础信息卡片顶部) */
.source-url-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
  padding: 6px 10px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 6px;
}
.source-url-tag {
  font-size: 11px; font-weight: 700; color: #c2410c;
  letter-spacing: 0.5px;
}
.source-url-input {
  flex: 1; min-width: 0;
  border: none; background: transparent; outline: none;
  font-size: 12px; color: var(--text);
  padding: 2px 0;
}
.source-url-input::placeholder { color: #a3a3a3; font-size: 11px; }
.source-url-open {
  text-decoration: none; font-size: 14px; opacity: 0.8;
  padding: 2px 4px; border-radius: 4px;
}
.source-url-open:hover { opacity: 1; background: #fed7aa; }

/* 草稿夹列表里的 🔗 图标 */
.stash-link-icon {
  text-decoration: none; font-size: 12px; opacity: 0.7;
  margin-left: 6px; vertical-align: middle;
}
.stash-link-icon:hover { opacity: 1; }

/* offer_id 冲突预检 */
.offer-id-cache-badge {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 6px;
}
.offer-id-warn {
  font-size: 11px;
  margin-top: 3px;
  min-height: 14px;
}
.offer-id-warn.clash { color: #b91c1c; font-weight: 500; }
.offer-id-warn.ok { color: #16a34a; }

/* ════════════════════════════════════════════
   字典属性组合框（搜索 + 下拉）
════════════════════════════════════════════ */
.attr-combo {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.attr-combo-input {
  flex: 1;
  min-width: 0;
}
.attr-combo-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 8px;
  border: 1px solid #f59e0b;
  background: #fef3c7;
  color: #92400e;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: default;
}
.attr-combo-badge.picked {
  background: #dcfce7;
  color: #166534;
  border-color: #22c55e;
}
.attr-combo-badge.unmatched {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #ef4444;
}
.attr-combo-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  margin-top: 2px;
  background: var(--surface, #fff);
  border: 1px solid var(--border-mid, #d0d7de);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  max-height: 280px;
  overflow-y: auto;
}
.attr-combo-dropdown.hidden {
  display: none;
}
.attr-combo-item {
  padding: 7px 10px;
  font-size: 12px;
  color: var(--text, #1f2328);
  cursor: pointer;
  border-bottom: 1px solid var(--border-light, #f0f0f0);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.attr-combo-item:last-child {
  border-bottom: none;
}
.attr-combo-item:hover {
  background: var(--primary-light, #ddf4ff);
  color: var(--primary, #0969da);
}
.attr-combo-info {
  font-size: 10px;
  color: var(--text-muted, #6e7781);
  font-weight: 400;
  flex-shrink: 0;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attr-combo-empty {
  padding: 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted, #6e7781);
}

/* ════════════════════════════════════════════
   滚动条
════════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 3px; }
