/* ==========================================================================
   中国金融科技燃指数数据库 · 样式
   设计基调：纸本出版物。浅色为默认，深色为同一结构的反相版本。
   ========================================================================== */

/* ---------- 设计令牌 ---------- */
:root {
  /* 纸本（默认） */
  --bg: #f6f4ef;
  --surface: #fbfaf7;
  --surface-sunken: #efece5;
  --ink: #1d1c1a;
  --ink-2: #4a4741;
  --ink-3: #7b776e;
  --ink-4: #a6a196;
  --rule: #dcd7cb;
  --rule-soft: #e8e4da;
  --rule-strong: #1d1c1a;

  --accent: #8b1d1d;          /* 社科院红：品牌与强调 */
  --accent-ink: #ffffff;
  --accent-soft: rgba(139, 29, 29, 0.07);

  --data: #1f3a5f;            /* 数据主色：墨蓝 */
  --data-soft: #c6d1df;
  --data-faint: #eef1f5;      /* 热力表低值端 */
  --data-highlight: #b0362b;  /* 选中项、中资机构 */
  --positive: #2f6b4f;
  --negative: #a65f17;        /* 下降：与选中红区分 */

  --focus: #1f3a5f;
  --overlay: rgba(29, 28, 26, 0.26);
  --shadow-pop: 0 12px 32px rgba(29, 28, 26, 0.14), 0 2px 6px rgba(29, 28, 26, 0.06);
  --shadow-dialog: 0 0 0 1px rgba(29, 28, 26, 0.08), 0 24px 56px -12px rgba(29, 28, 26, 0.28), 0 4px 12px rgba(29, 28, 26, 0.06);

  --track: #ebe8e0;           /* 分段控件凹槽 */
  --raised: #ffffff;          /* 浮起的选中块 */
  --raised-ring: rgba(29, 28, 26, 0.12);
  --raised-shadow: 0 1px 2px rgba(29, 28, 26, 0.08);
  --mark: rgba(214, 160, 60, 0.30);  /* 检索命中 */
  --scroll-thumb: rgba(29, 28, 26, 0.20);
  --scroll-thumb-hover: rgba(29, 28, 26, 0.38);

  --font-serif: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Source Han Sans SC", "Noto Sans SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  --radius: 3px;
  --radius-lg: 6px;
  --page-max: 1480px;
  --gutter: 2rem;
  --agent-width: 420px;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: light;
}

/* 墨色（深色）：保持结构与层级，只反转明度 */
[data-theme="dark"] {
  --bg: #141517;
  --surface: #191a1d;
  --surface-sunken: #1f2024;
  --ink: #ebe7de;
  --ink-2: #bdb8ad;
  --ink-3: #8a867d;
  --ink-4: #615e58;
  --rule: #2f3034;
  --rule-soft: #26272b;
  --rule-strong: #ebe7de;

  --accent: #d0675c;
  --accent-ink: #141517;
  --accent-soft: rgba(208, 103, 92, 0.12);

  --data: #a9c1df;
  --data-soft: #4a6385;
  --data-faint: #23272e;
  --data-highlight: #e0806f;
  --positive: #7fb89a;
  --negative: #d9a25e;

  --focus: #9cb6d6;
  --overlay: rgba(0, 0, 0, 0.5);
  --shadow-pop: 0 16px 40px rgba(0, 0, 0, 0.5);
  --shadow-dialog: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 24px 56px -12px rgba(0, 0, 0, 0.7);

  --track: #0f1012;
  --raised: #2a2b30;
  --raised-ring: rgba(255, 255, 255, 0.10);
  --raised-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --mark: rgba(217, 162, 94, 0.28);
  --scroll-thumb: rgba(235, 231, 222, 0.18);
  --scroll-thumb-hover: rgba(235, 231, 222, 0.34);
  color-scheme: dark;
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
button:disabled { cursor: not-allowed; }
svg { display: block; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

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

/* 滚动条：页面与各滚动区域统一由 scrollbar.js 绘制；以下为未接管区域的回退样式 */
html.scroll-locked { overflow: hidden; }
/* Chromium / Safari：自定义滚动条（无箭头、透明轨道、悬停加粗） */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
::-webkit-scrollbar-thumb {
  background-color: var(--scroll-thumb);
  background-clip: padding-box;
  border: 3.5px solid transparent;
  border-radius: 11px;
  min-height: 40px;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--scroll-thumb-hover); border-width: 2.5px; }
::-webkit-scrollbar-thumb:active { background-color: var(--scroll-thumb-hover); }

/* Firefox 不支持上面的伪元素，使用标准属性 */
@supports (-moz-appearance: none) {
  * { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
}
.agent-body, .search-results, .modal-body { overscroll-behavior: contain; }

/* 自绘滚动条：隐藏系统滚动条，由 scrollbar.js 绘制统一的圆角滑块 */
html.sb-page, .sb-hidden, .sb-hidden-x { scrollbar-width: none; }
html.sb-page::-webkit-scrollbar, .sb-hidden::-webkit-scrollbar, .sb-hidden-x::-webkit-scrollbar { display: none; width: 0; height: 0; }
.sb-hidden-x.sb-has-x { padding-bottom: 14px; }

.sb-track { position: absolute; z-index: 5; touch-action: none; }
.sb-track.is-hidden { display: none; }
.sb-y { width: 12px; }
.sb-x { height: 12px; }
.sb-thumb {
  position: absolute;
  border-radius: 6px;
  background: var(--scroll-thumb);
  transition: width 0.15s var(--ease), height 0.15s var(--ease), background-color 0.15s var(--ease);
}
.sb-y .sb-thumb { top: 0; left: 0; right: 0; margin: 0 auto; width: 5px; }
.sb-x .sb-thumb { left: 0; top: 0; bottom: 0; margin: auto 0; height: 5px; }
.sb-y:hover .sb-thumb, .sb-y.is-dragging .sb-thumb { width: 8px; background: var(--scroll-thumb-hover); }
.sb-x:hover .sb-thumb, .sb-x.is-dragging .sb-thumb { height: 8px; background: var(--scroll-thumb-hover); }
.sb-track.is-active .sb-thumb { background: var(--scroll-thumb-hover); }

/* 页面主滚动条：固定在视口右侧，位于导航之上、弹窗与研究助手之下 */
.sb-page-track { position: fixed; top: 6px; bottom: 6px; right: 2px; z-index: 999; }

.skip-link {
  position: absolute; left: -999px; top: 0.5rem;
  background: var(--ink); color: var(--bg); padding: 0.4rem 0.8rem; z-index: 2000;
}
.skip-link:focus { left: 0.5rem; }

.num, td.num, th.num { font-variant-numeric: tabular-nums lining-nums; }

/* ---------- 通用控件 ---------- */
.text-btn {
  font-size: 13px;
  color: var(--ink-2);
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius);
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease);
  white-space: nowrap;
}
.text-btn:hover { color: var(--ink); background: var(--surface-sunken); }

.icon-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  color: var(--ink-2);
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease);
}
.icon-btn:hover { color: var(--ink); background: var(--surface-sunken); }
.icon-btn svg, .search-trigger svg, .table-search-box svg, .search-input-row svg {
  width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  height: 32px; padding: 0 0.85rem;
  font-size: 13px; font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease);
  white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn-block { width: 100%; height: 38px; }

.link-btn {
  font-size: 13px; color: var(--ink-2);
  text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px;
}
.link-btn:hover { color: var(--accent); text-decoration-color: currentColor; }

.select {
  height: 32px;
  padding: 0 2rem 0 0.7rem;
  font-size: 13px;
  color: var(--ink);
  background-color: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 14px) 14px, calc(100% - 10px) 14px;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  cursor: pointer;
  min-width: 150px;
}
.select:hover { border-color: var(--ink-3); }
.select option { background: var(--surface); color: var(--ink); }

/* 图表浮窗内容（容器样式由 charts.js 的 tooltip() 设置） */
.ct { font-size: 12px; line-height: 1.5; color: var(--ink); }
.ct-head { display: flex; align-items: baseline; gap: 0.45rem; flex-wrap: wrap; }
.ct-title { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.ct-sub { font-size: 11.5px; color: var(--ink-3); }
.ct-value { display: flex; align-items: baseline; gap: 0.3rem; margin-top: 0.3rem; }
.ct-num { font-size: 22px; font-weight: 500; line-height: 1.2; letter-spacing: -0.01em; font-variant-numeric: tabular-nums lining-nums; color: var(--ink); }
.ct-unit { font-size: 11.5px; color: var(--ink-3); }
.ct-rows { margin-top: 0.5rem; padding-top: 0.4rem; border-top: 1px solid var(--rule-soft); line-height: 1.8; }
.ct-row { display: flex; justify-content: space-between; align-items: center; gap: 1.25rem; }
.ct-row > span:first-child { display: inline-flex; align-items: center; color: var(--ink-2); }
.ct-row > span:last-child { font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.ct-row.is-strong > span:last-child { font-weight: 600; }
.ct-up { color: var(--positive); }
.ct-down { color: var(--negative); }
.ct-note { margin-top: 0.4rem; font-size: 11px; line-height: 1.55; color: var(--ink-3); }
.ct-mark { display: inline-block; flex-shrink: 0; margin-right: 0.45rem; }
.ct-mark-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.ct-mark-hollow { width: 8px; height: 8px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--c); }
.ct-mark-bar { width: 10px; height: 6px; border-radius: 1px; background: var(--c); }
.ct-mark-line { width: 2px; height: 11px; border-radius: 1px; background: var(--c); margin-left: 4px; margin-right: calc(0.45rem + 4px); }

/* 自绘下拉选择：与分段控件同高、同圆角；弹出层与“下载”菜单一致 */
.cselect { position: relative; display: inline-block; }
.cselect-native { display: none !important; }
.cselect-trigger {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  height: 32px; min-width: 7.5em; padding: 0 0.65rem 0 0.95rem;
  font-size: 13px; color: var(--ink);
  background: var(--track);
  border-radius: 16px;
  box-shadow: inset 0 0 0 1px var(--rule-soft);
  white-space: nowrap;
  transition: box-shadow 0.15s var(--ease), background-color 0.15s var(--ease);
}
.cselect-trigger:hover { box-shadow: inset 0 0 0 1px var(--ink-4); }
.cselect.is-open .cselect-trigger { box-shadow: inset 0 0 0 1px var(--ink-3); }
.cselect-trigger svg { width: 14px; height: 14px; flex-shrink: 0; fill: none; stroke: var(--ink-3); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.15s var(--ease); }
.cselect.is-open .cselect-trigger svg { transform: rotate(180deg); }
.cselect-trigger:focus-visible { outline-offset: 1px; }

.cselect-pop {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 80;
  min-width: 100%; width: max-content; max-width: 320px;
  padding: 4px;
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--shadow-dialog);
  animation: menuIn 0.14s var(--ease);
}
.cselect-pop.is-up { top: auto; bottom: calc(100% + 6px); }
.cselect-search {
  display: flex; align-items: center; gap: 0.45rem;
  height: 34px; margin: 0 0 4px; padding: 0 0.6rem;
  color: var(--ink-3);
  border-bottom: 1px solid var(--rule-soft);
}
.cselect-search svg { width: 15px; height: 15px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.cselect-search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-size: 13px; color: var(--ink); }
.cselect-search input::placeholder { color: var(--ink-4); }
.cselect-list { max-height: 296px; overflow-y: auto; outline: none; }
.cselect-group { padding: 0.5rem 0.6rem 0.2rem; font-size: 11.5px; letter-spacing: 0.06em; color: var(--ink-3); }
.cselect-option {
  display: flex; align-items: center; justify-content: space-between; gap: 1.25rem;
  min-height: 32px; padding: 0 0.6rem;
  font-size: 13px; color: var(--ink-2);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.cselect-option svg { width: 14px; height: 14px; flex-shrink: 0; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; visibility: hidden; }
.cselect-option.is-active { background: var(--surface-sunken); color: var(--ink); }
.cselect-option[aria-selected="true"] { color: var(--ink); font-weight: 600; }
.cselect-option[aria-selected="true"] svg { visibility: visible; }
.cselect-option.is-disabled { color: var(--ink-4); cursor: default; }
.cselect-empty { padding: 0.6rem; font-size: 12.5px; color: var(--ink-3); }

/* 分段选择：凹槽内一块浮起的滑块，选中项切换时滑动 */
.segmented {
  position: relative;
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 16px;
  background: var(--track);
  box-shadow: inset 0 0 0 1px var(--rule-soft);
}
.seg-thumb {
  position: absolute; top: 2px; bottom: 2px; left: 0;
  border-radius: 14px;
  background: var(--raised);
  box-shadow: 0 0 0 1px var(--raised-ring), var(--raised-shadow);
  transition: transform 0.18s var(--ease), width 0.18s var(--ease);
  pointer-events: none;
}
.seg-btn {
  position: relative; z-index: 1;
  height: 28px;
  padding: 0 0.8rem;
  font-size: 13px;
  color: var(--ink-3);
  border-radius: 14px;
  font-variant-numeric: tabular-nums;
  transition: color 0.15s var(--ease);
}
.seg-btn:hover:not(:disabled):not(.active) { color: var(--ink); }
.seg-btn.active { color: var(--ink); font-weight: 600; }
.segmented:not(.has-thumb) .seg-btn.active { background: var(--raised); box-shadow: 0 0 0 1px var(--raised-ring), var(--raised-shadow); }
.seg-btn:disabled { color: var(--ink-4); }
.seg-btn:focus-visible { outline-offset: 0; }

/* 标签式筛选：选中为浅填充加细线，不用品牌色 */
.chips { display: flex; flex-wrap: wrap; gap: 0.25rem 0.15rem; }
.chip {
  height: 32px;
  padding: 0 0.8rem;
  font-size: 13px;
  color: var(--ink-2);
  border-radius: 16px;
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.chip:hover { color: var(--ink); background: var(--surface-sunken); }
.chip.active {
  color: var(--ink);
  font-weight: 600;
  background: var(--raised);
  box-shadow: 0 0 0 1px var(--raised-ring), var(--raised-shadow);
}
.chip:focus-visible { outline-offset: 1px; }

/* ---------- 刊头 ---------- */
.masthead {
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}
.masthead-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0.9rem var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
}
.brand { display: flex; align-items: center; gap: 0.9rem; text-decoration: none; color: inherit; min-width: 0; }
.brand-logo { display: flex; align-items: center; height: 44px; flex-shrink: 0; }
.brand-logo img { height: 40px; width: auto; display: block; mix-blend-mode: multiply; }
[data-theme="dark"] .brand-logo { padding: 3px 7px; background: #fff; border-radius: 6px; }
[data-theme="dark"] .brand-logo img { height: 36px; mix-blend-mode: normal; }
.brand-text { display: flex; flex-direction: column; min-width: 0; padding-left: 0.9rem; border-left: 1px solid var(--rule); }
.brand-title {
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.3;
  color: var(--ink);
  white-space: nowrap;
}
.brand-sub { font-size: 12px; color: var(--ink-3); letter-spacing: 0.02em; white-space: nowrap; }

.masthead-actions { display: flex; align-items: center; gap: 0.5rem; }
.masthead-actions > .text-btn { height: 34px; padding: 0 0.8rem; border-radius: 17px; font-size: 13.5px; }
.masthead-actions > .text-btn:hover { background: var(--raised); box-shadow: 0 0 0 1px var(--raised-ring), var(--raised-shadow); }
.masthead-actions > .icon-btn { width: 34px; height: 34px; border-radius: 50%; }
.masthead-divider { width: 1px; height: 18px; margin: 0 0.35rem; background: var(--rule); }

.search-trigger {
  display: flex; align-items: center; gap: 0.55rem;
  height: 34px; padding: 0 0.4rem 0 0.8rem;
  min-width: 240px;
  font-size: 13px; color: var(--ink-3);
  background: var(--bg);
  border-radius: 17px;
  box-shadow: inset 0 0 0 1px var(--rule);
  margin-right: 0.35rem;
  transition: box-shadow 0.15s var(--ease), color 0.15s var(--ease), background-color 0.15s var(--ease);
}
.search-trigger:hover { color: var(--ink-2); background: var(--raised); box-shadow: inset 0 0 0 1px var(--ink-4); }
.search-trigger .search-trigger-text { flex: 1; text-align: left; }
.search-trigger .kbd-group { display: inline-flex; gap: 3px; }

/* 键帽 */
kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  font-family: var(--font-sans);
  font-size: 11px; line-height: 1;
  color: var(--ink-3);
  background: var(--raised);
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  border-radius: 4px;
  white-space: nowrap;
}

#theme-toggle-btn .icon-sun { display: none; }
[data-theme="dark"] #theme-toggle-btn .icon-sun { display: block; }
[data-theme="dark"] #theme-toggle-btn .icon-moon { display: none; }

.account-btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  height: 34px; padding: 0 1rem 0 0.8rem;
  font-size: 13.5px; font-weight: 500;
  color: var(--bg);
  background: var(--ink);
  border-radius: 17px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  transition: background-color 0.15s var(--ease), transform 0.15s var(--ease);
}
.account-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.account-btn:hover { background: var(--ink-2); }
.account-btn:active { transform: scale(0.98); }

.user-chip {
  display: inline-flex; align-items: center; gap: 0.5rem;
  height: 34px; padding: 0 0.3rem 0 0.25rem;
  font-size: 13px; color: var(--ink-2);
  border-radius: 17px;
  background: var(--raised);
  box-shadow: 0 0 0 1px var(--raised-ring), var(--raised-shadow);
}
.user-avatar {
  width: 26px; height: 26px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 600;
  color: var(--accent); background: var(--accent-soft);
  border-radius: 50%;
}
.user-chip b { font-weight: 500; color: var(--ink); max-width: 8em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .text-btn { height: 26px; padding: 0 0.6rem; font-size: 12px; border-radius: 13px; color: var(--ink-3); }
.user-chip .text-btn:hover { color: var(--ink); }

/* ---------- 栏目导航 ---------- */
.section-nav {
  position: sticky; top: 0; z-index: 90;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(140%) blur(6px);
  border-bottom: 1px solid var(--rule);
}
.section-nav-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex; gap: 1.75rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.section-nav-inner::-webkit-scrollbar { display: none; }
.tab-item {
  position: relative;
  display: inline-flex; align-items: baseline; gap: 0.45rem;
  padding: 0.85rem 0 0.8rem;
  font-size: 14px;
  color: var(--ink-3);
  white-space: nowrap;
  transition: color 0.15s var(--ease);
}
.tab-item .nav-no { font-size: 11px; color: var(--ink-4); font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.tab-item:hover { color: var(--ink); }
.tab-item.active { color: var(--ink); font-weight: 600; }
.tab-item.active .nav-no { color: var(--accent); }
.tab-item.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--accent);
}

/* ---------- 主体 ---------- */
.main-container {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 2.25rem var(--gutter) 4rem;
  transition: padding-right 0.3s var(--ease);
}
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: paneIn 0.3s var(--ease); }
@keyframes paneIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- 数据加载提示 ---------- */
.data-loading {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(2px);
}
.data-loading[hidden] { display: none; }
.data-loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  color: var(--ink3);
  font-size: 0.9rem;
}
.spinner {
  width: 26px;
  height: 26px;
  border: 2px solid var(--rule);
  border-top-color: var(--data);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.load-error {
  max-width: 30rem;
  text-align: center;
  padding: 1.6rem 2rem;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink2);
  line-height: 1.7;
}
.load-error b { display: block; color: var(--ink); font-size: 1rem; margin-bottom: 0.4rem; }
.load-error .muted { color: var(--ink3); font-size: 0.85rem; }
.load-error .btn { margin-top: 0.9rem; }


/* 版块标题 */
.pane-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem;
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule);
}
.kicker {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 0.35rem;
}
.pane-title {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.pane-dek { margin-top: 0.5rem; font-size: 15px; color: var(--ink-2); max-width: 46em; }
.pane-meta { display: flex; gap: 0; flex-shrink: 0; }
.pane-meta > div { padding: 0 1.1rem; border-left: 1px solid var(--rule); }
.pane-meta > div:first-child { border-left: none; }
.pane-meta dt { font-size: 11px; color: var(--ink-3); letter-spacing: 0.06em; }
.pane-meta dd { font-size: 14px; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pane-source { margin-top: 0.75rem; font-size: 12px; color: var(--ink-3); }

/* 工具条 */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 2rem;
  padding: 0.25rem 0 1.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule-soft);
}
.tool-group { display: flex; align-items: center; gap: 0.75rem; }
.tool-group-wide { flex-basis: 100%; align-items: flex-start; }
.tool-group-wide .tool-label { padding-top: 7px; }
.toolbar > .tool-group:first-child > .tool-label,
.toolbar > .tool-group-wide > .tool-label { flex: 0 0 6.5em; width: 6.5em; }
.tool-group-wide .chips { flex: 1; min-width: 0; }
.tool-label { font-size: 12px; color: var(--ink-3); letter-spacing: 0.06em; white-space: nowrap; min-width: 3.2em; }

/* 关键统计量 */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 2px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2.25rem;
}
.stat { padding: 0.9rem 1.25rem 1rem; border-left: 1px solid var(--rule); min-width: 0; }
.stat:first-child { border-left: none; padding-left: 0; }
.stat-label { font-size: 12px; color: var(--ink-3); letter-spacing: 0.04em; }
.stat-value {
  margin-top: 0.15rem;
  font-size: 30px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ink);
  font-variant-numeric: tabular-nums lining-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stat-value small { font-size: 15px; font-weight: 400; color: var(--ink-2); margin-left: 0.35rem; letter-spacing: 0; }
.stat-sub { margin-top: 0.2rem; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.delta-up { color: var(--positive); }
.delta-down { color: var(--negative); }

/* ---------- 图表单元 ---------- */
.fig-grid { display: grid; gap: 2.5rem; margin-bottom: 2.5rem; }
.fig-grid-7-5 { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.fig-grid-5-7 { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.fig-stack { display: flex; flex-direction: column; gap: 2.5rem; min-width: 0; }

.fig { min-width: 0; margin-bottom: 2.5rem; }
.fig-grid .fig, .fig-stack .fig { margin-bottom: 0; }
.fig-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  padding-top: 0.75rem;
  border-top: 2px solid var(--rule-strong);
  margin-bottom: 0.75rem;
}
.fig-heading { min-width: 0; }
.fig-no {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.fig-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink);
  margin-top: 0.1rem;
}
.fig-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 0.15rem; }
/* 图表工具：下载菜单 + 分析本图 */
.fig-tools { display: flex; align-items: center; gap: 0.2rem; flex-shrink: 0; }

/* 平时只显示淡色图标；指针移入或键盘焦点进入图表时展开为带文字的按钮 */
.fig-btn {
  display: inline-flex; align-items: center; gap: 0;
  height: 28px; padding: 0 6.5px;
  font-size: 12.5px; color: var(--ink-4);
  border-radius: 14px;
  white-space: nowrap;
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease), box-shadow 0.15s var(--ease),
              padding 0.18s var(--ease), gap 0.18s var(--ease);
}
.fig-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.fig-btn > span {
  max-width: 0; opacity: 0; overflow: hidden;
  transition: max-width 0.18s var(--ease), opacity 0.15s var(--ease);
}
.fig-btn span + svg {
  width: 0; height: 12px; opacity: 0;
  transition: width 0.18s var(--ease), opacity 0.15s var(--ease), transform 0.15s var(--ease);
}

.fig:hover .fig-btn, .fig:focus-within .fig-btn, .fig-btn[aria-expanded="true"] {
  gap: 0.35rem; padding: 0 0.7rem 0 0.55rem; color: var(--ink-3);
}
.fig:hover .fig-btn > span, .fig:focus-within .fig-btn > span, .fig-btn[aria-expanded="true"] > span { max-width: 6em; opacity: 1; }
.fig:hover .fig-btn span + svg, .fig:focus-within .fig-btn span + svg, .fig-btn[aria-expanded="true"] span + svg { width: 12px; opacity: 0.7; margin-left: -0.1rem; }
.fig:hover .fig-btn-ask svg, .fig:focus-within .fig-btn-ask svg { color: var(--accent); }

.fig .fig-btn:hover, .fig .fig-btn[aria-expanded="true"] {
  color: var(--ink);
  background: var(--raised);
  box-shadow: 0 0 0 1px var(--raised-ring), var(--raised-shadow);
}
.fig-btn[aria-expanded="true"] span + svg { transform: rotate(180deg); }

/* 触屏设备没有悬停，始终显示完整按钮 */
@media (hover: none) {
  .fig-btn { gap: 0.35rem; padding: 0 0.7rem 0 0.55rem; color: var(--ink-3); }
  .fig-btn > span { max-width: 6em; opacity: 1; }
  .fig-btn span + svg { width: 12px; opacity: 0.7; margin-left: -0.1rem; }
  .fig-btn-ask svg { color: var(--accent); }
}

.fig-menu { position: relative; }
.fig-menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60;
  min-width: 212px;
  padding: 4px;
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--shadow-dialog);
  animation: menuIn 0.14s var(--ease);
}
@keyframes menuIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.fig-menu-item {
  display: flex; align-items: center; gap: 0.65rem;
  width: 100%; padding: 0.5rem 0.65rem;
  text-align: left;
  border-radius: 7px;
}
.fig-menu-item svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: var(--ink-3); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.fig-menu-item b { display: block; font-size: 13px; font-weight: 500; color: var(--ink); line-height: 1.4; }
.fig-menu-item small { display: block; font-size: 11.5px; color: var(--ink-3); line-height: 1.4; }
.fig-menu-item:hover, .fig-menu-item:focus-visible { background: var(--surface-sunken); outline: none; }
.fig-menu-item:hover svg, .fig-menu-item:focus-visible svg { stroke: var(--ink-2); }

/* 研究助手回答中的小按钮 */
.fig-tool {
  font-size: 12px;
  color: var(--ink-3);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius);
  white-space: nowrap;
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease);
}
.fig-tool:hover { color: var(--ink); background: var(--surface-sunken); }

.chart { width: 100%; position: relative; }
/* 内容较宽的图表：窄屏时横向滚动，不压缩文字 */
.chart-scroll { width: 100%; overflow-x: auto; }
.chart-scroll > .chart { min-width: 860px; }
.fig-note {
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--rule-soft);
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-3);
}

.notice {
  padding: 0.85rem 1rem;
  margin-bottom: 1.5rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  font-size: 13.5px;
  color: var(--ink-2);
}

/* 城市画像侧栏 */
.profile-card { min-width: 0; padding-top: 0.75rem; border-top: 2px solid var(--rule-strong); }
.profile-city { font-family: var(--font-serif); font-size: 26px; font-weight: 700; line-height: 1.3; }
.profile-region { font-size: 13px; color: var(--ink-3); margin-top: 0.15rem; }
.profile-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 1.25rem 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.profile-figures > div { padding: 0.7rem 0.9rem; border-left: 1px solid var(--rule); }
.profile-figures > div:first-child { border-left: none; padding-left: 0; }
.profile-figures span { display: block; font-size: 12px; color: var(--ink-3); }
.profile-figures b { font-size: 22px; font-weight: 500; font-variant-numeric: tabular-nums; }
.profile-summary { font-family: var(--font-serif); font-size: 15.5px; line-height: 1.85; color: var(--ink); }
.profile-lists { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-top: 1.25rem; }
.profile-lists h4 { font-size: 12px; font-weight: 600; color: var(--ink-3); letter-spacing: 0.06em; margin-bottom: 0.35rem; }
.profile-lists ol { list-style: none; }
.profile-lists li { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.3rem 0; border-bottom: 1px dotted var(--rule); font-size: 13.5px; }
.profile-lists li span:last-child { font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* 机构概要 */
.inst-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--rule); margin-bottom: 0.5rem; }
.inst-summary > div { padding: 0.25rem 0.9rem 0.65rem; border-left: 1px solid var(--rule); }
.inst-summary > div:first-child { border-left: none; padding-left: 0; }
.inst-summary span { display: block; font-size: 12px; color: var(--ink-3); }
.inst-summary b { font-size: 22px; font-weight: 500; font-variant-numeric: tabular-nums; }
.inst-summary b small { font-size: 13px; font-weight: 400; color: var(--ink-3); margin-left: 0.15rem; }

/* ---------- 表格 ---------- */
.table-responsive { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table caption { text-align: left; }
.data-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--rule-strong);
  white-space: nowrap;
  user-select: none;
}
.data-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: top;
  color: var(--ink);
}
.data-table th:first-child, .data-table td:first-child { padding-left: 0; }
.data-table th:last-child, .data-table td:last-child { padding-right: 0; }
.data-table th.num, .data-table td.num { text-align: right; font-variant-numeric: tabular-nums lining-nums; }
.data-table tbody tr:last-child td { border-bottom: 1px solid var(--rule); }
.data-table .muted { color: var(--ink-3); }
.data-table .row-strong td { font-weight: 600; }
.data-table .cell-desc { color: var(--ink-3); font-size: 12.5px; }
.data-table .rank { color: var(--ink-3); font-size: 12px; margin-left: 0.2rem; }
.data-table .is-cn td:first-child { color: var(--data-highlight); }

/* 三线表：顶线、栏目线、底线三条横线，无竖线与底色（学术出版常用表式）
   列宽固定：名称、国家之后为四组等宽的“得分 | 名次”，组间留出固定间距 */
.three-line {
  width: 100%; min-width: 760px;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums lining-nums;
}
.three-line col.c-name { width: 26%; }
.three-line col.c-score { width: 13.5%; }
.three-line col.c-rank { width: 8.5%; }

.three-line th, .three-line td { padding: 0.55rem 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.three-line th { font-weight: 500; text-align: left; color: var(--ink-3); font-size: 12px; }
.three-line .num { text-align: right; }
/* 每组“得分”列左侧留出组间距，“名次”列紧随其后 */
.three-line .col-score { padding-left: 1.5rem; }
.three-line .col-rank { padding-left: 0.5rem; }
.three-line .col-name { padding-right: 1rem; }

.three-line thead { border-top: 2px solid var(--rule-strong); border-bottom: 1px solid var(--rule-strong); }
.three-line .group-row th { padding-top: 0.75rem; padding-bottom: 0.35rem; }
.three-line .group-row th[rowspan] { vertical-align: bottom; padding-bottom: 0.55rem; }
.three-line .group-row th.year { padding-left: 1.5rem; text-align: center; color: var(--ink); font-size: 13px; font-weight: 600; }
.three-line .group-row th.year span { display: block; padding-bottom: 0.35rem; border-bottom: 1px solid var(--rule); }
.three-line .sub-row th { padding-top: 0.35rem; padding-bottom: 0.55rem; }

.three-line td { color: var(--ink); }
.three-line td.muted { color: var(--ink-3); }
.three-line td.col-rank { color: var(--ink-3); }
.three-line td.col-rank.is-top { color: var(--ink); font-weight: 600; }
.three-line .is-cn .col-name { color: var(--data-highlight); }
.three-line tbody tr { cursor: pointer; transition: background-color 0.12s var(--ease); }
.three-line tbody tr:hover, .three-line tbody tr:focus-visible { background: var(--surface-sunken); outline: none; }
.three-line tbody tr:first-child td { padding-top: 0.8rem; }
.three-line tbody tr:last-child td { padding-bottom: 0.8rem; }

/* 排序：箭头悬挂在文字外侧，不影响对齐 */
.three-line th.sortable { cursor: pointer; user-select: none; transition: color 0.15s var(--ease); }
.three-line th.sortable:hover, .three-line th.sorted { color: var(--ink); }
.three-line th.sortable:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.three-line .th-label { position: relative; }
.three-line .sort-icon { position: absolute; top: 0; color: var(--accent); font-weight: 400; }
.three-line th:not(.num) .sort-icon { left: 100%; padding-left: 0.2rem; }
.three-line th.num .sort-icon { right: 100%; padding-right: 0.2rem; }

.three-line tfoot { border-top: 1px solid var(--rule-strong); border-bottom: 2px solid var(--rule-strong); }
.three-line tfoot th, .three-line tfoot td { padding-top: 0.45rem; padding-bottom: 0.45rem; font-size: 12.5px; color: var(--ink-2); }
.three-line tfoot th { font-weight: 500; color: var(--ink-2); }
.three-line tfoot td.muted { color: var(--ink-3); }
.three-line tfoot tr:first-child th, .three-line tfoot tr:first-child td { padding-top: 0.75rem; }
.three-line tfoot tr:last-child th, .three-line tfoot tr:last-child td { padding-bottom: 0.75rem; }
.data-table-hover tbody tr { cursor: pointer; }
.data-table-hover tbody tr:hover td { background: var(--surface-sunken); }
.data-table th.sortable { cursor: pointer; }
.data-table th.sortable:hover { color: var(--ink); }
.data-table th.sorted { color: var(--ink); }
.sort-icon { margin-left: 0.25rem; font-weight: 400; }
.data-table .name-cell { font-weight: 500; }

.tag { display: inline-block; font-size: 12px; color: var(--ink-2); margin-right: 0.45rem; white-space: nowrap; }
.tag + .tag::before { content: "·"; color: var(--ink-4); margin-right: 0.45rem; }

.table-panel { border-top: 2px solid var(--rule-strong); }
.fig-flush { margin-bottom: 0; }
/* 表格在图表框架内：表头上方的粗线即表格顶线，检索与分页条位于其上下 */
.fig .table-panel { border-top: none; }
.fig .table-toolbar { padding: 0.25rem 0 0.85rem; border-bottom: 2px solid var(--rule-strong); row-gap: 0.75rem; }
.table-toolbar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--rule);
}
/* 表内检索：与筛选胶囊、下拉选择同一形态（凹槽底色、32px 胶囊），聚焦时浮起 */
.table-search-box {
  display: flex; align-items: center; gap: 0.5rem;
  height: 32px; padding: 0 0.3rem 0 0.8rem;
  width: 340px; max-width: 100%;
  color: var(--ink-3);
  background: var(--track);
  border-radius: 16px;
  box-shadow: inset 0 0 0 1px var(--rule-soft);
  transition: box-shadow 0.15s var(--ease), background-color 0.15s var(--ease);
}
.table-search-box:hover { box-shadow: inset 0 0 0 1px var(--ink-4); }
.table-search-box:focus-within {
  background: var(--raised);
  box-shadow: inset 0 0 0 1px var(--ink-3), 0 0 0 3px color-mix(in srgb, var(--data) 10%, transparent);
}
.table-search-box > svg { width: 15px; height: 15px; flex-shrink: 0; }
.table-search-box input { flex: 1; min-width: 0; height: 100%; border: none; outline: none; background: transparent; font-size: 13px; color: var(--ink); }
.table-search-box input::placeholder { color: var(--ink-4); }
.table-search-box input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }
.table-search-clear {
  flex-shrink: 0; width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-3); border-radius: 50%;
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease);
}
.table-search-clear svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.table-search-clear:hover { color: var(--ink); background: var(--rule-soft); }
.table-actions { display: flex; align-items: center; gap: 0.75rem; }
.table-count { font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.table-count b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.table-actions .select { min-width: 0; }
.table-empty { text-align: center; padding: 3rem 0 !important; color: var(--ink-3); }
.table-empty p { margin-bottom: 0.5rem; }

/* 表 6.1 企业名录：固定列宽，名称与赛道列较宽 */
.company-table { table-layout: fixed; min-width: 1120px; }
.company-table col.c-id { width: 52px; }
.company-table col.c-name { width: 22%; }
.company-table col.c-date { width: 104px; }
.company-table col.c-tech { width: 17%; }
.company-table col.c-app { width: 19%; }
.company-table col.c-stage { width: 15%; }
.company-table col.c-city { width: 80px; }
.company-table col.c-prov { width: 80px; }
.company-table col.c-cue { width: 58px; }
.company-table td { overflow-wrap: anywhere; }
.company-table th.col-id, .company-table td.col-id { color: var(--ink-4); font-size: 12px; }
.company-table th.col-id { color: var(--ink-3); }
.company-table td.col-stage { font-size: 12.5px; color: var(--ink-2); }
.company-table mark.hit { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }
/* 行尾“详情”提示：悬停或聚焦时显示 */
.company-table td.row-cue { text-align: right; white-space: nowrap; font-size: 12px; color: var(--ink-3); }
.company-table td.row-cue > * { opacity: 0; transition: opacity 0.15s var(--ease), color 0.15s var(--ease); vertical-align: middle; }
.company-table td.row-cue svg { width: 14px; height: 14px; margin-left: 0.1rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.company-table tbody tr:hover td.row-cue > *, .company-table tbody tr:focus-visible td.row-cue > * { opacity: 1; }
.company-table tbody tr:hover td.row-cue { color: var(--ink); }
.company-table tbody tr:focus-visible { outline: none; }
.company-table tbody tr:focus-visible td { background: var(--surface-sunken); }
.company-table tbody tr.empty-row { cursor: default; }
.company-table tbody tr.empty-row:hover td { background: transparent; }
@media (hover: none) { .company-table td.row-cue > * { opacity: 1; } }

/* 赛道按钮上的企业数（在其他条件不变时选择该项的结果） */
.chip-count { margin-left: 0.35rem; font-size: 11.5px; font-weight: 400; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.chip.active .chip-count { color: var(--ink-3); }
.chip.is-zero { color: var(--ink-4); }

/* 已选筛选条件 */
.filter-summary { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-top: -0.25rem; font-size: 12.5px; color: var(--ink-3); }
.fs-label { margin-right: 0.15rem; }
.fs-chip {
  display: inline-flex; align-items: center; gap: 0.2rem;
  height: 24px; padding: 0 0.2rem 0 0.65rem;
  color: var(--ink-2);
  background: var(--surface-sunken);
  border-radius: 12px;
}
.fs-chip b { font-weight: 500; color: var(--ink); }
.fs-chip button {
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-3); border-radius: 50%;
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease);
}
.fs-chip button svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.fs-chip button:hover { color: var(--ink); background: var(--rule-soft); }
.filter-summary .link-btn { margin-left: 0.25rem; font-size: 12.5px; }

.table-pagination {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.85rem 0;
  font-size: 13px; color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.pagination-controls { display: flex; gap: 0.2rem; }
.page-btn {
  min-width: 30px; height: 30px; padding: 0 0.55rem;
  font-size: 13px; color: var(--ink-2);
  border-radius: 5px;
  font-variant-numeric: tabular-nums;
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease);
}
.page-btn:hover:not(:disabled):not(.active) { background: var(--surface-sunken); color: var(--ink); }
.page-btn.active { color: var(--ink); font-weight: 600; background: var(--raised); box-shadow: 0 0 0 1px var(--raised-ring), var(--raised-shadow); }
.page-btn:disabled { color: var(--ink-4); }

/* ---------- 页脚 ---------- */
.site-footer { margin-top: 2rem; border-top: 1px solid var(--rule); background: var(--surface); transition: padding-right 0.3s var(--ease); }
.site-footer-inner {
  max-width: 720px; margin: 0 auto;
  padding: 2.25rem var(--gutter) 2rem;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
}
.footer-title { font-family: var(--font-serif); font-size: 17px; font-weight: 700; letter-spacing: 0.04em; color: var(--ink); }
.footer-org { margin-top: 0.45rem; font-size: 13px; color: var(--ink-2); }
.footer-org span, .footer-legal span { margin: 0 0.5em; color: var(--ink-4); }
.footer-links { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 0.1rem; margin-top: 0.9rem; }
.footer-links button {
  display: inline-flex; align-items: center; gap: 0.3rem;
  height: 30px; padding: 0 0.75rem;
  font-size: 13px; color: var(--ink-2);
  border-radius: 15px;
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.footer-links button svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.footer-links button:hover { color: var(--ink); background: var(--raised); box-shadow: 0 0 0 1px var(--raised-ring), var(--raised-shadow); }
.footer-dot { font-size: 12px; color: var(--ink-4); }
.footer-rule { width: 56px; height: 1px; margin: 0.9rem 0 0.75rem; background: var(--rule); }
.footer-legal { font-size: 11.5px; color: var(--ink-3); }

/* ---------- 弹窗 ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1100;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 1.5rem 1.5rem;
  background: var(--overlay);
  backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.16s var(--ease);
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-content {
  position: relative;
  display: flex; flex-direction: column;
  width: 100%; max-width: 640px; max-height: 76vh; overflow: hidden;
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--shadow-dialog);
  transform: translateY(-4px) scale(0.985);
  transition: transform 0.18s var(--ease);
}
.modal-wide { max-width: 820px; }
.modal-overlay.open .modal-content { transform: none; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  flex: none;
  padding: 0.85rem 0.85rem 0.85rem 1.5rem;
  border-bottom: 1px solid var(--rule-soft);
}
.modal-title { font-family: var(--font-serif); font-size: 18px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-3);
  border-radius: 50%;
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease);
}
.modal-close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.modal-close:hover { color: var(--ink); background: var(--surface-sunken); }
.modal-close:active { background: var(--rule-soft); }
.modal-body { flex: 1; min-height: 0; overflow-y: auto; padding: 1.25rem 1.5rem 1.5rem; }
.modal-lead { font-size: 13.5px; color: var(--ink-2); margin-bottom: 1rem; }

/* 检索弹窗 */
.modal-search { max-width: 620px; max-height: 72vh; overflow: hidden; display: flex; flex-direction: column; }
.search-input-row {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0 0.85rem 0 1.1rem;
  border-bottom: 1px solid var(--rule-soft);
  color: var(--ink-3);
}
.search-input-row > svg { width: 19px; height: 19px; flex-shrink: 0; }
.search-input-row input {
  flex: 1; min-width: 0; height: 56px;
  border: none; outline: none; background: transparent;
  font-size: 16px; color: var(--ink);
}
.search-input-row input::placeholder { color: var(--ink-4); }
.search-clear {
  width: 26px; height: 26px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-3); border-radius: 13px;
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease);
}
.search-clear:hover { color: var(--ink); background: var(--surface-sunken); }
.search-cancel { display: none; font-size: 14px; color: var(--ink-2); padding: 0.3rem 0 0.3rem 0.4rem; white-space: nowrap; }
.search-clear svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.search-scopes { display: flex; gap: 0.2rem; padding: 0.5rem 0.85rem; border-bottom: 1px solid var(--rule-soft); overflow-x: auto; scrollbar-width: none; }
.search-scopes::-webkit-scrollbar { display: none; }
.scope-btn {
  height: 26px; padding: 0 0.65rem;
  font-size: 12.5px; color: var(--ink-3);
  border-radius: 13px; white-space: nowrap;
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease);
}
.scope-btn b { font-weight: 400; margin-left: 0.3rem; font-variant-numeric: tabular-nums; color: var(--ink-4); }
.scope-btn:hover:not(:disabled) { color: var(--ink); background: var(--surface-sunken); }
.scope-btn.active { color: var(--ink); font-weight: 600; background: var(--raised); box-shadow: 0 0 0 1px var(--raised-ring), var(--raised-shadow); }
.scope-btn.active b { color: var(--ink-3); }
.scope-btn:disabled { color: var(--ink-4); cursor: default; }

.search-results { flex: 1; min-height: 0; overflow-y: auto; padding: 0.35rem 0 0.5rem; }
.search-group {
  position: sticky; top: 0; z-index: 1;
  padding: 0.55rem 1.1rem 0.3rem;
  font-size: 11.5px; letter-spacing: 0.06em; color: var(--ink-3);
  background: var(--surface);
}
.search-item {
  position: relative;
  display: flex; align-items: center; gap: 0.75rem;
  width: 100%; min-height: 40px; text-align: left;
  padding: 0.45rem 1.1rem;
}
.search-item::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 2px; border-radius: 0 2px 2px 0;
  background: var(--accent); opacity: 0;
}
.search-item.is-active { background: var(--surface-sunken); }
.search-item.is-active::before { opacity: 1; }
.search-item-icon {
  width: 26px; height: 26px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-3);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px var(--rule-soft);
  background: var(--bg);
}
.search-item-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.search-item-icon.is-num { font-size: 11px; font-variant-numeric: tabular-nums; color: var(--accent); }
.search-item-name { flex: 1; min-width: 0; font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-item-desc { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.search-item-enter { visibility: hidden; }
.search-item.is-active .search-item-enter { visibility: visible; }
.search-item mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }

.search-empty { padding: 2rem 1.25rem 1.75rem; text-align: center; }
.search-empty p { font-size: 13.5px; color: var(--ink-2); }
.search-empty p + p { margin-top: 0.25rem; font-size: 12.5px; color: var(--ink-3); }
.search-empty .btn { margin-top: 1rem; }

.search-foot {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.55rem 1.1rem;
  font-size: 12px; color: var(--ink-3);
  border-top: 1px solid var(--rule-soft);
  background: var(--bg);
}
.search-foot > span { display: inline-flex; align-items: center; gap: 0.3rem; }
.search-foot .search-count { margin-left: auto; font-variant-numeric: tabular-nums; }

/* 表单 */
.form { display: flex; flex-direction: column; gap: 0.85rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; }
.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field span { font-size: 12px; color: var(--ink-3); letter-spacing: 0.04em; }
.field input {
  height: 38px; padding: 0 0.75rem;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  outline: none;
  font-size: 14px;
}
.field input:focus { border-color: var(--ink-3); }
.form-error { font-size: 13px; color: var(--negative); }
.form-foot { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; }

/* 说明文档排版 */
.prose { font-size: 14px; line-height: 1.8; color: var(--ink-2); }
.prose h4 { font-family: var(--font-serif); font-size: 16px; color: var(--ink); margin: 1.5rem 0 0.4rem; }
.prose h4:first-child { margin-top: 0; }
.prose p + p { margin-top: 0.5rem; }
.prose ul { padding-left: 1.2rem; margin-top: 0.35rem; }
.prose li { margin: 0.15rem 0; }
.prose .data-table { margin-top: 0.5rem; font-size: 13px; }
.prose .callout { margin-top: 1.5rem; padding: 0.75rem 1rem; background: var(--surface-sunken); font-size: 13px; }

.cite-block + .cite-block { margin-top: 1.25rem; }
.cite-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.4rem; }
.cite-head h4 { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; color: var(--ink-3); }
.cite-text {
  padding: 0.8rem 0.95rem;
  background: var(--bg);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px var(--rule-soft);
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink);
  word-break: break-all;
  user-select: all;
}

/* 复制按钮 */
.copy-btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  height: 28px; padding: 0 0.7rem 0 0.6rem;
  font-size: 12.5px; color: var(--ink-2);
  border-radius: 14px;
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.copy-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.copy-btn .icon-check { display: none; }
.copy-btn:hover { color: var(--ink); background: var(--raised); box-shadow: 0 0 0 1px var(--raised-ring), var(--raised-shadow); }
.copy-btn.is-copied { color: var(--positive); background: transparent; box-shadow: none; }
.copy-btn.is-copied .icon-copy { display: none; }
.copy-btn.is-copied .icon-check { display: block; }

.detail-grid { display: grid; grid-template-columns: 6em 1fr; gap: 0.55rem 1rem; font-size: 14px; }
.detail-grid dt { color: var(--ink-3); }
.detail-grid dd { color: var(--ink); }

/* 提示 */
.toast {
  position: fixed; left: 50%; bottom: 2rem; z-index: 1500;
  transform: translate(-50%, 12px);
  padding: 0.55rem 1rem;
  font-size: 13px;
  color: var(--bg); background: var(--ink);
  border-radius: var(--radius);
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================================
   研究助手：宽屏停靠在右侧、整页让位，宽度可拖动；窄屏为底部抽屉
   ========================================================================== */
.agent-launcher {
  position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 95;
  display: inline-flex; align-items: center; gap: 0.5rem;
  height: 40px; padding: 0 1rem 0 0.85rem;
  font-size: 13.5px; font-weight: 500;
  color: var(--bg); background: var(--ink);
  border-radius: 20px;
  box-shadow: var(--shadow-pop);
  transition: transform 0.2s var(--ease), opacity 0.2s var(--ease), background-color 0.15s var(--ease);
}
.agent-launcher.has-kbd { padding-right: 0.55rem; }
.agent-launcher svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.agent-launcher:hover { transform: translateY(-1px); background: var(--ink-2); }
.agent-launcher-kbd {
  margin-left: 0.1rem; padding: 0 0.45rem;
  font: 11px/20px var(--font-sans); letter-spacing: 0.02em;
  color: color-mix(in srgb, var(--bg) 72%, transparent);
  background: color-mix(in srgb, var(--bg) 14%, transparent);
  border-radius: 10px;
}
.agent-launcher-kbd:empty { display: none; }
body.agent-open .agent-launcher { opacity: 0; transform: translateY(6px); pointer-events: none; }

.agent-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 1000;
  width: var(--agent-width);
  display: flex; flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--rule);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.28s var(--ease), visibility 0s linear 0.28s;
}
.agent-panel.open { transform: none; visibility: visible; transition: transform 0.28s var(--ease), visibility 0s; }

/* 停靠：整页让出面板宽度，刊头、导航、正文与页脚一同收窄，不遮挡任何内容 */
body { transition: padding-right 0.28s var(--ease); }
body.agent-docked { padding-right: var(--agent-width); }
body.agent-docked .sb-page-track { right: calc(var(--agent-width) + 2px); }
body.agent-docked .toast { left: calc((100% - var(--agent-width)) / 2); }
body.agent-resizing { transition: none; cursor: col-resize; user-select: none; }
body.agent-resizing * { cursor: col-resize !important; }
body.agent-resizing .agent-panel { transition: none; }

/* 窄屏：面板仍贴右侧，但改为覆盖式，正文不被压缩 */
body.agent-overlay .agent-panel { box-shadow: var(--shadow-pop); }
body.agent-overlay .agent-resizer { display: none; }
body.agent-overlay .agent-launcher { display: none; }

/* 正文可用宽度变窄时，沿用对应窄屏的版式（由脚本按“视口宽度 − 面板宽度”切换） */
body.content-compact .fig-grid-7-5, body.content-compact .fig-grid-5-7 { grid-template-columns: minmax(0, 1fr); }
body.content-compact .search-trigger { min-width: 0; }
body.content-compact .search-trigger span, body.content-compact .search-trigger kbd { display: none; }
body.content-narrow .masthead-inner { flex-wrap: wrap; }
body.content-narrow .brand-title { font-size: 18px; }
body.content-narrow .pane-head { flex-direction: column; align-items: flex-start; gap: 1rem; }
body.content-narrow .pane-meta > div:first-child { padding-left: 0; }
body.content-narrow .pane-title { font-size: 25px; }
body.content-narrow .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.content-narrow .stat:nth-child(3) { border-left: none; padding-left: 0; }
body.content-narrow .stat:nth-child(n+3) { border-top: 1px solid var(--rule); }
body.content-narrow .profile-lists { grid-template-columns: 1fr; }
body.content-narrow .table-search-box { min-width: 0; flex: 1; }

/* 拖动条：面板左缘，悬停或拖动时显示细线 */
.agent-resizer {
  position: absolute; top: 0; bottom: 0; left: -5px; z-index: 3;
  width: 10px;
  cursor: col-resize; touch-action: none;
}
.agent-resizer::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 4px; width: 2px;
  background: var(--data);
  opacity: 0; transition: opacity 0.15s var(--ease);
}
.agent-resizer:hover::after { opacity: 0.45; transition-delay: 0.1s; }
.agent-resizer:focus-visible { outline: none; }
.agent-resizer:focus-visible::after, body.agent-resizing .agent-resizer::after { opacity: 1; }

/* 顶部 */
.agent-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  flex-shrink: 0;
  height: 56px; padding: 0 0.75rem 0 1.25rem;
  border-bottom: 1px solid var(--rule);
}
.agent-title { display: flex; align-items: center; gap: 0.55rem; min-width: 0; }
.agent-title h2 { font-family: var(--font-serif); font-size: 17px; font-weight: 700; letter-spacing: 0.02em; line-height: 1; }
.agent-tag {
  padding: 0 0.45rem;
  font-size: 11px; line-height: 18px; letter-spacing: 0.04em;
  color: var(--ink-3);
  border-radius: 9px;
  box-shadow: inset 0 0 0 1px var(--rule);
}
.agent-head-actions { display: flex; align-items: center; gap: 2px; }
.agent-icon-btn {
  position: relative;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-3);
  border-radius: 50%;
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease);
}
.agent-icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.agent-icon-btn:hover { color: var(--ink); background: var(--surface-sunken); }
.agent-icon-btn:active { background: var(--rule-soft); }
/* 图标按钮的文字提示 */
.agent-icon-btn[data-tip]::after {
  content: attr(data-tip);
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 4;
  padding: 0.35rem 0.55rem;
  font-size: 12px; line-height: 1.2; white-space: nowrap;
  color: var(--bg); background: var(--ink);
  border-radius: 6px;
  opacity: 0; transform: translateY(-2px);
  pointer-events: none;
  transition: opacity 0.12s var(--ease), transform 0.12s var(--ease);
}
.agent-icon-btn:hover::after, .agent-icon-btn:focus-visible::after { opacity: 1; transform: none; transition-delay: 0.35s; }

/* 对话区 */
.agent-body {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 1.25rem 1.25rem 1.75rem;
  display: flex; flex-direction: column; gap: 1.75rem;
}

.agent-welcome h3 { font-family: var(--font-serif); font-size: 18px; font-weight: 700; line-height: 1.4; margin-bottom: 0.35rem; }
.agent-welcome > p { font-size: 13.5px; color: var(--ink-2); line-height: 1.75; }
.agent-welcome-quota { font-size: 12.5px !important; color: var(--ink-3) !important; }
.agent-suggest-label { margin: 1.35rem 0 0.35rem; font-size: 12px; color: var(--ink-3); letter-spacing: 0.04em; }
.agent-suggest { display: flex; flex-direction: column; border-top: 1px solid var(--rule); }
.suggest-item {
  display: grid; grid-template-columns: 2.4rem minmax(0, 1fr) auto; align-items: baseline; gap: 0.5rem;
  width: 100%; text-align: left;
  padding: 0.65rem 0;
  font-size: 13.5px; line-height: 1.6; color: var(--ink);
  border-bottom: 1px solid var(--rule-soft);
  transition: color 0.15s var(--ease);
}
.suggest-kind { font-size: 12px; color: var(--ink-3); }
.suggest-item::after { content: "→"; color: var(--ink-4); transition: transform 0.15s var(--ease), color 0.15s var(--ease); }
.suggest-item:hover { color: var(--accent); }
.suggest-item:hover::after { color: var(--accent); transform: translateX(2px); }
.agent-hint { margin-top: 1rem; font-size: 12.5px; line-height: 1.7; color: var(--ink-3); }

/* 未登录 */
.agent-login { padding: 1.1rem 1.15rem 1.2rem; background: var(--surface-sunken); border-radius: 10px; }
.agent-login h3 { font-family: var(--font-serif); font-size: 16px; font-weight: 700; margin-bottom: 0.3rem; }
.agent-login p { font-size: 13px; line-height: 1.7; color: var(--ink-2); margin-bottom: 0.9rem; }

/* 提问 */
.msg-user {
  align-self: flex-end;
  max-width: 85%;
  padding: 0.5rem 0.9rem;
  font-size: 13.5px; line-height: 1.65;
  color: var(--ink);
  background: var(--surface-sunken);
  border-radius: 16px 16px 4px 16px;
  white-space: pre-wrap; overflow-wrap: anywhere;
}

/* 回答：版式与正文图表一致——衬线标题、细线分隔的关键数字、三线表 */
.msg-agent { font-size: 13.5px; line-height: 1.75; color: var(--ink); }
@keyframes stepIn { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
.msg-agent, .msg-user { animation: stepIn 0.25s var(--ease) both; }
.ans-title { font-family: var(--font-serif); font-size: 16.5px; font-weight: 700; line-height: 1.45; margin-bottom: 0.4rem; }
.ans p { margin: 0.45rem 0; }
.ans ul { padding-left: 1.1rem; margin: 0.35rem 0; }
.ans li { margin: 0.2rem 0; }
.ans-note { font-size: 12px; line-height: 1.65; color: var(--ink-3); }

/* 智能体回答：Markdown 渲染 */
.ans-md > *:first-child { margin-top: 0; }
.ans-md > *:last-child { margin-bottom: 0; }
.ans-md h1, .ans-md h2, .ans-md h3, .ans-md h4 {
  font-family: var(--font-serif); font-weight: 700; line-height: 1.45;
  margin: 0.9rem 0 0.4rem;
}
.ans-md h1 { font-size: 17px; }
.ans-md h2 { font-size: 15.5px; }
.ans-md h3 { font-size: 14.5px; }
.ans-md h4 { font-size: 13.5px; }
.ans-md p { margin: 0.45rem 0; }
.ans-md ul, .ans-md ol { padding-left: 1.15rem; margin: 0.4rem 0; }
.ans-md li { margin: 0.2rem 0; }
.ans-md li > ul, .ans-md li > ol { margin: 0.15rem 0; }
.ans-md strong { font-weight: 600; }
.ans-md a { color: var(--link, #1a5fb4); text-decoration: underline; text-underline-offset: 2px; }
.ans-md blockquote {
  margin: 0.6rem 0; padding: 0.1rem 0 0.1rem 0.75rem;
  border-left: 2px solid var(--rule-strong); color: var(--ink-2);
}
.ans-md hr { border: 0; border-top: 1px solid var(--rule); margin: 0.9rem 0; }
.ans-md code {
  font-family: var(--font-mono, ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace);
  font-size: 12px; padding: 0.1rem 0.3rem;
  background: var(--surface-sunken); border-radius: 3px;
}
.ans-md pre {
  margin: 0.6rem 0; padding: 0.7rem 0.8rem;
  background: var(--surface-sunken); border-radius: 4px;
  overflow-x: auto;
}
.ans-md pre code { padding: 0; background: none; font-size: 11.5px; line-height: 1.6; }
.ans-md table {
  width: 100%; border-collapse: collapse;
  font-size: 12.5px; line-height: 1.55;
  font-variant-numeric: tabular-nums lining-nums;
  border-top: 1.5px solid var(--rule-strong);
  border-bottom: 1.5px solid var(--rule-strong);
  margin: 0.7rem 0;
}
.ans-md th {
  text-align: left; font-weight: 500; font-size: 12px; color: var(--ink-3);
  padding: 0.45rem 0.5rem 0.4rem;
  border-bottom: 1px solid var(--rule-strong);
  white-space: nowrap;
}
.ans-md td { padding: 0.28rem 0.5rem; white-space: nowrap; }
.ans-md tbody tr:first-child td { padding-top: 0.5rem; }
.ans-md tbody tr:last-child td { padding-bottom: 0.5rem; }
.ans-md th:first-child, .ans-md td:first-child { padding-left: 0; }
.ans-md th:last-child, .ans-md td:last-child { padding-right: 0; }

/* 生成状态与错误 */
.agent-status {
  display: flex; align-items: center; gap: 0.45rem;
  font-size: 12.5px; color: var(--ink-3); padding: 0.15rem 0;
}
.agent-spinner {
  width: 12px; height: 12px; border-radius: 50%;
  border: 1.6px solid var(--rule-strong); border-top-color: var(--ink-3);
  animation: agentSpin 0.7s linear infinite;
}
@keyframes agentSpin { to { transform: rotate(360deg); } }
.agent-error {
  font-size: 13px; line-height: 1.7; color: var(--danger, #b3261e);
  background: var(--surface-sunken); border-radius: 4px; padding: 0.55rem 0.7rem;
}
.agent-tool-status {
  display: inline-flex; align-items: center; gap: 0.35rem;
  margin-top: 0.5rem; padding: 0.15rem 0.5rem;
  font-size: 11.5px; color: var(--ink-3);
  background: var(--surface-sunken); border-radius: 999px;
}
.agent-tool-status svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.agent-tool-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--ink-3); }
.agent-tool-status.is-done .agent-tool-dot { background: var(--data, #2f7d5d); }
.agent-tool-status.is-done { opacity: 0.7; }

.ans-figs {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  margin: 0.75rem 0 0.8rem;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.ans-fig { min-width: 0; padding: 0.5rem 0.75rem 0.55rem; }
.ans-fig:first-child { padding-left: 0; }
.ans-fig + .ans-fig { border-left: 1px solid var(--rule-soft); }
.ans-fig-k { font-size: 11.5px; line-height: 1.5; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ans-fig-v {
  font-size: 18px; font-weight: 500; line-height: 1.35; letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums lining-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ans-fig-v small { margin-left: 0.2rem; font-size: 12px; font-weight: 400; color: var(--ink-3); letter-spacing: 0; }

.ans-table-wrap { margin: 0.7rem 0; overflow-x: auto; }
.ans-table {
  width: 100%; border-collapse: collapse;
  font-size: 12.5px; line-height: 1.55;
  font-variant-numeric: tabular-nums lining-nums;
  border-top: 1.5px solid var(--rule-strong);
  border-bottom: 1.5px solid var(--rule-strong);
}
.ans-table th {
  text-align: left; font-weight: 500; font-size: 12px; color: var(--ink-3);
  padding: 0.45rem 0.5rem 0.4rem;
  border-bottom: 1px solid var(--rule-strong);
  white-space: nowrap;
}
.ans-table td { padding: 0.28rem 0.5rem; white-space: nowrap; }
.ans-table tbody tr:first-child td { padding-top: 0.5rem; }
.ans-table tbody tr:last-child td { padding-bottom: 0.5rem; }
.ans-table th:first-child, .ans-table td:first-child { padding-left: 0; }
.ans-table th:last-child, .ans-table td:last-child { padding-right: 0; }
.ans-table .num { text-align: right; }
.ans-table tr.hl td { color: var(--accent); font-weight: 600; }
.ans-table.wrap td { white-space: normal; }
.ans-table.wrap td:first-child { white-space: nowrap; padding-right: 0.9rem; vertical-align: top; }

.ans-method { margin-top: 0.55rem; font-size: 12.5px; color: var(--ink-2); }
.ans-method summary {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.15rem 0;
  color: var(--ink-3); cursor: pointer; list-style: none;
  transition: color 0.15s var(--ease);
}
.ans-method summary::-webkit-details-marker { display: none; }
.ans-method summary::before {
  content: ""; width: 5px; height: 5px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg); transition: transform 0.15s var(--ease);
}
.ans-method[open] summary::before { transform: translateY(-1px) rotate(45deg); }
.ans-method summary:hover { color: var(--ink); }
.ans-method dl {
  display: grid; grid-template-columns: 2.6em minmax(0, 1fr); gap: 0.3rem 0.75rem;
  margin-top: 0.45rem; padding: 0.7rem 0.85rem;
  line-height: 1.65;
  background: var(--surface-sunken); border-radius: 8px;
}
.ans-method dt { color: var(--ink-3); }

.ans-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.8rem; }
.ans-btn, .ans-actions .copy-btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  height: 28px; padding: 0 0.75rem 0 0.6rem;
  font-size: 12.5px; color: var(--ink-2);
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px var(--rule);
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.ans-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ans-btn:hover, .ans-actions .copy-btn:hover { color: var(--ink); background: var(--raised); box-shadow: 0 0 0 1px var(--raised-ring), var(--raised-shadow); }
.ans-actions .copy-btn.is-copied { background: transparent; box-shadow: inset 0 0 0 1px var(--rule); }

.ans-followups { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.7rem; }
.followup {
  display: inline-flex; align-items: baseline; gap: 0.35rem;
  max-width: 100%;
  padding: 0.25rem 0.75rem;
  font-size: 12.5px; line-height: 1.55; text-align: left;
  color: var(--ink-2);
  background: var(--surface-sunken);
  border-radius: 14px;
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.followup::after { content: "→"; color: var(--ink-4); }
.followup:hover { color: var(--ink); background: var(--raised); box-shadow: 0 0 0 1px var(--raised-ring), var(--raised-shadow); }

/* 输入区 */
.agent-foot { flex-shrink: 0; padding: 0.75rem 1rem 0.6rem; border-top: 1px solid var(--rule); background: var(--surface); }
.agent-input-wrap {
  padding: 0.4rem 0.4rem 0.4rem 0.45rem;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 16px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.agent-input-wrap:focus-within { border-color: var(--rule-strong); box-shadow: 0 0 0 3px color-mix(in srgb, var(--data) 10%, transparent); }
.agent-input-wrap.is-disabled { opacity: 0.55; }
.agent-ctx { display: flex; padding: 0 0 0.3rem; }
.agent-ctx:empty { display: none; }

/* 未登录访客的每日配额提示 */
.agent-quota-hint {
  padding: 0 0 0.35rem;
  font-size: 11.5px; line-height: 1.5;
  color: var(--ink-3);
}
.agent-quota-hint[hidden] { display: none; }

/* 额度用尽时的提示卡片 */
.agent-quota-notice {
  margin-top: 0.9rem;
  padding: 0.9rem 1rem;
  text-align: center;
  background: var(--surface-sunken);
  border-radius: 8px;
}
.agent-quota-title {
  margin: 0 0 0.35rem;
  font-size: 14px; font-weight: 600; color: var(--ink);
}
.agent-quota-desc {
  margin: 0 0 0.75rem;
  font-size: 12.5px; line-height: 1.65; color: var(--ink-3);
}
.agent-quota-login {
  height: 32px; padding: 0 1rem;
  font-size: 13px; font-weight: 500;
  color: var(--bg); background: var(--ink);
  border-color: var(--ink);
  border-radius: 16px;
  transition: background-color 0.15s var(--ease), transform 0.15s var(--ease);
}
.agent-quota-login:hover { background: var(--ink-2); border-color: var(--ink-2); }
.agent-quota-login:active { transform: scale(0.97); }
.ctx-chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  max-width: 100%; height: 24px;
  padding: 0 0.2rem 0 0.6rem;
  font-size: 12px; color: var(--ink-2);
  background: var(--surface-sunken);
  border-radius: 12px;
}
.ctx-chip .ctx-k { flex: none; color: var(--ink-3); }
.ctx-chip b { min-width: 0; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx-chip button {
  flex: none; width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-3); border-radius: 50%;
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease);
}
.ctx-chip button svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.ctx-chip button:hover { color: var(--ink); background: var(--rule-soft); }
button.ctx-chip.is-off {
  padding: 0 0.65rem;
  color: var(--ink-3); background: transparent;
  box-shadow: inset 0 0 0 1px var(--rule);
  transition: color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
button.ctx-chip.is-off:hover { color: var(--ink); box-shadow: inset 0 0 0 1px var(--rule-strong); }
.agent-input-row { display: flex; align-items: flex-end; gap: 0.5rem; padding-left: 0.35rem; }
.agent-input-row textarea {
  flex: 1; min-width: 0;
  resize: none; border: none; outline: none; background: transparent;
  font: inherit; font-size: 13.5px; line-height: 1.6; color: var(--ink);
  max-height: 160px; padding: 0.3rem 0;
}
.agent-input-row textarea::placeholder { color: var(--ink-4); }
.agent-send {
  width: 30px; height: 30px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--bg); background: var(--ink);
  border-radius: 50%;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.agent-send svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.agent-send:not(:disabled):hover { background: var(--ink-2); }
.agent-send:disabled { color: var(--ink-4); background: var(--surface-sunken); cursor: default; }

.agent-foot-meta { display: flex; align-items: center; justify-content: center; gap: 0.15rem; margin-top: 0.4rem; font-size: 11.5px; color: var(--ink-3); }
.agent-info { position: relative; display: inline-flex; }
.agent-info-btn {
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-4); border-radius: 50%;
  transition: color 0.15s var(--ease);
}
.agent-info-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.agent-info-btn:hover, .agent-info-btn:focus-visible { color: var(--ink-2); }
.agent-info-tip {
  position: absolute; right: -8px; bottom: calc(100% + 8px); z-index: 4;
  width: 15rem; padding: 0.6rem 0.75rem;
  font-size: 12px; line-height: 1.65; color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--rule); border-radius: 8px;
  box-shadow: var(--shadow-pop);
  opacity: 0; visibility: hidden; transform: translateY(2px);
  transition: opacity 0.15s var(--ease), transform 0.15s var(--ease), visibility 0s linear 0.15s;
}
.agent-info:hover .agent-info-tip, .agent-info-btn:focus-visible + .agent-info-tip {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity 0.15s var(--ease), transform 0.15s var(--ease), visibility 0s;
}

/* 从回答定位到页面中的图表 */
.fig, .table-panel { scroll-margin-top: 72px; }
@keyframes locate {
  0%, 35% { outline-color: color-mix(in srgb, var(--accent) 45%, transparent); }
  100% { outline-color: transparent; }
}
.is-located { outline: 2px solid transparent; outline-offset: 10px; border-radius: 4px; animation: locate 2.2s var(--ease) both; }

/* ==========================================================================
   响应式
   ========================================================================== */
@media (max-width: 1200px) {
  .fig-grid-7-5, .fig-grid-5-7 { grid-template-columns: minmax(0, 1fr); }
  .search-trigger { min-width: 0; }
  .search-trigger span { display: none; }
  .search-trigger kbd { display: none; }
}

@media (max-width: 900px) {
  :root { --gutter: 1.1rem; }
  .masthead-inner { flex-wrap: wrap; }
  .brand-title { font-size: 18px; }
  .pane-head { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .pane-meta > div:first-child { padding-left: 0; }
  .pane-title { font-size: 25px; }
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: none; padding-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .profile-lists { grid-template-columns: 1fr; }
  .table-search-box { min-width: 0; flex: 1; }
}

@media (max-width: 640px) {
  body { font-size: 13.5px; }
  .brand-logo { display: none; }
  .brand-text { padding-left: 0; border-left: none; }
  .brand-sub { white-space: normal; }
  .masthead-actions { width: 100%; justify-content: space-between; }
  .masthead-actions .text-btn#cite-btn, .masthead-divider { display: none; }
  .main-container { padding-top: 1.5rem; }
  .tool-group { flex-wrap: wrap; }
  .tool-group-wide { flex-direction: column; gap: 0.35rem; }
  .toolbar > .tool-group:first-child > .tool-label,
  .toolbar > .tool-group-wide > .tool-label { flex: none; width: auto; }
  .segmented { max-width: 100%; overflow-x: auto; }
  .stat-value { font-size: 24px; }
  .fig-head { flex-direction: column; gap: 0.35rem; }
  .fig-tools { margin-left: -0.5rem; }
  #china-map-container { height: 380px !important; }
  #global-total-container, #global-secondary-container { height: 600px !important; }
  .profile-figures, .inst-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .table-toolbar { flex-direction: column; align-items: stretch; }
  .table-actions { justify-content: space-between; flex-wrap: wrap; }
  .table-pagination { flex-direction: column; }
  .form-row { grid-template-columns: 1fr; }
  .agent-launcher { right: 1rem; bottom: 1rem; }
  .site-footer-inner { padding-bottom: 5.5rem; }
  .modal-overlay { padding: 1rem; }
  #global-search-modal { padding: 0; }
  .modal-search { max-width: none; max-height: none; height: 100%; border-radius: 0; }
  .search-foot { display: none; }
  .search-cancel { display: inline-flex; }
}

/* ==========================================================================
   打印：输出为纸本页面
   ========================================================================== */
@media print {
  :root, [data-theme="dark"] {
    --bg: #fff; --surface: #fff; --surface-sunken: #f3f3f3;
    --ink: #000; --ink-2: #333; --ink-3: #555; --rule: #bbb; --rule-soft: #ddd; --rule-strong: #000;
    --data: #1f3a5f; --data-soft: #c6d1df; --data-highlight: #b0362b; --accent: #8b1d1d;
  }
  .section-nav, .masthead-actions, .toolbar, .fig-tools, .agent-launcher, .agent-panel,
  .table-toolbar, .table-pagination, .footer-links, .footer-rule, .toast, .sb-track { display: none !important; }
  .main-container { padding: 0; max-width: none; }
  body.agent-docked { padding-right: 0; }
  .fig { break-inside: avoid; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
