* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
       background: #f5f7fa; color: #1a2332; }
#app { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* 导航 */
#nav-bar { display: flex; justify-content: space-between; align-items: center;
           padding: 16px 0; border-bottom: 1px solid #e1e8f0; margin-bottom: 24px; }
.nav-title { font-size: 20px; font-weight: 700; color: #185fa5; letter-spacing: 2px; font-family: 'Noto Serif SC','Songti SC',SimSun,serif; }
.nav-links { display: flex; gap: 16px; }
.nav-links a { color: #4a5568; text-decoration: none; font-size: 14px; padding: 6px 12px;
               border-radius: 6px; cursor: pointer; }
.nav-links a:hover { background: #eef2f7; }
.nav-links a.active { background: #1a56db; color: #fff; }
/* 分析进行中：锁死导航（视觉禁用 + 不可点击），防止切页中断报告 */
.nav-links.locked a { pointer-events: none; opacity: 0.45; cursor: not-allowed; }

/* print-only：页面浏览隐藏，仅 PDF 显示（用于给每个 tab 加总标题） */
.print-only { display: none; }

/* 管理页：筛选胶囊 + 工具条 + 表格 + 分页（B+C 方案） */
.filter-chip { padding: 5px 14px; border-radius: 999px; font-size: 13px; cursor: pointer;
               border: 1px solid #d1d9e6; color: #4a5568; background: #fff; user-select: none; }
.filter-chip:hover { border-color: #185fa5; color: #185fa5; }
.filter-chip.active { background: #185fa5; color: #fff; border-color: #185fa5; }
.admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 12px 0 16px; }
.admin-select { padding: 6px 12px; border-radius: 8px; border: 1px solid #d1d9e6; font-size: 13px; color: #1a2332; background: #fff; }
.admin-select:focus { outline: none; border-color: #185fa5; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th { padding: 8px 12px; text-align: left; font-weight: 500; color: #64748b; border-bottom: 1px solid #e8ecf1; }
.admin-table td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; color: #1a2332; }
.admin-badge { font-size: 11px; color: #185fa5; background: #e6f1fb; padding: 1px 8px; border-radius: 999px; }
.admin-muted { color: #94a3b8; }
.admin-pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 14px; font-size: 13px; color: #64748b; }
/* 设置页字段提示（灰字注释） */
.field-hint { font-size: 12px; color: #94a3b8; margin: 2px 0 10px; }

/* 品牌（观澜阁）：登录/注册页顶部 logo 区 */
.brand-mark { text-align: center; margin: 24px 0 20px; }
.brand-name { font-size: 30px; font-weight: 700; color: #185fa5; letter-spacing: 6px; font-family: 'Noto Serif SC','Songti SC',SimSun,serif; }
.brand-tagline { font-size: 13px; color: #94a3b8; margin-top: 8px; letter-spacing: 2px; }

/* 卡片 */
.card { background: #fff; border-radius: 10px; padding: 24px; margin-bottom: 20px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.06); border: 1px solid #e8ecf1; }
.card h2 { font-size: 18px; margin-bottom: 16px; color: #1a2332; }
.card h3 { font-size: 15px; margin: 16px 0 8px; color: #2d3748; }

/* 表单 */
input, select, textarea { width: 100%; padding: 10px 14px; border: 1px solid #d1d9e6;
    border-radius: 8px; font-size: 14px; margin-bottom: 12px; background: #fff; }
input:focus, select:focus { outline: none; border-color: #1a56db; box-shadow: 0 0 0 3px rgba(26,86,219,0.1); }
label { display: block; font-size: 13px; font-weight: 600; color: #4a5568; margin-bottom: 4px; }

/* 按钮 */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 22px;
       border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer;
       transition: all 0.15s; }
.btn-primary { background: #1a56db; color: #fff; }
.btn-primary:hover { background: #1648c0; }
.btn-secondary { background: #eef2f7; color: #2d3748; }
.btn-secondary:hover { background: #e2e8f0; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* 提示 */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }

/* 双栏 */
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .row { grid-template-columns: 1fr; } }

/* 进度条 */
.progress-bar { width: 100%; height: 6px; background: #e2e8f0; border-radius: 3px;
                margin: 12px 0; overflow: hidden; }
.progress-fill { height: 100%; background: #1a56db; border-radius: 3px; transition: width 0.3s; }
.progress-text { font-size: 13px; color: #64748b; text-align: center; margin-bottom: 4px; }

/* Tab */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; flex-wrap: wrap; }
.tab { padding: 8px 16px; border-radius: 8px 8px 0 0; font-size: 13px; cursor: pointer;
       background: #f1f4f9; color: #4a5568; border: 1px solid #e1e8f0; border-bottom: none; }
.tab.active { background: #fff; color: #1a56db; font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* 报告侧边栏导航（商务简洁：左栏 + 图标 + 蓝色选中条） */
.report-layout { display: flex; gap: 16px; align-items: flex-start; }
.report-sidebar {
  width: 176px; min-width: 176px;
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px;
  padding: 10px 8px; position: sticky; top: 12px;
}
.side-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin: 2px 0; border-radius: 8px;
  font-size: 13px; color: #4a5568; cursor: pointer;
  border-left: 3px solid transparent; user-select: none;
}
.side-item svg { flex-shrink: 0; opacity: 0.75; }
.side-item:hover { background: #eef2f7; }
.side-item.active {
  background: #e6f1fb; color: #185fa5; font-weight: 500;
  border-left-color: #185fa5;
}
.side-item.active svg { opacity: 1; }
.report-content { flex: 1; min-width: 0; }
@media (max-width: 720px) {
  .report-layout { flex-direction: column; }
  .report-sidebar { width: 100%; min-width: 0; display: flex; overflow-x: auto; gap: 4px; position: static; }
  .side-item { white-space: nowrap; }
}

/* 对比框 */
.compare-box { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.compare-side { padding: 16px; border-radius: 8px; background: #f8fafc; border: 1px solid #e2e8f0; }
.compare-side h4 { font-size: 14px; margin-bottom: 8px; }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #e8ecf1; }
th { background: #f8fafc; font-weight: 600; color: #64748b; }

/* 结论卡片 */
.summary-card { background: linear-gradient(135deg, #1a56db, #1e40af); color: #fff;
                border-radius: 12px; padding: 28px; margin-bottom: 20px; }
.summary-card h1 { font-size: 24px; margin-bottom: 4px; }
.summary-verdict { font-size: 32px; font-weight: 700; margin: 8px 0; }
.summary-conf { font-size: 14px; opacity: 0.85; margin-bottom: 12px; }
.bullet-list { list-style: none; padding: 0; }
.bullet-list li { padding: 4px 0 4px 20px; position: relative; font-size: 14px; line-height: 1.5; }
.bullet-list li::before { content: '▶'; position: absolute; left: 0; color: #93c5fd; }

/* 数据来源 */
.data-source { font-size: 11px; color: #94a3b8; text-align: center; margin-top: 32px; padding: 16px 0; border-top: 1px solid #e2e8f0; }
.disclaimer { font-size: 11px; color: #94a3b8; text-align: center; margin-top: 4px; margin-bottom: 32px; }

/* 指标速览 */
.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin: 16px 0; }
.metric-card { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 14px; }
.metric-label { font-size: 12px; color: #64748b; }
.metric-value { font-size: 18px; font-weight: 700; color: #1a2332; margin: 4px 0; }
.metric-compare { font-size: 12px; color: #64748b; }

/* markdown 渲染容器 */
.md { font-size: 14px; line-height: 1.7; color: #1a2332; word-wrap: break-word; }
.md h1, .md h2, .md h3, .md h4 { margin: 18px 0 8px; font-weight: 700; color: #1a2332; }
.md h1 { font-size: 20px; } .md h2 { font-size: 17px; } .md h3 { font-size: 15px; } .md h4 { font-size: 14px; }
.md p { margin: 8px 0; }
.md ul, .md ol { margin: 8px 0 8px 22px; padding: 0; }
.md li { margin: 4px 0; }
.md strong { font-weight: 700; color: #111827; }
.md table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 12px 0; }
.md th, .md td { padding: 8px 10px; text-align: left; border: 1px solid #e2e8f0; }
.md th { background: #f8fafc; font-weight: 600; }
.md blockquote { border-left: 3px solid #1a56db; background: #f8fafc; padding: 8px 12px; margin: 10px 0; color: #475569; }
.md code { background: #f1f5f9; padding: 2px 5px; border-radius: 4px; font-size: 13px; }
.md pre { background: #0f172a; color: #e2e8f0; padding: 14px; border-radius: 8px; overflow-x: auto; margin: 12px 0; }
.md pre code { background: none; padding: 0; color: inherit; }
.md hr { border: none; border-top: 1px solid #e2e8f0; margin: 16px 0; }

/* 打印（导出 PDF） */
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: #fff; color: #000; }
  #nav-bar, .no-print, .tabs, .btn, .progress-bar, .progress-text { display: none !important; }
  #page-content { max-width: 100%; }
  /* PDF：隐藏侧边栏（避免重复显示 tab 名字），由 .print-only 显示 tab 标题 */
  .report-sidebar { display: none; }
  .report-content { width: 100%; }
  .print-only { display: block; font-size: 20px; font-weight: 700; color: #1a56db;
                 border-bottom: 2px solid #1a56db; padding-bottom: 8px; margin-bottom: 16px;
                 break-after: avoid; page-break-after: avoid; } /* 标题后必须跟内容，避免孤标题 */
  /* tab-content 里跟在 h2.print-only 后面的第一个 card：标题和内容同页 */
  .tab-content > .card:first-of-type { break-before: avoid; page-break-before: avoid; }
  /* 关键指标：打印时强制 4 列一行（页面浏览保持 auto-fill 自适应） */
  .metrics { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .metric-card { padding: 10px; }
  .metric-value { font-size: 16px; }
  .metric-compare { font-size: 11px; }
  .card { box-shadow: none; border: 1px solid #d1d9e6; break-inside: avoid; page-break-inside: avoid; margin-bottom: 16px; }
  .summary-card { background: #fff !important; color: #000 !important; border: 2px solid #1a56db; break-inside: avoid; }
  .summary-card h1, .summary-card .bullet-list li, .summary-card .summary-verdict,
  .summary-card .summary-conf, .summary-card .summary-logic, .summary-card .summary-risks { color: #000 !important; }
  .summary-verdict { color: #1a56db !important; }
  .tab-content { display: block !important; page-break-before: auto; }
  .tab-content > .card { page-break-inside: avoid; }
  /* 风控/研究决策的次级分段卡片：允许跨页连续排版（不必每个单开一页） */
  #r-risk > .card, #r-debate > .card { break-inside: auto; page-break-inside: auto; }
  /* 次级分段小标题：醒目（蓝色加下划线）+ 标题后必须跟内容 */
  #r-risk > .card > h3, #r-debate > .card > h3 {
    break-after: avoid; page-break-after: avoid;
    font-size: 16px; color: #1a56db; border-bottom: 1px solid #dbe4f0; padding-bottom: 4px;
  }
  #r-summary, #r-fundamentals, #r-market, #r-news, #r-debate, #r-risk { display: block !important; }
  #r-debate, #r-risk { page-break-before: always; }
  .compare-side { break-inside: avoid; page-break-inside: avoid; }
  .md { color: #000; }
  .md strong { color: #000; }
  .md th { background: #f1f5f9 !important; }
  .data-source, .disclaimer { color: #555; font-size: 10px; }
  a { text-decoration: none; color: inherit; }
  .print-footer { display: block; position: fixed; bottom: 0; left: 0; right: 0;
                  text-align: center; font-size: 10px; color: #666;
                  border-top: 1px solid #ccc; padding-top: 4px; }
  @page { margin: 14mm 12mm 16mm 12mm; }
}
.print-footer { display: none; }

/* 免责声明横幅：默认隐藏，仅打印/PDF 时在第一页顶部显示（低饱和、打印友好） */
.disclaimer-banner {
  display: none;
  background: #fdf6e3;             /* 浅米黄 */
  border-left: 4px solid #b0a060;  /* 暗驼色竖条 */
  color: #4a4a4a;                  /* 深灰文字 */
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 16px;
}
@media print {
  .disclaimer-banner {
    display: block !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}