.blueprint-dialog .graph-workspace {
  grid-template-columns: minmax(0, 1fr) clamp(312px, 29vw, 420px);
  border-color: #d8e0ec;
}
.blueprint-dialog .graph-tools {
  padding: 6px 0;
}
.blueprint-dialog .canvas-view {
  background-color: #eef2f8;
  background-image: radial-gradient(circle, #b9c7d9 1px, transparent 1.4px);
}
.blueprint-dialog .graph-node {
  width: 242px;
  padding: 0;
  border: 1px solid #c9d6e6;
  border-radius: 10px;
  box-shadow:
    0 7px 18px #24395819,
    0 2px 3px #24395813;
  color: #293c59;
  background: #fff;
}
.blueprint-dialog .graph-node.selected,
.blueprint-dialog .graph-node.armed {
  outline: 2px solid #497bbd;
  outline-offset: 2px;
}
.blueprint-dialog .graph-node[data-output="text"] {
  --node-accent: #4c6faa;
  --node-tint: #e9effb;
}
.blueprint-dialog .graph-node[data-output="image"] {
  --node-accent: #2e8371;
  --node-tint: #e0f4ed;
}
.blueprint-dialog .graph-node[data-output="video"] {
  --node-accent: #7c62ab;
  --node-tint: #eee8fc;
}
.blueprint-dialog .graph-node[data-output="gif"] {
  --node-accent: #976228;
  --node-tint: #f8ecd9;
}
.blueprint-dialog .graph-node[data-output="audio"] {
  --node-accent: #946554;
  --node-tint: #f7eae4;
}

.blueprint-node-head {
  display: flex;
  height: 53px;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #e3e9f2;
  padding: 8px 12px;
  background: linear-gradient(128deg, #fff, var(--node-tint, #f5f8fa));
  border-radius: 9px 9px 0 0;
}
.blueprint-node-head > div {
  min-width: 0;
}
.blueprint-node-head .blueprint-node-icon {
  width: 28px;
  height: 28px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--node-accent, #355c80);
  background: var(--node-tint, #eff5fb);
  border: 1px solid color-mix(in srgb, var(--node-accent, #355c80) 20%, #fff);
}
.blueprint-node-head small {
  color: #647790;
  letter-spacing: 0;
}
.blueprint-node-head strong {
  font-size: 13px;
}
.blueprint-node-model {
  display: grid;
  height: 38px;
  align-content: center;
  gap: 2px;
  padding: 3px 12px;
  border-bottom: 1px solid #e1e7f1;
  background: #f4f7fc;
}
.blueprint-node-model > span,
.blueprint-port-row small,
.blueprint-output-row small {
  color: #5a6e8a;
}
.blueprint-node-model code,
.blueprint-node-footer code {
  color: #5a6e8a;
  font:
    10px/1.3 Consolas,
    monospace;
  overflow: hidden;
  text-overflow: ellipsis;
}
.blueprint-port-row,
.blueprint-output-row {
  position: relative;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  height: 36px;
  padding: 3px 12px;
  border-bottom: 1px solid #edf1f7;
}
.blueprint-port-row > span,
.blueprint-output-row > span {
  color: #364d70;
  font-weight: 600;
}
.blueprint-output-row {
  height: 34px;
  background: #f6f9fd;
  justify-items: start;
}
.blueprint-node-footer {
  display: flex;
  height: 23px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-radius: 0 0 9px 9px;
  padding: 0 12px;
  color: #5f728e;
  font-size: 10px;
  background: #f6f9fd;
}
.blueprint-dialog .port {
  top: 11px;
  border-color: #8096b8;
}
.blueprint-dialog .port.in.connected {
  background: #e1e9f7;
  border-color: #567cac;
}
.blueprint-dialog .port.out {
  border-color: var(--node-accent, #2e8371);
}
.blueprint-dialog .port:hover {
  background: #c6dbea;
}

.blueprint-dialog .wires path {
  pointer-events: stroke;
  cursor: pointer;
  stroke: #8498b7;
}
.blueprint-dialog .wires path.active {
  stroke: #527caf;
}
.blueprint-dialog .wires path.order-wire {
  stroke: #9a86b6;
  stroke-dasharray: 6 5;
}
.blueprint-dialog .wires path.draft-wire {
  pointer-events: none;
  stroke: #3975b6;
  stroke-dasharray: 4 4;
}
.blueprint-dialog .wires path.selected-wire,
.blueprint-dialog .wires path:focus-visible {
  stroke: #2865c3;
  stroke-width: 3;
}
.blueprint-dialog .wire-label {
  fill: #45618a;
  paint-order: stroke;
  stroke: #eef2f8;
  stroke-width: 4px;
  font: 10px system-ui;
  pointer-events: none;
}
.blueprint-dialog .blueprint-inspector {
  padding: 0;
  gap: 0;
  overflow: hidden;
  border-color: #d8e0ec;
  background: #f9fbfe;
}
.blueprint-tabs {
  display: flex;
  flex: none;
  gap: 14px;
  padding: 0 14px;
  border-bottom: 1px solid #dbe3f0;
  background: #f8fafd;
}
.studio .blueprint-tab {
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #516784;
  font-weight: 600;
  padding: 12px 0 8px;
}
.studio .blueprint-tab[aria-selected="true"] {
  border-bottom-color: #3d70ba;
  color: #245eab;
}
.blueprint-attributes,
.blueprint-chat {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.blueprint-attributes,
.blueprint-model-params {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.blueprint-attributes {
  padding: 14px;
}
.blueprint-dialog .blueprint-attributes h4 {
  border-top: 1px solid #e2e8f0;
  padding-top: 10px;
  margin-top: 4px;
  color: #3e5577;
}
.blueprint-dialog .source-note {
  margin: 0;
  color: #556f91;
}
.blueprint-chat > div {
  min-height: 100%;
}
.blueprint-advanced {
  font-size: 12px;
  color: #3e5577;
}
.blueprint-advanced > summary {
  cursor: pointer;
  margin-bottom: 4px;
}
.reference-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.reference-card {
  background: #fff;
  border: 1px solid #dce5f0;
  border-radius: 7px;
  padding: 7px;
}
.reference-index {
  background: #eaf1fb;
  color: #345f9b;
  border-radius: 4px;
  padding: 3px 5px;
}
.reference-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.reference-controls button {
  white-space: nowrap;
}

.flow-tabs {
  margin: 0 0 8px;
  overflow-x: auto;
  align-items: center;
  gap: 18px;
}
.flow-tabs > button {
  flex: none;
  white-space: nowrap;
}
.studio .workflow-add-stage {
  margin: 4px 0 4px auto;
  color: #345f9b;
  padding: 5px 9px;
}
.workflow-changes {
  flex: none;
  max-height: 96px;
  overflow: auto;
  padding: 6px 10px;
  background: #fff6dd;
  border: 1px solid #dfc477;
  border-radius: 6px;
}
.workflow-changes > div { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.blueprint-dialog .graph-workspace.with-library {
  grid-template-columns: clamp(150px, 15vw, 220px) minmax(0, 1fr) clamp(275px, 24vw, 365px);
}
.blueprint-dialog .graph-tools label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.blueprint-dialog .graph-tools label input {
  width: 10em;
}
.workflow-library {
  min-width: 0;
  overflow: auto;
  padding: 13px 10px;
  border-right: 1px solid #d8e0ec;
  background: #f9fbfe;
}
.workflow-library h3,
.workflow-overview h3 {
  margin: 0 0 5px;
}
.workflow-library > small,
.workflow-stage-card > small {
  color: #556982;
}
.workflow-library h4 {
  margin: 15px 0 5px;
  color: #354e70;
}
.studio .workflow-source {
  display: grid;
  width: 100%;
  margin: 5px 0;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: grab;
}
.workflow-source small {
  color: #5c728a;
}
.workflow-overview {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid #d8e0ec;
  border-radius: 9px;
  padding: 19px;
  background: #f4f7fb;
}
.workflow-track {
  display: flex;
  align-items: flex-start;
  gap: 34px;
  margin: 18px 0;
  padding: 0;
  list-style: none;
}
.workflow-stage-card {
  position: relative;
  flex: 0 0 clamp(220px, 19vw, 310px);
  padding: 14px;
  border: 1px solid #c9d6e6;
  border-top: 3px solid #538277;
  border-radius: 9px;
  background: #fff;
}
.workflow-stage-card:first-child { border-top-color: #987545; }
.workflow-stage-card:last-child { border-top-color: #526fa0; }
.workflow-stage-card + .workflow-stage-card::before {
  content: "→";
  position: absolute;
  top: 21px;
  left: -27px;
  color: #7286a2;
  font-size: 19px;
}
.workflow-stage-card h4 {
  margin: 3px 0 8px;
  overflow-wrap: anywhere;
}
.workflow-stage-card p {
  margin: 8px 0;
}
.workflow-port-count { font-weight: 600; }
.workflow-stage-inputs,
.workflow-port small {
  font-size: 12px;
  color: #526780;
  overflow-wrap: anywhere;
}
.workflow-port {
  display: grid;
  gap: 3px;
  padding: 8px 0;
  border-top: 1px solid #e1e7ef;
  overflow-wrap: anywhere;
}
.workflow-port > div,
.workflow-stage-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.workflow-port span {
  padding: 1px 5px;
  border-radius: 4px;
  background: #edf3fa;
  color: #3f628a;
  font-size: 12px;
}
.workflow-stage-actions { margin-top: 14px; }
@media (max-width: 950px) {
  .blueprint-dialog .graph-workspace.with-library {
    grid-template-columns: minmax(125px, 18%) minmax(0, 1fr) minmax(215px, 26%);
  }
}
@media (max-width: 700px) {
  .blueprint-dialog .graph-workspace.with-library {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(90px, 150px) 320px minmax(310px, 65dvh);
  }
  .workflow-library { border-right: 0; border-bottom: 1px solid #d8e0ec; }
  .workflow-source { max-width: 240px; }
  .workflow-track { flex-direction: column; }
  .workflow-stage-card { width: 100%; flex-basis: auto; }
  .workflow-stage-card + .workflow-stage-card::before { content: "↓"; top: -31px; left: 19px; }
}
.analysis-workspace {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 20px;
  border: 1px solid #d8e0ec;
  border-radius: 9px;
  background: #f9fbfe;
}
.analysis-workspace > label,
.analysis-details {
  max-width: 760px;
}
.analysis-details {
  display: grid;
  gap: 12px;
  margin: 14px 0;
}
.analysis-port-note {
  display: grid;
  grid-template-columns: minmax(90px, max-content) auto;
  gap: 12px;
  align-items: center;
  padding: 9px 11px;
  border: 1px solid #dbe3f0;
  border-radius: 7px;
  background: #fff;
}
.analysis-port-note p {
  margin: 0;
}
.blueprint-dialog .graph-node.internal .blueprint-node-head {
  border-top: 2px solid #7565a5;
}
.template-binding-section {
  display: grid;
  gap: 12px;
  padding: 12px 0 0;
  border-top: 1px solid var(--line);
  min-width: 0;
}
.template-binding-section .section-head {
  margin: 0;
}
.template-binding-section .section-head h3 {
  margin: 0;
}
.binding-tabs {
  gap: 18px;
  overflow: auto;
}
.binding-tabs button {
  flex: none;
  white-space: nowrap;
}
.analysis-actions {
  display: grid;
  gap: 8px;
  align-content: start;
}
.analysis-result {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}
.analysis-overlay {
  position: relative;
  width: fit-content;
  max-width: 100%;
}
.analysis-overlay img,
.analysis-video {
  display: block;
  max-width: 100%;
  max-height: 420px;
  width: auto;
  height: auto;
  border-radius: 6px;
}
.analysis-candidates {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.studio button.analysis-marker {
  position: absolute;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 2px solid #e8dd72;
  background: #17191556;
  color: #fff;
  overflow: hidden;
}
.studio button.analysis-marker[aria-pressed="true"] {
  border-color: #68e1a9;
  background: #06492d78;
}
.studio .analysis-candidates button[aria-pressed="true"] {
  background: #e1f4e9;
  border-color: #42966c;
  color: #24583d;
}
.analysis-choice-order:not(:empty) {
  display: inline-grid;
  place-items: center;
  min-width: 1.25rem;
  height: 1.25rem;
  margin-inline-start: 0.4rem;
  padding-inline: 0.2rem;
  border-radius: 1rem;
  background: #24583d;
  color: #fff;
  font-size: 0.75rem;
}
.analysis-confirm {
  align-items: center;
}

@media (max-width: 700px) {
  .blueprint-dialog .graph-workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 320px minmax(310px, 65dvh);
    min-height: 630px;
  }
  .blueprint-dialog .blueprint-inspector {
    max-height: none;
  }
}
