/* ==========================================================================
   跨境选品工作台 · 深色主题设计系统
   ========================================================================== */
:root {
  --bg: #070a0f;
  --bg-soft: #0b1017;
  --panel: #10161f;
  --panel-2: #151d29;
  --panel-3: #1b2534;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.13);
  --text: #e9eff8;
  --muted: #8d9bad;
  --dim: #66748a;
  --brand: #5ea6ff;
  --brand-2: #7c6bff;
  --ok: #22c98b;
  --warn: #ffb648;
  --bad: #ff5d6c;
  --gold: #ffd166;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.55);
  --font: "PingFang SC", "Microsoft YaHei", ui-sans-serif, system-ui, -apple-system,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* hidden 属性优先级最高，避免被 display:grid/flex 覆盖导致元素常显 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 12% -12%, rgba(94, 166, 255, 0.14), transparent 65%),
    radial-gradient(760px 460px at 92% 0%, rgba(34, 201, 139, 0.09), transparent 62%);
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* --------------------------------- 顶栏 --------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 24px;
  height: 64px;
  background: rgba(7, 10, 15, 0.82);
  backdrop-filter: blur(16px) saturate(150%);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 11px; flex-shrink: 0; }
.brand-mark { display: grid; place-items: center; filter: drop-shadow(0 3px 10px rgba(94, 166, 255, 0.35)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 15px; letter-spacing: 0.3px; }
.brand-text span { font-size: 11px; color: var(--dim); letter-spacing: 0.2px; }

.tabs { display: flex; gap: 4px; padding: 4px; background: rgba(255, 255, 255, 0.035); border: 1px solid var(--line); border-radius: 11px; }
.tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--muted);
  font-size: 13px; font-family: inherit; font-weight: 500;
  cursor: pointer; transition: color 0.16s, background 0.16s;
  white-space: nowrap;
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.tab.is-active { color: #fff; background: linear-gradient(180deg, rgba(94, 166, 255, 0.26), rgba(94, 166, 255, 0.13)); box-shadow: inset 0 0 0 1px rgba(94, 166, 255, 0.35); }
.tab em { font-style: normal; font-size: 11px; padding: 1px 6px; border-radius: 20px; background: rgba(255, 255, 255, 0.12); color: var(--text); }

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

.source-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: 20px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  font-size: 12px; color: var(--muted);
  white-space: nowrap;
}
.source-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05); }
.source-pill.is-live i { background: var(--ok); box-shadow: 0 0 0 3px rgba(34, 201, 139, 0.16); animation: pulse 2.4s ease-in-out infinite; }
.source-pill.is-mock i { background: var(--warn); box-shadow: 0 0 0 3px rgba(255, 182, 72, 0.16); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

.sync-time { font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* --------------------------------- 按钮 --------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  font-size: 13px; font-family: inherit; font-weight: 500;
  cursor: pointer; text-decoration: none;
  transition: background 0.16s, border-color 0.16s, transform 0.12s;
  white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.22); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn.primary {
  background: linear-gradient(180deg, #4f9bff, #2f7bea);
  border-color: rgba(120, 180, 255, 0.55);
  color: #fff;
  box-shadow: 0 6px 18px rgba(47, 123, 234, 0.28);
}
.btn.primary:hover { background: linear-gradient(180deg, #63a9ff, #3a86f0); }
.btn.ghost { background: transparent; }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; }
.btn.danger { border-color: rgba(255, 93, 108, 0.4); color: #ff8d97; }
.btn[disabled] { opacity: 0.55; pointer-events: none; }
.btn.is-busy svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 8px; border: 1px solid var(--line);
  background: transparent; color: var(--muted);
  font-size: 13px; cursor: pointer; transition: 0.16s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }

.seg { display: flex; padding: 3px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); border-radius: 9px; }
.seg-btn {
  border: 0; background: transparent; color: var(--muted);
  font-size: 12.5px; font-family: inherit; padding: 4px 11px;
  border-radius: 6px; cursor: pointer; transition: 0.16s;
}
.seg-btn.is-active { background: rgba(255, 255, 255, 0.1); color: var(--text); }

/* --------------------------------- 主体 --------------------------------- */
.main { flex: 1; padding: 20px 24px 40px; max-width: 1680px; width: 100%; margin: 0 auto; }

/* KPI 卡片 */
.kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpi {
  position: relative;
  padding: 15px 16px 14px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.18s, transform 0.18s;
}
.kpi::after {
  content: "";
  position: absolute; inset: 0 auto auto 0;
  width: 100%; height: 2px;
  background: linear-gradient(90deg, var(--accent, var(--brand)), transparent 75%);
  opacity: 0.85;
}
.kpi:hover { border-color: var(--line-2); transform: translateY(-1px); }
.kpi-label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi-value { margin-top: 7px; font-size: 25px; font-weight: 650; letter-spacing: -0.4px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi-value small { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 3px; }
.kpi-sub { margin-top: 6px; font-size: 11.5px; color: var(--dim); display: flex; gap: 10px; flex-wrap: wrap; }
.kpi-sub b { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi-sub .up { color: var(--ok); }
.kpi-sub .down { color: var(--bad); }

.grade-bar { display: flex; gap: 3px; margin-top: 9px; height: 5px; border-radius: 4px; overflow: hidden; }
.grade-bar span { height: 100%; border-radius: 3px; }

/* 面板 */
.panel {
  background: linear-gradient(180deg, rgba(21, 29, 41, 0.9), rgba(16, 22, 31, 0.9));
  border: 1px solid var(--line);
  border-radius: 16px;
  /* clip 同样裁掉圆角溢出，但不像 hidden 那样创建滚动容器，子元素 sticky 才能生效 */
  overflow: clip;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}

/* 工具栏 */
.toolbar {
  /* 向下滚动时吸附在页头下方，筛选条件随时可用 */
  position: sticky;
  top: 64px; /* 页头 .topbar 高度 */
  z-index: 30;
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  /* 吸附时必须不透明，否则下层卡片会透出来 */
  background: #131b27;
  border-radius: 16px 16px 0 0;
}
.toolbar .spacer { flex: 1; }
.search {
  position: relative; display: flex; align-items: center;
  height: 32px; min-width: 250px;
  padding: 0 10px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  color: var(--dim);
  transition: border-color 0.16s;
}
.search:focus-within { border-color: rgba(94, 166, 255, 0.6); box-shadow: 0 0 0 3px rgba(94, 166, 255, 0.12); }
.search input {
  flex: 1; height: 100%; margin-left: 7px;
  background: transparent; border: 0; outline: 0;
  color: var(--text); font-size: 13px; font-family: inherit;
}
.search input::placeholder { color: var(--dim); }

select {
  height: 32px; padding: 0 26px 0 10px;
  background-color: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  color: var(--text); font-size: 12.5px; font-family: inherit;
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238d9bad' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}
select:hover { border-color: rgba(255, 255, 255, 0.24); }
select:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
option { background: #10161f; color: var(--text); }

/* --------------------------------- 表格 --------------------------------- */
.table-wrap { overflow-x: auto; }
.grid-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 880px; }
.grid-table thead th {
  position: sticky; top: 0; z-index: 2;
  padding: 10px 14px;
  background: #0e141d;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.4px;
  color: var(--dim); text-align: left; text-transform: uppercase;
  white-space: nowrap; user-select: none;
}
.grid-table th.num { text-align: right; }
.grid-table th.sortable { cursor: pointer; transition: color 0.15s; }
.grid-table th.sortable:hover { color: var(--text); }
.grid-table th.is-sorted { color: var(--brand); }
.grid-table th.is-sorted::after { content: " ↓"; font-size: 10px; }
.grid-table th.is-sorted.asc::after { content: " ↑"; }

.grid-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  vertical-align: middle;
  font-size: 13px;
}
.grid-table tbody tr { transition: background 0.14s; }
.grid-table tbody tr:hover { background: rgba(94, 166, 255, 0.055); }
.grid-table tbody tr.is-picked { background: rgba(34, 201, 139, 0.05); }
.grid-table tbody tr:last-child td { border-bottom: 0; }

.goods { display: flex; align-items: center; gap: 11px; min-width: 320px; }
.thumb {
  width: 46px; height: 46px; flex-shrink: 0;
  border-radius: 10px;
  background: var(--panel-3);
  object-fit: cover;
  border: 1px solid var(--line);
}
.goods-meta { min-width: 0; }
.goods-name {
  font-size: 13px; font-weight: 550; color: var(--text);
  max-width: 330px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.goods-sub {
  display: flex; align-items: center; gap: 7px; margin-top: 3px;
  font-size: 11px; color: var(--dim); font-family: var(--mono);
}
.goods-sub .cat { color: var(--muted); font-family: var(--font); }
.goods-sub .dot { opacity: 0.4; }

.shop-cell { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; }
.shop-cell .wh { font-size: 11px; color: var(--dim); }

.num-cell { text-align: right; font-variant-numeric: tabular-nums; font-weight: 550; }
.num-cell .sub { display: block; font-size: 11px; color: var(--dim); font-weight: 400; margin-top: 2px; }

.delta { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 12.5px; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--dim); }

.score-cell { display: flex; align-items: center; gap: 9px; justify-content: flex-end; }
.score-badge {
  width: 30px; height: 30px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 9px;
  font-size: 13px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
}
.grade-S { background: rgba(255, 209, 102, 0.14); color: var(--gold); border-color: rgba(255, 209, 102, 0.4); }
.grade-A { background: rgba(94, 166, 255, 0.14); color: var(--brand); border-color: rgba(94, 166, 255, 0.38); }
.grade-B { background: rgba(34, 201, 139, 0.12); color: var(--ok); border-color: rgba(34, 201, 139, 0.32); }
.grade-C { background: rgba(255, 255, 255, 0.06); color: var(--dim); border-color: var(--line); }

.score-bar { width: 54px; height: 4px; border-radius: 3px; background: rgba(255, 255, 255, 0.09); overflow: hidden; }
.score-bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #7c6bff, #5ea6ff); }
.grade-S ~ .score-bar i, .score-bar.g-S i { background: linear-gradient(90deg, #ffb648, #ffd166); }
.score-bar.g-A i { background: linear-gradient(90deg, #3f8bf5, #7cc0ff); }
.score-bar.g-B i { background: linear-gradient(90deg, #19a874, #3ddc9f); }
.score-bar.g-C i { background: linear-gradient(90deg, #4a5568, #76839a); }

.tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.tag {
  font-size: 10.5px; padding: 1px 6px; border-radius: 5px; line-height: 1.6;
  border: 1px solid transparent; white-space: nowrap;
}
.tag.success { color: #4bdc9d; background: rgba(34, 201, 139, 0.1); border-color: rgba(34, 201, 139, 0.28); }
.tag.warning { color: #ffc76a; background: rgba(255, 182, 72, 0.1); border-color: rgba(255, 182, 72, 0.28); }
.tag.danger { color: #ff8791; background: rgba(255, 93, 108, 0.1); border-color: rgba(255, 93, 108, 0.3); }
.tag.muted { color: var(--dim); background: rgba(255, 255, 255, 0.045); border-color: var(--line); }

.col-act { text-align: right; width: 132px; }
.act-row { display: flex; gap: 5px; justify-content: flex-end; }
.mini-btn {
  height: 26px; padding: 0 9px;
  border-radius: 7px; border: 1px solid var(--line-2);
  background: transparent; color: var(--muted);
  font-size: 11.5px; font-family: inherit; cursor: pointer; transition: 0.15s;
  white-space: nowrap;
}
.mini-btn:hover { color: var(--text); border-color: rgba(94, 166, 255, 0.5); background: rgba(94, 166, 255, 0.1); }
.mini-btn.is-on { color: #4bdc9d; border-color: rgba(34, 201, 139, 0.45); background: rgba(34, 201, 139, 0.1); }

.spark { display: block; }

/* 空状态 / 分页 */
.empty { padding: 56px 20px; text-align: center; color: var(--muted); }
.empty-icon { font-size: 30px; color: var(--dim); margin-bottom: 8px; }
.empty p { margin: 0 0 14px; font-size: 13px; }

.pager {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--dim);
}
.pager .spacer { flex: 1; }
.pager button {
  min-width: 30px; height: 28px; padding: 0 9px;
  border-radius: 7px; border: 1px solid var(--line-2);
  background: transparent; color: var(--muted);
  font-size: 12px; font-family: inherit; cursor: pointer;
}
.pager button:hover:not(:disabled) { color: var(--text); border-color: rgba(255, 255, 255, 0.24); }
.pager button.is-active { background: rgba(94, 166, 255, 0.18); border-color: rgba(94, 166, 255, 0.5); color: #fff; }
.pager button:disabled { opacity: 0.4; cursor: default; }
.pager select.pager-size { height: 28px; padding: 0 24px 0 9px; font-size: 12px; }

/* --------------------------------- 卡片视图 --------------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 12px;
  padding: 14px;
}
.pcard {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: border-color 0.18s, transform 0.18s;
  cursor: pointer;
}
.pcard:hover { border-color: rgba(94, 166, 255, 0.4); transform: translateY(-2px); }
.pcard-img { position: relative; aspect-ratio: 4 / 3; background: var(--panel-3); }
.pcard-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pcard-img .score-badge { position: absolute; top: 9px; right: 9px; width: 34px; height: 34px; backdrop-filter: blur(8px); }
.pcard-body { padding: 11px 13px 13px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.pcard-name { font-size: 13px; font-weight: 550; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 36px; }
.pcard-name-row { display: flex; align-items: flex-start; gap: 6px; }
.pcard-name-row .pcard-name { flex: 1; min-width: 0; }
.pcard-sku { font-size: 11px; color: var(--dim); font-family: var(--mono); }

/* 一键复制款号按钮 */
.copy-btn {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.05);
  color: var(--dim);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.1s;
}
.copy-btn:hover { color: var(--text); border-color: rgba(94, 166, 255, 0.55); background: rgba(94, 166, 255, 0.12); }
.copy-btn:active { transform: scale(0.9); }

/* 后台同步任务进度条（管理员） */
.sync-progress {
  margin: 0 24px 14px;
  padding: 10px 14px;
  border: 1px solid rgba(94, 166, 255, 0.35);
  border-radius: 10px;
  background: rgba(94, 166, 255, 0.07);
  display: flex; flex-direction: column; gap: 7px;
}
.sync-progress[hidden] { display: none !important; }
.sp-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.sp-label { color: var(--text); font-weight: 550; }
.sp-info { font-variant-numeric: tabular-nums; color: var(--muted); }
.sp-bar { height: 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.sp-bar i { display: block; height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, #5ea6ff, #22c98b); transition: width 0.8s ease; }
.sp-bar i.is-unknown { width: 34%; animation: sp-unknown 1.4s ease-in-out infinite alternate; }
@keyframes sp-unknown { from { margin-left: 0; } to { margin-left: 66%; } }
.pcard-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding-top: 9px; border-top: 1px solid var(--line); }
.pcard-stats div { display: flex; flex-direction: column; gap: 2px; }
.pcard-stats span { font-size: 10.5px; color: var(--dim); }
.pcard-stats b { font-size: 13px; font-variant-numeric: tabular-nums; }

/* --------------------------------- 抽屉 --------------------------------- */
.drawer-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(3, 6, 10, 0.62);
  backdrop-filter: blur(3px);
  animation: fade 0.2s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 61;
  width: min(560px, 100%);
  background: #0d131c;
  border-left: 1px solid var(--line-2);
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.5);
  transform: translateX(101%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.drawer.is-open { transform: translateX(0); }

.drawer-head { position: relative; padding: 0; }
.drawer-hero { position: relative; height: 260px; overflow: hidden; background: var(--panel-3); }
.drawer-hero img { width: 100%; height: 100%; object-fit: contain; }
.drawer-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 30%, #0d131c 100%); }
.drawer-close { position: absolute; top: 12px; right: 12px; z-index: 2; background: rgba(0, 0, 0, 0.5); }

/* 仓库分布 / 同款 SKU 库存 */
.wh-stock { display: flex; flex-direction: column; gap: 6px; }
.wh-row {
  display: grid;
  grid-template-columns: minmax(90px, 1.4fr) repeat(3, minmax(56px, 1fr));
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--dim);
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}
.wh-row .wh-name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wh-row b { color: var(--text); font-weight: 600; }

.sib-table { display: flex; flex-direction: column; gap: 4px; }
.sib-head,
.sib-row {
  display: grid;
  grid-template-columns: minmax(100px, 1.5fr) repeat(3, minmax(44px, 0.6fr)) minmax(56px, 0.7fr);
  gap: 8px;
  align-items: center;
  font-size: 12px;
  padding: 7px 10px;
}
.sib-head { color: var(--dim); font-size: 11px; }
.sib-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  width: 100%;
}
.sib-row:hover { border-color: var(--brand); background: rgba(94, 166, 255, 0.08); }
.sib-row.is-active { border-color: var(--brand); background: rgba(94, 166, 255, 0.14); }
.sib-row .sib-sku { font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 7px; min-width: 0; }
.sib-row .sib-dot { flex: none; display: inline-block; width: 8px; height: 8px; border-radius: 2px; }
.sib-row b { font-weight: 600; text-align: right; }
.sib-row.sib-total { cursor: default; border-style: dashed; background: transparent; color: var(--dim); }
.sib-row.sib-total:hover { border-color: var(--line); background: transparent; }
.sib-row.sib-total .sib-sku { font-family: inherit; font-weight: 600; }

/* 图集缩略条：主图（领星）+ 后台上传的详情图 */
.gallery-strip {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  overflow-x: auto;
  background: #0d131c;
  scrollbar-width: thin;
}
.gthumb {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: var(--panel-3);
  transition: border-color 0.15s, opacity 0.15s;
  opacity: 0.72;
}
.gthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gthumb:hover { opacity: 1; }
.gthumb.is-active { border-color: var(--brand); opacity: 1; }

/* ------------------------------ 图片后台上传页 ------------------------------ */
.admin-main { max-width: 1080px; margin: 0 auto; padding: 22px 20px 60px; }
.admin-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 16px; align-items: start; }
.acard {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}
.acard h3 { margin: 0 0 12px; font-size: 14px; color: var(--text); }
.acard h3 small { font-weight: 400; color: var(--dim); margin-left: 8px; font-size: 12px; }
.dropzone {
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  padding: 26px 16px;
  text-align: center;
  color: var(--dim);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--brand); background: rgba(94, 166, 255, 0.06); color: var(--text); }
.dropzone b { color: var(--text); }
.ggroup { margin-bottom: 14px; }
.ggroup-head {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12px; color: var(--text);
  margin-bottom: 8px;
}
.ggroup-head span { color: var(--dim); font-family: inherit; }
.gimgs { display: flex; flex-wrap: wrap; gap: 10px; }
.gitem { position: relative; width: 96px; }
.gitem img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.gitem .gdel {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; padding: 0;
  border-radius: 6px; border: none;
  background: rgba(0, 0, 0, 0.65); color: #fff;
  font-size: 11px; cursor: pointer; line-height: 1;
}
.gitem .gdel:hover { background: #e5484d; }
.gempty { color: var(--dim); font-size: 13px; padding: 12px 0; }
.drawer-title { position: relative; z-index: 2; margin-top: -54px; padding: 0 20px 14px; }
/* 有图集缩略条时，标题不再上浮，避免与缩略图重叠 */
.drawer-head.has-gallery .drawer-title { margin-top: 0; padding-top: 12px; }
.drawer-title h2 { margin: 0; font-size: 17px; line-height: 1.35; font-weight: 600; }
.drawer-name-row { display: flex; align-items: center; gap: 8px; }
.drawer-name-row .copy-btn { margin-top: 2px; }
.drawer-title .meta { margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; font-size: 11.5px; color: var(--dim); font-family: var(--mono); }

.drawer-body { padding: 0 20px 28px; display: flex; flex-direction: column; gap: 16px; }

.dsec { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255, 255, 255, 0.022); padding: 13px 14px; }
.dsec h3 { margin: 0 0 11px; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.5px; text-transform: uppercase; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat-grid > div { display: flex; flex-direction: column; gap: 3px; }
.stat-grid span { font-size: 11px; color: var(--dim); }
.stat-grid b { font-size: 15px; font-variant-numeric: tabular-nums; }

.meter { display: flex; flex-direction: column; gap: 8px; }
.meter-row { display: grid; grid-template-columns: 62px 1fr 42px; align-items: center; gap: 9px; font-size: 11.5px; color: var(--muted); }
.meter-track { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.meter-track i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #7c6bff, #5ea6ff); }
.meter-row b { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; font-size: 11.5px; }

.bars { display: flex; align-items: flex-end; gap: 3px; height: 76px; }
.bars div { flex: 1; border-radius: 2px 2px 0 0; background: linear-gradient(180deg, #5ea6ff, rgba(94, 166, 255, 0.28)); min-height: 2px; transition: opacity 0.15s; }
.bars div:hover { opacity: 0.7; }
.chart-axis { display: flex; justify-content: space-between; margin-top: 6px; font-size: 10.5px; color: var(--dim); }

.stock-split { display: flex; height: 9px; border-radius: 5px; overflow: hidden; gap: 2px; }
.stock-split span { height: 100%; }
.legend { display: flex; gap: 14px; margin-top: 9px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }

/* ------------------------------ 用户徽标 / 账号管理 ------------------------------ */
.user-chip {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 12.5px; background: rgba(255, 255, 255, 0.03);
}
.user-chip .user-dot { width: 8px; height: 8px; border-radius: 50%; background: #5ea6ff; }
.user-chip em { font-style: normal; color: var(--dim); font-size: 11px; }
.user-list { display: flex; flex-direction: column; gap: 6px; }
.user-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px;
  background: rgba(255, 255, 255, 0.02);
}
.user-row-acts { display: flex; gap: 6px; }

.reco { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 11px; background: rgba(94, 166, 255, 0.07); border: 1px solid rgba(94, 166, 255, 0.24); }
.reco b { font-size: 20px; font-variant-numeric: tabular-nums; color: #9fcaff; }
.reco p { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }

.drawer-foot { display: flex; gap: 8px; padding-top: 2px; }

/* --------------------------------- 弹窗 --------------------------------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 70;
  display: grid; place-items: center;
  padding: 20px;
  background: rgba(3, 6, 10, 0.66);
  backdrop-filter: blur(4px);
  animation: fade 0.18s ease;
}
.modal {
  width: min(620px, 100%);
  max-height: 84dvh;
  display: flex; flex-direction: column;
  background: #0d131c;
  border: 1px solid var(--line-2);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-body { padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); }
.field .hint { font-size: 11.5px; color: var(--dim); line-height: 1.55; }
.field input[type="text"], .field input[type="password"], .field input[type="number"] {
  height: 36px; padding: 0 11px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  color: var(--text); font-size: 13px; font-family: var(--mono);
  outline: 0; transition: border-color 0.16s;
}
.field input:focus { border-color: rgba(94, 166, 255, 0.6); box-shadow: 0 0 0 3px rgba(94, 166, 255, 0.12); }

/* 定时同步：开关 + 间隔分钟 */
.auto-sync-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.auto-sync-row .chk { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text); cursor: pointer; }
.auto-sync-row .chk input { width: 15px; height: 15px; accent-color: #5ea6ff; cursor: pointer; }
.auto-sync-every { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.auto-sync-every input { width: 76px; text-align: center; height: 32px; padding: 0 6px; }

.radio-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.radio-card {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 11px 12px;
  border: 1px solid var(--line-2); border-radius: 10px;
  cursor: pointer; transition: 0.16s;
}
.radio-card:hover { border-color: rgba(255, 255, 255, 0.24); }
.radio-card input { margin-top: 2px; accent-color: var(--brand); }
.radio-card strong { display: block; font-size: 12.5px; font-weight: 550; }
.radio-card span { font-size: 11px; color: var(--dim); line-height: 1.5; }
.radio-card:has(input:checked) { border-color: rgba(94, 166, 255, 0.55); background: rgba(94, 166, 255, 0.08); }

.log {
  background: #070b11;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 11.5px; line-height: 1.75;
  color: var(--muted);
  max-height: 200px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-all;
}
.log .warn { color: var(--warn); }
.log .error { color: var(--bad); }
.log .ok { color: var(--ok); }

.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding-top: 4px; }

/* --------------------------------- Toast --------------------------------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 14px;
  background: #131b26;
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--brand);
  border-radius: 10px;
  font-size: 12.5px; color: var(--text);
  box-shadow: var(--shadow);
  animation: slide-in 0.22s ease;
  max-width: 340px;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--bad); }
@keyframes slide-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

/* --------------------------------- 页脚 --------------------------------- */
.foot {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 14px; padding: 0 2px;
  font-size: 11.5px; color: var(--dim); flex-wrap: wrap;
}

/* --------------------------------- 响应式 --------------------------------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .topbar { gap: 12px; padding: 0 14px; height: auto; flex-wrap: wrap; padding-block: 10px; }
  .topbar-right { width: 100%; margin-left: 0; flex-wrap: wrap; }
  .main { padding: 14px 12px 32px; }
  .brand-text span { display: none; }
  /* 窄屏页头高度不定，筛选栏取消吸附，避免错位遮挡 */
  .toolbar { position: static; }
}
@media (max-width: 760px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search { min-width: 100%; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .radio-row { grid-template-columns: 1fr; }
  .col-store, .grid-table th.col-store { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* 默认密码提醒条（公网部署前必须处理） */
.pwd-warn {
  margin: 0 0 14px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 182, 72, 0.45);
  background: rgba(255, 182, 72, 0.12);
  color: #ffcf8a;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pwd-warn[hidden] { display: none !important; }
.link-btn {
  border: 0;
  background: none;
  color: #5ea6ff;
  font-size: 12.5px;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  font-family: inherit;
}
.link-btn:hover { color: #8bc0ff; }

/* ------------------------- SHEIN 开放平台对接 ------------------------- */
.shein-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px;
  border-radius: 999px; font-size: 11.5px; font-family: var(--mono);
  border: 1px solid var(--line-2); color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}
.badge.ok { color: #34d399; border-color: rgba(52, 211, 153, 0.45); background: rgba(52, 211, 153, 0.1); }
.badge.warn { color: #fbbf24; border-color: rgba(251, 191, 36, 0.45); background: rgba(251, 191, 36, 0.1); }
.badge.err { color: #ff7d7d; border-color: rgba(255, 125, 125, 0.45); background: rgba(255, 125, 125, 0.1); }
.shein-env { font-size: 11.5px; color: var(--dim); font-family: var(--mono); }
.shein-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.shein-table th {
  text-align: left; font-weight: 500; color: var(--dim); font-size: 11.5px;
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.shein-table td { padding: 9px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); vertical-align: middle; }
.shein-table tbody tr:last-child td { border-bottom: 0; }
.shein-table .mono { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.shein-table .ok { color: #34d399; }
.shein-table .err { color: #ff7d7d; }
.shein-table .muted { color: var(--dim); }
.shein-pre {
  margin: 10px 0 0; padding: 12px; max-height: 320px; overflow: auto;
  background: rgba(0, 0, 0, 0.42); border: 1px solid var(--line-2); border-radius: 10px;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.7; color: #9fb4cc;
  white-space: pre-wrap; word-break: break-all;
}
.shein-logs { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.shein-log-row {
  display: grid; grid-template-columns: 150px 1fr 70px 1fr; gap: 10px;
  align-items: center; font-size: 12px; color: var(--muted);
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}
.shein-log-row .mono { font-family: var(--mono); font-size: 11.5px; color: var(--dim); }
.shein-log-row .ok { color: #34d399; }
.shein-log-row .err { color: #ff7d7d; }
@media (max-width: 760px) {
  .shein-log-row { grid-template-columns: 1fr; gap: 2px; }
}
