:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #1a2230;
  --muted: #6b7688;
  --line: #e3e7ec;
  --accent: #14508c;
  --down: #1f8a4c;
  --up: #b23b3b;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding: 24px;
}
h1 { font-size: 20px; margin: 0; }
.sub { margin: 4px 0 0; color: var(--ink); }
.muted { color: var(--muted); }

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  max-width: 1120px;
  margin: 0 auto 16px;
}
.source-link { color: var(--accent); text-decoration: none; white-space: nowrap; font-size: 13px; }
.source-link:hover { text-decoration: underline; }

.filters {
  max-width: 1120px;
  margin: 0 auto 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: end;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
}
.filters label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.filters input[type="number"], .filters select {
  font: inherit;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  min-width: 96px;
}
.filters input[type="number"] { width: 110px; }
.reset {
  font: inherit;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}
.reset:hover { background: var(--bg); }

.status { max-width: 1120px; margin: 0 auto 12px; color: var(--muted); }
.status.error { color: var(--up); }

.table-wrap {
  max-width: 1120px;
  margin: 0 auto;
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #fafbfc; }
tbody tr:hover { background: #fafbfc; }
tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.power { max-width: 260px; color: var(--muted); }
td a { color: var(--accent); text-decoration: none; white-space: nowrap; }
td a:hover { text-decoration: underline; }

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 4px;
  white-space: nowrap;
}
.badge.down { background: #e5f4ea; color: var(--down); }
.badge.up { background: #f7e7e7; color: var(--up); }

.status-badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.status-badge.on { background: #e5f4ea; color: var(--down); }
.status-badge.off { background: #eef0f3; color: var(--muted); }

.empty { max-width: 1120px; margin: 24px auto; color: var(--muted); }
.foot { max-width: 1120px; margin: 20px auto 0; font-size: 12px; }

/* scatter chart */
.chart-section {
  max-width: 1120px;
  margin: 28px auto 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
}
.chart-section h2 { font-size: 15px; margin: 0 0 10px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 6px; }
.chart-legend button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 2px 4px;
  border-radius: 4px;
  cursor: pointer;
}
.chart-legend button[aria-pressed="true"] { opacity: .4; text-decoration: line-through; }
.chart-legend .swatch { width: 11px; height: 11px; border-radius: 50%; }
.chart-box { position: relative; }
#scatter { display: block; width: 100%; height: auto; }
#scatter .grid { stroke: var(--line); stroke-width: 1; }
#scatter .axis-line { stroke: #c7ccd4; stroke-width: 1; }
#scatter .tick-label { fill: var(--muted); font-size: 12px; }
#scatter .axis-title { fill: var(--ink); font-size: 12px; font-weight: 600; }
#scatter .dot { stroke: #fff; stroke-width: 1.25; opacity: .9; cursor: pointer; }
#scatter .dot:hover { opacity: 1; stroke-width: 2; }
#scatter .dot.off { fill-opacity: .22; }
.chart-tip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 5px;
  white-space: nowrap;
  transform: translate(-50%, -135%);
}
.chart-note { margin-top: 8px; font-size: 12px; }

@media (max-width: 620px) {
  body { padding: 14px; }
  .power { display: none; }
  .chart-section { padding: 12px; }
}
