:root {
  --bg: #fafaf8;
  --card: #ffffff;
  --ink: #1f2933;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #0f766e;
  --accent2: #b45309;
  --accent3: #6d28d9;
  --accent4: #be185d;
  --warn: #b91c1c;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
}
.hidden { display: none !important; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 40px 20px 80px; }
header.page { margin-bottom: 36px; }
header.page h1 { font-size: 26px; font-weight: 650; letter-spacing: 0.02em; }
header.page .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.meta span {
  font-size: 12.5px; color: var(--muted);
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 12px;
}
.meta span.stale { color: var(--warn); border-color: var(--warn); }
section { margin-top: 44px; }
section > h2 { font-size: 19px; font-weight: 600; margin-bottom: 6px; }
section > .desc { color: var(--muted); font-size: 13.5px; margin-bottom: 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 20px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 18px;
}
.card .t { font-size: 13px; color: var(--muted); }
.card .v { font-size: 26px; font-weight: 650; margin-top: 2px; }
.card .d { font-size: 12px; color: var(--muted); margin-top: 2px; }
.chart-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 18px; margin-bottom: 18px;
}
.chart-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.chart-card .note { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.chart-box { position: relative; width: 100%; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.scroll-x .chart-box { min-width: 780px; }
.chart-box svg { display: block; width: 100%; height: auto; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 6px 0 10px; }
.legend button {
  border: 0; background: none; cursor: pointer; font-size: 13px; color: var(--ink);
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px; border-radius: 4px;
}
.legend button.off { opacity: 0.35; }
.legend .sw { width: 18px; height: 3px; border-radius: 2px; display: inline-block; }
.tooltip {
  position: absolute; pointer-events: none; display: none;
  background: rgba(31,41,51,0.94); color: #fff; font-size: 12px;
  border-radius: 6px; padding: 8px 10px; line-height: 1.5; white-space: nowrap; z-index: 5;
}
.defs { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px 22px; }
.defs dl { display: grid; grid-template-columns: 150px 1fr; row-gap: 10px; column-gap: 16px; font-size: 13.5px; }
.defs dt { color: var(--ink); font-weight: 600; }
.defs dd { color: var(--muted); }
.formula {
  margin-top: 16px; padding: 12px 16px; background: var(--bg);
  border: 1px dashed var(--line); border-radius: 8px; font-size: 13.5px;
}
.source-details { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; font-size: 13.5px; }
.source-details summary { cursor: pointer; color: var(--ink); font-weight: 600; }
.source-details ul { margin: 10px 0 0 20px; color: var(--muted); }
.source-details li { margin: 4px 0; }
footer.page { margin-top: 56px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.entry {
  display: block; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 26px 24px; text-decoration: none; color: var(--ink); margin-top: 18px;
}
.entry:hover { border-color: var(--accent); }
.entry .t { font-size: 18px; font-weight: 600; }
.entry .s { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.range-head { display: flex; justify-content: flex-end; margin: 2px 0 4px; }
.range-head button {
  font-size: 12px; color: var(--muted); background: var(--card);
  border: 1px solid var(--line); border-radius: 6px; padding: 2px 10px; cursor: pointer;
}
.range-head button:hover { border-color: var(--accent); color: var(--accent); }
/* 纯色时间缩放条：轨道浅灰蓝、选区纯蓝、手柄白底蓝框；内部不绘制任何数据图形 */
.range-slider { position: relative; height: 40px; user-select: none; -webkit-user-select: none; touch-action: none; }
.range-slider .rng-track { position: absolute; left: 0; right: 0; top: 12px; height: 16px; background: #e8edf3; border-radius: 4px; }
.range-slider .rng-sel { position: absolute; top: 12px; height: 16px; background: #93c5fd; border-radius: 4px; cursor: grab; }
.range-slider .rng-sel:active { cursor: grabbing; }
.range-slider .rng-handle { position: absolute; top: 8px; width: 10px; height: 24px; background: #ffffff; border: 2px solid #2563eb; border-radius: 3px; cursor: ew-resize; }
.warn-text { color: var(--warn); }
.contracts-meta { font-size: 12.5px; color: var(--muted); margin: 8px 0 0; }
.contracts-meta b { color: var(--ink); font-weight: 600; }
.contracts-controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.contracts-controls button {
  font-size: 12.5px; color: var(--muted); background: var(--card);
  border: 1px solid var(--line); border-radius: 6px; padding: 3px 12px; cursor: pointer;
}
.contracts-controls button:hover { border-color: var(--accent); color: var(--accent); }
/* 横轴标题独立区域：只出现一次，位于主图与缩放条之间，不与图例/缩放条重叠 */
.x-axis-title { text-align: center; font-size: 12px; color: var(--muted); font-weight: 600; margin: 8px 0 2px; }
/* 图例独立容器（HTML 层，不在 SVG/缩放条内）：默认限高，可展开 */
.legend-wrap { margin-top: 10px; }
.contracts-legend { max-height: 88px; overflow-y: auto; margin: 0; }
.contracts-legend.open { max-height: 320px; }
.legend-toggle-btn {
  margin-top: 6px; font-size: 12px; color: var(--muted); background: var(--card);
  border: 1px solid var(--line); border-radius: 6px; padding: 2px 10px; cursor: pointer;
}
.legend-toggle-btn:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 640px) {
  .wrap { padding: 24px 14px 56px; }
  .defs dl { grid-template-columns: 1fr; }
  header.page h1 { font-size: 22px; }
}
