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

:root {
  --bg: #0d0f18;
  --surface: #161929;
  --surface2: #1e2235;
  --border: #2a2f47;
  --border-hover: #3d4566;
  --accent: #5b8dee;
  --accent-hover: #4a7bdc;
  --success: #3ecf8e;
  --danger: #f46a6a;
  --warning: #f5c542;
  --muted: #6b7280;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --radius: 12px;
  --font: 'Segoe UI', system-ui, sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ── Header ── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 56px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 12px rgba(0,0,0,0.4);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
}

.logo-icon { color: var(--accent); font-size: 14px; }

.back-link {
  font-size: 20px;
  color: var(--muted);
  transition: color 0.15s;
  padding-right: 2px;
}
.back-link:hover { color: var(--text); }

.header-sep { color: var(--border); font-weight: 300; }
.header-project { font-size: 15px; font-weight: 600; color: var(--text-dim); }

.api-status {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
}
.api-status.checking { background: rgba(107,114,128,0.15); color: var(--muted); }
.api-status.ok       { background: rgba(62,207,142,0.12); color: var(--success); }
.api-status.warning  { background: rgba(245,197,66,0.12);  color: var(--warning); }
.api-status.error    { background: rgba(244,106,106,0.12); color: var(--danger); }

/* ── Main layout ── */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

h2 {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 18px;
}

/* ── Project grid ── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

.project-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.project-card-name { font-size: 16px; font-weight: 700; }
.project-card-desc { color: var(--muted); font-size: 13px; line-height: 1.5; flex: 1; }

.project-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.project-last-run { font-size: 12px; color: var(--muted); }

.status-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}
.status-pill.passed  { background: rgba(62,207,142,0.12); color: var(--success); }
.status-pill.failed  { background: rgba(244,106,106,0.12); color: var(--danger); }
.status-pill.running { background: rgba(245,197,66,0.12);  color: var(--warning); }
.status-pill.pending { background: rgba(107,114,128,0.12); color: var(--muted); }
.status-pill.never   { background: rgba(107,114,128,0.08); color: var(--muted); }

/* ── Panel ── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* ── Form ── */
.form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 1;
  min-width: 140px;
}

.field label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.field input,
.field select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 13px;
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.field input:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91,141,238,0.12);
}
.field select option { background: var(--surface2); }

.btn-run {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s, box-shadow 0.15s, opacity 0.15s;
  white-space: nowrap;
  letter-spacing: 0.1px;
}
.btn-run:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 2px 12px rgba(91,141,238,0.35);
}
.btn-run:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-icon { font-size: 10px; }

.run-error { margin-top: 12px; color: var(--danger); font-size: 13px; }
.hidden { display: none !important; }

/* ── Active run banner ── */
.active-banner {
  background: rgba(245,197,66,0.07);
  border: 1px solid rgba(245,197,66,0.2);
  border-radius: var(--radius);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--warning);
  font-weight: 500;
  font-size: 14px;
}

/* ── Spinners ── */
.spinner {
  display: inline-block;
  vertical-align: middle;
  width: 16px; height: 16px;
  border: 2px solid rgba(245,197,66,0.25);
  border-top-color: var(--warning);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

.spinner-accent {
  border-color: rgba(91,141,238,0.2);
  border-top-color: var(--accent);
}

.spinner-btn {
  display: inline-block;
  vertical-align: middle;
  width: 10px; height: 10px;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

.btn-run-suite.btn-spinning {
  min-width: 36px;
  justify-content: center;
  opacity: 0.85;
  pointer-events: none;
}
.btn-run-test.btn-spinning {
  color: var(--accent);
  border-color: rgba(91,141,238,0.35);
  background: rgba(91,141,238,0.08);
  pointer-events: none;
  opacity: 1;
}

/* ── Results ── */
.results-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}
.results-header h2 { margin-bottom: 4px; }
.results-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.results-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.count-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}
.count-badge.passed   { background: rgba(62,207,142,0.14); color: var(--success); }
.count-badge.failed   { background: rgba(244,106,106,0.14); color: var(--danger); font-size: 13px; padding: 4px 12px; }
.count-badge.total    { background: rgba(107,114,128,0.12); color: var(--muted); }
.count-badge.duration { background: rgba(91,141,238,0.1);  color: var(--accent); }

.results-actions { display: flex; gap: 8px; flex-shrink: 0; }

.btn-toggle, .btn-secondary, .btn-refresh {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 7px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
}
.btn-toggle:hover, .btn-secondary:hover, .btn-refresh:hover {
  color: var(--text);
  border-color: var(--border-hover);
  background: rgba(255,255,255,0.03);
}
.btn-toggle.active {
  background: rgba(62,207,142,0.1);
  border-color: rgba(62,207,142,0.35);
  color: var(--success);
}

.section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin: 24px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.passed-label { color: var(--success); opacity: 0.7; }

/* ── Test result cards ── */
.test-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  overflow: hidden;
  background: var(--surface2);
  transition: box-shadow 0.15s;
}
.test-card:last-child { margin-bottom: 0; }
.test-card.failed {
  border-left: 4px solid var(--danger);
  background: rgba(244,106,106,0.03);
}
.test-card.passed { border-left: 4px solid var(--success); }

.test-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s;
}
.test-card-header:hover { background: rgba(255,255,255,0.025); }

.test-outcome-icon { font-size: 15px; flex-shrink: 0; }
.test-outcome-icon.failed { color: var(--danger); }
.test-outcome-icon.passed { color: var(--success); }

.test-name-wrap { flex: 1; min-width: 0; }
.test-name { font-weight: 600; font-size: 14px; }
.test-class { font-size: 11px; color: var(--muted); margin-top: 3px; }
.test-duration { font-size: 12px; color: var(--muted); flex-shrink: 0; }

.card-chevron {
  font-size: 9px;
  color: var(--muted);
  flex-shrink: 0;
  transition: transform 0.2s;
  margin-left: 2px;
}
.test-card.expanded .card-chevron { transform: rotate(180deg); }

.test-card-body {
  padding: 0 18px 16px;
  border-top: 1px solid var(--border);
  display: none;
}
.test-card.expanded .test-card-body { display: block; }

.error-message {
  background: rgba(244,106,106,0.06);
  border: 1px solid rgba(244,106,106,0.18);
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 14px;
  font-size: 13px;
  color: #f8a4a4;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.stack-trace-toggle {
  background: none; border: none;
  color: var(--muted); font-size: 12px;
  cursor: pointer; padding: 8px 0 4px;
  display: block; transition: color 0.15s;
}
.stack-trace-toggle:hover { color: var(--text-dim); }

.stack-trace {
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: 11px; color: var(--text-dim);
  background: var(--bg);
  border-radius: 7px; padding: 12px 14px;
  overflow-x: auto; white-space: pre;
  line-height: 1.6; margin-top: 4px;
  display: none;
}
.stack-trace.visible { display: block; }

/* ── Test card artifacts ── */
.test-card-artifacts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.test-card-artifacts .artifact-thumb img {
  width: 120px; height: 75px;
}

/* ── Artifacts ── */
.artifact-video-thumb {
  position: relative;
  width: 160px; height: 100px;
  border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  background: #000;
  transition: border-color 0.15s, transform 0.15s;
  flex-shrink: 0;
}
.artifact-video-thumb:hover { border-color: var(--accent); transform: scale(1.02); }
.artifact-video-thumb video {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  pointer-events: none;
}
.play-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.5);
  color: #fff; font-size: 22px;
  transition: background 0.15s;
}
.artifact-video-thumb:hover .play-overlay { background: rgba(0,0,0,0.3); }

.test-card-artifacts .artifact-video-thumb { width: 120px; height: 75px; }

#video-modal-src {
  max-width: 95vw; max-height: 88vh;
  display: block; border-radius: 8px; background: #000;
}

.artifact-trace-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--text); text-decoration: none; font-size: 13px;
  background: var(--surface); transition: border-color 0.15s, background 0.15s;
  white-space: nowrap;
}
.artifact-trace-link:hover { border-color: var(--accent); background: var(--hover); }

.artifact-thumb {
  border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer; transition: border-color 0.15s, transform 0.15s;
}
.artifact-thumb:hover { border-color: var(--accent); transform: scale(1.02); }
.artifact-thumb img {
  display: block; width: 160px; height: 100px; object-fit: cover;
}

/* ── Run history ── */
.runs-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.runs-header h2 { margin-bottom: 0; }
.btn-refresh { font-size: 16px; padding: 5px 10px; }

.empty-state, .loading-state {
  text-align: center; color: var(--muted);
  padding: 48px 0; font-size: 14px;
  line-height: 1.6;
}
.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-dim);
}

.run-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.run-card:last-child { margin-bottom: 0; }
.run-card:hover {
  border-color: var(--border-hover);
  background: rgba(255,255,255,0.02);
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}

.status-dot {
  width: 10px; height: 10px;
  border-radius: 50%; flex-shrink: 0;
}
.status-dot.pending { background: var(--muted); }
.status-dot.running { background: var(--warning); animation: pulse 1.2s ease-in-out infinite; }
.status-dot.passed  { background: var(--success); }
.status-dot.failed  { background: var(--danger); }
.status-dot.error   { background: var(--danger); }
.status-dot.cancelled { background: var(--muted); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.4); }
}

.run-info { flex: 1; min-width: 0; }
.run-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.run-time { font-size: 13px; font-weight: 600; color: var(--text); }
.run-filter { font-size: 11px; color: var(--accent); background: rgba(91,141,238,0.1); padding: 1px 8px; border-radius: 10px; }
.run-meta { font-size: 12px; color: var(--muted); }
.run-status-label { font-size: 12px; font-weight: 500; }
.run-status-label.running, .run-status-label.pending { color: var(--warning); }
.run-status-label.error { color: var(--danger); }
.run-status-label.cancelled { color: var(--muted); }
.run-counts { display: flex; gap: 8px; align-items: center; }

/* ── Modals ── */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
}
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.7); }
.modal-box {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 90%; max-width: 860px; max-height: 80vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 14px;
}
.modal-close {
  background: none; border: none;
  color: var(--muted); font-size: 20px;
  cursor: pointer; line-height: 1; transition: color 0.15s;
}
.modal-close:hover { color: var(--text); }
.output-pre {
  flex: 1; overflow-y: auto; padding: 20px;
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: 12px; line-height: 1.6;
  color: var(--text-dim); white-space: pre-wrap; word-break: break-word;
}

.img-modal-box {
  position: relative;
  max-width: 95vw; max-height: 90vh;
}
.img-modal-box img {
  max-width: 95vw; max-height: 88vh;
  display: block; border-radius: 10px;
}
.img-modal-close {
  position: absolute; top: -44px; right: 0;
  background: rgba(255,255,255,0.1); border: none;
  color: var(--text); font-size: 22px;
  border-radius: 50%; width: 36px; height: 36px;
  cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  transition: background 0.15s;
}
.img-modal-close:hover { background: rgba(255,255,255,0.18); }

/* ── Test list panel ── */
.test-list-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

.test-list-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.test-search-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 13px;
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  width: 220px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.test-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91,141,238,0.12);
}

.test-count-badge {
  font-size: 11px;
  background: rgba(107,114,128,0.15);
  color: var(--muted);
  padding: 2px 9px;
  border-radius: 10px;
  font-weight: 600;
  margin-left: 6px;
  vertical-align: middle;
}

.btn-stop {
  background: rgba(244,106,106,0.08);
  border: 1px solid rgba(244,106,106,0.25);
  color: var(--danger);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 7px;
}
.btn-stop::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  background: currentColor;
  border-radius: 2px;
  flex-shrink: 0;
}
.btn-stop:hover:not(:disabled) { background: rgba(244,106,106,0.16); }
.btn-stop:disabled { opacity: 0.3; cursor: not-allowed; }

.btn-run-suite {
  background: rgba(91,141,238,0.07);
  border: 1px solid rgba(91,141,238,0.2);
  color: var(--accent);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
  margin-left: auto;
  opacity: 0;
}
.test-group-header:hover .btn-run-suite { opacity: 1; }
.btn-run-suite:hover:not(:disabled) {
  background: rgba(91,141,238,0.15);
  border-color: var(--accent);
}
.btn-run-suite:disabled { opacity: 0.3 !important; cursor: not-allowed; }

/* ── Test groups ── */
.test-group { margin-bottom: 6px; }

.test-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, border-color 0.15s;
}
.test-group-header:hover {
  background: rgba(255,255,255,0.03);
  border-color: var(--border-hover);
}
.test-group:not(.collapsed) .test-group-header {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.group-toggle-icon {
  font-size: 9px;
  color: var(--muted);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.test-group.collapsed .group-toggle-icon { transform: rotate(-90deg); }

.group-name  { font-weight: 600; font-size: 14px; flex: 1; }
.group-count { font-size: 12px; color: var(--muted); white-space: nowrap; }
.group-badges { display: flex; gap: 6px; }

.group-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 10px;
}
.group-badge.passed { background: rgba(62,207,142,0.12); color: var(--success); }
.group-badge.failed { background: rgba(244,106,106,0.12); color: var(--danger); }

.test-group-body {
  border: 1px solid var(--border);
  border-top: none;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  overflow: hidden;
}
.test-group.collapsed .test-group-body { display: none; }

/* ── Test rows ── */
.test-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.test-row:last-child { border-bottom: none; }
.test-row:hover { background: rgba(255,255,255,0.025); }

.test-row-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.test-row-dot.passed  { background: var(--success); }
.test-row-dot.failed  { background: var(--danger); }
.test-row-dot.unknown { background: transparent; border: 1px solid var(--border-hover); }
.test-row-dot.running {
  background: transparent;
  border: 1.5px solid var(--warning);
  border-top-color: transparent;
  animation: spin 0.7s linear infinite;
}

.test-row.row-running { background: rgba(245,197,66,0.04); }

.test-group.suite-running > .test-group-header {
  background: rgba(245,197,66,0.05);
  border-color: rgba(245,197,66,0.25);
}

.suite-spinner { flex-shrink: 0; margin-left: 2px; }

.test-row-name {
  flex: 1;
  font-size: 13px;
  color: var(--text);
}

.btn-run-test {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 11px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s, opacity 0.15s;
  flex-shrink: 0;
  opacity: 0;
}
.test-row:hover .btn-run-test,
.btn-run-test.btn-spinning { opacity: 1; }
.btn-run-test:hover:not(:disabled) {
  color: var(--accent);
  border-color: rgba(91,141,238,0.5);
  background: rgba(91,141,238,0.08);
}
.btn-run-test:disabled { opacity: 0.3 !important; cursor: not-allowed; }

/* Result card rerun button — always visible since it's a primary action there */
.btn-rerun { opacity: 1 !important; }

@media (max-width: 640px) {
  main { padding: 16px; gap: 16px; }
  .panel { padding: 18px; }
  .form-row { flex-direction: column; }
  .results-header { flex-direction: column; align-items: flex-start; }
  .test-list-top { flex-direction: column; align-items: flex-start; }
  .test-search-input { width: 100%; }
}

/* ── Login page ── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
}

.login-sub { color: var(--muted); font-size: 13px; }

.hidden { display: none !important; }

.btn-ms-signin {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  width: 100%;
  transition: border-color 0.15s, background 0.15s;
}
.btn-ms-signin:hover { border-color: var(--border-hover); background: rgba(255,255,255,0.04); }

.login-error {
  color: var(--danger);
  font-size: 13px;
}

/* ── User info ── */
.user-info { display: flex; align-items: center; gap: 10px; }
.user-name { font-size: 13px; color: var(--text-dim); }

.btn-signout {
  font-size: 12px;
  color: var(--muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 10px;
  cursor: pointer;
  font-family: var(--font);
  transition: color 0.15s, border-color 0.15s;
}

.btn-signout:hover { color: var(--text); border-color: var(--border-hover); }
