* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
:root {
  font:
    13px/1.45 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #202937;
  background: #f6f7f9;
  font-variant-numeric: tabular-nums;
}
body {
  margin: 0;
}
header,
.bar,
.foot,
.title,
form {
  display: flex;
  align-items: center;
  gap: 10px;
}
header {
  height: 44px;
  background: white;
  border-bottom: 1px solid #d6dde6;
  padding: 0 20px;
}
header strong {
  font-size: 15px;
  letter-spacing: -0.04em;
}
.slash,
small {
  color: #63738a;
}
.spacer {
  flex: 1;
}
main {
  max-width: 1640px;
  margin: auto;
  padding: 14px 18px;
}
.card,
.layout,
.bar,
.diagram,
.evidence {
  background: white;
}
.card {
  margin: 7vh auto;
  padding: 22px;
  max-width: 480px;
  border: 1px solid #d5dce5;
  border-radius: 5px;
}
h1,
h2,
p,
dl {
  margin: 0;
}
h1 {
  font-size: 18px;
  font-weight: 600;
}
h2 {
  font-size: 13px;
  font-weight: 620;
}
.bar {
  min-height: 42px;
  padding: 7px 11px;
  flex-wrap: wrap;
  border: 1px solid #d7dce4;
  border-radius: 4px;
}
button,
select,
input {
  font: inherit;
  color: inherit;
  background: white;
  border: 1px solid #c6ceda;
  border-radius: 4px;
  padding: 4px 8px;
  min-height: 28px;
}
button,
select,
summary {
  cursor: pointer;
}
button:hover,
button[aria-current="true"] {
  background: #edf2fa;
  border-color: #99aac6;
}
.primary {
  background: #354774;
  color: white;
}
.primary:hover:not(:disabled), .primary:focus-visible { background: #29395f; color: #fff; }
.stack {
  display: grid;
  gap: 4px;
}
.card form {
  margin-top: 14px;
  align-items: end;
  flex-wrap: wrap;
}
.card label {
  display: grid;
  flex: 1;
  gap: 4px;
}
label,
dt,
small,
th {
  font-size: 12px;
  color: #4a586d;
}
code,
pre,
#event-value,
#field-type {
  font:
    11px/1.5 ui-monospace,
    SFMono-Regular,
    Consolas,
    monospace;
  overflow-wrap: anywhere;
}
#notice:not(:empty) {
  margin: 5px auto 8px;
  color: #5a4852;
}
.layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  margin-top: 10px;
  border: 1px solid #d7dce4;
  border-radius: 5px;
}
.catalog {
  background: #fafbfc;
  padding: 13px;
  border-right: 1px solid #dde2ea;
}
.catalog h2 {
  margin-bottom: 12px;
}
.catalog nav {
  display: grid;
  gap: 5px;
  margin: 10px 0;
}
.catalog button {
  text-align: left;
}
.catalog input {
  width: 100%;
}
.catalog p,
.evidence > p,
#app-state {
  color: #5a6577;
  font-size: 12px;
}
article {
  padding: 13px;
  min-width: 0;
}
.title {
  justify-content: space-between;
  flex-wrap: wrap;
}
dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 3px 12px;
  margin: 8px 0 12px;
}
dd {
  margin: 0;
}
.diagram,
.evidence {
  border: 1px solid #d7dce4;
  border-radius: 4px;
  overflow: hidden;
}
.diagram > .bar,
.evidence > .bar {
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid #e1e5eb;
  background: #fcfcfd;
}
.stage {
  display: flex;
  height: clamp(210px, 32vh, 405px);
}
.drawing {
  position: relative;
  flex: 1;
  min-width: 0;
  background: #f8f9fb;
}
.drawing canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.drawing p:not(:empty) {
  position: absolute;
  inset: 12px auto auto 16px;
  color: #51627c;
}
.stage aside {
  width: 34%;
  max-width: 420px;
  padding: 10px;
  overflow: auto;
  order: -1;
  border-right: 1px solid #d7dce4;
  background: #fcfcfd;
}
.stage aside code {
  display: block;
}
.foot {
  padding: 6px 10px;
  flex-wrap: wrap;
}
.foot select,
.bar select {
  max-width: 100%;
  min-width: 0;
}
.foot label,
.bar label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
.evidence {
  margin-top: 12px;
}
.evidence p,
.diagram details {
  padding: 6px 10px;
}
.scroll {
  overflow: auto;
  max-height: 240px;
}
table {
  width: 100%;
  text-align: left;
  font-size: 12px;
  border-collapse: collapse;
}
td,
th {
  padding: 5px 9px;
  border-bottom: 1px solid #e3e7ee;
  vertical-align: top;
}
th {
  font-weight: 550;
}
.divergent {
  color: #913f30;
}
.matched {
  color: #236247;
}
:focus-visible {
  outline: 2px solid #516da6;
  outline-offset: 2px;
}
@media (max-width: 780px) {
  main {
    padding: 7px;
  }
  .layout {
    grid-template-columns: 1fr;
  }
  .catalog {
    border-right: 0;
    border-bottom: 1px solid #dde2ea;
  }
  .catalog nav {
    display: flex;
    flex-wrap: wrap;
  }
  .stage {
    height: 235px;
  }
  .title code {
    max-width: 100%;
  }
  .bar,
  .foot {
    gap: 5px;
  }
  .foot label {
    max-width: 100%;
  }
  article {
    padding: 7px;
  }
}

#invocation-link {
  display: inline-block;
  margin: 0 10px 6px;
}

.workspace-panel {
  background: #fff;
  border: 1px solid #d7dce4;
  border-radius: 5px;
  margin-top: 10px;
  padding: 16px;
}
.panel-heading, .panel-tools, .form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-heading { justify-content: space-between; }
.panel-tools { margin: 12px 0; flex-wrap: wrap; }
.panel-tools label { display: flex; align-items: center; gap: 8px; }
.workspace-panel table { width: 100%; }
.workspace-panel td:first-child { font-weight: 550; }
.workspace-panel td:last-child { text-align: right; }
.workspace-panel p:not(:empty), dialog p { margin: 8px 0; }
.setup-panel { max-width: 580px; }
.setup-panel form { display: grid; gap: 12px; margin-top: 14px; }
.form-actions { justify-content: flex-end; }
dialog { width: min(380px, 90vw); color: inherit; padding: 18px; border: 1px solid #bdc8d4; border-radius: 5px; }
dialog::backdrop { background: rgb(24 34 47 / 30%); }
.danger { color: #9a2830; border-color: #bc8085; }
dialog button.danger { background: #9a2830; color: #fff; border-color: #9a2830; }
dialog button.danger:hover { background: #812129; }
#simulation-panel button[aria-busy="true"]::before,
#access-panel[aria-busy="true"] #access-status::before,
#create-project-form:has(#submit-project:disabled) #create-status::before,
#open-branch-form:has(#open-published-branch:disabled) #branch-status::before {
  content: "";
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  margin-right: 0.45em;
  border: 1px solid #aebbc9;
  border-top-color: #324761;
  border-radius: 50%;
  animation: workspace-wait 0.8s linear infinite;
}
@keyframes workspace-wait { to { transform: rotate(1turn); } }
.workspace-panel pre { white-space: pre-wrap; }
@media (max-width: 640px) {
  .workspace-panel { padding: 10px; overflow-x: auto; }
  .setup-panel { max-width: 100%; }
  #directory-table th, #directory-table td { overflow-wrap: anywhere; }
}

.access-columns { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 24px; margin-top: 18px; }
.access-columns > section { min-width: 0; }
.access-columns table { margin: 8px 0; }
.access-form { margin: 15px 0 4px; flex-wrap: wrap; align-items: end; }
.access-form input { max-width: 185px; }
.delegation-dialog { width: min(520px, calc(100% - 32px)); max-height: 85vh; overflow: auto; }
.delegation-dialog .project-rows { margin: 8px 0; }
.delegation-dialog .project-rows li span { overflow-wrap: anywhere; }
.cell-actions { display: flex; justify-content: flex-end; gap: 4px; }
#issued-dialog .form-actions { margin-top: 12px; }
#access-binding { display: block; margin-top: 3px; }
@media (max-width: 920px) { .access-columns { grid-template-columns: 1fr; } }

.gate-help { margin-top: 8px; color: #4a586d; font-size: 12px; }
.directory-group {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #d5dce5;
  border-radius: 4px;
}
.directory-group p:not(:empty) { margin-top: 7px; color: #4a586d; }
.project-rows { list-style: none; padding: 0; margin: 0; }
.project-rows li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  overflow-wrap: anywhere;
}
.project-rows li + li { border-top: 1px solid #e2e7ee; }
.project-rows li span { flex: 1; }
.saved-connections { margin-top: 12px; border-top: 1px solid #e2e7ee; padding-top: 9px; }
.saved-connections h3 { margin: 0 0 6px; font-size: 14px; }
.saved-connections .project-rows li { flex-wrap: wrap; }
.saved-connection-info { flex: 1; min-width: min(180px, 100%); }
.saved-connection-info small { display: block; color: #4a586d; }
.saved-connection-info code { margin-left: 6px; }
.saved-connections .project-rows button.danger { background: #fff; color: #9a2830; border-color: #bc8085; }
.saved-connections .project-rows button.danger:hover { background: #fff3f3; }
.saved-connections details { margin: 8px 0; }
.saved-connections pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.saved-connections dialog:modal { overscroll-behavior: contain; }
.saved-connections dialog::backdrop { overflow: hidden; overscroll-behavior: contain; }
#delegation-manual { margin-top: 12px; }
#connected-heading { margin-top: 12px; }
.account-card .form-actions {
  margin-top: 16px;
  flex-wrap: wrap;
}
.connection-details dd {
  min-width: 0;
  overflow-wrap: anywhere;
}
.account-card [role="status"]:not(:empty) {
  margin-top: 10px;
}
button[aria-busy="true"]::before {
  content: "";
  display: inline-block;
  width: .65em;
  height: .65em;
  margin-right: .45em;
  border: 1px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: account-progress .8s linear infinite;
}
@keyframes account-progress {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  button[aria-busy="true"]::before { animation: none; }
}

.simulation-fields { display: flex; align-items: end; flex-wrap: wrap; gap: 8px; }
#scenario-file { min-width: min(24rem, 75vw); }
#simulation-panel > section, #simulation-debug { border-top: 1px solid #d7dce4; margin-top: 12px; padding-top: 12px; }
#simulation-reference, #simulation-cli { font-family: ui-monospace, monospace; font-size: 11px; }
#simulation-cli { display: block; margin-top: 8px; overflow-wrap: anywhere; }
#simulation-panel table td { text-align: left; }
#simulation-selection pre { max-height: 14rem; overflow: auto; }
#simulation-timeline:not([hidden]) { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; margin: 8px 0 12px; }
#simulation-timeline dt { font-weight: 600; }
#simulation-timeline dd { margin: 0; overflow-wrap: anywhere; }
#timeline-source:not(:empty) { display: block; margin-top: 3px; color: #43536b; font: 11px ui-monospace, monospace; }

#simulation-attempts { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0; }
#simulation-attempts[hidden] { display: none; }
#simulation-attempts a[aria-current] { font-weight: 600; }
#simulation-panel a { color: #324e78; }
#simulation-selection { border-left: 2px solid #aabace; padding: 4px 12px; margin: 12px 0; }
#simulation-selection h3 { font-size: 13px; margin: 0; }
#event-rule-history { margin: 8px 0; }
#event-rule-history-items { list-style: none; margin: 0; padding: 0; }
#event-rule-history-items li { border-top: 1px solid #d7dce4; padding: 7px 0; overflow-wrap: anywhere; }
#event-rule-history-items p { margin: 4px 0; }
#event-rule-history-items nav { display: flex; flex-wrap: wrap; gap: 4px 12px; }
#simulation-panel button:disabled { opacity: .55; }

.event-views, #sequence-causes, #sequence-events { display: flex; flex-wrap: wrap; gap: 5px; }
.event-views { margin-bottom: 8px; }
.event-views [aria-pressed="true"], #sequence-events [aria-current="true"] { background: #e6edf8; border-color: #94a8c6; }
#lineage-region, #inv-process, #sequence-region { border: 1px solid #d7dce4; border-radius: 4px; margin: 8px 0; min-width: 0; }
#lineage-region .bar, #inv-process .bar, #sequence-region .bar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 5px 8px; }
#sequence-coverage, #sequence-render, #sequence-selection { font-size: 11px; color: #43536b; }
#sequence-region p, #sequence-causes, #sequence-region details { margin: 6px 10px; }
#sequence-region details { padding-bottom: 4px; }
#sequence-drawing { height: clamp(260px, 39vh, 370px); }
#sequence-events { margin-top: 6px; }

#inv-process-binding, #inv-process-contract, #inv-process-guard, .invocation-facts { font-size: 12px; }
#inv-process-contract, #inv-process-guard { margin: 6px 10px; overflow-wrap: anywhere; }
#inv-process-links { display: flex; flex-wrap: wrap; gap: 4px; }
#inv-process .foot { flex-wrap: wrap; }
#inv-process-events { max-width: min(70vw, 42ch); }
.invocation-facts { display: grid; grid-template-columns: max-content 1fr; gap: 3px 12px; margin: 8px 10px; }
.invocation-facts dd { margin: 0; overflow-wrap: anywhere; }
#inv-process-source { min-width: 0; font: 11px/1.4 ui-monospace, monospace; }

#lineage-region .bar, #lineage-region .foot { flex-wrap: wrap; }
#lineage-region .foot:empty, #lineage-region .foot:has(#lineage-mismatch:empty) { display: none; }
#lineage-region details, .lineage-selection { margin: 6px 10px; }
#lineage-region select { max-width: min(48vw, 38ch); }
#lineage-region .stage aside { font: 11px/1.4 ui-monospace, monospace; min-width: 0; }
#lineage-rows > div { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin: 3px 0; }
#lineage-rows button, #lineage-selected, #lineage-location { overflow-wrap: anywhere; max-width: 100%; }
#lineage-rows span, #lineage-coverage, #lineage-binding { font-size: 11px; color: #43536b; }
#lineage-location { font: 11px ui-monospace, monospace; }
#lineage-up[aria-pressed="true"], #lineage-down[aria-pressed="true"] { background: #e6edf8; border-color: #94a8c6; }

#lineage-location { display: block; line-height: 1.5; }

.map-stage { display:flex; height:clamp(260px,46vh,425px); }
#map-index { flex:0 0 min(170px,30%); overflow:auto; border-right:1px solid #d7dce4; padding:10px; }
#map-index h2 { margin:0 0 8px; font-size:12px; }
#map-nodes { display:grid; gap:3px; }
#map-nodes button { text-align:left; overflow-wrap:anywhere; }
#map-panel .panel-tools { margin:8px 0; }
#map-panel td { text-align:left; overflow-wrap:anywhere; }
#map-panel td:first-child { font-weight:400; }
#map-panel h3 { font-size:12px; margin:10px 0 4px; }
#map-flow { border-top:1px solid #d7dce4; padding:10px 0; }
#map-contract, #map-callers { font:11px/1.55 ui-monospace,monospace; overflow-wrap:anywhere; }
#map-callers button, #map-contract code { margin-right:8px; }

#map-occurrences:not(:empty) { border-left:2px solid #9aadc6; margin:12px 0 4px; padding:4px 12px; font:12px/1.55 ui-monospace,monospace; }
#map-occurrences button { margin:3px 6px 3px 0; }

#map-source { flex:0 0 min(275px,32%); padding:8px; border-right:1px solid #d7dce4; overflow:auto; min-width:0; }
#map-source code,#map-source pre { white-space:pre; font:11px/1.45 ui-monospace,monospace; }
#map-message-evidence { border-left:2px solid #9aadc6; padding:6px 12px; margin:8px 0; }
#map-message-evidence button { margin:3px 6px 3px 0; }
#map-boundaries { margin-top:10px; }

.security-page { max-width: 840px; margin: 0 auto; }
.security-page .workspace-panel + .workspace-panel { margin-top: 12px; }
.security-page .project-rows li { flex-wrap: wrap; }
.security-page .project-rows li span { overflow-wrap: anywhere; min-width: min(150px, 100%); }
.security-page .project-rows .cell-actions { margin-left: auto; flex-wrap: wrap; }
.security-page details { margin-top: 10px; }

.oversight-page { max-width: 900px; }
.oversight-page > .workspace-panel + .workspace-panel { margin-top: 12px; }
.oversight-page .project-rows li { flex-wrap: wrap; justify-content: space-between; }
.oversight-page .project-rows li > div:first-child { flex: 1; min-width: min(220px, 100%); }
.oversight-page .cell-actions { flex-wrap: wrap; align-items: center; margin-left: auto; gap: 10px; }
.oversight-page .project-rows p { overflow-wrap: anywhere; }
.oversight-page [role="status"]:not(:empty) { margin: 8px 0; }
.audit-access { margin-bottom: 10px; }
