/* ============================================
   Stellaris — 自主投研操作系统
   金融暗色主题（复用 chain-news-site 风格并进化）
   ============================================ */

/* === CSS Variables === */
:root {
  /* Stellaris 品牌色 */
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #60a5fa;
  --primary-glow: rgba(37, 99, 235, 0.3);
  --accent: #10b981;
  --accent-green: #22c55e;
  --accent-red: #ef4444;

  /* 背景 */
  --bg-body: #0a0e1a;
  --bg-surface: #111827;
  --bg-card: #1a2332;
  --bg-card-hover: #1e293b;
  --bg-active: #1e3a5f;
  --bg-gradient: linear-gradient(135deg, #0a0e1a 0%, #111827 100%);

  /* 文字 */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-brand: #60a5fa;

  /* 边框 */
  --border: #1e293b;
  --border-light: #334155;

  /* 产业链节点颜色 */
  --color-upstream: #ef4444;
  --color-midstream: #f59e0b;
  --color-downstream: #22c55e;
  --color-equipment: #8b5cf6;
  --color-service: #06b6d4;
  --color-external: #ec4899;

  /* A股涨跌色 */
  --color-rise: #ef4444;
  --color-fall: #22c55e;

  /* 尺寸 */
  --navbar-height: 64px;
  --hero-height: 420px;
  --card-radius: 12px;
  --btn-radius: 8px;

  /* 动画 */
  --transition: all 0.2s ease;
}

/* === Reset === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

html, body {
  height: 100%;
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(ellipse at 50% 0%, rgba(37, 99, 235, 0.04) 0%, transparent 50%);
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* === Typography === */
h1, h2, h3, h4 { font-weight: 600; line-height: 1.3; }
h1 { font-size: 2.5rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }

a { color: var(--text-brand); text-decoration: none; }
a:hover { color: var(--primary-light); }

/* === Navbar === */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-height);
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 24px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: white;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  display: none;
}

@media (min-width: 768px) {
  .brand-subtitle { display: inline; margin-left: 8px; padding-left: 8px; border-left: 1px solid var(--border); }
}

.navbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-link {
  color: var(--text-secondary);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 6px;
  transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
  background: var(--bg-card);
}

/* === Hero Section === */
.hero {
  padding: calc(var(--navbar-height) + 48px) 24px 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 300px;
  background: radial-gradient(ellipse, rgba(37, 99, 235, 0.08) 0%, transparent 60%);
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.2);
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-brand);
  margin-bottom: 20px;
}

.hero-badge-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-brand) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
  letter-spacing: -0.5px;
}

.hero p {
  color: var(--text-secondary);
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  max-width: 640px;
  margin: 0 auto 28px;
  line-height: 1.7;
}

/* === Stats Bar === */
.stats-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 24px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-divider {
  width: 1px;
  height: 48px;
  background: var(--border);
}

/* === Main Content === */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* === Section Headers === */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title h2 {
  color: var(--text-primary);
}

.section-title .count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: 10px;
}

/* === Brief Cards === */
.brief-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.brief-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: 20px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.brief-card:hover {
  border-color: var(--primary);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.brief-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--primary);
  opacity: 0;
  transition: var(--transition);
}

.brief-card:hover::before { opacity: 1; }

.brief-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 10px;
}

.brief-type-badge.morning { background: rgba(37, 99, 235, 0.12); color: var(--text-brand); }
.brief-type-badge.editor { background: rgba(16, 185, 129, 0.12); color: var(--accent); }
.brief-type-badge.chain { background: rgba(139, 92, 246, 0.12); color: #a78bfa; }
.brief-type-badge.mailbox { background: rgba(6, 182, 212, 0.12); color: var(--color-service); }

.brief-card h3 {
  font-size: 15px;
  margin-bottom: 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.brief-card .summary {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
}

.brief-card .meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.brief-card .meta .confidence {
  margin-left: auto;
}

.confidence-high { color: var(--accent-green); }
.confidence-mid { color: var(--color-midstream); }
.confidence-low { color: var(--accent-red); }

/* === Chain Grid (Industry Grid) === */
.chain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 40px;
}

.chain-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.chain-item:hover {
  border-color: var(--primary);
  background: var(--bg-card-hover);
}

.chain-item .chain-code {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.chain-item .chain-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.node-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

.node-upstream { background: var(--color-upstream); }
.node-midstream { background: var(--color-midstream); }
.node-downstream { background: var(--color-downstream); }
.node-equipment { background: var(--color-equipment); }
.node-service { background: var(--color-service); }

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 13px;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: var(--btn-radius);
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
}

.btn-primary:hover {
  box-shadow: 0 4px 16px var(--primary-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

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

.btn-ghost:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* === Loading Skeleton === */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card {
  height: 140px;
  border-radius: var(--card-radius);
  margin-bottom: 16px;
}

/* === Footer === */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

.footer a { color: var(--text-secondary); }

/* === Responsive === */
@media (max-width: 640px) {
  .hero { padding: calc(var(--navbar-height) + 32px) 16px 32px; }
  .hero h1 { font-size: 1.6rem; }
  .stats-bar { gap: 16px; padding: 16px; }
  .stat-value { font-size: 22px; }
  .brief-grid { grid-template-columns: 1fr; }
  .chain-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .main-content { padding: 20px 16px; }
  .navbar { padding: 0 16px; }
}

/* === Brief View (Detail Page Overlay / Page) === */
.brief-detail {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: 32px;
  margin-bottom: 24px;
}

.brief-detail h1 {
  font-size: 1.5rem;
  margin-bottom: 16px;
}

.brief-detail .brief-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
}

.brief-detail .brief-content {
  line-height: 1.8;
  font-size: 14px;
}

.brief-detail .brief-content h2 {
  font-size: 1.2rem;
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.brief-detail .brief-content p {
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.brief-detail .brief-content strong {
  color: var(--text-primary);
}

.brief-detail .brief-content ul {
  margin: 8px 0 16px 20px;
  color: var(--text-secondary);
}

.brief-detail .brief-content li {
  margin-bottom: 6px;
}
