:root {
  color-scheme: dark;
  --bg: #070a0b;
  --rail: #0b0f10;
  --surface: #0f1517;
  --surface-2: #121a1c;
  --surface-3: #182124;
  --line: #253034;
  --line-soft: #1b2528;
  --text: #edf4f2;
  --muted: #91a0a4;
  --muted-2: #627176;
  --teal: #4ecdc4;
  --green: #4ee0a1;
  --amber: #f0b95d;
  --red: #ff6b6b;
  --violet: #a78bfa;
  --radius: 6px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button {
  color: var(--text);
}

button:disabled {
  cursor: wait;
  opacity: 0.55;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  letter-spacing: 0;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
}

.operator-rail {
  height: 100vh;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 44px;
  border-right: 1px solid var(--line);
  background: var(--rail);
  z-index: 20;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(78, 205, 196, 0.55);
  border-radius: var(--radius);
  color: var(--teal);
  background: #0d191a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  font-weight: 800;
}

.brand-lockup strong,
.brand-lockup span {
  display: block;
}

.brand-lockup strong {
  font-size: 1rem;
}

.brand-lockup span {
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
}

.rail-nav {
  display: grid;
  align-content: start;
  gap: 4px;
}

.rail-link {
  min-height: 42px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
}

.rail-link span {
  color: var(--muted-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.66rem;
}

.rail-link:hover,
.rail-link.active {
  color: var(--text);
  border-color: var(--line);
  background: var(--surface-2);
}

.rail-link.active span {
  color: var(--teal);
}

.rail-status {
  padding: 12px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--line);
}

.connection-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(78, 224, 161, 0.1);
}

.rail-status strong,
.rail-status span {
  display: block;
}

.rail-status strong {
  color: var(--text);
  font-size: 0.72rem;
  text-transform: capitalize;
}

.rail-status span {
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.application {
  min-width: 0;
}

.topbar {
  min-height: 76px;
  padding: 13px 22px;
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 10, 11, 0.92);
  backdrop-filter: blur(14px);
  z-index: 15;
}

.page-context {
  min-width: 360px;
  max-width: 440px;
}

.context-label,
.section-kicker {
  display: block;
  color: var(--muted-2);
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
}

.page-title-row {
  margin-top: 5px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.page-title-row h1 {
  flex: 0 0 auto;
}

h1 {
  margin-bottom: 0;
  font-size: 1.15rem;
  line-height: 1.2;
}

h2 {
  margin-bottom: 0;
  font-size: 0.95rem;
  line-height: 1.3;
}

h3 {
  margin-bottom: 0;
  font-size: 0.88rem;
  line-height: 1.3;
}

.snapshot-label {
  max-width: 240px;
  color: var(--muted-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.67rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.snapshot-origin {
  width: max-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 7px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 0.58rem;
  font-weight: 850;
  text-transform: uppercase;
  white-space: nowrap;
}

.snapshot-origin.real_capture,
.snapshot-origin.live_capture {
  color: var(--green);
  border-color: rgba(78, 224, 161, 0.35);
  background: rgba(78, 224, 161, 0.08);
}

.controls {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
}

button,
.file-button {
  min-height: 38px;
  padding: 8px 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface-2);
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 750;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

button:hover,
.file-button:hover {
  border-color: #3e5055;
  background: var(--surface-3);
}

.primary-action {
  color: #06100f;
  border-color: var(--teal);
  background: var(--teal);
}

.primary-action:hover {
  color: #06100f;
  border-color: #74ded7;
  background: #74ded7;
}

.secondary-control {
  color: var(--muted);
  background: transparent;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.amount-field,
.scenario-field,
.live-field {
  display: grid;
  gap: 5px;
  color: var(--muted-2);
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
}

.amount-field input,
.scenario-field select,
.live-field input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  color: var(--text);
  background: #090d0e;
  outline: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  text-transform: none;
}

.scenario-field select {
  width: 200px;
  appearance: none;
  padding-right: 28px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 16px, calc(100% - 10px) 16px;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
}

.amount-field input {
  width: 146px;
}

.amount-field input:focus,
.scenario-field select:focus,
.live-field input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.1);
}

.dashboard {
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: 20px 22px 42px;
}

.overview-shell,
.workspace-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.overview-shell {
  min-height: 390px;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  overflow: hidden;
}

.readiness-rail {
  padding: 18px;
  display: grid;
  align-content: start;
  gap: 22px;
  border-right: 1px solid var(--line);
  background: #0d1315;
}

.readiness-heading,
.section-heading,
.topology-heading,
.runbook-inspector-head,
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.readiness-heading > span:first-child {
  color: var(--muted-2);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.status-pill,
.route-verdict,
.rpc-status,
.runbook-safety,
.severity-tag {
  width: max-content;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 7px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 0.62rem;
  font-weight: 850;
  text-transform: uppercase;
}

.status-pill.ready,
.route-verdict.ready,
.rpc-status.ok {
  color: var(--green);
  border-color: rgba(78, 224, 161, 0.35);
  background: rgba(78, 224, 161, 0.08);
}

.status-pill.degraded,
.route-verdict.not_captured,
.rpc-status.missing {
  color: var(--amber);
  border-color: rgba(240, 185, 93, 0.35);
  background: rgba(240, 185, 93, 0.08);
}

.status-pill.blocked,
.route-verdict.failed,
.rpc-status.error {
  color: var(--red);
  border-color: rgba(255, 107, 107, 0.35);
  background: rgba(255, 107, 107, 0.08);
}

.score-row {
  display: grid;
  grid-template-columns: 106px minmax(0, 1fr);
  gap: 15px;
  align-items: center;
}

.score-ring {
  --score-deg: 0deg;
  width: 106px;
  aspect-ratio: 1;
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--ring-color, var(--amber)) var(--score-deg), #222c2f 0deg);
}

.score-ring::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--surface);
}

.score-ring strong,
.score-ring span {
  position: relative;
  z-index: 1;
}

.score-ring strong {
  font-size: 2rem;
  line-height: 1;
}

.score-ring span {
  align-self: end;
  margin-bottom: 24px;
  color: var(--muted-2);
  font-size: 0.6rem;
  font-weight: 800;
}

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

.score-copy h2 {
  margin-bottom: 6px;
  font-size: 1.15rem;
  overflow-wrap: anywhere;
}

.score-copy p {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mono,
.code-block,
.runbook-preview,
.preset-runbook,
.live-command,
.finding code,
.rpc-item code,
.node-facts {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.muted {
  color: var(--muted);
}

.node-facts {
  border-top: 1px solid var(--line);
}

.node-fact {
  padding: 10px 0;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  border-bottom: 1px solid var(--line-soft);
}

.node-fact span {
  color: var(--muted-2);
  font-size: 0.62rem;
  text-transform: uppercase;
}

.node-fact strong {
  min-width: 0;
  font-size: 0.69rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.snapshot-provenance {
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: #0a1011;
}

.snapshot-provenance-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.snapshot-provenance-head span,
.snapshot-provenance-grid span {
  color: var(--muted-2);
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
}

.snapshot-provenance-head strong {
  color: var(--green);
  font-size: 0.68rem;
  text-align: right;
}

.snapshot-provenance p {
  margin: 9px 0 11px;
  color: var(--muted);
  font-size: 0.67rem;
  line-height: 1.45;
}

.snapshot-provenance-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.snapshot-provenance-grid div {
  min-width: 0;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
}

.snapshot-provenance-grid strong {
  display: block;
  margin-top: 3px;
  font: 700 0.67rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.topology-stage {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(245px, 1fr) auto;
}

.topology-heading {
  min-height: 66px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.topology-heading .section-kicker,
.section-heading .section-kicker,
.dialog-heading .section-kicker {
  margin-bottom: 4px;
}

.topology-counters {
  display: flex;
  gap: 18px;
}

.topology-counters span {
  color: var(--muted-2);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.topology-counters strong {
  color: var(--text);
  font-size: 0.8rem;
}

.topology-canvas-wrap {
  min-height: 245px;
  position: relative;
  overflow: hidden;
  background: #091011;
}

#topology-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.topology-legend {
  position: absolute;
  right: 14px;
  bottom: 12px;
  display: flex;
  gap: 12px;
  pointer-events: none;
}

.topology-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted-2);
  font-size: 0.61rem;
  text-transform: uppercase;
}

.topology-legend span::before {
  content: "";
  width: 6px;
  height: 6px;
  border: 1px solid currentColor;
  border-radius: 50%;
}

.legend-self {
  color: var(--teal) !important;
}

.legend-target {
  color: var(--amber) !important;
}

.route-strip {
  min-height: 74px;
  padding: 12px 18px;
  display: grid;
  grid-template-columns: 185px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  border-top: 1px solid var(--line);
  background: #0c1214;
}

.route-strip > div {
  display: grid;
  justify-items: start;
  gap: 6px;
}

.route-strip > div > span {
  color: var(--muted-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.66rem;
  white-space: nowrap;
}

.route-evidence {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.metric-strip {
  min-height: 88px;
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.metric {
  min-width: 0;
  padding: 13px 16px;
  display: grid;
  align-content: space-between;
  border-right: 1px solid var(--line);
  border-top: 2px solid var(--teal);
}

.metric:last-child {
  border-right: 0;
}

.metric-channels {
  border-top-color: var(--green);
}

.metric-graph {
  border-top-color: var(--violet);
}

.metric-outbound {
  border-top-color: var(--amber);
}

.metric-inbound {
  border-top-color: var(--red);
}

.metric span,
.metric small {
  color: var(--muted-2);
  font-size: 0.63rem;
  text-transform: uppercase;
}

.metric strong {
  margin: 5px 0;
  font-size: 1.15rem;
  overflow-wrap: anywhere;
}

.workspace-panel {
  min-width: 0;
  padding: 16px;
}

.section-heading {
  min-height: 44px;
  margin-bottom: 14px;
}

.section-heading > span,
.heading-actions > span {
  color: var(--muted-2);
  font-size: 0.7rem;
}

.heading-actions {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.mini-button {
  min-height: 29px;
  padding: 5px 8px;
  color: var(--teal);
  border-color: rgba(78, 205, 196, 0.28);
  background: transparent;
  font-size: 0.65rem;
  text-transform: uppercase;
}

.runbook-panel {
  margin-bottom: 16px;
  padding: 0;
  overflow: hidden;
}

.runbook-heading {
  min-height: 66px;
  margin: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.runbook-workbench {
  min-height: 390px;
  display: grid;
  grid-template-columns: 230px minmax(310px, 0.95fr) minmax(360px, 1.1fr);
}

.runbook-summary,
.runbook-inspector {
  min-width: 0;
  padding: 15px;
}

.runbook-summary {
  display: grid;
  align-content: start;
  gap: 16px;
  border-right: 1px solid var(--line);
  background: #0c1214;
}

.runbook-verdict span {
  width: max-content;
  display: block;
  margin-bottom: 9px;
  border: 1px solid rgba(240, 185, 93, 0.34);
  border-radius: 999px;
  padding: 4px 7px;
  color: var(--amber);
  background: rgba(240, 185, 93, 0.08);
  font-size: 0.62rem;
  font-weight: 850;
  text-transform: uppercase;
}

.runbook-verdict.ready span {
  color: var(--green);
  border-color: rgba(78, 224, 161, 0.34);
  background: rgba(78, 224, 161, 0.08);
}

.runbook-verdict strong {
  display: block;
  font-size: 0.9rem;
  line-height: 1.45;
}

.runbook-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.runbook-stats div {
  min-height: 64px;
  padding: 9px;
  display: grid;
  align-content: space-between;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.runbook-stats strong {
  font-size: 1.15rem;
}

.runbook-stats span,
.runbook-summary p {
  color: var(--muted-2);
  font-size: 0.66rem;
  line-height: 1.45;
}

.runbook-summary p {
  margin: 0;
}

.runbook-steps {
  max-height: 430px;
  overflow: auto;
  border-right: 1px solid var(--line);
}

.runbook-step {
  width: 100%;
  min-height: 86px;
  padding: 11px 12px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  text-align: left;
}

.runbook-step:hover,
.runbook-step.active {
  background: var(--surface-2);
}

.runbook-step.active {
  box-shadow: inset 3px 0 0 var(--teal);
}

.runbook-sequence {
  width: 31px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid #355054;
  border-radius: 50%;
  color: var(--teal);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.64rem;
  font-weight: 850;
}

.runbook-step-copy {
  min-width: 0;
}

.runbook-step-copy small,
.runbook-step-copy em {
  display: block;
  color: var(--muted-2);
  font-size: 0.61rem;
  font-style: normal;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.runbook-step-copy strong {
  display: block;
  margin: 5px 0;
  font-size: 0.78rem;
  line-height: 1.35;
}

.runbook-safety {
  max-width: 112px;
  text-align: center;
}

.runbook-safety.dry_run {
  color: var(--teal);
  border-color: rgba(78, 205, 196, 0.3);
  background: rgba(78, 205, 196, 0.07);
}

.runbook-safety.reversible_write {
  color: var(--amber);
  border-color: rgba(240, 185, 93, 0.3);
  background: rgba(240, 185, 93, 0.07);
}

.runbook-safety.funding_write {
  color: var(--red);
  border-color: rgba(255, 107, 107, 0.3);
  background: rgba(255, 107, 107, 0.07);
}

.runbook-inspector {
  display: grid;
  grid-template-rows: auto minmax(215px, 1fr) auto;
  gap: 11px;
  background: #0a1012;
}

.runbook-inspector-head {
  align-items: start;
}

.runbook-inspector-head span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.62rem;
  overflow-wrap: anywhere;
}

.runbook-preview,
.code-block,
.preset-runbook,
.live-command {
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #c6e5df;
  background: #060a0b;
  font-size: 0.7rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.runbook-preview {
  min-height: 215px;
  max-height: 290px;
  padding: 12px;
}

.runbook-success {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.runbook-success span {
  display: block;
  margin-bottom: 4px;
  color: var(--green);
  font-size: 0.61rem;
  font-weight: 850;
  text-transform: uppercase;
}

.runbook-success strong {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.diagnostic-grid {
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: minmax(300px, 1.05fr) minmax(330px, 1fr) minmax(280px, 0.86fr);
  gap: 12px;
  align-items: start;
}

.findings-list,
.channel-list,
.gate-failures,
.rpc-grid,
.diff-findings {
  display: grid;
  gap: 8px;
}

.finding {
  padding: 11px 0 11px 12px;
  border-left: 3px solid var(--teal);
  border-bottom: 1px solid var(--line-soft);
}

.finding.critical {
  border-left-color: var(--red);
}

.finding.warning {
  border-left-color: var(--amber);
}

.finding-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.finding strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.8rem;
}

.finding code {
  color: var(--muted-2);
  font-size: 0.63rem;
  overflow-wrap: anywhere;
}

.finding p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.finding p:last-child {
  color: #c4d0d1;
}

.liquidity-ledger {
  border-top: 1px solid var(--line);
}

.ledger-head {
  padding: 9px 0;
  display: flex;
  justify-content: space-between;
  color: var(--muted-2);
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
}

.channel-row {
  padding: 11px 0;
  display: grid;
  gap: 9px;
  border-bottom: 1px solid var(--line-soft);
}

.channel-top,
.channel-bottom {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.69rem;
}

.channel-top strong {
  color: var(--text);
  font-size: 0.74rem;
}

.channel-state {
  color: var(--green);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.63rem;
}

.split-track {
  height: 9px;
  position: relative;
  overflow: hidden;
  border-radius: 999px;
  background: #28243a;
}

.split-track span {
  width: var(--local-width, 0%);
  height: 100%;
  display: block;
  background: var(--teal);
}

.split-track::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 50%;
  width: 1px;
  background: rgba(255, 255, 255, 0.5);
}

.gate-summary,
.diff-summary {
  margin-bottom: 11px;
  padding: 11px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(255, 107, 107, 0.26);
  border-radius: var(--radius);
  background: rgba(255, 107, 107, 0.05);
}

.gate-summary.pass {
  border-color: rgba(78, 224, 161, 0.26);
  background: rgba(78, 224, 161, 0.05);
}

.gate-summary strong,
.diff-summary strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.8rem;
  text-transform: uppercase;
}

.gate-summary span,
.gate-failure p,
.diff-summary span,
.diff-summary small {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.4;
}

.gate-score,
.diff-score {
  min-width: 50px;
  padding: 8px;
  border: 1px solid rgba(255, 107, 107, 0.25);
  border-radius: var(--radius);
  color: var(--red);
  text-align: center;
  font-weight: 850;
}

.gate-summary.pass .gate-score,
.diff-score.improved {
  color: var(--green);
  border-color: rgba(78, 224, 161, 0.25);
}

.diff-score.regressed {
  color: var(--red);
}

.diff-score.stable,
.diff-score.changed {
  color: var(--amber);
  border-color: rgba(240, 185, 93, 0.25);
}

.gate-failure {
  padding: 8px 0 8px 10px;
  display: grid;
  gap: 4px;
  border-left: 2px solid var(--red);
  border-bottom: 1px solid var(--line-soft);
}

.gate-failure.pass {
  border-left-color: var(--green);
}

.gate-failure code {
  color: var(--muted-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.6rem;
}

.gate-failure strong {
  font-size: 0.72rem;
}

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.diff-metrics {
  margin-bottom: 11px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.diff-metric {
  padding: 9px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.diff-metric span {
  display: block;
  color: var(--muted-2);
  font-size: 0.6rem;
  text-transform: uppercase;
}

.diff-metric strong {
  display: block;
  margin: 4px 0;
  font-size: 0.82rem;
}

.diff-metric small {
  color: var(--muted);
  font-size: 0.65rem;
}

.diff-chip {
  padding: 8px 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px 9px;
  border-bottom: 1px solid var(--line-soft);
}

.diff-chip span {
  width: max-content;
  border-radius: 999px;
  padding: 3px 6px;
  color: var(--muted);
  background: var(--surface-3);
  font-size: 0.58rem;
  font-weight: 850;
  text-transform: uppercase;
}

.diff-chip.resolved span {
  color: var(--green);
}

.diff-chip.introduced span {
  color: var(--amber);
}

.diff-chip code {
  align-self: center;
  color: var(--muted-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.61rem;
}

.diff-chip p {
  grid-column: 2;
  margin: 0;
  color: var(--muted);
  font-size: 0.69rem;
}

.code-block {
  min-height: 260px;
  max-height: 360px;
  padding: 12px;
}

.rpc-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.rpc-item {
  min-width: 0;
  padding: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.rpc-item code {
  color: var(--text);
  font-size: 0.68rem;
  overflow-wrap: anywhere;
}

.preset-list {
  margin-bottom: 10px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.preset-card {
  min-width: 0;
  padding: 9px;
  display: grid;
  justify-items: start;
  text-align: left;
  background: transparent;
}

.preset-card.active {
  color: var(--teal);
  border-color: rgba(78, 205, 196, 0.45);
  background: rgba(78, 205, 196, 0.05);
}

.preset-card strong,
.preset-card span {
  display: block;
  overflow-wrap: anywhere;
}

.preset-card strong {
  font-size: 0.7rem;
}

.preset-card span {
  margin-top: 4px;
  color: var(--muted-2);
  font-size: 0.6rem;
}

.preset-runbook {
  min-height: 210px;
  max-height: 340px;
  padding: 11px;
}

.empty-state {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

.live-dialog {
  width: min(880px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  padding: 0;
  overflow: auto;
  border: 1px solid #344449;
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.65);
}

.live-dialog::backdrop {
  background: rgba(2, 5, 6, 0.76);
  backdrop-filter: blur(5px);
}

.dialog-heading {
  min-height: 70px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.close-button {
  min-height: 32px;
  color: var(--muted);
  background: transparent;
}

.live-grid {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.live-field input {
  width: 100%;
}

.live-rpc-field,
.live-target-field {
  grid-column: span 1;
}

.live-toggle {
  min-height: 38px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: end;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: #090d0e;
  font-size: 0.72rem;
}

.live-toggle input {
  width: 15px;
  height: 15px;
  accent-color: var(--teal);
}

.live-command {
  min-height: 90px;
  margin: 0 16px;
  padding: 11px;
}

.dialog-actions {
  padding: 14px 16px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.dialog-actions span {
  max-width: 520px;
  color: var(--muted-2);
  font-size: 0.67rem;
  line-height: 1.4;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(320px, calc(100vw - 32px));
  padding: 10px 13px;
  border: 1px solid rgba(78, 205, 196, 0.4);
  border-radius: var(--radius);
  color: var(--text);
  background: #10191b;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.55);
  transform: translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 50;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1280px) {
  .app-shell {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .topbar {
    align-items: start;
  }

  .page-context {
    min-width: 220px;
  }

  .controls {
    flex-wrap: wrap;
  }

  .page-title-row {
    display: grid;
  }

  .runbook-workbench {
    grid-template-columns: 220px minmax(320px, 1fr);
  }

  .runbook-inspector {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
  }

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

  .gate-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1040px) {
  html {
    scroll-padding-top: 140px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .operator-rail {
    width: 100%;
    height: auto;
    min-height: 62px;
    padding: 10px 14px;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto;
    align-items: center;
    gap: 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .rail-nav {
    display: flex;
    justify-content: center;
  }

  .rail-link {
    min-height: 36px;
  }

  .rail-status {
    padding: 0;
    border: 0;
  }

  .topbar {
    top: 61px;
  }

  .overview-shell {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .evidence-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  html {
    scroll-padding-top: 12px;
  }

  .operator-rail {
    position: static;
    grid-template-columns: 1fr auto;
    gap: 10px;
  }

  .rail-nav {
    grid-column: 1 / -1;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .rail-link {
    min-width: 0;
    padding: 0 6px;
    justify-content: center;
    gap: 5px;
    font-size: 0.68rem;
  }

  .rail-status {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .topbar {
    padding: 13px 14px;
    position: static;
    display: grid;
  }

  .page-title-row {
    display: flex;
    flex-wrap: wrap;
  }

  .controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }

  .amount-field,
  .scenario-field,
  .scenario-field select,
  .amount-field input {
    width: 100%;
  }

  .amount-field {
    grid-column: 1 / -1;
  }

  .scenario-field {
    grid-column: 1 / -1;
  }

  .dashboard {
    padding: 12px 12px 34px;
  }

  .overview-shell {
    grid-template-columns: 1fr;
  }

  .readiness-rail {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .topology-stage {
    grid-template-rows: auto 280px auto;
  }

  .topology-heading,
  .route-strip {
    display: grid;
  }

  .topology-counters {
    margin-top: 7px;
  }

  .route-strip {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid var(--line);
  }

  .metric {
    min-height: 78px;
    border-bottom: 1px solid var(--line);
  }

  .metric:nth-child(2n) {
    border-right: 0;
  }

  .metric:last-child {
    grid-column: 1 / -1;
  }

  .runbook-heading,
  .section-heading,
  .runbook-inspector-head {
    align-items: start;
  }

  .runbook-heading {
    display: grid;
  }

  .runbook-workbench {
    grid-template-columns: 1fr;
  }

  .runbook-summary,
  .runbook-steps {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .runbook-steps {
    max-height: 390px;
  }

  .runbook-inspector {
    grid-column: auto;
  }

  .diagnostic-grid,
  .evidence-grid {
    grid-template-columns: 1fr;
  }

  .gate-panel {
    grid-column: auto;
  }

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

  .live-grid {
    grid-template-columns: 1fr;
  }

  .dialog-actions {
    display: grid;
  }
}

@media (max-width: 460px) {
  .brand-lockup > div > span,
  .rail-status span {
    display: none;
  }

  .rail-link {
    padding: 0 8px;
    font-size: 0.72rem;
  }

  .score-row {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .score-ring {
    width: 92px;
  }

  .runbook-step {
    grid-template-columns: 31px minmax(0, 1fr);
  }

  .runbook-safety {
    grid-column: 2;
    justify-self: start;
  }

  .rpc-grid,
  .diff-metrics {
    grid-template-columns: 1fr;
  }
}
