/* Canvas-first editor: the same Living canvas fills the dialog, one slim panel sits beside it. */
.next-human-editor {color:var(--ui-next-ink); background:var(--ui-next-canvas); border:1px solid var(--ui-next-line); border-radius:12px; width:calc(100vw - 32px); height:calc(100dvh - 32px); max-width:none; max-height:none; padding:0; box-sizing:border-box; overflow:hidden; user-select:none; -webkit-user-select:none;}
.next-human-editor[open] {display:flex; flex-direction:column;}
.next-human-editor::backdrop {background:rgb(0 0 0 / 45%);}
.next-human-editor [hidden] {display:none !important;}
.next-human-editor :is(input,textarea) {user-select:text; -webkit-user-select:text;}
.next-human-editor :is(h2,h3,h4,p) {margin:0;}
.next-human-editor button,.next-human-menu>summary {color:inherit; background:var(--ui-next-surface); border:1px solid var(--ui-next-line); border-radius:6px; padding:7px 12px; font:inherit; font-size:13px; line-height:1.2; cursor:pointer;}
.next-human-editor button:hover:not(:disabled),.next-human-menu>summary:hover {background:var(--ui-next-hover);}
.next-human-editor button:focus-visible,.next-human-menu>summary:focus-visible,.next-human-editor :is(input,textarea,select):focus-visible {outline:2px solid var(--ui-next-focus); outline-offset:1px;}
.next-human-editor button:disabled {opacity:.5; cursor:default;}
.next-human-editor button.is-primary {background:var(--ui-next-accent); border-color:var(--ui-next-accent); color:var(--ui-next-on-accent); font-weight:600;}
.next-human-editor button.is-primary:hover:not(:disabled) {background:color-mix(in srgb,var(--ui-next-accent) 88%,var(--ui-next-ink));}
.next-human-editor button.is-danger {color:var(--ui-next-danger); border-color:color-mix(in srgb,var(--ui-next-danger) 45%,var(--ui-next-line));}
.next-human-head {display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; padding:12px 16px; border-bottom:1px solid var(--ui-next-line); background:var(--ui-next-surface);}
.next-human-title {display:grid; gap:2px; min-width:0;}
.next-human-title h2 {font-size:16px;}
.next-human-title p {font-size:12px; color:var(--ui-next-muted); overflow-wrap:anywhere;}
.next-human-head-actions {display:flex; align-items:center; gap:8px; margin-left:auto;}
.next-human-menu {position:relative;}
.next-human-menu>summary {list-style:none; padding:7px 10px;}
.next-human-menu>summary::-webkit-details-marker {display:none;}
.next-human-menu>div {position:absolute; left:0; top:calc(100% + 4px); z-index:2; padding:4px; background:var(--ui-next-surface); border:1px solid var(--ui-next-line); border-radius:8px; box-shadow:0 8px 24px rgb(0 0 0 / 18%);}
.next-human-menu>div button {border:0; white-space:nowrap; width:100%; text-align:left;}
.next-human-alert {display:flex; align-items:center; gap:12px; flex-wrap:wrap; padding:10px 16px; color:var(--ui-next-danger); background:var(--ui-next-danger-bg); border-bottom:1px solid var(--ui-next-line); font-size:13px;}
.next-human-alert p {flex:1; min-width:0; overflow-wrap:anywhere;}
.next-human-body {flex:1; min-height:0; display:grid; grid-template-columns:minmax(0,1fr) 360px;}
.next-human-canvas {position:relative; display:flex; flex-direction:column; min-width:0; min-height:0; border-right:1px solid var(--ui-next-line);}
.next-human-toolbar {display:flex; align-items:center; gap:8px; flex-wrap:wrap; padding:8px 12px; border-bottom:1px solid var(--ui-next-line); background:var(--ui-next-surface);}
.next-human-canvas-hint {font-size:12px; color:var(--ui-next-muted);}
.next-human-editor .next-human-graph {flex:1; min-height:0; overflow:hidden;}
.next-human-graph svg {display:block; width:100%; height:100%; touch-action:none;}
.next-human-graph>.next-human-hint {padding:24px;}
.next-human-panel {min-width:0; min-height:0; overflow:auto; padding:16px; display:grid; align-content:start; gap:16px; background:var(--ui-next-surface);}
.next-human-panel h3 {font-size:15px; overflow-wrap:anywhere;}
.next-human-panel h4 {font-size:13px; color:var(--ui-next-muted); font-weight:600;}
.next-human-panel form,.next-human-changes,.next-human-connections {display:grid; gap:12px; min-width:0;}
.next-human-panel label {display:grid; gap:6px; font-size:13px; color:var(--ui-next-muted);}
.next-human-panel label:has(input[type=checkbox]) {display:flex; align-items:center; gap:8px; color:var(--ui-next-ink);}
.next-human-panel :is(input:not([type=checkbox]),textarea,select) {color:var(--ui-next-ink); background:var(--ui-next-canvas); box-sizing:border-box; width:100%; min-width:0; padding:8px 10px; border:1px solid var(--ui-next-line); border-radius:6px; font:inherit; font-size:14px;}
.next-human-panel textarea {resize:vertical;}
.next-human-form-actions {display:flex; gap:8px; flex-wrap:wrap;}
.next-human-form-actions .is-danger {margin-left:auto;}
.next-human-panel :is(ol,ul) {list-style:none; margin:0; padding:0; display:grid; gap:6px;}
.next-human-panel li {display:flex; align-items:center; gap:10px; padding:8px 10px; border:1px solid var(--ui-next-line-soft); border-radius:8px; font-size:13px;}
.next-human-panel li>span {flex:1; min-width:0; display:grid; gap:2px; overflow-wrap:anywhere;}
.next-human-panel li small {font-size:12px; color:var(--ui-next-muted);}
.next-human-panel li button {flex:none; padding:5px 10px;}
.next-human-panel li.is-invalid,.next-human-error {border-left:3px solid var(--ui-next-danger);}
.next-human-errors {display:grid; gap:10px;}
.next-human-errors:empty {display:none;}
.next-human-error {display:grid; gap:10px; padding:10px 12px; border-radius:8px; background:var(--ui-next-danger-bg); font-size:13px;}
.next-human-hint {font-size:13px; color:var(--ui-next-muted); line-height:1.5;}
.next-human-connections>button,.next-human-done {justify-self:start;}
@media (max-width:760px) {
  .next-human-editor {width:100vw; height:100dvh; border:0; border-radius:0;}
  .next-human-head {padding:10px 12px;}
  .next-human-head-actions {width:100%; justify-content:flex-end;}
  .next-human-body {display:flex; flex-direction:column;}
  .next-human-canvas {flex:1 1 0; min-height:30dvh; border-right:0; border-bottom:1px solid var(--ui-next-line);}
  .next-human-panel {flex:0 1 auto; min-height:0; max-height:50dvh; padding:12px;}
  .next-human-canvas-hint {display:none;}
}
.next-human-zoom {position:absolute; right:12px; bottom:12px; z-index:3; display:flex; gap:2px; padding:3px; background:var(--ui-next-surface); border:1px solid var(--ui-next-line); border-radius:8px; box-shadow:0 3px 16px rgb(0 0 0 / 14%);}
.next-human-editor .next-human-zoom button {min-width:36px; min-height:36px; padding:0 10px; border:0;}
.next-human-stale {position:absolute; top:10px; left:50%; translate:-50% 0; z-index:2; max-width:calc(100% - 24px); padding:6px 12px; border-radius:999px; border:1px solid color-mix(in srgb,var(--ui-next-danger) 40%,transparent); background:var(--ui-next-danger-bg); color:var(--ui-next-danger); font-size:12px; text-align:center;}
.next-human-graph :is([data-graph-entity="node"],[data-graph-entity="group"])[data-top-root] {cursor:grab;}
.next-human-graph .is-moving-area, .next-human-graph .is-moving-area * {cursor:grabbing;}
/* Matches the selected card's highlighted lines, which otherwise stay at full strength. */
[data-archbro-ui="next"] .next-human-graph .is-moving-area .is-area-drag-hidden {opacity:.15;}
.next-human-graph .is-rerouting :is(.next-graph-junction,.next-graph-junction-hit) {display:none;}
.next-human-graph .next-area-guides {pointer-events:none;}
.next-human-graph .next-area-guides line {stroke:var(--ui-next-accent, #7c5cff); stroke-width:1.5; stroke-dasharray:6 4;}
/* The same forms, edited on the Living canvas's own Details panel. */
[data-archbro-ui="next"] .next-draft-editor.next-human-panel {padding:0; background:none; gap:14px;}
[data-archbro-ui="next"] .next-draft-editor button {color:inherit; background:var(--ui-next-surface); border:1px solid var(--ui-next-line); border-radius:6px; padding:7px 12px; font:inherit; font-size:13px; line-height:1.2; cursor:pointer;}
[data-archbro-ui="next"] .next-draft-editor button:hover:not(:disabled) {background:var(--ui-next-hover);}
[data-archbro-ui="next"] .next-draft-editor button:focus-visible,[data-archbro-ui="next"] .next-draft-editor :is(input,textarea,select):focus-visible {outline:2px solid var(--ui-next-focus); outline-offset:1px;}
[data-archbro-ui="next"] .next-draft-editor button:disabled {opacity:.5; cursor:default;}
[data-archbro-ui="next"] .next-draft-editor button.is-primary {background:var(--ui-next-accent); border-color:var(--ui-next-accent); color:var(--ui-next-on-accent); font-weight:600;}
[data-archbro-ui="next"] .next-draft-editor button.is-danger {color:var(--ui-next-danger); border-color:color-mix(in srgb,var(--ui-next-danger) 45%,var(--ui-next-line));}
[data-archbro-ui="next"] .next-draft-editor-tools {display:flex; flex-wrap:wrap; gap:6px;}
[data-archbro-ui="next"] .next-draft-editor-error {margin:0; padding:8px 10px; border-radius:8px; background:var(--ui-next-danger-bg); color:var(--ui-next-danger); font-size:13px;}
