:root {
  --bg: #0f1115;
  --surface: #16191f;
  --surface-2: #1e222b;
  --border: #2a2f3a;
  --text: #e4e6eb;
  --text-muted: #9aa0a8;
  --ok: #22c55e;
  --ok-bg: rgba(34, 197, 94, 0.12);
  --warn: #f59e0b;
  --warn-bg: rgba(245, 158, 11, 0.12);
  --error: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.12);
  --unknown: #6b7280;
  --unknown-bg: rgba(107, 114, 128, 0.12);
  --accent: #60a5fa;
  --radius: 12px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

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

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.header h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.timer {
  font-variant-numeric: tabular-nums;
}

.last-updated {
  font-variant-numeric: tabular-nums;
}

.last-updated.offline {
  color: var(--error);
}

.dashboard {
  flex: 1;
}

.loading {
  color: var(--text-muted);
  text-align: center;
  padding: 48px 0;
  font-size: 1.1rem;
}

.error-banner {
  background: var(--error-bg);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: var(--error);
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.error-banner::before {
  content: "⚠";
  font-size: 1.2rem;
}

.section {
  margin-bottom: 32px;
}

.section-title {
  margin: 0 0 14px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--surface-2);
}

.status-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.25);
}

.status-dot.ok { background: var(--ok); }
.status-dot.warn { background: var(--warn); }
.status-dot.error { background: var(--error); }
.status-dot.unknown { background: var(--unknown); }

.card-body {
  flex: 1;
  min-width: 0;
}

.card-label {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-detail {
  margin: 0 0 6px;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.35;
  word-break: break-word;
}

.card-age {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.card-age .age-value {
  color: var(--warn);
  font-weight: 500;
}

.footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
}

.refresh-btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.refresh-btn:hover {
  background: #252a36;
  border-color: var(--accent);
}

.refresh-btn:active {
  transform: translateY(1px);
}

@media (min-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

@media (max-width: 480px) {
  .app {
    padding: 16px;
  }

  .header h1 {
    font-size: 1.35rem;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }
}
