/* ============================================================================
   DeadStock 周趋势样式  ds_weekly.css  v3
   主题：与 pyq-score 站点对齐
     - 容器透明（透出 body #f1f5f9）、padding 16px 20px（同总览页）
     - 卡片无边框 + shadow 0 2px 8px rgba(0,0,0,.06)（同总览页卡片）
   涨=红 跌=绿（中国习惯）
   ========================================================================== */

/* ---------- 容器：与 #ds-overview 内层保持一致 ---------- */
.ds-weekly-wrap {
  padding: 16px 20px 24px;
  background: transparent;
}

/* ---------- 顶部工具条 ---------- */
.ds-weekly-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.ds-weekly-bar .ttl {
  font-size: 15px;
  font-weight: 600;
  color: #1f2329;
  letter-spacing: .2px;
}
.ds-weekly-bar .ttl i {
  font-style: normal;
  font-size: 12px;
  font-weight: 400;
  color: #8f959e;
  margin-left: 8px;
}
.ds-weekly-bar .spacer { flex: 1; }

.ds-weekly-bar select,
.ds-weekly-bar label.chk {
  height: 30px;
  line-height: 28px;
  padding: 0 9px;
  border: 1px solid #e3e7ec;
  border-radius: 6px;
  background: #fff;
  font-size: 12.5px;
  color: #1f2329;
  cursor: pointer;
  transition: .16s;
}
.ds-weekly-bar select:hover,
.ds-weekly-bar label.chk:hover { border-color: #1890ff; }
.ds-weekly-bar label.chk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
.ds-weekly-bar label.chk input { margin: 0; cursor: pointer; }
.ds-weekly-bar .refresh {
  height: 30px;
  padding: 0 13px;
  border: 1px solid #e3e7ec;
  border-radius: 6px;
  background: #fff;
  color: #5a6474;
  font-size: 12.5px;
  cursor: pointer;
  transition: .16s;
}
.ds-weekly-bar .refresh:hover {
  border-color: #1890ff; color: #1890ff; background: #f7fbff;
}

/* ---------- KPI 卡片（对齐总览页卡片：无边框 + 柔和阴影）---------- */
.ds-weekly-kpi {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
@media (max-width: 1100px) {
  .ds-weekly-kpi { grid-template-columns: repeat(2, 1fr); }
}
.ds-kpi {
  background: #fff;
  border: none;
  border-radius: 10px;
  padding: 13px 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
  position: relative;
  overflow: hidden;
}
.ds-kpi::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, #40a9ff, #91d5ff);
}
.ds-kpi-t {
  font-size: 12px;
  color: #8f959e;
  margin-bottom: 6px;
  letter-spacing: .2px;
}
.ds-kpi-v {
  font-size: 22px;
  font-weight: 700;
  color: #1f2329;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.ds-kpi-s {
  font-size: 11.5px;
  color: #8f959e;
  margin-top: 5px;
  font-variant-numeric: tabular-nums;
}
.ds-kpi-s b { font-weight: 600; }

/* ---------- 涨跌色：中国习惯 涨红跌绿 ---------- */
.ds-up { color: #e8484b !important; }
.ds-down { color: #17b26a !important; }

/* ---------- 品类开关 ---------- */
.ds-weekly-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}
.ds-cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid #e3e7ec;
  border-radius: 14px;
  background: #fff;
  font-size: 12px;
  color: #8f959e;
  cursor: pointer;
  user-select: none;
  transition: .16s;
  opacity: .5;
}
.ds-cat-chip.on {
  opacity: 1;
  color: #1f2329;
  border-color: #dfe4ea;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
}
.ds-cat-chip:hover { border-color: #1890ff; }
.ds-cat-chip .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex: none;
}
.ds-cat-chip .nm { font-weight: 600; }
.ds-cat-chip .vl {
  font-size: 11px;
  color: #a3a9b3;
  font-variant-numeric: tabular-nums;
  padding-left: 7px;
  border-left: 1px solid #eef1f4;
  margin-left: 1px;
}
.ds-cat-chip.on .vl { color: #6b7480; }

/* ---------- 图表容器 ---------- */
.ds-weekly-chart-box {
  background: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 12px 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
  margin-bottom: 14px;
  position: relative;
  height: 360px;
}
.ds-weekly-chart-box canvas { width: 100% !important; height: 100% !important; }

/* ---------- 周/月环比表 ---------- */
.ds-weekly-tb-wrap {
  background: #fff;
  border: none;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
  overflow: auto;
  max-height: 440px;
}
.ds-weekly-tb {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ds-weekly-tb th,
.ds-weekly-tb td {
  padding: 8px 14px;
  border-bottom: 1px solid #f2f4f7;
  text-align: right;
}
.ds-weekly-tb thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fafbfc;
  color: #6b7480;
  font-weight: 600;
  font-size: 11.5px;
  border-bottom: 1px solid #eaedf1;
}
.ds-weekly-tb thead th.ds-th-name,
.ds-weekly-tb tbody th {
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff;
  font-weight: 500;
  color: #1f2329;
  min-width: 88px;
  border-right: 1px solid #f2f4f7;
}
.ds-weekly-tb thead th.ds-th-name {
  z-index: 3;
  background: #fafbfc;
}
.ds-weekly-tb tbody tr:hover td,
.ds-weekly-tb tbody tr:hover th { background: #f7fbff; }

.ds-weekly-tb td i {
  display: block;
  font-style: normal;
  font-size: 10px;
  line-height: 1.35;
  opacity: .92;
}

/* 月节点列：轻微底色，表示「这是月度汇总点」 */
.ds-weekly-tb th.ds-mo,
.ds-weekly-tb td.ds-mo {
  background: #fcfcfd;
}
.ds-weekly-tb th.ds-mo {
  color: #1f2329;
  font-weight: 700;
}
.ds-weekly-tb tbody tr:hover td.ds-mo { background: #f4f9ff; }

/* 旧口径列：灰化，提示不可与新数据直接比较 */
.ds-weekly-tb th.ds-lgcy,
.ds-weekly-tb td.ds-lgcy {
  background: #f7f8fa !important;
  color: #a3a9b3 !important;
}
.ds-weekly-tb td.ds-lgcy i { color: #b8bec7 !important; }

.ds-weekly-tb .ds-row-total th,
.ds-weekly-tb .ds-row-total td {
  background: #fdfcf9 !important;
  font-weight: 700;
  color: #1f2329;
  border-bottom: 1px solid #f0e9dc;
}
.ds-weekly-tb .ds-row-total th.ds-lgcy,
.ds-weekly-tb .ds-row-total td.ds-lgcy {
  background: #f7f8fa !important;
  color: #a3a9b3 !important;
}
.ds-weekly-tb .ds-cur {
  background: #f5faff !important;
}
.ds-weekly-tb .ds-row-total .ds-cur {
  background: #fdf8ef !important;
}

.ds-empty {
  padding: 48px;
  text-align: center;
  color: #a3a9b3;
  font-size: 13px;
}

/* ---------- 数据说明 ---------- */
.ds-weekly-note {
  margin-top: 12px;
  padding: 10px 14px;
  background: #fff;
  border: none;
  border-left: 3px solid #d6e4f0;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .04);
  font-size: 11.5px;
  color: #6b7480;
  line-height: 1.85;
}
.ds-weekly-note b { color: #1f2329; }
#ds-note-detail b { color: #1f2329; }

/* 「近31天按周·更早按月」小标签 */
.ds-note-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  background: #eef6ff;
  color: #1677cc;
  border-radius: 3px;
  font-size: 10.5px;
  line-height: 1.6;
  vertical-align: 1px;
}

/* 「展开详情」链接 */
.ds-note-more {
  margin-left: 8px;
  color: #1677cc;
  text-decoration: none;
  font-size: 11px;
  cursor: pointer;
}
.ds-note-more:hover { text-decoration: underline; }

.ds-weekly-note .warn {
  display: inline-block;
  margin-top: 4px;
  color: #b26a00;
}

/* ---------- 加载态 ---------- */
.ds-weekly-loading {
  padding: 60px;
  text-align: center;
  color: #8f959e;
  font-size: 13px;
}
.ds-weekly-loading::after {
  content: '';
  display: inline-block;
  width: 14px; height: 14px;
  margin-left: 8px;
  border: 2px solid #d9dde3;
  border-top-color: #1890ff;
  border-radius: 50%;
  vertical-align: -2px;
  animation: ds-spin .8s linear infinite;
}
@keyframes ds-spin { to { transform: rotate(360deg); } }
