/* ==========================================================================
   GZ虾皮采集上传系统 — 全局样式
   配色：CSS 变量 + 多套「马卡龙」主题（data-theme 切换，见底部主题块）。
   语义色（绿/红/黄/蓝）全局统一不随主题，品牌色（bg/主色/边框等）随主题变化。
   ========================================================================== */

:root {
  /* —— 默认主题 = 蜜桃粉（马卡龙）—— */
  --bg: #faf4f2;
  --panel: #ffffff;
  --border: #f0e3e6;
  --border-strong: #e0ccd1;
  --text: #3d2c33;
  --muted: #8a7a80;
  --faint: #b3a4aa;
  --primary: #e07b91;
  --primary-hover: #cc6880;
  --primary-btn: #b8526b;
  --primary-soft: #fbe9ee;
  --hover-bg: #f5eaec;
  --panel-2: #fbf5f6;
  --panel-3: #f4eaec;
  --thumb-bg: #f3e9eb;

  /* —— 语义色（全局统一，不随主题变化）—— */
  --green: #10b981;
  --green-strong: #16a34a;
  --green-soft: #ecfdf5;
  --green-border: #d1fae5;
  --red: #dc2626;
  --red-strong: #b91c1c;
  --red-soft: #fef2f2;
  --red-soft-2: #fdf3f3;
  --red-border: #fecaca;
  --red-border-strong: #fca5a5;
  --amber: #f59e0b;
  --amber-strong: #b45309;
  --amber-soft: #fff7ed;
  --amber-border: #fed7aa;
  --blue: #3b82f6;
  --blue-soft: #eff6ff;
  --indigo-soft: #eef2ff;
  --indigo-border: #c7d2fe;
  --orange-strong: #ea580c;

  /* —— 圆角 / 阴影 —— */
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(31, 41, 55, .04), 0 4px 12px rgba(31, 41, 55, .05);
  --shadow-lg: 0 16px 40px rgba(31, 41, 55, .14);
}

/* ===== 主题：薄荷绿 ===== */
:root[data-theme="mint"] {
  --bg: #f2f8f5; --panel: #ffffff; --border: #dcebe3; --border-strong: #c6dcd1;
  --text: #243a33; --muted: #71877f; --faint: #a1b6ad;
  --primary: #3f9e7c; --primary-hover: #348a6a; --primary-btn: #2f7d60; --primary-soft: #e2f2eb;
  --hover-bg: #e8f2ed; --panel-2: #f5faf7; --panel-3: #e9f3ee; --thumb-bg: #e6efe9;
}

/* ===== 主题：香芋紫 ===== */
:root[data-theme="taro"] {
  --bg: #f5f4fb; --panel: #ffffff; --border: #e4e0f2; --border-strong: #d3cde8;
  --text: #2f2a45; --muted: #7b7692; --faint: #a9a4bd;
  --primary: #8d7fd0; --primary-hover: #7a6cbe; --primary-btn: #6a5cb8; --primary-soft: #edeafa;
  --hover-bg: #efecf7; --panel-2: #f8f7fc; --panel-3: #efeef7; --thumb-bg: #eae9f3;
}

/* ===== 主题：奶油黄 ===== */
:root[data-theme="lemon"] {
  --bg: #faf7ee; --panel: #ffffff; --border: #eee6cd; --border-strong: #e0d4b0;
  --text: #3d3523; --muted: #8a8065; --faint: #b3a887;
  --primary: #d99a2b; --primary-hover: #c58724; --primary-btn: #b07a14; --primary-soft: #f9efd8;
  --hover-bg: #f6ecd7; --panel-2: #fbf9f2; --panel-3: #f3eedd; --thumb-bg: #f0e9d4;
}

/* ===== 主题：天青蓝 ===== */
:root[data-theme="sky"] {
  --bg: #f3f7fb; --panel: #ffffff; --border: #dce6f2; --border-strong: #c8d7e8;
  --text: #28303d; --muted: #74808f; --faint: #a3aec0;
  --primary: #6f9bd0; --primary-hover: #5d88bd; --primary-btn: #4a74a8; --primary-soft: #e7f0f9;
  --hover-bg: #e9f0f7; --panel-2: #f6f9fc; --panel-3: #eaf1f8; --thumb-bg: #e6edf5;
}

/* ===== 主题：经典虾皮橙 ===== */
:root[data-theme="shopee"] {
  --bg: #f4f6f9; --panel: #ffffff; --border: #e3e8ef; --border-strong: #cbd5e1;
  --text: #1f2937; --muted: #6b7280; --faint: #9ca3af;
  --primary: #ee4d2d; --primary-hover: #d63d1f; --primary-btn: #c63a1c; --primary-soft: #fdeeea;
  --hover-bg: #f0f2f5; --panel-2: #f8fafc; --panel-3: #f1f5f9; --thumb-bg: #eef1f5;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Noto Sans TC", sans-serif;
  background:
    radial-gradient(1100px 520px at 100% -8%, var(--primary-soft), transparent 62%),
    radial-gradient(900px 480px at -6% 0%, var(--panel-2), transparent 60%),
    var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}

/* 更精致的焦点环（键盘导航） */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

/* 细滚动条（贴合主题） */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--faint); border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ===== 顶栏 ===== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 20px;
  padding: 0 20px; height: 56px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.brand { font-size: 16px; font-weight: 800; white-space: nowrap; letter-spacing: .2px; }
.tabs { display: flex; gap: 4px; }
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  border: none; background: transparent; cursor: pointer;
  padding: 8px 15px; border-radius: 9px; font-size: 14px; color: var(--muted);
  transition: background .15s, color .15s;
}
.tab:hover { background: var(--hover-bg); color: var(--text); }
.tab.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }

/* 顶栏内联 SVG 图标（去 emoji 后的干净线条图标） */
.ico { width: 16px; height: 16px; flex: none; color: currentColor; }
.brand .ico { width: 18px; height: 18px; margin-right: 8px; vertical-align: -3px; color: var(--primary); }

main { max-width: 1680px; margin: 0 auto; padding: 20px; }
/* 全宽页（商品列表 / AI 优化 / 上传）：消除 main 的 max-width 造成的左右两侧空白，
   让左栏固定宽度 + 右栏自适应铺满整个横向空间 */
main:has(#page-products.active),
main:has(#page-optimize.active),
main:has(#page-upload.active) { max-width: none; }

.page { display: none; }
.page.active { display: block; }

/* ===== 通用 ===== */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input[type="text"], .toolbar input[type="search"] {
  flex: 1; min-width: 220px; max-width: 420px;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; outline: none; background: var(--panel); color: var(--text);
}
.toolbar input:focus { border-color: var(--primary); }
.page-size-sel {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; background: var(--panel); color: var(--text); outline: none; cursor: pointer;
}
.page-size-sel:focus { border-color: var(--primary); }

.btn {
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer; font-size: 14px;
  transition: background .15s, border-color .15s, color .15s, transform .1s, filter .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--border-strong); background: var(--panel-2); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary-btn); border-color: var(--primary-btn); color: #fff; }
.btn-primary:hover { background: var(--primary-btn); border-color: var(--primary-btn); filter: brightness(1.08); }
.btn-danger { color: var(--red); border-color: var(--red-border); }
.btn-danger:hover { background: var(--red-soft); border-color: var(--red-border-strong); }
.btn-sm { padding: 4px 10px; font-size: 13px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.muted { color: var(--muted); font-size: 13px; }
code { background: var(--panel-3); padding: 2px 6px; border-radius: 5px; font-size: 12px; color: var(--text); }

/* ===== 商品列表 ===== */
.list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; transition: border-color .15s, transform .15s, box-shadow .15s;
  display: flex; flex-direction: column;
}
.card:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card-thumb { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--thumb-bg); display: block; }
.card-body { padding: 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-name {
  font-weight: 600; font-size: 14px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 40px;
}
.card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 20px; font-weight: 500; }
.badge-platform { background: var(--indigo-soft); color: var(--blue); }
.badge-shopee { background: var(--primary-soft); color: var(--primary); }
.badge-pdd { background: var(--red-soft-2); color: var(--red); }
.badge-1688 { background: var(--amber-soft); color: var(--orange-strong); }
.badge-status { background: var(--panel-3); color: var(--muted); }
.badge-status.ready { background: var(--green-soft); color: var(--green); }
.badge-status.uploaded { background: var(--green-soft); color: var(--green); }
.badge-status.failed { background: var(--red-soft); color: var(--red); }
.badge-status.optimized { background: var(--blue-soft); color: var(--blue); }
.badge-status.queued { background: var(--panel-3); color: var(--muted); }
.badge-status.uploading { background: var(--blue-soft); color: var(--blue); }
.card-price { font-size: 16px; font-weight: 700; color: var(--primary-btn); }
.card-price .cur { font-size: 12px; color: var(--muted); font-weight: 400; margin-right: 2px; }
.card-foot { margin-top: auto; }
.card-foot .mini-btn { width: 100%; margin-right: 0; padding: 6px 10px; }

.empty { text-align: center; color: var(--muted); padding: 60px 0; font-size: 15px; }
.empty .big { font-size: 48px; display: block; margin-bottom: 12px; }

/* ===== 左树右列表布局 ===== */
.split-layout { display: flex; align-items: flex-start; gap: 16px; }
.tree-side {
  flex: 0 0 260px; width: 260px;
  position: sticky; top: 76px;
  max-height: calc(100vh - 96px);
  overflow-y: auto; overflow-x: hidden;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; box-shadow: var(--shadow);
}
.list-main { flex: 1; min-width: 0; }

/* ===== 文件夹栏（树形，可嵌套） ===== */
.folder-bar { margin-bottom: 14px; }
.folder-root-drop { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }

/* 树侧栏：纵向、整洁（树头 + 树体 + 整行节点） */
.folder-tree .tree-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 10px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.folder-tree .tree-title { font-size: 13px; font-weight: 700; color: var(--text); }
.folder-tree .tree-add { border: none; background: transparent; color: var(--primary); cursor: pointer; font-size: 15px; line-height: 1; padding: 3px 7px; border-radius: 6px; }
.folder-tree .tree-add:hover { background: var(--primary-soft); }
.folder-tree .tree-body { display: flex; flex-direction: column; gap: 2px; }
.folder-tree .tree-hint { font-size: 11px; color: var(--faint); padding: 6px 4px 2px; line-height: 1.5; }
.folder-tree .folder-chip {
  display: flex; align-items: center; gap: 6px; width: 100%;
  border: none; background: transparent; color: var(--text);
  padding: 6px 8px; border-radius: 7px; cursor: pointer; font-size: 13px;
  text-align: left; font-family: inherit; white-space: nowrap;
  transition: background .12s, color .12s;
}
.folder-tree .folder-chip:hover { background: var(--hover-bg); color: var(--text); }
.folder-tree .folder-chip.active { background: var(--primary-soft); color: var(--primary-btn); font-weight: 600; }
.folder-tree .folder-chip .fc { margin-left: auto; font-size: 11px; opacity: .6; font-weight: 400; }
.folder-tree .folder-node { position: relative; border-radius: 7px; }
.folder-tree .folder-node:hover { background: var(--hover-bg); }
.folder-tree .folder-toggle { flex: 0 0 14px; width: 14px; height: 16px; display: inline-flex; align-items: center; justify-content: center; color: var(--faint); cursor: pointer; font-size: 9px; user-select: none; }
.folder-tree .folder-act { opacity: 0; transition: opacity .12s; }
.folder-tree .folder-node:hover .folder-act { opacity: 1; }

/* AI 优化页左侧文件夹树（面板内，限高滚动） */
.opt-folder-tree { max-height: 200px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px; background: var(--panel-2); }
.folder-node {
  display: flex; align-items: center; gap: 5px;
  padding-top: 3px; padding-bottom: 3px; width: 100%;
}
.folder-node.dragging { opacity: .4; }
.folder-node.drag-over, .folder-chip.drag-over { background: var(--primary-soft); border-radius: var(--radius-sm); outline: 2px dashed var(--primary); outline-offset: 2px; }
.folder-toggle {
  flex: 0 0 16px; width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted); cursor: pointer; font-size: 10px; user-select: none;
}
.folder-toggle.ph { cursor: default; }
.folder-chip {
  display: inline-flex; align-items: center;
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  padding: 5px 13px; border-radius: 20px; cursor: pointer; font-size: 13px;
  transition: background .15s, border-color .15s, color .15s; white-space: nowrap; font-family: inherit;
}
.folder-chip:hover { border-color: var(--primary); color: var(--primary); }
.folder-chip.active { background: var(--primary-btn); border-color: var(--primary-btn); color: #fff; font-weight: 600; }
.folder-chip .fc { font-size: 12px; opacity: .7; margin-left: 5px; }
.folder-chip.add { border-style: dashed; color: var(--muted); }
.folder-chip.add:hover { color: var(--primary); border-color: var(--primary); }
.folder-chip[draggable="true"] { cursor: grab; }
.folder-chip[draggable="true"]:active { cursor: grabbing; }
.folder-act {
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 13px; padding: 4px 6px; border-radius: 6px; line-height: 1;
}
.folder-act:hover { background: var(--hover-bg); color: var(--primary); }
/* 子账户虚拟父节点：加粗 + 主色，与普通文件夹区分 */
.folder-tree .folder-owner { padding-left: 0; }
.folder-tree .folder-owner .folder-chip { font-weight: 600; color: var(--primary-btn); }
.folder-tree .folder-owner .folder-chip.active { background: var(--primary-soft); color: var(--primary-btn); }

/* ===== 编辑页 ===== */
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.panel h2 { margin: 0 0 4px; font-size: 16px; font-weight: 700; letter-spacing: .2px; }
.panel .sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.form-grid > * { min-width: 0; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; outline: none; font-family: inherit; background: var(--panel); color: var(--text);
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--primary); }
.field .hint { font-size: 12px; color: var(--faint); margin-top: 3px; }

.editor-actions {
  position: sticky; bottom: 0; background: var(--panel); border-top: 1px solid var(--border);
  padding: 14px 0; margin-top: 20px; display: flex; gap: 12px; align-items: center;
}
.spacer { flex: 1; }

/* 图片列表 */
.img-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.img-cell {
  position: relative; width: 96px; height: 96px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden; background: var(--thumb-bg);
}
.img-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-cell .del {
  position: absolute; top: 2px; right: 2px; width: 22px; height: 22px;
  border: none; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff;
  cursor: pointer; font-size: 12px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.img-cell .del:hover { background: var(--primary); }
.img-cell .idx {
  position: absolute; bottom: 2px; left: 2px; background: rgba(0,0,0,.5); color: #fff;
  font-size: 11px; padding: 1px 5px; border-radius: 4px;
}
.img-cell .mv {
  position: absolute; top: 2px; width: 22px; height: 22px; border: none;
  background: rgba(0,0,0,.55); color: #fff; cursor: pointer; font-size: 12px; line-height: 1;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.img-cell .mv-l { left: 2px; }
.img-cell .mv-r { left: 28px; }
.img-cell .mv:hover { background: var(--blue); }
.img-add {
  width: 96px; height: 96px; border: 1px dashed var(--border); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--muted);
  font-size: 12px; text-align: center; background: var(--panel-2); transition: border-color .15s, color .15s, background .15s;
}
.img-add:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

/* 规格 / SKU */
.row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.chk { display: flex; align-items: center; gap: 4px; font-size: 13px; white-space: nowrap; color: var(--text); cursor: pointer; }
.chk input { margin: 0; accent-color: var(--primary); }
.row input { flex: 1; padding: 8px 10px; border: 1px solid var(--border); border-radius: 7px; font-size: 13px; outline: none; background: var(--panel); color: var(--text); }
.row input:focus { border-color: var(--primary); }
.row .mini { flex: 0 0 90px; }
.row .rm { flex: 0 0 auto; }
.subhead { font-size: 13px; font-weight: 600; color: var(--text); margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }
.subhead .add-mini { font-size: 12px; color: var(--blue); cursor: pointer; font-weight: 400; }
.subhead .add-mini:hover { text-decoration: underline; }

/* AI 多中转站列表 */
.ai-relay-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.ai-relay-row input { padding: 8px 10px; border: 1px solid var(--border); border-radius: 7px; font-size: 13px; outline: none; background: var(--panel); color: var(--text); }
.ai-relay-row input:focus { border-color: var(--primary); }
.ai-relay-row .relay-name { flex: 0 0 130px; }
.ai-relay-row .relay-url { flex: 1; min-width: 0; }
.ai-relay-row .relay-key { flex: 1; min-width: 0; }
.ai-relay-row .relay-del { flex: 0 0 auto; width: 32px; height: 32px; border: none; border-radius: 7px; background: var(--red-soft); color: var(--red); cursor: pointer; font-size: 14px; line-height: 1; }
.ai-relay-row .relay-del:hover { background: var(--red-border); }

/* SKU 表 */
table.sku { width: 100%; border-collapse: collapse; font-size: 13px; }
table.sku th, table.sku td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; }
table.sku th { background: var(--panel-2); color: var(--muted); font-weight: 500; }
table.sku td input { width: 100%; border: none; outline: none; font-size: 13px; background: transparent; color: var(--text); }
.m-thumb { width: 130px; height: 130px; margin-bottom: 3px; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; background: var(--thumb-bg); }
.m-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }

/* 占位页 */
.placeholder { text-align: center; color: var(--muted); padding: 80px 20px; }
.placeholder .ph-icon { font-size: 56px; margin-bottom: 12px; }
.placeholder h2 { color: var(--text); font-size: 18px; margin: 0 0 8px; }

/* toast */
#toast {
  position: fixed; top: 72px; right: 20px; z-index: 100;
  background: #111827; color: #fff; padding: 10px 18px; border-radius: var(--radius-sm);
  font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.25); opacity: 0; transform: translateY(-6px);
  transition: all .25s; pointer-events: none; max-width: 360px;
}
#toast.show { opacity: 1; transform: translateY(0); }
#toast.err { background: var(--red); }
#toast.ok { background: var(--green); }

/* 返回按钮 */
.back-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.back-bar h1 { font-size: 18px; margin: 0; font-weight: 700; letter-spacing: .3px; }

/* ===== 卡片多选 ===== */
.card { position: relative; }
.card-check {
  position: absolute; top: 8px; left: 8px; z-index: 3;
  width: 24px; height: 24px; background: rgba(255,255,255,.9);
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.25); cursor: pointer;
}
.card-check input { width: 16px; height: 16px; cursor: pointer; margin: 0; accent-color: var(--primary); }
.card.selected { outline: 2px solid var(--primary); outline-offset: -2px; }
.card-del {
  position: absolute; top: 8px; right: 8px; z-index: 4;
  width: 24px; height: 24px; border: none; border-radius: 50%;
  background: rgba(255,255,255,.92); color: var(--red); cursor: pointer;
  font-size: 16px; line-height: 1; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.25); transition: background .15s, color .15s;
}
.card-del:hover { background: var(--red); color: #fff; }

/* ===== 批量编辑弹窗 ===== */
.modal-mask {
  position: fixed; top: 72px; right: 16px; z-index: 300;
  width: 660px; max-width: calc(100vw - 32px);
}
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; width: 100%;
  box-shadow: 0 24px 64px rgba(0,0,0,.32); animation: pop .18s ease;
  display: flex; flex-direction: column;
  max-height: calc(100vh - 100px);
}
@keyframes pop { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 20px;
  border-bottom: 1px solid var(--border); cursor: move; user-select: none;
}
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 16px 20px; max-height: 55vh; overflow-y: auto; flex: 1 1 auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--border); flex: 0 0 auto; }

/* ===== 批量编辑：标签页形式（切到哪个标签默认开始修改哪一项） ===== */
.batch-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.batch-tab {
  padding: 7px 12px; border: 1px solid var(--border); border-radius: 20px;
  background: var(--panel); font-size: 13px; color: var(--muted); cursor: pointer;
  white-space: nowrap; font-family: inherit; transition: color .15s, border-color .15s, background .15s;
}
.batch-tab:hover { color: var(--primary); border-color: var(--primary); }
.batch-tab.active { background: var(--primary-btn); border-color: var(--primary-btn); color: #fff; font-weight: 600; }
.batch-panel { display: none; }
.batch-panel.active { display: block; }
.batch-panel .batch-sec { border: none; border-bottom: 1px dashed var(--border); border-radius: 0; padding: 10px 0; margin-bottom: 0; }
.batch-panel .batch-sec:last-child { border-bottom: none; padding-bottom: 0; }

.batch-sec { border: 1px solid var(--border); border-radius: 9px; padding: 12px 14px; margin-bottom: 12px; }
.batch-sec .sec-label { font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.batch-sec:not(.on):not(.always-on) .be-fields { opacity: .45; }
.be-fields { margin-top: 4px; }
.be-fields.row { align-items: center; }
.be-fields .field input { width: 100%; }
.mini-sel {
  flex: 0 0 130px; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 7px; font-size: 13px; background: var(--panel); color: var(--text); outline: none;
}
.mini-sel:focus { border-color: var(--primary); }
.be-fields input[type="number"], .be-fields input[type="text"] {
  flex: 1; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 7px; font-size: 13px; outline: none; min-width: 0; background: var(--panel); color: var(--text);
}
.be-fields input:focus { border-color: var(--primary); }
.be-fields textarea {
  width: 100%; min-height: 96px; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 7px; font-size: 13px; font-family: inherit; resize: vertical; outline: none; background: var(--panel); color: var(--text);
}
.be-fields textarea:focus { border-color: var(--primary); }
.be-fields > input[type="text"], .be-fields > input[type="number"] { width: 100%; }
.be-fields select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 7px; font-size: 13px; background: var(--panel); color: var(--text); outline: none; font-family: inherit;
}
.be-fields select:focus { border-color: var(--primary); }
.be-fields .muted { white-space: nowrap; }

/* 去重面板 */
.dedup-groups { margin: 8px 0; max-height: 380px; overflow-y: auto; }
.dup-group { border: 1px solid var(--border); border-radius: 9px; margin-bottom: 10px; overflow: hidden; }
.dup-head { padding: 8px 12px; background: var(--panel-2); border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dup-items { display: flex; flex-direction: column; }
.dup-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--panel-3); }
.dup-item:last-child { border-bottom: none; }
.dup-item:hover { background: var(--panel-2); }
.dup-item.keep { background: var(--green-soft); }
.dup-item input[type="radio"] { accent-color: var(--primary); flex: 0 0 auto; }
.dup-thumb { flex: 0 0 40px; width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--thumb-bg); color: var(--muted); font-size: 18px; }
.dup-thumb img { width: 100%; height: 100%; object-fit: cover; }
.dup-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dup-price { font-weight: 700; color: var(--primary-btn); font-size: 14px; }
.dup-price .cur { font-size: 11px; color: var(--muted); font-weight: 400; margin-right: 2px; }
.dup-sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dup-keep-tag { flex: 0 0 auto; font-size: 11px; font-weight: 600; color: var(--faint); }
.dup-item.keep .dup-keep-tag { color: var(--green); }

/* 回收站 */
.trash-list { margin-top: 10px; max-height: 440px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.trash-item {
  display: flex; align-items: center; gap: 12px;
  padding: 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel);
}
.trash-thumb {
  width: 56px; height: 56px; border-radius: 8px; object-fit: cover; flex-shrink: 0;
  background: var(--thumb-bg); display: flex; align-items: center; justify-content: center; font-size: 22px; color: var(--muted);
}
.trash-info { flex: 1; min-width: 0; }
.trash-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trash-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }

.lc-name-fixed {
  flex: 0 0 auto; min-width: 120px; max-width: 220px; font-size: 13px; font-weight: 500;
  padding: 8px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.len-cap {
  font-size: 11px; font-weight: 400; color: var(--amber); background: var(--amber-soft);
  border: 1px solid var(--amber-border); padding: 1px 6px; border-radius: 20px; margin-left: 2px;
}
.sub-label { font-size: 12px; color: var(--muted); font-weight: 600; margin: 12px 0 6px; }
.clean-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 14px; }
.clean-grid .chk { font-size: 13px; }

/* ===== 视图切换 ===== */
.view-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.view-btn {
  border: none; background: var(--panel); color: var(--muted);
  padding: 7px 14px; cursor: pointer; font-size: 13px; transition: background .15s, color .15s;
}
.view-btn + .view-btn { border-left: 1px solid var(--border); }
.view-btn.active { background: var(--primary-btn); color: #fff; font-weight: 600; }

/* ===== 表格视图（詳細展示） ===== */
.list.table-mode { display: block; }
.table-wrap {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow-x: auto;
}
table.ptable { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 1100px; }
table.ptable th, table.ptable td {
  padding: 5px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle;
}
table.ptable thead th { background: var(--panel-2); color: var(--muted); font-weight: 600; white-space: nowrap; }
table.ptable tbody tr { cursor: default; }
table.ptable tbody tr:hover { background: var(--panel-2); }
table.ptable tbody tr.selected { background: var(--primary-soft); }
table.ptable tbody tr:last-child td { border-bottom: none; }
.col-chk { width: 40px; text-align: center; }
.col-chk input { width: 16px; height: 16px; cursor: pointer; margin: 0; accent-color: var(--primary); }
.col-thumb { width: 72px; }
.col-thumb img { width: 60px; height: 60px; object-fit: cover; border-radius: 6px; background: var(--thumb-bg); display: block; }
.col-thumb .thumb-ph { width: 60px; height: 60px; display: flex; align-items: center; justify-content: center; background: var(--thumb-bg); border-radius: 6px; font-size: 22px; }
.col-name { min-width: 260px; }
.tname { font-weight: 600; line-height: 1.3; white-space: nowrap; }
.tsub { margin-top: 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.col-price { white-space: nowrap; font-weight: 700; color: var(--primary-btn); font-size: 15px; }
.col-price .cur { font-size: 12px; color: var(--muted); font-weight: 400; margin-right: 1px; }
.col-desc { max-width: 160px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.col-spec { white-space: nowrap; text-align: center; font-weight: 600; }
.col-days { white-space: nowrap; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--primary); }
.sort-arrow { margin-left: 3px; font-size: 11px; color: var(--muted); font-weight: 400; }
.sort-arrow.active { color: var(--primary); }
.pre-badge {
  font-size: 11px; color: var(--amber); background: var(--amber-soft); border: 1px solid var(--amber-border);
  padding: 0 5px; border-radius: 20px; margin-left: 4px;
}
.owner-badge {
  font-size: 11px; color: var(--primary); background: var(--indigo-soft); border: 1px solid var(--indigo-border);
  padding: 0 5px; border-radius: 20px; margin-left: 4px; white-space: nowrap;
}
.col-ops { white-space: nowrap; }
.mini-btn {
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  padding: 3px 9px; border-radius: 6px; cursor: pointer; font-size: 12px; margin-right: 4px; transition: border-color .12s, color .12s, background .12s;
}
.mini-btn:hover { border-color: var(--primary); color: var(--primary); }
.mini-btn.danger { color: var(--red); border-color: var(--red-border); }
.mini-btn.danger:hover { background: var(--red-soft); border-color: var(--red-border-strong); }
.mini-btn:disabled { opacity: .4; cursor: not-allowed; }
.mini-btn:disabled:hover { border-color: var(--border); color: var(--text); }

/* ===== 批量结果弹窗 ===== */
.batch-result {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%);
  z-index: 9000; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; width: 440px; max-width: 92vw;
  max-height: 72vh; display: flex; flex-direction: column;
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
  transition: opacity .3s ease;
}
.batch-result.br-hide { opacity: 0; pointer-events: none; }
.batch-result .br-head {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.batch-result .br-body { overflow: auto; padding: 6px 0; }
.batch-result .br-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 16px; border-bottom: 1px solid var(--panel-3); font-size: 13px;
}
.batch-result .br-row:last-child { border-bottom: none; }
.batch-result .br-ic { width: 16px; text-align: center; flex-shrink: 0; }
.batch-result .br-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-result .br-err { color: var(--red); font-size: 12px; white-space: nowrap; flex-shrink: 0; }
.batch-result .br-foot { padding: 10px 16px; border-top: 1px solid var(--border); text-align: right; }

/* ===== AI 优化页 ===== */
.opt-layout { display: flex; align-items: flex-start; }
.opt-side {
  flex: 0 0 var(--opt-side-w, 720px); width: var(--opt-side-w, 720px);
  position: sticky; top: 76px; align-self: flex-start;
  max-height: calc(100vh - 100px); overflow-y: auto; overflow-x: hidden;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.opt-side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.opt-side-head h2 { font-size: 18px; margin: 0; }
.opt-splitter {
  flex: 0 0 16px; width: 16px; position: sticky; top: 76px; align-self: flex-start;
  height: calc(100vh - 100px); margin: 0 2px;
  cursor: col-resize; user-select: none; touch-action: none;
  display: flex; align-items: center; justify-content: center;
}
.opt-splitter::before {
  content: ''; width: 4px; height: 56px; border-radius: 2px; background: var(--border);
  transition: background .15s;
}
.opt-splitter:hover::before, .opt-splitter.dragging::before { background: var(--primary); }
.opt-splitter.locked { cursor: default; }
.opt-splitter.locked::before { background: var(--border-strong); }
.opt-side .field { margin-bottom: 10px; }
.opt-collapse-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--panel); cursor: pointer; font-size: 13px; color: var(--text);
  font-family: inherit; text-align: left;
}
.opt-collapse-head:hover { border-color: var(--primary); color: var(--primary); }
.opt-collapse-arrow { transition: transform .15s; font-size: 12px; color: var(--muted); flex-shrink: 0; }
.opt-collapse-head.open .opt-collapse-arrow { transform: rotate(90deg); }
.opt-collapse-body { margin-top: 8px; }
.opt-collapse-body textarea { width: 100%; min-height: 72px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; outline: none; resize: vertical; background: var(--panel); color: var(--text); }
.opt-collapse-body textarea:focus { border-color: var(--primary); }
.opt-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.opt-actions .btn { flex: 1 1 auto; min-width: 0; white-space: nowrap; }
.opt-conc {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted); white-space: nowrap; padding: 0 2px; cursor: default;
}
.opt-conc input { width: 64px; padding: 5px 6px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; background: var(--panel); color: var(--text); }

/* 批量生成失败面板 */
.opt-fail-panel { margin-top: 12px; }

/* 生成进展日志框（参考 GZ虾皮ai運營助手 的 .log 样式） */
.opt-log-wrap { margin-top: 12px; }
.opt-log-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.opt-log-head span { font-size: 13px; font-weight: 600; color: var(--muted); }
.opt-log-head .btn { padding: 2px 8px; font-size: 12px; }
.opt-log {
  margin: 0; padding: 10px;
  background: #0f172a; color: #cbd5e1;
  font-family: ui-monospace, Consolas, "SF Mono", Menlo, monospace;
  font-size: 11px; line-height: 1.6;
  border-radius: var(--radius-sm); white-space: pre-wrap; word-break: break-all;
  max-height: 220px; overflow-y: auto;
}
.opt-fail-head { font-size: 13px; font-weight: 600; color: var(--red); margin-bottom: 6px; }
.opt-fail-item {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  padding: 5px 8px; border: 1px solid var(--red-border); border-radius: 6px; background: var(--red-soft); margin-bottom: 4px;
}
.opt-fail-name { font-size: 13px; font-weight: 600; color: var(--text); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt-fail-kind { font-size: 12px; color: var(--red-strong); }
.opt-fail-err { font-size: 12px; color: var(--muted); flex: 1 1 100%; }
.opt-fail-panel #optRetryFailBtn { margin-top: 6px; }

/* 商品列表分页 */
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; padding: 10px 2px 4px; flex-wrap: wrap; }
.pager-btns { display: inline-flex; align-items: center; gap: 6px; }
.pager .pg-num { min-width: 30px; padding: 5px 8px; }
.pager .pg-num.active { background: var(--primary-btn); color: #fff; border-color: var(--primary-btn); }
.opt-main { flex: 1; min-width: 0; }
.opt-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }

.opt-bar { display: flex; gap: 16px; flex-wrap: wrap; }
.opt-bar .opt-folder { flex: 0 0 180px; min-width: 160px; }
.opt-bar .opt-product { flex: 1 1 320px; min-width: 240px; }
.opt-bar .opt-mode { flex: 1 1 320px; min-width: 240px; }
.opt-bar select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; background: var(--panel); color: var(--text); outline: none; font-family: inherit;
}
.opt-bar select:focus { border-color: var(--primary); }

.opt-result { margin-top: 4px; }
.opt-sec-head { font-size: 13px; font-weight: 600; color: var(--muted); margin: 18px 0 8px; }
.opt-product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; touch-action: none; user-select: none; -webkit-user-select: none; }
.opt-prod-card {
  position: relative;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s; display: flex; flex-direction: column;
}
.opt-prod-card:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.opt-prod-card.selected { outline: 2px solid var(--primary); outline-offset: -2px; }
.opt-prod-card::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  border-radius: var(--radius);
  background: rgba(16, 185, 129, .16);
  box-shadow: inset 0 0 0 2px var(--green);
  opacity: 0;
  transition: opacity .15s;
}
.opt-prod-card.checked::after { opacity: 1; }
.opt-prod-check {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255,255,255,.92); color: var(--faint);
  border: 2px solid var(--border-strong);
  font-size: 14px; line-height: 1; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
}
.opt-prod-card.checked .opt-prod-check { background: var(--green); border-color: var(--green); color: #fff; }
.opt-product-grid.locked .opt-prod-check { opacity: .4; cursor: not-allowed; }
.opt-prod-repl {
  position: absolute; top: 6px; left: 38px; z-index: 2;
  padding: 2px 6px; border-radius: 9px; font-size: 10px; line-height: 1.4;
  background: var(--primary-btn); color: #fff; font-weight: 600;
}
.replaced-badge {
  display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 10px;
  background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 600; vertical-align: middle;
}
.opt-prod-view {
  position: absolute; top: 6px; left: 6px; z-index: 2;
  width: 28px; height: 28px; border: none; border-radius: 50%;
  background: transparent; color: var(--text); font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: .45; transition: opacity .15s;
}
.opt-prod-card:hover .opt-prod-view { opacity: 1; }
.opt-prod-view:hover { background: rgba(255,255,255,.4); }
.opt-prod-ai {
  position: absolute; bottom: 6px; right: 6px; z-index: 2;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--green); color: #fff; font-size: 12px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.opt-prod-prog {
  position: absolute; bottom: 6px; left: 6px; z-index: 2;
  padding: 2px 6px; border-radius: 10px; font-size: 11px; line-height: 1;
  background: rgba(15,23,42,.62); color: #fff;
}
.opt-prod-card img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; background: var(--thumb-bg); }
.opt-prod-empty { width: 100%; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; color: var(--muted); background: var(--thumb-bg); font-size: 13px; }
.opt-prod-name {
  padding: 8px 10px; font-size: 13px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 36px;
}
.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.opt-cell {
  position: relative; aspect-ratio: 1 / 1; border-radius: var(--radius-sm); overflow: hidden;
  border: 1px solid var(--border); background: var(--thumb-bg);
}
.opt-cell.done { cursor: zoom-in; }
.opt-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.opt-cell-cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 6px;
  background: linear-gradient(transparent, rgba(0,0,0,.6)); color: #fff; font-size: 11px; text-align: left;
}
.opt-cell.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--muted); font-size: 12px; gap: 8px;
}
.opt-cell.empty.failed { border-color: var(--red-border-strong); color: var(--red); background: var(--red-soft); }
.opt-rerun {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px;
  border: none; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; cursor: pointer;
  font-size: 14px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.opt-rerun:hover { background: var(--primary); }
.opt-cell.empty .opt-rerun { position: static; background: var(--blue); }

/* 图片放大预览 */
.zoom-mask {
  top: 0; left: 0; right: auto; bottom: 0; width: 100vw; max-width: none;
  background: rgba(0,0,0,.72); z-index: 400;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.zoom-box { position: relative; }
.zoom-box img { max-width: 90vw; max-height: 82vh; border-radius: 8px; display: block; margin: 0 auto; background: #fff; }

/* 上传页：待上传商品（左）与上传队列（右）左右分栏 */
.up-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.up-col { min-width: 0; display: flex; flex-direction: column; height: calc(100vh - 320px); min-height: 360px; }
.up-col-head { font-size: 14px; font-weight: 600; margin-bottom: 10px; display: flex; align-items: baseline; gap: 8px; }
.up-col-head .muted { font-weight: 400; font-size: 12px; }

/* 待上传商品（虚拟滚动紧凑列表，可容纳上千件） */
.up-scroll {
  position: relative; flex: 1; height: auto; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
}
.up-spacer { position: relative; width: 100%; }
.up-window { position: absolute; top: 0; left: 0; right: 0; will-change: transform; }
.up-row {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto 30px;
  align-items: center; gap: 10px;
  height: 40px; box-sizing: border-box; padding: 0 12px;
  border-bottom: 1px solid var(--border); cursor: pointer;
  background: var(--panel); transition: background .12s;
}
.up-row:hover { background: var(--panel-2); }
.up-row.checked { background: var(--green-soft); }
.up-row-check {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border-strong); color: transparent;
  font-size: 12px; line-height: 1; font-weight: 700;
  display: flex; align-items: center; justify-content: center; transition: all .12s; flex: 0 0 auto;
}
.up-row.checked .up-row-check { background: var(--green); border-color: var(--green); color: #fff; }
.up-row-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-row-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.up-row .badge-status { justify-self: end; white-space: nowrap; }
.up-row-view {
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); background: transparent; border: none; cursor: pointer;
  transition: color .12s, background .12s;
}
.up-row-view:hover { color: var(--primary-btn); background: var(--panel-2); }

/* 上传队列列表（与待上传商品同一套紧凑单行样式） */
.upload-queue {
  display: flex; flex-direction: column; flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
}
.up-queue-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center; gap: 10px;
  height: 40px; box-sizing: border-box; padding: 0 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel); transition: background .12s;
}
.up-queue-item:hover { background: var(--panel-2); }
.up-q-actions { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.up-q-actions .mini-btn { margin-right: 0; }

/* ===== 登录 / 首次设置弹层 ===== */
.auth-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
}
.auth-card {
  width: 360px; max-width: calc(100vw - 40px);
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 28px 26px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.auth-title { font-size: 18px; text-align: center; margin: 0 0 18px; color: var(--text); }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form input {
  width: 100%; padding: 11px 12px; font-size: 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel); color: var(--text);
}
.auth-form .btn-block { width: 100%; padding: 11px; font-size: 15px; }
.auth-err { color: var(--red); font-size: 13px; min-height: 18px; text-align: center; }
.auth-loading { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 14px; padding: 20px 0; }
.auth-spin { width: 18px; height: 18px; border: 2px solid var(--border-strong); border-top-color: var(--primary-btn); border-radius: 50%; animation: spin .7s linear infinite; flex: 0 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 刷新按钮交互动画：刷新中显示转圈 + 禁用，让用户明显感知到正在刷新 */
.btn.loading { cursor: progress; opacity: .82; }
.btn .btn-spin { display: inline-block; width: 13px; height: 13px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; margin-right: 6px; }

/* 顶栏用户区 */
.userbar { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-name-label { font-size: 13px; font-weight: 600; color: var(--text); }
.user-row { align-items: center; gap: 10px; padding: 8px 10px; }
.user-row .user-name { font-weight: 600; min-width: 100px; }

/* 上传实时进度 */
.up-session-ok { color: var(--green-strong); font-weight: 600; }
.up-session-bad { color: var(--red); font-weight: 600; }
.upload-progress {
  margin: 10px 0; padding: 12px 14px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
}
.up-progress-head { display: flex; align-items: center; gap: 12px; font-size: 13px; font-weight: 600; }
.up-progress-nums { color: var(--muted); font-size: 12px; font-weight: 400; }
.up-progress-time { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 400; }
.up-progress-bar { height: 14px; border-radius: 7px; background: var(--thumb-bg); overflow: hidden; margin: 8px 0 12px; }
.up-progress-fill { height: 100%; background: linear-gradient(90deg, #22c55e, #16a34a); transition: width .4s ease; }
.up-progress-list { max-height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.up-progress-item { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; padding: 6px 8px; border-radius: 8px; background: var(--panel-2); flex-wrap: wrap; }
.up-progress-item .pi-name { flex: 1; min-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-progress-item .pi-err { color: var(--red); font-size: 12px; word-break: break-all; width: 100%; }
.up-progress-item .pi-id { color: var(--muted); font-size: 12px; }

/* 上传前检测弹窗 */
.up-validate-list { max-height: 46vh; overflow-y: auto; margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.up-validate-item { border: 1px solid var(--red-border); border-radius: 10px; padding: 10px 12px; background: var(--red-soft); }
.up-validate-item.ok { border-color: var(--green-border); background: var(--green-soft); }
.uv-name { font-weight: 600; font-size: 13px; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.uv-issue { font-size: 12px; padding: 2px 0 2px 18px; position: relative; color: var(--text); }
.uv-issue::before { position: absolute; left: 2px; }
.uv-issue.error { color: var(--red-strong); }
.uv-issue.error::before { content: '⛔'; }
.uv-issue.warn { color: var(--amber-strong); }
.uv-issue.warn::before { content: '⚠️'; }

/* ===== 配色主题选择器 ===== */
.theme-picker {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px; border: 1px solid var(--border); border-radius: 20px;
  background: var(--panel-2); margin-right: 4px;
}
.theme-dot {
  width: 18px; height: 18px; border-radius: 50%; border: none; padding: 0; cursor: pointer;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.75), 0 1px 2px rgba(0,0,0,.15);
  transition: transform .12s ease;
}
.theme-dot:hover { transform: scale(1.2); }
.theme-dot.active {
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.85), 0 0 0 2px var(--panel), 0 0 0 3.5px var(--primary);
}

/* ===== 无障碍：偏好减少动态效果（Impeccable 强制项） ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .modal { animation: none !important; }
  #toast { transition: none !important; transform: none; }
}
