:root {
  color-scheme: light dark;
  --bg: #fafafa;
  --bg-alt: #ffffff;
  --bg-sidebar: #f0f1f3;
  --border: #d8dadf;
  --text: #1c1f24;
  --text-muted: #5b6068;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --proved: #15803d;
  --proved-bg: #dcfce7;
  --gap: #b45309;
  --gap-bg: #fef3c7;
  --dead: #6b7280;
  --dead-bg: #e5e7eb;
  --code-bg: #eef0f3;
  --row-hover: #eef2ff;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --bg-alt: #161a22;
    --bg-sidebar: #11151c;
    --border: #2a3038;
    --text: #e6e8ec;
    --text-muted: #9aa0a8;
    --accent: #60a5fa;
    --accent-hover: #93c5fd;
    --proved: #4ade80;
    --proved-bg: #14532d;
    --gap: #fbbf24;
    --gap-bg: #78350f;
    --dead: #6b7280;
    --dead-bg: #1f2937;
    --code-bg: #1f242d;
    --row-hover: #1c2230;
    --shadow: 0 1px 3px rgba(0,0,0,0.4);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

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

.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
}

.sidebar .brand {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}
.sidebar .brand a { color: var(--text); }

.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}
.sidebar ul li {
  margin-bottom: 0.4rem;
}
.sidebar ul a {
  display: block;
  padding: 0.45rem 0.6rem;
  border-radius: 4px;
  color: var(--text-muted);
}
.sidebar ul a:hover {
  background: var(--bg-alt);
  color: var(--text);
  text-decoration: none;
}

.sidebar .footer {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 1rem;
}

.content {
  flex: 1;
  padding: 2rem 2.5rem;
  max-width: 1400px;
  overflow-x: auto;
}

h1 { font-size: 1.6rem; margin: 0 0 1rem; font-weight: 600; }
h2 { font-size: 1.2rem; margin: 1.75rem 0 0.75rem; font-weight: 600; }
h3 { font-size: 1rem; margin: 1.25rem 0 0.5rem; font-weight: 600; }

.cards {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  min-width: 160px;
  box-shadow: var(--shadow);
}
.card .num {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.card .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.25rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
th, td {
  padding: 0.55rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th {
  font-weight: 600;
  background: var(--bg-sidebar);
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
tbody tr:hover { background: var(--row-hover); }
tbody tr:last-child td { border-bottom: none; }

tr.total-row td {
  font-weight: 700;
  background: var(--bg-sidebar);
}

.truth-table {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
}
.truth-table th, .truth-table td {
  text-align: center;
  padding: 0.45rem 0.7rem;
}
.truth-table tr.row-gap {
  border-left: 4px solid #ef4444;
}
.truth-table td.dontcare { color: var(--text-muted); }
.truth-table td.t { color: var(--proved); font-weight: 600; }
.truth-table td.f { color: #b91c1c; font-weight: 600; }

.status {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-full_mcdc { background: var(--proved-bg); color: var(--proved); }
.status-partial_mcdc { background: var(--gap-bg); color: var(--gap); }
.status-no_mcdc { background: var(--dead-bg); color: var(--dead); }

.proved { color: var(--proved); font-weight: 600; }
.proved::before { content: "\2713 "; }
.gap { color: var(--gap); font-weight: 600; }
.gap::before { content: "\26A0 "; }
.dead { color: var(--dead); text-decoration: line-through; }

.cond-proved, .cond-gap, .cond-dead { padding: 0.3rem 0; }

code, .br {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--code-bg);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.88em;
}

.btn {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  background: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.88rem;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--bg-sidebar); text-decoration: none; }
.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: white;
}

ul.conditions {
  list-style: none;
  padding: 0;
  margin: 0;
}
ul.conditions li {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
ul.conditions li:last-child { border-bottom: none; }

.muted { color: var(--text-muted); }
.empty {
  padding: 3rem;
  text-align: center;
  color: var(--text-muted);
  background: var(--bg-alt);
  border: 1px dashed var(--border);
  border-radius: 6px;
}

.back-link { margin-top: 1.5rem; display: inline-block; }

/* v0.9.1 — gap drill-down view */
.gap-link {
  margin-left: 0.5rem;
  font-size: 0.85em;
  color: var(--accent);
  text-decoration: none;
}
.gap-link:hover { text-decoration: underline; }

.box {
  padding: 1rem 1.2rem;
  margin: 1rem 0;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 4px;
}
.box pre {
  background: transparent;
  padding: 0;
  margin: 0.5rem 0;
}

pre.stub {
  background: var(--code-bg);
  color: var(--text);
  padding: 1rem 1.2rem;
  border-radius: 6px;
  font-family: 'SF Mono', Monaco, Consolas, 'Courier New', monospace;
  font-size: 0.88em;
  line-height: 1.5;
  overflow-x: auto;
  border: 1px solid var(--border);
}

/* v0.9.2 — coverage bar component */
.cov-bar {
  display: inline-flex;
  width: 160px;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  vertical-align: middle;
}
.cov-bar.empty::after {
  content: "—";
  color: var(--text-muted);
  margin: auto;
  font-size: 0.85em;
}
.cov-bar .seg-proved { background: linear-gradient(180deg, #2ea043 0%, #238636 100%); }
.cov-bar .seg-gap    { background: linear-gradient(180deg, #d2a106 0%, #9e7a00 100%); }
.cov-bar .seg-dead   { background: linear-gradient(180deg, #6e7681 0%, #484f58 100%); }
.cov-bar > span { height: 100%; }

@media (prefers-color-scheme: dark) {
  .cov-bar .seg-proved { background: linear-gradient(180deg, #3fb950 0%, #2ea043 100%); }
  .cov-bar .seg-gap    { background: linear-gradient(180deg, #f0b400 0%, #c8961a 100%); }
  .cov-bar .seg-dead   { background: linear-gradient(180deg, #8b949e 0%, #6e7681 100%); }
}

/* Total-row visual emphasis */
tr.total-row {
  font-weight: 600;
  border-top: 2px solid var(--accent);
  background: var(--bg-alt);
}

/* Make full-MC/DC cell stand out */
table td:nth-child(4) {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

/* ──────────────────────────────────────────────────────────────────
   v0.24 — inline source snippet on Decision / Gap pages.
   Plain pre/span layout (no syntax highlighting — that's the
   full-file view's job). Target line gets a left border, a tinted
   background, and a `>` gutter marker.
   ────────────────────────────────────────────────────────────── */
pre.src-snippet {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6em 0.8em;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
  line-height: 1.5;
  margin: 0.6em 0 1.2em 0;
}
pre.src-snippet > span {
  display: block;
  padding: 0 0.3em;
  border-left: 3px solid transparent;
  white-space: pre;
}
pre.src-snippet .ln {
  display: inline-block;
  min-width: 4ch;
  margin-right: 0.6em;
  color: var(--muted, #6e7681);
  text-align: right;
  user-select: none;
}
pre.src-snippet .src-snippet-target {
  background: rgba(208, 161, 6, 0.10);
  border-left-color: var(--accent, #d2a106);
  font-weight: 500;
}
@media (prefers-color-scheme: dark) {
  pre.src-snippet .src-snippet-target {
    background: rgba(240, 180, 0, 0.15);
  }
}

/* ──────────────────────────────────────────────────────────────────
   v0.24 — full-file source pages (DEC-031, Option B). One page per
   unique source_file across all Decisions. Lines that carry a
   Decision get `.marked`; the `#L<n>` anchor on each line wrapper
   makes deep links from snippet pages land correctly.
   ────────────────────────────────────────────────────────────── */
pre.source-full {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6em 0;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
  line-height: 1.5;
  margin: 0.6em 0;
}
pre.source-full .src-line {
  display: block;
  padding: 0 0.6em;
  white-space: pre;
  border-left: 3px solid transparent;
}
pre.source-full .src-line.marked {
  background: rgba(208, 161, 6, 0.08);
  border-left-color: var(--accent, #d2a106);
}
pre.source-full .src-line:target {
  background: rgba(208, 161, 6, 0.20);
  outline: 2px solid var(--accent, #d2a106);
}
pre.source-full .src-line .ln {
  display: inline-block;
  width: 4ch;
  margin-right: 0.8em;
  color: var(--muted, #6e7681);
  text-align: right;
  user-select: none;
}
@media (prefers-color-scheme: dark) {
  pre.source-full .src-line.marked {
    background: rgba(240, 180, 0, 0.10);
  }
  pre.source-full .src-line:target {
    background: rgba(240, 180, 0, 0.25);
  }
}

/* "view full file →" link below the snippet on Decision / Gap pages */
p.src-link {
  margin: -0.4em 0 1em 0;
  font-size: 0.85em;
}

/* ──────────────────────────────────────────────────────────────────
   v0.27 — per-condition provenance (DEC-035). Shows which function a
   branch lives in, its kind (br_if / br_table arm), and the inline
   call chain when one exists. Muted so it sits under the condition
   verdict without competing with it.
   ────────────────────────────────────────────────────────────── */
.conditions .prov {
  font-size: 0.82em;
  margin-top: 0.2rem;
  line-height: 1.4;
}
.conditions .prov .kind {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--code-bg);
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
}
.conditions .prov .inline-chain {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
