*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: #0f1117;
  color: #e4e6ef;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

h1 {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 20px;
}

h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 12px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 10px;
}

a {
  color: #e4e6ef;
  text-decoration: none;
}

p {
  margin: 0 0 10px;
}

.text-muted {
  color: #6b7280;
}

.mono {
  font-family: "SF Mono", "Consolas", monospace;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 200px;
  height: 100vh;
  background: #12141f;
  border-right: 1px solid #252836;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
}
.sidebar .logo {
  font-size: 16px;
  font-weight: 700;
  color: #e4e6ef;
  padding-bottom: 28px;
  letter-spacing: -0.02em;
}
.sidebar .logo span {
  color: #ef4444;
}
.sidebar nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sidebar nav ul li a {
  display: block;
  padding: 7px 10px;
  border-radius: 6px;
  color: #6b7280;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.sidebar nav ul li a:hover, .sidebar nav ul li a.active {
  background: rgba(255, 255, 255, 0.06);
  color: #e4e6ef;
}

main {
  margin-left: 200px;
  padding: 28px 32px;
  min-height: 100vh;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge--ok {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}
.badge--warning {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}
.badge--critical {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}
.badge--inactive {
  background: rgba(107, 114, 128, 0.15);
  color: #6b7280;
}
.badge--maintenance {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot--ok {
  background: #22c55e;
}
.dot--warning {
  background: #f59e0b;
}
.dot--critical {
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}
.dot--inactive {
  background: #6b7280;
}
.dot--maintenance {
  background: #3b82f6;
}

.card {
  background: #1a1d26;
  border: 1px solid #252836;
  border-radius: 10px;
  padding: 20px;
}
.card--alert {
  border-left: 3px solid #ef4444;
}
.card--warning {
  border-left: 3px solid #f59e0b;
}

table.data {
  width: 100%;
  border-collapse: collapse;
}
table.data th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  padding: 8px 12px;
  border-bottom: 1px solid #252836;
}
table.data td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(37, 40, 54, 0.5);
  vertical-align: middle;
}
table.data tbody tr {
  transition: background 0.1s;
}
table.data tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}
table.data tbody tr:last-child td {
  border-bottom: none;
}
table.data tbody tr.clickable {
  cursor: pointer;
}
table.data tbody tr.link td {
  padding: 0;
}
table.data tbody tr.link td a {
  display: block;
  padding: 10px 12px;
  color: inherit;
  text-decoration: none;
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.metric__label {
  font-size: 12px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.metric__value {
  font-size: 26px;
  font-weight: 700;
  font-family: "SF Mono", "Consolas", monospace;
  line-height: 1;
}
.metric__sub {
  font-size: 12px;
  color: #6b7280;
}

.grid {
  display: grid;
  gap: 16px;
}
.grid--4 {
  grid-template-columns: repeat(4, 1fr);
}
.grid--3 {
  grid-template-columns: repeat(3, 1fr);
}
.grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.section {
  margin-bottom: 32px;
}

.filters {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.filters label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.filters select, .filters input {
  background: #1a1d26;
  border: 1px solid #252836;
  border-radius: 6px;
  color: #e4e6ef;
  padding: 7px 10px;
  font-size: 14px;
  min-width: 150px;
}
.filters select option, .filters input option {
  background: #1a1d26;
}
.filters button {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid #252836;
  border-radius: 6px;
  color: #e4e6ef;
  padding: 8px 18px;
  cursor: pointer;
  font-size: 14px;
}
.filters button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.empty {
  color: #6b7280;
  text-align: center;
  padding: 40px;
}

.server-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.server-card {
  background: #1a1d26;
  border: 1px solid #252836;
  border-radius: 10px;
  padding: 16px;
  text-decoration: none;
  display: block;
  transition: border-color 0.15s;
}
.server-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
}
.server-card__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.server-card__hostname {
  font-weight: 600;
  font-size: 15px;
  color: #e4e6ef;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.server-card__meta {
  font-size: 12px;
  color: #6b7280;
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
}
.server-card__alerts {
  font-size: 12px;
  font-weight: 600;
  color: #ef4444;
}
.server-card__alerts--none {
  color: #6b7280;
}

@keyframes live-pulse {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
  }
  50% {
    opacity: 0.7;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0);
  }
}
@keyframes live-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: #6b7280;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.live-indicator__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  animation: live-pulse 2.5s ease-in-out infinite;
  flex-shrink: 0;
}
.live-indicator--loading .live-indicator__dot {
  background: #f59e0b;
  animation: live-spin 0.7s linear infinite;
  border-radius: 50%;
  border: 2px solid rgba(245, 158, 11, 0.25);
  border-top-color: #f59e0b;
}

.bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}
.bar__fill {
  height: 100%;
  border-radius: 2px;
  background: #22c55e;
  transition: width 0.3s;
}
.bar__fill--warning {
  background: #f59e0b;
}
.bar__fill--critical {
  background: #ef4444;
}

/* Login */

body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-card {
  background: #1a1d26;
  border: 1px solid #252836;
  border-radius: 12px;
  padding: 36px 32px;
  width: 100%;
  max-width: 340px;
}

.login-card__logo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 28px;
}

.login-card__logo span {
  color: #ef4444;
}

.login-card__error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}

.login-card__label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  margin-bottom: 6px;
}

.login-card__input {
  display: block;
  width: 100%;
  background: #0f1117;
  border: 1px solid #252836;
  border-radius: 6px;
  color: #e4e6ef;
  padding: 9px 12px;
  font-size: 14px;
  margin-bottom: 16px;
  outline: none;
}

.login-card__input:focus {
  border-color: rgba(255, 255, 255, 0.2);
}

.login-card__btn {
  display: block;
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid #252836;
  border-radius: 6px;
  color: #e4e6ef;
  padding: 9px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.login-card__btn:hover {
  background: rgba(255, 255, 255, 0.13);
}

/* Sidebar logout */

.logout-btn {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: #6b7280;
  font-size: 14px;
  font-weight: 500;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e4e6ef;
}