/* Atlas Command Center dashboard — dark design system. Zero external resources. */

:root {
  --bg: #0b0f17;
  --panel: #121826;
  --panel-raised: #161e30;
  --border: #1f2937;
  --border-soft: #1a2233;
  --text: #e5eaf3;
  --text-dim: #94a3b8;
  --text-faint: #64748b;
  --accent-a: #6366f1;
  --accent-b: #22d3ee;
  --c-passed: #2dd4a7;
  --c-failed: #f4587a;
  --c-running: #38bdf8;
  --c-queued: #eab308;
  --c-error: #fb923c;
  --c-cancelled: #6b7280;
  --c-env-qa: #22d3ee;
  --c-env-staging: #eab308;
  --c-env-sandbox: #a78bfa;
  --c-env-dev: #60a5fa;
  --c-env-prod: #f4587a;
  --c-env-other: #94a3b8;
  --terminal-bg: #0a0d14;
  --radius: 12px;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }

/* author display rules (flex/inline-flex) must never override the hidden attribute */
[hidden] { display: none !important; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(1200px 500px at 80% -200px, rgba(99, 102, 241, 0.09), transparent 60%),
    radial-gradient(900px 400px at 10% -150px, rgba(34, 211, 238, 0.06), transparent 60%);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--font-mono); }

main {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---------------------------------------------------------------- header */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 15, 23, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
}

.topbar-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.logo { flex: 0 0 auto; display: block; }

.brand {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  background: linear-gradient(120deg, #a5b4fc, #67e8f9);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.version-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 999px;
  padding: 2px 9px;
}

.banner-unreachable {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--c-failed);
  background: rgba(244, 88, 122, 0.12);
  border: 1px solid rgba(244, 88, 122, 0.35);
  border-radius: 999px;
  padding: 3px 11px;
}

.banner-unreachable .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-failed);
  animation: pulse 1.2s ease-in-out infinite;
}

.meta-chip {
  font-size: 12px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 999px;
  padding: 3px 11px;
  white-space: nowrap;
}

.meta-chip.next-run {
  color: #a5b4fc;
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.1);
}

.panel-card .panel-card-spacer { flex: 1 1 auto; min-height: 18px; }
.panel-card .suite-desc { -webkit-line-clamp: 4; }

/* ---------------------------------------------------- group sub-screen */
.group-screen {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.group-screen-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.group-screen-title {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.group-screen-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-dim);
  max-width: 720px;
}

.btn-back { padding: 6px 13px; }

.notice-modal { max-width: 420px; }
.notice-body { padding: 8px 4px 4px; }
.notice-message {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
}

.meta-chip.host-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  border-color: rgba(34, 211, 238, 0.35);
  background: rgba(34, 211, 238, 0.08);
}

.host-chip .host-icon { font-size: 11px; opacity: 0.85; }

.host-chip .host-branch {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #22d3ee;
  padding-left: 6px;
  margin-left: 2px;
  border-left: 1px solid rgba(34, 211, 238, 0.3);
}

/* ---------------------------------------------------------------- panels */

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.panel-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.panel-head-right {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.panel-sub {
  font-size: 12px;
  color: var(--text-faint);
  font-weight: 400;
}

/* ----------------------------------------------------------- status chips */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 999px;
  padding: 2px 10px 2px 8px;
  white-space: nowrap;
}

.chip::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}

.chip.passed { color: var(--c-passed); background: rgba(45, 212, 167, 0.12); }
.chip.failed { color: var(--c-failed); background: rgba(244, 88, 122, 0.12); }
.chip.running { color: var(--c-running); background: rgba(56, 189, 248, 0.12); }
.chip.running::before { animation: pulse 1.2s ease-in-out infinite; }
.chip.queued { color: var(--c-queued); background: rgba(234, 179, 8, 0.12); }
.chip.error { color: var(--c-error); background: rgba(251, 146, 60, 0.13); }
.chip.cancelled { color: var(--c-cancelled); background: rgba(107, 114, 128, 0.16); }

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

.pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-running);
  animation: pulse 1.2s ease-in-out infinite;
  flex: 0 0 auto;
}

/* --------------------------------------------------------------- buttons */

.btn {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-raised);
  color: var(--text);
  padding: 6px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: filter 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.btn:hover:not(:disabled) { filter: brightness(1.15); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { cursor: default; opacity: 0.75; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  border: none;
  color: #fff;
  box-shadow: 0 2px 10px rgba(79, 119, 230, 0.35);
}

.btn-primary:hover:not(:disabled) { box-shadow: 0 3px 16px rgba(79, 119, 230, 0.5); }

.btn-run.running {
  color: var(--c-running);
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.08);
}

.btn-run.queued {
  color: var(--c-queued);
  border-color: rgba(234, 179, 8, 0.35);
  background: rgba(234, 179, 8, 0.07);
}

.btn-danger {
  color: var(--c-failed);
  border-color: rgba(244, 88, 122, 0.4);
  background: rgba(244, 88, 122, 0.08);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-dim);
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 15px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
}

.icon-btn:hover { color: var(--text); background: var(--panel-raised); }

/* ------------------------------------------------------------ suite grid */

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

.suite-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 150ms ease, transform 150ms ease;
}

.suite-card:hover { border-color: #2b3a55; transform: translateY(-1px); }

.suite-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.suite-name {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  min-width: 0;
}

.suite-desc {
  font-size: 12.5px;
  color: var(--text-dim);
  margin: 0;
  min-height: 2.6em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.suite-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12px;
  color: var(--text-dim);
  min-height: 20px;
}

.stats-inline { display: inline-flex; gap: 10px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat.ok { color: var(--c-passed); }
.stat.bad { color: var(--c-failed); }
.stat.flaky { color: var(--c-queued); }
.stat.muted { color: var(--text-faint); font-weight: 400; }

.suite-spark {
  height: 38px;
  display: flex;
  align-items: flex-end;
}

.sparkline { height: 36px; display: block; }
.sparkline rect { transition: opacity 100ms ease; }
.sparkline rect:hover { opacity: 0.75; }

.spark-passed { fill: var(--c-passed); }
.spark-failed { fill: var(--c-failed); }
.spark-running { fill: var(--c-running); }
.spark-queued { fill: var(--c-queued); }
.spark-error { fill: var(--c-error); }
.spark-cancelled { fill: var(--c-cancelled); }

.spark-empty {
  font-size: 11.5px;
  color: var(--text-faint);
  font-style: italic;
}

.suite-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}

.schedule-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-faint);
}

/* -------------------------------------------------------------- activity */

.activity { min-height: 120px; }

.queued-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.queued-label { font-size: 12px; color: var(--text-faint); font-weight: 600; }

.queued-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--c-queued);
  background: rgba(234, 179, 8, 0.1);
  border: 1px solid rgba(234, 179, 8, 0.3);
  border-radius: 999px;
  padding: 3px 6px 3px 11px;
}

.queued-chip .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-queued);
}

.chip-x {
  background: transparent;
  border: none;
  color: inherit;
  opacity: 0.6;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 1px 5px;
  border-radius: 50%;
}

.chip-x:hover { opacity: 1; background: rgba(234, 179, 8, 0.18); }

.terminal {
  background: var(--terminal-bg);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  height: 380px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 14px;
}

.terminal-pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  color: #c4d0e0;
  white-space: pre-wrap;
  word-break: break-word;
}

.elapsed {
  font-size: 13px;
  color: var(--c-running);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.run-summary {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.summary-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 13px;
  color: var(--text-dim);
}

.summary-row .label { color: var(--text-faint); font-size: 12px; }

.git-line {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.error-note {
  font-size: 12.5px;
  color: var(--c-error);
  background: rgba(251, 146, 60, 0.08);
  border: 1px solid rgba(251, 146, 60, 0.3);
  border-radius: 8px;
  padding: 9px 13px;
  font-family: var(--font-mono);
  white-space: pre-wrap;
  word-break: break-word;
}

.failed-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--c-failed);
  margin: 2px 0 0;
}

.failed-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.failed-list details {
  border: 1px solid rgba(244, 88, 122, 0.22);
  background: rgba(244, 88, 122, 0.05);
  border-radius: 8px;
  overflow: hidden;
}

.failed-list summary {
  cursor: pointer;
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: 9px;
  list-style: none;
}

.failed-list summary::-webkit-details-marker { display: none; }
.failed-list summary::before { content: '✕'; color: var(--c-failed); font-weight: 700; flex: 0 0 auto; }
.failed-list details[open] summary { border-bottom: 1px solid rgba(244, 88, 122, 0.18); }

.failed-title { min-width: 0; overflow-wrap: anywhere; }

.failed-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }

.failed-file {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
  overflow-wrap: anywhere;
}

.failed-error {
  margin: 0;
  background: var(--terminal-bg);
  border-radius: 6px;
  padding: 9px 11px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  color: #f0a8b8;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 180px;
  overflow-y: auto;
}

/* Consistent failures (same test failed 3+ runs in a row) */

.consistent-title { color: var(--c-error); }

.consistent-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.consistent-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(251, 146, 60, 0.25);
  background: rgba(251, 146, 60, 0.06);
  border-radius: 8px;
  padding: 8px 12px;
}

.consistent-row .badge.streak { flex: 0 0 auto; white-space: nowrap; }

.consistent-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.consistent-test-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}

.consistent-file {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  overflow-wrap: anywhere;
}

.consistent-diag { flex: 0 0 auto; }

.consistent-empty {
  font-size: 12px;
  color: var(--text-faint);
}

/* --------------------------------------------------------------- history */

.history-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.select {
  font-family: var(--font-sans);
  font-size: 12.5px;
  color: var(--text);
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.filter-chip {
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  cursor: pointer;
  transition: all 120ms ease;
}

.filter-chip:hover { color: var(--text); border-color: #334155; }

.filter-chip.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  border-color: transparent;
}

.filter-chip.active.passed { background: var(--c-passed); color: #062a20; }
.filter-chip.active.failed { background: var(--c-failed); color: #fff; }
.filter-chip.active.running { background: var(--c-running); color: #06283a; }
.filter-chip.active.queued { background: var(--c-queued); color: #2a2104; }
.filter-chip.active.error { background: var(--c-error); color: #3a1c04; }
.filter-chip.active.cancelled { background: var(--c-cancelled); color: #fff; }

.table-wrap { overflow-x: auto; }

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.history-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.history-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  white-space: nowrap;
}

.history-table tbody tr { transition: background 100ms ease; }
.history-table tbody tr:hover { background: rgba(99, 102, 241, 0.05); }
.history-table tbody tr:last-child td { border-bottom: none; }

.run-id {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-dim);
}

.trigger-cell { color: var(--text-faint); font-size: 12px; }

.actions-cell { display: flex; gap: 8px; align-items: center; }

.link-report {
  color: #67e8f9;
  text-decoration: none;
  font-weight: 600;
  font-size: 12px;
}

.link-report:hover { text-decoration: underline; }

.btn-log {
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 10px;
  cursor: pointer;
}

.btn-log:hover { color: var(--text); border-color: #334155; }

/* -------------------------------------------------------------- insights */

.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.insight-panel { display: flex; flex-direction: column; gap: 0; }

.insight-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.insight-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-soft);
}

.insight-item:last-child { border-bottom: none; }
.insight-item.col { flex-direction: column; align-items: stretch; gap: 6px; }

.insight-main { min-width: 0; flex: 1; }

.insight-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.insight-file {
  font-size: 11px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.insight-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.insight-times {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  flex: 0 0 auto;
}

.insight-badges { display: flex; gap: 6px; flex: 0 0 auto; }

.badge {
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  padding: 2px 8px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.badge.flaky { color: var(--c-queued); background: rgba(234, 179, 8, 0.12); }
.badge.bad { color: var(--c-failed); background: rgba(244, 88, 122, 0.12); }
.badge.streak { color: var(--c-error); background: rgba(251, 146, 60, 0.13); }

.bar-track {
  height: 6px;
  border-radius: 3px;
  background: var(--border-soft);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
  min-width: 3px;
}

.more-note {
  font-size: 11.5px;
  color: var(--text-faint);
  padding-top: 8px;
  text-align: center;
}

/* ---------------------------------------------------- environment chips/picker */

/* small uppercase env chip shown on suite cards, the latest-run header and history rows */
.env-chip {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border-radius: 5px;
  padding: 1px 6px;
  white-space: nowrap;
  text-transform: uppercase;
  color: var(--c-env-other);
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.env-chip.env-qa { color: var(--c-env-qa); background: rgba(34, 211, 238, 0.12); border-color: rgba(34, 211, 238, 0.35); }
.env-chip.env-staging { color: var(--c-env-staging); background: rgba(234, 179, 8, 0.12); border-color: rgba(234, 179, 8, 0.35); }
.env-chip.env-sandbox { color: var(--c-env-sandbox); background: rgba(167, 139, 250, 0.14); border-color: rgba(167, 139, 250, 0.35); }
.env-chip.env-dev { color: var(--c-env-dev); background: rgba(96, 165, 250, 0.13); border-color: rgba(96, 165, 250, 0.35); }
.env-chip.env-prod { color: var(--c-env-prod); background: rgba(244, 88, 122, 0.13); border-color: rgba(244, 88, 122, 0.35); }

.suite-cell { display: inline-flex; align-items: center; gap: 8px; }

/* env picker modal */
.env-modal { width: min(540px, 100%); }

.env-modal-title {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
}

.env-modal-suite { color: var(--text-dim); font-weight: 600; }

.env-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
}

.env-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.env-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-sans);
  min-height: 78px;
  padding: 16px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-raised);
  color: var(--text);
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.env-option:hover:not(:disabled) { transform: translateY(-1px); }
.env-option:active:not(:disabled) { transform: translateY(0); }
.env-option:disabled { cursor: default; opacity: 0.6; }

.env-option:focus-visible { outline: none; }

.env-option-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.env-option-tag {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* per-env accent for the option cards (border + name color), echoing the chip palette */
.env-option.env-qa { border-color: rgba(34, 211, 238, 0.4); }
.env-option.env-qa .env-option-name { color: var(--c-env-qa); }
.env-option.env-qa:hover:not(:disabled) { background: rgba(34, 211, 238, 0.08); box-shadow: 0 3px 14px rgba(34, 211, 238, 0.18); }

.env-option.env-staging { border-color: rgba(234, 179, 8, 0.4); }
.env-option.env-staging .env-option-name { color: var(--c-env-staging); }
.env-option.env-staging:hover:not(:disabled) { background: rgba(234, 179, 8, 0.08); box-shadow: 0 3px 14px rgba(234, 179, 8, 0.18); }

.env-option.env-sandbox { border-color: rgba(167, 139, 250, 0.4); }
.env-option.env-sandbox .env-option-name { color: var(--c-env-sandbox); }
.env-option.env-sandbox:hover:not(:disabled) { background: rgba(167, 139, 250, 0.08); box-shadow: 0 3px 14px rgba(167, 139, 250, 0.18); }

.env-option.env-dev { border-color: rgba(96, 165, 250, 0.4); }
.env-option.env-dev .env-option-name { color: var(--c-env-dev); }
.env-option.env-dev:hover:not(:disabled) { background: rgba(96, 165, 250, 0.08); box-shadow: 0 3px 14px rgba(96, 165, 250, 0.18); }

.env-option.env-prod { border-color: rgba(244, 88, 122, 0.4); }
.env-option.env-prod .env-option-name { color: var(--c-env-prod); }
.env-option.env-prod:hover:not(:disabled) { background: rgba(244, 88, 122, 0.08); box-shadow: 0 3px 14px rgba(244, 88, 122, 0.18); }

.env-option.env-other:hover:not(:disabled) { background: rgba(148, 163, 184, 0.08); }

/* the last-used env is ringed so the common case is a single extra click */
.env-option.is-last { box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.5); }
.env-option.is-last:focus-visible,
.env-option:focus-visible { box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.7); }

.env-note {
  margin: 0;
  font-size: 12px;
  color: var(--text-faint);
}

.env-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--c-running);
}

.env-status.env-error {
  display: block;
  color: var(--c-error);
  background: rgba(251, 146, 60, 0.08);
  border: 1px solid rgba(251, 146, 60, 0.3);
  border-radius: 8px;
  padding: 9px 13px;
  font-weight: 500;
}

/* ----------------------------------------------------------------- modal */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(4, 6, 12, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  width: min(960px, 100%);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-head .run-id { font-size: 13px; color: var(--text); }

.modal-sub { font-size: 12px; color: var(--text-faint); flex: 1; }

.modal-log {
  margin: 0;
  padding: 14px 18px;
  overflow: auto;
  flex: 1;
  background: var(--terminal-bg);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  color: #c4d0e0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ------------------------------------------------------ diagnose (AI) ---- */

.btn-diagnose {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  color: #a5b4fc;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 6px;
  padding: 3px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 120ms ease;
}

.btn-diagnose:hover {
  color: #c7d2fe;
  border-color: rgba(99, 102, 241, 0.7);
  background: rgba(99, 102, 241, 0.15);
}

.btn-diagnose .ai-icon { flex: 0 0 auto; }

.btn-diagnose.has-diagnosis {
  color: var(--c-passed);
  border-color: rgba(45, 212, 167, 0.35);
  background: rgba(45, 212, 167, 0.07);
}

.btn-diagnose.has-diagnosis:hover {
  border-color: rgba(45, 212, 167, 0.6);
  background: rgba(45, 212, 167, 0.12);
}

.btn-diagnose.has-diagnosis.running {
  color: var(--c-running);
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.07);
}

.btn-diagnose .pulse-dot {
  width: 7px;
  height: 7px;
  background: currentColor;
}

.diag-head-icon {
  display: inline-flex;
  color: #a5b4fc;
  flex: 0 0 auto;
}

.diag-head-icon .ai-icon { width: 15px; height: 15px; }

.diag-modal-title {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
}

.diag-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding: 18px;
  min-height: 160px;
}

.diag-form { display: flex; flex-direction: column; gap: 10px; }

.diag-intro {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-dim);
}

.diag-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}

.diag-context {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  resize: vertical;
  min-height: 76px;
  width: 100%;
}

.diag-context::placeholder { color: var(--text-faint); }
.diag-context:focus { outline: none; border-color: rgba(99, 102, 241, 0.6); }

.diag-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.diag-running {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 36px 20px;
  text-align: center;
}

.diag-running-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 700;
  color: var(--c-running);
}

.diag-running-note {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-faint);
  max-width: 440px;
}

.diag-loading {
  padding: 28px;
  text-align: center;
  font-size: 13px;
  color: var(--text-faint);
}

.diag-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 12px;
  color: var(--text-faint);
}

.diag-meta-context {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.diag-hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-dim);
}

/* rendered diagnosis markdown */

.md {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text);
  overflow-wrap: anywhere;
}

.md h2 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 18px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-soft);
}

.md h2:first-child { margin-top: 0; }

.md h3 {
  font-size: 13.5px;
  font-weight: 700;
  margin: 14px 0 6px;
}

.md p { margin: 0 0 10px; }
.md p:last-child { margin-bottom: 0; }

.md ul {
  margin: 0 0 10px;
  padding-left: 22px;
}

.md li { margin: 3px 0; }

.md strong { font-weight: 700; }

.md a {
  color: #67e8f9;
  text-decoration: none;
}

.md a:hover { text-decoration: underline; }

.md .md-code-inline {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #c4d0e0;
  background: var(--terminal-bg);
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  padding: 1px 5px;
}

.md .md-code {
  margin: 0 0 12px;
  background: var(--terminal-bg);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 11px 13px;
  overflow-x: auto;
}

.md .md-code code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.55;
  color: #c4d0e0;
  white-space: pre;
}

.verdict {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  border-radius: 6px;
  padding: 1px 8px;
  white-space: nowrap;
  vertical-align: baseline;
}

.verdict-bug {
  color: var(--c-failed);
  background: rgba(244, 88, 122, 0.13);
  border: 1px solid rgba(244, 88, 122, 0.3);
}

.verdict-outdated {
  color: var(--c-queued);
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.verdict-flaky {
  color: var(--c-running);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

/* ----------------------------------------------------------- empty states */

.empty-state {
  padding: 22px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--text-faint);
}

.empty-state.big { padding: 40px 20px; }

.empty-emoji { font-size: 30px; margin-bottom: 8px; }

.empty-state code {
  display: inline-block;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: #67e8f9;
  background: var(--terminal-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
}

/* ---------------------------------------------------------- skeleton/misc */

.skeleton-card { display: flex; flex-direction: column; gap: 12px; min-height: 150px; }

.skeleton-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--border-soft), #243049, var(--border-soft));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

.skeleton-line.w40 { width: 40%; }
.skeleton-line.w60 { width: 60%; }
.skeleton-line.w90 { width: 90%; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.noscript-note { color: var(--text); text-align: center; padding: 40px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #273349; border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #334360; }

@media (max-width: 720px) {
  main { padding: 16px 14px 60px; }
  .group-screen { padding: 16px 14px 60px; }
  .topbar-inner { padding: 10px 14px; }
  .meta-chip { display: none; }
  .meta-chip.next-run { display: inline-flex; }
  .meta-chip.host-chip { display: inline-flex; }
}
