
/* ── 10 条因子线配色（站点版：v1 序列令牌 + color-mix 派生，零裸 hex）── */
.vd-body {
  --fx-1: var(--chart-s5);                                              /* 规模  蓝 */
  --fx-2: var(--chart-s4);                                              /* Beta  红 */
  --fx-3: var(--chart-s2);                                              /* 残差波动 琥珀 */
  --fx-4: var(--chart-s3);                                              /* 非线性规模 紫 */
  --fx-5: var(--chart-s6);                                              /* 价值  绿 */
  --fx-6: color-mix(in srgb, var(--chart-s2) 60%, var(--chart-s4));     /* 流动性 砖 */
  --fx-7: color-mix(in srgb, var(--chart-s1) 40%, var(--chart-s5));     /* 盈利收益率 青蓝 */
  --fx-8: var(--chart-s1);                                              /* 成长  青 */
  --fx-9: color-mix(in srgb, var(--chart-s3) 50%, var(--chart-s4));     /* 杠杆  绛 */
  --fx-10: color-mix(in srgb, var(--chart-s6) 50%, var(--chart-s2));    /* 中期反转 橄榄 */
}

/* ══ 页面私有补充（仅本页用，不属于契约组件）══ */
.vd-body .grid-3{ display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.vd-body .grid-2{ display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }

@media (max-width: 1080px){ .vd-body .grid-3{ grid-template-columns: 1fr; }
 }

@media (max-width: 860px){
  .vd-body .grid-2{ grid-template-columns: 1fr; }

  .vd-body .mc-head-actions{ gap: 8px; }

  .vd-body .mc-summary{ display: none; }

}

.vd-body .legend-item{ border: 0; background: transparent; cursor: pointer; }

.vd-body .heat-table td, .vd-body .corr-table td{ padding: 2px 6px; text-align: right; }

.vd-body .heat-table th, .vd-body .corr-table th{ font-weight: 500; font-size: 10px; }

.vd-body .readout{ display: flex; flex-wrap: wrap; gap: 10px 24px; margin-top: 6px; }

.vd-body .readout-item{ display: flex; flex-direction: column; gap: 2px; }

.vd-body details.panel summary::-webkit-details-marker{ display: none; }

.vd-body details.panel{ margin-bottom: 8px; }

.vd-body #main-plot{ position: relative; }

/* ── 月度热力图（转置：行=因子，列=月份）─────────────────── */
.vd-body .heat-scroll{
  overflow-x: auto; overflow-y: hidden;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.vd-body .heat-scroll::-webkit-scrollbar{ height: 9px; }

.vd-body .heat-scroll::-webkit-scrollbar-thumb{
  background: var(--line-strong); border-radius: 5px;
}

.vd-body .heat-scroll::-webkit-scrollbar-track{ background: var(--line-soft); border-radius: 5px; }

.vd-body .heat-tw{ border-collapse: separate; border-spacing: 0; margin: 0; }

.vd-body .heat-tw th, .vd-body .heat-tw td{ text-align: center; padding: 1px; }

/* 每月固定宽度：由 --cell-w 控制，不随容器压缩 */
.vd-body .heat-tw .heat-m, .vd-body .heat-tw td.chart-heat{
  width: var(--cell-w, 62px);
  min-width: var(--cell-w, 62px);
  max-width: var(--cell-w, 62px);
}

.vd-body .heat-tw .heat-m{
  font-size: 9.5px; color: var(--muted); font-weight: 500;
  padding: 0 2px 4px; white-space: nowrap;
  position: sticky; top: 0; background: var(--paper); z-index: 2;
}

/* 因子名列：滚动时粘在左侧 */
.vd-body .heat-tw .heat-corner, .vd-body .heat-tw .heat-fac{
  position: sticky; left: 0; z-index: 3;
  background: var(--paper);
  text-align: left; white-space: nowrap;
  padding-right: 10px;
  min-width: 92px;
}

.vd-body .heat-tw .heat-corner{ z-index: 4; font-size: 9.5px; color: var(--muted); font-weight: 500; }

.vd-body .heat-tw .heat-fac{ font-size: 10.5px; color: var(--ink-soft); font-weight: 500; }

.vd-body .heat-tw td{ height: 22px; }

.vd-body .heat-tw td .chart-heat-label{ font-size: 9.5px; }

.vd-body .heat-scroll-hint{
  font-size: var(--fs-caption); color: var(--muted-2);
  margin-top: 4px; text-align: right;
}

@media (max-width: 860px){
  .vd-body .heat-scroll-hint{ text-align: left; }

}

/* ── CSV 下载按钮（每张图右上角的小图标）─────────────────── */
.vd-body .dl-btn{
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0; flex: none;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--paper); color: var(--muted);
  cursor: pointer; transition: color .12s, border-color .12s, background .12s;
}

.vd-body .dl-btn:hover{
  color: var(--accent); border-color: var(--accent);
  background: var(--accent-soft);
}

.vd-body .dl-btn:active{ transform: translateY(.5px); }

.vd-body .dl-btn svg{ display: block; }

/* 导出成功提示（右下角短暂浮现） */
.vd-body .csv-toast{
  position: fixed; right: 22px; bottom: 22px; z-index: 90;
  padding: 9px 15px; border-radius: var(--radius-sm);
  background: var(--nav); color: var(--paper);
  font-size: var(--fs-body); letter-spacing: .2px;
  box-shadow: 0 6px 20px rgba(16, 32, 48, .22);
  opacity: 0; transform: translateY(6px);
  transition: opacity .16s ease-out, transform .16s ease-out;
  pointer-events: none;
}

.vd-body .csv-toast.is-on{ opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce){
  .vd-body .csv-toast{ transition: none; }

}

@media print{ .vd-body .dl-btn, .vd-body .csv-toast{ display: none !important; }
 }


/* ── 十字线（主图与模拟组合共用）─────────────────────────── */
.vd-body .mc-cross{
  position: absolute; top: 0; bottom: 0; width: 1px;
  background: var(--line-strong);
  opacity: .9; pointer-events: none; display: none; z-index: 3;
}

.vd-body .chart-host{ position: relative; }

.vd-body #main-tip, .vd-body #mc-tip{ pointer-events: none; z-index: 8; }

.vd-body #main-tip.is-on, .vd-body #mc-tip.is-on{ opacity: 1; }

.vd-body #main-tip .tt-row em, .vd-body #mc-tip .tt-row em{
  font-style: normal; color: var(--muted-2);
  margin-left: 6px; font-size: 9.5px;
}


/* ── 相关性矩阵：多窗口面板 ─────────────────────────────── */
.vd-body .corr-panel[hidden]{ display: none; }

.vd-body .corr-note{
  margin-top: 8px; font-size: var(--fs-caption); color: var(--muted);
  line-height: 1.65;
}

.vd-body .corr-note b{ color: var(--ink-soft); font-weight: 600; }

.vd-body .corr-table td{ cursor: default; }

.vd-body .corr-table td:hover{ outline: 1.5px solid var(--accent); outline-offset: -1.5px; }


.vd-body #main-legend .legend-swatch{ width: 16px; height: 4px; border-radius: 2px; }

.vd-body #main-legend .legend-item{ padding: 3px 7px; }

/* 主图零轴线加重，便于读「风格中性」 */
.vd-body #main-plot .chart-grid line.is-zero{ stroke: var(--ink-soft); stroke-width: 1.1; }

/* 相关矩阵：表头吸顶 */
.vd-body .corr-table th{ position: sticky; top: 0; background: var(--paper); z-index: 1; }

.vd-body #sec-industry .panel-body{ overflow-x: auto; }


/* ── 模拟组合：头 / 图例 / 表格 ─────────────────────────── */
.vd-body .mc-head-actions{ display: flex; align-items: center; gap: 12px; }

.vd-body .mc-summary{ font-size: var(--fs-caption); color: var(--muted); }

.vd-body .mc-summary::before{ content: "当前："; color: var(--muted-2); }

.vd-body #mc-legend{ margin-bottom: 8px; }

.vd-body .mc-lg{ gap: 8px; }

.vd-body .mc-lg-dir{
  font-size: 9px; letter-spacing: .2px; color: var(--muted);
  border: 1px solid var(--line-strong); border-radius: 3px; padding: 0 4px;
}

.vd-body .mc-lg b{ font-variant-numeric: tabular-nums; }

.vd-body .mc-lg-hint{ font-size: var(--fs-caption); color: var(--muted-2); margin-left: 4px; }

.vd-body .mc-tbl td{ font-size: 10.5px; }

.vd-body .mc-nm{ display: flex; align-items: center; gap: 5px; }

.vd-body .mc-z{ color: var(--muted); }

.vd-body .mc-mini-tag{
  font-size: 9px; letter-spacing: .2px; color: var(--color-down-ink);
  background: var(--color-down-soft); border-radius: 2px; padding: 0 3px;
}


.vd-body .mc-split{ align-items: stretch; }

.vd-body .mc-split > .panel{ display: flex; flex-direction: column; min-height: 0; }

.vd-body .mc-split > .panel > .panel-body{ flex: 1 1 auto; min-height: 0; }

.vd-body .mc-split .panel-head{ flex: none; }

/* 左表行数少时不留大片空白：表格吸收剩余高度 */
.vd-body .mc-pick-tbl{ width: 100%; }


/* ── 各因子表现：可点击行 ───────────────────────────────── */
.vd-body .mc-pick-tbl tbody tr.mc-pick-row{ cursor: pointer; position: relative; }

.vd-body .mc-pick-tbl tbody tr.mc-pick-row:hover{ background: var(--surface-sunken); }

.vd-body .mc-pick-tbl tbody tr.mc-pick-row.is-active{ background: var(--accent-soft); }

.vd-body .mc-pick-tbl tbody tr.mc-pick-row.is-active td:first-child{ font-weight: 600; }

/* 选中行左侧主色指示条（2px，绝对定位，不参与表格布局） */
.vd-body .mc-pick-tbl tbody tr.mc-pick-row.is-active::after{
  content: ""; position: absolute; left: 0; top: 2px; bottom: 2px;
  width: 2px; border-radius: 1px; background: var(--accent);
}

.vd-body .mc-pick-tbl tbody tr.mc-pick-row:focus-visible{
  outline: 2px solid var(--focus-ring); outline-offset: -2px;
}

/* 表格下方的当前目标提示，填补行数少时的空白并说明联动关系 */
.vd-body .mc-pick-note{
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft);
  font-size: var(--fs-caption); color: var(--muted); line-height: 1.6;
}

.vd-body .mc-pick-note b{ color: var(--ink-soft); font-weight: 600; }


/* ── 成分股：权重条（以等权为中轴，左低配 / 右超配）───────── */
.vd-body .mc-cons-tbl .mc-wcell{ position: relative; width: 48%; padding-right: 6px; }

/* 中轴：50% 处的 1px 竖线，代表等权 */
.vd-body .mc-wtrack{
  position: absolute; left: 50%; top: 3px; bottom: 3px; width: 1px;
  background: var(--line-strong); pointer-events: none;
}

.vd-body .mc-wbar{
  position: absolute; top: 50%; transform: translateY(-50%);
  height: 11px; border-radius: 2px; pointer-events: none;
}

/* 超配向右（主色），低配向左（中性灰）——方向比红绿更重要 */
.vd-body .mc-wbar.is-over{ left: 50%; background: var(--accent); opacity: .18; }

.vd-body .mc-wbar.is-under{ right: 50%; background: var(--muted-2); opacity: .22; }

.vd-body .mc-wval{ position: relative; font-variant-numeric: tabular-nums; padding-left: 6px; }

.vd-body .mc-c-code{ color: var(--ink-soft); }


.vd-body #mc-cons .table, .vd-body #mc-table .table{ margin: 0; }

/* 窄屏：热力图 / 相关矩阵 / 行业图允许横向滚动，但不压缩列宽 */
@media (max-width: 860px){
  .vd-body .heat-table, .vd-body .corr-table{ min-width: 680px; }

  .vd-body #sec-heat .table-wrap, .vd-body #sec-corr .table-wrap{ overflow-x: auto; -webkit-overflow-scrolling: touch; }

  .vd-body #sec-industry .panel-body{ overflow-x: auto; }

  .vd-body #sec-industry svg{ min-width: 560px; }

  .vd-body .chart-host{ overflow-x: auto; }

  .vd-body #main-plot, .vd-body #mc-plot{ min-width: 640px; }

  .vd-body .card-head{ flex-wrap: wrap; gap: 8px; }

  .vd-body .ranges{ flex-wrap: wrap; }

}

.vd-body #mc-cons thead th, .vd-body #mc-table thead th{
  position: sticky; top: 0; background: var(--paper); z-index: 1;
  font-size: 9.5px; color: var(--muted); font-weight: 500;
  border-bottom: 1px solid var(--line);
}


/* ── 模拟组合：设置弹窗 ──────────────────────────────────── */
.vd-body .modal[hidden]{ display: none; }

.vd-body .modal{
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: var(--overlay);
  animation: barra-mc-fade .16s ease-out;
}

.vd-body .modal-card{
  width: min(560px, calc(100vw - 32px));
  max-height: min(86vh, 720px);
  display: flex; flex-direction: column;
  background: var(--paper); border-radius: var(--radius);
  box-shadow: 0 16px 48px rgba(16, 32, 48, .22);
  animation: barra-mc-rise .18s cubic-bezier(.22, .9, .3, 1);
}

@keyframes barra-mc-fade{ from { opacity: 0; } to { opacity: 1; } }

@keyframes barra-mc-rise{
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce){
  .vd-body .modal, .vd-body .modal-card{ animation: none; }

}

.vd-body .modal-head{
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 12px; border-bottom: 1px solid var(--line);
}

.vd-body .modal-close{
  border: 0; background: transparent; cursor: pointer; color: var(--muted);
  width: 26px; height: 26px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
}

.vd-body .modal-close:hover{ background: var(--surface-sunken); color: var(--ink); }

.vd-body .modal-body{ padding: 14px 18px; overflow: auto; }

.vd-body .modal-foot{
  padding: 12px 18px 16px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end;
}

.vd-body .mc-hint{ font-size: var(--fs-body); color: var(--ink-soft); line-height: 1.7; margin: 0 0 14px; }

.vd-body .mc-grid{ display: flex; flex-direction: column; gap: 2px; }

.vd-body .mc-row{
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: var(--radius-sm);
}

.vd-body .mc-row:hover{ background: var(--surface-sunken); }

.vd-body .mc-row.is-off{ opacity: .46; }

.vd-body .mc-pick{ display: flex; align-items: center; gap: 8px; cursor: pointer; flex: 1; min-width: 0; }

.vd-body .mc-dot{ width: 3px; height: 15px; border-radius: 2px; flex: none; }

.vd-body .mc-name{ font-size: var(--fs-body); color: var(--ink); }

.vd-body .mc-en{ font-size: var(--fs-caption); color: var(--muted-2); }

.vd-body .mc-dir{
  font: inherit; font-size: 10px; letter-spacing: .2px;
  color: var(--ink-soft); background: var(--accent-soft);
  border: 1px solid transparent; border-radius: 3px;
  padding: 2px 7px; cursor: pointer; font-variant-numeric: tabular-nums;
  transition: background .12s, color .12s;
}

.vd-body .mc-dir:hover{ border-color: var(--line-strong); }

.vd-body .mc-dir.is-bot{ background: var(--color-down-soft); color: var(--color-down-ink); }

.vd-body .mc-bulk{
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft);
}

.vd-body .mc-bulk .mc-pick{ flex: none; }

.vd-body :focus-visible{ outline: 2px solid var(--focus-ring); outline-offset: 2px; }

.vd-body ::selection{ background: var(--accent-soft); color: var(--ink); }

.vd-body #mc-cons::-webkit-scrollbar, .vd-body #mc-table::-webkit-scrollbar, .vd-body .modal-body::-webkit-scrollbar{
  width: 8px; height: 8px;
}

.vd-body #mc-cons::-webkit-scrollbar-thumb, .vd-body #mc-table::-webkit-scrollbar-thumb, .vd-body .modal-body::-webkit-scrollbar-thumb{
  background: var(--line-strong); border-radius: 4px;
}

.vd-body #mc-cons::-webkit-scrollbar-track, .vd-body #mc-table::-webkit-scrollbar-track, .vd-body .modal-body::-webkit-scrollbar-track{ background: transparent; }


/* ── 站点壳适配（M2）：导语 / 来源徽标 / 指标卡窄屏换行 ────────────── */
.vd-body { max-width: none; }
.vd-body .vd-meta {
  display: flex; align-items: flex-start; gap: 18px;
  margin: 2px 2px 16px;
}
.vd-body .vd-intro {
  flex: 1 1 auto; min-width: 0;
  margin: 0;
  font-size: var(--fs-body); line-height: 1.85; color: var(--muted);
}
.vd-body .vd-badges { display: flex; flex-wrap: wrap; gap: 6px; flex: none; }
.vd-body .metrics { margin: 0 0 18px; }
/* 指标读数是数据：按 A 股口径红涨绿跌复位（与站点壳 .card .metric-value 同规则） */
.vd-body .metric-value.is-up { color: var(--color-up); }
.vd-body .metric-value.is-down { color: var(--color-down); }
@media (max-width: 720px) {
  .vd-body .vd-meta { flex-direction: column-reverse; gap: 10px; }
  .vd-body .vd-badges { justify-content: flex-start; }
  .vd-body .metrics { margin-bottom: 14px; }
  .vd-body .metric-value { white-space: normal; overflow-wrap: anywhere; }
}
