/* ==========================================================================
   Workflow Quality & Regression Lab
   Warm paper research-library theme.

   Design tokens (single source of truth — every color below references these):
   - Canvas is warm cream paper; cards sit one step lighter; inset panels tan.
   - Tan pill chips carry taxonomy (edge cases, methods, sources).
   - Deep green is reserved for "selected / clean / pass" — the positive state.
   - Amber is reserved for evidence highlights and "needs review" warmth.
   - Muted brick red is reserved for regressions and declines only.
   Nothing decorative is interactive: every button-looking control works.
   ========================================================================== */

:root {
  /* Paper surfaces */
  --paper: #f2ebdb;
  --paper-side: #ebe1c9;
  --card: #faf6ea;
  --inset: #f0e7d0;
  --inset-deep: #e9dcc0;

  /* Hairlines */
  --line: #d8cbab;
  --line-soft: #e4d7b8;

  /* Warm ink scale */
  --ink: #2f2a20;
  --ink-soft: #6e6151;
  --ink-faint: #9c8f76;

  /* Taxonomy chips (tan pills) */
  --chip: #e7dab9;
  --chip-ink: #6d5e40;
  --chip-border: #d9c89e;

  /* Functional states */
  --green: #1d6a48;
  --green-deep: #155c3e;
  --green-tint: #dfe8d2;
  --green-border: #b3c9a3;

  --amber: #f0bd45;
  --amber-ink: #5f4a0e;
  --amber-tint: #f7ecd2;
  --amber-border: #e3cd97;

  --gold: #96700f;

  --red: #a63a2c;
  --red-deep: #8c2f24;
  --red-tint: #f6e2d8;
  --red-border: #e2b49f;

  --blue: #35648f;
  --plum: #7a4a6e;

  /* Fonts. Violet Sans throughout (single weight — heavier weights
     synthesize); JetBrains Mono for data and code. */
  --sans: "Violet Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;

  /* Geometry & shadow (paper casts almost no shadow — hairlines do the work) */
  --radius-pill: 999px;
  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 4px;
  --shadow-card: 0 1px 2px rgba(74, 60, 32, 0.06);
}

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

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--green-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--green-border);
  transition: text-decoration-color 0.15s ease;
}
a:hover {
  text-decoration-color: var(--green-deep);
}

h1, h2, h3, h4 {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

code, .mono {
  font-family: var(--mono);
  font-size: 0.88em;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   App shell: library sidebar + main column
   ========================================================================== */

.shell {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
}

.sidebar {
  width: 248px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 22px 16px 20px;
  background: var(--paper-side);
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 2px 8px 0;
}

.brand-mark {
  font-size: 19px;
  line-height: 1.2;
  color: var(--green-deep);
  font-family: var(--sans);
}

.sidebar h1 {
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.brand-sub {
  margin: 1px 0 0;
  font-size: 11.5px;
  color: var(--ink-soft);
}

.library-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section {
  margin: 12px 8px 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.library-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--radius-md);
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.library-nav a:hover {
  background: rgba(255, 253, 246, 0.55);
  color: var(--ink);
}

.library-nav a.active {
  background: var(--green);
  color: #f7f2e2;
  font-weight: 600;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-green { background: #2e8b5f; }
.dot-blue { background: #4a7fb5; }
.dot-amber { background: #d39a22; }
.dot-plum { background: #9a5f8c; }
.library-nav a.active .dot {
  background: #f7f2e2;
}

.sidebar-foot {
  margin-top: auto;
  padding: 12px 8px 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.corpus-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-soft);
}
.corpus-line strong {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
}

.corpus-note {
  margin-top: 4px;
  font-size: 11px;
  color: var(--ink-faint);
}

.main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Breadcrumb bar */
.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 36px;
  font-size: 12.5px;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line-soft);
  background: var(--paper);
}

.crumb-sep {
  color: var(--ink-faint);
}

.crumbs strong {
  color: var(--ink);
  font-weight: 600;
}

/* Synthetic notice */
.synthetic-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 24px;
  background: var(--amber-tint);
  border-bottom: 1px solid var(--amber-border);
  font-size: 12px;
  color: var(--ink-soft);
}

.banner-pill {
  display: inline-block;
  padding: 1px 9px;
  border-radius: var(--radius-pill);
  background: var(--green);
  color: #f7f2e2;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ==========================================================================
   Main layout & cards
   ========================================================================== */

main {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px 36px 90px;
}

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.view-head h2 {
  font-size: 31px;
  font-weight: 500;
}

.view-head p {
  margin: 6px 0 0;
  max-width: 64ch;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.5;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
}

.card > h3 {
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 6px;
}

.card-note {
  margin: 0 0 16px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.5;
  max-width: 74ch;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 960px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Form controls & pill buttons
   ========================================================================== */

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

label.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

select, input[type="text"], textarea {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236e6151' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

select:focus, input:focus, textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(29, 106, 72, 0.15);
}

textarea {
  width: 100%;
  min-height: 76px;
  resize: vertical;
  line-height: 1.5;
}

button {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 550;
  color: var(--ink);
  background: var(--chip);
  border: 1px solid var(--chip-border);
  border-radius: var(--radius-pill);
  padding: 8px 18px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

button:hover {
  background: #ddcfa9;
  border-color: #c9b786;
}

button:active {
  transform: translateY(1px);
}

button.primary {
  background: var(--green);
  border-color: var(--green-deep);
  color: #f7f2e2;
}

button.primary:hover {
  background: var(--green-deep);
}

button.danger {
  color: var(--red-deep);
  background: var(--red-tint);
  border-color: var(--red-border);
}

button.danger:hover {
  background: #efd2c4;
}

button[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* ==========================================================================
   Pills & badges — tan taxonomy chips, green selection, warm states
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.badge.quote {
  background: var(--green-tint);
  color: var(--green-deep);
  border-color: var(--green-border);
}

.badge.decline {
  background: var(--red-tint);
  color: var(--red-deep);
  border-color: var(--red-border);
}

.badge.referred {
  background: var(--amber-tint);
  color: var(--amber-ink);
  border-color: var(--amber-border);
}

.badge.flag {
  background: var(--red-tint);
  color: var(--red-deep);
  border-color: var(--red-border);
}

.badge.pass {
  background: var(--green-tint);
  color: var(--green-deep);
  border-color: var(--green-border);
}

.badge.not_evaluated {
  background: var(--inset);
  color: var(--ink-soft);
  border-color: var(--line);
}

.badge.high { background: var(--red-tint); color: var(--red-deep); border-color: var(--red-border); }
.badge.medium { background: var(--amber-tint); color: var(--amber-ink); border-color: var(--amber-border); }
.badge.low { background: var(--inset); color: var(--ink-soft); border-color: var(--line); }

.badge.edge {
  background: var(--chip);
  color: var(--chip-ink);
  border-color: var(--chip-border);
  font-weight: 550;
}

.badge.sim {
  background: var(--inset);
  color: var(--ink-soft);
  border-color: var(--line);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge-inferred {
  background: var(--red-tint);
  color: var(--red-deep);
  border-color: var(--red-border);
  font-weight: 700;
}

.badge-source {
  background: var(--chip);
  color: var(--chip-ink);
  border-color: var(--chip-border);
  font-weight: 550;
}

/* ==========================================================================
   Verdict banner
   ========================================================================== */

.verdict {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px;
  border-radius: var(--radius-lg);
  border: 1px solid;
  margin-bottom: 24px;
}

.verdict.clean {
  background: var(--green-tint);
  border-color: var(--green-border);
}

.verdict.regressed {
  background: var(--red-tint);
  border-color: var(--red-border);
}

.verdict-icon {
  font-size: 20px;
  line-height: 1;
  font-family: var(--sans);
  flex-shrink: 0;
  margin-top: 2px;
}

.verdict.clean .verdict-icon { color: var(--green-deep); }
.verdict.regressed .verdict-icon { color: var(--red-deep); }

.verdict-body {
  flex: 1;
}

.verdict-status {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.verdict.clean .verdict-status { color: var(--green-deep); }
.verdict.regressed .verdict-status { color: var(--red-deep); }

.verdict-title {
  font-family: var(--sans);
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.015em;
  margin-bottom: 4px;
}

.verdict-desc {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.5;
  max-width: 82ch;
}

/* ==========================================================================
   Metrics
   ========================================================================== */

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.metric {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric-label {
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.metric-pair {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 8px;
}

.metric-base {
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 14px;
}

.metric-arrow {
  color: var(--ink-faint);
  font-size: 13px;
}

.metric-cand {
  color: var(--ink);
  font-family: var(--sans);
  font-size: 29px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}

.metric-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
}

.metric-delta.up { color: var(--green-deep); }
.metric-delta.down { color: var(--red-deep); }
.metric-delta.flat { color: var(--ink-faint); }

.metric-foot {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-soft);
}

/* ==========================================================================
   Tables — hairline ledger rows
   ========================================================================== */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  color: var(--ink);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr.clickable {
  cursor: pointer;
  transition: background-color 0.12s ease;
}

tbody tr.clickable:hover {
  background-color: rgba(231, 218, 185, 0.35);
}

td.num, th.num {
  text-align: right;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.regression-row td {
  background: rgba(166, 58, 44, 0.07);
}

.regression-row:hover td {
  background: rgba(166, 58, 44, 0.12);
}

.improvement-row td {
  background: rgba(29, 106, 72, 0.07);
}

.improvement-row:hover td {
  background: rgba(29, 106, 72, 0.12);
}

.val-null {
  display: inline-block;
  color: var(--ink-faint);
  font-size: 11px;
  background: var(--inset);
  border: 1px solid var(--line-soft);
  padding: 1px 7px;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
}

.val-bad {
  color: var(--red-deep);
  font-weight: 600;
}

.val-good {
  color: var(--green-deep);
  font-weight: 600;
}

/* ==========================================================================
   Document & evidence viewer
   ========================================================================== */

.doc-pane {
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  max-height: 480px;
  overflow: auto;
}

.doc-pane pre {
  margin: 0;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  color: #453b29;
}

mark.evidence {
  background: var(--amber);
  color: #43350a;
  border-radius: 3px;
  padding: 1px 3px;
  box-shadow: inset 0 -1px 0 rgba(67, 53, 10, 0.35);
  font-weight: 500;
}

.doc-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.doc-tabs button {
  padding: 6px 14px;
  font-size: 12px;
}

.doc-tabs button.active {
  background: var(--green);
  border-color: var(--green-deep);
  color: #f7f2e2;
}

.evidence-hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--ink-soft);
}

.field-row.selected td {
  background: rgba(29, 106, 72, 0.09) !important;
}

.conf {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
}
.conf.low { color: var(--red-deep); }
.conf.mid { color: var(--gold); }
.conf.high { color: var(--green-deep); }

.method {
  font-size: 12px;
  color: var(--ink-soft);
}

/* ==========================================================================
   Execution trace
   ========================================================================== */

.trace-step {
  position: relative;
  padding: 0 0 20px 26px;
  border-left: 2px solid var(--line);
}

.trace-step:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}

.trace-step::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--card);
  box-shadow: 0 0 0 1px var(--green-border);
}

.trace-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.trace-head h4 {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 650;
}

.trace-time {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-faint);
}

.trace-summary {
  margin: 4px 0 6px;
  font-size: 13px;
  color: var(--ink-soft);
}

.trace-detail {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.trace-detail li {
  margin-bottom: 3px;
}

.trace-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--green);
  opacity: 0.55;
  margin: 6px 0;
  min-width: 2px;
}

/* ==========================================================================
   Review queue
   ========================================================================== */

.queue-item {
  border-left: 3px solid var(--amber);
}

.queue-item.reviewed {
  border-left-color: var(--green);
}

.reason {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--inset);
  border: 1px solid var(--line-soft);
  margin-bottom: 10px;
  font-size: 13px;
}

.reason-kind {
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: var(--green-deep);
  text-transform: uppercase;
  display: block;
  margin-bottom: 4px;
}

.review-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.review-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.review-recorded {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--green-tint);
  border: 1px solid var(--green-border);
  font-size: 13px;
  color: var(--green-deep);
}

.disclaimer {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--ink-faint);
}

/* ==========================================================================
   About
   ========================================================================== */

.about-hero {
  margin-bottom: 30px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.about-hero h2 {
  font-size: 38px;
  margin-bottom: 10px;
}

.about-hero p.lead {
  font-size: 16px;
  color: var(--ink-soft);
  line-height: 1.5;
  max-width: 62ch;
}

/* Live stat strip */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 700px) {
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
}

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
}

.stat-num {
  font-family: var(--sans);
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1;
}

.stat-label {
  margin-top: 6px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-soft);
}

/* Gate formula strip */
.gate-strip {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--green-deep);
  color: #f2edda;
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  margin-bottom: 20px;
}

.gate-strip code {
  font-family: var(--mono);
  font-size: 14px;
}

.gate-strip span {
  font-size: 13px;
  opacity: 0.85;
}

/* Exhibit CTA (pre-load) */
.exhibit-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Utilities & footer
   ========================================================================== */

.empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 13.5px;
}

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 80px 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--line);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.error {
  padding: 18px 22px;
  border-radius: var(--radius-lg);
  background: var(--red-tint);
  border: 1px solid var(--red-border);
  color: var(--red-deep);
  font-size: 13.5px;
}

.inline-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.subtle { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

ul.plain {
  margin: 0;
  padding-left: 18px;
}
ul.plain li {
  margin-bottom: 6px;
}

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding: 20px 36px;
  border-top: 1px solid var(--line-soft);
  color: var(--ink-soft);
  font-size: 12.5px;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-mark {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--green-deep);
}

.footer-right {
  display: flex;
  align-items: center;
}

.footer-sep {
  opacity: 0.4;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 550;
  text-decoration: none;
}
.back-link:hover {
  text-decoration: underline;
}

details.changes summary {
  cursor: pointer;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  user-select: none;
  padding: 4px 0;
}
details.changes ul {
  margin-top: 10px;
}

/* ==========================================================================
   Welcome gate — the user loads the corpus explicitly, nothing auto-runs
   ========================================================================== */

.welcome {
  max-width: 720px;
  margin: 48px auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 42px 46px;
  box-shadow: var(--shadow-card);
}

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green-deep);
  margin-bottom: 10px;
}

.welcome h2 {
  font-size: 40px;
  max-width: 16ch;
  margin-bottom: 12px;
}

.welcome p {
  margin: 0 0 22px;
  color: var(--ink-soft);
  font-size: 14.5px;
  max-width: 56ch;
}

.welcome-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.welcome-link {
  font-size: 13.5px;
  font-weight: 550;
  text-decoration: none;
  border-bottom: 1px solid var(--green-border);
}
.welcome-link:hover {
  border-color: var(--green-deep);
}

.how-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
@media (max-width: 640px) {
  .how-grid { grid-template-columns: 1fr; }
}

.how-card {
  background: var(--inset);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.how-num {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--green-deep);
  margin-bottom: 6px;
}

.how-card h4 {
  font-size: 16px;
  margin-bottom: 4px;
}

.how-card p {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.btn-big {
  font-size: 14px;
  padding: 11px 28px;
}

.welcome-note {
  margin-top: 16px;
  font-size: 12px;
  color: var(--ink-faint);
}

/* ==========================================================================
   Lab instruments: calibration bars, what-if form
   ========================================================================== */

.cal-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
  font-size: 12.5px;
}

.cal-range {
  font-family: var(--mono);
  width: 62px;
  flex-shrink: 0;
  color: var(--ink-soft);
}

.cal-track {
  flex: 1;
  height: 8px;
  min-width: 40px;
  background: var(--inset-deep);
  border-radius: 4px;
  overflow: hidden;
}

.cal-fill {
  height: 100%;
  background: var(--green);
  border-radius: 4px;
}

.cal-stat {
  font-family: var(--mono);
  width: 118px;
  flex-shrink: 0;
  text-align: right;
  color: var(--ink-soft);
  white-space: nowrap;
}

.whatif-form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 14px;
}

.whatif-form label.field input {
  width: 150px;
}

/* ==========================================================================
   Narrow screens: sidebar becomes a top strip
   ========================================================================== */

@media (max-width: 860px) {
  .shell {
    flex-direction: column;
  }

  .sidebar {
    width: auto;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 16px;
  }

  .library-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }

  .nav-section {
    width: 100%;
    margin: 6px 4px 2px;
  }

  .sidebar-foot {
    display: none;
  }

  /* Small-screen readability: tighter type, scroll-safe tables. Cards become
     the scroll container so wide ledger tables stay usable without breaking
     the layout. */
  main {
    padding: 20px 14px 64px;
  }

  .view-head {
    margin-bottom: 18px;
  }

  .view-head h2 {
    font-size: 25px;
  }

  .card {
    padding: 16px 14px;
    overflow-x: auto;
  }

  table {
    font-size: 12.5px;
    min-width: 560px;
  }

  th, td {
    padding: 8px;
  }

  .verdict {
    padding: 16px;
  }

  .verdict-title {
    font-size: 18px;
  }

  .metric-cand {
    font-size: 25px;
  }

  .about-hero h2 {
    font-size: 30px;
  }

  .welcome {
    margin: 24px auto;
    padding: 26px 22px;
  }

  .welcome h2 {
    font-size: 30px;
  }

  .whatif-form label.field {
    flex: 1 1 140px;
  }

  .whatif-form label.field input {
    width: 100%;
  }

  .review-actions button {
    flex: 1 1 40%;
  }

  .gate-strip {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .cal-stat {
    width: 96px;
  }

  .crumbs, .footer {
    padding-left: 14px;
    padding-right: 14px;
  }

  .crumbs {
    font-size: 12px;
  }

  .synthetic-banner {
    font-size: 11px;
    text-align: center;
    padding: 8px 14px;
  }
}
