/* ════════════════════════════════════════════
   全局 & 重置
════════════════════════════════════════════ */
*, *::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;
}

body.auth-locked > :not(#access-gate):not(#config-gate):not(#settings-modal):not(#api-tutorial-modal):not(#xj-tutorial-modal) {
  display: none !important;
}

.access-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(37,99,235,.08), rgba(22,163,74,.08)),
    var(--bg);
}
.access-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  padding: 28px;
}
.access-logo {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
}
.access-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}
.access-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 18px;
}
.access-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.access-form input {
  width: 100%;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
}
.access-form input:focus {
  outline: 2px solid rgba(37,99,235,.16);
  border-color: var(--primary);
}
.access-status {
  min-height: 20px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
}
.access-status.err {
  color: var(--danger);
}
.access-contact-box {
  margin-top: 16px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
}
.access-contact-box strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  word-break: break-word;
}
.access-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 18px;
  border-bottom: 2px solid var(--border);
}
.access-tab {
  flex: 1;
  padding: 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.access-tab:hover { color: var(--text); }
.access-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.access-panel.hidden { display: none; }
.captcha-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.captcha-question {
  flex: 1;
  padding: 10px 12px;
  background: #f1f5f9;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 1px;
  user-select: none;
}
.captcha-row input {
  width: 60px;
  flex-shrink: 0;
  text-align: center;
}
.reg-result {
  margin-top: 14px;
  padding: 14px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: #166534;
  word-break: break-all;
}
.reg-result code {
  display: block;
  margin-top: 6px;
  padding: 8px;
  background: #fff;
  border: 1px solid #bbf7d0;
  border-radius: 4px;
  font-size: 13px;
  user-select: all;
}
.reg-result .reg-copy-btn {
  margin-top: 8px;
}
.access-status.ok {
  color: #16a34a;
}

/* ── API 设置引导遮罩 ──────────────────────── */
.config-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(4px);
}
.config-gate.hidden { display: none; }
.config-gate-card {
  text-align: center;
  max-width: 400px;
  padding: 40px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}
.config-gate-icon { font-size: 48px; margin-bottom: 12px; }
.config-gate-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.config-gate-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.6;
}
.config-gate-status {
  margin-top: 12px;
  font-size: 13px;
  min-height: 20px;
}
.config-gate-status.err { color: var(--danger); }
.config-gate-status.ok { color: #16a34a; }
.config-gate-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.config-gate-back {
  margin-top: 8px;
}

/* ── 更新提示横幅 ───────────────────────────── */
.update-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 16px;
  background: #1e40af;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.update-banner .btn-primary { background: #fff; color: #1e40af; }
.update-banner .btn-ghost { color: rgba(255,255,255,.8); }

/* ════════════════════════════════════════════
   顶部导航
════════════════════════════════════════════ */
.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;
  gap: 12px;
  padding: 8px 24px;
  min-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 {
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 2px 7px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 700;
  font-family: inherit;
}
.version:hover {
  color: var(--primary);
  border-color: #bfdbfe;
  background: var(--primary-light);
}

.topbar-right { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; 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; }
.btn-warn { background: #f59e0b; color: #fff; }
.btn-warn:hover:not(:disabled) { background: #d97706; }
.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); }

/* ════════════════════════════════════════════
   全局粘贴 Toast
════════════════════════════════════════════ */
.paste-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 9999;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
  pointer-events: none;
  animation: toast-in .2s ease;
}
.paste-toast-warn { background: #b45309; }
.paste-toast-err  { background: #dc2626; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ════════════════════════════════════════════
   操作栏
════════════════════════════════════════════ */
.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;
}

/* ── 分类顶栏 ─────────────────────────────────────────────── */
.cat-top-card {
  margin-bottom: 14px;
  padding: 14px 20px;
}
.cat-top-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.cat-top-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}
.cat-top-row .cat-selected {
  flex: 1;
  min-width: 200px;
  margin: 0;
}

/* ════════════════════════════════════════════
   主容器 & 布局
════════════════════════════════════════════ */
.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;
  border-radius: 8px;
  font-size: 13px;
  overflow: hidden;
}
.price-rule-preview-empty {
  padding: 10px 12px;
  border: 1px dashed var(--border);
  background: #fafafa;
  color: var(--text-muted);
  font-size: 12px;
}
.price-rule-preview-active {
  border: 1px solid #e2e8f0;
  background: #fff;
}
.prp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  gap: 12px;
}
.prp-header b {
  color: var(--text);
  font-size: 13px;
}
.prp-ozon {
  font-size: 12px;
  color: var(--text-muted);
}
.prp-ozon strong {
  color: var(--primary);
  font-size: 13px;
}
.prp-main {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  flex-wrap: wrap;
}
.prp-kv {
  text-align: center;
}
.prp-kv-sale {
  background: #eff6ff;
  border-radius: 8px;
  padding: 6px 12px;
}
.prp-val {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.prp-cost { color: #64748b; }
.prp-profit { color: #16a34a; }
.prp-lbl {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: 1px;
}
.prp-arrow {
  color: #cbd5e1;
  font-size: 18px;
  font-weight: 700;
}
.prp-margin {
  margin-left: auto;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.prp-margin.good { background: #dcfce7; color: #16a34a; }
.prp-margin.ok { background: #fef3c7; color: #d97706; }
.prp-margin.bad { background: #fee2e2; color: #dc2626; }
.prp-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding: 8px 14px;
  border-top: 1px solid #f1f5f9;
  background: #fafafa;
  font-size: 11px;
  color: var(--text-muted);
}

/* ── 定价面板 ───────────────────────────────────────────── */
.pricing-panel {
  margin-bottom: 16px;
}
.pricing-panel-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

/* ── Ozon 内容评分小标签 ──────────────────────────────────────── */
.checklist-banner-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: #9ca3af;
  margin-left: auto;
  flex-shrink: 0;
}
.checklist-banner-score.excellent { background: #16a34a; }
.checklist-banner-score.good { background: #84cc16; color: #3f6212; }
.checklist-banner-score.warning { background: #f59e0b; }
.checklist-banner-score.danger { background: #ef4444; }

/* ── 防呆面板 ─────────────────────────────────────────────── */
.checklist-banner {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  padding: 10px 18px;
  margin-bottom: 12px;
  transition: background .3s, border-color .3s;
}
.checklist-banner.is-done {
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.checklist-banner-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.checklist-banner-icon {
  font-size: 15px;
}
.checklist-banner-title {
  font-size: 13px;
  font-weight: 700;
  color: #9a3412;
}
.is-done .checklist-banner-title { color: #166534; }
.checklist-banner-items {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.checklist-banner-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
}
.checklist-banner-item.done {
  color: #166534;
}
.checklist-banner-dot {
  font-size: 13px;
  font-weight: 700;
}
.checklist-banner-item.done .checklist-banner-dot {
  color: #16a34a;
}
.checklist-banner-hint {
  font-size: 10px;
  color: #d97706;
  margin-left: 2px;
}

/* ════════════════════════════════════════════
   弹窗通用
════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  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;
  max-height: calc(100dvh - 40px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.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-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.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;
  overflow-y: auto;
}
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* 设置弹窗 */
.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; }
.section-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.section-label-row .section-label {
  margin-bottom: 0;
}
.section-label-row .btn {
  flex-shrink: 0;
}

.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); }
.settings-quota-row { display: flex; align-items: center; gap: 10px; margin-left: 90px; min-height: 32px; }
.settings-quota-status { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.settings-quota-status.ok { color: #1a7f37; }
.settings-quota-status.err { color: #d73a49; }

.translate-export-options {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.translate-export-options label {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}
.translate-export-options select {
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  background: #fff;
}
.translate-export-options span {
  font-size: 12px;
  color: var(--text-muted);
}
@media (max-width: 640px) {
  .translate-export-options {
    align-items: stretch;
    flex-direction: column;
  }
  .translate-export-options select {
    width: 100%;
  }
}

.api-tutorial-modal {
  max-width: 720px;
}
.api-tutorial-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.api-tutorial-intro {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: #1e40af;
  font-size: 13px;
  line-height: 1.55;
}
.api-tutorial-steps {
  display: grid;
  gap: 10px;
}
.api-tutorial-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}
.api-tutorial-index {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
}
.api-tutorial-step h3 {
  margin-bottom: 5px;
  font-size: 14px;
  line-height: 1.35;
}
.api-tutorial-step p {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.65;
}
.api-tutorial-step a {
  display: inline-flex;
  margin-top: 8px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.api-tutorial-step a:hover {
  text-decoration: underline;
}
.api-tutorial-note {
  padding: 12px 14px;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  background: #f0fdf4;
  color: #166534;
  font-size: 13px;
  line-height: 1.6;
}
.api-tutorial-note-title {
  margin-bottom: 6px;
  font-weight: 800;
}
.api-tutorial-note ul {
  padding-left: 18px;
}
.api-tutorial-note li + li {
  margin-top: 4px;
}

.access-keys-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.access-key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: #f8fafc;
}
.access-key-main {
  min-width: 0;
}
.access-key-title {
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.access-key-title span {
  margin-left: 6px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}
.access-key-meta {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
}
.access-key-secret {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  max-width: 100%;
}
.access-key-secret code {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  background: #fff;
  color: #0f172a;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  line-height: 1.45;
  word-break: break-all;
  user-select: all;
}
.access-key-secret.missing {
  display: block;
  color: #9a3412;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  font-size: 12px;
}
.access-key-actions {
  flex-shrink: 0;
}
.access-key-lock {
  font-size: 12px;
  color: var(--text-muted);
}
.access-key-result {
  margin-top: 10px;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}
.access-key-result.ok {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}
.access-key-result.err {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}
.access-key-result code {
  display: block;
  margin-top: 6px;
  color: #0f172a;
  font-size: 12px;
  user-select: all;
}

.version-modal {
  max-width: 560px;
}
.version-current {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: #1e40af;
  font-size: 13px;
  line-height: 1.5;
}
.version-current b {
  font-size: 15px;
}
.version-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}
.version-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}
.version-row-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.version-row-main b {
  color: var(--text);
  font-size: 14px;
}
.version-row-main span,
.version-row time {
  color: var(--text-muted);
  font-size: 12px;
}
.version-row time {
  flex-shrink: 0;
  text-align: right;
}

.bug-reports-modal {
  max-width: 860px;
}
.bug-reports-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bug-report-row {
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  background: #fff7f7;
  padding: 12px;
}
.bug-report-row.resolved {
  border-color: var(--border);
  background: #f8fafc;
}
.bug-report-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.bug-report-title {
  min-width: 0;
  font-weight: 800;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bug-report-meta {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
}
.bug-report-message {
  margin-top: 8px;
  padding: 9px 10px;
  border: 1px solid rgba(220,38,38,.18);
  border-radius: var(--radius-sm);
  background: #fff;
  color: #991b1b;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.bug-report-detail {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.bug-report-detail summary {
  cursor: pointer;
  font-weight: 700;
}
.bug-report-detail pre {
  margin-top: 8px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #0f172a;
  color: #e2e8f0;
  padding: 10px;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.bug-report-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

/* ════════════════════════════════════════════
   分类选择弹窗
════════════════════════════════════════════ */
.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; }

/* 导入图片 */
.image-import-panel {
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  padding: 12px;
  background: #f8fafc;
  margin-bottom: 12px;
}
.image-import-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.image-import-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.image-import-sub {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.45;
}
.image-import-group {
  flex-shrink: 0;
  min-width: 92px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 5px 8px;
  color: var(--text);
  font-size: 12px;
}

.image-manager-modal {
  max-width: min(1060px, calc(100vw - 40px));
}
.image-manager-drop {
  margin-bottom: 12px;
}
.image-manager-summary {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 12px;
}
.image-manager-summary b {
  color: var(--text);
}
.image-manager-section {
  margin-bottom: 18px;
}
.image-manager-grid {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}
.image-manager-item {
  position: relative;
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 8px;
  min-height: 100px;
}
.image-manager-item[draggable="true"] {
  cursor: grab;
}
.image-manager-item.dragging {
  opacity: .5;
  cursor: grabbing;
}
.image-manager-item .img-thumb {
  width: 82px;
  height: 82px;
  aspect-ratio: auto;
}
.image-manager-item .img-thumb-del {
  opacity: 1;
}
.image-manager-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.35;
}
.image-manager-meta strong {
  color: var(--text);
  font-size: 13px;
}
.image-manager-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 图片分组 */
.img-group-section { margin-bottom: 14px; }
.img-group-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  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-group-tip {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
}

.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; }

.gpt-project-panel {
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  padding: 10px;
  margin-bottom: 12px;
}
.gpt-project-status {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}
.gpt-project-status.ok { color: #166534; }
.gpt-project-status.err { color: #991b1b; }
.gpt-project-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}
.gpt-project-actions input {
  min-width: 0;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  font-size: 12px;
  color: var(--text);
}
.gpt-replace-box {
  margin-top: 10px;
}
.gpt-replace-box textarea {
  width: 100%;
  min-height: 74px;
  box-sizing: border-box;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 8px 9px;
  resize: vertical;
  font-size: 12px;
  line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.gpt-replace-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
}
.gpt-replace-actions span {
  min-width: 0;
  font-size: 11px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}
.gpt-replace-actions span.ok { color: #166534; }
.gpt-replace-actions span.err { color: #991b1b; }

.gpt-replace-preview {
  margin-top: 10px;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  background: #f0f9ff;
  padding: 12px 14px;
}
.gpt-preview-summary {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 10px;
  overflow-y: auto;
  max-height: 65vh;
}
.gpt-preview-summary table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.gpt-preview-summary th,
.gpt-preview-summary td { border-bottom: 1px solid #e5e7eb; padding: 5px 8px; text-align: left; font-size: 12px; }
.gpt-preview-summary th { color: var(--text-muted); font-weight: 600; }
.gpt-preview-summary .change-count { color: #166534; font-weight: 600; }
.gpt-preview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.gpt-preview-group { margin-top: 12px; }
.gpt-preview-group-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #e5e7eb;
}
.gpt-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 6px;
}
.gpt-preview-item {
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
}
.gpt-preview-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}
.gpt-preview-item.broken img { display: none; }
.gpt-preview-item.broken::before {
  content: '图片加载失败';
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
  font-size: 11px;
  color: #94a3b8;
  background: #f8fafc;
}
.gpt-preview-item-label {
  font-size: 10px;
  color: var(--text-muted);
  padding: 4px 6px;
  line-height: 1.3;
  word-break: break-all;
}

/* ════════════════════════════════════════════
   🔗 AI 翻译 — 顶部核心横幅
════════════════════════════════════════════ */
.ai-translate-banner {
  background: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%);
  border: 2px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 20px;
  position: relative;
}
.ai-banner-badge {
  position: absolute;
  top: -12px;
  left: 24px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 20px;
  letter-spacing: .02em;
}
.ai-banner-head {
  margin-bottom: 18px;
}
.ai-banner-head h2 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}
.ai-banner-head p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}
.ai-translate-flow {
  display: flex;
  align-items: stretch;
  gap: 0;
}
.ai-translate-step {
  flex: 1;
  min-width: 180px;
  display: flex;
  gap: 12px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.ai-translate-step:first-child {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.ai-translate-step:last-child {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.ai-translate-step-num {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
}
.ai-translate-step-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ai-translate-step-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.ai-translate-step-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}
.ai-translate-arrow {
  flex-shrink: 0;
  width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #93c5fd;
  font-weight: 800;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

@media (max-width: 860px) {
  .ai-translate-flow {
    flex-direction: column;
    gap: 8px;
  }
  .ai-translate-step:first-child,
  .ai-translate-step:last-child {
    border-radius: var(--radius-sm);
  }
  .ai-translate-arrow {
    display: none;
  }
}

.img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
}
.img-grid.drag-over {
  outline: 2px dashed var(--primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
}
.img-grid-empty {
  display: block;
}
.img-empty-drop {
  min-height: 64px;
  border: 1px dashed var(--border-mid);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: #f8fafc;
  font-size: 12px;
  text-align: center;
  padding: 10px;
}
.img-grid.drag-over .img-empty-drop {
  border-color: var(--primary);
  color: var(--primary);
}

.img-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid transparent;
  background: var(--bg);
}
.img-thumb.is-cover { border-color: var(--primary); }
.img-thumb[draggable="true"] { cursor: grab; }
.img-thumb.dragging {
  opacity: .45;
  cursor: grabbing;
}
.img-thumb.drag-target-before::before,
.img-thumb.drag-target-after::before,
.image-manager-item.drag-target-before::before,
.image-manager-item.drag-target-after::before {
  content: '';
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 3px;
  border-radius: 999px;
  background: var(--primary);
  z-index: 4;
}
.img-thumb.drag-target-before::before,
.image-manager-item.drag-target-before::before { left: 3px; }
.img-thumb.drag-target-after::before,
.image-manager-item.drag-target-after::before { right: 3px; }
.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: 24px 56px minmax(0, 1fr) 80px 80px 64px 44px 28px;
  grid-template-rows: auto auto;
  gap: 4px 6px;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light, #f0f0f0);
}
.variant-row .variant-dims {
  grid-column: 2 / -1;
  display: flex;
  gap: 6px;
  align-items: center;
}
.variant-row .variant-dims input {
  width: 56px;
  flex: 0 0 56px;
}
.variant-row .variant-dims .variant-dims-label {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}
.variant-batch-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  margin-bottom: 4px;
  font-size: 12px;
  border-bottom: 1px solid var(--border-light, #f0f0f0);
}
.variant-check-label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}
.variant-col-check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
}
.variant-batch-count {
  color: var(--text-muted);
  font-size: 11px;
}
.variant-dims-hint-spacer { flex: 1; }
.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 {
  position: relative;
  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;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.variant-thumb:hover,
.variant-thumb:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, .16);
  outline: none;
}
.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: 24px 56px minmax(0, 1fr) 80px 80px 64px 44px 28px;
  gap: 4px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.variant-dims-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
}
.variant-dims-hint-text {
  color: var(--text-muted);
  font-size: 11px;
}

.variant-image-picker-modal {
  max-width: min(860px, calc(100vw - 40px));
}
.variant-image-picker-summary {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 12px;
}
.variant-image-picker-section {
  margin-bottom: 16px;
}
.variant-image-picker-section-title {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}
.variant-image-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
}
.variant-image-choice {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.variant-image-choice:hover,
.variant-image-choice:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 8px 18px rgba(15, 23, 42, .08);
  outline: none;
  transform: translateY(-1px);
}
.variant-image-choice.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, .18);
}
.variant-image-choice-thumb {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.variant-image-choice-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.variant-image-choice.broken .variant-image-choice-thumb {
  background: #fef2f2;
}
.variant-image-choice-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--text-muted);
}
.variant-image-choice-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(22, 163, 74, .92);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}
.variant-image-picker-empty {
  padding: 18px;
  border: 1px dashed var(--border-mid);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-align: center;
  font-size: 13px;
  background: #f8fafc;
}

@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; }
.result-retry { display: flex; align-items: flex-start; gap: 12px; margin-top: 14px; padding: 12px; background: #fffbeb; border: 1px solid #fcd34d; border-radius: var(--radius-sm); flex-wrap: wrap; }
.result-retry .btn-warn { flex-shrink: 0; }
.result-retry-hint { font-size: 11px; color: #92400e; line-height: 1.5; }

/* 检查结果样式 */
.result-success, .result-error {
  text-align: center;
  padding: 24px;
}
.result-icon {
  font-size: 48px;
  margin-bottom: 12px;
}
.result-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.result-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.result-list {
  text-align: left;
  margin-top: 16px;
}
.issue-group {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.issue-group-title {
  background: var(--bg);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.issue-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.2s;
}
.issue-item:last-child {
  border-bottom: none;
}
.issue-item:hover {
  background: var(--bg);
}
.issue-dot {
  color: var(--danger);
  font-size: 10px;
}
.issue-label {
  flex: 1;
  font-size: 13px;
  color: var(--text);
}
.issue-suggestion {
  font-size: 12px;
  color: var(--text-muted);
}
.issue-jump {
  font-size: 12px;
  padding: 4px 8px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: opacity 0.2s;
}
.issue-jump:hover {
  opacity: 0.8;
}
.result-actions {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* ════════════════════════════════════════════
   检查浮动面板
════════════════════════════════════════════ */
.check-panel {
  position: fixed;
  top: 120px;
  right: 30px;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  width: 380px;
  max-height: 60vh;
  overflow: hidden;
}
.check-panel.hidden {
  display: none;
}
.check-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.check-panel-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.check-panel-title.success {
  color: var(--success);
}
.check-panel-title.error {
  color: var(--danger);
}
.check-panel-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  transition: background-color 0.2s;
}
.check-panel-close:hover {
  background: var(--border);
}
.check-panel-content {
  padding: 16px;
  max-height: calc(70vh - 60px);
  overflow-y: auto;
}
.check-panel-upload-failure {
  margin-top: 0;
  line-height: 1.6;
}
.check-success {
  text-align: center;
  padding: 20px;
}
.check-desc {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.check-items {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.check-list {
  margin-bottom: 16px;
}
.check-group {
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.check-group-title {
  background: var(--bg);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.check-item:last-child {
  border-bottom: none;
}
.check-dot {
  color: var(--danger);
  font-size: 10px;
}
.check-label {
  flex: 1;
  font-size: 13px;
  color: var(--text);
}
.check-suggestion {
  font-size: 12px;
  color: var(--text-muted);
}
.check-jump {
  font-size: 12px;
  padding: 4px 8px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: opacity 0.2s;
}
.check-jump:hover {
  opacity: 0.8;
}
.check-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.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) {
  .gpt-project-actions {
    grid-template-columns: 1fr;
  }
  .gpt-replace-actions {
    display: grid;
    align-items: stretch;
  }
  .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-cleanup-panel {
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  padding: 10px 12px;
}
.warehouse-cleanup-status {
  font-size: 13px;
  color: var(--text-muted);
}
.warehouse-cleanup-status b {
  display: block;
  color: var(--text);
  margin-bottom: 2px;
}
.warehouse-cleanup-status span {
  display: block;
}
.warehouse-cleanup-status.err { color: var(--danger); }
.cleanup-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.cleanup-summary b {
  display: block;
  font-size: 13px;
}
.cleanup-summary span {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 2px;
}
.cleanup-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.cleanup-note {
  border: 1px solid #fbbf24;
  background: #fffbeb;
  color: #92400e;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 12px;
  margin-bottom: 10px;
}
.cleanup-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
  margin-top: 8px;
}
.cleanup-section-title {
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.cleanup-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
}
.cleanup-row:last-child { border-bottom: 0; }
.cleanup-row.is-warn { background: #fffbeb; }
.cleanup-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cleanup-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cleanup-main { min-width: 0; }
.cleanup-main b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.cleanup-meta,
.cleanup-offers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 11px;
}
.cleanup-meta code,
.cleanup-offers code {
  background: var(--bg);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 11px;
}
.cleanup-ok {
  color: var(--success);
  font-weight: 600;
}
.cleanup-warn {
  color: #b45309;
  font-weight: 600;
}
.cleanup-paused {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.cleanup-empty {
  padding: 12px;
  color: var(--text-muted);
  font-size: 12px;
}

.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-category-tag {
  background: #eef2ff;
  color: #3730a3;
  border-radius: 8px;
  padding: 1px 7px;
}
.warehouse-category-tag.warn {
  background: #fffbeb;
  color: #92400e;
}

.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; }
.warehouse-edit-btn { margin-left: 10px; white-space: nowrap; }

/* 历史列表缩略图 + 操作按钮 */
.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-field {
  margin-bottom: 14px;
}
.source-url-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #c2410c;
  margin-bottom: 4px;
}
.source-url-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 6px;
}
.source-url-hint {
  font-size: 11px;
  color: #9a9a9a;
  margin-top: 3px;
}
.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.replace { color: #2563eb; 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; }

/* ════════════════════════════════════════════
   翻译外链(导出 / 导入)
════════════════════════════════════════════ */
.translate-status {
  font-size: 13px;
  color: var(--text-muted, #6e7781);
  line-height: 1.6;
  margin-bottom: 12px;
}
.translate-status.err { color: #d73a49; }
.translate-status.ok  { color: #1a7f37; }
.translate-link-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 8px 0 12px;
}
.translate-link-row input {
  flex: 1;
  padding: 8px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  border: 1px solid var(--border-mid, #d0d7de);
  border-radius: 6px;
  background: #f6f8fa;
}
.translate-tip {
  font-size: 12px;
  color: var(--text-muted, #6e7781);
  background: #fff8e1;
  border-left: 3px solid #f59e0b;
  padding: 8px 10px;
  border-radius: 4px;
  line-height: 1.6;
}
.translate-import-input {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  padding: 10px;
  border: 1px solid var(--border-mid, #d0d7de);
  border-radius: 6px;
  resize: vertical;
}
.translate-diff {
  margin-top: 12px;
  border: 1px solid var(--border-mid, #d0d7de);
  border-radius: 6px;
  overflow: hidden;
}
.translate-diff-row {
  display: grid;
  grid-template-columns: 120px 1fr 1fr;
  gap: 8px;
  padding: 8px 10px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-mid, #d0d7de);
}
.translate-diff-row:last-child { border-bottom: 0; }
.translate-diff-row.head { background: #f6f8fa; font-weight: 600; font-size: 12px; }
.translate-diff-key {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--text-muted, #6e7781);
}
.translate-diff-old {
  color: #6e7781;
  white-space: pre-wrap;
  word-break: break-word;
}
.translate-diff-new {
  color: #1f2937;
  white-space: pre-wrap;
  word-break: break-word;
  background: #ecfdf5;
  padding: 4px 6px;
  border-radius: 4px;
}
.translate-diff-row.unchanged .translate-diff-new {
  background: transparent;
  color: var(--text-muted, #6e7781);
}

/* ════════════════════════════════════════════
   图片预览弹窗
════════════════════════════════════════════ */
#img-preview-modal {
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
}
#img-preview-modal.hidden {
  display: none;
}
.img-preview-wrapper {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}
#img-preview-img {
  max-width: 90vw;
  max-height: calc(90vh - 50px);
  object-fit: contain;
  border-radius: var(--radius-md);
  background: #000;
}
.img-preview-close {
  position: absolute;
  top: -36px;
  right: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.img-preview-close:hover {
  background: rgba(255, 255, 255, 0.35);
}
.img-preview-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
}
.img-preview-footer .btn-ghost {
  color: rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 255, 255, 0.3);
}

/* ── 定价规则设置（紧凑网格）─────────────────────────────── */
.pf-card {
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.pf-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
.pf-rule-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.pf-title-input {
  flex: 1;
  border: 1px solid transparent;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding: 2px 5px;
  border-radius: 4px;
}
.pf-title-input:hover { border-color: var(--border); background: #fff; }
.pf-title-input:focus { border-color: var(--primary); background: #fff; outline: none; }

.pf-card-body { padding: 6px 10px; }
.pf-grid { display: grid; gap: 6px; margin-bottom: 6px; }
.pf-grid:last-child { margin-bottom: 0; }
.pf-grid-3 { grid-template-columns: repeat(3, 1fr); }
.pf-grid-4 { grid-template-columns: repeat(4, 1fr); }
.pf-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.pf-label {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}
.pf-input-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
}
.pf-input {
  width: 100%;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  box-sizing: border-box;
  height: 28px;
}
.pf-input:hover { border-color: #94a3b8; }
.pf-input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 2px rgba(37,99,235,.1); }
.pf-suffix {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.pf-cost { color: #64748b; font-weight: 600; }
.pf-profit-good { color: #16a34a; font-weight: 600; }
.pf-profit-bad { color: #dc2626; font-weight: 600; }

/* 试算结果 */
.pf-trial-result {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  white-space: nowrap;
}
.pf-trial-result b { font-size: 12px; }
.pf-trial-none {
  background: #f8fafc;
  border: 1px dashed #e2e8f0;
  color: #94a3b8;
}
.pf-trial-ok {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}
