/* ==========================================================================
   GC Quant Research Edition · 全站一致性收敛层
   --------------------------------------------------------------------------
   本文件必须**最后**加载。它只做一件事：把各页历史遗留的排版取值收敛到
   assets/research-tokens.css 中的母版 token，避免各页 CSS 之间互相覆盖。
   不新增任何设计值，不改变任何页面的结构与数据。
   母版：quant_system/qmt_dashboard.py
   ========================================================================== */

/* ---- 页面背景与字体：母版为纯色 #f5f7fb + Inter/PingFang SC ---- */
html body {
  background-image: none;
  background-color: var(--dash-bg);
  font-family: var(--dash-font-family);
}

/* ---- 页面主标题统一 34px（--dash-font-title） ---- */
html body h1,
html body .research-hero h1,
html body .research-block h1,
html body .dashboard-section-heading h1,
html body .mt-title,
html body .theme-page-heading h1,
html body .snapshot-header h1,
html body .history-main h1,
html body #etf-page-title,
html body #mth-title {
  font-size: var(--dash-font-title);
  line-height: 1.22;
}

/* ---- 小节标题统一 22px（--dash-font-section） ---- */
html body h2,
html body .dashboard-section-heading h2,
html body .research-block h2,
html body .research-section h2,
html body .research-panel h2 {
  font-size: var(--dash-font-section);
  line-height: 1.3;
}

/* ---- 卡片标题统一 16px（--dash-font-card-title） ---- */
html body .research-panel h3,
html body .research-section h3,
html body .research-block h3 {
  font-size: var(--dash-font-card-title);
  line-height: 1.35;
}

/* 题材卡内标题保持母版 .theme-card-title h3 = 20px，不被上面的 16px 收走 */
html body .theme-card-title h3 { font-size: 20px; }

/* ---- 内容容器宽度与内边距统一（母版 main{1480px / 20px 24px 48px}） ---- */
html body main,
html body .research-main,
html body .theme-dashboard-main,
html body .history-main {
  max-width: var(--content-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--content-padding-x);
  padding-right: var(--content-padding-x);
}

html body .history-main {
  padding-top: var(--content-padding-top);
  padding-bottom: var(--content-padding-bottom);
}

/* 历史页内部 wrap 不再二次限宽，避免出现 1240px 的第二套宽度 */
html body .history-main .history-wrap {
  max-width: none;
  padding-left: 0;
  padding-right: 0;
}

/* ---- 顶部导航：对齐母版 .page-nav（padding 9px 13px / 无阴影 / margin-bottom 14px） ---- */
html body .page-nav,
html body .history-nav {
  margin-bottom: 14px;
}

html body .page-nav a,
html body .history-nav a {
  padding: 9px 13px;
  border-radius: 8px;
  font-weight: 820;
  box-shadow: none;
  white-space: nowrap;
}

html body .page-nav a.active,
html body .history-nav a.active {
  background: #111827;
  border-color: #111827;
  color: #fff;
  box-shadow: none;
}

/* .history-nav 是 .history-head 的 flex 子项：没有 min-width:0 时它不会收缩到内容宽度以下，
   overflow-x:auto 因此不生效，导航会把整页撑破（实测 768/390 均溢出）。 */
html body .history-head {
  flex-wrap: wrap;
  min-width: 0;
}

html body .history-nav {
  min-width: 0;
  max-width: 100%;
  flex: 1 1 auto;
}

/* 窄屏下 .history-head 会切成 flex-direction:column + align-items:flex-start，
   此时 nav 会按内容宽度收缩包裹（shrink-to-fit）而不是跟随容器，overflow-x 仍然失效。
   显式拉伸到容器宽度，滚动条才会落在 nav 自己身上。 */
html body .history-head > .history-nav {
  align-self: stretch;
  width: 100%;
}

/* 移动端：导航自身横向滚动，页面不横向溢出 */
@media (max-width: 900px) {
  html body .page-nav,
  html body .history-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 5px;
    -webkit-overflow-scrolling: touch;
  }
  html body .page-nav a,
  html body .history-nav a { flex: 0 0 auto; }
}

/* ---- 表格密度对齐母版（padding 9px 10px） ---- */
html body .research-panel table th,
html body .research-panel table td,
html body .research-section table th,
html body .research-section table td {
  padding: 9px 10px;
}

/* 历史快照页 390px 溢出的真实成因：.panel-note / .source-box 里的源文件路径
   （如 market_report_full.json:source_data_date）是不可断行的长 ASCII token，
   撑破所在容器 265px -> 366px，进而把整页推到 421px。允许任意位置断行即可。 */
html body .panel-note,
html body .source-box,
html body .snapshot-meta,
html body .field-note,
html body .history-main code,
html body .history-main small {
  overflow-wrap: anywhere;
  word-break: break-word;
}
