.dt-active-tree {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
  margin-right: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

/* Main layout: chart + editor (editor always visible) */
.dt-layout {
  display: grid;
  grid-template-columns: 1fr minmax(400px, 40%);
  gap: 16px;
  min-height: 680px;
}
.dt-layout.dt-chart-expanded {
  grid-template-columns: 1fr minmax(360px, 32%);
}
.dt-layout.dt-chart-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bone);
  grid-template-columns: 1fr minmax(380px, 34%) !important;
  padding: 12px 16px;
  margin: 0;
  max-height: 100vh;
  overflow: hidden;
}
.dt-layout.dt-chart-fullscreen .dt-canvas-wrap {
  min-height: calc(100vh - 130px);
  max-height: calc(100vh - 130px);
}
.dt-layout.dt-chart-fullscreen .dt-side-panel {
  max-height: calc(100vh - 40px);
}

@media (max-width: 1100px) {
  .dt-layout { grid-template-columns: 1fr; }
  .dt-side-panel { max-height: none; }
}

/* Tree drawer (open on demand) */
.dt-tree-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 16, 0.55);
  z-index: 210;
}
.dt-tree-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(360px, 92vw);
  z-index: 220;
  background: var(--bone);
  border-right: 1px solid var(--ink-5);
  box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dt-tree-drawer[hidden],
.dt-tree-drawer-backdrop[hidden] {
  display: none !important;
}
.dt-tree-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.dt-tree-menu-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--paper-2);
}
.dt-tree-drawer-new { width: 100%; }
.dt-tree-menu-list {
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1;
  overflow-y: auto;
}
.dt-tree-empty {
  padding: 12px 4px;
  font-size: 14px;
  line-height: 1.5;
}
.dt-tree-item {
  display: flex;
  gap: 6px;
  align-items: stretch;
  margin-bottom: 8px;
  border-radius: var(--r-3);
  border: 1px solid transparent;
}
.dt-tree-item.dt-active {
  border-color: var(--seal);
  background: var(--seal-tint);
}
.dt-tree-pick {
  flex: 1;
  display: block;
  text-align: left;
  padding: 10px 10px;
  background: transparent;
  border: none;
  border-radius: var(--r-3);
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.dt-tree-pick:hover { background: var(--ink-6); }
.dt-tree-name {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: var(--paper);
  line-height: 1.3;
}
.dt-tree-meta {
  display: block;
  font-size: 11px;
  margin-top: 4px;
  line-height: 1.35;
}
.dt-tree-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
}
.dt-tree-actions .btn { padding: 4px 8px; font-size: 11px; min-width: 44px; }

.dt-surface-filter {
  display: inline-flex;
  gap: 4px;
  margin-right: 8px;
  padding-right: 8px;
  border-right: 1px solid var(--ink-5);
}
.dt-surface-chip.on {
  background: color-mix(in srgb, var(--seal) 18%, transparent);
  color: var(--seal);
}
.dt-tree-section {
  list-style: none;
  padding: 10px 12px 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-3);
}
.dt-surface-tag {
  color: var(--seal);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

/* Public entry routes panel */
.dt-routes-panel {
  margin: 0 0 14px;
  padding: 0;
  border: 1px solid var(--ink-5);
  border-radius: var(--r-3);
  background: color-mix(in srgb, var(--ink) 4%, transparent);
}
.dt-routes-summary {
  cursor: pointer;
  padding: 10px 14px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--paper-2);
  list-style: none;
}
.dt-routes-summary::-webkit-details-marker { display: none; }
.dt-routes-body {
  padding: 0 14px 14px;
  border-top: 1px solid var(--ink-5);
}
.dt-routes-lead {
  font-size: 12px;
  line-height: 1.5;
  margin: 12px 0;
}
.dt-routes-group { margin-top: 14px; }
.dt-routes-group-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--paper);
}
.dt-routes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.dt-routes-table th,
.dt-routes-table td {
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--ink-5);
}
.dt-routes-table th {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--ink-3);
}
.dt-route-hash,
.dt-route-path {
  font-family: var(--font-mono);
  font-size: 11px;
  word-break: break-all;
}
.dt-route-note { font-size: 11px; max-width: 220px; }
.dt-route-actions {
  white-space: nowrap;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.dt-route-actions .btn { padding: 3px 8px; font-size: 11px; }
.dt-route-active { background: color-mix(in srgb, var(--seal) 10%, transparent); }
.dt-routes-active {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.5;
}
.dt-routes-active a { color: var(--seal); }
.dt-route-chip {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  background: color-mix(in srgb, var(--seal) 12%, transparent);
  color: var(--seal);
  word-break: break-all;
}

/* Chart panel */
.dt-chart-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.dt-canvas-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}
.dt-zoom-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
  min-width: 3.5rem;
  text-align: center;
}

.dt-canvas-wrap {
  background: var(--bone-2);
  border: 1px solid var(--ink-5);
  border-radius: var(--r-4);
  overflow: auto;
  flex: 1;
  min-height: 72vh;
  max-height: 82vh;
  position: relative;
}
.dt-canvas-placeholder { padding: 24px; }
.dt-canvas-inner {
  display: inline-block;
  min-width: min-content;
  padding: 16px;
}
.dt-canvas-wrap svg.dt-svg {
  display: block;
  width: auto;
  height: auto;
  max-width: none;
  user-select: none;
  touch-action: none;
}
.dt-fs-exit {
  position: sticky;
  top: 8px;
  float: right;
  z-index: 5;
  margin: 8px 8px 0 0;
}

.dt-node { cursor: pointer; outline: none; }
.dt-node:focus-visible .dt-shape {
  stroke: var(--seal-2);
  stroke-width: 4px;
}
.dt-node .dt-hit { cursor: pointer; }
.dt-node .dt-shape {
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.28));
  transition: filter 0.12s ease, stroke-width 0.12s ease;
}
.dt-node:hover .dt-shape {
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.38)) brightness(1.06);
}
.dt-node.dt-selected .dt-shape {
  stroke-width: 5px !important;
  filter: drop-shadow(0 0 0 2px var(--seal-2)) drop-shadow(0 4px 14px rgba(0, 0, 0, 0.4));
}

.dt-node .dt-label,
.dt-node .dt-prompt-line,
.dt-node .dt-role-badge {
  fill: #FAF8F3;
  pointer-events: none;
  paint-order: stroke fill;
  stroke: rgba(10, 10, 18, 0.6);
  stroke-width: 4px;
}
.dt-node.dt-node--light .dt-label,
.dt-node.dt-node--light .dt-prompt-line,
.dt-node.dt-node--light .dt-role-badge,
.dt-node .dt-text-dark {
  fill: #0F1820;
  stroke: rgba(250, 248, 243, 0.7);
}
.dt-node .dt-label {
  font-family: var(--font-body);
  font-size: 28px;
  font-weight: 700;
}
.dt-node .dt-prompt-line {
  font-family: var(--font-body);
  font-size: 21px;
  font-weight: 500;
}
.dt-node .dt-role-badge {
  font-family: var(--font-mono);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.dt-edge path { stroke: #8FA3B1; fill: none; stroke-width: 3px; }
.dt-edge text {
  fill: #E8E4DC;
  font-size: 15px;
  font-family: var(--font-mono);
  font-weight: 600;
  paint-order: stroke fill;
  stroke: rgba(10, 10, 18, 0.5);
  stroke-width: 3px;
}
.dt-arrow-fill { fill: #8FA3B1; }

/* Editor side panel — always on screen */
.dt-side-panel {
  background: var(--bone);
  border: 1px solid var(--ink-5);
  border-radius: var(--r-4);
  padding: 16px 18px;
  overflow-y: auto;
  max-height: 82vh;
  min-width: 0;
}

.dt-process-overview {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--ink-5);
}
.dt-process-lead {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.5;
}
.dt-process-h {
  margin: 14px 0 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--seal);
  display: block;
}
.dt-meta-input,
.dt-meta-ta {
  width: 100%;
  background: var(--bone-2);
  border: 1px solid var(--ink-5);
  color: var(--paper);
  border-radius: var(--r-3);
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
}
.dt-meta-ta { resize: vertical; min-height: 80px; }

.dt-node-fields { padding-top: 4px; }
.dt-editor-hint { margin: 0 0 12px; font-size: 14px; padding: 8px 0; }
.dt-editor-head { margin: 0 0 12px; font-family: var(--font-display); font-size: 18px; color: var(--paper-2); }
.dt-editor-head code { font-size: 14px; color: var(--seal); }

.dt-node-fields label,
.dt-llm-panel label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  margin: 12px 0 4px;
  text-transform: uppercase;
  letter-spacing: .6px;
}
.dt-node-fields input,
.dt-node-fields textarea,
.dt-node-fields select,
.dt-llm-ta {
  width: 100%;
  background: var(--bone-2);
  border: 1px solid var(--ink-5);
  color: var(--paper);
  border-radius: var(--r-3);
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
}
.dt-node-fields textarea { min-height: 80px; resize: vertical; }
.dt-llm-ta { font-family: var(--font-mono); font-size: 12px; min-height: 140px; }

.dt-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.dt-br-row { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.dt-br-row span { color: var(--ink-3); font-size: 13px; }
.dt-tag { font-family: var(--font-mono); font-size: 10px; background: var(--sage-2); color: var(--ink); padding: 3px 8px; border-radius: 4px; margin-left: 6px; }
.dt-verified { color: var(--sage-2); font-weight: 600; }
#dt-verify-badge { font-size: 12px; margin-bottom: 12px; line-height: 1.5; }
#dt-verify-badge code { font-size: 10px; word-break: break-all; }

.dt-llm-panel { margin-top: 16px; padding: 14px 16px; background: var(--bone-2); border: 1px solid var(--ink-5); border-radius: var(--r-4); }
.dt-llm-panel summary { cursor: pointer; font-weight: 600; color: var(--paper-2); margin-bottom: 8px; }
.dt-llm-help { font-size: 13px; line-height: 1.55; margin: 0 0 14px; white-space: pre-wrap; }

.dt-modal {
  border: 1px solid var(--ink-5);
  border-radius: var(--r-4);
  padding: 0;
  max-width: 440px;
  width: calc(100% - 32px);
  background: var(--bone);
  color: var(--paper);
}
.dt-modal::backdrop { background: rgba(6, 8, 16, 0.72); }
.dt-modal-form { padding: 20px 22px; }
.dt-modal-title { margin: 0 0 16px; font-family: var(--font-display); font-size: 20px; color: var(--paper-2); }
.dt-modal-form label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  margin: 12px 0 4px;
  text-transform: uppercase;
  letter-spacing: .6px;
}
.dt-modal-form input,
.dt-modal-form select {
  width: 100%;
  background: var(--bone-2);
  border: 1px solid var(--ink-5);
  color: var(--paper);
  border-radius: var(--r-3);
  padding: 10px 12px;
  font-size: 14px;
}
.dt-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.verifier-modal { max-width: 440px; }
