:root {
  --bg-base: #FAF8F4;
  --bg-surface: #FFFFFF;
  --bg-inset: #F3F0EA;
  --bg-inset-strong: #EAE5DC;
  --border-subtle: rgba(17, 19, 21, 0.12);
  --border-strong: rgba(17, 19, 21, 0.34);
  --text-primary: #111315;
  --text-secondary: #43423E;
  --text-muted: #6B6860;
  --emerald: #1B4332;
  --cyan: #27475E;
  --amber: #8A5A00;
  --violet: #3D405B;
  --rose: #8C2F1E;
  --font-serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --radius-lg: 10px;
  --radius-md: 7px;
}

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

html {
  scroll-behavior: smooth;
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.65;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  background-color: var(--bg-base);
  color: var(--text-primary);
}

.ambient-grid {
  display: none;
  pointer-events: none;
}

.moe-bipartite-wrap {
  margin-bottom: 0.9rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-base);
  padding: 0.5rem;
}

.moe-bipartite-wrap svg {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
}

.demo-launch-pill {
  display: inline-block;
  margin-top: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--emerald);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.container {
  width: min(1160px, 100% - 2.5rem);
  margin-inline: auto;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  background: rgba(250, 249, 246, 0.92);
  border-bottom: 1px solid var(--border-subtle);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 68px;
  flex-wrap: wrap;
  padding-block: 0.65rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--emerald);
}

.brand-prompt {
  color: var(--text-muted);
  font-weight: 400;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: color 0.15s ease;
}

.nav-links a:hover {
  color: var(--text-primary);
}

.btn-outline {
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary) !important;
}

.btn-outline:hover {
  background: var(--text-primary);
  color: var(--bg-base) !important;
}

/* Editorial Cards & Buttons */
.bento-card {
  min-width: 0;
  max-width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: border-color 0.16s ease;
}

.bento-card:hover {
  border-color: var(--border-strong);
}

.hero-bento {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 1.5rem;
  margin-top: 2.75rem;
}

.eyebrow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.15rem;
}

.editorial-dateline {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--emerald);
  font-weight: 600;
}

.chip {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.24rem 0.62rem;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-inset);
  color: var(--text-secondary);
}

.chip-emerald {
  color: var(--emerald);
  background: rgba(27, 67, 50, 0.08);
  border-color: rgba(27, 67, 50, 0.22);
}

.chip-cyan {
  color: var(--cyan);
  background: rgba(39, 71, 94, 0.07);
  border-color: rgba(39, 71, 94, 0.2);
}

.chip-slate {
  color: var(--text-secondary);
  background: var(--bg-inset);
  border-color: var(--border-subtle);
}

.hero-main h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(2.3rem, 4.2vw, 3.25rem);
  letter-spacing: -0.028em;
  line-height: 1.08;
  color: var(--text-primary);
}

.hero-role {
  margin: 0.65rem 0 1.1rem;
  font-size: 1.06rem;
  font-weight: 600;
  color: var(--emerald);
}

.hero-summary {
  margin: 0 0 1.65rem;
  color: var(--text-secondary);
  font-size: 0.98rem;
  max-width: 60ch;
}

.hero-summary code,
.section-sub code,
.repo-desc code,
.matrix-card code {
  font-family: var(--font-mono);
  font-size: 0.84em;
  padding: 0.1rem 0.36rem;
  border-radius: 4px;
  background: var(--bg-inset);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.2rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-primary {
  background: var(--text-primary);
  color: var(--bg-base);
}

.btn-primary:hover {
  background: #2C2B29;
}

.btn-primary kbd {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.05rem 0.36rem;
  border-radius: 4px;
  background: rgba(250, 249, 246, 0.16);
  color: var(--bg-base);
}

.btn-secondary {
  background: var(--bg-base);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-inset);
}

/* Architectural Specification Ledger */
.hero-terminal {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.4rem;
}

.spec-ledger-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.spec-ledger-kicker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text-secondary);
}

.spec-ledger-status {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--emerald);
  padding: 0.14rem 0.5rem;
  border-radius: 4px;
  border: 1px solid rgba(27, 67, 50, 0.24);
  background: rgba(27, 67, 50, 0.07);
}

.spec-ledger-list {
  display: flex;
  flex-direction: column;
  margin: 0.7rem 0 0.95rem;
}

.spec-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.35rem 0.8rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.8rem;
}

.spec-row:last-child {
  border-bottom: none;
}

.spec-row span {
  color: var(--text-secondary);
}

.spec-row strong {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.spec-row code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--text-primary);
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: transparent;
}

.dot-red { background: rgba(140, 47, 30, 0.28); border-color: rgba(140, 47, 30, 0.45); }
.dot-amber { background: rgba(138, 90, 0, 0.25); border-color: rgba(138, 90, 0, 0.45); }
.dot-green { background: rgba(27, 67, 50, 0.35); border-color: rgba(27, 67, 50, 0.55); }

.terminal-title {
  margin-left: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.terminal-body {
  margin: 0.9rem 0;
  padding: 0.95rem 1rem;
  max-width: 100%;
  border-radius: var(--radius-md);
  background: var(--bg-inset);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.77rem;
  color: var(--text-primary);
  overflow-x: auto;
  line-height: 1.6;
}

.t-comment { color: var(--text-muted); }
.t-key { color: var(--cyan); font-weight: 600; }
.t-num { color: var(--emerald); font-weight: 600; }
.t-str { color: #7C4A03; }

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
}

.kpi-cell {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.5rem;
  text-align: center;
}

.kpi-val {
  display: block;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--emerald);
}

.kpi-lbl {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* Sections */
.section-block {
  margin-top: 4rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border-subtle);
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.section-kicker {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--emerald);
  font-weight: 600;
}

.section-header h2 {
  margin: 0.3rem 0 0;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.55rem, 2.7vw, 2.1rem);
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.section-sub {
  margin: 0;
  max-width: 560px;
  color: var(--text-secondary);
  font-size: 0.93rem;
}

/* Proof & Flagship Repositories */
.repo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.35rem;
}

.repo-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.repo-card-featured {
  border-color: rgba(20, 20, 19, 0.24);
  box-shadow: 0 2px 10px rgba(20, 20, 19, 0.03);
}

.repo-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.repo-lang {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.lang-py { color: var(--emerald); }
.lang-rs { color: #8C3B19; }
.lang-ts { color: var(--cyan); }
.lang-web { color: var(--violet); }

.repo-top h3 {
  margin: 0;
  font-size: 1.18rem;
  font-family: var(--font-mono);
  letter-spacing: -0.015em;
}

.repo-top h3 a {
  color: var(--text-primary);
  text-decoration: none;
}

.repo-top h3 a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.repo-link {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.32rem 0.68rem;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  background: var(--bg-base);
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
}

.repo-link:hover {
  background: var(--text-primary);
  color: var(--bg-base);
}

.repo-desc {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin: 0.9rem 0 1.05rem;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
  margin-bottom: 1.1rem;
}

.stack-badge {
  font-family: var(--font-mono);
  font-size: 0.71rem;
  padding: 0.2rem 0.54rem;
  border-radius: 4px;
  background: var(--bg-inset);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.metric-grid {
  margin: 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.7rem;
}

.metric-grid dt {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.metric-grid dd {
  margin: 0.1rem 0 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.metric-grid dd a {
  color: var(--cyan);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Interactive Workbench */
.sim-shell {
  padding: 1.75rem;
}

.sim-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.45rem;
}

.sim-input-row {
  display: flex;
  gap: 0.75rem;
}

.sim-input-row input {
  flex: 1;
  min-width: 0;
  padding: 0.72rem 0.95rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.86rem;
}

.sim-input-row input:focus {
  outline: 2px solid rgba(27, 67, 50, 0.25);
  border-color: var(--emerald);
}

.preset-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.8rem;
}

.preset-chip {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  padding: 0.34rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-base);
  color: var(--text-secondary);
  cursor: pointer;
}

.preset-chip:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.slider-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 1rem;
  align-items: center;
  margin-top: 1.05rem;
  padding-top: 1.05rem;
  border-top: 1px solid var(--border-subtle);
}

.slider-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.slider-head output {
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-weight: 600;
}

.slider-group input[type="range"] {
  width: 100%;
  accent-color: var(--emerald);
}

.sim-telemetry-pill {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.48rem 0.85rem;
  border-radius: var(--radius-md);
  background: rgba(27, 67, 50, 0.08);
  border: 1px solid rgba(27, 67, 50, 0.24);
  color: var(--emerald);
  white-space: nowrap;
}

.sim-results-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 1.2rem;
  margin-top: 1.25rem;
}

.sim-panel {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.panel-header h3 {
  margin: 0;
  font-size: 0.96rem;
  color: var(--text-primary);
}

.guard-ok,
.guard-redacted,
.corpus-meta {
  font-family: var(--font-mono);
  font-size: 0.71rem;
  font-weight: 600;
  padding: 0.2rem 0.52rem;
  border-radius: 4px;
}

.guard-ok {
  background: rgba(27, 67, 50, 0.09);
  border: 1px solid rgba(27, 67, 50, 0.22);
  color: var(--emerald);
}

.guard-redacted {
  background: rgba(138, 90, 0, 0.1);
  border: 1px solid rgba(138, 90, 0, 0.25);
  color: var(--amber);
}

.corpus-meta {
  background: var(--bg-inset);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.moe-selected-summary {
  font-family: var(--font-mono);
  font-size: 0.79rem;
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  margin-bottom: 0.9rem;
  color: var(--text-primary);
}

.moe-bars {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.moe-row {
  padding: 0.55rem 0.72rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.moe-row.active-gate {
  border-color: rgba(27, 67, 50, 0.45);
  background: rgba(27, 67, 50, 0.05);
}

.moe-row-head {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  margin-bottom: 0.35rem;
  color: var(--text-primary);
}

.moe-track {
  height: 7px;
  border-radius: 999px;
  background: var(--bg-inset-strong);
  overflow: hidden;
}

.moe-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--emerald);
}

.rag-results {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.rag-hit {
  padding: 0.78rem 0.88rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.rag-hit-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.3rem;
}

.rag-hit-title {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--cyan);
}

.rag-scores {
  font-family: var(--font-mono);
  font-size: 0.71rem;
  font-weight: 600;
  color: var(--emerald);
}

.rag-hit-body {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* Capability Matrix */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.filter-btn {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.38rem 0.8rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
}

.filter-btn.active {
  border-color: var(--text-primary);
  background: var(--text-primary);
  color: var(--bg-base);
}

.matrix-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.1rem;
}

.matrix-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.35rem;
}

.matrix-card[hidden] {
  display: none;
}

.dim-index {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--cyan);
  letter-spacing: 0.06em;
}

.matrix-card h3 {
  margin: 0.35rem 0 0.5rem;
  font-size: 1.04rem;
  color: var(--text-primary);
}

.matrix-card p {
  margin: 0 0 0.9rem;
  font-size: 0.86rem;
  color: var(--text-secondary);
}

.dim-proof {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--emerald);
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-subtle);
}

/* Footer */
.site-footer {
  margin-top: 4.5rem;
  border-top: 1px solid var(--border-subtle);
  padding: 2rem 0 3rem;
  color: var(--text-secondary);
  font-size: 0.86rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  gap: 1.15rem;
  flex-wrap: wrap;
}

.footer-links a {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Simulator Tabs & Protocol Lab Controls */
.sim-tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.sim-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.77rem;
  padding: 0.48rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-base);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.sim-tab-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.sim-tab-btn.active {
  border-color: var(--text-primary);
  background: var(--text-primary);
  color: var(--bg-base);
}

.tab-new-pill {
  font-size: 0.67rem;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: none;
  opacity: 0.72;
  color: inherit;
}

.sim-tab-btn.active .tab-new-pill {
  background: transparent;
  border: none;
  opacity: 0.85;
  color: var(--bg-base);
}

.sim-tab-pane[hidden] {
  display: none;
}

.lab-split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}

.lab-split-grid > .sim-panel {
  min-width: 0;
}

.sim-select {
  width: 100%;
  min-width: 0;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.sim-select:focus {
  outline: 2px solid rgba(27, 67, 50, 0.25);
  border-color: var(--emerald);
}

.lab-desc {
  margin: 0.55rem 0 0.85rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.lab-sliders-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
  margin: 0.85rem 0;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.guard-fail {
  font-family: var(--font-mono);
  font-size: 0.71rem;
  font-weight: 600;
  padding: 0.2rem 0.52rem;
  border-radius: 4px;
  background: rgba(140, 47, 30, 0.1);
  border: 1px solid rgba(140, 47, 30, 0.28);
  color: var(--rose);
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  margin-bottom: 0.85rem;
}

.lab-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.76rem;
}

.lab-table th,
.lab-table td {
  padding: 0.45rem 0.5rem;
  text-align: right;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.lab-table th:first-child,
.lab-table td:first-child {
  text-align: left;
  color: var(--text-secondary);
}

.lab-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.7rem;
}

.delta-pos { color: var(--emerald); font-weight: 600; }
.delta-neg { color: var(--rose); font-weight: 600; }
.delta-neutral { color: var(--text-muted); }

.mini-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.mini-stat {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.45rem 0.5rem;
  min-width: 0;
}

.mini-stat span {
  display: block;
  font-size: 0.67rem;
  color: var(--text-muted);
}

.mini-stat strong {
  display: block;
  margin-top: 0.1rem;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.77rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gate-failure-box {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-md);
  margin-bottom: 0.55rem;
  background: rgba(140, 47, 30, 0.08);
  border: 1px solid rgba(140, 47, 30, 0.25);
  color: var(--rose);
}

.ab-case-list {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
}

.ab-case-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.case-id {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-primary);
}

.case-sub {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
}

.case-pill {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.16rem 0.46rem;
  border-radius: 999px;
  white-space: nowrap;
}

.pill-improved {
  background: rgba(27, 67, 50, 0.1);
  color: var(--emerald);
}

.pill-regressed {
  background: rgba(140, 47, 30, 0.12);
  color: var(--rose);
}

.pill-unchanged {
  background: var(--bg-inset);
  color: var(--text-secondary);
}

.crc-footer {
  margin-top: 0.8rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
  word-break: break-word;
}

/* Citation Spans & OTLP Waterfall */
.sim-mono-input {
  width: 100%;
  min-width: 0;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.sim-mono-input:focus {
  outline: 2px solid rgba(27, 67, 50, 0.25);
  border-color: var(--emerald);
}

.rag-hit-body mark {
  background: rgba(27, 67, 50, 0.14);
  color: var(--emerald);
  border: 1px solid rgba(27, 67, 50, 0.35);
  border-radius: 3px;
  padding: 0 0.22rem;
  font-family: var(--font-mono);
  font-size: 0.92em;
}

.span-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.span-offset-pill {
  font-family: var(--font-mono);
  font-size: 0.67rem;
  padding: 0.12rem 0.42rem;
  border-radius: 4px;
  background: var(--bg-inset);
  border: 1px solid var(--border-subtle);
  color: var(--cyan);
}

.v12-toggle-box {
  display: flex;
  align-items: center;
}

.v12-check-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.v12-check-label input[type="checkbox"] {
  accent-color: var(--rose);
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.waterfall-list {
  display: flex;
  flex-direction: column;
  gap: 0.48rem;
  margin-bottom: 0.8rem;
}

.wf-row {
  padding: 0.48rem 0.65rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.wf-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.73rem;
  margin-bottom: 0.3rem;
}

.wf-name {
  color: var(--text-primary);
  font-weight: 600;
}

.wf-meta {
  color: var(--emerald);
}

.wf-meta-err {
  color: var(--rose);
}

.wf-track {
  position: relative;
  height: 7px;
  border-radius: 999px;
  background: var(--bg-inset-strong);
  overflow: hidden;
}

.wf-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  background: var(--emerald);
}

.wf-bar-err {
  background: var(--rose);
}

.v12-otlp-box {
  margin: 0;
  max-height: 170px;
  overflow-y: auto;
  font-size: 0.71rem;
}

.sim-mono-textarea {
  resize: vertical;
  min-height: 96px;
  line-height: 1.45;
  display: block;
}

@media (max-width: 980px) {
  .hero-bento,
  .repo-grid,
  .sim-results-grid,
  .lab-split-grid {
    grid-template-columns: 1fr;
  }
  .matrix-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .slider-row {
    grid-template-columns: 1fr;
  }
  .mini-stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .container {
    width: min(1160px, 100% - 1.5rem);
  }
  .bento-card {
    padding: 1.15rem;
  }
  .repo-top {
    flex-direction: column;
    align-items: flex-start;
  }
  .repo-top h3 {
    font-size: 1.04rem;
    overflow-wrap: anywhere;
  }
  .matrix-grid {
    grid-template-columns: 1fr;
  }
  .kpi-strip,
  .mini-stat-grid,
  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }
  .kpi-cell,
  .metric-grid > div,
  .sim-panel {
    min-width: 0;
  }
  .dim-proof,
  .repo-desc,
  .matrix-card p {
    overflow-wrap: anywhere;
  }
  .lab-sliders-2col {
    grid-template-columns: 1fr;
  }
  .sim-input-row {
    flex-direction: column;
  }
}
