:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --border: #e6e9f0;
  --text: #1c2333;
  --muted: #8a93a6;
  --primary: #fe2c55;          /* TikTok 红 */
  --primary-dark: #d91f45;
  --cyan: #25f4ee;
  --sidebar: #10152b;
  --sidebar-text: #aab2c8;
  --green: #12b76a;
  --orange: #f79009;
  --blue: #2e90fa;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16,21,43,.05), 0 4px 16px rgba(16,21,43,.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
/* ===== 登录页 ===== */
.login-mask { position:fixed; inset:0; z-index:1000; background:linear-gradient(135deg,#10152b,#1a2340); display:flex; align-items:center; justify-content:center; }
.login-card { background:#fff; border-radius:18px; padding:40px 36px; width:380px; text-align:center; box-shadow:0 20px 60px rgba(0,0,0,.4); }
.login-logo { width:60px; height:60px; border-radius:15px; object-fit:cover; margin:0 auto 14px; display:block; }
.login-card h2 { font-size:18px; font-weight:700; margin-bottom:24px; color:#1c2333; }
.login-card input { width:100%; height:46px; margin-bottom:14px; padding:0 14px; border:1px solid var(--border); border-radius:10px; font-size:14px; outline:none; box-sizing:border-box; }
.login-card input:focus { border-color:var(--primary); box-shadow:0 0 0 3px rgba(254,44,85,.1); }
.login-btn { width:100%; height:46px; font-size:15px; margin-top:6px; }
.login-err { color:var(--primary); font-size:12px; margin-top:12px; min-height:18px; }
.remember-row { display:flex; align-items:center; gap:7px; justify-content:flex-start; font-size:13px; color:#5b6478; margin-bottom:6px; cursor:pointer; user-select:none; }
.remember-row input { margin:0; width:15px; height:15px; accent-color:var(--primary); cursor:pointer; }
.logout-btn { width:100%; margin-top:10px; padding:8px 0; border:1px solid rgba(255,255,255,.15); border-radius:8px; background:transparent; color:#aab2c8; font-size:12px; cursor:pointer; transition:.15s; }
.logout-btn:hover { background:rgba(255,255,255,.08); color:#fff; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.app { display: flex; min-height: 100vh; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: 224px; background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 22px 20px; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand-logo { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; display: block; }
.brand-title { color: #fff; font-weight: 700; font-size: 13px; white-space: nowrap; }
.brand-sub { font-size: 11px; color: var(--sidebar-text); margin-top: 2px; }

.nav { padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px;
  cursor: pointer; color: var(--sidebar-text); transition: .15s; user-select: none;
}
.nav-item .ic { font-size: 16px; width: 20px; text-align: center; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 600; }

.sidebar-foot { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.06); font-size: 11px; }
.hint { color: #66708a; line-height: 1.5; }

/* ---------- 顶栏 ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px; background: var(--card); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.page-title { font-size: 20px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); }
.dot.ok { background: var(--green); }
.dot.err { background: var(--primary); }

.content { padding: 24px 28px 48px; }

/* ---------- 通用 ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-h h3 { font-size: 15px; font-weight: 700; }
.card-b { padding: 20px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: none; cursor: pointer;
  padding: 9px 16px; border-radius: 9px; font-size: 13px; font-weight: 600; transition: .15s;
  background: var(--primary); color: #fff;
}
.btn:hover { background: var(--primary-dark); }
.btn.ghost { background: #eef1f6; color: var(--text); }
.btn.ghost:hover { background: #e2e7f0; }
.btn.sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn.danger { background: #fee4e7; color: #d91f45; }
.btn.danger:hover { background: #fdd0d6; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px;
  font-size: 13px; font-family: inherit; background: #fff; color: var(--text); outline: none; transition: .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(254,44,85,.1); }
label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 6px; font-weight: 600; }
.field { margin-bottom: 14px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- 统计卡片 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { padding: 20px; }
.stat .label { font-size: 13px; color: var(--muted); }
.stat .value { font-size: 30px; font-weight: 800; margin-top: 6px; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 6px; }
.stat.accent { background: linear-gradient(135deg, #fff, #fff6f7); border-color: #ffd6de; }
.stat.accent .value { color: var(--primary); }

/* ---------- 表格 ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.search { max-width: 260px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 11px 12px; font-size: 12px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid #f0f2f7; vertical-align: middle; }
tr:hover td { background: #fafbfd; }
.num { font-variant-numeric: tabular-nums; font-weight: 600; }
.tag { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.tag.green { background: #e6f7ef; color: #0e9455; }
.tag.red { background: #fee4e7; color: #d91f45; }
.tag.gray { background: #eef1f6; color: #5b6478; }
.tag.blue { background: #e6f0fe; color: #1f74d6; }
.tag.orange { background: #fef1dd; color: #c26a04; }
.up { color: var(--green); }
.down { color: var(--primary); }

.product-cell { display: flex; align-items: center; gap: 10px; max-width: 380px; }
.product-cell img { width: 46px; height: 46px; border-radius: 9px; object-fit: cover; background: #f0f2f7; flex: none; transition: transform .18s ease; }
.product-cell a.t { text-decoration:none; color:inherit; cursor:pointer; }
.product-cell a.t:hover { color:var(--primary); text-decoration:underline; }
.product-cell .t { font-weight: 600; font-size: 13px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.35; }
.product-cell .s { font-size: 11px; color: var(--muted); margin-top: 3px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #f0f2f7; }

.pagination { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; font-size: 13px; color: var(--muted); flex-wrap: wrap; gap: 10px; }
.page-btns { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.page-btns button { min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; font-size: 13px; font-weight: 600; }
.page-btns button:hover { border-color: var(--primary); color: var(--primary); }
.page-btns button.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btns button:disabled { opacity: .35; cursor: not-allowed; }
.pg-dots { color: var(--muted); padding: 0 2px; }
.page-jump { display:inline-flex; align-items:center; gap:5px; margin-left:8px; color:var(--muted); }
.page-jump input { width:52px; height:30px; padding:0 6px; border:1px solid var(--border); border-radius:7px; font-size:13px; text-align:center; outline:none; }
.page-jump input:focus { border-color:var(--primary); }
.page-jump button { height:30px; padding:0 10px; border:1px solid var(--border); border-radius:7px; background:#fff; cursor:pointer; font-size:12px; font-weight:600; }
.page-jump button:hover { border-color:var(--primary); color:var(--primary); }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 10px; }

/* ---------- 弹窗 ---------- */
.modal-mask[hidden] { display: none; }
.img-preview { position:fixed; pointer-events:none; z-index:999; border-radius:14px; overflow:hidden; box-shadow:0 10px 40px rgba(0,0,0,.35); border:3px solid #fff; background:#fff; }
.img-preview img { width:240px; height:240px; object-fit:cover; display:block; }
img.zoomable { cursor: zoom-in; }
.trend-tip { position:fixed; pointer-events:none; z-index:999; background:rgba(255,255,255,.88); backdrop-filter:blur(3px); color:#1c2333; border:1px solid #e6e9f0; padding:7px 12px; border-radius:8px; font-size:12px; white-space:nowrap; line-height:1.6; text-align:center; box-shadow:0 4px 16px rgba(16,21,43,.12); }
.modal-mask { position: fixed; inset: 0; background: rgba(16,21,43,.5); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-h { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-h h3 { font-size: 16px; }
.modal-h .x { cursor: pointer; font-size: 20px; color: var(--muted); line-height: 1; }
.modal-b { padding: 20px 22px; }
.modal-f { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; position: sticky; bottom: 0; background: #fff; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1c2333; color: #fff; padding: 11px 20px; border-radius: 10px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 图表 ---------- */
.chart-wrap { position: relative; }
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.chart-legend b { font-weight: 700; }
canvas { display: block; width: 100%; }

/* 响应式 */
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: 1fr 1fr; }
}

/* ===== 选品池 ===== */
.pool-head { display:flex; align-items:center; gap:8px; margin-bottom:14px; flex-wrap:wrap; }
.pill { display:inline-flex; align-items:center; gap:6px; padding:6px 12px; border-radius:999px; background:#eef1f6; color:#5b6478; font-weight:600; font-size:12px; white-space:nowrap; }
.pill.us { background:#e6f0fe; color:#1f74d6; }
.pill.sync { background:#fff5f7; color:var(--primary); }
.pill .dot { width:8px; height:8px; border-radius:50%; background:var(--green); }

.filter { padding:16px 20px; display:flex; flex-wrap:wrap; gap:14px; align-items:flex-end; margin-bottom:14px; }
.filter .f { align-items:center; }
.filter .f label { text-align:center; width:100%; }
.f { display:flex; flex-direction:column; gap:6px; }
.f label { font-size:12px; color:var(--muted); font-weight:600; }
.box { height:38px; display:flex; align-items:center; gap:8px; padding:0 12px; border:1px solid var(--border); border-radius:9px; background:#fff; font-size:13px; white-space:nowrap; cursor:pointer; }
.box.select { min-width:130px; }
.chips { display:flex; gap:8px; }
.chip { height:38px; display:flex; align-items:center; gap:6px; padding:0 13px; border:1px solid var(--border); border-radius:9px; background:#fff; font-size:13px; cursor:pointer; white-space:nowrap; }
.chip.on { border-color:var(--primary); background:#fff5f7; color:var(--primary); font-weight:600; }
.chip .sw { width:9px; height:9px; border-radius:50%; display:inline-block; }
.sw.local { background:var(--green); } .sw.cross { background:var(--blue); }
.range { display:flex; align-items:center; gap:6px; }
.range input { width:86px; height:38px; padding:0 10px; border:1px solid var(--border); border-radius:9px; font-size:13px; outline:none; }
.range input:focus { border-color:var(--primary); box-shadow:0 0 0 3px rgba(254,44,85,.08); }
.range .sep { color:var(--muted); }

.sort { display:inline-flex; align-items:center; gap:4px; cursor:pointer; user-select:none; }
.sort:hover { color:var(--text); }
.sort .arrow { font-size:9px; line-height:1; display:flex; flex-direction:column; gap:1px; color:#c3cad6; }
.sort.active { color:var(--primary); }
.sort.active .arrow { color:var(--primary); }

.shop { display:flex; align-items:center; gap:8px; }
.shop .av { width:28px; height:28px; border-radius:8px; display:grid; place-items:center; font-size:13px; font-weight:800; color:#fff; flex:none; }
.shop .si { display:flex; flex-direction:column; gap:3px; min-width:0; }
.shop .sn { font-weight:600; font-size:12.5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:130px; }
.coop { display:inline-flex; align-items:center; gap:3px; font-size:10px; font-weight:700; background:#e6f7ef; color:#0e9455; border-radius:5px; padding:1px 5px; width:max-content; }
.am { display:flex; gap:4px; flex-wrap:wrap; }
.am .tag { display:inline-flex; padding:3px 8px; border-radius:6px; font-size:11px; font-weight:600; background:#eef1f6; color:#4b5265; cursor:pointer; }
.am .tag:hover { background:#e2e7f0; }
.am .add { display:inline-flex; padding:3px 8px; border-radius:6px; font-size:11px; font-weight:600; color:var(--primary); background:#fff5f7; border:1px dashed #f7b6c3; cursor:pointer; }
.badge { display:inline-flex; align-items:center; gap:5px; padding:4px 10px; border-radius:999px; font-size:11px; font-weight:700; }
.badge .sw { width:8px; height:8px; border-radius:50%; }
.badge.local { background:#e6f7ef; color:#0e9455; } .badge.local .sw { background:var(--green); }
.badge.cross { background:#e6f0fe; color:#1f74d6; } .badge.cross .sw { background:var(--blue); }
.btn:disabled { background:#e6e9f0; color:#9aa1b3; cursor:not-allowed; }
.pool-tbl-wrap { overflow-x:auto; }
.pool-tbl { min-width:1300px; width:100%; border-collapse:collapse; }
.pool-tbl th { text-align:center; padding:12px 12px; font-size:12px; color:var(--muted); font-weight:600; border-bottom:1px solid var(--border); white-space:nowrap; }
.pool-tbl td { padding:13px 12px; }
.pool-tbl .btn { white-space:nowrap; }
.pool-tbl td { padding:12px; border-bottom:1px solid #f0f2f7; vertical-align:middle; }
.pool-tbl tr:hover td { background:#fafbfd; }
.pool-tbl .num { font-variant-numeric:tabular-nums; font-weight:600; white-space:nowrap; }
.pool-tbl .week { color:var(--primary); font-weight:800; }
.pool-tbl .rate { color:var(--orange); font-weight:700; }
.pool-tbl .star { color:#f79009; font-weight:700; }

/* 店铺信息卡 */
.shop-cell { display:flex; align-items:center; gap:10px; }
.shop-avatar { width:48px; height:48px; border-radius:10px; object-fit:cover; background:#f0f2f7; flex:none; }
.shop-avatar.fb { display:grid; place-items:center; font-size:17px; font-weight:800; color:#fff; }
.shop-info { display:flex; flex-direction:column; gap:3px; min-width:0; }
.shop-name { font-weight:700; font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:160px; }
.shop-name { text-decoration:none; color:inherit; }
.shop-name:hover { color:var(--primary); text-decoration:underline; }
.shop-sales { font-size:11.5px; color:var(--muted); }
.shop-sales b { color:var(--text); font-variant-numeric:tabular-nums; font-weight:700; }
.shop-meta { display:flex; align-items:center; gap:5px; flex-wrap:nowrap; white-space:nowrap; }
.product-cell .pi { display:flex; flex-direction:column; gap:3px; min-width:0; }
.pm { font-size:12px; margin-top:1px; }
.pm .price { font-weight:700; color:var(--text); }
.pm .star { color:#f79009; font-weight:700; }
.pm .dot-sep { color:#c3cad6; margin:0 4px; }
.listing { font-size:11.5px; color:var(--muted); margin-top:1px; }
.am-name { display:inline-flex; padding:2px 7px; border-radius:5px; font-size:11px; font-weight:600; background:#eef1f6; color:#4b5265; cursor:pointer; }
.am-name:hover { background:#e2e7f0; }
.am-add-sm { display:inline-flex; padding:2px 7px; border-radius:5px; font-size:11px; font-weight:600; color:var(--primary); background:#fff5f7; border:1px dashed #f7b6c3; cursor:pointer; }
.multi-select { position: relative; }
.cat-panel[hidden] { display:none; }
.cat-panel { position:absolute; top:100%; left:0; margin-top:6px; background:#fff; border:1px solid var(--border); border-radius:10px; box-shadow:0 8px 30px rgba(16,21,43,.15); padding:10px; z-index:50; min-width:190px; max-height:300px; overflow-y:auto; display:flex; flex-direction:column; gap:3px; }
.cat-opt { display:flex; align-items:center; gap:7px; font-size:13px; padding:5px 8px; border-radius:6px; cursor:pointer; white-space:nowrap; }
.cat-opt:hover { background:#f4f6fa; }
.cat-opt input { width:auto; cursor:pointer; }
.btn-excl { width:32px; height:32px; border:1px solid var(--border); border-radius:8px; background:#fff; color:#8a93a6; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; transition:.15s; vertical-align:middle; flex:none; }
.btn-excl:hover { background:#fee4e7; color:#d91f45; border-color:#f7b6c3; }
.btn-excl svg { display:block; }
