/* ============================================================
   BCR Agent — Design System
   Dark theme · Bitcoin orange accents · Monospace technical feel
   ============================================================ */

:root {
  /* Base palette */
  --bg:           #0a0e14;
  --bg-secondary: #111720;
  --bg-elevated:  #161e2a;
  --bg-hover:     #1a2330;
  --bg-active:    #1e293b;
  --border:       #1e2937;
  --border-light: #2a3a4e;

  /* Text */
  --text:         #d4dde8;
  --text-muted:   #7a8899;
  --text-dim:     #4a5868;

  /* Accents */
  --accent:       #f7931a;
  --accent-hover: #ffa733;
  --accent-dim:   rgba(247, 147, 26, 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 font stacks only (no web fonts, no CDN, privacy-respecting) */
  --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.3);
  --shadow:    0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);

  /* 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: 22px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.header-left h1 {
  font-size: 17px;
  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);
}

.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-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
}

.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;
}

.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: 6px;
}

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

/* Mode badges */
.mode-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}
.mode-augmented {
  color: var(--accent);
  background: var(--accent-dim);
}
.mode-blind {
  color: var(--blue);
  background: var(--blue-dim);
}
.mode-autonomous {
  color: var(--green);
  background: var(--green-dim);
  box-shadow: inset 0 0 0 1px rgba(63, 185, 80, 0.25);
}

.run-card .pr-title {
  font-size: 13px;
  color: var(--text);
  margin: 0 0 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

/* 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); }

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

/* 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); }

/* ============================================================
   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); }
}

.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);
}

/* Report loading (inside detail view) */
.report-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 80px 20px;
}
.report-loading p {
  color: var(--text-muted);
  font-size: 13px;
}

/* Report error */
.report-error {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.error-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--red-dim);
  color: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
}
.report-error p { margin-bottom: 8px; font-size: 14px; }
.report-error .error-detail {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--red);
}
.report-error .hint { font-size: 12px; color: var(--text-dim); }

/* ============================================================
   Report View — Detail
   ============================================================ */

section#report-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; }

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

.detail-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

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

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

.workshop-id-lg {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
  font-weight: 600;
}

.detail-pr-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

/* 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);
}

/* 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: 18px;
  font-weight: 600;
  color: var(--accent);
}

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

/* 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);
}

/* Report content (the actual report text) */
.report-content {
  padding: 32px 40px;
  max-width: 920px;
  margin: 0 auto;
}

.report-content pre {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.75;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
  tab-size: 2;
}

/* ============================================================
   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); }

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

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

@media (max-width: 768px) {
  #menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .subtitle {
    display: none;
  }

  .npub {
    display: none;
  }

  main {
    position: relative;
  }

  /* Sidebar becomes an overlay drawer */
  aside#runs-list {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 300px;
    min-width: 300px;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
  }

  #app.sidebar-open aside#runs-list {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 250ms;
  }

  #app.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  /* Detail header adjustments */
  .detail-header {
    padding: 16px 20px;
  }

  .detail-pr-title {
    font-size: 17px;
  }

  .detail-meta-grid {
    gap: 14px;
  }

  .detail-metrics {
    gap: 16px;
  }

  .metric-value {
    font-size: 16px;
  }

  .report-content {
    padding: 20px 16px;
  }

  .report-content pre {
    font-size: 12px;
  }

  .detail-links {
    gap: 8px;
  }

  .detail-link {
    padding: 5px 10px;
    font-size: 11px;
  }

  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: 15px;
  }

  .logo-mark {
    font-size: 18px;
  }

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

  aside#runs-list {
    top: 50px;
    width: 260px;
    min-width: 260px;
  }

  .sidebar-backdrop {
    top: 50px;
  }

  .detail-header {
    padding: 14px;
  }
}

/* === Mode Toggle === */
.mode-toggle {
  display: inline-flex;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
  margin: 8px 0;
}

.mode-btn {
  padding: 5px 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s;
  font-family: var(--font-mono);
}

.mode-btn:hover { color: var(--text); }
.mode-btn.active {
  background: var(--accent);
  color: var(--bg);
}
.mode-btn[data-mode="blind"].active {
  background: var(--blue);
  color: var(--bg);
}
.mode-btn[data-mode="autonomous"].active {
  background: var(--green);
  color: var(--bg);
}

.mode-toggle-single {
  margin: 8px 0;
}

.mode-badges {
  display: flex;
  gap: 3px;
}

/* ============================================================
   Run Environment Bar
   ============================================================ */

.run-environment {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0;
  margin-top: 16px;
  padding: 0;
  background: linear-gradient(90deg, var(--green-dim), rgba(63, 185, 80, 0.03));
  border: 1px solid rgba(63, 185, 80, 0.2);
  border-left: 3px solid var(--green);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.env-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 16px;
  flex: 1 1 auto;
  min-width: 0;
  border-right: 1px solid rgba(63, 185, 80, 0.12);
}
.env-item:last-child { border-right: none; }

.env-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--green);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  opacity: 0.85;
}
.env-label::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px rgba(63, 185, 80, 0.6);
}

.env-value {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text);
  word-break: break-all;
}
.env-value a {
  color: var(--green);
  text-decoration: none;
  border-bottom: 1px dashed rgba(63, 185, 80, 0.4);
  transition: var(--transition);
}
.env-value a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.env-value-commit {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.env-value-commit::before {
  content: '⌥';
  color: var(--text-dim);
  font-size: 11px;
}

/* ============================================================
   Report Table of Contents — collapsible section nav
   ============================================================ */

.report-toc {
  margin: 0 auto 20px;
  max-width: 920px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.toc-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: var(--transition);
}
.toc-toggle:hover {
  color: var(--accent);
  background: var(--bg-hover);
}
.toc-toggle .toc-chevron {
  transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 10px;
}
.report-toc.open .toc-toggle .toc-chevron {
  transform: rotate(180deg);
}
.toc-toggle .toc-label {
  display: flex;
  align-items: center;
  gap: 8px;
}
.toc-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.toc-nav {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--border);
}
.report-toc.open .toc-nav {
  display: flex;
}

.toc-link {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 11.5px;
  font-family: var(--font-mono);
  text-decoration: none;
  transition: var(--transition);
  cursor: pointer;
}
.toc-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}
.toc-link.toc-h3 {
  font-size: 10.5px;
  padding: 3px 9px;
  color: var(--text-dim);
  background: transparent;
  border-color: var(--border);
}
.toc-link.toc-h3:hover {
  color: var(--text-muted);
  border-color: var(--border-light);
  background: var(--bg-hover);
}

/* ============================================================
   Markdown Body
   ============================================================ */

.markdown-body {
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--text);
  max-width: 920px;
  margin: 0 auto;
  word-wrap: break-word;
}

.markdown-body > *:first-child { margin-top: 0; }
.markdown-body > *:last-child { margin-bottom: 0; }

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-top: 1.8em;
  margin-bottom: 0.6em;
  scroll-margin-top: 20px;
}

.markdown-body h1 {
  font-size: 26px;
  padding-bottom: 0.4em;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.02em;
}
.markdown-body h2 {
  font-size: 21px;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--border);
  color: var(--accent);
}
.markdown-body h3 {
  font-size: 17px;
  color: var(--text);
}
.markdown-body h4 {
  font-size: 15px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.markdown-body h5,
.markdown-body h6 {
  font-size: 13px;
  color: var(--text-muted);
}

.markdown-body p {
  margin: 0 0 1em;
}

.markdown-body a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(247, 147, 26, 0.3);
  transition: var(--transition);
}
.markdown-body a:hover {
  color: var(--accent-hover);
  border-bottom-color: var(--accent-hover);
}

.markdown-body strong {
  color: var(--text);
  font-weight: 700;
}
.markdown-body em { color: var(--text); }

.markdown-body ul,
.markdown-body ol {
  margin: 0 0 1em;
  padding-left: 1.6em;
}
.markdown-body li {
  margin: 0.25em 0;
}
.markdown-body li::marker {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.95em;
}
.markdown-body ul ul,
.markdown-body ol ol,
.markdown-body ul ol,
.markdown-body ol ul {
  margin: 0.25em 0;
}

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2em 0;
  height: 0;
}

.markdown-body blockquote {
  margin: 0 0 1em;
  padding: 8px 16px;
  border-left: 3px solid var(--accent);
  background: var(--bg-secondary);
  color: var(--text-muted);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.markdown-body blockquote p { margin: 0.4em 0; }

/* Inline code */
.markdown-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-elevated);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  word-break: break-word;
}

/* Code blocks */
.markdown-body pre {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  overflow-x: auto;
  margin: 0 0 1.2em;
  position: relative;
}
.markdown-body pre code {
  display: block;
  background: transparent;
  color: #c9d1d9;
  padding: 0;
  border: none;
  border-radius: 0;
  font-size: 12.5px;
  line-height: 1.65;
  word-break: normal;
}

/* Tables */
.markdown-body table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 0 0 1.2em;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.markdown-body thead {
  background: var(--bg-elevated);
}
.markdown-body th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--accent);
  border-bottom: 1px solid var(--border-light);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.markdown-body td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
}
.markdown-body tbody tr:last-child td { border-bottom: none; }
.markdown-body tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}
.markdown-body tbody tr:hover {
  background: var(--bg-hover);
}

.markdown-body img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* Task lists (GFM) */
.markdown-body input[type="checkbox"] {
  margin-right: 6px;
  accent-color: var(--accent);
}

/* Tighten spacing inside report-content wrapper */
.report-content { padding-bottom: 60px; }

@media (max-width: 768px) {
  .run-environment {
    flex-direction: column;
  }
  .env-item {
    border-right: none;
    border-bottom: 1px solid rgba(63, 185, 80, 0.12);
  }
  .env-item:last-child { border-bottom: none; }

  .markdown-body {
    font-size: 13.5px;
  }
  .markdown-body h1 { font-size: 22px; }
  .markdown-body h2 { font-size: 18px; }
  .markdown-body h3 { font-size: 15px; }
  .markdown-body pre {
    padding: 12px;
    border-radius: var(--radius-sm);
  }
  .markdown-body pre code { font-size: 11.5px; }
}
