:root {
  --bg: #0f172a;
  --panel: #111827;
  --panel2: #1f2937;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --line: #334155;
  --ok: #10b981;
  --watch: #f59e0b;
  --warn: #f97316;
  --danger: #ef4444;
  --accent: #60a5fa;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(circle at top left, #1e293b, var(--bg) 45%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 28px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}
h1 { margin: 0 0 6px; font-size: 28px; }
.subtitle { margin: 0; color: var(--muted); }
.top-actions { display: flex; gap: 10px; flex-wrap: wrap; }
button, .button {
  border: 0;
  background: var(--accent);
  color: #07111f;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
}
button.ghost, .button.ghost { background: #243244; color: var(--text); }
main { padding: 18px 28px 40px; }
.status {
  padding: 12px 14px;
  margin-bottom: 16px;
  background: rgba(30, 41, 59, .88);
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 12px;
  color: var(--muted);
}
.tabs { display: flex; gap: 8px; margin: 12px 0 18px; }
.tab { background: #243244; color: var(--text); }
.tab.active { background: var(--accent); color: #07111f; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.card, .panel, .chart-card {
  background: rgba(17, 24, 39, .92);
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 16px 40px rgba(0,0,0,.22);
}
.card h3, .panel h2, .chart-card h2 { margin: 0 0 8px; }
.value { font-size: 28px; font-weight: 800; margin: 6px 0; }
.meta { color: var(--muted); font-size: 13px; line-height: 1.55; }
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.badge.ok { background: rgba(16,185,129,.18); color: #86efac; }
.badge.watch { background: rgba(245,158,11,.18); color: #fcd34d; }
.badge.warn { background: rgba(249,115,22,.18); color: #fdba74; }
.badge.danger { background: rgba(239,68,68,.18); color: #fca5a5; }
.panel { margin-top: 16px; }
.summary { line-height: 1.7; color: #d1d5db; }
.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 16px;
}
.chart-card.wide { grid-column: 1 / -1; }
canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  background: #0b1220;
}
.hint { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.tooltip {
  position: fixed;
  display: none;
  pointer-events: none;
  z-index: 999999;
  background: rgba(3, 7, 18, .95);
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, .35);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  box-shadow: 0 10px 28px rgba(0,0,0,.45);
  white-space: nowrap;
}
.bars { display: grid; gap: 10px; }
.bar-row {
  display: grid;
  grid-template-columns: 190px 1fr 110px;
  gap: 12px;
  align-items: center;
}
.bar-label { color: #e5e7eb; font-size: 13px; }
.bar-track { background: #0b1220; border-radius: 999px; overflow: hidden; height: 22px; border: 1px solid rgba(148,163,184,.18); }
.bar-fill { height: 100%; background: linear-gradient(90deg, #60a5fa, #a78bfa); }
.bar-change { font-weight: 800; text-align: right; }
.source-links { display: grid; gap: 10px; }
.source-links a {
  color: #93c5fd;
  padding: 12px 14px;
  background: rgba(17,24,39,.92);
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 12px;
  text-decoration: none;
}
@media (max-width: 900px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .chart-grid { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 1fr; }
}
button.secondary { background: #334155; color: var(--text); }
button:disabled { opacity: .55; cursor: not-allowed; }
