/**
 * SENTINEL 公共样式表
 * 包含所有页面共享的 CSS 变量、重置样式、字体和顶栏组件。
 * 各页面独有的布局/组件样式仍保留在各自的内联 <style> 中。
 */

/* ── CSS 变量 ────────────────────────────────────────────────────── */
:root {
  --bg: #f0ede6;
  --bg2: #e8e4db;
  --surface: #f7f4ef;
  --surface2: #ede9e1;
  --surface3: #e2ddd4;
  --border: #d4cfc5;
  --border-dark: #b8b2a6;
  --accent: #c8522a;
  --accent-hover: #a83e1c;
  --accent-light: rgba(200,82,42,0.08);
  --accent-mid: rgba(200,82,42,0.15);
  --text: #1a1714;
  --text-mid: #4a453e;
  --text-dim: #8a847a;
  --text-xdim: #b0aa9f;
  --critical: #c0392b;
  --critical-bg: #fdf0ee;
  --critical-border: #e8b4ae;
  --high: #d45f1a;
  --high-bg: #fdf3ee;
  --high-border: #e8c4a4;
  --medium: #c08820;
  --medium-bg: #fdf8ee;
  --medium-border: #e8d890;
  --low: #2d8a5e;
  --low-bg: #eef7f2;
  --low-border: #a4d8be;
  --fin: #2563a8;
  --fin-bg: #eef3fb;
  --fin-border: #b8cde8;
  --green: #2d8a5e;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

/* ── 重置与基础 ──────────────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scrollbar-gutter: stable; }

/* 统一细滚动条，确保所有页面槽位宽度一致（避免导航跳位） */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-xdim); }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  min-height: 100vh;
}

/* ── 顶栏（所有子页面共用） ──────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(240,237,230,0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.back-btn {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all .12s;
  letter-spacing: .5px;
}
.back-btn:hover { border-color: var(--accent); color: var(--accent); }

.topbar-brand {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .6px;
  color: var(--text);
  cursor: pointer;
  line-height: 1;
}

.brand-ai {
  display: inline-block;
  font-family: inherit;
  font-size: .86em;
  line-height: 1;
  letter-spacing: 0;
  margin: 0 .02em;
  transform: translateY(.055em);
}

.topbar-sub {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 2px;
  display: none;
}

.topbar-nav {
  display: flex;
  gap: 0;
  align-items: center;
}
.topbar-nav a {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 400;
  color: var(--text-mid);
  text-decoration: none;
  padding: 8px 14px;
  transition: color 0.15s;
  cursor: pointer;
  position: relative;
}
.topbar-nav a::after {
  content: '';
  position: absolute;
  bottom: 6px; left: 14px; right: 14px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 0.2s;
}
.topbar-nav a:hover { color: var(--text); }
.topbar-nav a.active { color: var(--text); font-weight: 500; }
.topbar-nav a:hover::after,
.topbar-nav a.active::after { transform: scaleX(1); }

/* 无操作区时可用空 div 占位，与速报/周报等三栏顶栏共用同一 flex 节奏，避免导航被挤到最右侧 */
.topbar-right {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  flex: 1;
}

/* 顶栏操作按钮（事件库等页使用） */
.topbar-btn {
  padding: 6px 14px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .5px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  transition: all .12s;
}
.topbar-btn:hover { border-color: var(--accent); color: var(--accent); }
.topbar-btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── 报告页公共 Hero 区（日报/周报/月报/行业报告共享的基础结构） ── */
.report-hero-inner { max-width: 1200px; margin: 0 auto; }

.report-series {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2px;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.report-hero h1 {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 12px;
}

.report-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}
.report-hero-meta .sep { color: var(--border-dark); }

.date-nav { display: flex; gap: 0; margin-left: auto; }
.date-nav a {
  padding: 6px 14px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  text-decoration: none;
  transition: all .12s;
}
.date-nav a:first-child { border-right: none; }
.date-nav a:hover { color: var(--accent); border-color: var(--accent); z-index: 1; position: relative; }

/* ── 概览数据条（日报/周报共享的统计格） ────────────────────────── */
.overview-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  margin-bottom: 28px;
}
.ov-item {
  background: var(--surface);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ov-val {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -1px;
}
.ov-val.crit   { color: var(--critical); }
.ov-val.high   { color: var(--high); }
.ov-val.med    { color: var(--medium); }
.ov-val.low    { color: var(--low); }
.ov-val.accent { color: var(--accent); }
.ov-lbl {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--text-dim);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.ov-delta { font-family: var(--mono); font-size: 9px; color: var(--text-xdim); }
.ov-delta.up   { color: var(--critical); }
.ov-delta.down { color: var(--low); }

/* ── 章节标题（日报/周报/行业报告共享结构） ─────────────────────── */
.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.section-head .ico { font-size: 16px; }
.section-head-title {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.section-head .line { flex: 1; height: 1px; background: var(--border); }
.section-head .badge {
  font-family: var(--mono);
  font-size: 9px;
  padding: 3px 8px;
  background: var(--accent-light);
  border: 1px solid rgba(200,82,42,0.2);
  color: var(--accent);
  letter-spacing: 1px;
}

/* ── 执行摘要框（多报告页共用基础结构） ─────────────────────────── */
.exec-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 24px 28px;
  position: relative;
  padding-left: 32px;
}
.exec-summary::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--accent);
}
.exec-summary h3 {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 12px;
}
.exec-summary p {
  font-size: 13.5px;
  line-height: 2;
  color: var(--text-mid);
  margin-bottom: 8px;
}
.exec-summary p:last-child { margin-bottom: 0; }
.exec-summary strong { color: var(--text); }

/* ── 页面主体容器 ────────────────────────────────────────────────── */
.page-wrap { max-width: 1200px; margin: 0 auto; padding: 28px 40px; }

/* ── 通用报告区块（dr-section 系列，日报/周报/月报共用） ────────── */
.dr-section { margin-bottom: 32px; }
.dr-section-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.dr-section-head .ico { font-size: 16px; }
.dr-section-title { font-family: var(--serif); font-size: 16px; font-weight: 600; color: var(--text); }
.dr-section-head .line { flex: 1; height: 1px; background: var(--border); }
.dr-section-head .badge {
  font-family: var(--mono); font-size: 9px; padding: 3px 8px;
  background: var(--accent-light); border: 1px solid rgba(200,82,42,.2);
  color: var(--accent); letter-spacing: 1px;
}

/* ── 风险等级标签（通用） ───────────────────────────────────────── */
.risk-badge { font-family: var(--mono); font-size: 9px; padding: 2px 7px; font-weight: 500; }
.risk-badge.critical { background: var(--critical-bg); color: var(--critical); border: 1px solid var(--critical-border); }
.risk-badge.high     { background: var(--high-bg);     color: var(--high);     border: 1px solid var(--high-border); }
.risk-badge.medium   { background: var(--medium-bg);   color: var(--medium);   border: 1px solid var(--medium-border); }
.risk-badge.low      { background: var(--low-bg);      color: var(--low);      border: 1px solid var(--low-border); }

/* ── 通用数据表格 ─────────────────────────────────────────────── */
.notable-table { width: 100%; border-collapse: collapse; }
.notable-table th {
  font-family: var(--mono); font-size: 9px; letter-spacing: 1px;
  color: var(--text-dim); text-transform: uppercase; text-align: left;
  padding: 8px 12px; background: var(--surface2); border: 1px solid var(--border);
}
.notable-table td {
  padding: 10px 12px; font-size: 12px; color: var(--text-mid);
  border: 1px solid var(--border); background: var(--surface);
}
.notable-table tr { cursor: pointer; transition: background .12s; }
.notable-table tbody tr:hover td { background: var(--surface2); }

/* ── 趋势图网格 ──────────────────────────────────────────────── */
.trend-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ══════════════════════════════════════════════════════════════
   移动端适配（所有页面共享）
   ══════════════════════════════════════════════════════════════ */

/* 防止任何元素撑出 viewport 导致横向滚动 */
html { overflow-x: hidden; }
body { overflow-x: hidden; max-width: 100vw; }

@media (max-width: 960px) {
  /* 顶栏：隐藏导航链接（960px 以下导航会折行） */
  .topbar-nav { display: none; }
  .topbar-sub { display: none; }
}

@media (max-width: 768px) {
  /* 顶栏 */
  .topbar { padding: 0 14px; height: 52px; }
  .topbar-brand { font-size: 16px; letter-spacing: .5px; }
  .topbar-left { flex: none; }
  .topbar-right { flex: none; gap: 4px; }
  .back-btn { padding: 5px 8px; font-size: 10px; }
  .topbar-btn { padding: 5px 10px; font-size: 10px; }

  /* 页面主体容器 */
  .page-wrap { padding: 14px 14px 24px; }

  /* 概览数据条 → 3列 */
  .overview-bar { grid-template-columns: repeat(3, 1fr); }
  .ov-val { font-size: 22px; }

  /* 趋势图 → 单列 */
  .trend-grid { grid-template-columns: 1fr; }

  /* 报告 Hero */
  .report-hero h1 { font-size: 20px; line-height: 1.35; }
  .report-hero-meta { flex-direction: column; align-items: flex-start; gap: 6px; }
  .date-nav { margin-left: 0; margin-top: 4px; }

  /* 执行摘要 */
  .exec-summary { padding: 14px 14px 14px 18px; }
  .exec-summary h3 { font-size: 13px; }
  .exec-summary p { font-size: 13px; line-height: 1.8; }

  /* 数据表格 - 允许横向滚动 */
  .notable-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .notable-table { min-width: 480px; }
}

@media (max-width: 480px) {
  /* 顶栏 */
  .topbar-brand { font-size: 13px; }

  /* 概览条 → 2列 */
  .overview-bar { grid-template-columns: repeat(2, 1fr); }
  .ov-val { font-size: 20px; }
  .ov-lbl { font-size: 7px; }
}
