* {
  box-sizing: border-box;
}

:root {
  --bg: #080808;
  --bg-elevated: #121212;
  --bg-soft: #171717;
  --border: #2a2a2a;
  --text: #f3f3f3;
  --text-muted: #aaaaaa;
  --orange: #ff8a1f;
  --orange-strong: #ff7a00;
  --orange-soft: #ffb15f;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji",
    Tahoma, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top, #141414 0%, var(--bg) 56%);
}

.container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 18px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.header h1 {
  margin: 0;
  font-size: 24px;
}

.header p {
  margin: 6px 0 0;
  color: var(--text-muted);
}

.header .site-health {
  display: inline-block;
  margin: 8px 0 0;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.header .site-health.pending {
  background: #2b2b2b;
  border-color: #3a3a3a;
  color: #bbbbbb;
}

.header .site-health.all-operational {
  background: #153625;
  border-color: #1f4f35;
  color: #7ee7ad;
}

.header .site-health.degraded {
  background: #3a250c;
  border-color: #5f3d18;
  color: #ffc27d;
}

.header .site-health.under-maintenance {
  background: #4a2c0f;
  border-color: #7a461b;
  color: #ffd09a;
}

.header .site-health.partial-outage {
  background: #3b1616;
  border-color: #6d2a23;
  color: #ff9f9f;
}

.header .site-health.major-outage {
  background: #531313;
  border-color: #8a1f1f;
  color: #ff8e8e;
}

.error {
  background: #2a1111;
  color: #ffb3a9;
  border: 1px solid #6d2a23;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.hidden {
  display: none;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.incidents-board {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.incident-panel {
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 10px;
}

.incident-panel h2 {
  margin: 0 0 8px;
  font-size: 15px;
}

.incident-panel.failure {
  background: #2b1111;
  border-color: #6d2a23;
}

.incident-panel.failure h2 {
  color: #ff9f9f;
}

.incident-panel.planned {
  background: #2f1f0d;
  border-color: #69421a;
}

.incident-panel.planned h2 {
  color: #ffc27d;
}

.incident-table {
  min-width: 720px;
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

.card .label {
  color: var(--text-muted);
  font-size: 13px;
}

.card .value {
  margin-top: 6px;
  font-size: 20px;
  font-weight: 700;
  color: var(--orange);
}

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 14px;
}

.panel h2 {
  margin: 0 0 10px;
  font-size: 17px;
}

.profiles-panel-head {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.profiles-panel-head h2 {
  margin: 0;
}

.traffic-layout {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(300px, 420px);
  gap: 12px;
  align-items: flex-start;
}

.traffic-left {
  display: grid;
  gap: 12px;
}

.traffic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.traffic-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: var(--bg-soft);
}

.traffic-item .period {
  color: var(--text-muted);
  font-size: 13px;
}

.traffic-item .total {
  margin: 6px 0;
  font-size: 19px;
  font-weight: 700;
  color: var(--orange);
}

.load-chart-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: var(--bg-soft);
}

.load-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.load-chart-header h3 {
  margin: 0;
  font-size: 14px;
  color: var(--text);
}

.load-chart-header span {
  font-size: 12px;
  color: var(--text-muted);
}

.load-bars {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
}

.load-row {
  display: grid;
  gap: 4px;
}

.load-row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

.load-row-node {
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.load-row-value {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.load-row-track {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  background: #2d2d2d;
  overflow: hidden;
}

.load-row-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--orange-soft);
}

.load-empty {
  font-size: 12px;
  color: var(--text-muted);
}

.load-error {
  font-size: 12px;
  color: #ffb3a9;
  background: #2a1111;
  border: 1px solid #6d2a23;
  border-radius: 8px;
  padding: 8px 10px;
}

.traffic-donut-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: var(--bg-soft);
}

.traffic-donut-card h3 {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--text);
}

.donut-stack {
  width: min(100%, 220px);
  aspect-ratio: 1 / 1;
  margin: 0 auto 10px;
  position: relative;
  overflow: visible;
}

.donut-chart {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  position: relative;
  background: #2b2b2b;
}

.donut-chart::after {
  content: "";
  position: absolute;
  inset: 26%;
  border-radius: 50%;
  background: var(--bg-soft);
}

.donut-center {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  pointer-events: none;
  padding: 0 18%;
}

.donut-center-label {
  font-size: 11px;
  color: var(--text-muted);
}

.donut-center-total {
  margin-top: 4px;
  font-size: 14px;
  font-weight: 700;
  color: var(--orange);
}

.donut-tooltip {
  position: absolute;
  z-index: 2;
  left: calc(100% + 12px);
  top: 50%;
  width: max-content;
  max-width: none;
  padding: 8px 10px;
  border-radius: 8px;
  background: #1b1b1b;
  border: 1px solid #393939;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  color: #f0f0f0;
  font-size: 12px;
  line-height: 1.35;
  white-space: pre;
  pointer-events: none;
  opacity: 1;
  transform: translateY(-50%) translateX(0);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.donut-tooltip.hidden {
  display: block;
  opacity: 0;
  transform: translateY(-50%) translateX(8px);
}

.donut-legend {
  display: grid;
  gap: 6px;
  max-height: 240px;
  overflow: auto;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.donut-legend-name {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  min-width: 0;
}

.donut-legend-node {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.donut-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.donut-legend-value {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.donut-empty {
  font-size: 12px;
  color: var(--text-muted);
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 940px;
}

.profiles-table {
  min-width: 420px;
}

.systems-table {
  min-width: 420px;
}

.profile-status {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
}

.profile-status.ok {
  background: #153625;
  color: #7ee7ad;
}

.profile-status.fail {
  background: #3b1616;
  color: #ff9f9f;
}

.profile-status.pending {
  background: #2b2b2b;
  color: #bbbbbb;
}

.system-status {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
}

.system-status.ok {
  background: #153625;
  color: #7ee7ad;
}

.system-status.fail {
  background: #3b1616;
  color: #ff9f9f;
}

.system-status.degraded {
  background: #3a250c;
  color: #ffc27d;
}

.system-status.missing-config {
  background: #2b2b2b;
  color: #bbbbbb;
}

.system-status.pending {
  background: #2b2b2b;
  color: #bbbbbb;
}

.system-status.maintenance {
  background: #4a2c0f;
  color: #ffd09a;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  font-size: 13px;
}

th {
  color: var(--orange);
  font-weight: 600;
  background: #1b1b1b;
}

.status {
  padding: 2px 8px;
  border-radius: 999px;
  display: inline-block;
  font-weight: 600;
  font-size: 12px;
}

.status.online {
  color: #7ee7ad;
  background: #153625;
}

.status.offline {
  color: #ff9f9f;
  background: #3b1616;
}

@media (max-width: 820px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
  }

  .traffic-layout {
    grid-template-columns: 1fr;
  }

  .donut-tooltip {
    left: 50%;
    top: calc(100% + 8px);
    transform: translateX(-50%) translateY(0);
  }

  .donut-tooltip.hidden {
    transform: translateX(-50%) translateY(8px);
  }
}
