/* ==========================================================
   财经研报风（A3）· 仅浅色（E2）
   - 米黄纸色页面 / 米白纸面正文 / 暗红印章主色
   - 衬线标题（思源宋体 fallback 系统宋体）+ 黑体正文
   - 涨跌色：A 股惯例 红涨绿跌（仅在 .report 内的数字 / 持仓盈亏体现）
   - 状态色：标准语义（绿好红坏，用于 status / error / 操作记录刷新提醒）
   ========================================================== */

:root {
  /* 纸面层 */
  --bg:           #F4EFE3;   /* 页面：米黄旧报底 */
  --bg-paper:     #FCFAF4;   /* 内容卡：米白纸面 */
  --bg-sidebar:   #ECE5D5;   /* 侧栏：米黄边栏 */
  --bg-hover:    rgba(139, 0, 0, 0.04);
  --bg-active:   rgba(139, 0, 0, 0.08);
  --quote-bg:     #F0E9D6;
  --tldr-bg:      #F8F1DF;

  /* 文字 */
  --text:         #1A140C;   /* 黑墨 */
  --text-strong:  #0F0A04;
  --text-muted:   #6B5F4D;   /* 暖灰 */
  --text-faint:   #968870;

  /* 主色：暗红印章 */
  --accent:       #8B1A1A;
  --accent-dark:  #6B0F0F;
  --accent-soft:  #B84545;
  --accent-blue:  #0F4C75;   /* 次强调：图注 / 引用条 */

  /* 边线（微黄） */
  --border:       #D6CDB8;
  --border-dark:  #B5A98C;
  --border-faint: #E5DCC4;

  /* 状态色（标准语义，给 status / error） */
  --success:      #15803D;
  --danger:       #B91C1C;

  /* 涨跌色（A 股惯例：红涨绿跌） */
  --num-up:       #C0392B;
  --num-down:     #1E5631;

  /* 字体 —— 微信公众号风：苹方 / 雅黑系无衬线为主 */
  --font-sans:  -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "HarmonyOS Sans SC", "Source Han Sans SC", "Noto Sans SC", "Helvetica Neue", Arial, system-ui, sans-serif;
  --font-serif: var(--font-sans);                                       /* 整体不再宋体，与 sans 同栈以兼容旧引用 */
  --font-decor: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;  /* 仅章节印章 / 决策纲要徽标使用 */
  --font-mono:  "JetBrains Mono", "SF Mono", "Cascadia Code", Consolas, ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.78;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, button { font-size: 14px; }

/* 整页容器：限宽 1180，纸感 paper 居中 */
.app-wrap {
  display: flex;
  max-width: 1180px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg-paper);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  box-shadow: 0 0 24px rgba(43, 32, 14, 0.06);
}

/* ============================================================
   登录页
   ============================================================ */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  background-image:
    radial-gradient(rgba(139, 26, 26, 0.04) 1px, transparent 1px),
    radial-gradient(rgba(139, 26, 26, 0.03) 1px, transparent 1px);
  background-size: 32px 32px, 32px 32px;
  background-position: 0 0, 16px 16px;
}
.login-card {
  background: var(--bg-paper);
  padding: 52px 44px 40px;
  width: 380px;
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  box-shadow: 0 6px 32px rgba(43, 32, 14, 0.08);
}
.login-card .brand {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-family: var(--font-sans);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0;
}
.login-card .subtitle {
  margin: 0 0 28px;
  color: var(--text-muted);
  font-size: 13px;
  letter-spacing: 0.08em;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 16px;
}
.login-card label { display: block; margin-bottom: 16px; }
.login-card label span {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}
.login-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: #fff;
  outline: none;
  font-family: var(--font-sans);
  transition: border-color .12s;
}
.login-card input:focus { border-color: var(--accent); }
.login-card button[type="submit"] {
  width: 100%;
  padding: 11px 0;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.06em;
  margin-top: 8px;
  transition: background .12s;
  font-family: var(--font-sans);
}
.login-card button[type="submit"]:hover { background: var(--accent-dark); }
.error { color: var(--danger); font-size: 13px; margin-top: 10px; }

/* ============================================================
   侧栏（米黄边栏 · 衬线 brand · 双行主 Tab）
   ============================================================ */
.sidebar {
  width: 224px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
}
.sidebar-head {
  padding: 20px 18px 10px;
  border-bottom: 1px solid var(--border);
}
.sidebar-head .brand {
  margin: 0 0 14px;
  font-family: var(--font-sans);
  font-size: 19px;
  font-weight: 700;
  color: var(--accent-dark);
  letter-spacing: 0;
  line-height: 1.25;
}

/* 主 Tab：单行中文（极小英文小标可选保留作为 SEO/装饰，电脑端默认隐藏） */
.main-tabs {
  display: flex;
  gap: 0;
  margin: 0 -18px 10px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 251, 240, 0.4);
}
.main-tabs .main-tab {
  flex: 1;
  min-width: 0;
  padding: 11px 2px 10px;
  color: var(--text-muted);
  text-align: center;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .12s, border-color .12s, background .12s;
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: center;
  line-height: 1.2;
}
.main-tabs .main-tab .en { display: none; }
.main-tabs .main-tab .zh {
  font-size: 13px;
  letter-spacing: 0;
  font-weight: 500;
  white-space: nowrap;
}
.main-tabs .main-tab:hover {
  color: var(--text);
  background: rgba(255, 251, 240, 0.8);
}
.main-tabs .main-tab.active {
  color: var(--accent-dark);
  border-bottom-color: var(--accent);
  background: var(--bg-paper);
}
.main-tabs .main-tab.active .en { color: var(--accent); }

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.btn-block { display: block; width: 100%; text-align: center; }
.btn-primary {
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  font-family: var(--font-sans);
  transition: background .12s;
  border-radius: 4px;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled {
  background: var(--border-dark);
  color: var(--bg-paper);
  cursor: not-allowed;
}
.btn-secondary {
  background: var(--bg-paper);
  color: var(--text);
  padding: 9px 14px;
  font-size: 13px;
  border: 1px solid var(--border);
  font-family: var(--font-sans);
  border-radius: 2px;
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--accent-soft); }

.filter-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  cursor: pointer;
  user-select: none;
}
.filter-toggle input { accent-color: var(--accent); }

.user-bar {
  padding: 10px 16px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.link {
  color: var(--accent-dark);
  font-size: 12px;
  padding: 0;
  text-decoration: none;
  border-bottom: 1px dashed var(--accent-soft);
}
.link:hover { color: var(--accent); border-bottom-style: solid; }

/* 侧栏列表项（左线指示选中，纸感虚线分隔） */
.stock-list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  overflow-y: auto;
  flex: 1;
}
.stock-list li {
  padding: 8px 16px 8px 13px;
  cursor: pointer;
  font-size: 13px;
  border-left: 3px solid transparent;
  transition: background .1s, border-color .1s;
  position: relative;
}
.stock-list li:hover {
  background: var(--bg-hover);
  border-left-color: var(--accent-soft);
}
.stock-list li.active {
  background: var(--bg-active);
  border-left-color: var(--accent);
  font-weight: 600;
  color: var(--accent-dark);
}
.stock-list li .code {
  display: block;
  color: var(--text-faint);
  font-size: 11px;
  font-family: var(--font-mono);
  margin-top: 2px;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

/* 板块边栏：一级标题（小型大写）+ 二级缩进 */
.stock-list li.sector-nav-group {
  padding: 14px 14px 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-sans);
  cursor: default;
  border-left: none;
  background: none;
}
.stock-list li.sector-nav-group:hover { background: none; border-left-color: transparent; }
.stock-list li.sector-nav-item {
  padding-left: 22px;
  font-size: 13px;
}

/* ============================================================
   内容区（米白 paper）
   ============================================================ */
.content {
  flex: 1;
  min-width: 0;
  padding: 40px 56px 80px;
  overflow-x: hidden;
  background: var(--bg-paper);
}
.content-head {
  margin: 0 auto 24px;
  max-width: 760px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 18px;
}
#stock-title {
  margin: 0 0 14px;
  font-family: var(--font-sans);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-strong);
  letter-spacing: 0;
  line-height: 1.3;
}

/* 报告类型 Tab：章节式下划线 */
.tabs {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
}
.tabs .tab {
  padding: 6px 14px 6px 0;
  margin-right: 18px;
  color: var(--text-muted);
  font-size: 14px;
  font-family: var(--font-serif);
  letter-spacing: 0.06em;
  border-bottom: 2px solid transparent;
  transition: color .12s, border-color .12s;
  position: relative;
}
.tabs .tab:hover { color: var(--text); }
.tabs .tab.active {
  color: var(--accent-dark);
  border-bottom-color: var(--accent);
  font-weight: 700;
}

/* Tab 红点（操作记录已更新提示） */
.tabs .tab .tab-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--danger);
  margin-left: 5px;
  vertical-align: middle;
}

.empty-hint {
  color: var(--text-muted);
  padding: 60px 0;
  text-align: center;
  font-style: italic;
  font-family: var(--font-serif);
  letter-spacing: 0.04em;
}

/* ============================================================
   报告（Markdown 长文本）—— 纸感研报排版
   ============================================================ */
.report {
  max-width: 760px;
  margin: 32px auto 0;
  font-size: 15px;
  line-height: 1.95;
  color: var(--text);
  counter-reset: h2section figureNum;
  font-family: var(--font-sans);
}

.report p {
  margin: 1em 0;
  text-align: justify;
  text-justify: inter-ideograph;
}

/* 标题：衬线宋体 + 章节序号衬线小型大写 */
.report h1 {
  font-family: var(--font-serif);
  font-size: 28px;
  margin: 0 0 0.8em;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--text-strong);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-strong);
  line-height: 1.35;
  text-align: center;
}
.report h1::after {
  content: "";
  display: block;
  width: 72px;
  height: 2px;
  background: var(--accent);
  margin: 12px auto -18px;
}

/* H2：暗红方块号 + 衬线章节名（CSS counter） */
.report h2 {
  font-family: var(--font-serif);
  font-size: 22px;
  color: var(--text-strong);
  margin: 2.6em 0 1.1em;
  padding: 0 0 8px;
  line-height: 1.4;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 12px;
  letter-spacing: 0.03em;
}
.report h2::before {
  counter-increment: h2section;
  content: "卷 " counter(h2section, cjk-ideographic);
  flex-shrink: 0;
  font-family: var(--font-decor);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.12em;
  background: transparent;
  padding: 2px 8px;
  border: 1px solid var(--accent-soft);
  align-self: center;
  white-space: nowrap;
}
/* TL;DR 章节（第一个 H2）：印章式 */
.report h2:first-of-type {
  margin-top: 1.4em;
  counter-increment: none;
  color: var(--accent-dark);
}
.report h2:first-of-type::before {
  counter-increment: none;
  content: "綱";
  font-family: var(--font-decor);
  font-size: 16px;
  background: var(--accent);
  color: var(--bg-paper);
  border-color: var(--accent);
  letter-spacing: 0;
  font-weight: 700;
  padding: 3px 10px;
}

.report h3 {
  font-family: var(--font-serif);
  font-size: 17px;
  color: var(--text-strong);
  margin: 2em 0 0.6em;
  padding-bottom: 4px;
  font-weight: 700;
  letter-spacing: 0.03em;
  border-bottom: 1px dashed var(--border);
}
.report h3::before {
  content: "▍";
  color: var(--accent);
  margin-right: 6px;
  font-weight: 400;
}
.report h4 {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--accent-dark);
  margin: 1.4em 0 0.4em;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.report h4::before {
  content: "◆ ";
  color: var(--accent-soft);
  font-size: 0.85em;
}

/* 强调（粗体）：研报里的关键数字，下划暗红实线（不再 chip 化） */
.report strong {
  color: var(--text-strong);
  font-weight: 700;
}
.report p strong,
.report li strong {
  background-image: linear-gradient(to top, rgba(139, 26, 26, 0.18) 0, rgba(139, 26, 26, 0.18) 2px, transparent 2px);
  background-position: 0 100%;
  background-repeat: no-repeat;
  padding: 0 1px;
  white-space: nowrap;
}
/* TL;DR / 表格内不要重复底纹 */
.report .tldr-card strong,
.report td strong,
.report th strong {
  background: none;
  padding: 0;
}
.report em {
  color: var(--accent-dark);
  font-style: normal;
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: 0.04em;
  border-bottom: 1px dotted var(--accent-soft);
  padding-bottom: 1px;
}

/* 列表 */
.report ul,
.report ol {
  padding-left: 1.7em;
  margin: 1em 0;
}
.report li {
  margin: 0.5em 0;
  padding-left: 4px;
}
.report ul > li::marker { color: var(--accent); content: "▪ "; }
.report ol > li::marker { color: var(--accent-dark); font-weight: 700; }
.report li > p:first-child { margin-top: 0; }
.report li > p:last-child { margin-bottom: 0; }

/* 链接：研报式脚注下划 */
.report a {
  color: var(--accent-dark);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
  transition: background .12s, border-color .12s;
}
.report a:hover {
  background: var(--bg-hover);
  border-bottom-color: var(--accent);
}

/* 引用块：分析师批注（米黄底 + 暗红边线） */
.report blockquote {
  margin: 1.4em 0;
  padding: 12px 20px;
  background: var(--quote-bg);
  border-left: 4px solid var(--accent);
  color: var(--text);
  font-size: 14px;
  line-height: 1.75;
  font-family: var(--font-serif);
  letter-spacing: 0.02em;
}
.report blockquote p:first-child { margin-top: 0; }
.report blockquote p:last-child { margin-bottom: 0; }
.report blockquote strong { color: var(--accent-dark); background: none; }

/* 风险提示块（含 ⚠️ 或 风险 开头）：红边警示 */
.report blockquote.risk-block {
  background: #FBEDED;
  border-left-color: var(--danger);
  color: #4C1414;
}
.report blockquote.risk-block strong { color: var(--danger); }

/* ============================================================
   TL;DR 决策看板卡片（md 里手写 <div class="tldr-card">）
   ============================================================ */
.report .tldr-card {
  margin: 1.6em 0 2.4em;
  padding: 24px 28px;
  background: var(--tldr-bg);
  border: 1px solid var(--accent-soft);
  border-top: 3px solid var(--accent);
  position: relative;
  box-shadow: 0 2px 12px rgba(43, 32, 14, 0.06);
}
.report .tldr-card::before {
  content: "決 策 綱 要";
  position: absolute;
  top: -11px;
  left: 24px;
  background: var(--accent);
  color: var(--bg-paper);
  font-family: var(--font-decor);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.32em;
  padding: 3px 14px 3px 18px;
}
.report .tldr-card .verdict {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 6px 0 16px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--accent-soft);
}
.report .tldr-card .verdict-label {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  font-family: var(--font-sans);
}
.report .tldr-card .verdict-value {
  font-family: var(--font-decor);
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-dark);
  letter-spacing: 0.04em;
  line-height: 1.2;
}
.report .tldr-card .verdict-value.verdict-warn { color: #C2410C; }
.report .tldr-card .verdict-value.verdict-good { color: var(--success); }
.report .tldr-card .verdict-value.verdict-bad  { color: var(--danger); }
.report .tldr-card .verdict-tag {
  font-size: 12px;
  padding: 4px 12px;
  background: var(--bg-paper);
  color: var(--accent-dark);
  border: 1px solid var(--accent-soft);
  font-weight: 600;
  letter-spacing: 0.06em;
  font-family: var(--font-serif);
}
.report .tldr-card .reason {
  margin: 0 0 16px;
  font-size: 15px;
  line-height: 1.85;
  color: var(--text);
  font-family: var(--font-serif);
  letter-spacing: 0.02em;
}
.report .tldr-card .reason strong {
  color: var(--accent-dark);
  background: none;
  padding: 0;
  white-space: nowrap;
}

/* 评分快照 chips */
.report .tldr-card .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin: 14px 0 16px;
}
.report .tldr-card .chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 12px;
  background: var(--bg-paper);
  border: 1px solid var(--border);
  font-size: 13px;
  white-space: nowrap;
  line-height: 1.4;
  font-family: var(--font-sans);
}
.report .tldr-card .chip .chip-key {
  color: var(--text-muted);
  font-size: 0.92em;
  letter-spacing: 0.04em;
}
.report .tldr-card .chip .chip-val {
  font-weight: 700;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}
.report .tldr-card .chip-score .chip-val { color: var(--accent-dark); }
.report .tldr-card .chip-score .chip-val::after {
  content: " /100";
  font-size: 0.78em;
  color: var(--text-faint);
  font-weight: 400;
  font-family: var(--font-sans);
}

.report .tldr-card h4 {
  margin: 16px 0 6px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: var(--font-sans);
  border-bottom: 1px solid var(--accent-soft);
  padding-bottom: 4px;
}
.report .tldr-card h4::before { content: ""; }
.report .tldr-card ul {
  margin: 6px 0 0;
  padding-left: 1.4em;
}
.report .tldr-card ul li { margin: 4px 0; line-height: 1.7; }

/* 涨跌色（A 股惯例：报告内数字） */
.report .num-up   { color: var(--num-up); font-weight: 700; font-variant-numeric: tabular-nums; }
.report .num-down { color: var(--num-down); font-weight: 700; font-variant-numeric: tabular-nums; }
.report .num-warn { color: #C2410C; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ============================================================
   图片 / 图表（图 N 衬线编号 + 点击放大）
   ============================================================ */
.report figure {
  margin: 2em auto;
  padding: 0;
  text-align: center;
  counter-increment: figureNum;
}
.report figure img {
  margin: 0 auto;
  cursor: zoom-in;
}
.report figcaption {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--font-serif);
  letter-spacing: 0.04em;
  font-style: normal;
}
.report figcaption::before {
  content: "图 " counter(figureNum) " · ";
  color: var(--accent);
  font-weight: 700;
}
.report img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.6em auto;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(43, 32, 14, 0.06);
}

/* Lightbox：原生 dialog */
.lightbox::backdrop { background: rgba(20, 16, 8, 0.78); }
.lightbox {
  border: none;
  background: transparent;
  max-width: 96vw;
  max-height: 96vh;
  padding: 0;
}
.lightbox img {
  max-width: 96vw;
  max-height: 96vh;
  margin: 0;
  border: 1px solid var(--bg-paper);
  background: #fff;
  cursor: zoom-out;
  box-shadow: 0 12px 60px rgba(0, 0, 0, 0.6);
}

/* ============================================================
   表格（研报附表风：宋体表头 / 等宽数字 / 暗色斑马）
   ============================================================ */
.report .table-wrap {
  margin: 1.4em 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
}
.report .table-wrap table {
  margin: 0;
  border: none;
}
.report table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 1.6em 0;
  font-size: 14px;
  border: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.report th {
  background: #E8DFC7;
  color: var(--text-strong);
  font-weight: 700;
  text-align: left;
  padding: 9px 14px;
  border-bottom: 2px solid var(--border-dark);
  white-space: nowrap;
  font-size: 13px;
  letter-spacing: 0.06em;
  font-family: var(--font-serif);
}
.report td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-faint);
  vertical-align: top;
  font-family: var(--font-sans);
}
.report tbody tr:last-child td { border-bottom: none; }
.report tbody tr:nth-child(even) td { background: rgba(214, 205, 184, 0.18); }
.report tbody tr:hover td { background: var(--bg-hover); }
.report td strong {
  white-space: nowrap;
  background: none;
  padding: 0;
  color: var(--accent-dark);
}

/* 评分快照表（score-table）：第二列右对齐等宽 */
.report table.score-table td:nth-child(2),
.report table.score-table th:nth-child(2) {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}
.report table.score-table tbody td:nth-child(2) {
  font-weight: 700;
  color: var(--accent-dark);
}

/* 启发式：3 列短表，2/3 列等宽数字 */
.report table:has(tr td:nth-child(3)):not(:has(tr td:nth-child(4))) td:nth-child(2),
.report table:has(tr td:nth-child(3)):not(:has(tr td:nth-child(4))) td:nth-child(3) {
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

/* 行内代码 */
.report code {
  background: var(--bg-active);
  color: var(--accent-dark);
  padding: 1px 6px;
  font-size: 13px;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

/* 代码块（研报里少见，做克制处理） */
.report pre {
  background: #2A2520;
  color: #F0E6D0;
  padding: 16px 18px;
  overflow-x: auto;
  margin: 1.4em 0;
  line-height: 1.55;
  font-size: 13px;
  border-left: 3px solid var(--accent);
}
.report pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

/* 分隔线：双线（研报章节分隔） */
.report hr {
  border: none;
  height: 6px;
  margin: 3em 0;
  background:
    linear-gradient(to bottom,
      transparent 0,
      transparent 1px,
      var(--border-dark) 1px,
      var(--border-dark) 2px,
      transparent 2px,
      transparent 4px,
      var(--border-dark) 4px,
      var(--border-dark) 5px,
      transparent 5px);
}

/* ============================================================
   持仓视图（kv-grid + 操作记录折叠）
   ============================================================ */
.holding-summary {
  max-width: 760px;
  margin: 24px auto 0;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent-blue);
  padding: 16px 22px 18px;
  position: relative;
}
.holding-summary h3 {
  margin: 0 0 12px;
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-dark);
  letter-spacing: 0.08em;
  border-bottom: 1px dashed var(--border-dark);
  padding-bottom: 8px;
}
.holding-summary .kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px 22px;
  font-size: 13px;
  font-family: var(--font-sans);
}
.holding-summary .kv-grid div { color: var(--text-muted); }
.holding-summary .kv-grid strong {
  color: var(--text-strong);
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-weight: 700;
}
/* 持仓 good/warn 走西方语义（绿好红坏） */
.holding-summary .warn { color: var(--danger); }
.holding-summary .good { color: var(--success); }

.holding-ops-details {
  max-width: 760px;
  margin: 24px auto 0;
  border: 1px solid var(--border);
  background: var(--bg-paper);
}
.holding-ops-details > summary {
  padding: 10px 18px;
  cursor: pointer;
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 13px;
  font-family: var(--font-serif);
  letter-spacing: 0.06em;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
}
.holding-ops-details[open] > summary { border-bottom: 1px solid var(--border); }
.holding-ops-details > div { padding: 6px 18px 14px; }
.holding-ops-details table { width: 100%; border-collapse: collapse; font-size: 13px; }
.holding-ops-details th, .holding-ops-details td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
}
.holding-ops-details th {
  background: var(--bg-sidebar);
  font-weight: 700;
  font-family: var(--font-serif);
}

.holding-actions {
  max-width: 760px;
  margin: 14px auto 0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ============================================================
   板块总览（chip 网格）
   ============================================================ */
.sector-overview {
  max-width: 1040px;
  margin: 0 auto;
}
.sector-overview .overview-intro {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 22px;
  line-height: 1.7;
  padding: 12px 16px;
  background: var(--quote-bg);
  border-left: 3px solid var(--accent-blue);
  font-family: var(--font-serif);
}
.sector-overview .overview-intro strong {
  color: var(--accent-dark);
  font-weight: 700;
}
.sector-group {
  border-bottom: 1px solid var(--border);
  padding: 8px 0 14px;
}
.sector-group:last-child { border-bottom: none; }
.sector-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  padding: 6px 0 8px;
}
.sector-group-head:hover { color: var(--accent-dark); }
.sector-group-head .arrow {
  display: inline-block;
  width: 14px;
  font-size: 11px;
  color: var(--text-muted);
  transition: transform .12s;
}
.sector-group.collapsed .arrow { transform: rotate(-90deg); }
.sector-group-head .name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-strong);
  font-family: var(--font-serif);
  letter-spacing: 0.04em;
}
.sector-group-head .ratio {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-sidebar);
  padding: 2px 9px;
  letter-spacing: 0.04em;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.sector-group-head .ratio.has-any {
  background: var(--accent);
  color: var(--bg-paper);
}
.sector-group-body {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 7px;
  padding: 4px 0 0 24px;
}
.sector-group.collapsed .sector-group-body { display: none; }

.sector-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  font-size: 12.5px;
  background: var(--bg-sidebar);
  color: var(--text-faint);
  border: 1px solid var(--border);
  cursor: default;
  transition: background .12s, color .12s, transform .08s;
  font-family: var(--font-sans);
}
.sector-chip.generated {
  background: var(--accent);
  color: var(--bg-paper);
  border-color: var(--accent);
  cursor: pointer;
  font-weight: 600;
}
.sector-chip.generated:hover { background: var(--accent-dark); transform: translateY(-1px); }
.sector-chip.stale {
  background: var(--bg-paper);
  color: var(--accent-dark);
  border-color: var(--accent-soft);
  cursor: pointer;
  font-weight: 600;
}
.sector-chip.stale:hover { background: var(--quote-bg); transform: translateY(-1px); }

/* ============================================================
   📡 启动扫描（ignition）
   ============================================================ */
.ignition-overview {
  padding: 4px 0 24px;
}
.ignition-header {
  border-bottom: 1px solid var(--border);
  padding: 6px 0 14px;
  margin-bottom: 18px;
}
.ignition-date-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  position: relative;
}
.ignition-date-chip {
  display: inline-block;
  padding: 5px 14px;
  font-weight: 600;
  background: var(--bg-sidebar);
  color: var(--accent-dark);
  border: 1px solid var(--accent-soft);
  border-radius: 16px;
  cursor: pointer;
  font-size: 13px;
  user-select: none;
}
.ignition-date-chip:hover { background: var(--bg-paper); }
.ignition-date-menu {
  position: absolute;
  top: 30px;
  left: 0;
  list-style: none;
  margin: 0;
  padding: 4px 0;
  background: var(--bg-paper);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  z-index: 50;
  min-width: 140px;
}
.ignition-date-menu li {
  padding: 6px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.ignition-date-menu li:hover { background: var(--bg-hover); }
.ignition-date-menu li.active { background: var(--bg-active); color: var(--accent-dark); font-weight: 600; }
.ignition-stat {
  font-size: 12px;
  color: var(--text-muted);
}

.ignition-tier {
  margin-bottom: 28px;
}
.ignition-tier-head {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--text-strong);
  padding-left: 4px;
}
.ignition-tier-recommended .ignition-tier-head { color: #B45309; }
.ignition-empty {
  font-size: 13px;
  color: var(--text-muted);
  padding: 12px 16px;
  background: var(--bg-sidebar);
  border-radius: 6px;
  margin: 0;
}

.ignition-card {
  display: block;
  padding: 12px 16px;
  margin-bottom: 8px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.08s, border-color 0.12s, background 0.12s;
}
.ignition-card:hover { transform: translateY(-1px); border-color: var(--accent-soft); }

.ignition-card-recommended {
  background: #FEF3C7;       /* 推荐池：浅黄底（设计书 §14.10）*/
  border-left: 3px solid #B45309;
}
.ignition-card-recommended .ignition-name { color: #B45309; font-weight: 600; }

.ignition-card-base_only {
  background: #F5F0EB;       /* 基础池：浅暖灰底（设计书 §14.10）*/
  border-left: 3px solid #A8A29E;
}
.ignition-card-base_only .ignition-name { color: var(--text); }

.ignition-card-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}
.ignition-code {
  font-family: var(--font-mono, monospace);
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}
.ignition-name {
  font-size: 15px;
}
.ignition-card .held-star {
  color: #D97706;             /* 设计书 §14.10 已持仓橙色 */
  font-size: 13px;
}
.ignition-sw_l2 {
  font-size: 11px;
  color: var(--text-faint);
  margin-left: auto;
  font-family: var(--font-mono, monospace);
}
.ignition-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.ig-m { white-space: nowrap; }

.ig-channel {
  display: inline-block;
  margin-left: 0.4em;
  padding: 0.05em 0.45em;
  border-radius: 3px;
  font-size: 0.8em;
  font-weight: 600;
  letter-spacing: 0.05em;
}
.ig-channel-A  { background: #fef3c7; color: #92400e; }   /* 深跌反转，琥珀 */
.ig-channel-B  { background: #dbeafe; color: #1e40af; }   /* 横盘突破，蓝 */
.ig-channel-AB { background: #fce7f3; color: #be185d; }   /* 双通道，玫红 */

/* ============================================================
   板块分组（一级 → 二级 两层 details / summary）
   ============================================================ */
.ig-group {
  margin: 0.4em 0;
  border: 1px solid var(--border-soft, #e7e2d6);
  border-radius: 4px;
  background: var(--bg-card, #fff);
}
.ig-group[open] { background: #fffefb; }
.ig-group-head {
  list-style: none;
  cursor: pointer;
  padding: 0.5em 0.8em;
  display: flex;
  align-items: center;
  gap: 0.6em;
  user-select: none;
}
.ig-group-head::-webkit-details-marker { display: none; }
.ig-group-head::before {
  content: '▶';
  font-size: 0.75em;
  color: var(--text-muted, #888);
  transition: transform 0.15s;
}
.ig-group[open] > .ig-group-head::before { transform: rotate(90deg); }
.ig-group-name { font-weight: 600; color: var(--text-strong, #2a1a08); }
.ig-group-code { font-size: 0.8em; color: var(--text-muted, #888); font-family: monospace; }
.ig-group-count {
  font-size: 0.8em; color: var(--text-muted, #888);
  margin-left: auto;
}
.ig-group-rank {
  font-size: 0.85em;
  font-weight: 600;
}

/* 一级板块（顶层）：更醒目，深色边框 */
.ig-group-l1 {
  border-color: #d4a574;
  margin: 0.8em 0;
}
.ig-group-l1[open] { background: #fffaf0; }
.ig-group-head-l1 {
  font-size: 1.05em;
  background: linear-gradient(to right, #fef3c7 0%, #fffaf0 30%, transparent 100%);
  border-bottom: 1px solid #e7d4b0;
}
.ig-group-head-l1 .ig-group-name { color: #78350f; }

/* 二级板块（嵌套层）：缩进 + 弱化样式 */
.ig-group-l2 {
  margin: 0.3em 0.6em 0.3em 1.2em;
  border-color: #ede4d0;
  border-radius: 3px;
}
.ig-group-l2[open] { background: #fdfaf3; }
.ig-group-head-l2 {
  padding: 0.35em 0.7em;
  font-size: 0.92em;
}
.ig-group-head-l2 .ig-group-name { color: #5a4a30; font-weight: 500; }

/* 二级里的卡片：缩进 + 顶部分隔线 */
.ig-group-l2 .ignition-card {
  margin: 0;
  border-radius: 0;
  border: none;
  border-top: 1px solid var(--border-soft, #e7e2d6);
}
.ig-group-l2 > .ignition-card:first-of-type {
  border-top: 1px solid #e7d4b0;
}

/* 排名 chip：8 档颜色 —— 推荐池 4 档 + 基础池 4 档 */
.ig-rank {
  display: inline-block;
  padding: 0.05em 0.5em;
  border-radius: 3px;
  font-size: 0.85em;
  font-weight: 700;
  font-family: var(--font-mono, ui-monospace, monospace);
  letter-spacing: 0.02em;
}
/* 推荐池档：金 / 暗红 / 橙 / 浅橙 */
.ig-rank-gold       { background: #fde68a; color: #78350f; }
.ig-rank-red        { background: #fee2e2; color: #991b1b; }
.ig-rank-orange     { background: #ffedd5; color: #9a3412; }
.ig-rank-paleorange { background: #fff7ed; color: #c2410c; }
/* 基础池档：蓝 / 浅蓝 / 灰 / 浅灰 */
.ig-rank-blue       { background: #dbeafe; color: #1e3a8a; }
.ig-rank-paleblue   { background: #eff6ff; color: #1e40af; }
.ig-rank-gray       { background: #e5e7eb; color: #374151; }
.ig-rank-palegray   { background: #f3f4f6; color: #6b7280; }

/* 卡片在分组内：去掉外边距让 details 撑开 */
.ig-group .ignition-card {
  margin: 0;
  border-radius: 0;
  border-top: 1px solid var(--border-soft, #e7e2d6);
  border-left: none;
  border-right: none;
  border-bottom: none;
}

.ignition-nav-item[data-tier="recommended"] { color: #B45309; font-weight: 500; }

.ig-collapsible { cursor: pointer; user-select: none; }
.ig-collapsible:hover { background: rgba(0,0,0,0.03); }
.ig-collapse-arrow { display: inline-block; font-size: 0.75em; width: 0.9em; }

/* nav item 里的 rank chip 紧凑些 */
.ignition-nav-item .ig-rank {
  font-size: 0.78em;
  padding: 0 0.35em;
  margin-right: 0.3em;
}

/* ============================================================
   左栏 nav 两层板块归类样式
   ============================================================ */
.stock-list li.nav-l1-head {
  cursor: pointer;
  user-select: none;
  padding: 0.4em 0.8em 0.35em 0.8em;
  display: flex;
  align-items: center;
  gap: 0.4em;
  font-size: 0.92em;
  font-weight: 600;
  color: #78350f;
  background: linear-gradient(to right, #fef3c7 0%, #fffaf0 70%);
  border-bottom: 1px solid #e7d4b0;
  border-left: 3px solid transparent;
}
.stock-list li.nav-l1-head:hover { background: #fde9b5; border-left-color: #d4a574; }
.stock-list li.nav-l1-head-base_only {
  color: #1e3a8a;
  background: linear-gradient(to right, #dbeafe 0%, #f0f8ff 70%);
  border-bottom-color: #b6cef5;
}
.stock-list li.nav-l1-head-base_only:hover { background: #bfdbfe; border-left-color: #5b8fe6; }
.nav-l1-name { flex: 1; }
.nav-l1-meta { font-size: 0.8em; color: var(--text-muted, #888); font-weight: 400; }

.stock-list li.nav-l2-head {
  cursor: pointer;
  user-select: none;
  padding: 0.25em 0.8em 0.25em 1.6em;
  display: flex;
  align-items: center;
  gap: 0.3em;
  font-size: 0.85em;
  color: #5a4a30;
  background: #fdfaf3;
  border-left: 3px solid transparent;
}
.stock-list li.nav-l2-head:hover { background: #f9f0dd; border-left-color: #d4a574; }
.stock-list li.nav-l2-head-base_only {
  color: #1e40af;
  background: #f4f8fd;
}
.stock-list li.nav-l2-head-base_only:hover { background: #e3eefb; border-left-color: #5b8fe6; }
.nav-l2-name { flex: 1; }
.nav-l2-meta { font-size: 0.85em; color: var(--text-muted, #888); }

/* 股票项在二级板块下：再缩进一点 */
.stock-list li.nav-stock-item { padding-left: 1.8em; }

/* ============================================================
   模态框 / 状态条
   ============================================================ */
.modal {
  position: fixed; inset: 0;
  background: rgba(20, 16, 8, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--bg-paper);
  padding: 30px 32px 26px;
  width: 420px;
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-card h3 {
  margin: 0 0 22px;
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--accent-dark);
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}
.modal-card label { display: block; margin-bottom: 14px; }
.modal-card label span {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}
.modal-card input, .modal-card select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  outline: none;
  background: #fff;
  font-family: var(--font-sans);
}
.modal-card input:focus, .modal-card select:focus { border-color: var(--accent); }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}
.status {
  margin-top: 14px;
  padding: 10px 12px;
  font-size: 13px;
  border: 1px solid var(--border);
}
.status.pending, .status.running {
  background: var(--quote-bg);
  color: var(--accent-dark);
  border-color: var(--accent-soft);
}
.status.succeeded {
  background: #ECFDF5;
  color: var(--success);
  border-color: #A7F3D0;
}
.status.failed {
  background: #FEF2F2;
  color: var(--danger);
  border-color: #FCA5A5;
}

/* ============================================================
   汉堡按钮 / 抽屉遮罩（移动端用）
   ============================================================ */
.btn-menu {
  display: none;
  color: var(--text-muted);
  font-size: 22px;
  padding: 4px 8px;
  margin-right: 8px;
  line-height: 1;
}
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 8, .45);
  z-index: 40;
}
.sidebar-backdrop[hidden] { display: none; }

/* ============================================================
   移动端适配（< 768px）
   ============================================================ */
@media (max-width: 768px) {
  .app-wrap { display: block; max-width: 100%; border: none; box-shadow: none; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 78vw;
    max-width: 300px;
    height: 100vh;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 2px 0 16px rgba(0,0,0,.12);
  }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 22px 18px 50px; }
  .content-head { display: flex; flex-wrap: wrap; align-items: center; padding-bottom: 12px; }
  .btn-menu { display: inline-block; }
  #stock-title { font-size: 19px; margin: 0 0 10px; flex: 1 1 100%; min-width: 0; }
  .tabs { width: 100%; overflow-x: auto; }
  .tabs .tab { padding: 6px 0; margin-right: 14px; white-space: nowrap; font-size: 13px; }
  .report {
    margin-top: 18px;
    font-size: 14.5px;
    line-height: 1.85;
  }
  .report h1 { font-size: 22px; }
  .report h1::after { width: 56px; margin-top: 10px; }
  .report h2 {
    font-size: 18px;
    margin: 2.2em 0 0.9em;
    gap: 9px;
  }
  .report h2::before {
    font-size: 11px;
    padding: 2px 6px;
  }
  .report h3 { font-size: 15.5px; margin: 1.6em 0 0.5em; }
  .report h4 { font-size: 14px; margin: 1.1em 0 0.3em; }
  .report p { margin: 0.85em 0; }
  .report table { font-size: 12.5px; }
  .report th, .report td { padding: 7px 10px; }
  .report th { font-size: 12px; }
  .report blockquote { padding: 10px 14px; font-size: 13px; }

  .report .tldr-card {
    margin: 1.2em 0 2em;
    padding: 18px 18px 18px;
  }
  .report .tldr-card::before {
    font-size: 10px;
    letter-spacing: 0.32em;
    padding: 3px 12px;
  }
  .report .tldr-card .verdict {
    gap: 6px 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
  }
  .report .tldr-card .verdict-value { font-size: 22px; }
  .report .tldr-card .verdict-tag { font-size: 11px; padding: 3px 9px; }
  .report .tldr-card .reason { font-size: 13.5px; line-height: 1.75; }
  .report .tldr-card .chips { gap: 6px 8px; margin: 10px 0 12px; }
  .report .tldr-card .chip { padding: 4px 10px; font-size: 12px; }
  .report .tldr-card h4 { margin: 12px 0 4px; font-size: 11px; letter-spacing: 0.18em; }
  .report .tldr-card ul { padding-left: 1.2em; }

  .report .table-wrap { margin: 1em -4px; }
  .report table { min-width: 480px; }

  /* 评分快照表：变成卡片栈 */
  .report table.score-table {
    min-width: 0;
    display: block;
    border: none;
    background: transparent;
  }
  .report table.score-table thead { display: none; }
  .report table.score-table tbody { display: block; }
  .report table.score-table tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 10px;
    align-items: baseline;
    padding: 10px 14px;
    margin-bottom: 8px;
    background: var(--bg-paper);
    border: 1px solid var(--border);
  }
  .report table.score-table tr:nth-child(even) td { background: transparent; }
  .report table.score-table tr:hover td { background: transparent; }
  .report table.score-table td {
    display: block;
    padding: 0;
    border: none;
    background: transparent !important;
    font-size: 13px;
  }
  .report table.score-table td:first-child {
    color: var(--text-muted);
    font-size: 12px;
    letter-spacing: 0.04em;
  }
  .report table.score-table td:nth-child(2) {
    font-weight: 700;
    color: var(--accent-dark);
    text-align: right;
  }
  .report table.score-table td:nth-child(3) {
    grid-column: 1 / -1;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.6;
    margin-top: 2px;
  }

  .modal-card { width: min(92vw, 420px); padding: 24px 22px 20px; }
}
