:root {
  --bg: #0f1420;
  --bg-soft: #161d2e;
  --card: #1a2338;
  --card-hover: #202b45;
  --border: #26314e;
  --text: #e6ebf5;
  --text-dim: #8b96b3;
  --accent: #3b82f6;
  --accent-2: #22c1a3;
  --warn: #f59e0b;
  --danger: #f87171;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 420px at 50% -120px, rgba(59, 130, 246, 0.14), transparent 65%),
    radial-gradient(800px 300px at 90% -80px, rgba(34, 193, 163, 0.08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  line-height: 1.6;
}

.container { max-width: 1240px; margin: 0 auto; padding: 0 20px; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(15, 20, 32, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-dot {
  width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.7);
}
.brand h1 { font-size: 18px; margin: 0; font-weight: 650; letter-spacing: 0.5px; }
.brand-sub { margin: 0; font-size: 10.5px; color: var(--text-dim); letter-spacing: 1.5px; }
.meta { display: flex; align-items: center; gap: 12px; color: var(--text-dim); font-size: 13px; flex-wrap: wrap; justify-content: flex-end; }

.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--accent-2);
  border: 1px solid rgba(34, 193, 163, 0.35);
  padding: 3px 12px; border-radius: 20px;
  background: rgba(34, 193, 163, 0.08);
}
.pulse {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34, 193, 163, 0.5); }
  50% { opacity: 0.55; box-shadow: 0 0 0 6px rgba(34, 193, 163, 0); }
}

#refresh-btn {
  background: var(--accent); color: #fff; border: none; padding: 7px 16px;
  border-radius: 8px; cursor: pointer; font-size: 13px;
  transition: filter .15s, transform .1s;
}
#refresh-btn:hover { filter: brightness(1.15); }
#refresh-btn:active { transform: scale(0.96); }

/* 数据总览条 */
.stats-bar {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  margin: 26px 0 8px;
}
.stat-card {
  background: linear-gradient(165deg, #1b2540, #141c2e);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px;
  transition: transform .15s, border-color .15s;
}
.stat-card:hover { transform: translateY(-2px); border-color: #31406b; }
.stat-num {
  font-size: 27px; font-weight: 750; line-height: 1.2;
  background: linear-gradient(90deg, #60a5fa, #22c1a3);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat-label { color: var(--text-dim); font-size: 12.5px; margin-top: 2px; }

/* 快捷导航 */
.quick-nav { display: flex; gap: 8px; margin: 18px 0 4px; }
.qn-item {
  padding: 6px 16px; border-radius: 20px; font-size: 13px;
  background: var(--card); border: 1px solid var(--border); color: var(--text-dim);
  text-decoration: none; transition: all .15s;
}
.qn-item:hover { color: var(--text); border-color: var(--accent); }

/* 双栏布局 */
.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 20px;
  align-items: start;
  margin-top: 14px;
}
.col-main { min-width: 0; }
.col-side { min-width: 0; }

/* 板块 */
.section { margin: 32px 0; scroll-margin-top: 84px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.section-head h2 { font-size: 22px; margin: 0; }
.section-head h2::before { content: "▍"; color: var(--accent); margin-right: 4px; }
.section-sub { color: var(--text-dim); font-size: 13px; margin: 0; }

/* KPI 卡片 */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi-card {
  position: relative;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; overflow: hidden;
  transition: transform .15s, background .15s, border-color .15s;
}
.kpi-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: 0; transition: opacity .2s;
}
.kpi-card:hover { transform: translateY(-3px); background: var(--card-hover); border-color: #31406b; }
.kpi-card:hover::before { opacity: 1; }
.kpi-name { color: var(--text-dim); font-size: 13px; margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value { font-size: 27px; font-weight: 750; display: flex; align-items: baseline; flex-wrap: wrap; }
.kpi-value .unit { font-size: 14px; color: var(--text-dim); font-weight: 400; margin-left: 3px; }
.kpi-delta { font-size: 12px; margin-left: 8px; font-weight: 600; }
.kpi-delta.up { color: var(--accent-2); }
.kpi-delta.down { color: var(--danger); }
.kpi-period { color: var(--text-dim); font-size: 12px; margin-top: 6px; }
.kpi-source { color: var(--text-dim); font-size: 12px; margin-top: 2px; display: flex; align-items: center; }

/* 通用小圆点 */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; flex-shrink: 0; }

/* 面板 */
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 10px; }
.panel-head h3 { margin: 0; font-size: 15.5px; }
.panel-hint { color: var(--text-dim); font-size: 12px; }
.chart { width: 100%; height: 350px; }
.chart-sm { height: 270px; }
.chart-map { height: 540px; }
.map-tabs { display: flex; gap: 8px; }
.map-note { color: var(--text-dim); font-size: 12px; margin: 10px 0 0; }
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* 数据列表 */
.metrics-list { display: flex; flex-direction: column; gap: 8px; }
.metric-item {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px;
  border-radius: 10px; background: var(--bg-soft); border: 1px solid transparent;
  transition: border-color .15s;
}
.metric-item:hover { border-color: var(--border); }
.metric-tag {
  flex-shrink: 0; padding: 3px 10px; border-radius: 6px; font-size: 12px;
  background: rgba(61, 123, 255, 0.15); color: #8fb1ff;
  max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.metric-body { flex: 1; min-width: 0; }
.metric-title { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-title a { color: var(--text); text-decoration: none; }
.metric-title a:hover { color: var(--accent); }
.metric-period { color: var(--text-dim); font-size: 12px; }
.metric-source { flex-shrink: 0; color: var(--text-dim); font-size: 12px; display: flex; align-items: center; }
.metric-date { flex-shrink: 0; color: var(--text-dim); font-size: 12px; }

/* 新闻（悬浮侧栏） */
.news-panel {
  position: sticky; top: 84px;
  display: flex; flex-direction: column;
  max-height: calc(100vh - 104px);
  padding: 16px 16px 10px;
}
.panel-sub { margin: -2px 0 10px; color: var(--text-dim); font-size: 12px; }
.news-panel .search-input { width: 100%; max-width: none; margin-bottom: 10px; flex: none; }
.news-panel .filter-bar { margin-bottom: 4px; }
.search-input {
  flex: 1; min-width: 220px; max-width: 340px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 14px; color: var(--text); font-size: 13px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search-input::placeholder { color: #5d6a8c; }
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18); }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; flex: 1; }
.filter-chip {
  display: inline-flex; align-items: center;
  padding: 6px 13px; border-radius: 20px; cursor: pointer; font-size: 13px;
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--text-dim);
  transition: all .15s;
}
.filter-chip:hover { border-color: var(--accent); color: var(--text); }
.filter-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.news-count { color: var(--text-dim); font-size: 12px; }

.news-list {
  display: flex; flex-direction: column; gap: 10px;
  overflow-y: auto; min-height: 0; padding-right: 4px;
  scrollbar-width: thin; scrollbar-color: #31406b transparent;
}
.news-list::-webkit-scrollbar { width: 6px; }
.news-list::-webkit-scrollbar-thumb { background: #31406b; border-radius: 3px; }
.news-item {
  padding: 15px 18px; border-radius: var(--radius); background: var(--bg-soft);
  border: 1px solid var(--border); transition: background .15s, transform .15s, border-color .15s;
}
.news-item:hover { background: var(--card-hover); transform: translateY(-1px); border-color: #31406b; }
.news-title { font-size: 14px; font-weight: 600; margin-bottom: 7px; }
.news-title a { color: var(--text); text-decoration: none; }
.news-title a:hover { color: var(--accent); }
.news-meta { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--text-dim); }
.news-source { color: var(--text-dim); display: flex; align-items: center; }
.day-badge {
  padding: 1px 9px; border-radius: 10px; font-size: 11px;
  background: var(--card); border: 1px solid var(--border); color: var(--text-dim);
}
.day-badge.today { color: #0f1420; background: var(--accent-2); border-color: var(--accent-2); font-weight: 700; }

/* 页脚 */
.footer { margin-top: 44px; padding: 26px 0; border-top: 1px solid var(--border); color: var(--text-dim); font-size: 12px; text-align: center; }
.footer a { color: var(--accent-2); }
.footer-tech { margin-top: 8px; letter-spacing: 1px; font-size: 11px; opacity: 0.75; }

/* 空态与加载 */
.empty { color: var(--text-dim); text-align: center; padding: 30px; }
.loading { color: var(--text-dim); text-align: center; padding: 30px; }

@media (max-width: 1080px) {
  .layout-grid { grid-template-columns: 1fr; }
  .news-panel { position: static; max-height: none; }
  .news-list { max-height: 62vh; }
}
@media (max-width: 900px) {
  .chart-grid { grid-template-columns: 1fr; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .brand h1 { font-size: 15px; }
  .brand-sub { display: none; }
  .kpi-value { font-size: 22px; }
  .stat-num { font-size: 22px; }
  .metric-item { flex-wrap: wrap; }
  .news-count { display: none; }
  .chart { height: 280px; }
}
