/* Audit dossier, related records and knowledge graph. */
#run-explorer {
  min-width: 0;
}
#explorer-result:empty { display: none; }
#explorer-result {
  margin: 16px clamp(14px, 3vw, 32px);
  padding: 4px 0 4px 16px;
  border-inline-start: 3px solid var(--teal);
  display: grid;
  gap: 12px;
  overflow-wrap: anywhere;
}
#explorer-result h2 { margin: 0; font-size: clamp(1.15rem, 2vw, 1.5rem); font-weight: 500; }
.audit-result-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; }
.audit-result-row p { margin: 4px 0 0; color: var(--muted); line-height: 1.5; }

/* Default reading view: one outcome, compact work, details on demand. */
#explorer-overview, #explorer-investigations {
  padding: clamp(20px, 3vw, 36px);
  gap: clamp(24px, 3vw, 36px);
}
#explorer-overview .progress-verdict { border: 0; border-left: 2px solid var(--line); padding: 2px 12px; font-size: 1rem; }
@media(max-width:760px) {
  #explorer-overview, #explorer-investigations { padding: 20px 16px 24px; gap: 24px; }
}

.progress-verdict { border-top: 1px solid var(--line); padding: 14px 24px; color: var(--muted); font-size: 1rem; }
.progress-verdict ul { list-style: none; margin: 8px 0 0; padding: 0; }
.progress-verdict li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.progress-verdict li .inspector-link { max-width: 100%; overflow-wrap: anywhere; }

@media(max-width:760px) {
  .progress-verdict { padding: 14px 16px; }
}

/* Selected audit identity and tab navigation */
#selected-audit {
  min-width: 0;
  overflow: clip;
  color: var(--text);
  background: var(--raised-fill);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--raised-shadow);
  scroll-margin-top: 16px;
}

.console-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  min-height: 58px;
  padding: 16px clamp(16px, 2.3vw, 26px);
  background: var(--surface);
}

.run-identity, .run-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.run-identity { flex: 1 1 215px; }
.run-caption { display: grid; gap: 3px; min-width: 0; }
.run-caption h2 { margin: 0; color: var(--text); font: 500 clamp(23px, 2.1vw, 29px)/1.1 var(--font-display); letter-spacing: -.032em; }
.run-caption strong { color: var(--muted); font: 400 12px/1.5 var(--mono); }
.run-caption :is(h2, strong) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-caption:has(h2[hidden]) strong { color: var(--text); }
.run-controls { margin-inline-start: auto; }
.run-controls .timer { padding-right: 3px; font: 12px/1.4 var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.run-controls .button { min-height: 34px; padding: 6px 12px; border-radius: var(--control-radius); font-size: 13px; font-weight: 500; }
.run-controls .stop-button { color: var(--coral); }
.run-identity .run-status {
  max-width: 55%;
  border: none;
  padding: 0;
  background: transparent;
  font: 400 11px/1.4 var(--mono);
  letter-spacing: .02em;
  white-space: normal;
  overflow-wrap: anywhere;
}

.explorer-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 14px;
  padding: 10px clamp(12px, 2.3vw, 25px);
  border-bottom: 1px solid var(--line);
}
.explorer-toolbar .tabs {
  display: flex;
  flex: 1 1 400px;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.explorer-toolbar .tab {
  flex: none;
  position: relative;
  padding: 6px 11px;
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: var(--control-radius);
  color: var(--muted);
  font: 450 13px/1.4 var(--font);
  white-space: nowrap;
}
.explorer-toolbar .tab:focus-visible { outline-offset: -3px; }
.explorer-toolbar .tab:hover { color: var(--text); background: var(--control-fill); }
.explorer-toolbar .tab[aria-selected="true"] {
  border-color: var(--teal);
  background: var(--petrol);
  color: var(--text);
  font-weight: 550;
}
.stream-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  color: var(--muted);
  font: 12px/1.4 var(--mono);
}
.stream-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--coral); }
.stream-status.connected::before { background: var(--teal); }
.explorer-sync {
  padding: 10px clamp(16px, 2.6vw, 28px);
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.explorer-sync:empty { display: none; }
.explorer-panel {
  display: grid;
  gap: 18px;
  min-width: 0;
  padding: clamp(16px, 2.3vw, 26px);
}
.explorer-panel[hidden] { display: none; }

.explorer-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.explorer-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  background: var(--control-fill);
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  text-align: left;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
}

.explorer-button:hover {
  border-color: color-mix(in srgb, var(--text) 35%, var(--line));
}

.explorer-button[aria-pressed=true] {
  background: var(--petrol);
  border-color: var(--teal);
}

.explorer-button:disabled {
  color: var(--faint);
  border-style: dashed;
  opacity: 1;
}

.explorer-button.reference {
  font-family: var(--mono);
  font-size: 12px;
  padding: 6px 9px;
}

.explorer-meta {
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.explorer-route-map {
  position: relative;
  min-width: 0;
}

.explorer-connectors {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  color: var(--muted);
}

.explorer-edge {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1;
}

.explorer-edge.form {
  stroke-dasharray: 5 4;
}

.explorer-detail {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  display: grid;
  gap: 14px;
  overflow-wrap: anywhere;
  min-width: 0;
}

.explorer-detail h3 {
  font: 500 23px/1.18 var(--font-display);
  letter-spacing: -.02em;
}

.explorer-detail p {
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.65;
}

.explorer-facts {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) minmax(0, 3fr);
  gap: 9px 16px;
  margin: 0;
  font-size: 12px;
}

.explorer-facts dt {
  color: var(--muted);
}

.explorer-facts dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.explorer-panel details {
  min-width: 0;
}

.explorer-panel summary {
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  padding-block: 5px;
}

.explorer-panel details[open]>:not(summary) {
  margin-top: 14px;
}

.explorer-panel pre {
  margin: 0;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 12px/1.7 var(--mono);
  max-height: 350px;
  overflow: auto;
}

.explorer-panel code {
  font: 12px/1.6 var(--mono);
  overflow-wrap: anywhere;
}

.explorer-conclusion {
  display: grid;
  gap: 9px;
}

.explorer-warning {
  padding: 12px 14px;
  border-left: 2px solid var(--coral);
  background: var(--panel);
  font-size: 1rem;
}

.explorer-references {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.explorer-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

.explorer-route-scroll {
  overflow-x: auto;
  min-width: 0;
}

.explorer-route-map {
  display: grid;
  gap: 70px;
  padding: 24px 32px;
  width: max-content;
  min-width: 100%;
}

.explorer-route-root {
  display: flex;
  justify-content: center;
  position: relative;
}

.explorer-route-node {
  display: grid;
  gap: 7px;
  justify-items: center;
  text-align: center;
  min-width: 0;
}

.explorer-route-root .explorer-route-node {
  max-width: 280px;
}

.explorer-route-targets {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 170px;
  justify-content: center;
  gap: 30px;
  position: relative;
}

.route-node {
  font-family: var(--mono);
  text-align: center;
}

.explorer-relation-label {
  color: var(--muted);
  font-size: 12px;
}

.explorer-table {
  overflow-x: auto;
  min-width: 0;
}

.explorer-table table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.explorer-table th {
  position: static;
  padding: 10px 8px;
  color: var(--muted);
  background: var(--bg);
  font-size: 12px;
}

.explorer-table td {
  max-width: none;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 12px;
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
}

.explorer-table td:first-child {
  min-width: 110px;
}

.explorer-table tbody tr {
  cursor: default;
}

.explorer-table td>div {
  margin-top: 6px;
}

.explorer-notices {
  display: grid;
  gap: 6px;
}

.explorer-notice {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) auto;
  gap: 12px;
  text-align: left;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 12px;
}

.explorer-notice:hover { background: var(--elevated); }
.explorer-notice[aria-pressed=true] { background: var(--petrol); color: var(--text); }

.explorer-notice time,
.explorer-notice small {
  font: 11px var(--mono);
  color: var(--muted);
}

.explorer-cost {
  font-variant-numeric: tabular-nums;
  font-size: 16px;
}

.explorer-meter {
  height: 6px;
  background: var(--elevated);
  border-radius: var(--control-radius);
  overflow: hidden;
}

.explorer-meter span {
  display: block;
  height: 100%;
  background: var(--teal);
}

.explorer-empty-copy {
  padding: 24px 0;
  color: var(--muted);
  font-size: 1rem;
}

/* Detail views share a compact list and a single selected inspector. */
.explorer-workspace { display: grid; gap: clamp(16px, 2vw, 24px); min-width: 0; }
.explorer-workspace.with-inspector { grid-template-columns: minmax(0, 1.15fr) minmax(285px, .85fr); }
.explorer-primary { min-width: 0; display: grid; gap: 18px; align-content: start; }
.explorer-inspector { min-width: 0; border-left: 1px solid var(--line); padding: 0 0 0 22px; position: relative; align-self: start; }
.explorer-inspector .explorer-detail { border: 0; padding: 3px 0 0; gap: 15px; }
.explorer-inspector h3 { padding-right: 42px; overflow-wrap: anywhere; }
.inspector-close { position: absolute; right: 0; top: 0; font-size: 22px; color: var(--muted); line-height: 1; padding: 0 4px; }
.inspector-link { color: var(--text); font-size: 12px; padding: 7px 0; text-align: left; }
.explorer-search { display: grid; gap: 7px; font-size: 13px; font-weight: 550; color: var(--muted); max-width: 430px; }
.explorer-search input { min-width: 0; width: 100%; font-weight: 400; font-size: 1rem; padding: 10px 12px; }
.catalog-list { display: grid; align-content: start; min-width: 0; border-block: 1px solid var(--line-soft); }
.catalog-list > :last-child { border-bottom: 0; }
.catalog-list > .explorer-empty-copy { padding-inline: 16px; }
.catalog-row { color: var(--text); width: 100%; display: grid; grid-template-columns: minmax(0,1fr) auto 10px; align-items: center; gap: 12px; text-align: left; padding: 11px 9px; border-bottom: 1px solid var(--line-soft); border-radius: 0; min-width: 0; }
.catalog-row:hover { background: var(--elevated); }
.catalog-row[aria-pressed=true] { background: var(--petrol); box-shadow: inset 3px 0 var(--teal); }
.catalog-row strong, .catalog-operation { font: 12px var(--mono); overflow-wrap: anywhere; }
.catalog-row small { color: var(--muted); font-size: 11px; }
.catalog-row > span:last-child { color: var(--faint); }
.catalog-row[aria-pressed=true] > span:last-child { color: var(--muted); }
.exchange-row small { display: block; margin-top: 5px; }
.exchange-row .http-code { font: 12px var(--mono); color: var(--muted); }
.exchange-summary { font-size: 12px; color: var(--muted); }
.exchange-summary strong { color: var(--text); }
.route-browser { display: grid; grid-template-columns: minmax(230px, .8fr) minmax(0,1.2fr); gap: 24px; min-width: 0; }
.route-catalog { min-width: 0; display: grid; align-content: start; gap: 16px; }
.route-inspector.explorer-detail { border-top: 0; border-left: 1px solid var(--line); padding: 0 0 0 24px; align-content: start; }
.route-inspector > details { border-top: 1px solid var(--line-soft); padding-top: 8px; }
.relation-row { grid-template-columns: minmax(0,1fr) 10px; }
.relation-row small { grid-row: 2; grid-column: 1; margin-top: -5px; }
.relation-row > span:last-child { grid-row: 1; grid-column: 2; }
.diagnostic-summary { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(200px,1fr); gap: 20px; border-bottom: 1px solid var(--line-soft); padding-bottom: 16px; }
.diagnostic-outcome, .diagnostic-cost { display: grid; align-content: start; gap: 7px; min-width: 0; }
.diagnostic-cost { padding-left: 20px; border-left: 1px solid var(--line-soft); }
.diagnostic-outcome h3, .diagnostic-cost h3 { margin: 0; color: var(--text); font: 500 23px/1.2 var(--font-display); letter-spacing: -.02em; }
.diagnostic-outcome p { margin: 0; line-height: 1.6; font-size: 1rem; color: var(--muted); max-width: 70ch; }
.diagnostic-cost .explorer-cost { margin: 0; font-size: 22px; font-weight: 500; line-height: 1.15; letter-spacing: -.035em; }
.diagnostic-cost .explorer-cost small { color: var(--muted); font-size: 12px; }
@media(max-width:1150px) {
  .explorer-workspace.with-inspector { grid-template-columns: 1fr; }
  .explorer-inspector { border-left: 0; border-top: 1px solid var(--line); padding: 20px 0 0; }
  .inspector-close { top: 20px; }
}
@media(max-width:700px) {
  .route-browser, .diagnostic-summary { grid-template-columns: 1fr; }
  .diagnostic-cost { border: 0; padding-left: 0; }
  .route-inspector.explorer-detail { border-left: 0; border-top: 1px solid var(--line); padding: 20px 0 0; }
  .route-catalog .catalog-list { max-height: 260px; overflow: auto; }
  .catalog-row { padding: 13px 10px; gap: 8px; }
}

@media(max-width:600px) {
  .run-identity { flex: 1 1 12ch; flex-direction: column; align-items: flex-start; gap: 5px; }
  .run-caption { width: 100%; }
  .run-caption h2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: normal; overflow-wrap: anywhere; font-size: 20px; }
  .run-identity .run-status { max-width: 100%; }

  .explorer-facts {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .explorer-facts dd {
    margin-bottom: 8px;
  }

  .explorer-route-map {
    padding-inline: 12px;
  }

  .explorer-notice {
    grid-template-columns: 60px minmax(0, 1fr) auto;
    gap: 6px;
    padding-inline: 5px;
  }


}

@media (pointer: coarse) {
  .explorer-toolbar .tab,
  .run-controls .button,
  .run-controls .icon-button,
  .run-inspector :is(.inspector-back, .inspector-close-button) { min-height: 44px; }
}

@media(prefers-reduced-motion:reduce) {
  .explorer-panel * {
    animation: none !important;
    transition: none !important;
  }
}

.explorer-heading { font-size: 12px; }
.explorer-panel > details { margin-top: 12px; color: var(--muted); font-size: 12px; }
.explorer-panel > details > summary { cursor: pointer; }

/* Run workspace: live activity first, details on demand. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
#run-explorer { position: relative; }
.section-kicker { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: .08em; font-weight: 450; color: var(--faint); }
.run-pulse { display: flex; align-items: start; justify-content: space-between; gap: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.run-pulse > div { min-width: 0; }
.run-pulse h2 { font: 500 clamp(1.75rem, 2.7vw, 2.35rem)/1.12 var(--font-display); letter-spacing: -.028em; margin-top: 4px; }
.run-pulse p { max-width: 65ch; font-size: .9375rem; line-height: 1.6; color: var(--muted); margin-top: 6px; overflow-wrap: anywhere; }
.run-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 18px; flex: 0 1 540px; }
.run-stat-grid > button, .run-stat-grid > div { display: grid; align-content: start; gap: 4px; text-align: left; padding: 4px 0 4px 14px; border-inline-start: 1px solid var(--line); }
.run-stat-grid strong { font-size: clamp(1.25rem, 2vw, 1.55rem); font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.25; overflow-wrap: anywhere; }
.run-stat-grid span { font-size: .8125rem; line-height: 1.4; color: var(--muted); }
.run-stat-grid > button:hover strong { text-decoration: underline; text-underline-offset: .2em; }
.run-stat-cost strong { font-size: 1.05rem; line-height: 1.8; }
.agent-strip { display: grid; grid-template-columns: repeat(auto-fit,minmax(190px,1fr)); gap: 7px 16px; }
.agent-card, .investigation-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--raised-fill); box-shadow: var(--raised-shadow); }
.agent-card:hover, .investigation-card:hover { border-color: color-mix(in srgb, var(--muted) 26%, var(--line)); }
.agent-card { display: grid; align-content: start; gap: 7px; text-align: left; padding: 14px 16px; min-width: 0; }
.agent-card-top { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.agent-symbol { display: grid; place-items: center; height: 19px; width: 19px; color: var(--muted); font-size: 12px; flex-shrink: 0; }
.agent-dot { margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.agent-dot.active { background: var(--teal); }
.agent-dot.failed { background: var(--coral); }
.agent-card:has(.agent-dot.active) { border-block-start: 3px solid var(--teal); }
.agent-card:has(.agent-dot.failed) { border-block-start: 3px solid var(--coral); }
.agent-card strong { font-size: 12px; font-weight: 500; line-height: 1.5; }
.agent-card small { color: var(--faint); font-size: 11px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.business-journal { min-width: 0; }
.journal-agents { display: grid; gap: 16px; }
.workspace-section-title { display: flex; align-items: start; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; }
.workspace-section-title > div { min-width: 0; }
.workspace-section-title h3, .workspace-section-title h2 { font: 500 clamp(1.6rem, 2.4vw, 2.1rem)/1.15 var(--font-display); letter-spacing: -.025em; }
.workspace-subtitle { max-width: 72ch; margin-top: 6px; font-size: .9375rem; line-height: 1.55; color: var(--muted); overflow-wrap: anywhere; }
.workspace-count { align-self: center; font: .8125rem/1.4 var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.journal-mode { display: inline-flex; align-self: center; max-width: 100%; padding: 3px; border-radius: var(--control-radius); border: 1px solid var(--line); gap: 2px; background: var(--surface); }
.journal-mode button { padding: 7px 12px; font-size: .8125rem; line-height: 1.4; color: var(--muted); border-radius: var(--control-radius); }
.journal-mode button:hover { background: var(--elevated); }
.journal-mode [aria-pressed=true], .journal-mode [aria-pressed=true]:hover { color: var(--inverse-text); background: var(--inverse-ground); }
.journal-filters { display: grid; gap: 16px; margin: 22px 0 20px; }
.investigation-filters { margin: 0; }
.journal-filter-group { display: grid; gap: 8px; }
.journal-filter-label { display: block; font-size: .8125rem; font-weight: 550; color: var(--muted); }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chips button { font-size: .8125rem; line-height: 1.35; color: var(--muted); padding: 7px 12px; border-radius: var(--control-radius); border: 1px solid var(--line); }
.filter-chips button:hover { color: var(--text); background: var(--elevated); }
.filter-chips [aria-pressed=true] { border-color: var(--teal); color: var(--text); background: var(--petrol); font-weight: 550; }
.filter-count { display: inline-block; margin-inline-start: 2px; font: .75rem/1.3 var(--mono); color: var(--faint); }
.filter-chips [aria-pressed=true] .filter-count { color: inherit; }
.journal-search { display: grid; grid-template-columns: minmax(0, 1fr) minmax(170px, 28%); gap: 14px; }
.journal-search label { display: grid; gap: 6px; margin: 0; min-width: 0; }
.journal-search input, .journal-search select { min-height: 40px; font-size: 1rem; padding: 8px 11px; width: 100%; background: var(--bg); }
.journal-rows { border-block-start: 1px solid var(--line); }
.journal-day { margin: 0; padding: 15px 7px 10px; font: 500 .8125rem/1.45 var(--font); color: var(--muted); letter-spacing: .01em; }
.journal-day:not(:first-child) { padding-top: 24px; }
.journal-row { width: 100%; display: grid; grid-template-columns: 64px 8px minmax(0,1fr) minmax(80px,120px) 16px; gap: 14px; align-items: start; padding: 17px 7px; border-bottom: 1px solid var(--line-soft); text-align: left; }
.journal-row:hover { background: var(--surface); }
.journal-row time { font: .75rem/1.45 var(--mono); font-variant-numeric: tabular-nums; color: var(--faint); padding-top: 3px; white-space: nowrap; }
.journal-marker { width: 6px; height: 6px; border: 1px solid var(--muted); border-radius: 50%; margin-top: 7px; background: var(--muted); }
.journal-row.decision .journal-marker { background: var(--panel); }
.journal-row.discovery .journal-marker { background: var(--teal); border-color: var(--teal); }
.journal-row.incident .journal-marker { background: var(--coral); border-color: var(--coral); }
.journal-copy { display: grid; gap: 5px; min-width: 0; }
.journal-copy strong { font-size: 1rem; font-weight: 500; overflow-wrap: anywhere; }
.journal-copy > span { max-width: 80ch; font-size: .9375rem; color: var(--muted); line-height: 1.55; overflow-wrap: anywhere; }
.journal-copy small { font-size: .75rem; line-height: 1.5; color: var(--faint); overflow-wrap: anywhere; }
.journal-copy .decision-author, .run-inspector .decision-author { font: 600 12px/1.5 var(--font); color: var(--text); }
.journal-category { font-size: .75rem; line-height: 1.45; color: var(--muted); padding-top: 4px; text-align: right; overflow-wrap: anywhere; }
.row-arrow { font-size: 13px; color: var(--faint); padding-top: 2px; text-align: right; }
.journal-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 15px; font-size: 11px; color: var(--faint); }
.workspace-empty { border-top: 1px solid var(--line-soft); display: grid; justify-items: center; gap: 5px; text-align: center; padding: 25px 16px; width: 100%; color: var(--muted); }
.workspace-empty > span { display: grid; place-items: center; width: 27px; height: 27px; font-size: 18px; color: var(--muted); }
.workspace-empty strong { font-size: 1rem; font-weight: 500; color: var(--text); }
.workspace-empty p { font-size: 1rem; }
.workspace-error { color: var(--text); box-shadow: inset 2px 0 var(--coral); padding-inline-start: 10px; font-size: 1rem; overflow-wrap: anywhere; }
.investigation-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; align-content: start; }
.investigation-grid > .workspace-empty { grid-column: 1/-1; }
.investigation-card { min-width: 0; display: flex; flex-direction: column; gap: 12px; text-align: left; padding: clamp(16px, 2vw, 24px); box-shadow: none; overflow-wrap: anywhere; }
.investigation-top { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 8px 14px; font-size: .8125rem; font-weight: 500; color: var(--muted); }
.investigation-card > strong { font-size: 1.0625rem; line-height: 1.4; letter-spacing: -.012em; font-weight: 550; }
.investigation-card p { font-size: .9375rem; color: var(--muted); line-height: 1.6; }
.investigation-proof { border-inline-start: 2px solid var(--teal); padding-inline-start: 12px; }
.investigation-proof > span:first-child { display: block; color: var(--faint); font-size: .75rem; font-weight: 550; }
.state-pill { display: inline-flex; align-self: start; font-size: 11px; line-height: 1.4; padding: 3px 9px; border-radius: var(--control-radius); color: var(--muted); background: var(--elevated); }
.state-pill:is(.confirmed, .error, .failed, .blocked) { box-shadow: inset 0 0 0 1px var(--coral); color: var(--text); }
.state-pill:is(.running, .ok, .completed) { background: var(--petrol); box-shadow: inset 0 0 0 1px var(--teal); color: var(--text); }
.state-pill.boolean { color: var(--text); background: var(--elevated); font-family: var(--mono); }
.check-stages { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; font-size: 11px; color: var(--faint); }
.check-stages .done { color: var(--text); }
.check-stages i { font-style: normal; color: var(--faint); }
.investigation-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); color: var(--faint); font-size: .8125rem; line-height: 1.5; }
.investigation-footer > [aria-hidden], .journal-row .row-arrow { color: var(--faint); }
:is(.investigation-card, .journal-row):is(:hover, :focus-visible) :is(.row-arrow, .investigation-footer > [aria-hidden]) { color: var(--teal); }
.record-link { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; line-height: 1.6; color: var(--text); text-align: left; padding: 5px 0; overflow-wrap: anywhere; }
.record-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.run-inspector { color: var(--text); overscroll-behavior: contain; position: fixed; right: 0; top: 0; bottom: 0; width: min(460px,100vw); z-index: 40; border-left: 1px solid var(--line); background: var(--raised-fill); box-shadow: -12px 0 36px rgb(0 0 0 / .45), inset 1px 0 0 rgb(255 255 255 / .035); overflow: auto; outline: none; }
.run-inspector[hidden] { display: none; }
.run-inspector-heading { position: sticky; top: 0; display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--teal); background: var(--petrol); z-index: 1; }
.run-inspector-heading > div { flex: 1; min-width: 0; display: grid; gap: 6px; }
.run-inspector-heading .section-kicker { color: var(--muted); }
.run-inspector-heading small { color: var(--muted); font: 10px/1.5 var(--mono); overflow-wrap: anywhere; }
.inspector-back { padding: 5px; font-size: 20px; }
.inspector-back, .inspector-close-button, .inspector-close {
  display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border-radius: var(--control-radius); background: var(--control-fill); border: 1px solid var(--line); color: var(--muted); font-size: 18px; line-height: 1;
}
:is(.inspector-back, .inspector-close-button, .inspector-close):hover { color: var(--text); background: var(--elevated); }

.run-inspector-body { display: grid; gap: 16px; padding: 20px; min-width: 0; overflow-wrap: anywhere; }
.run-inspector h3 { font: 500 26px/1.15 var(--font-display); letter-spacing: -.025em; }
.run-inspector h4 { font-size: 12px; font-weight: 500; margin: 0; color: var(--text); }
.run-inspector p { font-size: 1rem; line-height: 1.8; color: var(--muted); }
.run-inspector details { min-width: 0; border-top: 1px solid var(--line); padding-top: 10px; }
.run-inspector summary { cursor: pointer; font-size: 12px; color: var(--muted); padding: 5px 0; }
.run-inspector details[open] > :not(summary) { margin-top: 15px; }
.run-inspector pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 420px; overflow: auto; background: var(--bg); border: 1px solid var(--line-soft); padding: 13px 14px; border-radius: var(--radius); font: 12px/1.7 var(--mono); margin: 0; }
.run-inspector .explorer-facts { font-size: 12px; line-height: 1.7; }
.run-inspector .explorer-references { gap: 5px 13px; }
.context-reference { font-size: 11px!important; color: var(--faint)!important; }
.context-reference code { font-size: 11px; }
.inspector-sync { font-size: 11px!important; }
.investigation-chain { display: grid; gap: 0; }
.chain-stage { display: grid; grid-template-columns: 28px minmax(0,1fr); gap: 14px; position: relative; padding: 0 0 26px; }
.chain-stage:not(:last-child):before { content: ''; position: absolute; top: 29px; left: 13px; bottom: 4px; border-left: 1px dashed var(--line); }
.chain-number { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 50%; border: 1px solid var(--line); color: var(--faint); font: 11px var(--mono); }
.chain-stage.recorded .chain-number { color: var(--text); border-color: var(--teal); }
.chain-stage > div { display: grid; justify-items: start; gap: 12px; padding-top: 4px; }
.chain-stage .criterion { font-size: 1rem; padding-left: 10px; border-left: 2px solid var(--line); }
.change-list { display: grid; gap: 14px; }
.change-list > div { display: grid; gap: 7px; font-size: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.change-list strong { font: 11px var(--mono); color: var(--text); }
.change-list span { color: var(--muted); font-size: 1rem; padding: 7px 9px; background: var(--bg); border-radius: var(--radius); }
.change-list .change-after { color: var(--text); box-shadow: inset 2px 0 var(--teal); }
.decision-proposal { border-left: 2px solid var(--faint); padding-left: 14px; display: grid; gap: 8px; }
.decision-tools ol { margin: 8px 0 0; padding-inline-start: 2em; }
.decision-tools li { padding: 3px 0; font: 13px/1.5 var(--mono); }
.decision-tools li::marker { color: var(--muted); }
.workflow-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 20px; }
.workflow-steps li { display: grid; grid-template-columns: 25px 1fr; gap: 13px; }
.workflow-index { font: 11px var(--mono); color: var(--muted); padding-top: 3px; }
.workflow-steps li > div { display: grid; gap: 9px; min-width: 0; }
.workflow-steps strong { font-size: 12px; font-weight: 500; }
.workflow-steps small { font-size: 11px; color: var(--muted); }
.experiment-measures { display: grid; gap: 12px; }
.experiment-measures > div { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: start; gap: 6px 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); font-size: 12px; }
.experiment-measures strong { font: 11px var(--mono); color: var(--muted); }
@media(min-width:1600px) { .agent-strip { grid-template-columns: repeat(auto-fit,minmax(205px,1fr)); } }
@media(max-width:1000px) {
  .run-pulse { flex-direction: column; gap: 20px; }
  .run-stat-grid { flex: none; width: 100%; }
}
@media(max-width:760px) {
  .explorer-panel { gap: 18px; }
  .agent-strip { display: grid; grid-template-columns: minmax(0,1fr); gap: 8px; }
  .agent-card { padding: 12px 14px; gap: 8px; grid-template-columns: 1fr 1.2fr; align-items: center; }
  .agent-card-top { font-size: 11px; }
  .agent-card strong { font-size: 12px; }
  .agent-card small { grid-column: 1/-1; -webkit-line-clamp: 1; }
  .workspace-section-title { align-items: start; flex-wrap: wrap; }
  .journal-row {
    grid-template-columns: 59px minmax(0,1fr) 14px;
    grid-template-areas: "time copy arrow" "time category arrow";
    gap: 6px 10px;
    padding: 16px 0;
  }
  .journal-row time { grid-area: time; font-size: .6875rem; }
  .journal-marker { display: none; }
  .journal-copy { grid-area: copy; }
  .journal-category { grid-area: category; text-align: left; padding: 0; }
  .row-arrow { grid-area: arrow; }
  .journal-search { grid-template-columns: minmax(0,1fr); gap: 8px; }
  .journal-search select { width: 100%; min-width: 0; }
  .investigation-grid { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .run-inspector { inset: 0; width: 100%; border-radius: 0; border: 0; }
  .run-inspector-body { padding: 21px; }
  .run-inspector-heading { padding: 17px 20px; }
  .journal-footer { align-items: start; flex-wrap: wrap; }
}
@media(max-width:520px) {
  .run-stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .journal-mode { align-self: start; }
}
@media(pointer:coarse) {
  :is(.filter-chips, .journal-mode) button { min-height: 44px; }
}

/* Knowledge graph canvas */
#explorer-knowledge { padding: 0; }
.graph-feature {
  --graph-line: var(--line);
  --graph-wire: #a5a5a5;
  --graph-ink: var(--text);
  --graph-muted: var(--muted);
  --graph-paper: var(--panel);
  --graph-height: clamp(350px, 65dvh, 800px);
  container: knowledge / inline-size;
  min-width: 0;
  overflow: hidden;
  color-scheme: dark;
  color: var(--graph-ink);
  background: var(--graph-paper);
  scroll-margin-top: 12px;
  min-height: 0;
}
.graph-head, .graph-foot, .graph-actions, .graph-view-tools, .graph-zoom, .graph-source {
  display: flex;
  align-items: center;
}
.graph-head {
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 18px;
  padding: 14px clamp(16px, 2.6cqi, 32px);
  border-bottom: 1px solid var(--graph-line);
  background: var(--graph-paper);
}
.graph-head h2 {
  margin: 0;
  color: var(--graph-ink);
  font: 500 clamp(21px, 2.6cqi, 25px)/1.15 var(--font-display);
  letter-spacing: -.035em;
}
.graph-actions, .graph-view-tools { gap: 8px; }
.graph-actions button, .graph-dismiss {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 36px;
  height: 36px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--control-fill);
  color: var(--text);
  font: 500 13px/1 var(--font);
}
.graph-actions button:hover:enabled, .graph-dismiss:hover { background: var(--elevated); }
.graph-actions svg, .graph-dismiss svg { width: 16px; height: 16px; stroke-width: 1.5; }
.graph-actions button:disabled { color: var(--faint); border-style: dashed; opacity: 1; }
.graph-zoom { border: 1px solid var(--line); border-radius: var(--control-radius); background: var(--control-fill); }
.graph-zoom button { height: 34px; min-width: 32px; padding: 0 6px; border: none; background: transparent; }
#graph-scale { min-width: 47px; color: var(--text); font: 12px var(--mono); }
#graph-fit[aria-pressed="true"] { color: var(--text); background: var(--petrol); border-color: var(--teal); }
#graph-fit[aria-pressed="true"]:hover { border-color: var(--text); }
.graph-feature :focus-visible { outline: 2px solid var(--text); outline-offset: 2px; z-index: 4; }
.graph-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: minmax(0, 1fr);
  height: var(--graph-height);
  background-color: var(--bg);
  background-image: radial-gradient(circle, #292929 .75px, transparent 1px);
  background-size: 16px 16px;
}
.graph-stage:has(#graph-viewport[hidden]) { height: auto; }
#graph-viewport {
  display: flex;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  cursor: grab;
  scrollbar-color: #858585 var(--surface-2);
}
#graph-viewport[data-panning="true"] { cursor: grabbing; user-select: none; }
@supports selector(::-webkit-scrollbar) {
  #graph-viewport { scrollbar-color: auto; }
  #graph-viewport::-webkit-scrollbar { width: 13px; height: 13px; }
  #graph-viewport::-webkit-scrollbar-track, #graph-viewport::-webkit-scrollbar-corner { background: var(--surface-2); }
  #graph-viewport::-webkit-scrollbar-thumb {
    min-width: 32px; min-height: 32px; border: 3px solid var(--surface-2);
    border-radius: var(--control-radius); background: #858585;
  }
  #graph-viewport::-webkit-scrollbar-thumb:hover { background: var(--faint); }
}
#graph-viewport:focus-visible { outline-offset: -3px; }
#graph-sheet { position: relative; flex: none; margin: auto; overflow: clip; }
#graph-world { position: absolute; top: 0; left: 0; transform-origin: top left; }
#graph-world svg { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#graph-world path { fill: none; stroke: var(--graph-wire); stroke-width: 1.4; }
#graph-arrow polygon { fill: var(--graph-wire); }
#graph-arrow-selected polygon { fill: var(--teal); }
#graph-world:has(.graph-node[aria-pressed="true"]) path:not(.highlight) { opacity: .20; }
#graph-world path.highlight { stroke: var(--teal); stroke-width: 2; }
.graph-lane {
  position: absolute;
  z-index: 2;
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--text);
  overflow: hidden;
  white-space: nowrap;
  font: 550 .875em/1.25 var(--font);
  pointer-events: none;
}
.graph-lane::before {
  content: ""; flex: none; width: 14px; height: 2px; background: var(--teal);
}
.graph-lane[data-lane="finding"]::before { background: var(--coral); }
.graph-lane > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.graph-lane-short { display: none; }
#graph-world[data-compact-labels="true"] .graph-lane { transform: translateY(-3px); font-size: .96em; line-height: 1; }
#graph-world[data-compact-labels="true"][data-orientation="columns"] .graph-lane-name { display: none; }
#graph-world[data-compact-labels="true"][data-orientation="columns"] .graph-lane-short { display: inline; }
.graph-node {
  position: absolute;
  z-index: 2;
  display: grid;
  align-content: center;
  gap: 1px;
  width: 184px;
  height: 62px;
  padding: 5px 10px;
  text-align: left;
  border: 1px solid #585858;
  border-radius: var(--radius);
  background: var(--elevated);
  color: var(--graph-ink);
  font-family: var(--font);
  font-size: inherit;
}
.graph-node:hover { border-color: var(--faint); }
.graph-branch {
  position: absolute;
  inset: 4px 7px auto auto;
  color: var(--muted);
  font: 12px/1.2 var(--mono);
}
#graph-world[data-compact-labels="true"] .graph-branch { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .graph-node { animation: graph-node-enter 180ms ease-out; }
  @keyframes graph-node-enter {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
  }
}
.graph-node.neighbour { border-color: var(--teal); }
.graph-node[aria-pressed="true"] { border-color: var(--text); background: var(--petrol); }
.graph-node[data-graph-kind="evidence"] { border-inline-start: 4px solid var(--teal); }
.graph-node[data-graph-kind="finding"] { border-inline-start: 4px solid var(--coral); }
.graph-node small { color: var(--muted); font-size: 12px; font-weight: 500; line-height: 1.1; }
.graph-node strong {
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  hyphens: auto;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: 1em;
  font-weight: 500;
  line-height: 1.17;
}
#graph-world[data-compact-labels="true"] .graph-node { padding: 0 6px; }
#graph-world[data-compact-labels="true"] .graph-node small { display: none; }
#graph-world[data-compact-labels="true"] .graph-node strong { line-height: 1; }
#graph-detail {
  width: clamp(218px, 23cqi, 320px);
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  overflow-wrap: anywhere;
  padding: 18px;
  border-left: 1px solid var(--graph-line);
  background: var(--graph-paper);
  scrollbar-color: var(--faint) var(--graph-paper);
}
.graph-dismiss { float: right; margin: -4px -4px 4px 8px; min-width: 32px; height: 32px; }
#graph-detail small { display: block; color: var(--graph-muted); font: 550 13px/1.4 var(--font); }
#graph-detail strong { display: block; margin: 4px 0 10px; color: var(--graph-ink); font: 500 17px/1.3 var(--font); }
#graph-detail p { color: var(--graph-muted); font-size: 1rem; }
#graph-detail ul { clear: both; list-style: none; margin: 12px 0 0; padding: 0; }
#graph-detail li { border-top: 1px solid var(--graph-line); }
#graph-detail li button { display: block; width: 100%; padding: 8px 0; color: var(--graph-ink); font-size: 14px; text-align: left; overflow-wrap: anywhere; }
#graph-detail li button:hover, .graph-origin:hover { color: var(--graph-ink); text-decoration: underline; }
#graph-detail li span { display: block; color: var(--graph-muted); font-size: 12px; }
.graph-origin { padding: 2px 0; color: var(--graph-ink); text-decoration: underline; font-size: 14px; }
.graph-toggle {
  display: block;
  margin: 8px 0;
  padding: 6px 12px;
  border: 1px solid var(--graph-line);
  border-radius: var(--control-radius);
  background: var(--control-fill);
  color: var(--graph-ink);
  font: 500 13px/1.4 var(--font);
}
.graph-toggle:hover { border-color: var(--teal); }
.graph-foot {
  gap: 5px 16px;
  flex-wrap: wrap;
  min-height: 38px;
  padding: 8px clamp(16px, 2.6cqi, 32px);
  border-top: 1px solid var(--graph-line);
  color: var(--graph-muted);
  font: 12px/1.4 var(--font);
}
.graph-source { gap: 7px; }
.graph-source i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
#graph-run { flex: 1 1 10ch; min-width: 0; overflow: hidden; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
#graph-empty { display: grid; justify-items: center; text-align: center; min-height: 188px; align-content: center; padding: 30px 16px; }
#graph-empty strong { color: var(--graph-ink); font-size: 18px; font-weight: 550; }
#graph-empty p { color: var(--graph-muted); font-size: 1rem; margin: 5px 0 0; }
.graph-reticle { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); margin: 0 0 15px;
  background: radial-gradient(circle, var(--faint) 0 2px, transparent 3px 10px, var(--line) 10.5px 11.5px, transparent 12px), var(--panel); }
.graph-feature [hidden] { display: none; }
#graph-dialog {
  inset: 0;
  width: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: var(--bg);
  animation: none;
}
#graph-dialog .graph-feature { display: grid; height: 100%; grid-template-rows: auto minmax(0, 1fr) auto; }
#graph-dialog .graph-stage { height: auto; min-height: 0; max-height: none; }
@container knowledge (max-width: 660px) {
  .graph-stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  #graph-detail { width: 100%; border-left: 0; border-top: 1px solid var(--graph-line); padding: 12px 16px; }
  .graph-stage:has(#graph-detail:not([hidden])) { grid-template-rows: minmax(0, 1fr) min(36%, 190px); }
  #graph-detail ul { margin-top: 8px; }
  #graph-run { flex-basis: 7ch; }
}
@container knowledge (max-width: 620px) {
  .graph-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 12px; }
  .graph-actions:not([hidden]) { display: contents; }
  #graph-expand { grid-area: 1 / 2; }
  .graph-view-tools { grid-area: 2 / 1 / auto / -1; flex-wrap: wrap; gap: 6px; }
  .graph-foot { gap: 4px 12px; }
}
