/* 拼多多店群运营控制台 — 样式 */
[v-cloak] { display: none; }

:root {
  --el-color-primary: #2f6fed;
  --bg: #f4f6fa;
  --card: #ffffff;
  --line: #e8ecf3;
  --txt: #1f2a3d;
  --txt2: #5b6779;
  --txt3: #8a94a6;
  --green: #17a673;
  --orange: #e6a23c;
  --red: #e34d59;
  --blue: #2f6fed;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

.layout { display: flex; height: 100vh; overflow: hidden; }

/* ---------------- 侧边栏 ---------------- */
.side {
  width: 208px; flex: 0 0 208px; background: var(--card);
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 14px; }
.logo {
  width: 34px; height: 34px; border-radius: 9px; flex: 0 0 34px;
  background: linear-gradient(135deg, #2f6fed, #5b8ff9);
  color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .5px;
  display: flex; align-items: center; justify-content: center;
}
.brand-t { font-weight: 650; font-size: 14px; line-height: 1.3; }
.brand-s { color: var(--txt3); font-size: 11px; }

.nav { padding: 6px 10px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 8px;
  color: var(--txt2); cursor: pointer; font-size: 13px; margin-bottom: 2px;
  transition: background .15s, color .15s; user-select: none;
}
.nav-item:hover { background: #f2f5fb; color: var(--txt); }
.nav-item.on { background: #eaf1fe; color: var(--blue); font-weight: 600; }
.nav-item .ico { width: 16px; text-align: center; font-size: 14px; opacity: .85; }
.badge {
  margin-left: auto; background: var(--red); color: #fff; font-size: 10px;
  min-width: 17px; height: 17px; line-height: 17px; text-align: center;
  border-radius: 9px; padding: 0 5px; font-weight: 600;
}
.nav-item.on .badge { background: var(--blue); }

.side-foot { padding: 12px 14px; border-top: 1px solid var(--line); }
.src { font-size: 11px; padding: 5px 9px; border-radius: 6px; text-align: center; font-weight: 600; }
.src.demo { background: #fff7e8; color: #b3730a; }
.src.live { background: #e8f7f0; color: #0e7d55; }
.foot-tip {
  color: var(--txt3); font-size: 10px; text-align: center; margin-top: 7px;
  display: flex; justify-content: center; gap: 8px; align-items: center;
}
.foot-tip .logout { color: var(--txt3); cursor: pointer; text-decoration: underline dotted; }
.foot-tip .logout:hover { color: var(--blue); }

.beian { text-align: center; margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line); }
.beian-links { font-size: 10px; color: var(--txt3); }
.beian-links a { color: var(--txt3); text-decoration: none; }
.beian-links a:hover { color: var(--blue); }
.beian-corp {
  font-size: 10px; color: var(--txt3); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.beian-no {
  display: inline-block; font-size: 10px; color: var(--txt3);
  text-decoration: none; margin-top: 2px;
}
.beian-no:hover { color: var(--blue); }

/* ---------------- 登录页 ---------------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 20px;
}
.login-card {
  width: 380px; background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 34px 32px 24px; box-shadow: 0 8px 34px rgba(31, 42, 61, .07);
}
.lc-head { text-align: center; margin-bottom: 24px; }
.logo.lg {
  width: 46px; height: 46px; border-radius: 12px; font-size: 16px; margin: 0 auto 14px;
  flex: none;
}
.lc-head h1 { font-size: 18px; font-weight: 600; margin: 0 0 6px; letter-spacing: .5px; }
.lc-head p { font-size: 11.5px; color: var(--txt3); margin: 0; }
.lc-input { margin-bottom: 12px; }
.lc-ico { font-size: 11px; color: var(--txt3); }
.lc-btn { width: 100%; margin-top: 6px; letter-spacing: 4px; }
.lc-foot { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); text-align: center; }
.lc-links { font-size: 11.5px; color: var(--txt3); margin-bottom: 8px; }
.lc-links a { color: var(--txt2); text-decoration: none; }
.lc-links a:hover { color: var(--blue); }
.lc-links span { margin: 0 6px; color: var(--line); }
.lc-corp { font-size: 11px; color: var(--txt3); }
.lc-beian { display: inline-block; font-size: 11px; color: var(--txt3); text-decoration: none; margin-top: 3px; }
.lc-beian:hover { color: var(--blue); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 24px; }
@media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } }

/* ---------------- 主区 ---------------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 58px; flex: 0 0 58px; background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
}
.tb-left { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.tb-left h1 { font-size: 16px; font-weight: 650; margin: 0; white-space: nowrap; }
.tb-left .sub { color: var(--txt3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-right { display: flex; align-items: center; gap: 10px; }
.sync-time { color: var(--txt3); font-size: 11px; white-space: nowrap; }

.content { flex: 1; overflow-y: auto; padding: 16px 20px 32px; }
.content > section { animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* ---------------- KPI ---------------- */
.kpi-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px;
}
.kpi-row.mini { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 13px 15px;
}
.kpi-label { color: var(--txt3); font-size: 11.5px; margin-bottom: 6px; }
.kpi-val { font-size: 22px; font-weight: 650; letter-spacing: -.3px; line-height: 1.15; }
.kpi-val.sm { font-size: 18px; }
.kpi-unit { font-size: 12px; font-weight: 400; color: var(--txt3); margin-left: 3px; }
.kpi-sub { font-size: 11px; margin-top: 5px; display: flex; gap: 5px; align-items: center; }
.kpi-sub.up { color: var(--red); }      /* 电商习惯：涨=红 */
.kpi-sub.down { color: var(--green); }
.muted { color: var(--txt3); }
.small { font-size: 11.5px; }
.tiny { font-size: 10.5px; }
.red { color: var(--red) !important; }
.green { color: var(--green) !important; }

/* ---------------- 卡片 ---------------- */
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; margin-bottom: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; margin-bottom: 14px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px 10px; margin-bottom: 14px; min-width: 0;
}
.grid-2 .card, .grid-3 .card { margin-bottom: 0; }
.card-h {
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 600; font-size: 13px; margin-bottom: 10px; gap: 10px; flex-wrap: wrap;
}
.tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chart { width: 100%; height: 248px; }
.chart-sm { width: 100%; height: 190px; }
.dims { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 22px; padding-bottom: 4px; }
.dim-h { display: flex; justify-content: space-between; font-size: 11.5px; margin-bottom: 4px; }

.span2 { }

/* ---------------- 排行 ---------------- */
.rank { padding: 2px 0 6px; }
.rank-row { display: flex; align-items: center; gap: 9px; padding: 6px 0; font-size: 12px; }
.rk {
  width: 18px; height: 18px; flex: 0 0 18px; border-radius: 5px; background: #eef2f8;
  color: var(--txt3); font-size: 10.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.rk1 { background: #ffe9d6; color: #c65a00; }
.rk2 { background: #e6eefc; color: #2f6fed; }
.rk3 { background: #e9f2f0; color: #0e7d55; }
.rk-name { width: 128px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-cvr { width: 46px; text-align: right; }
.rk-bar { flex: 1; height: 6px; background: #f0f3f8; border-radius: 3px; overflow: hidden; }
.rk-bar i { display: block; height: 100%; background: linear-gradient(90deg, #7ea9f7, #2f6fed); border-radius: 3px; }
.rk-val { width: 74px; text-align: right; font-weight: 600; }

/* ---------------- 预警 ---------------- */
.alerts { max-height: 268px; overflow-y: auto; }
.alert {
  border-left: 3px solid var(--red); background: #fff8f8; border-radius: 0 6px 6px 0;
  padding: 8px 10px; margin-bottom: 7px;
}
.al-top { display: flex; align-items: center; gap: 7px; margin-bottom: 3px; }
.al-dim { font-size: 11px; color: var(--red); font-weight: 600; }
.al-store { font-size: 11px; color: var(--txt3); }
.al-score { margin-left: auto; font-size: 11px; color: var(--txt3); }
.al-title { font-size: 12px; font-weight: 600; margin-bottom: 2px; }
.al-goods { font-size: 11px; color: var(--txt3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- 通用 ---------------- */
.bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.bar-l { display: flex; gap: 8px; }
.pill {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 12px; font-size: 12px; color: var(--txt2);
}
.pill b { color: var(--txt); font-size: 14px; margin-left: 3px; }
.cell-store b { display: block; font-size: 12.5px; font-weight: 600; }
.pager { display: flex; justify-content: flex-end; padding: 10px 0 2px; }
.t1 { font-size: 12.5px; line-height: 1.35; }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 11px; }

/* 等级色 */
.grade-tag { display: inline-block; padding: 1px 7px; border-radius: 5px; font-size: 11px; font-weight: 700; }
.gS { background: #e4f6ee; color: #0e7d55; }
.gA { background: #eaf7f1; color: #1b8a63; }
.gB { background: #fdf3e2; color: #a86a12; }
.gC { background: #fdeee2; color: #b45c15; }
.gD { background: #fdeaea; color: #c03a44; }

.score-cell {
  display: inline-block; min-width: 34px; padding: 2px 6px; border-radius: 6px;
  font-weight: 700; font-size: 12.5px; text-align: center;
}
.mini-dim {
  display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 10.5px;
  margin-right: 4px; background: #f3f5f9; color: var(--txt2);
}
.mini-dim.bad { background: #fdeaea; color: #c03a44; }
.mini-dim.warn { background: #fdf3e2; color: #a86a12; }
.mini-dim.ok { background: #eaf7f1; color: #1b8a63; }

.lv {
  display: inline-block; padding: 0 5px; border-radius: 4px; font-size: 10px;
  font-weight: 700; margin-right: 5px; vertical-align: 1px;
}
.lv.p0 { background: #fdeaea; color: #c03a44; }
.lv.p1 { background: #fdf3e2; color: #a86a12; }
.lv.p2 { background: #eef2f8; color: var(--txt3); }

/* 得分概览 */
.score-big { text-align: center; padding: 12px 0 16px; }
.sg-num { font-size: 46px; font-weight: 700; line-height: 1; letter-spacing: -1.5px; color: var(--blue); }
.sg-lbl { color: var(--txt3); font-size: 11.5px; margin: 6px 0 12px; }
.sg-grades { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }

/* 抽屉 */
.dt { padding: 0 2px 20px; }
.dt-top { display: flex; gap: 18px; align-items: center; margin-bottom: 10px; }
.dt-score { text-align: center; flex: 0 0 96px; }
.ds-num {
  font-size: 38px; font-weight: 700; line-height: 1; letter-spacing: -1px;
  background: none; padding: 0;
}
.ds-lbl { font-size: 10.5px; color: var(--txt3); margin-top: 5px; line-height: 1.4; }
.dt-metrics { flex: 1; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.dt-metrics > div { background: #f7f9fc; border-radius: 7px; padding: 8px 6px; text-align: center; }
.dt-metrics b { display: block; font-size: 14px; }
.dt-metrics span { font-size: 10px; color: var(--txt3); }

.sec-t {
  font-weight: 600; font-size: 12.5px; margin: 16px 0 9px;
  padding-left: 8px; border-left: 3px solid var(--blue);
}
.adv { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.adv-h { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.adv-t { font-weight: 600; font-size: 12.5px; flex: 1; }
.adv-gain { color: var(--green); font-size: 11px; font-weight: 700; white-space: nowrap; }
.adv-d { font-size: 11.5px; color: var(--txt2); line-height: 1.62; }
.adv-f { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }

.cmt { display: flex; gap: 8px; align-items: baseline; padding: 6px 0; border-bottom: 1px dashed #f0f3f8; font-size: 12px; }
.cmt-s { color: #f0a020; font-size: 10px; flex: 0 0 auto; }
.cmt-s.bad { color: var(--red); }
.cmt-c { flex: 1; color: var(--txt2); line-height: 1.5; }

/* 任务 */
.tasks { max-height: 460px; overflow-y: auto; }
.task { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.tk-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
.tk-title { font-weight: 600; font-size: 12.5px; }
.tk-bar { display: flex; align-items: center; gap: 10px; }
.tk-prog { flex: 1; height: 5px; background: #f0f3f8; border-radius: 3px; overflow: hidden; }
.tk-prog i { display: block; height: 100%; background: var(--green); border-radius: 3px; transition: width .3s; }
.tk-log { margin-top: 6px; line-height: 1.6; }

/* 表单 */
.form .fr { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.form .fr > label { width: 76px; flex: 0 0 76px; color: var(--txt2); font-size: 12px; }
.tip-box {
  background: #f7f9fc; border: 1px dashed #d8e0ec; border-radius: 8px;
  padding: 10px 12px; font-size: 11px; color: var(--txt2); line-height: 1.75;
}
.tip-box code { background: #eef2f8; padding: 1px 5px; border-radius: 4px; font-size: 10.5px; }

/* 机会 */
.opps { padding-bottom: 8px; }
.opp { border-left: 3px solid var(--orange); background: #fffbf3; border-radius: 0 7px 7px 0; padding: 9px 12px; margin-bottom: 8px; }
.opp-h { font-weight: 600; font-size: 12.5px; margin-bottom: 3px; }
.opp-d { font-size: 11.5px; color: var(--txt2); line-height: 1.6; }

.trace-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--line); padding-bottom: 10px; }

.probe-tip {
  background: #f0f6ff; border: 1px solid #d6e4fb; border-radius: 7px;
  padding: 8px 12px; font-size: 11.5px; color: #26508f; margin-bottom: 10px; line-height: 1.6;
}

/* Element Plus 微调 */
.el-table { font-size: 12px; }
.el-table th.el-table__cell { background: #fafbfd !important; color: var(--txt2); font-weight: 600; }
.el-table .cell { padding: 0 8px; }
.el-button { font-weight: 500; }
.el-drawer__header { margin-bottom: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.el-dialog__header { font-weight: 600; }

@media (max-width: 1280px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .dims { grid-template-columns: 1fr; }
}
