:root {
  --bg: #f9f9f9;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --ink: #111827;
  --navy: #111827;
  --muted: #4b5563;
  --faint: #9ca3af;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --green: #059669;
  --green-soft: #ecfdf5;
  --pink: #e896af;
  --pink-soft: #fff4f7;
  --pink-line: #f2c7d5;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: none;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  cursor: pointer;
}

button:focus-visible,
.stage-tab:focus-visible,
.rail-item:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}

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

.side-nav {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: #fff;
  display: flex;
  flex-direction: column;
  padding: 22px 10px 0;
}

.brand {
  height: 28px;
  display: flex;
  align-items: center;
  margin: 0 8px 30px;
}

.brand img {
  width: 112px;
  max-height: 28px;
  height: auto;
  object-fit: contain;
}

.main-menu {
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  padding: 0 10px;
  margin-bottom: 12px;
}

.main-menu svg,
.rail-item svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.2;
}

.rail {
  display: grid;
  gap: 4px;
}

.rail-item {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #2f3745;
  padding: 0 10px;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
}

.rail-item:hover,
.rail-item.active {
  background: #e8eaed;
  color: #111827;
}

.rail-item.muted {
  color: #8b93a1;
}

.user-chip {
  margin-top: auto;
  min-height: 54px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  color: #697180;
  font-size: 12px;
  font-weight: 700;
}

.avatar-dot {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #111827;
  border: 3px solid #eef1f4;
  display: inline-block;
}

.workspace {
  min-width: 0;
  width: 100%;
  max-width: 1720px;
  margin: 0 auto;
  padding: 12px 34px 42px;
}

.topbar {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 0 10px;
}

.eyebrow,
.panel-label {
  margin: 0;
  color: var(--faint);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topbar h1 {
  font-size: 21px;
  font-weight: 800;
  line-height: 1.2;
  margin: 5px 0 0;
  letter-spacing: 0;
}

.title-stack {
  min-width: 0;
  max-width: 780px;
}

.top-step-copy {
  margin: 4px 0 0;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.35;
}

.top-step-copy strong {
  color: #596273;
  font-weight: 800;
}

.top-step-copy span {
  margin-left: 6px;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: max-content;
}

.session-pill,
.metric-chip {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  color: #596273;
  font-size: 11px;
  font-weight: 800;
  padding: 0 10px;
  white-space: nowrap;
}

.primary-button,
.secondary-button {
  height: 36px;
  border-radius: 999px;
  padding: 0 14px;
  border: 1px solid var(--navy);
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.top-actions .primary-button {
  min-width: 172px;
  max-width: 220px;
  overflow: hidden;
  justify-content: center;
  text-overflow: ellipsis;
}

.top-actions .secondary-button {
  min-width: 82px;
}

.top-actions .session-pill {
  min-height: 36px;
}

.primary-button {
  background: var(--navy);
  color: #fff;
}

.secondary-button {
  background: #fff;
  color: var(--navy);
  border-color: var(--line-strong);
}

.primary-button:hover {
  background: #0f1622;
  border-color: #0f1622;
}

.secondary-button:hover {
  border-color: var(--navy);
}

.secondary-button:disabled,
.secondary-button[aria-disabled="true"] {
  cursor: not-allowed;
  color: #a2aab6;
  border-color: var(--line);
  background: #f8f9fb;
}

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

.top-actions .secondary-button svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.2;
}

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

.metric-card {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 8px 11px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 2px 10px;
}

.metric-card span {
  color: #8d96a5;
  font-size: 11px;
  font-weight: 800;
}

.metric-card strong {
  grid-row: 1 / span 2;
  grid-column: 2;
  color: var(--green);
  font-size: 20px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0;
}

.metric-card small {
  color: #9aa3b1;
  font-size: 10.5px;
  font-weight: 700;
}

.stage-strip,
.guided-stepper,
.ten-step-stepper,
.demo-stepper {
  --step-count: 10;
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.guided-stepper,
.ten-step-stepper,
.demo-stepper {
  grid-template-columns: repeat(var(--step-count), minmax(0, 1fr));
}

.stage-tab,
.stepper-item,
.stepper-step,
.guided-step {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  text-align: left;
  font-size: 11px;
  font-weight: 800;
  overflow: hidden;
  white-space: nowrap;
}

.stage-tab span,
.stepper-index,
.step-number-badge {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background: #f4f5f7;
  color: #77808d;
  font-size: 9px;
  border: 1px solid transparent;
}

.stage-tab.active,
.stepper-item.active,
.stepper-step.active,
.guided-step.active,
.stepper-item[aria-current="step"],
.stepper-step[aria-current="step"],
.guided-step[aria-current="step"] {
  background: #f7f8fa;
  color: var(--ink);
  border-color: var(--line-strong);
}

.stage-tab.active span,
.stepper-item.active .stepper-index,
.stepper-step.active .stepper-index,
.guided-step.active .stepper-index,
.stepper-item[aria-current="step"] .stepper-index,
.stepper-step[aria-current="step"] .stepper-index,
.guided-step[aria-current="step"] .stepper-index {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.workspace:has(.stage-tab[data-stage="1"].active) .stage-tab[data-stage="0"],
.workspace:has(.stage-tab[data-stage="2"].active) .stage-tab[data-stage="0"],
.workspace:has(.stage-tab[data-stage="2"].active) .stage-tab[data-stage="1"],
.workspace:has(.stage-tab[data-stage="3"].active) .stage-tab[data-stage="0"],
.workspace:has(.stage-tab[data-stage="3"].active) .stage-tab[data-stage="1"],
.workspace:has(.stage-tab[data-stage="3"].active) .stage-tab[data-stage="2"],
.stepper-item.complete,
.stepper-step.complete,
.guided-step.complete,
.stepper-item.is-complete,
.stepper-step.is-complete,
.guided-step.is-complete {
  color: #425466;
  border-color: #d6e7db;
  background: #fbfdfb;
}

.workspace:has(.stage-tab[data-stage="1"].active) .stage-tab[data-stage="0"] span,
.workspace:has(.stage-tab[data-stage="2"].active) .stage-tab[data-stage="0"] span,
.workspace:has(.stage-tab[data-stage="2"].active) .stage-tab[data-stage="1"] span,
.workspace:has(.stage-tab[data-stage="3"].active) .stage-tab[data-stage="0"] span,
.workspace:has(.stage-tab[data-stage="3"].active) .stage-tab[data-stage="1"] span,
.workspace:has(.stage-tab[data-stage="3"].active) .stage-tab[data-stage="2"] span,
.stepper-item.complete .stepper-index,
.stepper-step.complete .stepper-index,
.guided-step.complete .stepper-index,
.stepper-item.is-complete .stepper-index,
.stepper-step.is-complete .stepper-index,
.guided-step.is-complete .stepper-index {
  color: var(--green);
  background: var(--green-soft);
  border-color: #cfe7d9;
}

.summary-band {
  display: grid;
  grid-template-columns: minmax(280px, 0.78fr) minmax(0, 1.22fr);
  gap: 12px;
  margin-bottom: 14px;
}

.demo-brief {
  display: none;
  grid-template-columns: minmax(360px, 0.92fr) minmax(460px, 1.08fr);
  align-items: stretch;
  margin-bottom: 12px;
}

.workspace:has(.stage-tab[data-stage="5"].active) .demo-brief,
.workspace:has(.stage-tab[data-stage="6"].active) .demo-brief,
.workspace:has(.stage-tab[data-stage="7"].active) .demo-brief,
.workspace:has(.stage-tab[data-stage="8"].active) .demo-brief,
.workspace:has(.stage-tab[data-stage="9"].active) .demo-brief {
  display: grid;
}

.request-panel,
.story-panel,
.surface-card,
.graph-card,
.document-import-state,
.graph-empty,
.empty-graph-state,
.selected-path-log,
.path-log {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: none;
}

.request-panel,
.story-panel {
  padding: 13px 16px;
}

.summary-compare {
  padding: 13px 16px;
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.summary-compare .section-heading {
  margin-bottom: 0;
}

.request-panel h2,
.story-panel h2,
.surface-card h2,
.graph-card h2 {
  margin: 5px 0 0;
  font-size: 15px;
  line-height: 1.25;
  letter-spacing: 0;
}

.request-panel p:last-child,
.story-panel p:last-child {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin: 7px 0 0;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(620px, 1fr) minmax(300px, 320px);
  grid-template-areas:
    "graph inspector";
  gap: 14px;
  align-items: start;
}

.right-column {
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
}

.graph-card {
  grid-area: graph;
}

.right-column {
  grid-area: inspector;
  position: sticky;
  top: 12px;
}

.surface-card,
.graph-card {
  padding: 16px;
}

.side-panel {
  padding: 13px 14px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.side-panel .section-heading {
  align-items: center;
  margin-bottom: 0;
  min-width: 0;
}

.side-panel .section-heading > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.side-panel .panel-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-panel h2 {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-panel.is-open .section-heading {
  margin-bottom: 10px;
}

.panel-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 54%;
}

.side-panel .metric-chip {
  max-width: 118px;
  min-height: 24px;
  overflow: hidden;
  padding: 0 8px;
  text-overflow: ellipsis;
}

.right-column > *,
.side-panel-body,
.runtime-question,
.agent-draft,
.runtime-output,
.trace-list,
.trace-row,
.doc-row,
.pipeline-step {
  min-width: 0;
  max-width: 100%;
}

.collapse-button {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: #667085;
  padding: 0;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.collapse-button:hover {
  border-color: var(--line-strong);
  background: #f8fafc;
}

.collapse-button svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.3;
  transition: transform 0.18s ease;
}

.side-panel.is-open .collapse-button svg {
  transform: rotate(180deg);
}

.side-panel-body {
  max-height: 142px;
  overflow: auto;
  transition: max-height 0.2s ease, opacity 0.16s ease, margin-top 0.16s ease;
}

.side-panel.is-collapsed .side-panel-body {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.decision-card .side-panel-body {
  max-height: min(52vh, 520px);
}

.side-panel.is-collapsed {
  background: #fff;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.graph-heading {
  margin-bottom: 10px;
}

.document-list {
  display: grid;
  gap: 8px;
}

.document-list .doc-row:not(.active) {
  display: none;
}

.workspace:has(.stage-tab[data-stage="0"].active) .document-list::before,
.document-list:empty::before,
.document-import-state,
.import-state,
.empty-state {
  min-height: 108px;
  display: grid;
  align-content: center;
  gap: 6px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--muted);
  padding: 16px;
  font-size: 12px;
  line-height: 1.45;
}

.workspace:has(.stage-tab[data-stage="0"].active) .document-list::before,
.document-list:empty::before {
  content: "No source documents synced yet. The graph is waiting for policy inputs.";
}

.doc-row {
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 11px;
  display: grid;
  gap: 7px;
  opacity: 0.66;
  transition: opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.doc-row.active {
  opacity: 1;
  background: #fff;
  border-color: var(--line-strong);
  animation: revealPanel 0.18s ease both;
}

.doc-row.delta,
.doc-row.is-delta,
.doc-row.new,
.document-import-state.delta {
  border-color: var(--pink-line);
  background: var(--pink-soft);
}

.doc-row.fresh:not(.delta) {
  border-color: #cfe7d9;
  background: #fbfdfb;
}

.doc-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.doc-title {
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.doc-title-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.doc-title-button:hover,
.doc-title-button[aria-expanded="true"] {
  color: #111827;
  text-decoration: underline;
  text-decoration-color: #ff5a1f;
  text-underline-offset: 3px;
}

.policy-document-detail {
  display: grid;
  gap: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  padding: 14px;
}

.right-column:has(.policy-document-detail) {
  grid-column: 1 / -1;
}

.right-column:has(.policy-document-detail) #documentsPanel {
  width: 100%;
}

.policy-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.policy-detail-head div {
  display: grid;
  gap: 3px;
}

.policy-detail-head span,
.policy-detail-head small {
  color: #9ca3af;
  font-size: 11px;
  font-weight: 500;
}

.policy-detail-head strong {
  color: #111827;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.policy-document-detail > p {
  margin: 0;
  color: #4b5563;
  font-size: 12px;
  line-height: 1.45;
}

.policy-pdf-preview {
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
}

.policy-pdf-bar {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
  padding: 0 10px;
}

.policy-pdf-bar strong {
  color: #111827;
  font-size: 12px;
  font-weight: 600;
}

.policy-pdf-bar span {
  color: #9ca3af;
  font-size: 11px;
}

.policy-pdf-frame {
  width: 100%;
  height: min(78vh, 900px);
  min-height: 680px;
  display: block;
  border: 0;
  background: #f9fafb;
}

.modal-open {
  overflow: hidden;
}

.policy-document-modal {
  position: fixed;
  inset: 0;
  z-index: 240;
  display: grid;
  place-items: center;
  background: rgba(17, 24, 39, 0.5);
  padding: 22px;
}

.policy-document-modal[hidden] {
  display: none;
}

.policy-modal-shell {
  width: min(1480px, calc(100vw - 44px));
  height: min(940px, calc(100vh - 44px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(17, 24, 39, 0.28);
}

.policy-modal-header {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
  padding: 10px 14px 10px 18px;
}

.policy-modal-header div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.policy-modal-header span,
.policy-modal-header small {
  color: #9ca3af;
  font-size: 11px;
  font-weight: 500;
}

.policy-modal-header strong {
  color: #111827;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
}

.policy-modal-close {
  flex: 0 0 auto;
  height: 34px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 500;
}

.policy-modal-close:hover {
  border-color: #111827;
  background: #111827;
  color: #fff;
}

.policy-modal-frame {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  background: #f9fafb;
}

.policy-meta-table th:first-child,
.policy-meta-table td:first-child,
.policy-clause-table th:first-child,
.policy-clause-table td:first-child,
.policy-rule-table th:first-child,
.policy-rule-table td:first-child {
  width: 34%;
  color: #111827;
  font-weight: 600;
}

.doc-detail {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.35;
}

.status-tag {
  flex: none;
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
  padding: 0 7px;
  background: #f1f3f5;
  color: #596273;
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-tag.synced,
.status-tag.done {
  color: var(--green);
  background: var(--green-soft);
}

.status-tag.new,
.status-tag.delta,
.status-tag.fresh {
  color: var(--pink);
  background: #fff;
  border: 1px solid var(--pink-line);
}

.status-tag.fresh:not(.delta) {
  color: var(--green);
  background: #fff;
  border-color: #cfe7d9;
}

.pipeline-list,
.pipeline-checklist,
.pipeline-progress {
  display: grid;
  gap: 7px;
}

.workspace:has(.stage-tab[data-stage="0"].active) .pipeline-list .pipeline-step:not(.done) {
  display: none;
}

.workspace:has(.stage-tab[data-stage="0"].active) .pipeline-list::before {
  content: "Pipeline starts after import. Each completed step becomes an auditable ontology transformation.";
  min-height: 108px;
  display: grid;
  align-content: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--muted);
  padding: 16px;
  font-size: 12px;
  line-height: 1.45;
}

.pipeline-step,
.pipeline-item,
.checklist-step {
  min-height: 56px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 9px;
  padding: 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  opacity: 0.52;
}

.pipeline-step.done,
.pipeline-item.done,
.checklist-step.done,
.pipeline-step.is-complete,
.pipeline-item.is-complete,
.checklist-step.is-complete {
  opacity: 1;
  background: #fff;
  border-color: var(--line-strong);
  animation: revealPanel 0.18s ease both;
}

.pipeline-step.hot,
.pipeline-step.delta,
.pipeline-step.fresh,
.pipeline-item.hot,
.pipeline-item.delta,
.checklist-step.hot,
.checklist-step.delta {
  border-color: #cfe7d9;
  background: #fbfdfb;
  animation: revealPanel 0.18s ease both, deltaPulse 1.4s ease-in-out 1;
}

.pipeline-step.delta,
.pipeline-item.delta,
.checklist-step.delta {
  border-color: var(--pink-line);
  background: var(--pink-soft);
}

.step-number {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background: #f1f3f5;
  color: #6f7785;
  font-size: 10px;
  font-weight: 900;
  margin-top: 2px;
}

.pipeline-step.done .step-number,
.pipeline-item.done .step-number,
.checklist-step.done .step-number,
.pipeline-step.is-complete .step-number,
.pipeline-item.is-complete .step-number,
.checklist-step.is-complete .step-number {
  color: transparent;
  background: var(--green-soft);
  border: 1px solid #cfe7d9;
}

.pipeline-step.done .step-number::after,
.pipeline-item.done .step-number::after,
.checklist-step.done .step-number::after,
.pipeline-step.is-complete .step-number::after,
.pipeline-item.is-complete .step-number::after,
.checklist-step.is-complete .step-number::after {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 2px solid var(--green);
  border-bottom: 2px solid var(--green);
  transform: rotate(-45deg) translateY(-1px);
}

.pipeline-step.hot .step-number,
.pipeline-step.fresh .step-number,
.pipeline-step.delta .step-number {
  background: #fff;
  border-color: #cfe7d9;
}

.pipeline-step.delta .step-number {
  border-color: var(--pink-line);
}

.step-title-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.step-title-line strong {
  font-size: 11.5px;
  line-height: 1.2;
}

.step-title-line span {
  flex: none;
}

.pipeline-step p,
.pipeline-item p,
.checklist-step p {
  color: var(--muted);
  margin: 3px 0 0;
  font-size: 10.8px;
  line-height: 1.35;
}

.ip-chip {
  min-height: 18px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
  padding: 0 6px;
  color: #596273;
  background: #f1f3f5;
  font-size: 8.5px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.graph-card {
  display: flex;
  flex-direction: column;
}

.graph-heading {
  align-items: flex-start;
}

.graph-heading > div:first-child {
  min-width: 0;
}

.graph-page-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.graph-page-control span {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: #6b7280;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.graph-page-control strong {
  color: #111827;
  font-size: 11px;
  font-weight: 600;
}

.graph-page-control em,
.graph-page-control b {
  color: #6b7280;
  font-size: 11px;
  font-style: normal;
  font-weight: 500;
}

.graph-page-control em {
  margin: 0 1px;
}

.graph-page-next {
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: #374151;
}

.graph-page-next:hover {
  border-color: #d1d5db;
  background: #f9fafb;
}

.graph-page-next svg {
  width: 13px;
  height: 13px;
  stroke-width: 1.8;
}

.graph-wrap {
  position: relative;
  flex: none;
  aspect-ratio: 1000 / 620;
  min-height: clamp(440px, 52vh, 560px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-soft);
  cursor: grab;
  touch-action: none;
}

.graph-wrap.is-panning {
  cursor: grabbing;
}

.graph-viewport {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
  will-change: transform;
}

.graph-state-callout {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 8;
  display: none;
  max-width: 150px;
  border: 1px solid #bbf7d0;
  border-left: 4px solid #16a34a;
  border-radius: 8px;
  background: #f0fdf4;
  color: #14532d;
  padding: 8px 10px;
  box-shadow: 0 8px 22px rgba(17, 24, 39, 0.08);
}

.graph-state-callout span {
  display: block;
  color: #16a34a;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.graph-state-callout strong {
  display: block;
  margin-top: 3px;
  color: #111827;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.graph-state-callout p {
  margin: 3px 0 0;
  color: #166534;
  font-size: 11px;
  line-height: 1.25;
}

.workspace:has(.stage-tab[data-stage="9"].active) .graph-state-callout {
  display: block;
}

.workspace:has(.stage-tab[data-stage="0"].active) .graph-wrap::after,
.graph-empty,
.empty-graph-state {
  content: "No committed ontology yet";
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--muted);
  padding: 0 10px;
  font-size: 11px;
  font-weight: 800;
}

.graph-empty,
.empty-graph-state {
  position: static;
  min-height: 180px;
  justify-content: center;
  padding: 18px;
}

.edge-layer,
.node-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.node-layer:empty::before {
  content: "Import a source document to build the first graph nodes.";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  padding: 24px;
}

.edge-line {
  stroke: #d9dee7;
  stroke-width: 1.05;
  opacity: 0.58;
  shape-rendering: geometricPrecision;
}

.edge-line.new-edge,
.edge-line.active-edge,
.edge-line.path-edge,
.edge-line.traversal-highlight {
  stroke: var(--green);
  stroke-width: 1.35;
  opacity: 0.82;
}

.edge-line.fresh-edge {
  stroke: var(--green);
  stroke-width: 1.35;
  opacity: 0.82;
}

.edge-line.delta-edge {
  stroke: var(--pink);
  stroke-width: 1.45;
  opacity: 0.9;
}

.edge-label-bg {
  fill: rgba(255, 255, 255, 0.88);
  stroke: #edf0f4;
  stroke-width: 0.75;
}

.edge-label {
  fill: #7a8392;
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0;
}

.node {
  position: absolute;
  width: 96px;
  min-height: 60px;
  transform: translate(-50%, -50%);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 8px 10px;
  box-shadow: none !important;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  align-content: center;
  gap: 3px 8px;
  opacity: 0;
  animation: nodeIn 0.28s ease forwards;
  transition: border-color 0.18s ease, background 0.18s ease, opacity 0.18s ease;
}

.node.fresh-node,
.node.delta-node {
  border-color: #cfe7d9 !important;
  border-left: 3px solid var(--green) !important;
  background: #fbfdfb;
  box-shadow: none !important;
}

.node.selected,
.node.active,
.node.path-node,
.node.traversed,
.node.traversal-highlight,
.selected-path .node {
  border-color: var(--green);
  background: #fbfdfb;
  z-index: 4;
}

.workspace:has(.stage-tab[data-stage="0"].active) .node[data-node-id="request"],
.workspace:has(.stage-tab[data-stage="0"].active) .node[data-node-id="draft"],
.workspace:has(.stage-tab[data-stage="0"].active) .node[data-node-id="gateway"],
.workspace:has(.stage-tab[data-stage="0"].active) .node[data-node-id="pending"],
.workspace:has(.stage-tab[data-stage="1"].active) .node[data-node-id="rate"],
.workspace:has(.stage-tab[data-stage="1"].active) .node[data-node-id="apr"],
.workspace:has(.stage-tab[data-stage="1"].active) .node[data-node-id="disclosure"],
.workspace:has(.stage-tab[data-stage="1"].active) .node[data-node-id="rewrite"],
.workspace:has(.stage-tab[data-stage="1"].active) .node[data-node-id="allow"],
.workspace:has(.stage-tab[data-stage="2"].active) .node.fresh-node,
.workspace:has(.stage-tab[data-stage="3"].active) .node[data-node-id="mileage"],
.workspace:has(.stage-tab[data-stage="3"].active) .node[data-node-id="cap"],
.workspace:has(.stage-tab[data-stage="3"].active) .node[data-node-id="block"],
.workspace:has(.stage-tab[data-stage="3"].active) .node[data-node-id="retail"],
.workspace:has(.stage-tab[data-stage="3"].active) .node[data-node-id="review"] {
  z-index: 5;
}

.node-type {
  width: 8px;
  height: 8px;
  min-height: 8px;
  border-radius: 999px;
  font-size: 0;
  padding: 0;
  margin-top: 5px;
  border: 1px solid transparent;
}

.node.entity .node-type,
.legend-dot.entity {
  background: #dbeafe;
  border-color: #3b82f6;
}

.node.product .node-type,
.legend-dot.product {
  background: #ede9fe;
  border-color: #8b5cf6;
}

.node.source .node-type,
.legend-dot.source {
  background: #e2e8f0;
  border-color: #64748b;
}

.node.rule .node-type,
.legend-dot.rule {
  background: #fef3c7;
  border-color: #d97706;
}

.node.risk .node-type,
.legend-dot.risk {
  background: #ffe4e6;
  border-color: #e11d48;
}

.node.action .node-type,
.legend-dot.action {
  background: #dcfce7;
  border-color: #16a34a;
}

.node.fresh-node .node-type,
.node.delta-node .node-type,
.legend-dot.delta {
  background: var(--pink-soft);
  border-color: var(--pink);
}

.node.fresh-node:not(.delta-node) .node-type,
.node.path-node:not(.delta-node) .node-type {
  background: var(--green-soft);
  border-color: var(--green);
}

.node strong {
  grid-column: 2;
  font-size: 12px;
  line-height: 1.18;
  color: var(--ink);
}

.node span:last-child {
  grid-column: 2;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}

.graph-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 11px;
  color: #4b5563;
  font-size: 11px;
  font-weight: 800;
}

.graph-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  display: inline-block;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.82);
}

.decision-card {
  min-height: 0;
}

.decision-card.is-open {
  min-height: 430px;
}

.decision-badge {
  min-width: 0;
  max-width: 100%;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
  padding: 0 9px;
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.decision-card .decision-badge {
  max-width: 148px;
}

.decision-badge.neutral {
  color: #596273;
  background: #eef1f4;
}

.decision-badge.allow {
  color: var(--green);
  background: var(--green-soft);
}

.decision-badge.block {
  color: var(--navy);
  background: #eef1f4;
}

.runtime-question,
.agent-draft {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 11px;
  margin-bottom: 10px;
}

.runtime-question {
  border-color: #d6e7db;
  background: #fbfdfb;
}

.runtime-question span,
.agent-draft span {
  color: var(--faint);
  display: block;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.runtime-question p,
.agent-draft p {
  margin: 5px 0 0;
  color: #323946;
  font-size: 12px;
  line-height: 1.45;
}

.runtime-question p {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.runtime-output {
  min-height: 142px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 13px 14px;
  margin-bottom: 10px;
}

.runtime-output.allow {
  border-color: #cfe7d9;
  background: #fbfdfb;
}

.runtime-output.block {
  border-color: var(--pink-line);
  background: var(--pink-soft);
}

.qa-label {
  display: block;
  color: var(--faint);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 7px;
}

.runtime-output strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.25;
  margin-bottom: 6px;
}

.runtime-output p {
  margin: 0;
  color: #323946;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.trace-list,
.selected-path-log,
.path-log {
  display: grid;
  gap: 7px;
}

.trace-list {
  max-height: min(34vh, 360px);
  overflow: auto;
  padding-right: 2px;
}

.trace-row,
.log-row,
.selected-path-log article,
.path-log article {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 8px 9px;
}

.trace-row.hot,
.trace-row.delta,
.trace-row.fresh,
.log-row.hot,
.log-row.delta,
.selected-path-log .hot,
.path-log .hot {
  border-color: #cfe7d9;
  background: #fbfdfb;
}

.trace-row.hot {
  border-color: var(--pink-line);
  background: var(--pink-soft);
}

.trace-row.selected,
.trace-row.active,
.log-row.selected,
.log-row.active,
.selected-path-log .selected,
.path-log .selected {
  border-color: #cfe7d9;
  background: #fbfdfb;
}

.trace-row strong,
.log-row strong,
.selected-path-log strong,
.path-log strong {
  display: block;
  color: #202938;
  font-size: 11px;
}

.trace-row p,
.log-row p,
.selected-path-log p,
.path-log p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10.6px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.compare-cell {
  min-height: 64px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px;
  display: grid;
  gap: 4px;
}

.compare-cell span {
  color: var(--faint);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.compare-cell strong {
  font-size: 11px;
  line-height: 1.2;
}

.compare-cell p {
  color: var(--muted);
  font-size: 9.8px;
  line-height: 1.25;
  margin: 0;
}

.compare-cell.before {
  border-color: #cfe7d9;
  background: var(--green-soft);
}

.compare-cell.after {
  border-color: var(--pink-line);
  background: var(--pink-soft);
}

.is-hidden,
.panel-hidden,
.hidden-panel,
.reveal-when-active:not(.is-revealed),
[hidden],
[data-panel-state="hidden"],
[data-visible="false"] {
  display: none !important;
}

.is-revealed,
.panel-revealed,
.revealed-panel,
[data-panel-state="revealed"],
[data-visible="true"] {
  animation: revealPanel 0.18s ease both;
}

.stage-strip.guided-stepper {
  --step-count: 10;
  grid-template-columns: repeat(10, minmax(64px, 1fr));
}

.stage-tab {
  justify-content: flex-start;
  align-items: center;
  flex-direction: row;
  gap: 6px;
  min-height: 30px;
  height: 30px;
  padding: 4px 7px;
  font-size: 10px;
  line-height: 1;
  min-width: 0;
  text-overflow: ellipsis;
}

.stage-tab span {
  width: 21px;
  height: 21px;
  border-radius: 7px;
}

.stage-tab:has(~ .stage-tab.active) {
  color: #425466;
  border-color: #d6e7db;
  background: #fbfdfb;
}

.stage-tab:has(~ .stage-tab.active) span {
  color: var(--green);
  background: var(--green-soft);
  border-color: #cfe7d9;
}

.view-badge {
  align-self: flex-start;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--muted);
  padding: 0 10px;
  font-size: 11px;
  font-weight: 800;
}

#stepKicker,
#stepViewBadge {
  color: transparent;
  font-size: 0;
}

#stepKicker::after,
#stepViewBadge::after {
  color: var(--faint);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#stepViewBadge::after {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}

#stepKicker::after {
  content: "Step 01 / Builder";
}

#stepViewBadge::after {
  content: "Builder";
}

.workspace:has(.stage-tab[data-stage="1"].active) #stepKicker::after {
  content: "Step 02 / Builder";
}

.workspace:has(.stage-tab[data-stage="2"].active) #stepKicker::after {
  content: "Step 03 / Builder";
}

.workspace:has(.stage-tab[data-stage="3"].active) #stepKicker::after {
  content: "Step 04 / Builder";
}

.workspace:has(.stage-tab[data-stage="4"].active) #stepKicker::after {
  content: "Step 05 / Context graph";
}

.workspace:has(.stage-tab[data-stage="5"].active) #stepKicker::after {
  content: "Step 06 / Runtime";
}

.workspace:has(.stage-tab[data-stage="6"].active) #stepKicker::after {
  content: "Step 07 / Verify";
}

.workspace:has(.stage-tab[data-stage="7"].active) #stepKicker::after {
  content: "Step 08 / Builder";
}

.workspace:has(.stage-tab[data-stage="8"].active) #stepKicker::after {
  content: "Step 09 / Context graph";
}

.workspace:has(.stage-tab[data-stage="9"].active) #stepKicker::after {
  content: "Step 10 / Evaluate";
}

.workspace:has(.stage-tab[data-stage="4"].active) #stepViewBadge::after,
.workspace:has(.stage-tab[data-stage="8"].active) #stepViewBadge::after {
  content: "Context graph";
}

.workspace:has(.stage-tab[data-stage="5"].active) #stepViewBadge::after,
.workspace:has(.stage-tab[data-stage="6"].active) #stepViewBadge::after,
.workspace:has(.stage-tab[data-stage="9"].active) #stepViewBadge::after {
  content: "Evaluate";
}

.step-focus {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.reveal-panel.is-locked {
  background: #fff;
}

#useCasePanel,
#runtimeQuestionPanel,
#agentDraftPanel,
#comparePanel {
  display: none;
}

.workspace:has(.stage-tab[data-stage="5"].active) #useCasePanel,
.workspace:has(.stage-tab[data-stage="6"].active) #useCasePanel,
.workspace:has(.stage-tab[data-stage="7"].active) #useCasePanel,
.workspace:has(.stage-tab[data-stage="8"].active) #useCasePanel,
.workspace:has(.stage-tab[data-stage="9"].active) #useCasePanel,
.workspace:has(.stage-tab[data-stage="5"].active) #runtimeQuestionPanel,
.workspace:has(.stage-tab[data-stage="6"].active) #runtimeQuestionPanel,
.workspace:has(.stage-tab[data-stage="7"].active) #runtimeQuestionPanel,
.workspace:has(.stage-tab[data-stage="8"].active) #runtimeQuestionPanel,
.workspace:has(.stage-tab[data-stage="9"].active) #runtimeQuestionPanel,
.workspace:has(.stage-tab[data-stage="5"].active) #agentDraftPanel,
.workspace:has(.stage-tab[data-stage="6"].active) #agentDraftPanel,
.workspace:has(.stage-tab[data-stage="7"].active) #agentDraftPanel,
.workspace:has(.stage-tab[data-stage="8"].active) #agentDraftPanel,
.workspace:has(.stage-tab[data-stage="9"].active) #agentDraftPanel,
.workspace:has(.stage-tab[data-stage="6"].active) #comparePanel,
.workspace:has(.stage-tab[data-stage="9"].active) #comparePanel {
  display: block;
  animation: revealPanel 0.18s ease both;
}

.workspace:has(.stage-tab[data-stage="5"].active) #useCasePanel,
.workspace:has(.stage-tab[data-stage="7"].active) #useCasePanel,
.workspace:has(.stage-tab[data-stage="8"].active) #useCasePanel {
  grid-column: 1 / -1;
}

.workspace:has(.stage-tab[data-stage="0"].active) #useCasePanel,
.workspace:has(.stage-tab[data-stage="1"].active) #useCasePanel,
.workspace:has(.stage-tab[data-stage="2"].active) #useCasePanel,
.workspace:has(.stage-tab[data-stage="3"].active) #useCasePanel,
.workspace:has(.stage-tab[data-stage="4"].active) #useCasePanel,
.workspace:has(.stage-tab[data-stage="0"].active) #agentDraftPanel,
.workspace:has(.stage-tab[data-stage="1"].active) #agentDraftPanel,
.workspace:has(.stage-tab[data-stage="2"].active) #agentDraftPanel,
.workspace:has(.stage-tab[data-stage="3"].active) #agentDraftPanel,
.workspace:has(.stage-tab[data-stage="4"].active) #agentDraftPanel {
  opacity: 0.64;
}

.workspace:has(.stage-tab[data-stage="0"].active) #comparePanel,
.workspace:has(.stage-tab[data-stage="1"].active) #comparePanel,
.workspace:has(.stage-tab[data-stage="2"].active) #comparePanel,
.workspace:has(.stage-tab[data-stage="3"].active) #comparePanel,
.workspace:has(.stage-tab[data-stage="4"].active) #comparePanel,
.workspace:has(.stage-tab[data-stage="5"].active) #comparePanel,
.workspace:has(.stage-tab[data-stage="7"].active) #comparePanel,
.workspace:has(.stage-tab[data-stage="8"].active) #comparePanel {
  display: none;
}

.graph-wrap::after,
.workspace:has(.stage-tab[data-stage="0"].active) .graph-wrap::after {
  display: none;
}

.empty-graph-state {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: var(--muted);
  padding: 24px;
  text-align: center;
}

.empty-graph-state strong {
  color: var(--ink);
  font-size: 15px;
}

.empty-graph-state span {
  max-width: 330px;
  font-size: 12px;
  line-height: 1.45;
}

.workspace:not(:has(.stage-tab[data-stage="0"].active)) .empty-graph-state {
  display: none;
}

.graph-wrap:has(.empty-graph-state) .node-layer:empty::before {
  display: none;
}

.graph-focus {
  min-height: 38px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
}

.graph-focus span {
  color: var(--faint);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.graph-focus strong {
  color: transparent;
  font-size: 0;
  text-align: right;
}

.graph-focus strong::after {
  content: "No runtime path yet";
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.workspace:has(.stage-tab[data-stage="6"].active) .graph-focus strong::after {
  content: "Question -> policy -> disclosure rewrite -> allow";
  color: var(--green);
}

.workspace:has(.stage-tab[data-stage="8"].active) .graph-focus strong::after {
  content: "Policy delta -> mileage cap -> block rule";
  color: var(--pink);
}

.workspace:has(.stage-tab[data-stage="9"].active) .graph-focus strong::after {
  content: "Same question -> no-rate outcome -> customer follow-up";
  color: var(--green);
}

.node.fresh-node:not(.delta-node) .node-type,
.node.delta-node .node-type {
  background: var(--green-soft);
  border-color: var(--green);
}

.node.fresh-node:is(
  [data-node-id="update_doc"],
  [data-node-id="mileage_fact"],
  [data-node-id="residual_cap"],
  [data-node-id="residual_risk"],
  [data-node-id="block_rule"],
  [data-node-id="retail_path"],
  [data-node-id="review_path"]
),
.node.delta-node {
  border-color: #e7a9bb !important;
  border-left-color: var(--pink) !important;
  background: #fff8fb;
}

.node.fresh-node:is(
  [data-node-id="update_doc"],
  [data-node-id="mileage_fact"],
  [data-node-id="residual_cap"],
  [data-node-id="residual_risk"],
  [data-node-id="block_rule"],
  [data-node-id="retail_path"],
  [data-node-id="review_path"]
) .node-type,
.node.delta-node .node-type {
  background: var(--pink-soft);
  border-color: var(--pink);
}

.workspace:has(.stage-tab[data-stage="9"].active) .node.path-node:is(
  [data-node-id="request"],
  [data-node-id="vehicle"]
) {
  border-color: #cfe7d9 !important;
  border-left-color: var(--green) !important;
  background: #fbfdfb;
}

.workspace:has(.stage-tab[data-stage="9"].active) .node[data-node-id="no_rate_event"],
.workspace:has(.stage-tab[data-stage="9"].active) .node[data-node-id="customer_followup"],
.workspace:has(.stage-tab[data-stage="9"].active) .node[data-node-id="retention_review"] {
  z-index: 9;
  width: 138px;
  border-color: #86efac !important;
  border-left: 4px solid #16a34a !important;
  background: #f0fdf4 !important;
  box-shadow: 0 10px 24px rgba(22, 163, 74, 0.12) !important;
}

.workspace:has(.stage-tab[data-stage="9"].active) .node[data-node-id="no_rate_event"] .node-type,
.workspace:has(.stage-tab[data-stage="9"].active) .node[data-node-id="customer_followup"] .node-type,
.workspace:has(.stage-tab[data-stage="9"].active) .node[data-node-id="retention_review"] .node-type {
  background: #dcfce7 !important;
  border-color: #16a34a !important;
}

@keyframes nodeIn {
  from {
    opacity: 0;
    transform: translate(-50%, -46%) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes revealPanel {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes deltaPulse {
  0%,
  100% {
    border-color: var(--pink-line);
  }
  50% {
    border-color: var(--pink);
  }
}

@keyframes dashFlow {
  to {
    stroke-dashoffset: -22;
  }
}

@media (max-width: 1180px) {
  .main-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "graph"
      "inspector";
  }

  .right-column {
    position: static;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .trace-list {
    max-height: 300px;
  }
}

@media (max-width: 1120px) {
  .workspace {
    padding: 12px 24px 36px;
  }

  .summary-band {
    grid-template-columns: 1fr;
  }

  .summary-compare {
    grid-template-columns: minmax(120px, 0.32fr) minmax(0, 1fr);
  }

  .graph-wrap {
    min-width: 900px;
    min-height: 560px;
  }

  .graph-card {
    overflow-x: auto;
  }
}

@media (max-width: 960px) {
  .app-shell {
    display: block;
  }

  .side-nav {
    position: relative;
    height: auto;
    padding: 12px;
    flex-direction: row;
    gap: 12px;
    overflow-x: auto;
  }

  .brand,
  .main-menu,
  .user-chip {
    display: none;
  }

  .rail {
    display: flex;
    min-width: max-content;
  }

  .workspace {
    padding: 10px 16px 16px;
  }

  .topbar,
  .main-grid,
  .right-column {
    display: grid;
    grid-template-columns: 1fr;
  }

  .top-actions {
    justify-content: start;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .stage-strip {
    grid-template-columns: repeat(10, minmax(76px, 1fr));
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .guided-stepper,
  .ten-step-stepper,
  .demo-stepper {
    grid-template-columns: repeat(10, minmax(76px, 1fr));
    overflow-x: auto;
  }

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

  .graph-card {
    min-height: auto;
  }
}

@media (max-width: 620px) {
  .workspace {
    padding: 10px 14px 14px;
  }

  .topbar {
    gap: 12px;
  }

  .top-actions {
    justify-content: start;
  }

  .primary-button,
  .secondary-button,
  .session-pill {
    flex: 0 0 auto;
    justify-content: center;
  }

  .stage-strip {
    grid-template-columns: repeat(10, minmax(76px, 1fr));
  }

  .stage-tab {
    min-height: 30px;
  }

  .metric-row {
    grid-template-columns: 1fr;
  }

  .step-detail-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .step-detail-grid,
  .step-detail-card.is-wide {
    grid-template-columns: 1fr;
    grid-column: auto;
  }

  .step-detail-rows div {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .connector-grid,
  .pdf-page-grid,
  .action-step-grid,
  .trigger-example,
  .refresh-lists,
  .inconsistency-summary,
  .case-choice-buttons,
  .mission-canvas,
  .mini-edge {
    grid-template-columns: 1fr;
  }

  .mission-step,
  .mission-postcondition {
    width: auto;
    margin-left: 0;
  }

  .mission-trace,
  .mission-trigger {
    width: auto;
    max-width: none;
    margin-left: 0;
  }

  .case-card-head {
    grid-template-columns: auto minmax(0, 1fr) 18px;
  }

  .case-card-head p {
    grid-column: 1 / -1;
    white-space: normal;
  }

  .case-card-head em {
    grid-column: 2 / 3;
  }

  .browser-top,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .metric-card {
    min-height: 56px;
  }

  .summary-band {
    grid-template-columns: 1fr;
  }

  .summary-compare,
  .compare-grid {
    grid-template-columns: 1fr;
  }

  .graph-wrap {
    min-width: 840px;
  }

  .node {
    width: 132px;
  }
}

/* Rippletide platform light app shell */
:root {
  --bg: #f9f9f9;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --ink: #111827;
  --navy: #111827;
  --muted: #4b5563;
  --faint: #9ca3af;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --green: #059669;
  --green-soft: #ecfdf5;
  --pink: #e896af;
  --pink-soft: #fff4f7;
  --pink-line: #f2c7d5;
  --sidebar: #f9f9f9;
  --radius: 12px;
  --radius-sm: 8px;
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-brand: Poppins, Inter, ui-sans-serif, system-ui, sans-serif;
  --font-mono: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, monospace;
}

html,
body {
  background: var(--bg);
}

body,
button,
input,
textarea {
  font-family: var(--font-sans);
}

body {
  color: var(--ink);
  font-size: 13px;
  font-weight: 400;
}

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

.side-nav {
  position: sticky;
  top: 0;
  width: 220px;
  height: 100vh;
  padding: 14px 8px 12px 0;
  border-right: 1px solid #e5e7eb;
  background: var(--sidebar);
  color: #111827;
}

.brand {
  height: 34px;
  margin: 0 10px 20px 10px;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #9ca3af;
  text-decoration: none;
}

.brand img {
  width: 22px;
  height: 22px;
  max-height: 22px;
  border-radius: 999px;
}

.brand::after {
  content: "rippletide";
  color: #9ca3af;
  font-family: var(--font-brand);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.main-menu {
  height: 32px;
  margin: 0 8px 12px 0;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: 0;
  background: transparent;
  color: #111827;
  font-size: 14px;
  font-weight: 400;
}

.main-menu svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.6;
}

.rail {
  gap: 8px;
  padding: 0 8px 0 0;
}

.rail-item {
  min-height: 38px;
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
  font-size: 14px;
  font-weight: 400;
}

.rail-item svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.8;
}

.rail-item:hover,
.rail-item.active {
  background: #e5e7eb;
  color: #111827;
}

.rail-item.muted {
  color: #111827;
  opacity: 1;
}

.user-chip {
  min-height: 58px;
  margin-top: auto;
  border-top: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px 0 6px;
  color: #344054;
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
}

.avatar-dot {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: #e973b8;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
}

.user-chip span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace {
  min-width: 0;
  width: 100%;
  max-width: none;
  min-height: calc(100vh - 26px);
  margin-top: 26px;
  padding: 20px clamp(32px, 6vw, 116px) 42px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  border-left: 1px solid #e5e7eb;
  border-top-left-radius: 22px;
}

.topbar {
  order: 1;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  align-items: flex-start;
  margin-bottom: 16px;
}

.topbar .title-stack {
  display: block;
  max-width: 720px;
}

.topbar .eyebrow {
  display: none;
}

.topbar h1 {
  margin: 0 0 4px;
  color: #111827;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
}

.top-step-copy {
  display: block;
  margin: 0;
  color: #9ca3af;
  font-size: 12px;
  line-height: 1.45;
}

.top-step-copy strong {
  color: #6b7280;
  font-weight: 400;
}

.top-actions {
  gap: 8px;
}

.session-pill,
.metric-chip {
  min-height: 28px;
  border-radius: 6px;
  border-color: #e5e7eb;
  background: #fff;
  color: #4b5563;
  font-size: 12px;
  font-weight: 400;
}

.primary-button,
.secondary-button {
  height: 32px;
  border-radius: 6px;
  padding: 0 13px;
  font-size: 12px;
  font-weight: 500;
}

.primary-button {
  background: #111827;
  border-color: #111827;
  color: #fff;
}

.primary-button:hover {
  background: #374151;
  border-color: #374151;
}

.secondary-button {
  border-color: #e5e7eb;
  background: #fff;
  color: #6b7280;
}

.secondary-button:hover {
  border-color: #d1d5db;
  background: #f9fafb;
  color: #111827;
}

.stage-strip,
.guided-stepper,
.ten-step-stepper,
.demo-stepper {
  order: 2;
  padding: 0;
  margin: 0 0 12px;
  gap: 8px;
}

.stage-strip.guided-stepper {
  grid-template-columns: repeat(10, minmax(88px, 1fr));
}

.stage-tab {
  height: 34px;
  min-height: 34px;
  position: relative;
  overflow: visible;
  border-radius: 6px;
  border-color: #e5e7eb;
  background: #fff;
  color: #374151;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 400;
}

.stage-tab > strong {
  min-width: 0;
  overflow: hidden;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-tab span {
  width: 21px;
  height: 21px;
  border-radius: 5px;
  background: #f9fafb;
  color: #9ca3af;
  font-size: 10px;
  font-weight: 500;
}

.stage-tab.active {
  background: #e5e7eb;
  border-color: #e5e7eb;
  color: #111827;
}

.stage-tab.active span {
  background: #111827;
  border-color: #111827;
  color: #fff;
}

.stage-info {
  position: absolute;
  top: -7px;
  right: 6px;
  width: 17px;
  height: 17px;
  z-index: 2;
  display: grid;
  place-items: center;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #f9fafb;
  color: #111827;
  font-family: Georgia, serif;
  font-size: 11px;
  font-style: italic;
  font-weight: 700;
  line-height: 1;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.stage-info:hover,
.stage-info[aria-expanded="true"] {
  border-color: #111827;
  background: #111827;
  color: #fff;
}

.step-detail-tab {
  order: 3;
  scroll-margin-top: 18px;
  margin: 0 0 16px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  color: #111827;
  padding: 18px 20px 20px;
  box-shadow: none;
}

.step-detail-tab[hidden] {
  display: none;
}

.step-detail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.step-detail-kicker {
  margin: 0 0 4px;
  color: #9ca3af;
  font-size: 11px;
  font-weight: 500;
}

.step-detail-top h2 {
  margin: 0;
  color: #111827;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

.step-detail-top p:last-child {
  max-width: 900px;
  margin: 6px 0 0;
  color: #4b5563;
  font-size: 12px;
  line-height: 1.45;
}

.step-detail-close {
  flex: 0 0 auto;
  height: 30px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 500;
}

.step-detail-close:hover {
  border-color: #d1d5db;
  background: #f9fafb;
}

.step-detail-mapped {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 16px;
}

.step-detail-mapped span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #f9fafb;
  color: #4b5563;
  padding: 0 9px;
  font-size: 11px;
  line-height: 1;
}

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

.step-detail-card {
  min-width: 0;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  padding: 14px;
}

.step-detail-card.is-wide {
  grid-column: span 2;
}

.step-detail-card.is-protected {
  background: #f9fafb;
}

.step-detail-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.step-detail-card-head strong {
  color: #4b5563;
  font-size: 13px;
  font-weight: 600;
}

.step-detail-card-head span {
  color: #9ca3af;
  font-size: 11px;
  white-space: nowrap;
}

.step-detail-card p {
  margin: 0;
  color: #4b5563;
  font-size: 12px;
  line-height: 1.45;
}

.step-detail-list,
.step-detail-rows {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.step-detail-card p + .step-detail-list,
.step-detail-card p + .step-detail-rows {
  margin-top: 10px;
}

.step-detail-list li {
  position: relative;
  padding-left: 13px;
  color: #4b5563;
  font-size: 12px;
  line-height: 1.45;
}

.step-detail-list li::before {
  content: "";
  position: absolute;
  top: 0.62em;
  left: 0;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: #ff5a1f;
}

.step-detail-rows div {
  display: grid;
  grid-template-columns: minmax(110px, 0.45fr) minmax(0, 1fr);
  gap: 10px;
  border-top: 1px solid #f3f4f6;
  padding-top: 7px;
}

.step-detail-rows div:first-child {
  border-top: 0;
  padding-top: 0;
}

.step-detail-rows dt {
  color: #9ca3af;
  font-size: 11px;
  font-weight: 500;
}

.step-detail-rows dd {
  margin: 0;
  color: #4b5563;
  font-size: 12px;
  line-height: 1.4;
}

.step-detail-table-wrap {
  overflow-x: auto;
}

.step-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.step-detail-table th,
.step-detail-table td {
  border-top: 1px solid #f3f4f6;
  padding: 8px 10px 8px 0;
  text-align: left;
  vertical-align: top;
}

.step-detail-table th {
  color: #9ca3af;
  font-weight: 500;
}

.step-detail-table td {
  color: #4b5563;
  line-height: 1.4;
}

.step-detail-code {
  overflow-x: auto;
  margin: 0;
  border: 1px solid #f3f4f6;
  border-radius: 8px;
  background: #f9fafb;
  color: #111827;
  padding: 12px;
  font: 11px/1.55 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
}

.step-detail-card p + .step-detail-code {
  margin-top: 10px;
}

.step-detail-card p + .step-detail-table-wrap {
  margin-top: 10px;
}

.step-detail-card p + .step-detail-list {
  margin-top: 10px;
}

.step-detail-card p + .step-detail-rows {
  margin-top: 10px;
}

.step-detail-card-head + .step-detail-code,
.step-detail-card-head + .step-detail-table-wrap {
  margin-top: 0;
}

.connector-panel,
.browser-panel,
.markdown-panel,
.commit-panel,
.playbook-panel,
.mission-panel,
.action-steps-panel,
.trigger-panel,
.graph-write-panel,
.graph-mini-panel,
.graph-table-panel,
.predicate-panel,
.predicate-table-panel,
.view-refresh-panel,
.final-result-panel,
.artifact-panel {
  margin-top: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  padding: 14px;
}

.connector-panel:first-of-type,
.browser-panel:first-of-type,
.markdown-panel:first-of-type,
.commit-panel:first-of-type,
.playbook-panel:first-of-type,
.mission-panel:first-of-type,
.action-steps-panel:first-of-type,
.trigger-panel:first-of-type,
.graph-write-panel:first-of-type,
.graph-mini-panel:first-of-type,
.graph-table-panel:first-of-type,
.predicate-panel:first-of-type,
.predicate-table-panel:first-of-type,
.view-refresh-panel:first-of-type,
.final-result-panel:first-of-type,
.artifact-panel:first-of-type {
  margin-top: 0;
}

.browser-top,
.section-heading,
.final-result-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.browser-top strong,
.section-heading strong,
.final-result-header h3 {
  color: #4b5563;
  font-size: 13px;
  font-weight: 600;
}

.browser-top span,
.section-heading span,
.final-result-header span {
  color: #9ca3af;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.connector-grid,
.pdf-page-grid,
.action-step-grid,
.trigger-example,
.refresh-lists,
.inconsistency-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.connector-grid article,
.pdf-page,
.action-step-card,
.trigger-example article,
.refresh-lists article,
.inconsistency-summary article,
.commit-tree article,
.mini-edge,
.polling-list article {
  border: 1px solid #f3f4f6;
  border-radius: 8px;
  background: #f9fafb;
  padding: 10px;
}

.inconsistency-case-panel {
  margin-top: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  padding: 14px;
}

.inconsistency-case-list {
  display: grid;
  gap: 12px;
}

.inconsistency-case-card {
  border: 1px solid #f3f4f6;
  border-radius: 8px;
  background: #fff;
  padding: 0;
  overflow: hidden;
}

.case-card-head {
  display: grid;
  grid-template-columns: auto minmax(180px, 0.9fr) auto minmax(260px, 1.4fr) 18px;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.case-card-head:hover,
.case-card-head:focus-visible,
.inconsistency-case-card.is-expanded .case-card-head {
  background: #f9fafb;
}

.case-card-head:focus-visible {
  outline: 2px solid #111827;
  outline-offset: -2px;
}

.case-card-head span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 600;
}

.case-card-head strong {
  color: #111827;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.case-card-head em {
  color: #9ca3af;
  font-size: 11px;
  font-style: normal;
  white-space: nowrap;
}

.case-card-head p {
  overflow: hidden;
  margin: 0;
  color: #4b5563;
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-card-head i {
  width: 8px;
  height: 8px;
  justify-self: center;
  border-right: 1.5px solid #4b5563;
  border-bottom: 1.5px solid #4b5563;
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

.inconsistency-case-card.is-expanded .case-card-head i {
  transform: rotate(225deg);
}

.case-details {
  border-top: 1px solid #f3f4f6;
  padding: 0 12px 12px;
}

.case-details[hidden] {
  display: none;
}

.case-impact,
.case-resolution {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  border-radius: 8px;
  background: #f9fafb;
  padding: 10px;
}

.case-impact strong,
.case-resolution strong {
  color: #111827;
  font-size: 12px;
  font-weight: 600;
}

.case-impact span,
.case-resolution span {
  color: #4b5563;
  font-size: 12px;
  line-height: 1.45;
}

.inconsistency-case-card .graph-table-scroll {
  margin-top: 12px;
}

.case-choice-panel {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 9px;
  background: #f9fafb;
  padding: 12px;
}

.case-choice-panel > strong {
  color: #111827;
  font-size: 12px;
  font-weight: 600;
}

.case-choice-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.case-choice-button {
  min-height: 120px;
  display: grid;
  align-content: start;
  gap: 6px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #4b5563;
  padding: 11px;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.case-choice-button:hover {
  border-color: #d1d5db;
  background: #fff;
}

.case-choice-button.is-selected {
  border-color: #111827;
  background: #fff;
  box-shadow: inset 0 0 0 1px #111827;
}

.case-choice-button span {
  color: #9ca3af;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.case-choice-button strong {
  color: #111827;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.case-choice-button small {
  color: #4b5563;
  font-size: 12px;
  line-height: 1.45;
}

.case-choice-result {
  display: grid;
  gap: 4px;
  border-radius: 8px;
  background: #ecfdf5;
  color: #047857;
  padding: 10px;
}

.case-choice-result[hidden] {
  display: none;
}

.case-choice-result span {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.case-choice-result strong {
  color: #065f46;
  font-size: 12px;
  font-weight: 700;
}

.case-choice-result p {
  margin: 0;
  color: #047857;
  font-size: 12px;
  line-height: 1.45;
}

.connector-grid strong,
.pdf-page strong,
.action-step-card strong,
.trigger-example strong,
.refresh-lists strong,
.inconsistency-summary strong,
.commit-tree strong,
.mini-edge strong,
.polling-list strong {
  display: block;
  color: #111827;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.connector-grid span,
.action-step-card span,
.trigger-example span,
.commit-tree span,
.mini-edge span,
.polling-list span {
  display: block;
  margin-bottom: 4px;
  color: #9ca3af;
  font-size: 11px;
}

.pdf-page p,
.polling-list p,
.inconsistency-summary p,
.commit-tree p,
.action-steps-description,
.trigger-description,
.view-refresh-description,
.final-result-header p {
  margin: 6px 0 0;
  color: #4b5563;
  font-size: 12px;
  line-height: 1.45;
}

.mission-panel h3 {
  margin: 0 0 12px;
  color: #111827;
  font-size: 14px;
  font-weight: 600;
}

.mission-canvas {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(220px, 0.8fr);
  gap: 14px;
  align-items: stretch;
}

.mission-main {
  border: 1px solid #e5e7eb;
  border-left: 5px solid #f59e0b;
  border-radius: 10px;
  background: #fff;
  padding: 14px;
}

.mission-name {
  margin: 0 0 10px;
  color: #111827;
  font-size: 13px;
  font-weight: 700;
}

.mission-precondition,
.mission-postcondition,
.mission-green {
  border-radius: 7px;
  background: #dcfce7;
  color: #166534;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.4;
}

.mission-step {
  width: 88%;
  margin: 12px 0 0 36px;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: #fff7ed;
  padding: 12px;
}

.mission-step-two {
  margin-top: 8px;
}

.mission-step p {
  margin: 0 0 6px;
  color: #4b5563;
  font-size: 12px;
  line-height: 1.4;
}

.mission-trace {
  display: grid;
  gap: 6px;
  width: 88%;
  margin: 10px auto 4px;
  border: 5px solid #ffedd5;
  border-radius: 8px;
  background: #ffedd5;
}

.mission-red {
  border-radius: 7px;
  background: #fee2e2;
  color: #991b1b;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.4;
}

.mission-trigger {
  width: fit-content;
  max-width: 78%;
  margin: 10px 0 0 auto;
  border-radius: 7px;
  background: #cffafe;
  color: #0e7490;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.4;
}

.mission-postcondition {
  width: 92%;
  margin-top: 14px;
}

.mission-callout {
  align-self: center;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  background: #f0fdf4;
  color: #166534;
  padding: 14px;
  font-size: 12px;
  line-height: 1.45;
}

.page-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.page-tabs span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #f9fafb;
  color: #4b5563;
  padding: 0 9px;
  font-size: 11px;
}

.real-pdf-browser {
  min-height: 640px;
}

.pdf-frame {
  width: 100%;
  height: min(72vh, 720px);
  min-height: 560px;
  display: block;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
}

.diff-lines,
.polling-list,
.commit-tree,
.mini-graph {
  display: grid;
  gap: 8px;
}

.diff-line {
  margin: 0;
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.45;
}

.diff-line.added {
  background: #ecfdf5;
  color: #047857;
}

.diff-line.removed {
  background: #fef2f2;
  color: #b91c1c;
}

.polling-rhythm {
  margin: 0 0 10px;
  color: #9ca3af;
  font-size: 11px;
}

.markdown-code,
.playbook-code {
  max-height: 360px;
}

.entity-intro {
  margin: 0 0 10px;
  color: #4b5563;
  font-size: 12px;
  line-height: 1.45;
}

.entity-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.entity-legend span {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #f9fafb;
  color: #4b5563;
  padding: 0 9px;
  font-size: 11px;
}

.entity-swatch {
  width: 12px;
  height: 12px;
  border-radius: 4px;
}

.markdown-editor-shell {
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
}

.markdown-filebar {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
  color: #9ca3af;
  padding: 0 12px;
  font-size: 11px;
}

.markdown-filebar span:first-child {
  color: #4b5563;
  font-weight: 600;
}

.markdown-editor-shell .markdown-code {
  border: 0;
  border-radius: 0;
}

.highlighted-markdown {
  min-height: 340px;
  max-height: min(560px, 68vh);
  overflow: auto;
  white-space: pre-wrap;
}

.entity-highlight {
  display: inline;
  padding: 1px 4px;
  border-radius: 5px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  font-weight: 700;
}

.entity-product {
  background: #dbeafe;
  color: #1d4ed8;
}

.entity-rate {
  background: #dcfce7;
  color: #047857;
}

.entity-condition {
  background: #fef3c7;
  color: #92400e;
}

.entity-guardrail {
  background: #ede9fe;
  color: #6d28d9;
}

.entity-underwriting {
  background: #fee2e2;
  color: #b91c1c;
}

.entity-source {
  background: #e0f2fe;
  color: #0369a1;
}

.commit-tree article {
  position: relative;
}

.commit-tree article.is-active {
  border-color: #ff5a1f;
  background: #fff7ed;
}

.mini-edge {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, auto) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.mini-edge strong {
  color: #ff5a1f;
  text-align: center;
}

.graph-table-scroll {
  overflow-x: auto;
}

.graph-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.graph-table th,
.graph-table td {
  border-top: 1px solid #f3f4f6;
  padding: 8px 10px 8px 0;
  color: #4b5563;
  text-align: left;
  vertical-align: top;
  line-height: 1.4;
}

.graph-table th {
  color: #9ca3af;
  font-weight: 500;
}

.predicate-result {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
}

.action-step-table th:first-child,
.action-step-table td:first-child {
  width: 72px;
}

.trigger-table th:first-child,
.trigger-table td:first-child {
  width: 180px;
}

.action-step-table td:first-child,
.trigger-table td:first-child {
  color: #111827;
  font-weight: 600;
}

.final-result-panel {
  border-color: #d1fae5;
  background: #f8fffb;
}

.final-result-header {
  display: block;
}

.final-result-header span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  padding: 0 9px;
  font-size: 11px;
}

.final-result-header h3 {
  margin: 10px 0 0;
  color: #111827;
  font-size: 14px;
}

.final-result-panel .graph-table-scroll,
.final-result-panel .detail-code {
  margin-top: 12px;
}

.step-info-list strong {
  color: #111827;
  font-size: 12px;
  font-weight: 500;
}

.stage-tab:has(~ .stage-tab.active),
.workspace:has(.stage-tab[data-stage="1"].active) .stage-tab[data-stage="0"],
.workspace:has(.stage-tab[data-stage="2"].active) .stage-tab[data-stage="0"],
.workspace:has(.stage-tab[data-stage="2"].active) .stage-tab[data-stage="1"],
.workspace:has(.stage-tab[data-stage="3"].active) .stage-tab[data-stage="0"],
.workspace:has(.stage-tab[data-stage="3"].active) .stage-tab[data-stage="1"],
.workspace:has(.stage-tab[data-stage="3"].active) .stage-tab[data-stage="2"] {
  background: #fff;
  border-color: #e5e7eb;
  color: #4b5563;
}

.stage-tab:has(~ .stage-tab.active) span,
.workspace:has(.stage-tab[data-stage="1"].active) .stage-tab[data-stage="0"] span,
.workspace:has(.stage-tab[data-stage="2"].active) .stage-tab[data-stage="0"] span,
.workspace:has(.stage-tab[data-stage="2"].active) .stage-tab[data-stage="1"] span,
.workspace:has(.stage-tab[data-stage="3"].active) .stage-tab[data-stage="0"] span,
.workspace:has(.stage-tab[data-stage="3"].active) .stage-tab[data-stage="1"] span,
.workspace:has(.stage-tab[data-stage="3"].active) .stage-tab[data-stage="2"] span {
  background: #f9fafb;
  border-color: transparent;
  color: #9ca3af;
}

.metric-row {
  order: 4;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 0;
  margin: 0 0 16px;
  gap: 14px;
}

.metric-card,
.request-panel,
.story-panel,
.surface-card,
.graph-card,
.document-import-state,
.graph-empty,
.empty-graph-state,
.selected-path-log,
.path-log,
.runtime-question,
.agent-draft,
.runtime-output,
.trace-row,
.log-row,
.compare-cell,
.doc-row,
.pipeline-step,
.pipeline-item,
.checklist-step {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  box-shadow: none;
}

.metric-card {
  min-height: 92px;
  padding: 14px 20px;
  display: block;
}

.metric-card span {
  display: block;
  color: #9ca3af;
  font-size: 12px;
  font-weight: 400;
}

.metric-card strong {
  display: block;
  margin-top: 6px;
  color: #059669;
  font-size: 24px;
  line-height: 1;
  font-weight: 600;
}

.metric-card small {
  display: block;
  margin-top: 12px;
  color: #9ca3af;
  font-size: 11px;
  font-weight: 400;
}

.summary-band {
  order: 5;
  padding: 0;
}

.main-grid {
  order: 6;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  gap: 14px;
  padding: 0;
}

.surface-card,
.graph-card {
  padding: 20px;
  min-width: 0;
}

.side-panel {
  padding: 20px;
}

.section-heading {
  margin-bottom: 16px;
}

.section-heading .graph-page-control span {
  min-height: 26px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  color: #6b7280;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 500;
}

.section-heading .graph-page-control strong {
  color: #111827;
  font-size: 11px;
  font-weight: 600;
}

.section-heading .graph-page-next {
  border-radius: 6px;
}

.eyebrow,
.panel-label {
  color: #9ca3af;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
}

.request-panel h2,
.story-panel h2,
.surface-card h2,
.graph-card h2 {
  margin-top: 7px;
  color: #111827;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
}

.graph-wrap {
  min-height: clamp(420px, 52vh, 560px);
  border-color: #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.empty-graph-state {
  background: #fff;
}

.empty-graph-state strong {
  color: #111827;
  font-size: 14px;
  font-weight: 600;
}

.empty-graph-state span {
  color: #4b5563;
  font-size: 12px;
}

.graph-focus {
  border-color: #e5e7eb;
  border-radius: 8px;
}

.graph-legend {
  color: #4b5563;
  font-size: 12px;
  font-weight: 400;
}

.right-column {
  top: 20px;
  gap: 14px;
}

.collapse-button {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border-color: #e5e7eb;
  color: #4b5563;
}

.decision-badge,
.status-tag,
.ip-chip {
  border-radius: 5px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.node {
  border-color: #d1d5db;
  border-radius: 8px;
  box-shadow: none !important;
}

.node strong,
.doc-title,
.step-title-line strong,
.trace-row strong,
.log-row strong {
  font-weight: 500;
}

@media (max-width: 1180px) {
  .workspace {
    padding-right: 32px;
    padding-left: 32px;
  }

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

  .right-column {
    position: static;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .app-shell {
    display: block;
  }

  .side-nav {
    position: sticky;
    width: 100%;
    height: auto;
    min-height: 50px;
    padding: 8px;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }

  .brand {
    display: flex;
    flex: 0 0 auto;
    margin: 0 10px 0 0;
  }

  .brand::after,
  .main-menu,
  .user-chip {
    display: none;
  }

  .rail {
    display: flex;
    min-width: max-content;
    padding: 0;
    gap: 6px;
  }

  .rail-item {
    min-height: 34px;
    width: auto;
    padding: 0 10px;
  }

  .workspace {
    min-height: auto;
    margin-top: 0;
    padding: 16px;
    border-left: 0;
    border-top-left-radius: 0;
    overflow-x: hidden;
  }

  .topbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .top-actions {
    justify-content: start;
    flex-wrap: wrap;
    overflow: visible;
  }

  .stage-strip.guided-stepper {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    grid-template-columns: repeat(10, minmax(88px, 1fr));
    overflow-x: auto;
    padding-bottom: 2px;
  }

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

  .right-column {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .top-actions .session-pill,
  .top-actions .secondary-button {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .top-actions .primary-button {
    flex: 1 0 100%;
    min-width: 0;
  }

  .topbar .title-stack {
    max-width: 100%;
    min-width: 0;
  }

  .top-step-copy span {
    margin-left: 0;
  }

  .metric-row {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 74px;
  }

  .graph-wrap {
    width: 100%;
    min-width: 0;
    min-height: 360px;
  }
}
