:root {
  color-scheme: light;
  --page: #f9f9f9; --surface-1: #ffffff; --surface-2: #f3f3f3;
  --text-primary: #191919; --text-secondary: #666666;
  --grid: #e7e7e7; --axis: #c2c2c2; --border: rgba(11,11,11,0.10);
  --accent: #257de0;
  --good: #0aac23; --warning: #fbb315; --serious: #f18a59; --critical: #dc3c3d;
  --up: #dc3c3d; --down: #257de0;   /* 국내 관례: 상승 빨강, 하락 파랑 */
  --q-lead: #008a17; --q-weak: #f2a600; --q-lag: #ec4647; --q-imp: #257de0;
  --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0b0b0b; --surface-1: #191919; --surface-2: #232323;
    --text-primary: #efefef; --text-secondary: #9c9c9c;
    --grid: #303030; --axis: #474747; --border: rgba(255,255,255,0.10);
    --accent: #338ced; --up: #eb6263; --down: #338ced;
    --q-lead: #0aac23; --q-weak: #d28e05; --q-lag: #eb6263; --q-imp: #338ced;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0b0b0b; --surface-1: #191919; --surface-2: #232323;
  --text-primary: #efefef; --text-secondary: #9c9c9c;
  --grid: #303030; --axis: #474747; --border: rgba(255,255,255,0.10);
  --accent: #338ced; --up: #eb6263; --down: #338ced;
  --q-lead: #0aac23; --q-weak: #d28e05; --q-lag: #eb6263; --q-imp: #338ced;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--text-primary); line-height: 1.5; }
a { color: inherit; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 20px 16px 60px; }

header.top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
header.top h1 { font-size: 20px; margin: 0; }
header.top .back { text-decoration: none; color: var(--text-secondary); font-size: 14px; }
header.top .meta { color: var(--text-secondary); font-size: 13px; }
header.top .spacer { flex: 1; }

button, .btn {
  font: inherit; font-size: 13px; color: var(--text-primary);
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 12px; cursor: pointer;
}
button:hover { background: var(--surface-2); }
button[aria-pressed="true"] { background: var(--text-primary); color: var(--surface-1); }

.card {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.muted { color: var(--text-secondary); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.up { color: var(--up); } .down { color: var(--down); }

.notice {
  border: 1px dashed var(--axis); border-radius: var(--radius);
  padding: 14px 16px; color: var(--text-secondary); font-size: 14px; margin-bottom: 14px;
}
.notice.err { border-color: var(--critical); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border);
}
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge.good::before { background: var(--good); }
.badge.warning::before { background: var(--warning); }
.badge.serious::before { background: var(--serious); }
.badge.critical::before { background: var(--critical); }
.badge.neutral::before { background: var(--axis); }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; font-weight: 600; color: var(--text-secondary);
  border-bottom: 1px solid var(--axis); padding: 6px 8px; white-space: nowrap; }
table.data td { border-bottom: 1px solid var(--grid); padding: 6px 8px; }
table.data td.r, table.data th.r { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr:hover td { background: var(--surface-2); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
footer.foot { margin-top: 30px; color: var(--text-secondary); font-size: 12px; }
