/* ============================================================================
   看板图形层：图例 / 折线 / 条形 / 堆叠 / 五张分布卡 / 重要程度 / 粒度切换 /
   三段总结 / 骨架。布局层在 board.css。
   ========================================================================== */
/* ── 图例 / 图形 ──────────────────────────────────────────────────────── */
.legend {
  display: flex;
  gap: var(--space-md);
  margin: 0 0 0 auto;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: var(--fs-d8);
}
.legend li { display: flex; align-items: center; gap: var(--space-xs); }
.legend__dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.legend__dot--new { background: var(--accent); }
.legend__dot--done { background: var(--success); }

.chart-line { display: block; width: 100%; height: auto; }

.bars { display: flex; flex-direction: column; gap: var(--space-xs); }
.bars__row {
  /* 内容驱动高度：标签行 → 条，再留 6px 给下一条目的呼吸。
     绝不写死 height——固定 24px 时内容需要 26px，就会压字。 */
  display: flex;
  flex-direction: column;
  gap: var(--gap-rail-item); /* 2px：标签行与条之间的贴合缝 */
  padding-bottom: 6px;
  font-size: var(--fs-d7);
}
.bars__label-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-sm);
  min-width: 0;
}
.bars__label {
  min-width: 0;
  color: var(--muted);
  font-size: var(--fs-d7);
  line-height: var(--lh-d7);
  white-space: normal;
  overflow-wrap: anywhere;
}
.bars__track { flex: none; width: 100%; height: 6px; display: block; }
.bars__value {
  grid-area: value;
  justify-self: stretch;
  text-align: right;
  white-space: normal;   /* 数字比卡片宽时换行，绝不允许溢出卡片边界 */
  color: var(--ink);
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-d6);
  white-space: nowrap;
}
.bars__imp { color: var(--danger); }
.bars__empty { color: var(--faint); font-size: var(--fs-d8); margin: 0; }
.stack { display: block; }

.stack__bar { width: 100%; height: 14px; display: block; margin-bottom: var(--space-sm); }
.stack__legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-lg);
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: var(--fs-d8);
}
.stack__legend li { display: flex; align-items: center; gap: var(--space-xs); }
.stack__dot { width: 8px; height: 8px; }

/* ── 四个分布：2×2 ────────────────────────────────────────────────────── */
/* 四等分区：条目形态与其它列一致（内容驱动高度），只保证不换行挤压 */
.dists-row--four .bars__label { white-space: normal; overflow-wrap: anywhere; line-height: 1.2; }
/* 四等分区把「数值行」的行高压到 1.2：14px 的默认 1.5 会把单项顶到 35，
   而这一行只需要"标签 + 数字"对齐，不需要额外 leading */
.dists-row--four .bars__value { white-space: nowrap; line-height: 1.2; }
.dists-row--four .bars__row { padding-bottom: var(--space-sm); row-gap: 2px; }  /* 条贴自己标签，条下留 8px 隔开下一行 */  /* 条形与标签之间留 4px，否则条看着像划在字上 */
.dists-row--four .dist__title { margin-bottom: 0; }

/* 两行布局：第一行四等分，第二行 360 + 剩余 */
.dists-row { display: grid; column-gap: var(--space-lg); }
.dists-row--four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dists-row--full { margin-top: var(--space-lg); display: block; }  /* 通栏：不要按内容宽度收缩 */
.dists-row--full .asker { width: 100%; }
.dists-row > .dist { align-self: start; }
/* 明细展开后：一个 panel 里 5 个列组，组内不再各自成卡 */
.dist { padding: 0; background: none; border: 0; border-radius: 0; }
.dist__title {
  margin-bottom: var(--space-xs);
  font-size: var(--fs-d6);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-caption);
  color: var(--muted);
}

/* ── 骨架（数据未到达时整页灰条，不白屏、不写 loading）────────────────── */
.sk {
  display: block;
  height: var(--space-md);
  border-radius: var(--radius-sm);
  background: var(--surface-skeleton);
  animation: breathe var(--dur-skeleton) var(--ease-in-out) infinite;
}
.pie--sk .sk { height: var(--space-md); }
@keyframes breathe {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .core { grid-template-columns: minmax(0, 1fr); }
  .dists { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }

/* ── 粒度切换（日/周/月）：当前项 accent 底白字，其余描边 ─────────────── */
.panel__tools { display: flex; align-items: center; gap: var(--space-md); margin-left: auto; }
.seg {
  display: inline-flex;
  padding: 2px;
  border: var(--bw-hairline) solid var(--border);
  border-radius: var(--radius-sm);
}
.seg__item {
  height: 24px;
  padding: 0 var(--space-md);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: var(--fs-d8);
  line-height: 24px;
}
.seg__item[aria-checked="true"] {
  background: var(--accent);
  color: var(--on-accent);
}

/* ── 重要程度卡 ───────────────────────────────────────────────────────── */
.legend__dot--danger { background: var(--danger); }
.legend__dot--stop { background: var(--neutral); opacity: 0.4; }
.legend__dot--blank { background: var(--border); }
.dists__hint {
  margin: var(--space-sm) 0 0;
  padding-top: var(--space-sm);
  border-top: var(--bw-hairline) solid var(--hairline);
  color: var(--muted);
  font-size: var(--fs-d8);
}

/* ── 三段总结：通栏一条摘要，左侧 3px accent 竖条（不是卡片）────────── */
/* 导读：无框无条，两段（16px ink / 14px muted） */
.summary { display: flex; flex-direction: column; min-height: 64px; }
.summary__lead {
  margin: 0;
  color: var(--ink);
  font-size: var(--fs-d5);
  line-height: 1.7;
}
.summary__sub {
  margin: var(--space-sm) 0 0;
  color: var(--muted);
  font-size: var(--fs-d6);
  line-height: 1.6;
}
.summary__lead strong,
.summary__sub strong { font-weight: var(--fw-medium); color: var(--ink); }

/* ── 「明细统计」：常开，标题行写明这块跟的是哪个时间窗口 ──────────────── */
.dists-collapse {
  background: var(--surface);
  border: var(--bw-hairline) solid var(--hairline);
  border-radius: var(--radius-md);
}
.dists__head {
  display: flex;
  align-items: center;   /* baseline 会让这一行贴着上边框，看着像掉出来了 */
  gap: var(--space-md);
  height: 52px;
  padding: 0 var(--space-lg);
  border-bottom: var(--bw-hairline) solid var(--hairline);
}
.dists__title {
  margin: 0;
  color: var(--ink);
  font-size: var(--fs-d6);
  font-weight: var(--fw-medium);
  line-height: var(--lh-d6);
}
/* 窗口 + 分组说明：淡，但要看得见——它是这块和上面 KPI 口径不同的唯一解释 */
.dists__meta {
  color: var(--faint);
  font-size: var(--fs-d8);
  letter-spacing: var(--ls-caption);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dists-body { padding: var(--space-lg); }

/* ── 客户问统计表（真表格，跟台账同一套气质）──────────────────────────── */
.asker__wrap { min-width: 0; }
.asker {
  /* 通栏：宽度吃满 panel，列宽按比例分，避免右侧一大片空白 */
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-d7);
}
.asker__caption {
  padding-bottom: 0;
  color: var(--muted);
  font-size: var(--fs-d6);
  font-weight: var(--fw-medium);
  text-align: left;
  letter-spacing: var(--ls-caption);
}
.asker th,
.asker td {
  height: 40px;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 var(--space-md);
  text-align: left;
  border-bottom: var(--bw-hairline) solid var(--hairline);
  white-space: nowrap;
}
.asker th {
  color: var(--muted);
  font-size: var(--fs-d7);
  font-weight: var(--fw-medium);
  /* 表头上边框 + 数字列表头右对齐：让「数在其列上」 */
  border-top: var(--bw-hairline) solid var(--hairline);
}
.asker th.num { text-align: right; }
.asker th:nth-child(1), .asker td:nth-child(1) { width: 30%; }
.asker th:nth-child(2), .asker td:nth-child(2) { width: 17.5%; }
.asker th:nth-child(3), .asker td:nth-child(3) { width: 17.5%; }
.asker th:nth-child(4), .asker td:nth-child(4) { width: 17.5%; }
.asker th:nth-child(5), .asker td:nth-child(5) { width: 17.5%; }
.asker .num { text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.asker .num--alert { color: var(--danger); font-weight: var(--fw-medium); }
.asker .asker__sum td {
  color: var(--muted);
  font-weight: var(--fw-medium);
  border-bottom: 0;
  border-top: var(--bw-hairline) solid var(--hairline);
}

/* ── 「构成」列组：两条同款堆叠条 ─────────────────────────────────────── */
.dist--compose { min-width: 0; }
.compose__row + .compose__row { margin-top: var(--space-md); }
.compose__head { display: flex; align-items: baseline; gap: var(--space-sm); }
.compose__title { color: var(--muted); font-size: var(--fs-d8); letter-spacing: var(--ls-caption); }
.compose__total { margin-left: auto; color: var(--faint); font-size: var(--fs-d8); font-variant-numeric: tabular-nums; }
/* 两条同宽：都是 100%，图例在下一行，不会挤条 */
.compose__bar { display: block; width: 100%; height: 10px; margin: var(--space-xs) 0; }
.compose__legend { display: flex; flex-wrap: wrap; gap: 0 var(--space-md); margin: 0; color: var(--muted); font-size: var(--fs-d8); }
.compose__legendItem { display: inline-flex; align-items: center; gap: var(--space-xs); white-space: nowrap; }
.legend__dot--new-weak { background: var(--accent-weak); }
