/* =====================================================
   CM Group - 统一字体系统 (Typography)
   Version: 2.0 - Investment Bank Grade
   ===================================================== */

/* ===== CSS 变量定义 ===== */
:root {
  /* 字体族 */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Monaco, Consolas, monospace;
  
  /* 字体大小 - 金融数据优化Scale (8级) */
  --text-2xs: 10px;     /* 时间戳、微标签 */
  --text-xs: 11px;      /* 表头、元数据 */
  --text-sm: 12px;      /* 次要标签、说明 */
  --text-base: 13px;    /* 主正文、表格数据 */
  --text-md: 14px;      /* 强调文本、导航 */
  --text-lg: 16px;      /* 卡片标题、小节标题 */
  --text-xl: 20px;      /* 页面副标题 */
  --text-2xl: 24px;     /* 页面标题 */
  --text-3xl: 32px;     /* Hero数字、KPI */
  
  /* 字重 */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  
  /* 行高 */
  --leading-none: 1;
  --leading-tight: 1.2;
  --leading-snug: 1.35;
  --leading-normal: 1.5;
  --leading-relaxed: 1.6;
  
  /* 字间距 */
  --tracking-tighter: -0.02em;
  --tracking-tight: -0.01em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;
  --tracking-wider: 0.05em;
  
  /* 语义颜色 */
  --text-primary: #202124;
  --text-secondary: #3c4043;
  --text-muted: #5f6368;
  --text-disabled: #80868b;
  --text-negative: #d32f2f;
  --text-positive: #2e7d32;
}

/* ===== 全局字体渲染优化 ===== */
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ===== 基础样式 ===== */
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'liga' 1, 'calt' 1, 'kern' 1;
}

/* 确保所有元素继承字体平滑 */
*, *::before, *::after {
  -webkit-font-smoothing: inherit;
  -moz-osx-font-smoothing: inherit;
}

/* ===== 通用表格数字 - 金融数据必需 ===== */
table td,
.number,
.price,
.cost,
.percentage,
.stat-value,
.stat-val,
.kpi-value,
.price-value,
[data-numeric] {
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: 'tnum' 1, 'lnum' 1;
}

/* ===== 统一Header导航字体 ===== */
.header-nav a,
.header-nav > li > a,
.nav-link {
  font-family: var(--font-sans);
  font-size: var(--text-md);
  font-weight: var(--font-medium);
  letter-spacing: var(--tracking-normal);
}

.header-nav > li > a.active,
.nav-link.active {
  font-weight: var(--font-semibold);
}

/* Sign In 按钮 */
.header-signin,
.user-dropdown-btn {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-medium);
}

/* SOON 徽章 - 统一 */
.soon-badge,
.nav-soon,
.badge {
  font-size: var(--text-2xs);
  font-weight: var(--font-bold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

/* ===== 标题层级 ===== */
.page-title,
.heading-page {
  font-size: var(--text-2xl);
  font-weight: var(--font-normal);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tighter);
  color: var(--text-primary);
}

.page-subtitle {
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  color: var(--text-muted);
}

.chart-title,
.detail-title,
.heading-card {
  font-size: var(--text-lg);
  font-weight: var(--font-medium);
  line-height: var(--leading-snug);
  color: var(--text-primary);
}

.section-title,
.heading-section {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}

/* ===== 侧边栏标签 ===== */
.sb-label,
.label {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-muted);
}

.caption,
.text-caption {
  font-size: var(--text-xs);
  font-weight: var(--font-normal);
  color: var(--text-disabled);
}

/* ===== 按钮字体 ===== */
.btn,
.view-btn,
.ctrl,
.tb-btn,
.tab-btn,
.filter-btn {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-medium);
}

.btn.active,
.view-btn.active,
.ctrl.active,
.tb-btn.active,
.tab-btn.active {
  font-weight: var(--font-semibold);
}

/* ===== 表格字体 ===== */
.ptable thead th,
.detail-table th,
.data-table th {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-muted);
}

.ptable tbody td,
.detail-table td,
.data-table td {
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  font-variant-numeric: tabular-nums;
}

/* ===== 数字/数据显示 ===== */
.stat-val,
.stat-value,
.kpi-value,
.price-value,
.kpi-primary {
  font-size: var(--text-3xl);
  font-weight: var(--font-medium);
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: var(--tracking-tighter);
  line-height: var(--leading-none);
}

.kpi-secondary,
.stat-value-sm {
  font-size: var(--text-xl);
  font-weight: var(--font-medium);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-tight);
}

/* 数字格式化 */
.number-negative {
  color: var(--text-negative);
}

.number-positive {
  color: var(--text-positive);
}

.decimal-align {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ===== Mega Menu 字体 ===== */
.mega-col h4 {
  font-size: var(--text-md);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

.mega-item-text h5 {
  font-size: var(--text-md);
  font-weight: var(--font-medium);
}

.mega-item-text p {
  font-size: var(--text-sm);
  font-weight: var(--font-normal);
}

/* ===== 通知系统字体 ===== */
.notif-header-title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-tight);
}

.notif-title {
  font-size: var(--text-base);
  font-weight: var(--font-medium);
}

.notif-type,
.notif-time {
  font-size: var(--text-xs);
}

/* ===== Monospace (代码/ID) ===== */
.mono,
.code,
.mine-id,
.vessel-id {
  font-family: var(--font-mono);
  font-size: 0.9em;
  letter-spacing: -0.02em;
}

/* ===== 辅助类 ===== */
.text-2xs { font-size: var(--text-2xs) !important; }
.text-xs { font-size: var(--text-xs) !important; }
.text-sm { font-size: var(--text-sm) !important; }
.text-base { font-size: var(--text-base) !important; }
.text-md { font-size: var(--text-md) !important; }
.text-lg { font-size: var(--text-lg) !important; }
.text-xl { font-size: var(--text-xl) !important; }
.text-2xl { font-size: var(--text-2xl) !important; }
.text-3xl { font-size: var(--text-3xl) !important; }

.font-normal { font-weight: var(--font-normal) !important; }
.font-medium { font-weight: var(--font-medium) !important; }
.font-semibold { font-weight: var(--font-semibold) !important; }
.font-bold { font-weight: var(--font-bold) !important; }

.uppercase { text-transform: uppercase !important; }
.tabular-nums { font-variant-numeric: tabular-nums !important; }
.tracking-tight { letter-spacing: var(--tracking-tight) !important; }
.tracking-wide { letter-spacing: var(--tracking-wide) !important; }

.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }
