/* Copyright 2026 NVIDIA CORPORATION */
/* SPDX-License-Identifier: Apache-2.0 */

:root {
  --bg:       #0d1117;
  --surface:  #161b22;
  --surface2: #21262d;
  --border:   #30363d;
  --text:     #e6edf3;
  --muted:    #8b949e;
  --pass:     #3fb950;
  --fail:     #f85149;
  --skip:     #d29922;
  --accent:   #58a6ff;
  --radius:   6px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────────────────────────── */

.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.page-header svg { flex-shrink: 0; }
.page-header h1 { font-size: 16px; font-weight: 600; }

.header-stats {
  margin-left: auto;
  display: flex;
  gap: 24px;
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}
.header-stat-val {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  display: block;
  line-height: 1.1;
}

/* ── Controls ────────────────────────────────────────────────────────────── */

.controls {
  padding: 8px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  background: var(--bg);
}

.search-wrap { flex: 1; min-width: 180px; position: relative; }
.search-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search {
  width: 100%;
  padding: 5px 10px 5px 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.search:focus { border-color: var(--accent); }
.search::placeholder { color: var(--muted); }

.sep { width: 1px; height: 18px; background: var(--border); flex-shrink: 0; }
.ctrl-label { font-size: 12px; color: var(--muted); flex-shrink: 0; }

.btn-group { display: flex; }
.btn-group button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.1s, background 0.1s;
}
.btn-group button:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.btn-group button:last-child  { border-radius: 0 var(--radius) var(--radius) 0; }
.btn-group button:not(:first-child) { border-left: none; }
.btn-group button.active {
  background: var(--surface2);
  color: var(--accent);
  border-color: var(--accent);
  z-index: 1;
  position: relative;
}
.btn-group button:hover:not(.active) { color: var(--text); background: var(--surface2); }

.filter-group { display: flex; gap: 4px; }
.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid var(--border);
  color: var(--muted);
  background: transparent;
  transition: all 0.1s;
  user-select: none;
}
.filter-pill:hover:not(.active) { border-color: var(--text); color: var(--text); }
.filter-pill.pass.active { border-color: var(--pass); color: var(--pass); background: rgba(63,185,80,0.08); }
.filter-pill.fail.active { border-color: var(--fail); color: var(--fail); background: rgba(248,81,73,0.08); }
.filter-pill.skip.active { border-color: var(--skip); color: var(--skip); background: rgba(210,153,34,0.08); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ── Summary strip ───────────────────────────────────────────────────────── */

.summary {
  padding: 6px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: center;
}
.summary strong { color: var(--text); }

/* ── Main content area ───────────────────────────────────────────────────── */

main { padding: 16px 24px; max-width: 1280px; margin: 0 auto; }

.msg { text-align: center; padding: 60px 24px; color: var(--muted); }
.msg.err { color: var(--fail); }

.spinner {
  display: inline-block;
  width: 22px; height: 22px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Run card ────────────────────────────────────────────────────────────── */

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

.run-header {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.run-header:hover { background: rgba(255,255,255,0.025); }

.chevron { color: var(--muted); font-size: 10px; transition: transform 0.15s; flex-shrink: 0; }
.run-card.open .chevron { transform: rotate(90deg); }

.run-ts  { font-size: 13px; font-weight: 600; white-space: nowrap; }
.run-desc { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.run-dur  { color: var(--muted); font-size: 11px; font-family: monospace; white-space: nowrap; flex-shrink: 0; }
.run-counts { margin-left: auto; display: flex; gap: 12px; font-size: 12px; flex-shrink: 0; align-items: center; }

.commit-display {
  font-size: 12px;
  padding: 0 8px;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  white-space: nowrap;
  flex-shrink: 0;
}
.commit-link {
  font-family: monospace;
  color: var(--accent);
  text-decoration: none;
  transition: color 0.1s;
}
.commit-link:hover {
  color: var(--text);
  text-decoration: underline;
}
.commit-na {
  font-family: monospace;
  color: var(--muted);
  opacity: 0.5;
}

.c-pass  { color: var(--pass); }
.c-fail  { color: var(--fail); }
.c-skip  { color: var(--skip); }
.c-muted { color: var(--muted); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  flex-shrink: 0;
}
.badge-pass { background: rgba(63,185,80,0.15);  color: var(--pass); }
.badge-fail { background: rgba(248,81,73,0.15);  color: var(--fail); }
.badge-skip { background: rgba(210,153,34,0.15); color: var(--skip); }

/* ── Run body ────────────────────────────────────────────────────────────── */

.run-body { display: none; }
.run-card.open .run-body { display: block; }

.suite-meta {
  padding: 6px 14px;
  background: var(--surface2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 20px;
  font-size: 11px;
  color: var(--muted);
  flex-wrap: wrap;
  align-items: center;
}
.suite-meta strong { color: var(--text); }
.suite-warn {
  color: var(--skip);
  background: rgba(210,153,34,0.08);
  border: 1px solid rgba(210,153,34,0.2);
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 11px;
}

/* ── Spec rows ───────────────────────────────────────────────────────────── */

.spec-row {
  padding: 7px 14px 7px 32px;
  border-top: 1px solid rgba(48,54,61,0.5);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.spec-row.match { background: rgba(88,166,255,0.04); }

.spec-state-icon { flex-shrink: 0; font-size: 13px; margin-top: 1px; width: 16px; text-align: center; }
.spec-body { flex: 1; min-width: 0; }
.spec-path { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spec-leaf { font-size: 13px; font-weight: 500; margin-top: 1px; }
.spec-labels { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.label {
  background: rgba(88,166,255,0.1);
  color: var(--accent);
  padding: 0 5px;
  border-radius: 3px;
  font-size: 10px;
}
.spec-meta { display: flex; gap: 14px; margin-top: 3px; font-size: 11px; color: var(--muted); }
.spec-meta .mono { font-family: monospace; }

.detail-btn {
  flex-shrink: 0;
  padding: 2px 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.1s;
  margin-top: 1px;
  white-space: nowrap;
}
.detail-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Spec detail panel ───────────────────────────────────────────────────── */

.spec-detail {
  display: none;
  margin: 6px 14px 6px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 12px;
}
.spec-detail.open { display: block; }

.detail-section {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.detail-section:last-child { border-bottom: none; }

.detail-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 3px 16px; }
.kv-k { color: var(--muted); font-family: monospace; }
.kv-v { font-family: monospace; color: var(--text); word-break: break-all; }

.pre {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  max-height: 300px;
  overflow-y: auto;
  line-height: 1.6;
}
.pre.err { color: #ff7b72; }

.entry-block { margin-bottom: 10px; }
.entry-block:last-child { margin-bottom: 0; }
.entry-name { font-weight: 600; color: var(--text); margin-bottom: 3px; font-size: 12px; }
.entry-val { font-family: monospace; font-size: 11px; white-space: pre-wrap; color: var(--text); }

/* ── Tabs ────────────────────────────────────────────────────────────── */

.tabs {
  display: flex;
  gap: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}

.tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.tab:hover:not(.active) {
  color: var(--text);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-content {
  display: block;
}

.tab-content.hidden {
  display: none;
}

/* ── Metrics view ────────────────────────────────────────────────────── */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: 16px;
  padding: 16px 0;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow: hidden;
}

.chart-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 12px 0;
}

.chart-wrapper {
  position: relative;
  height: 300px;
}

.chart-wrapper canvas {
  max-height: 100%;
}
