/* 结构样式；设计令牌见 tokens.css */
/* ============================================================
   FengInvest 设计宪法 v3.0 · 册二 视觉 token + 组件契约
   唯一样式入口。任何颜色/字号/间距必须引用这里的变量。
   主题：亮色默认（石墨）；[data-theme="dark"] 整体重映射。
   ============================================================ */


* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: var(--fs-body);
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0.01em;
}

/* 细滚动条（借鉴 llm-text-processor） */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* 主题防闪烁脚本在 layout <head> 预置，此处不需要 JS */

/* ---- 布局 ---- */
.layout { display: flex; min-height: 100vh; }

/* ---- 侧栏（抽屉式） ---- */
.sidebar {
  position: fixed;
  top: 0;
  left: -240px;
  width: 220px;
  height: 100vh;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 10000;
  box-shadow: 4px 0 12px rgba(0,0,0,0.15);
  overflow-y: auto;
}
.sidebar.open { left: 0; }

.sidebar-header {
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sidebar-logo {
  color: var(--sidebar-active);
  font-size: 20px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.5px;
}
.sidebar-toggle {
  width: 30px; height: 30px;
  border: 0; border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.1);
  color: var(--sidebar-text);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.2); color: #fff; }

.sidebar-nav { list-style: none; padding: 8px 10px 12px; }
.nav-group-label {
  font-size: var(--fs-xxs);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-faint);
  padding: 14px 10px 4px;
  opacity: 0.85;
}
.nav-item {
  display: block;
  padding: 9px 12px;
  margin: 1px 0;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  border-radius: var(--radius);
  transition: background 0.12s, color 0.12s;
}
.nav-item:hover { color: var(--sidebar-active); background: rgba(255,255,255,0.07); }
.nav-item.active {
  color: var(--sidebar-active);
  background: rgba(255,255,255,0.12);
  font-weight: 600;
}

/* ---- 顶栏 ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0 20px 0;
}
.menu-toggle {
  width: 36px; height: 36px;
  border: 0; border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  font-size: 22px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.menu-toggle:hover { background: var(--bg-inset); border-radius: var(--radius); }
.settings-btn, .theme-btn {
  width: 34px; height: 34px;
  border: 0; border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.settings-btn:hover, .theme-btn:hover { background: var(--bg-inset); }
.topbar-title {
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--text-muted);
}

/* ---- 主内容区 ---- */
.main-content {
  flex: 1;
  padding: 20px 36px 28px 36px;
  max-width: 1200px;
  margin: 0 auto; /* 宪法册二：版心居中，宽屏不偏左 */
}
@media (min-width: 769px) {
  .sidebar.open { left: 0; }
  /* 侧栏展开时：在剩余空间内继续居中 */
  .main-content.sidebar-open {
    margin-left: calc(220px + max(0px, (100% - 220px - 1200px) / 2));
    margin-right: auto;
  }
}

/* ---- 页头 ---- */
.page-header { margin-bottom: 24px; }
.page-header h2 { font-size: var(--fs-h1); font-weight: 600; letter-spacing: -0.02em; }
.breadcrumb { font-size: 13px; color: var(--text-muted); margin-top: 4px; font-family: var(--font-serif); font-style: italic; letter-spacing: 0; }
.breadcrumb a { color: var(--accent); text-decoration: none; }

.section-title {
  font-size: var(--fs-h3);
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- 卡片 ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

/* ---- 统计卡 ---- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  text-align: center;
  padding: 20px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.stat-value {
  font-size: var(--fs-display);
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stat-value.positive { color: var(--color-up); }
.stat-value.negative { color: var(--color-down); }

/* ---- 数字（宪法：等宽对齐） ---- */
.num { font-variant-numeric: tabular-nums; }

/* ---- 持仓表 ---- */
.holdings-table { width: 100%; border-collapse: collapse; }
.holdings-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border);
}
.holdings-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.holdings-table tr:hover td { background: var(--bg-inset); }
.holdings-table a { color: var(--accent); text-decoration: none; font-weight: 600; }
.holdings-table a:hover { text-decoration: underline; }

.pnl-positive { color: var(--color-up); font-weight: 600; }
.pnl-negative { color: var(--color-down); font-weight: 600; }

/* ---- 筛选页签（组件契约 2.4） ---- */
.filter-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: var(--space-4); background: var(--bg-inset); padding: 4px; border-radius: var(--radius); width: fit-content; max-width: 100%; }

/* ---- 提醒条目（宪法 2.3：禁大红大绿——语义只用 soft 底色区分，无左侧竖线） ---- */
.alert-list { display: flex; flex-direction: column; gap: var(--space-2); }
.alert-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
}
.alert-item { margin-bottom: var(--space-2); }
.alert-item .alert-text { flex: 1; min-width: 0; }
.alert-item > a.btn, .alert-item > .btn, .alert-item > a.btn-sm { margin-left: auto; }
.alert-item .btn, .alert-item a.btn {
  flex-shrink: 0;
  white-space: nowrap;
  min-width: 88px;
  text-align: center;
  justify-content: center;
}
.alert-item.info { background: var(--bg-inset); }
.alert-item.warning { background: var(--warn-bg); }
.alert-item.danger { background: var(--danger-bg); }
.alert-item.stale { background: var(--stale-bg); }
.alert-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.3px;
}
.alert-tag.info { background: var(--stale-bg); color: var(--text-secondary); }
.alert-tag.warning { background: var(--warn-bg); color: var(--warn); }
.alert-tag.danger { background: var(--danger-bg); color: var(--danger); }

/* ---- 研究动态 ---- */
.activity-list { display: flex; flex-direction: column; gap: 6px; }
.activity-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-inset);
  border-radius: var(--radius);
  font-size: 14px;
}
.activity-ticker { font-weight: 600; color: var(--accent); }
.activity-layer { font-size: var(--fs-small); }

/* ---- 目录状态 ---- */
.dir-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.dir-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 6px 12px;
  background: var(--bg-inset);
  border-radius: 6px;
}

/* ---- 通用表 ---- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.data-table tr:hover td { background: var(--bg-inset); }
.data-table a { color: var(--accent); text-decoration: none; }
.data-table a:hover { text-decoration: underline; }

/* ---- 徽章（宪法契约） ---- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 600;
}
.badge-green { background: var(--ok-bg); color: var(--ok); }
.badge-yellow { background: var(--warn-bg); color: var(--warn); }
.badge-red { background: var(--danger-bg); color: var(--danger); }
.badge-primary { background: var(--accent-soft); color: var(--accent); }
.badge-neutral { background: var(--bg-inset); color: var(--text-secondary); }
.badge-community { background: var(--warn-bg); color: var(--warn); border: 1px dashed var(--warn); }

/* ---- 来源徽标（宪法册五：自有 vs 外来） ---- */
.source-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  border-radius: 3px;
  font-size: var(--fs-xxs);
  font-weight: 600;
  vertical-align: middle;
}
.source-tag.own { background: var(--accent-soft); color: var(--accent); }
.source-tag.community { background: var(--warn-bg); color: var(--warn); border: 1px dashed var(--warn); }

/* ---- 内联提示（deprecated 保留兼容） ---- */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 14px;
}
.alert-info { background: var(--ok-bg); border: 1px solid var(--ok); }
.alert-warning { background: var(--warn-bg); border: 1px solid var(--warn); }
.alert-danger { background: var(--danger-bg); border: 1px solid var(--danger); }

/* ---- 空态 ---- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state p { font-size: 14px; font-family: var(--font-serif); font-style: italic; letter-spacing: 0.01em; }
.empty-holdings { text-align: center; padding: 40px 24px; color: var(--text-muted); }
.empty-holdings p { font-size: 14px; margin-top: 6px; font-family: var(--font-serif); font-style: italic; }

/* ---- 按钮 ---- */
.btn {
  display: inline-block;
  text-decoration: none;
  transition: background 0.12s, box-shadow 0.12s, border-color 0.12s;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: var(--bg-inset);
  color: var(--text);
}
/* 按钮统一原则（2026-09-06 创始人令）：全站同一尺寸体系，只有 sm 一档变体；行内动作一律 btn-sm 垂直居中 */
.btn-sm { padding: 4px 12px; font-size: 12px; min-height: 28px; }
.btn:not(.btn-sm) { min-height: 36px; }
.btn:hover { filter: brightness(0.97); }
.data-table .btn, .holdings-table .btn { vertical-align: middle; }
.btn-primary { background: var(--primary); color: var(--bg-card); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--fg); }
.btn-outline:hover { border-color: var(--fg-muted); }
.btn-danger-outline { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-danger-outline:hover { background: rgba(255,0,0,0.06); }
.chip { background: transparent; border: 1px solid transparent; color: var(--text-secondary); border-radius: var(--radius-sm); cursor: pointer; padding: 4px 14px; font-size: 13px; min-height: 28px; transition: background 0.12s, color 0.12s, box-shadow 0.12s; }
.chip:hover { color: var(--text); background: rgba(127, 127, 127, 0.12); }
.chip.active { background: var(--bg-card); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }
.scheme-opt { flex: 1; border: 2px solid var(--border); padding: 10px; border-radius: 8px; background: var(--bg-card); cursor: pointer; font-size: 13px; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.88; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---- 表单 ---- */
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.calc-form { display: flex; flex-direction: column; gap: 8px; }
.calc-form label { font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); text-transform: uppercase; }
.calc-form input, .calc-form select, .calc-form textarea {
  padding: 9px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 14px;
  width: 100%;
  background: var(--bg-card);
  color: var(--text);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.calc-form input:focus, .calc-form select:focus, .calc-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.calc-result { padding: 16px; background: var(--bg-inset); border-radius: var(--radius); }
.result-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.result-row .label { color: var(--text-muted); }
.result-row .value { font-weight: 600; }

.field-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field-row > label { font-size: var(--fs-small); font-weight: 600; color: var(--text-secondary); }
.field-row .field-hint { font-size: var(--fs-xs); color: var(--text-faint); }

/* ---- 详情网格 ---- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-grid > * { min-width: 0; }

/* ---- 条目列表 ---- */
.entry-list { display: flex; flex-direction: column; gap: 8px; }
.entry-item {
  display: block;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.12s, box-shadow 0.12s, background 0.12s;
}
.entry-item:hover { border-color: var(--border-strong); background: var(--bg-card); box-shadow: var(--shadow-lift); }
.entry-title { font-weight: 600; font-size: 15px; }
.entry-preview { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ---- 决策日志 ---- */
.journal-entry {
  display: grid;
  grid-template-columns: 140px 80px 1fr;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.journal-entry:last-child { border-bottom: none; }
.journal-date { color: var(--text-muted); font-size: 13px; }
.journal-ticker { font-weight: 600; }

/* ---- Markdown 阅读版式（宪法：阅读宽度 760 / 行高 1.85） ---- */
.md-content { max-width: var(--w-read); }
.md-content h1 { font-size: var(--fs-display); margin: 20px 0 10px; }
.md-content h2 { font-size: var(--fs-h1); margin: 18px 0 10px; }
.md-content h3 { font-size: var(--fs-h2); margin: 18px 0 8px; }
.md-content h4 { font-size: var(--fs-h3); margin: 14px 0 6px; }
.md-content p { margin: 8px 0; font-size: 15px; line-height: var(--lh-read); }
.md-content ul, .md-content ol { margin: 8px 0; padding-left: 24px; }
.md-content li { margin: 4px 0; font-size: 14px; line-height: 1.7; }
.md-content li p { margin: 4px 0; }
.md-content a { color: var(--accent); text-decoration: none; }
.md-content a:hover { text-decoration: underline; }
.md-content strong { font-weight: 600; }
.md-content em { font-style: italic; }
.md-content hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.md-content blockquote {
  margin: 12px 0;
  padding: 10px 16px;
  background: var(--accent-soft);
  border-radius: var(--radius);
}
.md-content blockquote p { margin: 4px 0; font-size: 14px; }
.md-content code {
  font-family: "SF Mono", "JetBrains Mono", ui-monospace, "Consolas", monospace;
  font-size: 13px;
  background: var(--bg-inset);
  padding: 2px 6px;
  border-radius: 3px;
}
.md-content pre {
  margin: 12px 0;
  padding: 14px 16px;
  background: var(--sidebar-bg);
  border-radius: var(--radius);
  overflow-x: auto;
}
.md-content pre code {
  background: none;
  padding: 0;
  color: #CBD5E1;
  font-size: 13px;
  line-height: 1.6;
}
.md-content table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 14px; }
.md-content th, .md-content td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  text-align: left;
}
.md-content th {
  background: var(--bg-inset);
  font-weight: 600;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.md-content tr:hover td { background: var(--bg-inset); }
.md-content img { max-width: 100%; border-radius: var(--radius); margin: 12px 0; }

/* ---- 报告阅读页作用域（宪法 5.3：16px/1.85） ---- */
.report-reader {
  padding: 32px 40px;
  border-radius: 24px;
  box-shadow: 0 24px 60px -30px rgba(30, 41, 59, 0.18), 0 10px 24px -16px rgba(30, 41, 59, 0.10);
}
[data-theme="dark"] .report-reader { box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.55), 0 10px 24px -16px rgba(0, 0, 0, 0.35); }
.report-reader .md-content { max-width: var(--w-read); }
.report-reader .md-content p, .report-reader .md-content li { font-size: 16px; line-height: var(--lh-read); }
.report-reader .md-content li { margin: 6px 0; }

/* ---- 红队栏（宪法册五：报告页无此栏 = P0 缺陷） ---- */
.red-team-bar {
  border: 1px solid var(--warn);
  background: var(--warn-bg);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 20px 0;
  font-size: 14px;
  line-height: 1.7;
}
.red-team-bar .rt-title { font-weight: 700; color: var(--warn); margin-bottom: 6px; }
.red-team-bar .rt-row { margin: 4px 0; }
.red-team-bar .rt-label { font-weight: 600; }
.red-team-bar.missing { border-color: var(--stale); background: var(--stale-bg); }
.red-team-bar.missing .rt-title { color: var(--stale); }

/* ---- 五态数据容器（宪法册二：loading/ok/empty/error/stale） ---- */
.data-block { position: relative; min-height: 24px; }
.data-block[data-state="loading"] { opacity: 0.55; }
.data-block[data-state="loading"]::after {
  content: "加载中…";
  display: block;
  padding: 12px 0;
  color: var(--text-muted);
  font-size: 13px;
}
.data-block[data-state="empty"] .db-empty,
.data-block[data-state="error"] .db-error,
.data-block[data-state="stale"] .db-stale-banner { display: block; }
.db-empty, .db-error { display: none; padding: 16px 0; color: var(--text-muted); font-size: 14px; }
.db-error { color: var(--danger); }
.db-stale-banner {
  display: none;
  margin: 0 0 12px;
  padding: 8px 14px;
  border-radius: var(--radius);
  background: var(--stale-bg);
  border: 1px solid var(--stale);
  color: var(--stale);
  font-size: 13px;
}
.data-block[data-state="stale"] { border: 1px dashed var(--stale); border-radius: var(--radius); padding: 12px; }
.data-block[data-state="error"] { border: 1px solid var(--danger); border-radius: var(--radius); padding: 12px; }

/* ---- 步骤向导（宪法册六：登记/卖出 wizard） ---- */
.step-wizard { max-width: 720px; }
.step-indicator { display: flex; gap: 6px; margin-bottom: 20px; }
.step-dot {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--border-strong);
}
.step-dot.done { background: var(--accent); }
.step-dot.current { background: var(--primary); }
.step-panel { display: none; }
.step-panel.active { display: block; }
.step-nav { display: flex; justify-content: space-between; margin-top: 20px; }

/* ---- 市场数据源卡 ---- */
.source-card {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
}
.source-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
  border-color: var(--accent);
}
.source-card strong { font-size: 14px; }
.sc-desc { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 3px; line-height: 1.4; }
.sc-tag { display: inline-block; font-size: var(--fs-xxs); padding: 2px 6px; border-radius: 4px; margin-top: 5px; }
.sc-tag.green { color: var(--ok); background: var(--ok-bg); }
.sc-tag.yellow { color: var(--warn); background: var(--warn-bg); }
.sc-tag.red { color: var(--danger); background: var(--danger-bg); }
.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

/* ---- Mermaid ---- */
.diagram-card { overflow-x: auto; padding: 24px; }
.diagram-card .mermaid { min-width: 800px; display: flex; justify-content: center; }
.pipeline-card .mermaid { min-width: 900px; display: flex; justify-content: center; }
.system-map-diagram { min-width: 1500px !important; justify-content: flex-start !important; }

/* ---- 图例 ---- */
.legend-card { padding: 14px 20px; }
.legend-items { display: flex; gap: 20px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); }
.legend-color { width: 16px; height: 16px; border-radius: 3px; display: inline-block; }

/* ---- 兼容旧类 ---- */
.status-grid { display: flex; gap: 12px; flex-wrap: wrap; }
.status-item { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 6px 12px; background: var(--bg-inset); border-radius: 6px; }
.sidebar-badge { display: inline-block; font-size: var(--fs-xxs); padding: 1px 6px; background: var(--accent); color: #fff; border-radius: 4px; margin-left: 6px; vertical-align: middle; }
.watch-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }

/* ---- 响应式（移动端断点 640） ---- */
@media (max-width: 768px) {
  .sidebar { left: -240px; }
  .sidebar.open { left: 0; width: 100%; }
  .topbar { padding: 8px 0 12px 0; }
  .main-content { padding: 12px 16px; max-width: 100%; }
  .main-content.sidebar-open { margin-left: 0; }
  .dashboard-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .calc-grid, .detail-grid { grid-template-columns: 1fr; }
  .journal-entry { grid-template-columns: 1fr; }
  .source-grid { grid-template-columns: 1fr; }
  .holdings-table-wrap, .data-table-wrap { overflow-x: auto; }
  .card { padding: 14px; }
  .stat-card { padding: 14px 10px; }
  .stat-value { font-size: 24px; }
  .page-header { margin-bottom: 14px; }
  .page-header h2 { font-size: 20px; }
}

@media (max-width: 480px) {
  .main-content { padding: 10px 12px !important; }
  .dashboard-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .stat-card { padding: 10px 6px; }
  .stat-value { font-size: 20px; }
  .stat-label { font-size: var(--fs-xxs); }
  .card { padding: 12px; margin-bottom: 10px; }
  .section-title { font-size: 14px; margin-bottom: 8px; }
  .source-grid { grid-template-columns: 1fr; gap: 6px; }
  .source-card { padding: 8px 10px; }
  .source-card strong { font-size: var(--fs-small); }
  .sc-desc { font-size: var(--fs-xxs); }
  .holdings-table th, .holdings-table td { padding: 6px; font-size: var(--fs-small); }
  .data-table th, .data-table td { padding: 6px; font-size: var(--fs-small); }
  .page-header { margin-bottom: 10px; }
  .page-header h2 { font-size: 17px; }
  .breadcrumb { font-size: var(--fs-xxs); }
  .alert-item { font-size: var(--fs-small); padding: var(--space-2) var(--space-3); }
  .activity-item { font-size: var(--fs-small); padding: 8px 10px; }
  .btn:not(.btn-sm) { padding: 6px 12px; font-size: var(--fs-small); min-height: 36px; }
  .journal-entry { font-size: var(--fs-small); grid-template-columns: 1fr; padding: 6px 0; }
  .diagram-card, .pipeline-card { padding: 10px; overflow-x: auto; }
  .diagram-card .mermaid, .pipeline-card .mermaid { min-width: auto; }
  .legend-items { gap: 8px; }
  .empty-state { padding: 24px 12px; }
  .watch-card-grid { grid-template-columns: 1fr !important; }
}

/* ---- 移动端底部导航（宪法册八） ---- */
.bottom-nav { display: none; }
@media (max-width: 768px) {
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--sidebar-bg);
    z-index: 9999;
    padding: 4px 0 max(4px, env(safe-area-inset-bottom));
  }
  .bottom-nav .bn-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 10px;
    padding: 6px 0;
  }
  .bottom-nav .bn-item span { font-size: var(--fs-xxs); }
  .bottom-nav .bn-item.active { color: var(--sidebar-active); }
  body { padding-bottom: 58px; }
}

/* 宪法修正（创始人 2026-09-06 裁定）：全站无动画——静态优先 */
*, *::before, *::after {
  transition: none !important;
  animation: none !important;
  scroll-behavior: auto !important;
}

/* 宪法册二补充：数字等宽栈 + 移动端表格滚动 */
.num { font-variant-numeric: tabular-nums; font-family: "SF Mono", "Cascadia Mono", Consolas, "Courier New", monospace; }
/* O2 文献图谱/报告阅读器：宽表格横向滚动而非撑破视口 */
.md-content table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
@media (max-width: 640px) {
  .card > .data-table, .card table.data-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
}

/* 侧栏「更多工具」折叠组（宪法 1.4：侧栏只留两梯队，长尾收纳） */
.nav-more-toggle {
  width: 100%;
  background: none;
  border: none;
  color: var(--sidebar-text);
  opacity: 0.75;
  font-size: 13px;
  padding: 9px 12px;
  margin: 1px 0;
  text-align: left;
  cursor: pointer;
  letter-spacing: 0.5px;
  border-radius: var(--radius);
}
.nav-more-toggle:hover { opacity: 1; color: var(--sidebar-active); background: rgba(255,255,255,0.07); }
.nav-more-toggle .more-arrow { display: inline-block; float: right; }
.nav-more-toggle.expanded .more-arrow { transform: rotate(180deg); }

/* ---- market.ejs 内联样式收编（2026-09-11 #31） ---- */
.source-section { margin-bottom: 20px; }
.source-title { font-size: 15px; font-weight: 600; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 2px solid var(--border); }
.source-card > div:nth-child(1) { font-weight: 600; font-size: 14px; }
.source-card > div:nth-child(2) { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.mkt-muted { color: var(--text-muted); font-size: 13px; }
.mkt-muted-sm { color: var(--text-muted); font-size: 12px; }
.mkt-muted-xs { color: var(--text-muted); font-size: 11px; }
.mkt-hint { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.mkt-loading { text-align: center; padding: 40px; }
.mkt-table { width: 100%; font-size: 13px; }
.mkt-hdr-row { display: flex; justify-content: space-between; align-items: center; }
.mkt-flex-between { display: flex; justify-content: space-between; font-size: 13px; }
.mkt-flex-gap { display: flex; gap: 8px; align-items: center; }
.mkt-flex { display: flex; gap: 16px; }
.mkt-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.mkt-fx-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.mkt-inset { padding: 12px; background: var(--bg-inset); border-radius: 8px; }
.mkt-inset-c { flex: 1; text-align: center; padding: 12px; background: var(--bg-inset); border-radius: 8px; }
.mkt-emoji { font-size: 20px; margin-bottom: 8px; }
.mkt-val-lg { font-size: 28px; font-weight: 700; color: var(--ok); }
.mkt-val { font-size: 22px; font-weight: 700; margin: 4px 0; }
.mkt-val-plain { font-size: 22px; }
.mkt-noise-p { font-size: 14px; line-height: var(--lh-body); color: var(--text-secondary); margin: 0; }
.mkt-sources-intro { font-size: 15px; line-height: 1.7; margin: 0; }
.mkt-notes-title { font-size: 14px; margin: 0; }
.mkt-warn-note { font-size: 12px; margin-top: 4px; color: var(--warn); }
.mkt-ok-banner { margin-top: 12px; background: var(--ok-bg); border: 1px solid var(--ok); }
.mkt-warn-banner { margin-top: 12px; display: none; background: var(--warn-bg); border-color: var(--warn); }
.mkt-mb0 { margin-bottom: 0; }
.mkt-mt8 { margin-top: 8px; }
.mkt-m4 { margin: 4px 0; }
.mkt-hidden { display: none; }
.mkt-bar-track { height: 8px; background: var(--border); border-radius: 4px; }

/* ---- 表格 ≤640px 卡片化（2026-09-11 #32；data-label 由 i18n.js relabelTables 同步表头文字） ---- */
@media (max-width: 640px) {
  .holdings-table-wrap, .data-table-wrap { overflow-x: visible; }
  .holdings-table thead, .data-table thead { display: none; }
  .holdings-table, .data-table { border-collapse: separate; border-spacing: 0; }
  .holdings-table tr, .data-table tr {
    display: block; margin-bottom: 12px; padding: 4px 12px;
    border: 1px solid var(--border); border-radius: 8px; background: var(--bg-card);
  }
  .holdings-table td, .data-table td {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    min-height: 44px; padding: 6px 0; border: none; text-align: right;
  }
  .holdings-table td::before, .data-table td::before {
    content: attr(data-label); font-weight: 600; font-size: 12px;
    color: var(--text-muted); text-align: left; flex-shrink: 0;
  }
  .holdings-table td:empty, .data-table td:empty { display: none; }
}

/* ===== 结论卡 conclusion-card（R58 UX 审计 P0-1）：机器状态 → 一句人话 + 动词按钮 ===== */
.conclusion-card {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  margin: 0 0 18px 0;
}
.conclusion-card.cc-green { background: var(--ok-bg, #F0FDF6); }
.conclusion-card.cc-yellow { background: var(--warn-bg, #FFFBEB); }
.conclusion-card.cc-red { background: var(--danger-bg, #FDF2F2); }
.conclusion-card .cc-badge {
  font-size: 15px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.cc-green .cc-badge { background: var(--ok); color: #fff; }
.cc-yellow .cc-badge { background: var(--warn); color: #fff; }
.cc-red .cc-badge { background: var(--danger); color: #fff; }
.conclusion-card .cc-main {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.5;
  flex: 1 1 300px;
  min-width: 0;
}
.conclusion-card .cc-sub {
  font-size: 13px;
  color: var(--text-muted);
  flex: 1 1 200px;
  min-width: 0;
}
.conclusion-card .cc-actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
