:root {
  color-scheme: dark;
  --cs-page: #090e14;
  --cs-card: #141d27;
  --cs-card-soft: #101821;
  --cs-chart: #0b121a;
  --cs-ink: #edf3f8;
  --cs-muted: #98a7b7;
  --cs-border: #263342;
  --cs-line: #223040;
  --cs-blue: #4aa3ff;
  --cs-red: #ff6b50;
  --cs-green: #4fd18b;
  --cs-orange: #f4a83d;
}

@font-face {
  font-family: "Aventa";
  src: url("/fonts/aventa-regular.ttf?v=20260831-10") format("truetype");
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--cs-page);
  color: var(--cs-ink);
  font-family: Aventa, Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  align-items: center;
  background: var(--cs-page);
  display: flex;
  justify-content: center;
  min-height: 72px;
  padding: 13px 24px;
}

.brand {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: center;
  min-width: 0;
}

.brand-mark {
  background: url("/logo.svg?v=20260831-10") center / contain no-repeat;
  display: inline-block;
  flex: 0 0 42px;
  height: 42px;
  width: 42px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  color: var(--cs-ink);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

h2 {
  color: var(--cs-ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.page {
  min-height: calc(100vh - 72px);
  padding: 3px 24px 24px;
}

.global-controls {
  align-items: center;
  background: var(--cs-card);
  border: 1px solid var(--cs-border);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  justify-content: space-between;
  margin-bottom: 18px;
  padding: 12px;
}

.control-row,
.timebar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.control-row {
  justify-content: space-between;
  min-width: min(100%, 560px);
}

.timebar {
  justify-content: flex-end;
  margin-left: auto;
}

.timebar label {
  color: var(--cs-muted);
  display: grid;
  font-size: 11px;
  font-weight: 600;
  gap: 5px;
}

.timebar input {
  background: var(--cs-card-soft);
  border: 1px solid var(--cs-line);
  border-radius: 7px;
  color: var(--cs-ink);
  min-height: 34px;
  padding: 5px 9px;
  width: 198px;
}

.control-group {
  background: var(--cs-card-soft);
  border: 1px solid var(--cs-line);
  border-radius: 8px;
  display: inline-flex;
  gap: 2px;
  padding: 3px;
}

.seg,
.text-btn,
.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--cs-muted);
  min-height: 32px;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.seg {
  font-size: 13px;
  font-weight: 700;
  min-width: 48px;
  padding: 5px 10px;
}

.seg.active,
.text-btn.active {
  background: var(--cs-chart);
  border-color: var(--cs-border);
  color: var(--cs-blue);
}

.text-btn,
.icon-btn {
  border-color: var(--cs-line);
  font-size: 13px;
  font-weight: 700;
}

.text-btn {
  padding: 5px 12px;
}

.icon-actions {
  display: inline-flex;
  gap: 6px;
}

.icon-btn {
  align-items: center;
  display: inline-flex;
  font-size: 16px;
  justify-content: center;
  line-height: 1;
  min-width: 32px;
  padding: 0;
}

.seg:hover,
.text-btn:hover,
.icon-btn:hover {
  border-color: rgba(74, 163, 255, 0.45);
  color: var(--cs-ink);
}

.cards-grid {
  align-items: stretch;
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr));
}

.metric-card {
  background: var(--cs-card);
  border: 1px solid var(--cs-border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.card-header {
  padding: 16px 16px 12px;
}

.title-row {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.title-row h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.server-icon {
  color: var(--cs-muted);
  display: inline-flex;
  flex: 0 0 auto;
  height: 18px;
  width: 18px;
}

.server-icon svg {
  display: block;
  height: 18px;
  width: 18px;
}

.charts {
  display: grid;
  gap: 10px;
  padding: 0 16px 16px;
}

.chart-block {
  background: var(--cs-chart);
  border: 1px solid var(--cs-line);
  border-radius: 8px;
  height: 136px;
  overflow: hidden;
  position: relative;
}

canvas {
  display: block;
  height: 100%;
  width: 100%;
}

.empty-state {
  align-items: center;
  background: var(--cs-card);
  border: 1px solid var(--cs-border);
  border-radius: 8px;
  color: var(--cs-muted);
  display: none;
  min-height: 180px;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

.tooltip {
  background: rgba(7, 11, 16, 0.96);
  border: 1px solid var(--cs-border);
  border-radius: 7px;
  color: var(--cs-ink);
  font-size: 12px;
  line-height: 1.45;
  max-width: min(320px, 70vw);
  padding: 8px 10px;
  pointer-events: none;
  position: fixed;
  z-index: 20;
}

.tooltip.hidden {
  display: none;
}

.tooltip strong {
  display: block;
  margin-bottom: 4px;
}

.tooltip-swatch {
  border-radius: 2px;
  display: inline-block;
  height: 9px;
  margin-right: 4px;
  width: 12px;
}

@media (max-width: 900px) {
  .global-controls,
  .control-row,
  .timebar {
    align-items: stretch;
    width: 100%;
  }

  .timebar {
    justify-content: flex-start;
    margin-left: 0;
  }
}

@media (max-width: 700px) {
  .topbar {
    min-height: 64px;
    padding: 12px 14px;
  }

  .brand-mark {
    flex-basis: 34px;
    height: 34px;
    width: 34px;
  }

  h1 {
    font-size: 18px;
  }

  .page {
    min-height: calc(100vh - 64px);
    padding: 14px;
  }

  .global-controls {
    margin-bottom: 14px;
  }

  .control-group {
    overflow-x: auto;
    width: 100%;
  }

  .seg {
    flex: 1 0 auto;
  }

  .icon-actions {
    width: 100%;
  }

  .icon-btn,
  .text-btn {
    flex: 1;
  }

  .timebar label,
  .timebar input {
    width: 100%;
  }

}
