:root {
  --bg: #0a0b0d;
  --panel: #111317;
  --border: #23262b;
  --text: #f3f4f6;
  --text-dim: #9aa1ab;
  --orange: #f6821f;
  --blue: #5b8def;
  --blue-light: #7fd1e0;
  --green: #33c481;
}

* { box-sizing: border-box; }

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

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.title-block h1 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
}
.status-dot.offline { background: #e5484d; }

.subtitle {
  margin: 0 0 8px;
  color: var(--text-dim);
  font-size: 13px;
}

.description {
  margin: 0;
  color: var(--text-dim);
  font-size: 12.5px;
  max-width: 760px;
  line-height: 1.5;
}

.controls {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.control {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--text-dim);
}

.control select {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  min-width: 200px;
}

.refresh-button {
  align-self: flex-end;
  background: var(--orange);
  border: 0;
  border-radius: 6px;
  color: #111;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  min-height: 32px;
  padding: 8px 12px;
}

.refresh-button:disabled {
  cursor: wait;
  opacity: .65;
}

.endpoint-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  margin-bottom: 20px;
  background: linear-gradient(135deg, rgba(246,130,31,.11), rgba(91,141,239,.08));
  border: 1px solid rgba(246,130,31,.35);
  border-radius: 10px;
}

.endpoint-kicker {
  color: var(--orange);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  margin-bottom: 7px;
}

.endpoint-card code {
  display: block;
  color: var(--text);
  font-size: 16px;
  word-break: break-all;
}

.endpoint-card p {
  color: var(--text-dim);
  font-size: 12px;
  margin: 7px 0 0;
}

.endpoint-card button {
  flex: 0 0 auto;
  color: #111;
  background: var(--orange);
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.totals-row {
  display: flex;
  gap: 48px;
  flex-wrap: wrap;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.total-label {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot.mitigated { background: var(--orange); }
.dot.cf { background: var(--blue); }
.dot.origin { background: var(--blue-light); }
.dot.rps { background: var(--green); }
.dot.peak { background: var(--orange); }

.total-value {
  font-size: 26px;
  font-weight: 700;
}

.chart-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px 20px;
  position: relative;
  height: 320px;
  margin-bottom: 40px;
}

.chart-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--text-dim);
  font-size: 10px;
  letter-spacing: .04em;
  margin-bottom: 10px;
}

.chart-container {
  position: relative;
  width: 100%;
  height: calc(100% - 22px);
}

.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 13px;
  background: var(--panel);
  border-radius: 10px;
  z-index: 10;
}

.empty-state[hidden] {
  display: none !important;
}

.top-stats-header h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.top-stats-header p {
  margin: 0 0 16px;
  color: var(--text-dim);
  font-size: 13px;
}

.cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 780px) {
  .cards-grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; }
  .endpoint-card { align-items: stretch; flex-direction: column; }
  .endpoint-card button { align-self: flex-start; }
  .chart-meta { flex-direction: column; gap: 4px; }
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  min-height: 170px;
}

.stat-card h3 {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 600;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border);
}

.bar-row {
  display: grid;
  grid-template-columns: 140px 50px 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 13px;
}

.bar-row .label {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-row .count {
  color: var(--text-dim);
  text-align: right;
}

.bar-track {
  height: 6px;
  background: #1b1e23;
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--blue);
  border-radius: 4px;
}

.unavailable {
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.5;
}
