/* ==========================================================================
   中国石油集团全要素生产率（TFP）测算、归因与战略决策支持系统
   Theme Design System — 央企政企智库浅色白底视觉规范 (DRC / McKinsey / CNPC Style)
   File: public/css/theme.css
   ========================================================================== */

:root {
  /* 1. 背景表面层级 (Surface & Canvas Hierarchy) */
  --bg-canvas: #F5F7FA;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F8FAFC;
  --bg-muted: #F1F5F9;
  --bg-hover: #EEF2F6;

  /* 2. 中石油品牌色与智库学术语义色 (Brand & Semantic Palette) */
  --cnpc-red: #C8102E;
  --cnpc-red-dark: #9E0B22;
  --cnpc-red-soft: #FEF2F2;
  --cnpc-red-border: #FECACA;

  --cnpc-navy: #0F2C59;
  --cnpc-navy-mid: #1E3A8A;
  --cnpc-navy-light: #2B4C7E;
  --cnpc-navy-soft: #EFF4FB;
  --cnpc-navy-border: #CBD8EA;

  --accent-teal: #0D9488;
  --accent-teal-dark: #0F766E;
  --accent-teal-soft: #F0FDFA;
  --accent-teal-border: #99F6E4;

  --accent-amber: #B45309;
  --accent-amber-bright: #D97706;
  --accent-amber-soft: #FFFBEB;
  --accent-amber-border: #FDE68A;

  --danger-crimson: #B91C1C;
  --danger-soft: #FEF2F2;

  /* 3. 文字与分割线层级 (Typography & Hairline Borders) */
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --text-faint: #94A3B8;
  --text-inverse: #FFFFFF;

  --border-hairline: #E2E8F0;
  --border-subtle: #EDF2F7;
  --border-strong: #CBD5E1;
  --border-navy: #0F2C59;

  /* 4. 字体家族栈 (CJK Think-Tank & Tabular Numeric Typography) */
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif-title: "Songti SC", "STSong", "Source Han Serif SC", "Noto Serif CJK SC", "Times New Roman", serif;
  --font-num: "Times New Roman", "SF Pro Display", "DIN Alternate", "Helvetica Neue", Arial, "PingFang SC", sans-serif;
  --font-mono: "SFMono-Regular", "JetBrains Mono", Menlo, Monaco, Consolas, monospace;

  /* 5. 尺寸、圆角与克制阴影 (Spacing, Radius & Restrained Elevation) */
  --header-height: 60px;
  --toolbar-height: 48px;
  --sidebar-width: 244px;
  --radius-xs: 3px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.035);
  --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.045), 0 1px 2px rgba(15, 23, 42, 0.025);
  --shadow-float: 0 8px 24px rgba(15, 23, 42, 0.09), 0 2px 6px rgba(15, 23, 42, 0.04);
  --shadow-drawer: -8px 0 28px rgba(15, 23, 42, 0.12);

  --transition-fast: 140ms cubic-bezier(0.2, 0, 0, 1);
  --transition-base: 220ms cubic-bezier(0.2, 0, 0, 1);
}

/* ==========================================================================
   1. 基础重置与排版铁律 (Reset & Numeric Alignment Discipline)
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 14px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
}

p {
  margin: 0 0 0.65rem 0;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--cnpc-navy);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--cnpc-red);
}

[hidden],
.hidden,
.is-hidden {
  display: none !important;
}

/* 统计数字等宽纵向对齐铁律 */
.num,
.tabular-nums,
.kpi-value,
.kpi-delta,
.delta-up,
.delta-down,
.delta-neutral,
.fin-table td,
.fin-table th.num-col,
.slider-value,
.stat-num,
.metric-val,
input[type="number"] {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums lining-nums;
}

/* ==========================================================================
   2. 顶部政企门户级 Header 与全局控制栏 (.app-header, .global-toolbar)
   ========================================================================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: var(--header-height);
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-hairline);
  border-top: 3px solid var(--cnpc-red);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow-xs);
}

.header-brand,
.app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark,
.brand-emblem {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--cnpc-red);
  color: var(--text-inverse);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.16);
}

.brand-title-group,
.header-title-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-title,
.app-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--cnpc-navy);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-subtitle,
.app-subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions,
.header-right,
.header-status-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* 全局基准口径控制栏 */
.global-toolbar {
  position: sticky;
  top: var(--header-height);
  z-index: 35;
  min-height: var(--toolbar-height);
  background-color: var(--bg-subtle);
  border-bottom: 1px solid var(--border-hairline);
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 20px;
}

.toolbar-group,
.control-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-label,
.control-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.toolbar-divider {
  width: 1px;
  height: 20px;
  background-color: var(--border-hairline);
  margin: 0 4px;
}

/* 分段选择器 (.segmented-control) */
.segmented-control {
  display: inline-flex;
  align-items: center;
  background-color: #E8EEF5;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.segmented-control button,
.segmented-control .seg-btn,
.segmented-control .segment-item {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  padding: 5px 11px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.segmented-control button:hover,
.segmented-control .seg-btn:hover,
.segmented-control .segment-item:hover {
  color: var(--text-primary);
}

.segmented-control button.active,
.segmented-control button.is-active,
.segmented-control button[aria-pressed="true"],
.segmented-control button[aria-selected="true"],
.segmented-control .seg-btn.active,
.segmented-control .seg-btn.is-active,
.segmented-control .segment-item.active {
  background-color: var(--bg-surface);
  color: var(--cnpc-navy);
  font-weight: 600;
  border-color: rgba(15, 44, 89, 0.12);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

/* 状态胶囊徽章 (.pill-badge) */
.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
  border-radius: 999px;
  border: 1px solid var(--border-hairline);
  background-color: var(--bg-subtle);
  color: var(--text-secondary);
  white-space: nowrap;
}

.pill-badge::before {
  content: "";
  display: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.pill-badge.has-dot::before,
.pill-badge.pill-online::before,
.pill-badge.pill-local::before {
  display: inline-block;
}

.pill-badge.pill-red,
.pill-badge--red {
  background-color: var(--cnpc-red-soft);
  border-color: var(--cnpc-red-border);
  color: var(--cnpc-red);
}

.pill-badge.pill-navy,
.pill-badge--navy {
  background-color: var(--cnpc-navy-soft);
  border-color: var(--cnpc-navy-border);
  color: var(--cnpc-navy);
}

.pill-badge.pill-teal,
.pill-badge--teal,
.pill-badge.pill-online {
  background-color: var(--accent-teal-soft);
  border-color: var(--accent-teal-border);
  color: var(--accent-teal-dark);
}

.pill-badge.pill-online::before {
  background-color: var(--accent-teal);
}

.pill-badge.pill-amber,
.pill-badge--amber,
.pill-badge.pill-local {
  background-color: var(--accent-amber-soft);
  border-color: var(--accent-amber-border);
  color: var(--accent-amber);
}

.pill-badge.pill-local::before {
  background-color: var(--accent-amber-bright);
}

/* ==========================================================================
   3. 主应用框架：左侧固定导航 + 右侧自适应宽屏工作区 (.app-shell)
   ========================================================================== */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: calc(100vh - var(--header-height));
  width: 100%;
  align-items: stretch;
}

/* 兼容将 header / toolbar 置于 .app-shell 内部的 DOM 结构 */
.app-shell > .app-header,
.app-shell > .global-toolbar {
  grid-column: 1 / -1;
}

.sidebar-nav {
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-hairline);
  padding: 16px 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
}

.nav-group-label,
.sidebar-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 12px 12px 6px;
}

.nav-group-label:first-child,
.sidebar-section-label:first-child {
  padding-top: 4px;
}

.nav-item {
  appearance: none;
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  padding: 9px 12px 9px 14px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  position: relative;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.nav-item-main {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.nav-item:hover {
  background-color: var(--bg-subtle);
  color: var(--cnpc-navy);
}

.nav-item.active,
.nav-item.is-active,
.nav-item[aria-current="page"],
.nav-item[aria-selected="true"] {
  background-color: #FDF2F4;
  color: var(--cnpc-red);
  font-weight: 600;
  border-color: rgba(200, 16, 46, 0.14);
}

.nav-item.active::before,
.nav-item.is-active::before,
.nav-item[aria-current="page"]::before,
.nav-item[aria-selected="true"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background-color: var(--cnpc-red);
}

.nav-item-code,
.nav-step {
  font-family: var(--font-num);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  min-width: 18px;
}

.nav-item.active .nav-item-code,
.nav-item.is-active .nav-item-code {
  color: var(--cnpc-red);
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--border-hairline);
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.5;
  background-color: var(--bg-subtle);
  border-radius: var(--radius-sm);
}

/* 右侧主工作区 */
.main-workspace {
  min-width: 0;
  padding: 20px 26px 44px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 1680px;
  width: 100%;
  margin: 0 auto;
}

.workspace-section,
.tab-panel,
.view-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.section-heading-bar,
.page-section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-hairline);
}

.section-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--cnpc-navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 16px;
  background-color: var(--cnpc-red);
  border-radius: 1px;
}

.section-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ==========================================================================
   4. KPI 核心指标卡 (.kpi-grid, .kpi-card, .delta-up/down/neutral)
   ========================================================================== */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.kpi-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.kpi-grid-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.kpi-grid-6 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.kpi-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-top: 3px solid var(--cnpc-navy);
  border-radius: var(--radius-md);
  padding: 14px 16px 13px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  position: relative;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.kpi-card:first-child,
.kpi-card.kpi-card--red,
.kpi-card[data-accent="red"] {
  border-top-color: var(--cnpc-red);
}

.kpi-card.kpi-card--navy,
.kpi-card[data-accent="navy"] {
  border-top-color: var(--cnpc-navy);
}

.kpi-card.kpi-card--teal,
.kpi-card[data-accent="teal"] {
  border-top-color: var(--accent-teal);
}

.kpi-card.kpi-card--amber,
.kpi-card[data-accent="amber"] {
  border-top-color: var(--accent-amber);
}

.kpi-card:hover {
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.065);
}

.kpi-label-row,
.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.kpi-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.35;
}

.kpi-value-row,
.kpi-main {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text-primary);
  letter-spacing: -0.015em;
}

.kpi-card--red .kpi-value {
  color: var(--cnpc-red);
}

.kpi-unit {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.kpi-footer,
.kpi-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--text-muted);
  padding-top: 6px;
  border-top: 1px dashed var(--border-subtle);
}

/* 涨跌与状态徽章 */
.delta-up,
.delta-down,
.delta-neutral,
.delta-warn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1.5px 7px;
  border-radius: var(--radius-xs);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.delta-up {
  background-color: var(--accent-teal-soft);
  color: var(--accent-teal-dark);
  border: 1px solid rgba(13, 148, 136, 0.22);
}

.delta-down {
  background-color: var(--danger-soft);
  color: var(--danger-crimson);
  border: 1px solid rgba(185, 28, 28, 0.2);
}

.delta-neutral {
  background-color: var(--bg-muted);
  color: var(--text-secondary);
  border: 1px solid var(--border-hairline);
}

.delta-warn {
  background-color: var(--accent-amber-soft);
  color: var(--accent-amber);
  border: 1px solid var(--accent-amber-border);
}

/* ==========================================================================
   5. 智库诊断简报框 (.executive-brief-box)
   ========================================================================== */

.executive-brief-box {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-left: 4px solid var(--cnpc-red);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brief-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-hairline);
}

.brief-kicker {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--cnpc-red);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.brief-headline {
  font-size: 16.5px;
  font-weight: 700;
  color: var(--cnpc-navy);
  line-height: 1.4;
}

.brief-takeaways {
  list-style: none;
  margin: 0;
  padding: 10px 14px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 8px 18px;
}

.brief-takeaways li,
.brief-takeaway-item {
  position: relative;
  padding-left: 14px;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.55;
}

.brief-takeaways li::before,
.brief-takeaway-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 5px;
  height: 5px;
  background-color: var(--cnpc-red);
  border-radius: 1px;
}

.brief-columns,
.brief-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.brief-col-card,
.brief-item-card {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brief-col-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--cnpc-navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brief-col-text {
  font-size: 12.8px;
  color: var(--text-secondary);
  line-height: 1.62;
  text-align: justify;
}

.brief-policy-alert,
.policy-alert-bar {
  background-color: var(--accent-amber-soft);
  border: 1px solid var(--accent-amber-border);
  border-left: 3px solid var(--accent-amber);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12.8px;
  color: #78350F;
  line-height: 1.58;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.brief-policy-alert strong,
.policy-alert-bar strong {
  color: var(--accent-amber);
  font-weight: 700;
}

/* ==========================================================================
   6. 图表容器卡片与学术图注 (.chart-card, .chart-canvas, .chart-footnote)
   ========================================================================== */

.chart-grid,
.chart-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.chart-card.full-width,
.chart-card.span-2 {
  grid-column: 1 / -1;
}

.chart-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chart-header {
  padding: 14px 18px 11px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.chart-title-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.chart-figure-no {
  font-family: var(--font-num);
  font-size: 11px;
  font-weight: 700;
  color: var(--cnpc-red);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chart-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--cnpc-navy);
  line-height: 1.35;
}

.chart-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.chart-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* 预设合理最小高度防塌陷 */
.chart-canvas {
  width: 100%;
  min-height: 400px;
  padding: 8px 12px 4px;
  position: relative;
}

.chart-canvas--lg,
.chart-canvas.is-tall {
  min-height: 440px;
}

.chart-canvas--sm,
.chart-canvas.is-compact {
  min-height: 380px;
}

/* 还原智库学术报告图注栏质感 */
.chart-footnote {
  background-color: var(--bg-subtle);
  border-top: 1px solid var(--border-hairline);
  padding: 9px 18px;
  font-size: 11.8px;
  color: var(--text-muted);
  line-height: 1.55;
}

.chart-footnote strong {
  color: var(--text-secondary);
  font-weight: 600;
}

/* ==========================================================================
   7. 历史演进阶段卡片与方法论知识卡 (.stage-card, .method-card)
   ========================================================================== */

.stage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.stage-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-top: 3px solid var(--cnpc-navy);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stage-card:nth-child(3) {
  border-top-color: var(--cnpc-red);
}

.stage-card:nth-child(4) {
  border-top-color: var(--accent-teal);
}

.stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.stage-period {
  font-family: var(--font-num);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--cnpc-red);
  letter-spacing: 0.02em;
}

.stage-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--cnpc-navy);
}

.stage-mechanism {
  font-size: 12.8px;
  color: var(--text-secondary);
  line-height: 1.65;
  text-align: justify;
}

.stage-metrics-box {
  margin-top: auto;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--cnpc-navy);
  border-radius: var(--radius-xs);
  padding: 9px 12px;
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.58;
}

/* 方法论卡片 */
.methodology-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
}

.method-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.method-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.method-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--cnpc-navy);
  background-color: var(--cnpc-navy-soft);
  border: 1px solid var(--cnpc-navy-border);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
}

.method-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.method-formula {
  font-family: var(--font-num);
  font-size: 13px;
  color: var(--cnpc-navy);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-xs);
  padding: 8px 12px;
  overflow-x: auto;
  white-space: nowrap;
}

.method-summary {
  font-size: 12.8px;
  color: var(--text-secondary);
  line-height: 1.62;
}

.method-points {
  margin: 0;
  padding-left: 16px;
  font-size: 12.3px;
  color: var(--text-secondary);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.method-source {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed var(--border-hairline);
  font-size: 11.5px;
  color: var(--text-muted);
}

/* 悬浮指标释义触发器 ([data-tooltip]) */
.tooltip-trigger,
.info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  font-family: var(--font-num);
  font-size: 10px;
  font-weight: 700;
  cursor: help;
  position: relative;
  vertical-align: middle;
  background-color: var(--bg-subtle);
}

[data-tooltip] {
  position: relative;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  width: max-content;
  max-width: 320px;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  background-color: #0F172A;
  color: #F8FAFC;
  font-family: var(--font-sans);
  font-size: 11.8px;
  font-weight: 400;
  line-height: 1.5;
  white-space: normal;
  text-align: left;
  box-shadow: var(--shadow-float);
  z-index: 90;
  pointer-events: none;
}

/* ==========================================================================
   8. 专业金融三线表与热力高亮数据表 (.data-table-wrap, .fin-table)
   ========================================================================== */

.data-table-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.data-table-wrap {
  width: 100%;
  max-height: 580px;
  overflow: auto;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
}

.data-table-card .data-table-wrap {
  border: none;
  border-radius: 0;
}

.fin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
  border-top: 2px solid var(--cnpc-navy);
  border-bottom: 2px solid var(--cnpc-navy);
}

.fin-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background-color: var(--bg-subtle);
  color: var(--cnpc-navy);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 12px;
  padding: 10px 12px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1.5px solid var(--border-strong);
}

.fin-table thead th:first-child,
.fin-table thead th.text-left {
  text-align: left;
}

.fin-table tbody td {
  padding: 8.5px 12px;
  text-align: right;
  white-space: nowrap;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
  transition: background-color 100ms ease;
}

.fin-table tbody td:first-child,
.fin-table tbody td.text-left {
  text-align: left;
  font-weight: 600;
  color: var(--cnpc-navy);
}

.fin-table tbody tr:nth-child(even) td {
  background-color: #FAFBFD;
}

.fin-table tbody tr:hover td {
  background-color: #F1F5FB;
}

.fin-table tfoot td,
.fin-table tr.summary-row td {
  background-color: var(--bg-subtle) !important;
  font-weight: 700;
  color: var(--cnpc-navy);
  border-top: 1.5px solid var(--border-strong);
  border-bottom: none;
}

/* 冻结首列与交叉表头 */
.fin-table .sticky-col,
.fin-table th:first-child.sticky-col,
.fin-table td:first-child.sticky-col {
  position: sticky;
  left: 0;
  z-index: 2;
  border-right: 1px solid var(--border-hairline);
}

.fin-table thead th.sticky-col {
  z-index: 4;
  background-color: var(--bg-subtle);
}

/* 2011年薪酬等插补值琥珀底色标记 (.cell-imputed) */
.fin-table td.cell-imputed,
.cell-imputed {
  background-color: var(--accent-amber-soft) !important;
  color: #92400E !important;
  font-weight: 600;
  position: relative;
  box-shadow: inset 3px 0 0 var(--accent-amber-bright);
}

.cell-imputed::after {
  content: "插补";
  display: inline-block;
  margin-left: 5px;
  padding: 0 4px;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  color: var(--accent-amber);
  background-color: rgba(217, 119, 6, 0.14);
  border-radius: 2px;
}

/* 正负贡献微底色条与语义高亮 */
.fin-table td.cell-pos,
.val-pos {
  color: var(--accent-teal-dark);
}

.fin-table td.cell-neg,
.val-neg {
  color: var(--danger-crimson);
}

.fin-table td.contrib-bar-pos {
  background-image: linear-gradient(
    to left,
    rgba(13, 148, 136, 0.14) var(--bar-pct, 35%),
    transparent var(--bar-pct, 35%)
  );
  color: var(--accent-teal-dark);
  font-weight: 600;
}

.fin-table td.contrib-bar-neg {
  background-image: linear-gradient(
    to left,
    rgba(200, 16, 46, 0.13) var(--bar-pct, 35%),
    transparent var(--bar-pct, 35%)
  );
  color: var(--cnpc-red-dark);
  font-weight: 600;
}

.fin-table td.cell-editable {
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(15, 44, 89, 0.08);
}

.fin-table td.cell-editable:hover {
  background-color: var(--cnpc-navy-soft) !important;
}

/* ==========================================================================
   9. 文件拖拽上传区、沙盘滑块控件、按钮与表单控件
   ========================================================================== */

.dropzone-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.dropzone-card {
  background-color: var(--bg-surface);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.dropzone-card:hover,
.dropzone-card.is-dragover,
.dropzone-card.drag-over {
  border-color: var(--cnpc-red);
  background-color: #FEF7F8;
}

.dropzone-card.is-loaded,
.dropzone-card.is-parsed {
  border-style: solid;
  border-color: var(--accent-teal);
  background-color: var(--accent-teal-soft);
}

.dropzone-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--cnpc-navy);
}

.dropzone-hint {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 420px;
}

/* 前瞻推演与敏感性滑块行 (.sandbox-slider-row) */
.sandbox-panel {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sandbox-slider-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.2fr) minmax(140px, 2fr) 86px;
  align-items: center;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border-subtle);
}

.sandbox-slider-row:last-child {
  border-bottom: none;
}

.slider-label {
  font-size: 12.8px;
  font-weight: 600;
  color: var(--text-primary);
}

.slider-sub {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}

.sandbox-slider-row input[type="range"],
input[type="range"].range-input {
  width: 100%;
  height: 5px;
  appearance: none;
  background: #DCE4EE;
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}

.sandbox-slider-row input[type="range"]::-webkit-slider-thumb,
input[type="range"].range-input::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--cnpc-red);
  border: 2px solid var(--bg-surface);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.28);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.sandbox-slider-row input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.12);
}

.slider-value {
  text-align: right;
  font-size: 13px;
  font-weight: 700;
  color: var(--cnpc-navy);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-xs);
  padding: 4px 8px;
}

/* 通用按钮与表单控件 */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background-color: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.btn:hover:not(:disabled) {
  background-color: var(--bg-subtle);
  border-color: var(--cnpc-navy-light);
  color: var(--cnpc-navy);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary,
.btn-red {
  background-color: var(--cnpc-red);
  border-color: var(--cnpc-red);
  color: var(--text-inverse);
}

.btn-primary:hover:not(:disabled),
.btn-red:hover:not(:disabled) {
  background-color: var(--cnpc-red-dark);
  border-color: var(--cnpc-red-dark);
  color: var(--text-inverse);
}

.btn-navy {
  background-color: var(--cnpc-navy);
  border-color: var(--cnpc-navy);
  color: var(--text-inverse);
}

.btn-navy:hover:not(:disabled) {
  background-color: var(--cnpc-navy-mid);
  border-color: var(--cnpc-navy-mid);
  color: var(--text-inverse);
}

.btn-sm {
  font-size: 11.5px;
  padding: 4px 9px;
}

.btn-ghost {
  border-color: transparent;
  background-color: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background-color: var(--bg-hover);
  border-color: transparent;
}

.form-input,
.form-select,
select.select-sm,
input.input-sm {
  font-family: var(--font-sans);
  font-size: 12.5px;
  color: var(--text-primary);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-select:focus {
  border-color: var(--cnpc-navy);
  box-shadow: 0 0 0 2px rgba(15, 44, 89, 0.12);
}

/* ==========================================================================
   10. 模态窗与侧滑抽屉 (.modal-backdrop, .drawer-panel)
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background-color: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-backdrop[aria-hidden="true"]:not(.active):not(.is-open):not(.open) {
  display: none;
}

.modal-dialog,
.modal-card,
.modal-content {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-top: 3px solid var(--cnpc-navy);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-float);
  width: 100%;
  max-width: 680px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header,
.drawer-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-body,
.drawer-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer,
.drawer-footer {
  padding: 12px 20px;
  background-color: var(--bg-subtle);
  border-top: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* 侧滑抽屉 (.drawer-panel) */
.drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(480px, 92vw);
  z-index: 105;
  background-color: var(--bg-surface);
  border-left: 1px solid var(--border-hairline);
  border-top: 3px solid var(--cnpc-red);
  box-shadow: var(--shadow-drawer);
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform var(--transition-base);
}

body > .drawer-panel:not(.is-open):not(.open):not(.active),
.drawer-panel.is-closed,
.drawer-panel[aria-hidden="true"]:not(.is-open):not(.open):not(.active) {
  transform: translateX(104%);
  pointer-events: none;
}

/* Toast 轻提示 */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast-item {
  background-color: var(--cnpc-navy);
  color: var(--text-inverse);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  box-shadow: var(--shadow-float);
  border-left: 3px solid var(--cnpc-red);
}

/* ==========================================================================
   11. 响应式断点与政企汇报打印优化 (@media max-width & @media print)
   ========================================================================== */

@media (max-width: 1240px) {
  .kpi-grid-6 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .kpi-grid-5,
  .kpi-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .chart-grid,
  .chart-grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar-nav {
    position: static;
    height: auto;
    flex-direction: row;
    overflow-x: auto;
    padding: 8px 14px;
    border-right: none;
    border-bottom: 1px solid var(--border-hairline);
    gap: 6px;
  }
  .nav-group-label,
  .sidebar-section-label,
  .sidebar-footer {
    display: none;
  }
  .nav-item {
    width: auto;
    white-space: nowrap;
    padding: 7px 12px;
  }
  .nav-item.active::before,
  .nav-item.is-active::before {
    left: 8px;
    right: 8px;
    top: auto;
    bottom: 0;
    width: auto;
    height: 2px;
  }
  .global-toolbar {
    position: static;
  }
  .main-workspace {
    padding: 16px 14px 32px;
  }
  .sandbox-slider-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

@media print {
  @page {
    size: A4 landscape;
    margin: 12mm 14mm;
  }

  html,
  body {
    background-color: #FFFFFF !important;
    color: #000000 !important;
    font-size: 11pt;
  }

  .sidebar-nav,
  .global-toolbar,
  .chart-actions,
  .header-actions,
  .dropzone-card,
  .modal-backdrop,
  .drawer-panel,
  .toast-stack,
  .btn,
  .no-print {
    display: none !important;
  }

  .app-header {
    position: static !important;
    box-shadow: none !important;
    border-bottom: 1.5pt solid #0F2C59 !important;
    padding: 0 0 8pt 0 !important;
  }

  .app-shell {
    display: block !important;
  }

  .main-workspace {
    padding: 10pt 0 0 0 !important;
    max-width: none !important;
  }

  .kpi-card,
  .chart-card,
  .executive-brief-box,
  .stage-card,
  .method-card,
  .data-table-card {
    box-shadow: none !important;
    break-inside: avoid;
    page-break-inside: avoid;
    border-color: #CBD5E1 !important;
  }

  .data-table-wrap {
    max-height: none !important;
    overflow: visible !important;
  }

  .fin-table thead th,
  .fin-table .sticky-col {
    position: static !important;
  }
}
