:root {
  --color-bg: #f9f9fb;
  --color-card: #ffffff;
  --color-text: #2c3e50;
  --color-muted: #7f8c8d;
  --color-shadow: rgba(0, 0, 0, 0.05);
  --online: #2ecc71;
  --degraded: #f39c12;
  --offline: #e74c3c;
  --color-primary: #3498db;
  --color-accent: #8e44ad;
  --font: 'Segoe UI', sans-serif;
}
body.dark {
  --color-bg: #121212;
  --color-card: #1e1e1e;
  --color-text: #eaeaea;
  --color-muted: #aaa;
  --color-shadow: rgba(255, 255, 255, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 2em;
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  transition: background 0.3s ease, color 0.3s ease;
  max-width: 1000px;
  margin-inline: auto;
}

h1 {
  margin-bottom: 1em;
  font-size: 2rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75em;
  margin-bottom: 1em;
  align-items: center;
}

.controls select,
.controls input,
.controls button {
  font-size: 1em;
  padding: 0.6em 0.8em;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: var(--color-card);
  color: var(--color-text);
  transition: all 0.2s ease;
}
.controls button:hover {
  background: var(--color-primary);
  color: white;
  cursor: pointer;
}
button:focus,
input:focus,
select:focus {
  outline: 2px solid var(--color-primary);
}

#banner {
  display: none;
  background: var(--offline);
  color: white;
  padding: 1em;
  text-align: center;
  border-radius: 8px;
  font-weight: bold;
  margin-bottom: 1.5em;
}

.service {
  background: var(--color-card);
  padding: 1.2em;
  border-radius: 10px;
  box-shadow: 0 2px 8px var(--color-shadow);
  margin-bottom: 1em;
  transition: transform 0.2s ease;
}
.service:hover {
  transform: translateY(-2px);
  cursor: pointer;
}
.service:focus {
  outline: 2px solid var(--color-accent);
}

.status-icon {
  font-size: 1.4em;
  vertical-align: middle;
  margin-right: 0.5em;
}
.online { color: var(--online); }
.degraded { color: var(--degraded); }
.offline { color: var(--offline); }

.timestamp {
  font-size: 0.85em;
  color: var(--color-muted);
  margin-top: 0.5em;
}

#last-update {
  font-size: 0.9em;
  color: var(--color-muted);
  margin-bottom: 1em;
}

#loading,
#error-message {
  font-style: italic;
  margin-top: 1em;
  color: var(--color-muted);
}

#modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 100;
  justify-content: center;
  align-items: center;
}

#modal-content {
  background: var(--color-card);
  color: var(--color-text);
  border-radius: 10px;
  padding: 2em;
  width: 90%;
  max-width: 500px;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  max-height: 80vh;
  overflow-y: auto;
  animation: fadeIn 0.2s ease;
}

#modal-close {
  position: absolute;
  top: 1em;
  right: 1em;
  background: none;
  border: none;
  font-size: 1.5em;
  color: var(--color-text);
  cursor: pointer;
}

#modal-body > div {
  margin-bottom: 0.5em;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* Responsive */
@media (max-width: 600px) {
  .controls {
    flex-direction: column;
    align-items: stretch;
  }
}
