:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --border: #e4e9f0;
  --text: #1d2733;
  --muted: #6b7787;
  --green: #22a35a;
  --green-soft: #e9f8ef;
  --yellow: #c58b13;
  --yellow-soft: #fff7e2;
  --red: #d14b4b;
  --red-soft: #fdecec;
  --blue: #3b82f6;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 68px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  position: relative;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(145deg, #2cb56a, #178247);
  box-shadow: 0 0 0 4px rgba(34, 163, 90, 0.12);
}

.updated {
  position: absolute;
  right: 22px;
  color: var(--muted);
  font-size: 12px;
}

.container {
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 36px;
}

.overall-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 24px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.overall-card.status-operational { background: var(--green-soft); border-color: #c8ecd7; }
.overall-card.status-degraded { background: var(--yellow-soft); border-color: #f1dfaf; }
.overall-card.status-down { background: var(--red-soft); border-color: #f3c5c5; }
.overall-card.status-unknown, .overall-card.status-loading { background: var(--card); }

.overall-dot {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #cdd5df;
  position: relative;
}
.overall-dot::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: #ffffff;
  opacity: 0.9;
}
.overall-dot.status-operational { background: var(--green); box-shadow: 0 0 0 7px rgba(34, 163, 90, 0.12); }
.overall-dot.status-degraded { background: #e7b53b; box-shadow: 0 0 0 7px rgba(231, 181, 59, 0.16); }
.overall-dot.status-down { background: var(--red); box-shadow: 0 0 0 7px rgba(209, 75, 75, 0.14); }

.overall-copy h1 {
  margin: 0 0 5px;
  font-size: clamp(20px, 3vw, 26px);
  letter-spacing: -0.02em;
}
.overall-copy p { margin: 0; color: var(--muted); font-size: 13px; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card, .monitor-card, .graph-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 16px 18px;
}
.stat-label, .stat-note, .section-sub, .updated { color: var(--muted); font-size: 12px; }
.stat-card strong { font-size: 25px; letter-spacing: -0.03em; }

.monitor-card { margin-bottom: 18px; overflow: hidden; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.section-head.compact { padding: 0 0 10px; border: 0; }
.section-head h2 { margin: 0; font-size: 15px; }
.section-sub { margin: 3px 0 0; }
.section-head.compact .section-sub { margin: 0; }

.legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}
.legend-up, .legend-down {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.legend-up { background: var(--green); }
.legend-down { background: var(--red); margin-left: 7px; }

.node-list { display: flex; flex-direction: column; }
.node-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.1fr) minmax(200px, 2fr) 92px;
  align-items: center;
  gap: 18px;
  padding: 15px 18px;
  border-top: 1px solid var(--border);
}
.node-row:first-child { border-top: 0; }
.node-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.node-main h3 {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}
.node-status { display: block; margin-top: 3px; font-size: 11px; }
.status-text-up { color: var(--green); }
.status-text-down { color: var(--red); }

.status-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.dot-up { background: var(--green); box-shadow: 0 0 0 4px rgba(34, 163, 90, 0.1); }
.dot-down { background: var(--red); box-shadow: 0 0 0 4px rgba(209, 75, 75, 0.1); }

.node-heartbeat {
  display: flex;
  align-items: stretch;
  gap: 2px;
  height: 30px;
}
.heartbeat-bar {
  flex: 1 1 0;
  min-width: 2px;
  border-radius: 2px;
  background: #dce3ea;
}
.bar-up { background: #35b86b; }
.bar-down { background: #e05b5b; }
.bar-unknown { background: #dce3ea; }

.node-uptime { text-align: right; }
.node-uptime strong { display: block; font-size: 13px; }
.node-uptime span { color: var(--muted); font-size: 10px; }

.empty { margin: 0; padding: 22px 18px; color: var(--muted); font-size: 13px; }

.graphs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.graph-card { padding: 14px; overflow: hidden; }
.graph-card img {
  display: block;
  width: 100%;
  min-height: 180px;
  height: auto;
  margin-top: 2px;
  border-radius: 8px;
  background: #f9fafb;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 18px;
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 820px) {
  .updated { position: static; }
  .site-header { justify-content: space-between; }
  .graphs { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .container { width: min(100% - 20px, 960px); padding-top: 18px; }
  .stats { grid-template-columns: 1fr; }
  .overall-card { align-items: flex-start; padding: 18px; }
  .node-row { grid-template-columns: 1fr; gap: 9px; }
  .node-heartbeat { height: 26px; }
  .node-uptime { grid-column: 1; display: flex; align-items: baseline; gap: 6px; }
  .site-header { align-items: flex-start; flex-direction: column; gap: 4px; }
  footer { flex-direction: column; }
}
