/* 暗色主题, 借鉴 webpilot 风格 */
:root {
  --bg: #0e1116;
  --panel: #161b22;
  --panel-2: #1c2128;
  --line: #30363d;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --accent: #58a6ff;
  --green: #3fb950;
  --red: #f85149;
  --orange: #d29922;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

a { color: var(--accent); text-decoration: none; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.brand { display: flex; align-items: baseline; gap: 10px; }
.brand .logo { color: var(--accent); font-size: 16px; }
.brand h1 { margin: 0; font-size: 18px; font-weight: 600; }
.brand .sub { color: var(--text-dim); font-size: 12px; }

.health { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-dim); }
.health .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.health .dot.ok { background: var(--green); box-shadow: 0 0 6px var(--green); }
.health .dot.bad { background: var(--red); box-shadow: 0 0 6px var(--red); }

main { padding: 24px 28px; max-width: 1280px; margin: 0 auto; }

.tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 20px;
}
.tile.wide { grid-column: span 1; }
.tile-label { color: var(--text-dim); font-size: 12px; margin-bottom: 6px; }
.tile-val { font-size: 32px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

.picker {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
  padding: 14px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.picker label { color: var(--text-dim); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.picker select, .picker input[type="date"] {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 13px;
  font-family: inherit;
}
.picker select { min-width: 240px; }

.chart-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  height: 400px;          /* 固定高度 — Chart.js maintainAspectRatio:false 需要明确容器高 */
  min-height: 0;          /* 覆盖 min-height:360 让 grid 子项不强行撑大 */
}
.chart-wrap #main-chart { width: 100% !important; height: 100% !important; display: block; }

/* spark 同样给固定高度, 避免 Chart.js 误算 */
.tile #spark { width: 100% !important; height: 56px !important; display: block; }

.meta {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  color: var(--text-dim);
  font-size: 12px;
}
.auto-refresh { color: var(--text-dim); }

footer {
  margin-top: 40px;
  padding: 18px 28px;
  border-top: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 900px) {
  .tiles { grid-template-columns: 1fr 1fr; }
  .chart-wrap { padding: 12px; }
}
