:root {
  --bg: #0d0f14;
  --surface: #161922;
  --border: #252830;
  --text: #e8eaf0;
  --muted: #7a7f8e;
  --green: #34d399;
  --red: #f87171;
  --yellow: #fbbf24;
  --blue: #5b8af5;
  --terminal-bg: #1a1c24;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 24px;
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

nav h1 {
  font-size: 1.25rem;
  font-weight: 600;
}

nav a {
  color: var(--blue);
  text-decoration: none;
  font-size: 0.9rem;
}

nav a:hover { text-decoration: underline; }

/* --- Summary banner --- */
.summary {
  padding: 12px 20px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-weight: 600;
  font-size: 0.95rem;
  text-align: center;
}
.summary-ok {
  background: rgba(52, 211, 153, 0.12);
  color: var(--green);
  border: 1px solid rgba(52, 211, 153, 0.3);
}
.summary-degraded {
  background: rgba(248, 113, 113, 0.12);
  color: var(--red);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

/* --- Status cards --- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

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

.card-title {
  font-size: 1rem;
  font-weight: 500;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--muted);
}

.status-dot.healthy { background: var(--green); }
.status-dot.down { background: var(--red); }
.status-dot.checking { background: var(--yellow); animation: pulse 1s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.card-status {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.card-detail {
  font-size: 0.8rem;
  color: var(--muted);
  font-family: "SF Mono", Monaco, "Cascadia Code", monospace;
}

/* --- Footer bar --- */
.meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--muted);
}

.btn {
  display: inline-block;
  background: var(--blue);
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}

.btn:hover { opacity: 0.9; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* --- Test runner --- */
.test-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.test-status {
  font-size: 0.9rem;
  font-weight: 500;
}

.test-status.passed { color: var(--green); }
.test-status.failed { color: var(--red); }
.test-status.running { color: var(--yellow); }

.test-summary {
  font-size: 0.85rem;
  color: var(--muted);
}

/* --- Category groups --- */
.empty-message {
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.category {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
}

.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.category-header:hover {
  background: rgba(255, 255, 255, 0.03);
}

.category-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.category-chevron {
  font-size: 0.65rem;
  color: var(--muted);
  transition: transform 0.2s;
  display: inline-block;
  width: 12px;
}

.category.expanded .category-chevron {
  transform: rotate(90deg);
}

.category-dot { line-height: 0; }

.category-name {
  font-size: 0.95rem;
  font-weight: 600;
}

.category-count {
  font-size: 0.8rem;
  font-family: "SF Mono", Monaco, "Cascadia Code", monospace;
  color: var(--muted);
}

.category-count.pass { color: var(--green); }
.category-count.fail { color: var(--red); }

.category-body {
  display: none;
  border-top: 1px solid var(--border);
}

.category.expanded .category-body {
  display: block;
}

/* --- Test results table --- */
.test-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  overflow: hidden;
}

.test-table thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.test-table tbody td {
  padding: 10px 16px;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.test-table tbody tr:last-child td {
  border-bottom: none;
}

.test-table .empty-row td {
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
}

.col-num { width: 50px; text-align: center; }
.col-status { width: 60px; text-align: center; }
.col-title { }
.col-time { width: 80px; text-align: right; font-family: "SF Mono", Monaco, monospace; font-size: 0.8rem; color: var(--muted); }

.row-pass .col-title { color: var(--text); }
.row-fail .col-title { color: var(--red); }

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.green { background: var(--green); }
.dot.red { background: var(--red); }
.dot.yellow { background: var(--yellow); animation: pulse 1s infinite; }
