:root {
  color-scheme: dark;
  --ground: #0b0d11;
  --ground-raised: #0e1116;
  --panel: #101319;
  --panel-strong: #131720;
  --rule: #1c222b;
  --rule-strong: #2a3441;
  --ink: #e7ebf1;
  --dim: #98a3b3;
  --faint: #8490a1;
  --signal: #4da2ff;
  --allow: #5fd08a;
  --allow-bg: #102219;
  --refuse: #ff7b72;
  --refuse-bg: #251517;
  --warning: #f2b84b;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --page: min(100% - 40px, 1380px);
}

* { box-sizing: border-box; }

html {
  background: var(--ground);
  color: var(--ink);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(90deg, transparent 0, transparent calc(100% - 1px), rgba(255,255,255,.018) 100%) 0 0 / 32px 32px,
    var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select { font: inherit; }

button { color: inherit; }

button:not(:disabled) { cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
  translate: 0 -150%;
  padding: 9px 13px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--ground);
  font-weight: 700;
}

.skip-link:focus { translate: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px max(20px, calc((100vw - 1380px) / 2));
  border-bottom: 1px solid var(--rule);
  background: rgba(11, 13, 17, .9);
  backdrop-filter: blur(15px) saturate(140%);
}

.brand {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  text-decoration: none;
}

.brand img { border-radius: 6px; }
.brand span { color: var(--ink); font-weight: 700; }
.brand strong { color: var(--dim); font-weight: 500; }
.brand .brand-divider { color: var(--rule-strong); }

.topbar-state {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.connection-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--allow);
  box-shadow: 0 0 0 3px rgba(95, 208, 138, .1);
}

.topbar-separator {
  width: 1px;
  height: 14px;
  margin: 0 3px;
  background: var(--rule-strong);
}

.app-shell {
  width: var(--page);
  margin: 0 auto;
  padding: 42px 0 80px;
}

.case-strip {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(440px, .7fr);
  align-items: end;
  gap: clamp(32px, 7vw, 100px);
  padding: 0 0 32px;
}

.eyebrow,
.panel-index {
  margin: 0 0 7px;
  color: var(--signal);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .11em;
  line-height: 1.4;
  text-transform: uppercase;
}

.case-title-block h1 {
  max-width: 790px;
  margin: 0;
  font-size: clamp(32px, 4.4vw, 60px);
  font-weight: 670;
  letter-spacing: -.045em;
  line-height: .98;
}

.case-title-block > p:last-child {
  max-width: 720px;
  margin: 18px 0 0;
  color: var(--dim);
  font-size: clamp(15px, 1.4vw, 18px);
}

.case-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0;
  border-top: 1px solid var(--rule-strong);
}

.case-facts div {
  min-width: 0;
  padding: 13px 14px 0 0;
  border-right: 1px solid var(--rule);
}

.case-facts div + div { padding-left: 14px; }
.case-facts div:last-child { border-right: 0; }

.case-facts dt,
.approval-meta dt {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.case-facts dd,
.approval-meta dd {
  margin: 4px 0 0;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11.5px;
}

.case-facts .policy-value { color: var(--warning); }

.instrument-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 11px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.instrument-line i {
  height: 1px;
  min-width: 15px;
  flex: 1;
  background: var(--rule);
}

.review-grid {
  display: grid;
  grid-template-columns: 226px minmax(420px, 1fr) 270px;
  align-items: stretch;
  gap: 10px;
}

.instrument-panel {
  min-width: 0;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: rgba(16, 19, 25, .93);
  box-shadow: 0 14px 42px rgba(0,0,0,.13);
}

.panel-heading,
.code-toolbar {
  display: flex;
  min-height: 65px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--rule);
  background: var(--ground-raised);
}

.panel-heading h2,
.code-toolbar h2,
.section-heading h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -.015em;
}

.panel-heading .panel-index,
.code-toolbar .panel-index,
.section-heading .panel-index { margin-bottom: 2px; }

.count-badge {
  display: inline-grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 10px;
}

.file-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.file-row { border-bottom: 1px solid var(--rule); }

.file-row [data-open-file] {
  display: grid;
  width: 100%;
  min-height: 68px;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border: 0;
  border-left: 2px solid transparent;
  background: transparent;
  color: inherit;
  text-decoration: none;
  text-align: left;
  transition: background .16s ease, border-color .16s ease;
}

.file-row [data-open-file]:hover { background: #141922; }

.file-row.is-selected [data-open-file] {
  border-left-color: var(--signal);
  background: #121925;
}

.file-glyph {
  display: inline-grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 1px solid var(--rule-strong);
  border-radius: 5px;
  color: var(--signal);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .04em;
}

.file-copy { min-width: 0; }

.file-name,
.file-detail,
.file-content {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-name {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11.5px;
}

.file-detail,
.file-lines {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9.5px;
}

.file-content {
  margin-top: 3px;
  color: #718096;
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.35;
}

.graft-field-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.scope-note {
  display: flex;
  gap: 9px;
  margin: 13px;
  padding: 11px;
  border: 1px dashed var(--rule-strong);
  border-radius: 7px;
  color: var(--dim);
  background: #0d1015;
}

.scope-note p { margin: 0; font-size: 11px; line-height: 1.5; }
.scope-note strong { color: var(--ink); font-weight: 620; }
.scope-icon { color: var(--allow); font-family: var(--mono); }

.code-panel {
  display: grid;
  min-height: 405px;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.toolbar-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

.quiet-button {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  background: transparent;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 9.5px;
  transition: border-color .16s ease, color .16s ease, background .16s ease;
}

.quiet-button:hover:not(:disabled) {
  border-color: #415169;
  background: #151b24;
  color: var(--ink);
}

.quiet-button:disabled { opacity: .38; cursor: not-allowed; }

.code-surface {
  position: relative;
  min-height: 290px;
  overflow: auto;
  background:
    linear-gradient(90deg, rgba(77, 162, 255, .035) 1px, transparent 1px) 0 0 / 44px 100%,
    #0c0f14;
}

.code-ruler {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  height: 28px;
  align-items: center;
  padding: 0 12px;
  border-bottom: 1px solid var(--rule);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.code-surface pre {
  min-width: max-content;
  margin: 0;
  padding: 22px 28px 36px 62px;
  counter-reset: code-line;
  color: #dfe7f2;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.85;
  tab-size: 2;
}

.code-line {
  position: relative;
  display: block;
  min-height: 1.85em;
  counter-increment: code-line;
}

.code-line::before {
  position: absolute;
  right: calc(100% + 24px);
  width: 24px;
  color: #4f5a69;
  content: counter(code-line);
  text-align: right;
}

.code-line.is-changed {
  margin: 0 -28px 0 -62px;
  padding: 0 28px 0 62px;
  border-left: 2px solid var(--allow);
  background: rgba(95, 208, 138, .08);
}

.source-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  padding: 8px 12px;
  border-top: 1px solid var(--rule);
  color: var(--faint);
  background: var(--ground-raised);
  font-family: var(--mono);
  font-size: 9.5px;
}

.source-state { color: var(--dim); }
.source-state-bad { color: var(--refuse); }
.source-state-good { color: var(--allow); }

.live-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--allow);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.live-label i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.audit-panel { display: flex; flex-direction: column; }

.audit-log {
  margin: 0;
  padding: 16px 14px 6px;
  list-style: none;
}

.audit-log li {
  position: relative;
  display: grid;
  grid-template-columns: 13px minmax(0, 1fr);
  gap: 10px;
  min-height: 65px;
}

.audit-log li:not(:last-child)::after {
  position: absolute;
  top: 13px;
  bottom: 0;
  left: 4px;
  width: 1px;
  background: var(--rule-strong);
  content: "";
}

.audit-marker {
  position: relative;
  z-index: 1;
  width: 9px;
  height: 9px;
  margin-top: 3px;
  border: 2px solid var(--ground-raised);
  border-radius: 50%;
  background: var(--faint);
  box-shadow: 0 0 0 1px var(--rule-strong);
}

.audit-marker-good { background: var(--allow); }
.audit-marker-bad { background: var(--refuse); }

.audit-log strong,
.audit-log small { display: block; }
.audit-log strong { font-size: 11.5px; font-weight: 630; }
.audit-log small { margin-top: 2px; color: var(--faint); font-size: 10.5px; line-height: 1.45; }

.receipt {
  margin: auto 12px 12px;
  padding: 12px;
  border: 1px solid var(--rule-strong);
  border-radius: 7px;
  background: #0c0f14;
}

.receipt-label {
  display: block;
  margin-bottom: 8px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.receipt strong { display: block; font-size: 12px; }
.receipt p { margin: 5px 0 0; color: var(--dim); font-size: 10.5px; line-height: 1.5; }
.receipt.is-success { border-color: #27543a; background: var(--allow-bg); }
.receipt.is-rejected { border-color: #513037; background: var(--refuse-bg); }

.patch-section,
.tests-section { margin-top: 64px; }

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 16px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--rule);
}

.section-heading h2 { font-size: clamp(22px, 2.7vw, 32px); letter-spacing: -.032em; }

.section-heading > p {
  max-width: 500px;
  margin: 0;
  color: var(--dim);
  font-size: 13px;
  text-align: right;
}

.patch-list {
  border-top: 1px solid var(--rule-strong);
}

.patch-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(245px, .78fr) minmax(280px, 1fr) minmax(205px, .68fr) 170px;
  align-items: center;
  min-height: 146px;
  border-bottom: 1px solid var(--rule);
  background: rgba(11, 13, 17, .74);
}

.patch-row::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: transparent;
  content: "";
}

.patch-row.is-recommended::before { background: var(--allow); }
.patch-row.is-active { background: #111720; }

.patch-row > header,
.patch-row > p,
.patch-row > .mini-diff,
.patch-row > .patch-actions {
  min-width: 0;
  min-height: 100%;
  padding: 21px 18px;
  border-right: 1px solid var(--rule);
}

.patch-row > header,
.patch-row > .patch-actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.patch-row > .patch-actions { border-right: 0; align-items: stretch; gap: 12px; }

.patch-id-line { display: grid; grid-template-columns: 27px minmax(0, 1fr); align-items: start; gap: 9px; }

.rank {
  padding-top: 2px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
}

.patch-row h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
}

.confidence {
  margin: 11px 0 0 36px;
  color: var(--allow);
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.confidence-low { color: var(--refuse); }

.patch-row > p {
  display: flex;
  align-items: center;
  margin: 0;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.6;
}

.patch-row > p code,
.runner-note code { font-family: var(--mono); color: var(--ink); }

.mini-diff {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  overflow: hidden;
  background: #0c0f14;
  font-family: var(--mono);
  font-size: 10px;
}

.mini-diff span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.minus { color: var(--refuse); }
.plus { color: var(--allow); }

.evidence {
  color: var(--allow);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.45;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.evidence-bad { color: var(--refuse); }

.apply-button {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #2b5d41;
  border-radius: 6px;
  background: var(--allow-bg);
  color: #9ce8b9;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  transition: background .16s ease, border-color .16s ease, translate .16s ease;
}

.apply-button:hover:not(:disabled) { translate: 0 -1px; border-color: var(--allow); background: #153020; }
.apply-button:active:not(:disabled) { translate: 0; }
.apply-button:disabled { opacity: .36; cursor: not-allowed; }

.section-heading-tests { align-items: center; }

.suite-output {
  color: var(--refuse);
  font-family: var(--mono);
  font-size: 11px;
}

.suite-output.is-passing { color: var(--allow); }
.suite-output.is-running { color: var(--warning); }

.table-shell {
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 9px;
  background: var(--panel);
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 11px;
}

caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

th,
td {
  height: 47px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  white-space: nowrap;
}

thead th {
  height: 38px;
  color: var(--faint);
  background: var(--ground-raised);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

tbody th { color: var(--ink); font-weight: 550; }
tbody td { color: var(--dim); }
tbody tr:last-child th,
tbody tr:last-child td { border-bottom: 0; }

.test-state {
  display: inline-flex;
  min-width: 56px;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.test-state::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.test-state.is-pass { color: var(--allow); }
.test-state.is-fail { color: var(--refuse); }
.test-state.is-running { color: var(--warning); }
.test-state.is-waiting { color: var(--faint); }

.runner-note {
  max-width: 720px;
  margin: 13px 0 0;
  color: var(--faint);
  font-size: 11px;
}

.approval-dialog {
  width: min(620px, calc(100% - 28px));
  max-height: calc(100vh - 28px);
  padding: 0;
  overflow: auto;
  border: 1px solid #374557;
  border-radius: 12px;
  background: var(--panel-strong);
  color: var(--ink);
  box-shadow: 0 28px 100px rgba(0,0,0,.68);
}

.approval-dialog::backdrop {
  background: rgba(3, 5, 8, .78);
  backdrop-filter: blur(5px);
}

.dialog-card { margin: 0; padding: clamp(22px, 5vw, 38px); }

.dialog-signal {
  display: grid;
  grid-template-columns: 9px 1fr 9px;
  align-items: center;
  gap: 8px;
  margin-bottom: 25px;
}

.dialog-signal span {
  width: 9px;
  height: 9px;
  border: 2px solid var(--warning);
  border-radius: 50%;
}

.dialog-signal i { height: 1px; background: linear-gradient(90deg, var(--warning), var(--rule-strong)); }

.approval-dialog h2 {
  max-width: 500px;
  margin: 0;
  font-size: clamp(26px, 5vw, 38px);
  font-weight: 670;
  letter-spacing: -.04em;
  line-height: 1.05;
}

.dialog-copy { margin: 14px 0 0; color: var(--dim); font-size: 14px; }

.approval-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 24px 0 0;
  padding: 13px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.approval-meta div { padding: 0 13px; border-right: 1px solid var(--rule); }
.approval-meta div:first-child { padding-left: 0; }
.approval-meta div:last-child { border-right: 0; }

.approval-diff {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 0 12px;
  margin: 23px 0;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: #0b0e12;
  font-family: var(--mono);
  font-size: 11px;
}

.approval-diff > * { min-width: max-content; padding: 8px 0; }
.approval-diff .line-no { padding-left: 10px; color: var(--faint); }
.approval-diff code:nth-of-type(1) { color: var(--refuse); }
.approval-diff code:nth-of-type(2) { color: var(--allow); }

.dialog-actions { display: grid; grid-template-columns: .7fr 1.3fr; gap: 9px; }

.dialog-actions button {
  min-height: 46px;
  border-radius: 7px;
  font-weight: 700;
}

.reject-button { border: 1px solid var(--rule-strong); background: transparent; color: var(--dim); }
.reject-button:hover { border-color: #526075; color: var(--ink); }
.approve-button { border: 1px solid #347750; background: var(--allow); color: #06150c; }
.approve-button:hover { background: #76dd9c; }
.dialog-actions button:disabled { opacity: .45; cursor: wait; }

.keyboard-note { margin: 12px 0 0; color: var(--faint); font-family: var(--mono); font-size: 9px; text-align: center; }

/* Live contract proof */
.app-shell {
  padding-top: 30px;
}

.proof-hero {
  display: grid;
  grid-template-columns: minmax(380px, .78fr) minmax(620px, 1.22fr);
  min-height: min(480px, calc(100dvh - 96px));
  align-items: stretch;
  gap: clamp(28px, 4vw, 64px);
}

.proof-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  padding: clamp(34px, 6vw, 72px) 0;
}

.proof-copy h1 {
  max-width: 13ch;
  margin: 0;
  font-size: clamp(45px, 5.1vw, 72px);
  font-weight: 690;
  letter-spacing: -.055em;
  line-height: .95;
  text-wrap: balance;
}

.proof-summary {
  max-width: 560px;
  margin: 22px 0 0;
  color: var(--dim);
  font-size: clamp(15px, 1.3vw, 18px);
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 30px;
}

.hero-run-button,
.hero-tool-link {
  min-height: 48px;
  border-radius: 7px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.hero-run-button {
  display: inline-flex;
  min-width: 220px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 15px 0 17px;
  border: 1px solid #3b7f56;
  background: var(--allow);
  color: #06150c;
  box-shadow: 0 12px 34px rgba(95, 208, 138, .14);
}

.hero-run-button:disabled {
  cursor: default;
  opacity: .82;
}

.hero-tool-link {
  display: inline-flex;
  align-items: center;
  padding-inline: 4px;
  color: var(--ink);
  text-underline-offset: 5px;
}

.hero-tool-link:hover {
  color: var(--signal);
  text-decoration: underline;
}

.proof-footnote {
  max-width: 520px;
  margin: 24px 0 0;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.55;
}

.repair-stage {
  position: relative;
  isolation: isolate;
  display: grid;
  min-width: 0;
  align-self: center;
  overflow: hidden;
  border: 1px solid var(--rule-strong);
  border-radius: 14px;
  background:
    radial-gradient(circle at 76% 18%, rgba(95, 208, 138, .08), transparent 27%),
    linear-gradient(145deg, rgba(17, 22, 29, .98), rgba(11, 14, 18, .98));
  box-shadow: 0 30px 90px rgba(0, 0, 0, .35);
}

.repair-stage::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    linear-gradient(90deg, transparent calc(100% - 1px), rgba(255, 255, 255, .026) 100%) 0 0 / 28px 28px,
    linear-gradient(0deg, transparent calc(100% - 1px), rgba(255, 255, 255, .018) 100%) 0 0 / 28px 28px;
  content: "";
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .7), transparent 82%);
  pointer-events: none;
}

.repair-stage::after {
  position: absolute;
  z-index: 4;
  top: 0;
  bottom: 0;
  left: -20%;
  width: 18%;
  background: linear-gradient(90deg, transparent, rgba(95, 208, 138, .12), transparent);
  content: "";
  opacity: 0;
  pointer-events: none;
  transform: skewX(-12deg);
}

.repair-stage-head,
.repair-stage-footer {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px 19px;
}

.repair-stage-head {
  border-bottom: 1px solid var(--rule);
}

.repair-stage-head > div {
  display: grid;
  gap: 3px;
}

.stage-overline,
.repair-stage-head strong,
.repair-stage-status,
.repair-stage-footer,
.repair-node-label,
.repair-node > strong,
.approval-bridge {
  font-family: var(--mono);
}

.stage-overline {
  color: var(--signal);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .09em;
}

.repair-stage-head strong {
  font-size: 13px;
}

.repair-stage-status {
  color: var(--warning);
  font-size: 10px;
  letter-spacing: .03em;
}

.repair-flow {
  display: grid;
  min-height: 330px;
  grid-template-columns: minmax(0, 1fr) 118px minmax(0, 1fr);
  align-items: center;
  gap: 0;
  padding: clamp(28px, 4vw, 52px) clamp(18px, 2.6vw, 34px);
}

.repair-node {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 205px;
  align-content: space-between;
  gap: 24px;
  padding: 22px;
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  background: rgba(11, 14, 18, .92);
}

.repair-node::before {
  position: absolute;
  top: -1px;
  right: 18px;
  left: 18px;
  height: 1px;
  background: var(--rule-strong);
  content: "";
}

.repair-node-before::before {
  background: color-mix(in srgb, var(--refuse) 62%, var(--rule-strong));
}

.repair-node-after::before {
  background: color-mix(in srgb, var(--allow) 72%, var(--rule-strong));
}

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

.repair-node code {
  display: block;
  white-space: nowrap;
  color: var(--ink);
  font-family: var(--mono);
  font-size: clamp(16px, 1.55vw, 21px);
  letter-spacing: -.03em;
}

.repair-node mark {
  padding: 0 .16em;
  background: transparent;
  color: var(--refuse);
  font: inherit;
}

.repair-node-after mark {
  color: var(--allow);
}

.repair-node > strong {
  color: var(--dim);
  font-size: 10px;
  font-weight: 600;
}

.repair-node-after > strong {
  color: var(--allow);
}

.approval-bridge {
  display: grid;
  min-width: 0;
  grid-template-rows: 1fr auto 1fr;
  justify-items: center;
  gap: 12px;
  align-self: stretch;
  color: var(--warning);
  text-align: center;
}

.approval-bridge > span {
  width: 1px;
  background: linear-gradient(var(--rule-strong), var(--warning));
}

.approval-bridge > span:last-child {
  background: linear-gradient(var(--warning), var(--rule-strong));
}

.approval-bridge > div {
  display: grid;
  gap: 5px;
  padding: 10px 6px;
}

.approval-bridge small {
  color: var(--faint);
  font-size: 8px;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.approval-bridge strong {
  max-width: 12ch;
  font-size: 9px;
  line-height: 1.45;
}

.repair-stage-footer {
  border-top: 1px solid var(--rule);
  color: var(--faint);
  font-size: 9.5px;
}

.repair-stage-footer strong {
  color: var(--dim);
  font-weight: 600;
  text-align: right;
}

.repair-stage[data-phase="approval"] {
  border-color: color-mix(in srgb, var(--warning) 48%, var(--rule-strong));
}

.repair-stage[data-phase="running"],
.repair-stage[data-phase="verified"] {
  border-color: color-mix(in srgb, var(--allow) 52%, var(--rule-strong));
}

.repair-stage[data-phase="verified"] .repair-stage-status,
.repair-stage[data-phase="verified"] .repair-stage-footer strong {
  color: var(--allow);
}

.repair-stage[data-phase="verified"] .repair-node-after {
  border-color: color-mix(in srgb, var(--allow) 58%, var(--rule-strong));
  background: color-mix(in srgb, var(--allow-bg) 76%, var(--ground));
  box-shadow: 0 18px 50px rgba(95, 208, 138, .08);
}

.tool-surface {
  margin: 18px 0 28px;
  overflow: hidden;
  border-block: 1px solid var(--rule-strong);
  background: rgba(14, 17, 22, .7);
}

.tool-surface-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  padding: 24px 22px 20px;
}

.tool-surface-head h2 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(24px, 2.7vw, 38px);
  font-weight: 650;
  letter-spacing: -.04em;
  line-height: 1.04;
}

.tool-count {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--dim);
  font-family: var(--mono);
}

.tool-count strong {
  color: var(--ink);
  font-size: 48px;
  font-weight: 450;
  letter-spacing: -.08em;
  line-height: .8;
}

.tool-count span {
  font-size: 10px;
}

.tool-registry {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--rule);
  list-style: none;
}

.tool-registry li {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 94px;
  align-content: center;
  gap: 7px;
  padding: 17px 19px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.tool-registry li:nth-child(4n) {
  border-right: 0;
}

.tool-registry li:nth-last-child(-n + 4) {
  border-bottom: 0;
}

.tool-registry li::after {
  position: absolute;
  top: 20px;
  right: 18px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--rule-strong);
  content: "";
  box-shadow: 0 0 0 3px transparent;
}

html[data-webmcp="ready"] .tool-registry li::after {
  background: var(--allow);
  box-shadow: 0 0 0 3px rgba(95, 208, 138, .08);
}

html[data-webmcp="ready"] .connection-dot {
  box-shadow: 0 0 0 4px rgba(95, 208, 138, .1), 0 0 20px rgba(95, 208, 138, .22);
}

.tool-registry span,
.tool-registry small {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .05em;
}

.tool-registry code {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 650;
}

.tool-registry small {
  letter-spacing: 0;
}

.tool-registry .tool-write {
  background: linear-gradient(135deg, rgba(95, 208, 138, .07), transparent 58%);
}

.tool-registry .tool-write code,
.tool-registry .tool-write small {
  color: var(--allow);
}

.tool-surface + .review-grid {
  margin-top: 12px;
}

.review-grid {
  gap: 12px;
}

.instrument-panel {
  border-color: var(--rule-strong);
  box-shadow: 0 18px 54px rgba(0, 0, 0, .17);
}

.panel-heading,
.code-toolbar {
  min-height: 58px;
}

.section-heading h2 {
  font-size: clamp(24px, 2.6vw, 34px);
  letter-spacing: -.035em;
}

.section-heading > p {
  max-width: 53ch;
}

.source-state-ready {
  color: var(--warning);
}

.patch-row.is-recommended {
  border-color: color-mix(in srgb, var(--allow) 48%, var(--rule-strong));
  background: linear-gradient(90deg, rgba(95, 208, 138, .045), transparent 44%);
  box-shadow: 0 18px 54px rgba(0, 0, 0, .16);
}

@media (hover: hover) {
  .hero-run-button:not(:disabled):hover {
    background: #76dd9c;
    transform: translateY(-1px);
  }

  .tool-registry li:hover {
    background-color: rgba(77, 162, 255, .035);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-run-button,
  .repair-node-after,
  .tool-registry li {
    transition: transform 150ms cubic-bezier(0, 0, .2, 1), background-color 150ms cubic-bezier(0, 0, .2, 1), border-color 150ms cubic-bezier(0, 0, .2, 1), box-shadow 150ms cubic-bezier(0, 0, .2, 1);
  }

  .repair-stage[data-phase="verified"]::after {
    animation: repair-scan 400ms cubic-bezier(0, 0, .2, 1) 1;
  }

  .repair-stage[data-phase="verified"] .repair-node-after {
    transform: translateY(-3px);
  }
}

@keyframes repair-scan {
  0% { left: -20%; opacity: 0; }
  22% { opacity: 1; }
  100% { left: 112%; opacity: 0; }
}

@media (max-width: 1120px) {
  .proof-hero {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    gap: 0;
  }

  .proof-copy {
    padding: 38px 0 44px;
  }

  .proof-copy h1 {
    max-width: 14ch;
  }

  .repair-stage {
    width: 100%;
  }

  .tool-surface {
    margin-top: 28px;
  }

  .tool-registry {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tool-registry li:nth-child(4n) {
    border-right: 1px solid var(--rule);
  }

  .tool-registry li:nth-child(2n) {
    border-right: 0;
  }

  .tool-registry li:nth-last-child(-n + 4) {
    border-bottom: 1px solid var(--rule);
  }

  .tool-registry li:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .case-strip { grid-template-columns: 1fr; gap: 28px; }
  .case-facts { max-width: 700px; }
  .review-grid { grid-template-columns: 210px minmax(0, 1fr); }
  .audit-panel { grid-column: 1 / -1; min-height: 210px; }
  .audit-log { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .audit-log li { min-height: 48px; }
  .audit-log li:not(:last-child)::after { display: none; }
  .receipt { margin-top: 8px; }
  .patch-row { grid-template-columns: minmax(230px, .85fr) minmax(290px, 1.15fr) minmax(205px, .75fr); }
  .patch-row > .patch-actions { grid-column: 1 / -1; min-height: auto; flex-direction: row; align-items: center; justify-content: space-between; border-top: 1px solid var(--rule); }
  .apply-button { min-width: 150px; }
}

@media (max-width: 900px) and (min-width: 761px) {
  .patch-row { grid-template-columns: 230px minmax(0, 1fr); }
  .patch-row > .mini-diff { grid-column: 1 / -1; min-height: 72px; border-top: 1px solid var(--rule); }
  .patch-row > .patch-actions { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  :root { --page: min(100% - 28px, 1380px); }
  .topbar { padding-inline: 14px; }
  .brand strong,
  .brand-divider,
  .topbar-separator { display: none; }
  .app-shell { padding-top: 26px; }
  .proof-copy {
    padding: 24px 0 34px;
  }

  .proof-copy h1 {
    max-width: 12ch;
    font-size: clamp(40px, 12vw, 58px);
  }

  .proof-summary {
    margin-top: 18px;
  }

  .hero-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    margin-top: 24px;
  }

  .hero-run-button {
    width: 100%;
  }

  .hero-tool-link {
    min-height: 44px;
  }

  .repair-flow {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    padding: 20px;
  }

  .repair-node {
    min-height: 164px;
  }

  .approval-bridge {
    min-height: 64px;
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: auto;
    align-items: center;
  }

  .approval-bridge > span {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, var(--rule-strong), var(--warning));
  }

  .approval-bridge > span:last-child {
    background: linear-gradient(90deg, var(--warning), var(--rule-strong));
  }

  .approval-bridge > div {
    padding: 4px;
  }

  .approval-bridge strong {
    max-width: 16ch;
  }

  .repair-stage-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .repair-stage-footer strong {
    text-align: left;
  }

  .tool-surface-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
    padding-inline: 16px;
  }

  .tool-count {
    align-items: center;
  }

  .tool-count strong {
    font-size: 40px;
  }

  .tool-registry li {
    min-height: 86px;
    padding-inline: 16px;
  }
  .case-strip { padding-bottom: 23px; }
  .case-title-block h1 { max-width: 540px; }
  .case-facts { grid-template-columns: 1fr 1fr; }
  .case-facts div:nth-child(2) { border-right: 0; }
  .case-facts div:last-child { grid-column: 1 / -1; padding-left: 0; padding-top: 12px; }
  .instrument-line span:nth-of-type(n + 2),
  .instrument-line i:nth-of-type(n + 2) { display: none; }
  .review-grid { grid-template-columns: 1fr; }
  .files-panel,
  .code-panel,
  .audit-panel { grid-column: auto; }
  .file-list { display: grid; grid-template-columns: repeat(3, 1fr); }
  .file-row { min-width: 0; border-right: 1px solid var(--rule); }
  .file-row:last-child { border-right: 0; }
  .file-row [data-open-file] { grid-template-columns: 26px minmax(0, 1fr); min-height: 62px; padding: 8px; }
  .file-lines { display: none; }
  .file-detail { font-size: 8.5px; }
  .scope-note { margin-top: 10px; }
  .audit-log { grid-template-columns: 1fr; gap: 0; }
  .audit-log li { min-height: 57px; }
  .audit-log li:not(:last-child)::after { display: block; }
  .section-heading { align-items: start; flex-direction: column; gap: 9px; }
  .section-heading > p { text-align: left; }
  .patch-section,
  .tests-section { margin-top: 48px; }
  .patch-row { grid-template-columns: 1fr; padding: 0; }
  .patch-row > header,
  .patch-row > p,
  .patch-row > .mini-diff,
  .patch-row > .patch-actions {
    min-height: auto;
    padding: 15px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }
  .patch-row > .patch-actions { grid-column: auto; flex-direction: row; border-bottom: 0; border-top: 0; }
  .mini-diff { min-height: 78px; }
  .approval-meta { grid-template-columns: 1fr; gap: 8px; }
  .approval-meta div { padding: 0 0 8px; border-right: 0; border-bottom: 1px solid var(--rule); }
  .approval-meta div:last-child { padding-bottom: 0; border-bottom: 0; }
}

@media (max-width: 480px) {
  :root { --page: min(100% - 20px, 1380px); }
  .topbar-state > span:nth-child(2),
  .topbar-state > .topbar-separator { display: none; }
  .topbar-state > #webmcp-state {
    display: inline;
    max-width: 132px;
    overflow: hidden;
    font-size: 8.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .case-title-block h1 { font-size: 34px; }
  .proof-copy h1 {
    max-width: 11ch;
    font-size: 40px;
  }

  .repair-stage-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

  .repair-node code {
    font-size: 16px;
  }

  .tool-registry {
    grid-template-columns: minmax(0, 1fr);
  }

  .tool-registry li,
  .tool-registry li:nth-child(2n),
  .tool-registry li:nth-child(4n),
  .tool-registry li:nth-last-child(-n + 2),
  .tool-registry li:nth-last-child(-n + 4) {
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .tool-registry li:last-child {
    border-bottom: 0;
  }
  .case-title-block > p:last-child { font-size: 14px; }
  .case-facts { grid-template-columns: 1fr; }
  .case-facts div,
  .case-facts div + div,
  .case-facts div:last-child { grid-column: auto; padding: 10px 0; border-right: 0; border-bottom: 1px solid var(--rule); }
  .case-facts div:last-child { border-bottom: 0; }
  .file-list { grid-template-columns: 1fr; }
  .file-row { border-right: 0; }
  .file-row [data-open-file] { grid-template-columns: 28px minmax(0, 1fr) auto; }
  .file-lines { display: block; }
  .code-toolbar { align-items: flex-start; flex-direction: column; }
  .toolbar-actions { width: 100%; justify-content: stretch; }
  .quiet-button { min-height: 44px; flex: 1; }
  .code-surface pre { padding-left: 55px; }
  .code-line.is-changed { margin-left: -55px; padding-left: 55px; }
  .patch-row > .patch-actions { align-items: stretch; flex-direction: column; }
  .apply-button { width: 100%; }
  .dialog-actions { grid-template-columns: 1fr; }
  .reject-button { order: 2; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
