/* ============================================================
   TollGate Router Tests — Design System
   Dark theme (#0a0a0a bg) · TollGate orange (#f60) accents
   Vanilla CSS, no dependencies, no web fonts.
   ============================================================ */

:root {
  /* Base palette — tests.cashu.email dark */
  --bg:           #0a0a0a;
  --bg-secondary: #121212;
  --bg-elevated:  #181818;
  --bg-hover:     #1e1e1e;
  --bg-active:    #242424;
  --border:       #1e1e1e;
  --border-light: #2e2e2e;

  /* Text */
  --text:         #e0e0e0;
  --text-muted:   #888;
  --text-dim:     #555;

  /* Accents — TollGate orange */
  --accent:       #f60;
  --accent-hover: #ff8533;
  --accent-dim:   rgba(255, 102, 0, 0.15);

  /* Semantic */
  --green:        #3fb950;
  --green-dim:    rgba(63, 185, 80, 0.15);
  --blue:         #58a6ff;
  --blue-dim:     rgba(88, 166, 255, 0.15);
  --red:          #f85149;
  --red-dim:      rgba(248, 81, 73, 0.15);
  --yellow:       #d29922;
  --yellow-dim:   rgba(210, 153, 34, 0.15);

  /* Typography — system fonts only */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, 'Helvetica Neue', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Code', 'Menlo', Consolas, 'Liberation Mono', monospace;

  /* Radii */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow:    0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.6);

  /* Transitions */
  --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   Reset & Base
   ============================================================ */

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

html, body {
  height: 100%;
  overscroll-behavior: none;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ============================================================
   Header
   ============================================================ */

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  height: 56px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 100;
}

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

#menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
#menu-toggle:hover {
  color: var(--accent);
  background: var(--bg-hover);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-mark {
  font-size: 14px;
  font-weight: 800;
  color: var(--bg);
  background: var(--accent);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  line-height: 1;
  letter-spacing: 0.02em;
}

.header-left h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-dim);
  font-size: 12px;
  padding-left: 12px;
  border-left: 1px solid var(--border-light);
  white-space: nowrap;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Connection badge */
.conn-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid;
  white-space: nowrap;
}
.conn-badge.offline {
  color: var(--red);
  background: var(--red-dim);
  border-color: rgba(248, 81, 73, 0.3);
}
.conn-badge.partial {
  color: var(--yellow);
  background: var(--yellow-dim);
  border-color: rgba(210, 153, 34, 0.3);
}
.conn-badge.online {
  color: var(--green);
  background: var(--green-dim);
  border-color: rgba(63, 185, 80, 0.3);
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 20px;
  border: 1px solid;
  white-space: nowrap;
  transition: var(--transition);
}
.live-indicator .live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.live-indicator.idle {
  color: var(--text-dim);
  background: var(--bg-secondary);
  border-color: var(--border);
}
.live-indicator.idle .live-dot {
  background: var(--text-dim);
}
.live-indicator.live {
  color: var(--green);
  background: var(--green-dim);
  border-color: rgba(63, 185, 80, 0.3);
}
.live-indicator.live .live-dot {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: live-pulse 2s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  transition: var(--transition);
}
.link:hover { color: var(--accent); }

.npub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ============================================================
   Layout: Main + Sidebar
   ============================================================ */

main {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

.sidebar-backdrop {
  display: none;
}

/* ============================================================
   Sidebar — Runs List
   ============================================================ */

aside#runs-list {
  width: 340px;
  min-width: 340px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   Sidebar Controls — Search / Filter / Sort
   ============================================================ */

.sidebar-controls {
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.search-input {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  outline: none;
  transition: var(--transition);
}
.search-input::placeholder {
  color: var(--text-dim);
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.filter-toggles {
  display: flex;
  gap: 4px;
}

.filter-btn {
  flex: 1;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-sans);
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}
.filter-btn:hover {
  color: var(--text);
  border-color: var(--text-dim);
}
.filter-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

.sort-select {
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  font-family: var(--font-sans);
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}
.sort-select:hover {
  border-color: var(--text-dim);
  color: var(--text);
}
.sort-select:focus {
  border-color: var(--accent);
}

.runner-filter {
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}
.runner-filter:hover {
  border-color: var(--text-dim);
  color: var(--text);
}
.runner-filter:focus {
  border-color: var(--accent);
}

.age-filter {
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  font-family: var(--font-sans);
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}
.age-filter:hover {
  border-color: var(--text-dim);
  color: var(--text);
}
.age-filter:focus {
  border-color: var(--accent);
}

/* Runs scroll container */
.runs-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

/* No data indicator in sidebar cards */
.pf-no-data {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  font-style: italic;
}

/* No runs match filters */
.no-match {
  padding: 30px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}

.runs-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 10px 6px;
}

.run-card {
  padding: 12px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  margin-bottom: 4px;
  position: relative;
  animation: fadeInUp 0.3s ease forwards;
  opacity: 0;
}

.run-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}

.run-card.active {
  background: var(--bg-active);
  border-color: var(--accent);
}
.run-card.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

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

.run-id {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}

.run-card-pf {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pf-text {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.pf-pass-num { color: var(--green); font-weight: 600; margin-right: 2px; }
.pf-fail-num { color: var(--red); font-weight: 600; margin-right: 2px; }

/* Pass/fail bar */
.pf-bar {
  display: flex;
  height: 4px;
  width: 100%;
  border-radius: 2px;
  overflow: hidden;
  background: var(--bg);
  margin-bottom: 8px;
}
.pf-seg {
  height: 100%;
  transition: width 200ms ease;
}
.pf-pass { background: var(--green); }
.pf-fail { background: var(--red); }
.pf-skip { background: var(--yellow); }

.run-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.meta-chip {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.meta-chip-branch { color: var(--blue); border-color: rgba(88,166,255,0.2); }
.meta-chip-pr { color: var(--accent); border-color: rgba(255,102,0,0.2); }

.run-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.run-card-footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.runner-npub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.runner-code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-light);
}

.dvm-status-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid;
  white-space: nowrap;
}

.dvm-status-processing {
  color: var(--yellow);
  background: var(--yellow-dim);
  border-color: rgba(210, 153, 34, 0.3);
}

.dvm-status-success {
  color: var(--green);
  background: var(--green-dim);
  border-color: rgba(63, 185, 80, 0.3);
}

.dvm-status-error,
.dvm-status-failed {
  color: var(--red);
  background: var(--red-dim);
  border-color: rgba(248, 81, 73, 0.3);
}

.dvm-status-partial {
  color: var(--yellow);
  background: var(--yellow-dim);
  border-color: rgba(210, 153, 34, 0.3);
}

.run-card .timestamp {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}
.run-card .relative {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  opacity: 0.7;
}

/* Status dots */
.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-success { background: var(--green); box-shadow: 0 0 6px rgba(63, 185, 80, 0.5); }
.status-partial { background: var(--yellow); box-shadow: 0 0 6px rgba(210, 153, 34, 0.5); }
.status-error   { background: var(--red); box-shadow: 0 0 6px rgba(248, 81, 73, 0.5); }

.status-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 20px;
  border: 1px solid;
  white-space: nowrap;
  flex-shrink: 0;
}
.status-badge.passed {
  color: var(--green);
  background: var(--green-dim);
  border-color: rgba(63, 185, 80, 0.3);
}
.status-badge.failed {
  color: var(--red);
  background: var(--red-dim);
  border-color: rgba(248, 81, 73, 0.3);
}
.status-badge.unknown {
  color: var(--text-dim);
  background: var(--bg);
  border-color: var(--border-light);
}

/* Sidebar empty state */
.runs-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}
.runs-empty-icon {
  font-size: 32px;
  margin-bottom: 12px;
  opacity: 0.5;
}
.runs-empty p { margin-bottom: 8px; font-size: 13px; }
.runs-empty .hint { font-size: 12px; line-height: 1.8; color: var(--text-dim); }

/* Detail view placeholder (lazy load) */
.run-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  height: 100%;
  min-height: 300px;
  text-align: center;
  color: var(--text-muted);
}
.run-placeholder-icon {
  font-size: 40px;
  opacity: 0.4;
}
.run-placeholder p { font-size: 14px; margin: 0; }
.run-placeholder .hint { font-size: 12px; color: var(--text-dim); }

/* ============================================================
   Loading & Connecting States
   ============================================================ */

.loading {
  padding: 20px;
  text-align: center;
}

.connecting {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 30px 20px;
}

.connecting p {
  color: var(--text-muted);
  font-size: 13px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.relay-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.relay-chip {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  background: var(--bg);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* ============================================================
   Detail View
   ============================================================ */

section#run-view {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
  gap: 16px;
  padding: 40px;
}
.empty-icon {
  color: var(--border-light);
  opacity: 0.6;
}
.empty-state .empty-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-muted);
}
.empty-state .hint {
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-dim);
}
.empty-state a { color: var(--accent); text-decoration: none; }
.empty-state a:hover { text-decoration: underline; }

.empty-icon-arrow {
  animation: fadeInUp 0.4s ease;
}
.empty-hint {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  animation: nudgeLeft 2s ease-in-out infinite;
}
.empty-hint-desktop { display: block; }
.empty-hint-mobile { display: none; }

@keyframes nudgeLeft {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-4px); }
}

/* Detail header */
.detail-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 24px 32px;
  animation: fadeIn 0.25s ease;
}

.back-to-list {
  display: none;
}

.detail-titles {
  flex: 1;
  min-width: 0;
}

.detail-run {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.run-id-lg {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--accent);
  font-weight: 600;
  word-break: break-all;
}

/* Metrics row */
.detail-metrics {
  display: flex;
  gap: 24px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 60px;
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.metric-green .metric-value { color: var(--green); }
.metric-red .metric-value { color: var(--red); }
.metric-yellow .metric-value { color: var(--yellow); }

.metric-wide {
  flex: 1;
  min-width: 200px;
  max-width: 100%;
  overflow: hidden;
}
.metric-value-text {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.metric-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

/* Metadata grid */
.detail-meta-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meta-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 500;
}

.meta-value {
  font-size: 13px;
  color: var(--text);
  font-family: var(--font-mono);
}

.meta-value code {
  color: var(--accent);
  background: var(--accent-dim);
  padding: 1px 6px;
  border-radius: 4px;
}

/* Links */
.detail-links {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.detail-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--border-light);
  background: var(--bg-elevated);
  color: var(--text-muted);
  transition: var(--transition);
}
.detail-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* Detail body */
.detail-body {
  padding: 24px 32px 60px;
  max-width: 1100px;
  margin: 0 auto;
  animation: fadeIn 0.25s ease;
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 1px 8px;
  border-radius: 10px;
  text-transform: none;
}

.section-empty {
  color: var(--text-dim);
  font-size: 13px;
  padding: 8px 0;
}

.screenshot-section,
.files-section,
.summary-section {
  margin-bottom: 36px;
}

/* ============================================================
   Screenshot Grid
   ============================================================ */

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

.shot-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}
.shot-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.shot-card:has(.shot-thumb:not(.loaded))::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 220px;
  background: linear-gradient(110deg, var(--bg) 0%, rgba(255,255,255,0.04) 20%, var(--bg) 40%);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
  border-bottom: 1px solid var(--border);
  z-index: 0;
  pointer-events: none;
}
@keyframes shimmer {
  to { background-position: -200% 0; }
}
.shot-error {
  opacity: 0.4;
}
.shot-error .shot-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--red);
  font-size: 12px;
  height: 220px;
}
.shot-expired {
  opacity: 0.5;
}
.shot-expired-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 220px;
  color: var(--text-dim);
  font-size: 11px;
  background: var(--bg-elevated);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-sm);
}

.shot-thumb {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
  object-position: top center;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  opacity: 0;
  transition: opacity 300ms ease;
}
.shot-thumb.loaded {
  opacity: 1;
}

.shot-name {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  padding: 8px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   File List
   ============================================================ */

.file-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  transition: var(--transition);
  border: 1px solid transparent;
}
.file-row:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}
.file-status {
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  min-width: 36px;
  text-align: center;
}
.file-status-checking { color: var(--text-dim); background: var(--bg); }
.file-status-ok { color: var(--green); background: var(--green-dim); }
.file-status-gone { color: var(--red); background: var(--red-dim); }
.file-download {
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  flex-shrink: 0;
}
.file-download:hover { color: var(--accent); }

.file-icon {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.file-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  flex-shrink: 0;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-path {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.file-ext {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--bg);
  border: 1px solid var(--border-light);
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* ============================================================
   Run Summary (content text)
   ============================================================ */

.run-summary {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 400px;
  overflow-y: auto;
}

/* ============================================================
   Lightbox
   ============================================================ */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox[hidden] { display: none; }

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  opacity: 0;
  transition: opacity 200ms ease;
  cursor: zoom-out;
}

.lightbox.open .lightbox-backdrop { opacity: 1; }

.lightbox-img {
  position: relative;
  max-width: 92vw;
  max-height: 88vh;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  opacity: 0;
  transition: transform 200ms ease, opacity 200ms ease;
}

.lightbox.open .lightbox-img {
  transform: scale(1);
  opacity: 1;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  z-index: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  color: var(--text);
  font-size: 28px;
  line-height: 1;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
}
.lightbox-close:hover {
  background: var(--red);
  border-color: var(--red);
}

.lightbox-open {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: var(--transition);
}
.lightbox-open:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* ============================================================
   Footer
   ============================================================ */

footer {
  padding: 8px 20px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  flex-shrink: 0;
}

footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
}
footer a:hover { color: var(--accent); }

/* ============================================================
   Scrollbars
   ============================================================ */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}

/* ============================================================
   Test Tree (Hierarchical Browser)
   ============================================================ */

.test-tree-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 60px 20px;
  color: var(--text-muted);
}

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-buttons {
  display: flex;
  gap: 4px;
  background: var(--bg-secondary);
  padding: 4px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--font-sans);
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.filter-btn.active {
  color: var(--accent);
  background: var(--accent-dim);
}

.filter-count {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 8px;
}

.filter-btn.active .filter-count {
  background: var(--accent);
  color: var(--bg);
}

.test-search {
  flex: 1;
  max-width: 280px;
  min-width: 140px;
  padding: 7px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-sans);
  outline: none;
  transition: var(--transition);
}

.test-search:focus {
  border-color: var(--accent);
}

.test-search::placeholder {
  color: var(--text-dim);
}

/* Suite (collapsible) */
.test-suite {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}

.test-suite-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}

.test-suite-header:hover {
  background: var(--bg-hover);
}

.test-suite-toggle {
  font-size: 10px;
  color: var(--text-dim);
  transition: transform 200ms ease;
  width: 12px;
  text-align: center;
}

.test-suite.collapsed .test-suite-toggle {
  transform: rotate(-90deg);
}

.test-suite-name {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.test-suite-badges {
  display: flex;
  gap: 4px;
}

.suite-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
}

.suite-badge-passed { color: var(--green); background: var(--green-dim); }
.suite-badge-failed { color: var(--red); background: var(--red-dim); }
.suite-badge-skipped { color: var(--yellow); background: var(--yellow-dim); }

.test-suite-body {
  border-top: 1px solid var(--border);
}

.test-suite.collapsed .test-suite-body {
  display: none;
}

/* Test case (row) */
.test-case {
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

.test-case:last-child {
  border-bottom: none;
}

.test-case-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px 9px 38px;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}

.test-case-header:hover {
  background: var(--bg-hover);
}

.test-toggle {
  font-size: 10px;
  color: var(--text-dim);
  width: 12px;
  text-align: center;
  transition: transform 200ms ease;
}

.test-case.expanded .test-toggle {
  transform: rotate(90deg);
}

.test-status-icon {
  font-size: 13px;
  font-weight: 700;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

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

.test-name {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.test-duration {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.test-failure {
  color: var(--yellow);
  font-size: 14px;
  flex-shrink: 0;
  cursor: help;
}

/* Test case expanded body */
.test-case-body {
  padding: 16px 16px 16px 50px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.test-detail-meta {
  margin-bottom: 16px;
}

.test-failure-detail {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--red);
  background: var(--red-dim);
  border: 1px solid rgba(248, 81, 73, 0.2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 10px;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.6;
}

.test-detail-info {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.test-detail-info span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.test-no-artifacts {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  padding: 8px 0;
}

.test-description {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 10px;
}

.test-markers {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}

.test-marker {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 6px;
}

.debug-log-section {
  margin-top: 8px;
}

.debug-log-toggle {
  cursor: pointer;
  font-size: 12px;
  color: var(--accent);
  padding: 6px 0;
}

.debug-log-content {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  max-height: 400px;
  overflow: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin-top: 8px;
}

.test-artifact-group {
  margin-bottom: 18px;
}

.featured-videos {
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

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

.featured-videos-count {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 4px;
}

.featured-videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.featured-video-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  color: inherit;
  font-family: var(--font-sans);
}

.featured-video-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.featured-video-card.test-status-passed {
  border-left: 3px solid var(--green);
}

.featured-video-play {
  font-size: 20px;
  color: var(--accent);
}

.featured-video-name {
  font-size: 12px;
  color: var(--text);
  word-break: break-word;
}

.featured-video-suite {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
}

.test-artifact-group:last-child {
  margin-bottom: 0;
}

.test-artifact-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.test-artifact-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 1px 6px;
  border-radius: 8px;
  text-transform: none;
}

/* Test case screenshots: smaller grid inside test */
.test-case-body .shot-grid {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.test-case-body .shot-thumb {
  height: 120px;
}

/* Video player */
.test-video-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.test-video-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.test-video {
  display: block;
  width: 100%;
  max-height: 480px;
  background: #000;
}

.test-video-name {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  padding: 8px 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* HTML inline viewer button */
.html-inline-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}

.html-view-btn {
  padding: 5px 12px;
  background: var(--accent-dim);
  border: 1px solid rgba(255, 102, 0, 0.3);
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-sans);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.html-view-btn:hover {
  background: var(--accent);
  color: var(--bg);
}

.html-open-link {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
}

.html-open-link:hover {
  color: var(--accent);
}

.html-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* General artifacts + reports sections */
.general-section {
  margin-bottom: 36px;
  margin-top: 28px;
}

.advanced-section {
  margin-top: 28px;
  margin-bottom: 36px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.advanced-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: var(--transition);
  list-style: none;
}

.advanced-header::-webkit-details-marker {
  display: none;
}

.advanced-header::before {
  content: '\25B8';
  font-size: 10px;
  color: var(--text-dim);
  transition: transform 200ms ease;
  display: inline-block;
  width: 12px;
  text-align: center;
}

.advanced-section[open] .advanced-header::before {
  transform: rotate(90deg);
}

.advanced-header:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.advanced-body {
  padding: 0 16px 12px;
  border-top: 1px solid var(--border);
}

.advanced-body .file-list {
  padding-top: 8px;
}

/* Utility */
.hidden {
  display: none !important;
}

/* ============================================================
   HTML Viewer Modal
   ============================================================ */

.html-viewer-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.html-viewer-modal[hidden] { display: none; }

.html-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  opacity: 0;
  transition: opacity 200ms ease;
  cursor: zoom-out;
}

.html-viewer-modal.open .html-viewer-backdrop { opacity: 1; }

.html-viewer-content {
  position: relative;
  width: 92vw;
  height: 88vh;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  opacity: 0;
  transition: transform 200ms ease, opacity 200ms ease;
}

.html-viewer-modal.open .html-viewer-content {
  transform: scale(1);
  opacity: 1;
}

.html-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.html-viewer-title {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.html-viewer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.html-viewer-open {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  text-decoration: none;
  padding: 5px 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.html-viewer-open:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.html-viewer-close {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
}

.html-viewer-close:hover {
  background: var(--red);
  border-color: var(--red);
}

.html-viewer-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: #fff;
}

/* ============================================================
   Project Filter Tabs (sidebar top)
   ============================================================ */

.project-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.project-tabs::-webkit-scrollbar {
  display: none;
}

.project-tab {
  flex: 1;
  min-width: max-content;
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-sans);
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  white-space: nowrap;
}
.project-tab:hover {
  color: var(--text);
  border-color: var(--text-dim);
}
.project-tab.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}
.project-tab-secondary {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--text-dim);
  font-size: 10px;
  opacity: 0.7;
}
.project-tab-secondary:hover {
  opacity: 1;
  color: var(--text-muted);
}
.project-tab-secondary.active {
  color: var(--text-muted);
  border-color: var(--text-dim);
  background: var(--bg-elevated);
}

/* Project chip in run card */
.meta-chip-project {
  color: var(--project-color, var(--text-dim));
  border-color: var(--project-color, var(--border-light));
  background: color-mix(in srgb, var(--project-color, var(--bg)) 8%, transparent);
  font-weight: 600;
  text-transform: capitalize;
}
.meta-chip-legacy {
  color: var(--text-dim);
  background: var(--bg-elevated);
  border-color: var(--border-light);
  font-size: 9px;
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.meta-chip-nip78 {
  color: #58a6ff;
  background: rgba(88, 166, 255, 0.1);
  border-color: rgba(88, 166, 255, 0.3);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.meta-chip-contextvm {
  color: #3fb950;
  background: rgba(63, 185, 80, 0.1);
  border-color: rgba(63, 185, 80, 0.3);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.meta-chip-rpc {
  color: #d29922;
  background: rgba(210, 153, 34, 0.1);
  border-color: rgba(210, 153, 34, 0.3);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================================
   FIPS renderer: file nav + report viewer
   ============================================================ */

.fips-run-info {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.file-nav-bar {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.file-nav-tab {
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}
.file-nav-tab:hover {
  color: var(--text);
  border-color: var(--text-dim);
}
.file-nav-tab.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 600;
}

.fips-viewer {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 400px;
  position: relative;
}

.fips-report-frame {
  width: 100%;
  height: 75vh;
  border: none;
  background: #fff;
  display: block;
}

.fips-image-viewer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: auto;
}
.fips-image-viewer img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: var(--radius-sm);
}

.json-viewer-pre {
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-x: auto;
  max-height: 70vh;
  overflow-y: auto;
}

.md-viewer {
  padding: 20px 24px;
  max-height: 70vh;
  overflow-y: auto;
  line-height: 1.6;
  color: var(--text);
}
.md-viewer h1 { font-size: 1.5em; margin: 0.8em 0 0.4em; border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
.md-viewer h2 { font-size: 1.3em; margin: 0.8em 0 0.4em; border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
.md-viewer h3 { font-size: 1.1em; margin: 0.8em 0 0.4em; }
.md-viewer p { margin: 0.5em 0; }
.md-viewer ul { margin: 0.5em 0; padding-left: 1.5em; }
.md-viewer li { margin: 0.2em 0; }
.md-viewer code { font-family: var(--font-mono); font-size: 0.9em; background: var(--bg-tertiary, rgba(255,255,255,0.05)); padding: 2px 5px; border-radius: 3px; }
.md-viewer table { border-collapse: collapse; margin: 0.8em 0; width: 100%; }
.md-viewer th, .md-viewer td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.md-viewer strong { color: var(--text); }

.fips-download-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--text-muted);
  text-align: center;
}
.fips-download-state p {
  font-size: 14px;
}

/* ============================================================
   BLE renderer: metrics
   ============================================================ */

.ble-metrics {
  margin-top: 0;
  margin-bottom: 24px;
}

/* ============================================================
   Microfips renderer: status bar
   ============================================================ */

.microfips-status-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border: 2px solid;
  border-radius: var(--radius);
  background: var(--bg-secondary);
  margin-bottom: 20px;
}
.microfips-status-icon {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}
.microfips-status-text {
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex: 1;
}
.microfips-status-count {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
}

/* ============================================================
   Responsive — Mobile (≤768px)
   ============================================================ */

@media (max-width: 768px) {
  #menu-toggle {
    display: none;
  }

  .subtitle { display: none; }
  .npub { display: none; }

  main { position: relative; }

  aside#runs-list {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    min-width: 0;
    z-index: 200;
    transform: translateX(0);
    transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
  }

  #app.mobile-view-detail aside#runs-list {
    transform: translateX(-100%);
  }

  section#run-view {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 250;
    background: var(--bg);
    transform: translateX(100%);
    transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
  }

  #app.mobile-view-detail section#run-view {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: none;
  }

  .back-to-list {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 10px 16px 10px 0;
    margin-bottom: 14px;
    background: none;
    border: none;
    color: var(--accent);
    font-family: var(--font-sans);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: var(--transition);
  }
  .back-to-list:active {
    opacity: 0.6;
  }

  .search-input {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 16px;
  }

  .filter-btn {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 8px;
  }

  .sort-select {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 16px;
  }

  .detail-header { padding: 16px 18px; }

  .detail-metrics { gap: 16px; }
  .metric-value { font-size: 18px; }

  .detail-body { padding: 18px 16px 40px; }

  .shot-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .shot-thumb,
  .shot-card:has(.shot-thumb:not(.loaded))::before {
    height: 160px;
  }
  .shot-error .shot-thumb { height: 160px; }

  .file-name { max-width: 160px; }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-buttons {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .test-search {
    max-width: none;
  }

  .test-case-header {
    padding-left: 24px;
  }

  .test-case-body {
    padding-left: 24px;
  }

  .test-case-body .shot-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }

  .test-case-body .shot-thumb {
    height: 90px;
  }

  .empty-hint-desktop { display: none; }
  .empty-hint-mobile { display: block; }

  footer { font-size: 10px; padding: 6px 12px; }
}

/* ============================================================
   Responsive — Small mobile (≤420px)
   ============================================================ */

@media (max-width: 420px) {
  header {
    padding: 0 12px;
    height: 50px;
  }

  .header-left h1 { font-size: 14px; }
  .logo-mark { font-size: 12px; }

  .conn-badge {
    font-size: 10px;
    padding: 2px 8px;
  }

  aside#runs-list,
  section#run-view {
    top: 50px;
  }
}

/* ============================================================
   Reduced motion
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* === Nostr DVM Events Section === */
.nostr-events-section{margin:0.5rem 0 1rem;border:1px solid var(--border);border-radius:8px;overflow:hidden}
.nostr-events-section summary{cursor:pointer;padding:0.6rem 1rem;font-size:0.82rem;color:var(--text-2);font-weight:500;list-style:none;display:flex;align-items:center;gap:0.4rem;background:var(--surface)}
.nostr-events-section summary::-webkit-details-marker{display:none}
.nostr-events-section summary::before{content:"\25B6";font-size:0.6rem;transition:transform 0.15s}
.nostr-events-section[open] summary::before{transform:rotate(90deg)}
.nostr-events-list{padding:0.5rem;display:flex;flex-direction:column;gap:0.5rem}
.nostr-event-block{background:var(--surface-2);border:1px solid var(--border);border-radius:6px;padding:0.5rem 0.75rem;font-size:0.78rem}
.nostr-event-kind{font-weight:600;color:var(--text);margin-bottom:0.3rem}
.nostr-event-meta{display:flex;flex-wrap:wrap;gap:0.5rem;color:var(--text-3);font-size:0.72rem;margin-bottom:0.3rem;align-items:center}
.nostr-event-meta code{font-family:var(--mono);background:var(--surface-3);padding:1px 4px;border-radius:3px}
.nostr-event-content{background:var(--bg);border:1px solid var(--border);border-radius:4px;padding:0.5rem;font-size:0.72rem;font-family:var(--mono);overflow-x:auto;max-height:300px;color:var(--text-2);line-height:1.5;white-space:pre-wrap;word-break:break-all}
.nostr-event-feedback .feedback-success{color:var(--green-text);font-weight:600}
.nostr-event-feedback .feedback-error{color:var(--red-text);font-weight:600}
.nostr-event-result{border-left:3px solid var(--green)}
.nostr-event-request{border-left:3px solid var(--blue)}

/* ============================================================
   View Toggle Bar
   ============================================================ */
.view-toggle {
  display: flex;
  gap: 4px;
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 90;
}
.view-toggle-btn {
  padding: 7px 16px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-sans);
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.view-toggle-btn:hover { color: var(--text); border-color: var(--text-dim); }
.view-toggle-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* Services view: full-width (sidebar hidden) */
main.view-services aside#runs-list { display: none; }

/* ============================================================
   CVM Jobs sidebar
   ============================================================ */
.cvm-live-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.cvm-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.cvm-job-item {
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  margin-bottom: 4px;
  animation: fadeInUp 0.3s ease forwards;
  opacity: 0;
  position: relative;
}
.cvm-job-item:hover { background: var(--bg-hover); border-color: var(--border-light); }
.cvm-job-item.active { background: var(--bg-active); border-color: var(--accent); }
.cvm-job-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.cvm-job-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.cvm-dir {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}
.cvm-dir-request { color: var(--blue); }
.cvm-dir-response { color: var(--green); }
.cvm-dir-unknown { color: var(--text-dim); }
.cvm-method {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cvm-job-meta { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.cvm-job-pubkey { font-family: var(--font-mono); font-size: 10px; color: var(--text-dim); }
.cvm-job-time { font-family: var(--font-mono); font-size: 10px; color: var(--text-dim); }
.no-match .hint { display: block; margin-top: 6px; color: var(--text-dim); font-size: 11px; }

/* ============================================================
   CVM Services grid
   ============================================================ */
.cvm-services-wrap {
  padding: 24px 32px 60px;
  max-width: 1200px;
  margin: 0 auto;
  animation: fadeIn 0.25s ease;
}
.cvm-services-header { margin-bottom: 20px; }
.cvm-services-header h2 { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.cvm-services-header p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.cvm-services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.cvm-service-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: var(--transition);
}
.cvm-service-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.cvm-service-name { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.cvm-service-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cvm-service-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cvm-service-pubkey { font-family: var(--font-mono); font-size: 10px; color: var(--text-dim); }

/* Tools list (service detail) */
.cvm-tools-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }
.cvm-tool {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}
.cvm-tool-name { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--accent); }
.cvm-tool-desc { display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }

/* ============================================================
   CVM detail view
   ============================================================ */
.cvm-detail-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 20px 32px;
  animation: fadeIn 0.25s ease;
}
.cvm-detail {
  padding: 24px 32px 60px;
  max-width: 1100px;
  margin: 0 auto;
  animation: fadeIn 0.25s ease;
}
.cvm-result-media { margin: 14px 0; }
.cvm-result-media img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: block;
}
.cvm-result-text {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  max-height: 420px;
  overflow: auto;
  margin: 10px 0;
}

/* ============================================================
   JSON Viewer (renderJson)
   ============================================================ */
.json-viewer {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 60vh;
  overflow: auto;
}
.jv-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  cursor: pointer;
  transition: var(--transition);
}
.jv-copy:hover { color: var(--accent); border-color: var(--accent); }
.jv-copy.copied { color: var(--green); border-color: var(--green); }
.jv-root { padding: 14px 18px; font-family: var(--font-mono); font-size: 12px; line-height: 1.6; }
details.jv-block { margin-left: 18px; }
details.jv-block > .jv-content { margin-left: 2px; }
.jv-summary {
  cursor: pointer;
  color: var(--text-muted);
  user-select: none;
  list-style: none;
  padding: 1px 0;
}
.jv-summary::-webkit-details-marker { display: none; }
.jv-summary::before {
  content: '\25BE';
  display: inline-block;
  width: 14px;
  color: var(--text-dim);
  transition: transform 150ms ease;
  font-size: 10px;
}
details.jv-block:not([open]) > .jv-summary::before { transform: rotate(-90deg); }
.jv-line { padding: 1px 0; }
.jv-key { color: var(--blue); }
.jv-colon { color: var(--text-dim); }
.jv-str { color: var(--green); word-break: break-all; }
.jv-num { color: var(--accent); }
.jv-bool { color: var(--yellow); }
.jv-null { color: var(--text-dim); font-style: italic; }
.jv-bracket { color: var(--text-muted); }

/* ============================================================
   Responsive — CVM views on mobile
   ============================================================ */
@media (max-width: 768px) {
  .view-toggle { padding: 6px 10px; overflow-x: auto; scrollbar-width: none; }
  .view-toggle::-webkit-scrollbar { display: none; }
  main.view-services section#run-view { position: static; transform: none; }
  main.view-services aside#runs-list { display: none; }
  .cvm-services-wrap { padding: 16px; }
  .cvm-services-grid { grid-template-columns: 1fr; }
  .cvm-detail,
  .cvm-detail-header { padding-left: 16px; padding-right: 16px; }
}

.error-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #3a1a1a;
  border-bottom: 1px solid #f8514955;
  color: #f85149;
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.error-banner[hidden] { display: none; }
.error-banner-icon { flex-shrink: 0; font-size: 16px; }
.error-banner-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.error-banner-copy,
.error-banner-dismiss {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid #f8514944;
  color: #f85149;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.error-banner-copy:hover,
.error-banner-dismiss:hover { background: #f8514922; }

/* ============================================================
   conwrt Matrix View
   ============================================================ */
.conwrt-matrix { padding: 8px; overflow-x: auto; }
.matrix-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.matrix-table th {
  text-align: center; padding: 8px 12px; font-weight: 600;
  color: var(--text-dim); border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.matrix-table th:first-child { text-align: left; }
.matrix-table td {
  padding: 6px 12px; border-bottom: 1px solid var(--border); text-align: center;
}
.matrix-uc-name {
  text-align: left !important; font-weight: 500; color: var(--text);
  white-space: nowrap;
}
.matrix-cell { cursor: default; min-width: 60px; }
.matrix-cell-none { color: var(--text-muted); }
.matrix-cell-pass { background: rgba(34,197,94,0.12); }
.matrix-cell-pass:hover { background: rgba(34,197,94,0.22); }
.matrix-cell-fail { background: rgba(239,68,68,0.12); }
.matrix-cell-fail:hover { background: rgba(239,68,68,0.22); }
.matrix-pass-icon { color: #22c55e; font-weight: bold; font-size: 15px; }
.matrix-fail-icon { color: #ef4444; font-weight: bold; font-size: 15px; }
.matrix-cell-unknown { color: var(--text-muted); }

/* ============================================================
   Inline File Viewer
   ============================================================ */
.inline-viewer-overlay {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.7); z-index: 10000;
  align-items: center; justify-content: center;
}
.inline-viewer-content {
  background: var(--bg, #1a1a2e); border-radius: 8px; max-width: 90vw; max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--border, #333);
}
.inline-viewer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-bottom: 1px solid var(--border, #333);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.inline-viewer-title { font-size: 14px; font-weight: 600; color: var(--text, #e0e0e0); }
.inline-viewer-actions { display: flex; align-items: center; gap: 12px; }
.inline-viewer-ext-link { font-size: 12px; color: var(--accent, #f60); text-decoration: none; }
.inline-viewer-ext-link:hover { text-decoration: underline; }
.inline-viewer-close {
  background: none; border: none; color: var(--text-dim, #888);
  font-size: 22px; cursor: pointer; padding: 0; line-height: 1;
}
.inline-viewer-close:hover { color: var(--text, #e0e0e0); }
.inline-viewer-body { overflow: auto; padding: 0; flex: 1; }
.inline-viewer-pre {
  margin: 0; padding: 16px; font-family: "SF Mono", "Fira Code", monospace;
  font-size: 13px; line-height: 1.5; color: var(--text, #e0e0e0);
  white-space: pre-wrap; word-break: break-all; max-width: 85vw;
}

/* ============================================================
   Version badge in run card
   ============================================================ */
.meta-chip-version {
  background: rgba(34,211,238,0.15); color: #22d3ee;
}
