:root {
  --bg: #fafafa;
  --fg: #1c1c1c;
  --muted: #666;
  --accent: #2c5cb6;
  --border: #d4d4d4;
  --card: #fff;
  --good: #2e7d32;
  --ok: #66961a;
  --warn: #c47b00;
  --bad: #c62828;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button {
  font: inherit;
  padding: 0.35rem 0.8rem;
  background: var(--accent);
  color: white;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
input[type="search"] {
  font: inherit;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: white;
  width: 240px;
}
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
  background: #eee;
  padding: 1px 4px;
  border-radius: 3px;
}

/* topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.2rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 0.6rem; }
.topbar-right { display: flex; align-items: center; gap: 0.6rem; }
.brand a { color: var(--fg); }
.brand .sep { color: var(--muted); }
.ckpt-picker { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.ckpt-picker label { color: var(--muted); font-size: 0.85em; }
.ckpt-picker select {
  font: inherit;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: white;
  max-width: 100%;
}
.ckpt-picker #ckpt-run { max-width: 50ch; }
.ckpt-status { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.9em; }
.ckpt-section { margin: 0 0 1rem; }
.ckpt-table-wrap {
  margin-top: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fbfbfd;
}
.ckpt-table-wrap > summary {
  padding: 0.4rem 0.7rem;
  cursor: pointer;
  font-size: 0.9em;
  color: var(--muted);
  user-select: none;
}
.ckpt-table-wrap[open] > summary { border-bottom: 1px solid var(--border); }
.ckpt-table-wrap > p { padding: 0 0.7rem 0.7rem; margin: 0; }
.runs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88em;
}
.runs-table th, .runs-table td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
.runs-table th { background: #f3f4f6; font-weight: 600; }
.runs-table td.num, .runs-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.runs-table tr:last-child td { border-bottom: none; }
.runs-table tr.tag-good td { background: #f4faf4; }
.runs-table tr.tag-bad td { background: #fdf6f6; }
.runs-table tr.best-overall td { background: #eaf6ea; font-weight: 500; }
.runs-table tr.tag-paper td {
  background: #eef4fb;
  font-style: italic;
  border-top: 2px solid var(--accent, #1a73e8);
}
.tag-pill.tag-paper { background: #d6e5f7; color: var(--accent, #1a73e8); font-style: normal; }
.runs-table code { background: rgba(0,0,0,0.04); padding: 1px 4px; border-radius: 3px; }

/* login + logout */
.logout-form { display: inline; margin: 0; padding: 0; }
.linklike {
  background: none; border: none; padding: 0;
  font: inherit; color: var(--accent, #1a73e8); cursor: pointer;
  text-decoration: underline;
}
body.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
body.login-page > .content {
  width: 100%;
  padding: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  width: 100%;
  max-width: 380px;
  margin: 0;
  padding: 1.5rem 1.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
}
.login-card h1 { margin: 0 0 0.2rem; }
.login-form { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 1rem; }
.login-form label { display: flex; flex-direction: column; gap: 0.2rem; }
.login-form label > span { font-size: 0.85em; color: var(--muted); }
.login-form input {
  font: inherit; padding: 0.45rem 0.6rem;
  border: 1px solid var(--border); border-radius: 4px;
}
.login-form button {
  margin-top: 0.4rem; padding: 0.5rem 0.9rem;
  font: inherit; cursor: pointer;
  background: var(--accent, #1a73e8); color: white;
  border: none; border-radius: 4px;
}
.login-error {
  padding: 0.5rem 0.7rem;
  background: #fbe9e7;
  color: var(--bad, #c62828);
  border: 1px solid #f5c2bd;
  border-radius: 4px;
  font-size: 0.9em;
  margin-top: 0.6rem;
}
.login-success {
  padding: 0.5rem 0.7rem;
  background: #e9f7ec;
  color: var(--good, #2e7d32);
  border: 1px solid #c8e6c9;
  border-radius: 4px;
  font-size: 0.9em;
  margin-top: 0.6rem;
}
.profile-section { margin: 1.5rem 0 2rem; max-width: 540px; }
.profile-section h2 { margin: 0 0 0.6rem; font-size: 1.05rem; }
.profile-section .login-form { margin-top: 0.8rem; }

/* main content */
.content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1.2rem 3rem;
}
.content h1 { margin-top: 0.5rem; }
.subtitle { color: var(--muted); margin-top: -0.5rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85em; }
.crumbs { color: var(--muted); margin-bottom: 0.4rem; font-size: 0.9em; }
.loading { color: var(--muted); padding: 2rem 0; text-align: center; }

/* status cards */
.status {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.8rem;
  margin: 1.2rem 0 2rem;
}
.status-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.8rem 1rem;
}
.status-label {
  color: var(--muted);
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.2rem;
}
.status-value { font-size: 1.05em; font-weight: 600; }

/* compounds page */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.8rem 0;
}
.legend { display: flex; gap: 0.4rem; font-size: 0.85em; }
.compound-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.6rem;
}
.compound-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.7rem 0.9rem;
  color: var(--fg);
}
.compound-card:hover { border-color: var(--accent); text-decoration: none; }
.compound-name { font-weight: 600; word-break: break-word; }
.compound-meta {
  margin-top: 0.3rem;
  font-size: 0.85em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* split-grouped sections on the compounds page */
.compound-group + .compound-group { margin-top: 1.5rem; }
.group-head {
  margin: 0 0 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}
.group-head h2 { margin: 0; font-size: 1.1em; }
.group-head p { margin: 0.2rem 0 0; }

/* badges */
.badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.78em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge.train   { background: #e3eefc; color: #1d4480; }
.badge.test    { background: #fce8d4; color: #8a4500; }
.badge.unknown { background: #ebebeb; color: #555; }

/* compound page */
.compound-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.compound-header h1 { margin-bottom: 0.2rem; }
.treatments-toolbar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 1rem 0 0.6rem;
  flex-wrap: wrap;
}
.treatment-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.8rem 1rem;
  margin: 0.6rem 0;
}
.treatment-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  gap: 0.8rem;
  flex-wrap: wrap;
}
.treatment-actions { display: flex; align-items: center; gap: 0.6rem; }
.dose-low    { color: #2e7d32; font-weight: 600; }
.dose-middle { color: #c47b00; font-weight: 600; }
.dose-high   { color: #c62828; font-weight: 600; }

/* comparison table */
.comparison {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
}
.comparison th,
.comparison td {
  text-align: left;
  padding: 4px 8px;
  border-bottom: 1px solid #eee;
}
.comparison th {
  background: #f3f3f3;
  font-weight: 600;
}
.comparison .num { text-align: right; font-variant-numeric: tabular-nums; }
.comparison .meas-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
}
.comparison tr:hover td { background: #fafafa; }
.delta-pos  { color: var(--bad); }
.delta-neg  { color: var(--accent); }
.delta-zero { color: var(--muted); }
.pct {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 500;
}
.pct-good { background: #d8f0d8; color: var(--good); }
.pct-ok   { background: #ecf3d8; color: var(--ok); }
.pct-warn { background: #fdebcc; color: var(--warn); }
.pct-bad  { background: #fbd5d5; color: var(--bad); }

/* k/v summary tables (dashboard, history) */
.kv-table {
  border-collapse: collapse;
  width: 100%;
  max-width: 700px;
  font-size: 0.92em;
  margin: 0.5rem 0 1.2rem;
}
.kv-table th,
.kv-table td {
  text-align: left;
  padding: 4px 10px;
  border-bottom: 1px solid #eee;
}
.kv-table th {
  font-weight: 500;
  color: var(--muted);
  width: 220px;
}

/* inline checkbox toggle */
.inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.inline-toggle input { margin: 0; }

/* ===== two-column layout (compound + summary pages) ===== */
.compound-layout,
.summary-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 800px) {
  .compound-layout,
  .summary-layout { grid-template-columns: 1fr; }
  .compound-sidebar,
  .summary-sidebar { position: static !important; }
}

.compound-sidebar,
.summary-sidebar {
  position: sticky;
  top: 0.6rem;
  align-self: start;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.7rem 0.9rem;
  font-size: 0.92em;
  max-height: calc(100vh - 1.2rem);
  overflow-y: auto;
}
.sidebar-section + .sidebar-section {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid #eee;
}
.sidebar-title {
  font-weight: 700;
  font-size: 1.05em;
  word-break: break-word;
  margin-bottom: 0.3rem;
}
.sidebar-subtitle {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.78em;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 0.4rem;
  cursor: pointer;
}
.sidebar-subtitle::-webkit-details-marker { color: var(--muted); }

/* TOC */
.toc-group { margin-bottom: 0.55rem; }
.toc-group-label {
  font-weight: 600;
  color: var(--fg);
  font-size: 0.92em;
  margin-bottom: 0.15rem;
}
.toc ul {
  list-style: none;
  padding: 0;
  margin: 0 0 0 0.5rem;
}
.toc li { margin: 0.1rem 0; }
.toc a {
  display: block;
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--fg);
  font-size: 0.9em;
}
.toc a:hover { background: #eef3fb; text-decoration: none; }
.toc a.active {
  background: #d6e4f9;
  color: var(--accent);
  font-weight: 500;
}

/* glossary in sidebar */
.glossary {
  list-style: none;
  padding: 0;
  margin: 0.4rem 0 0;
  font-size: 0.85em;
  max-height: 280px;
  overflow-y: auto;
}
.glossary li {
  padding: 2px 0;
  display: grid;
  grid-template-columns: max-content auto;
  column-gap: 0.4rem;
  align-items: baseline;
}
.glos-key {
  background: #eee;
  padding: 0 4px;
  border-radius: 3px;
  font-size: 0.92em;
}
.glos-cat {
  display: none;  /* show only as a colored dot in the table */
}

/* explainer */
.explainer {
  background: #eef4fc;
  border-left: 3px solid var(--accent);
  padding: 0.7rem 1rem;
  margin: 0 0 1rem;
  border-radius: 0 4px 4px 0;
}
.explainer p { margin: 0.3rem 0; }

/* category dot in measurement column */
.cat-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-left: 6px;
  vertical-align: middle;
}
.cat-hematology  { background: #c2185b; }
.cat-coagulation { background: #6a1b9a; }
.cat-lipids      { background: #ef6c00; }
.cat-liver       { background: #2e7d32; }
.cat-kidney      { background: #1565c0; }
.cat-electrolyte { background: #00838f; }
.cat-protein     { background: #5d4037; }
.cat-metabolic   { background: #c47b00; }
.cat-other       { background: #888; }

/* Make tooltip visible by emphasizing the dotted underline cue */
.meas-name { cursor: help; }

/* per-treatment fit badge */
.fit-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 0.85em;
  font-variant-numeric: tabular-nums;
}
.fit-good { background: #d8f0d8; color: var(--good); }
.fit-ok   { background: #ecf3d8; color: var(--ok); }
.fit-warn { background: #fdebcc; color: var(--warn); }
.fit-bad  { background: #fbd5d5; color: var(--bad); }

/* aggregate summary block in sidebar */
.aggregate .agg-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 2px 0;
}
.agg-val {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 1px 6px;
  border-radius: 3px;
}

/* runs page */
.run-section + .run-section { margin-top: 1.4rem; }
.run-section h2 { font-size: 1.05em; margin: 0 0 0.5rem; }
.run-list { display: grid; gap: 0.6rem; }
.run-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 6px;
  padding: 0.7rem 0.9rem;
}
.run-card.status-queued  { border-left-color: #9aa0a6; }
.run-card.status-running { border-left-color: var(--accent); }
.run-card.status-done    { border-left-color: var(--good); }
.run-card.status-failed  { border-left-color: var(--bad); }
.run-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.4rem;
}
.run-title { font-weight: 600; font-size: 1.02em; }
.run-status { display: flex; align-items: center; gap: 0.5rem; }
.status-pill {
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.78em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-pill.status-queued  { background: #ebebeb; color: #555; }
.status-pill.status-running { background: #e3eefc; color: var(--accent); }
.status-pill.status-done    { background: #d8f0d8; color: var(--good); }
.status-pill.status-failed  { background: #fbd5d5; color: var(--bad); }
.run-meta { display: grid; gap: 2px; margin-bottom: 0.3rem; }
.run-meta code { font-size: 0.92em; }
.run-cmd summary { cursor: pointer; color: var(--muted); font-size: 0.85em; }
.run-cmd pre {
  background: #f3f3f3;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 0.85em;
  overflow-x: auto;
  margin: 0.3rem 0 0;
}

/* journal cards */
.journal-card { border-left-width: 4px; }
.journal-card.tag-bad     { border-left-color: var(--bad); }
.journal-card.tag-good    { border-left-color: var(--good); }
.journal-card.tag-tbd     { border-left-color: var(--accent); }
.journal-card.tag-unknown { border-left-color: var(--muted); }
.tag-pill {
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.78em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tag-pill.tag-bad     { background: #fbd5d5; color: var(--bad); }
.tag-pill.tag-good    { background: #d8f0d8; color: var(--good); }
.tag-pill.tag-tbd     { background: #e3eefc; color: var(--accent); }
.tag-pill.tag-unknown { background: #ebebeb; color: var(--muted); }
.journal-text p { margin: 0.4rem 0 0.2rem; font-size: 0.92em; }
.glossary-dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.3rem 1rem;
  margin: 0.6rem 0 0;
  font-size: 0.92em;
}
.glossary-dl dt { font-weight: 500; }
.glossary-dl dd { margin: 0; color: var(--muted); }

/* runs page */
.run-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid #ccc;
  border-radius: 6px;
  padding: 0.8rem 1rem;
  margin-bottom: 0.8rem;
}
.run-card.tag-good   { border-left-color: var(--good); }
.run-card.tag-bad    { border-left-color: var(--bad); }
.run-card.tag-tbd    { border-left-color: #888; }
.run-card.tag-unknown { border-left-color: var(--warn); }
.run-head { margin-bottom: 0.4rem; }
.run-title-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.run-dir {
  background: #f1f1f1;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.92em;
}
.run-status {
  font-size: 0.78em;
  padding: 1px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.status-good    { background: #d8f0d8; color: var(--good); }
.status-bad     { background: #fbd5d5; color: var(--bad); }
.status-tbd     { background: #ebebeb; color: var(--muted); }
.status-unknown { background: #fdebcc; color: var(--warn); }
.run-title {
  margin: 0.2rem 0 0;
  font-size: 1.05em;
}
.run-detail {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 1rem;
  row-gap: 0.3rem;
  margin: 0.5rem 0 0;
  font-size: 0.93em;
}
.run-detail dt {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding-top: 1px;
}
.run-detail dd { margin: 0; }

/* summary page */
.summary { max-width: 920px; }
.summary h2 { margin-top: 2.4rem; padding-bottom: 0.3rem; border-bottom: 1px solid var(--border); }
.summary h3 { margin-top: 1.6rem; }
.summary section { scroll-margin-top: 4rem; }
.summary pre { background: #f4f4f4; padding: 0.7rem 0.9rem; border-radius: 5px; overflow-x: auto; font-size: 0.88em; }
.summary code { background: #f0f0f0; padding: 0.1em 0.3em; border-radius: 3px; }
.summary pre code { background: transparent; padding: 0; }

.tldr-box {
  background: var(--card);
  border: 2px solid var(--accent);
  border-radius: 6px;
  padding: 1rem 1.4rem 1.2rem;
  margin: 1.2rem 0 2rem;
}
.tldr-box h2 {
  margin-top: 0;
  border-bottom: none;
  color: var(--accent);
}
.tldr-box h3 { margin-top: 1.4rem; }

.tldr-table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.6rem 0 0.8rem;
}
.tldr-table th, .tldr-table td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.7rem;
  text-align: left;
  vertical-align: top;
}
.tldr-table thead th {
  background: #f0f4fa;
  font-weight: 600;
}
.tldr-table tbody th {
  background: #f7f7f7;
  white-space: nowrap;
}
.tldr-table td.good { background: #effbf0; color: var(--good); font-weight: 500; }
.tldr-table td.bad  { background: #fdf0f0; color: var(--bad); }


/* validation table on summary page */
.validation-table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.8rem 0 1rem;
  font-size: 0.92em;
}
.validation-table th,
.validation-table td {
  border: 1px solid var(--border);
  padding: 0.35rem 0.5rem;
  text-align: left;
  vertical-align: top;
}
.validation-table thead th {
  background: #f0f4fa;
  font-weight: 600;
}
.validation-table td.good { background: #effbf0; color: var(--good); }
.validation-table td.bad  { background: #fdf0f0; color: var(--bad); }
.validation-table tr.row-fail td { background: #fdf0f0; color: var(--bad); }
.summary h4 { margin-top: 1.1rem; margin-bottom: 0.35rem; }

/* code browser */
.code-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.8rem 0 1rem;
}
.code-toolbar select {
  font: inherit;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: white;
}
.code-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
  align-items: start;
}
.code-tree {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.4rem 0.6rem 0.6rem;
  max-height: 75vh;
  overflow: auto;
  font-size: 0.92em;
}
.code-tree-list {
  list-style: none;
  padding-left: 0.9rem;
  margin: 0;
}
.code-tree > .code-tree-list { padding-left: 0; }
.code-tree-dir > details > summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--fg);
  padding: 1px 0;
}
.code-tree-dir > details > summary:hover { color: var(--accent); }
.code-tree-file a {
  display: block;
  padding: 1px 4px;
  color: var(--fg);
  border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.95em;
}
.code-tree-file a:hover { background: #eef2fa; text-decoration: none; }
.code-tree-file a.active {
  background: var(--accent);
  color: white;
}
.code-viewer {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  min-height: 75vh;
  display: flex;
  flex-direction: column;
}
.code-viewer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid var(--border);
  background: #f4f4f4;
  border-radius: 6px 6px 0 0;
}
.code-path {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  color: var(--fg);
}
.code-body {
  flex: 1;
  margin: 0;
  padding: 0.8rem 1rem;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  line-height: 1.45;
  white-space: pre;
  background: #fbfbfb;
  border-radius: 0 0 6px 6px;
}

/* --- Terminal page ------------------------------------------------------ */
body.term-page {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
body.term-page .topbar { flex: 0 0 auto; }
body.term-page .content {
  max-width: none;
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.term-host {
  flex: 1 1 auto;
  min-height: 0;
  background: #0b0d10;
  padding: 6px 8px;
  box-sizing: border-box;
}
.term-host .xterm,
.term-host .xterm-viewport,
.term-host .xterm-screen { height: 100% !important; }
.term-statusbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.75rem;
  background: var(--card);
  border-top: 1px solid var(--border);
}
.term-statusbar .small { padding: 0.15rem 0.5rem; }
