.debug-panel {
  border: 1px solid #c7d5e7;
  border-radius: 8px;
  background: #f7f9fd;
  margin: 10px 0;
  padding: 12px;
  max-height: 42vh;
  overflow: auto;
  font-size: 12px;
}
.debug-panel[hidden] {
  display: none;
}
.debug-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.debug-toolbar small {
  color: #6b7c94;
}
.debug-toolbar select {
  font-size: 12px;
  width: 100%;
  max-width: 520px;
  margin: 0;
}
.debug-toolbar .button {
  font-size: 11px;
  padding: 6px 9px;
}
.debug-panel .hint {
  font-size: 11px;
  margin: 7px 0;
}
.debug-data {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(240px, 3fr);
  gap: 16px;
}
.debug-data details {
  max-height: 180px;
  overflow: auto;
}
.debug-value {
  font:
    11px Consolas,
    monospace;
  overflow-wrap: anywhere;
  padding: 4px;
}
.debug-table {
  max-height: 220px;
  overflow: auto;
  margin: 8px 0;
}
.debug-table table {
  border-collapse: collapse;
  font-size: 12px;
  width: 100%;
}
.debug-table td,
.debug-table th {
  border: 1px solid #dce4ef;
  padding: 6px 8px;
  text-align: left;
  white-space: pre-wrap;
  max-width: 320px;
  overflow-wrap: anywhere;
}
.debug-table th {
  position: sticky;
  top: 0;
  background: #eaf0f8;
}
.debug-plan {
  background: #edf2f9;
}
.debug-plan:empty {
  display: none;
}
#graph-stage .graph-node.debug-ready {
  outline: 3px solid #409b77;
  outline-offset: 3px;
}
#graph-stage .graph-node.debug-running {
  outline: 3px solid #dfac35;
  outline-offset: 3px;
}
#graph-stage .graph-node.debug-succeeded {
  border-color: #65a58b;
  background: #f6fcf9;
}
#graph-stage .graph-node.debug-failed {
  outline: 3px solid #c44f58;
  outline-offset: 3px;
}
@media (max-width: 900px) {
  .debug-data {
    grid-template-columns: 1fr;
  }
}
.node-preview {
  position: absolute;
  right: 5px;
  top: 5px;
  border: 1px solid #c6d3e5;
  border-radius: 4px;
  background: #fff;
  color: #456292;
  cursor: pointer;
  padding: 2px 5px;
  font-size: 12px;
}
.graph-node .node-handle {
  padding-right: 30px;
}
.data-preview {
  min-width: 0;
}
.preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 6px 0;
}
.preview-toolbar input,
.preview-toolbar select {
  width: auto;
  max-width: 260px;
  margin: 0;
  font-size: 12px;
}
.preview-toolbar .button,
.preview-table-scroll .button {
  font-size: 11px;
  padding: 4px 7px;
}
.preview-table-scroll {
  max-height: 55vh;
  overflow: auto;
}
.preview-table-scroll table {
  border-collapse: collapse;
  font-size: 12px;
  width: 100%;
}
.preview-table-scroll td,
.preview-table-scroll th {
  padding: 6px 8px;
  border: 1px solid #dce4ef;
  max-width: 340px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  text-align: left;
}
.preview-table-scroll th {
  background: #edf2f9;
}
.preview-table-scroll td:has(> .preview-toolbar) {
  background: #f8faff;
  padding: 10px 16px;
}
.preview-raw {
  max-height: 55vh;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #f1f5fa;
  padding: 12px;
  font:
    12px Consolas,
    monospace;
}
.preview-panel {
  border-top: 1px solid #c7d5e7;
  padding: 8px 0;
}
.preview-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.preview-toolbar .button[aria-pressed='true'] {
  background: #405e91;
  color: white;
  border-color: #405e91;
}
.preview-panel:first-child {
  border-top: 0;
  border-bottom: 1px solid #c7d5e7;
  margin-bottom: 10px;
}
.preview-choice {
  padding: 10px;
  background: #edf2f9;
  border-radius: 6px;
}
.preview-panel > .preview-toolbar > select {
  max-width: 700px;
  flex: 1;
}
.node-execute {
  position: absolute;
  right: 32px;
  top: 5px;
  border: 1px solid #c6d3e5;
  border-radius: 4px;
  background: #fff;
  color: #348363;
  cursor: pointer;
  padding: 2px 5px;
  font-size: 12px;
}
#graph-stage .graph-node .node-handle {
  padding-right: 60px;
}

/* Compact debugger: fixed controls, a scoped iteration picker and readable item fields. */
.debug-panel {
  padding: 7px 9px;
  margin: 6px 0;
  max-height: 44vh;
}
.debug-toolbar {
  position: sticky;
  top: -7px;
  z-index: 2;
  background: #f7f9fd;
  padding: 4px 0;
  gap: 4px;
  border-bottom: 1px solid #dce4ef;
}
.debug-toolbar select {
  width: auto;
  min-width: 130px;
  max-width: 270px;
  flex: 1 1 170px;
  padding: 3px 6px;
  min-height: 28px;
}
.debug-toolbar .button {
  padding: 4px 7px;
  min-height: 28px;
}
.debug-toolbar small {
  font-size: 10px;
}
.debug-panel .error-text:empty {
  display: none;
}
.debug-data {
  gap: 8px;
  grid-template-columns: minmax(160px, 1fr) minmax(200px, 2fr);
  margin-top: 5px;
}
.debug-items {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.debug-item {
  border: 1px solid #dce4ef;
  border-radius: 5px;
  padding: 4px 7px;
  background: #fff;
  overflow: auto;
  max-height: 190px;
}
.debug-item summary {
  font-weight: 600;
  cursor: pointer;
}
.debug-item table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.debug-item td,
.debug-item th {
  padding: 2px 6px;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
  border-bottom: 1px solid #edf2f9;
}
.debug-item th {
  width: 25%;
  font-weight: 500;
  color: #536680;
}
.debug-iteration-steps {
  margin: 6px 0;
  display: grid;
  gap: 2px;
}
.debug-iteration-step {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) 120px 75px auto;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  border-bottom: 1px solid #e2e8f1;
}
.debug-iteration-step .button {
  font-size: 11px;
  padding: 3px 7px;
}
.debug-iteration-step small {
  color: #64748b;
}
.debug-panel .preview-toolbar {
  margin: 4px 0;
  gap: 4px;
}
.debug-panel .preview-panel {
  padding: 5px 0;
}
.debug-panel .preview-table-scroll {
  max-height: 28vh;
}
.preview-table-scroll td,
.preview-table-scroll th {
  padding: 4px 6px;
}
.preview-table-scroll th .button {
  padding: 2px 4px;
}
@media (max-width: 700px) {
  .debug-data {
    grid-template-columns: 1fr;
  }
  .debug-iteration-step {
    grid-template-columns: minmax(90px, 1fr) 95px auto;
  }
  .debug-iteration-step > small:nth-child(3) {
    display: none;
  }
}
