/* 内参旧文换肤覆盖 · 老模板专用作用域
 * 隔离机制：v2 与老文渲染后根结构都是 <div id="report-XXX" class="report-container">，
 *   且根级都无内联 --var 定义。v2 不含老模板独有类，故用 :has() 锁定老文：
 *   .report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source)
 *   → 仅命中老文，v2 零误伤（已线上验证：v2 文 0 个上述类）。
 * 优先级：老模板变量定义在 #id 级（无 !important），此处 class 级 + !important 稳赢。
 */
.report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) {
  --bg-main: #faf6ef !important;
  --bg-card: #ffffff !important;
  --bg-light: #f5efe2 !important;
  --bg-title: #ece3d2 !important;
  --border-color: #ece3d2 !important;
  --text-main: #2d2420 !important;
  --text-title: #2d2420 !important;
  --text-muted: #8a7a68 !important;
  --header-dark: #9c6b3f !important;
  --header-light: #f5efe2 !important;
  --risk-high: #a8433a !important;
  --risk-medium: #9c6b3f !important;
  --risk-low: #3f7a52 !important;
  --bg-cell: #ffffff !important;
  --info-box-bg: #f5efe2 !important;
  --sec-1: #9c6b3f !important;
  --sec-2: #b07d4a !important;
  --sec-3: #c08f57 !important;
  --sec-4: #cf9f66 !important;
  --sec-5: #ddb27a !important;
  --sec-6: #e6c491 !important;
  --statement-bg: rgba(156,107,63,.08) !important;
  --dropcap-color: #9c6b3f !important;
  --pullquote-border: #ece3d2 !important;
  --trend-up: #a8433a !important;
  --trend-down: #3f7a52 !important;
  --trend-flat: #9c6b3f !important;
}

/* 暗色：跟随站点 html.dark 单信号（不写 @media prefers-color-scheme） */
html.dark .report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) {
  --bg-light: #243447 !important;
  --bg-title: #334155 !important;
  --border-color: #334155 !important;
  --text-main: #d1d5dc !important;
  --text-title: #d1d5dc !important;
  --text-muted: #94a3b8 !important;
  --header-dark: #d9a566 !important;
  --dropcap-color: #d9a566 !important;
  --pullquote-border: #334155 !important;
  --statement-bg: rgba(217,165,102,.10) !important;
  --info-box-bg: #243447 !important;
}

/* ===== 字面色硬编码覆盖（老独有类，不用 var()） ===== */
.report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) .heading-sub { color: #8a7a68 !important; }
.report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) .source,
.report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) .source-small,
.report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) .source-tag { color: #8a7a68 !important; }
.report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) .disclaimer { color: #8a7a68 !important; }

.report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) .pill-up { color: #a8433a !important; background: rgba(168,67,58,.10) !important; }
.report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) .pill-down { color: #3f7a52 !important; background: rgba(63,122,82,.10) !important; }
.report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) .pill-warn { color: #9c6b3f !important; background: rgba(156,107,63,.10) !important; }
.report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) .pill-neutral { color: #9c6b3f !important; background: rgba(156,107,63,.10) !important; }

.report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) .risk-high { background: rgba(168,67,58,.10) !important; }
.report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) .risk-medium { background: rgba(156,107,63,.10) !important; }
.report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) .risk-low { background: rgba(63,122,82,.10) !important; }

.report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) .info-box { background: var(--info-box-bg) !important; }
.report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) th { color: #ffffff !important; }

/* 链接色：老模板高频蓝 #004080 统一为棕强调 */
.report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) a { color: #9c6b3f !important; }

/* ===== 暗色硬编码覆盖 ===== */
html.dark .report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) .heading-sub,
html.dark .report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) .source,
html.dark .report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) .source-small,
html.dark .report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) .source-tag,
html.dark .report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) .disclaimer { color: #94a3b8 !important; }

html.dark .report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) .pill-up { color: #FF8A75 !important; background: rgba(255,138,117,.12) !important; border-color: rgba(255,138,117,.28) !important; }
html.dark .report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) .pill-down { color: #7FD0A2 !important; background: rgba(127,208,162,.10) !important; border-color: rgba(127,208,162,.28) !important; }
html.dark .report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) .pill-warn { color: #E8B45A !important; background: rgba(232,180,90,.10) !important; border-color: rgba(232,180,90,.28) !important; }
html.dark .report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) .pill-neutral { color: #A8B8D0 !important; background: rgba(168,184,208,.10) !important; border-color: rgba(168,184,208,.26) !important; }

html.dark .report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) .risk-high { background: rgba(255,138,117,.12) !important; }
html.dark .report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) .risk-medium { background: rgba(232,180,90,.10) !important; }
html.dark .report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) .risk-low { background: rgba(127,208,162,.10) !important; }

html.dark .report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) th { color: #e8edf3 !important; background: #333B45 !important; }
html.dark .report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) td { color: #e7e5e4 !important; }
html.dark .report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) tbody tr:nth-child(even) td { background: rgba(255,255,255,.03) !important; }
html.dark .report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) .table-row-light td { background: rgba(255,255,255,.03) !important; }
html.dark .report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) .info-box { background: rgba(255,255,255,.03) !important; }
html.dark .report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) .card h3::after { color: rgba(255,255,255,.05) !important; }
html.dark .report-container:has(.card-s1, .pill-up, .risk-high, .info-box, .data-bar, .section-break, .pull-quote, .source) .disclaimer { border-top-color: #383E46 !important; }
