.decision-tree-shell {
    border: 1px solid #dce3e8;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
}

.decision-tree-toolbar {
    min-height: 58px;
    padding: 10px 14px;
    border-bottom: 1px solid #e3e8ec;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    background: #fafbfc;
}

.decision-tree-toolbar > div:first-child {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.decision-tree-toolbar span {
    font-size: 11px;
    color: #7b8791;
}

.decision-tree-toolbar-actions {
    display: flex;
    gap: 5px;
}

.decision-tree-toolbar-actions button {
    border: 1px solid #d3dbe1;
    background: #fff;
    border-radius: 8px;
    min-width: 38px;
    height: 34px;
    font-weight: 750;
    color: #354755;
}

.decision-tree-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    min-height: 660px;
}

.decision-tree-canvas {
    position: relative;
    min-width: 0;
    min-height: 660px;
    background:
        linear-gradient(#eef2f4 1px, transparent 1px),
        linear-gradient(90deg, #eef2f4 1px, transparent 1px),
        #f8fafb;
    background-size: 24px 24px;
    overflow: hidden;
}

.decision-tree-svg {
    display: block;
    width: 100%;
    height: 660px;
    touch-action: none;
    cursor: grab;
    user-select: none;
}

.decision-tree-svg.is-panning {
    cursor: grabbing;
}

.decision-tree-hint {
    position: absolute;
    left: 12px;
    bottom: 10px;
    border: 1px solid #d7dfe5;
    background: rgba(255, 255, 255, .91);
    border-radius: 8px;
    padding: 6px 9px;
    font-size: 10px;
    color: #70808d;
    pointer-events: none;
}

.decision-edge {
    fill: none;
    stroke: #a8b5bf;
    stroke-width: 2;
    opacity: .78;
}

.decision-edge.taken {
    stroke: #157347;
    stroke-width: 3.5;
    opacity: 1;
}

.decision-tree-arrow-head {
    fill: #8696a2;
}

.decision-edge.taken + .decision-edge-label-object + * {
    /* intentionally empty; marker is shared */
}

.decision-edge-label-object {
    pointer-events: none;
    overflow: visible;
}

.decision-edge-label {
    display: inline-block;
    max-width: 184px;
    padding: 3px 6px;
    border: 1px solid #dbe2e7;
    border-radius: 6px;
    background: rgba(255, 255, 255, .94);
    color: #61717e;
    font-size: 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.decision-node {
    cursor: pointer;
}

.decision-node rect {
    fill: #fff;
    stroke: #b8c4cd;
    stroke-width: 1.5;
    filter: drop-shadow(0 2px 4px rgba(20, 32, 43, .09));
}

.decision-node:hover rect {
    stroke: #617a8d;
    stroke-width: 2;
}

.decision-node.visited rect {
    stroke: #62a17a;
}

.decision-node.current rect {
    stroke: #0d6efd;
    stroke-width: 3;
}

.decision-node.selected rect {
    stroke: #17232f;
    stroke-width: 3;
}

.decision-node.unreachable {
    opacity: .48;
}

.decision-node.step-numberquestion rect {
    fill: #fbfdff;
}

.decision-node.step-choicequestion rect {
    fill: #fcfbff;
}

.decision-node.step-action rect {
    fill: #fffdf9;
}

.decision-node.step-end rect {
    fill: #f7faf8;
}

.decision-node-content {
    width: 100%;
    height: 100%;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
    color: #1d2a34;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

.decision-node-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.decision-node-type,
.decision-entry-badge {
    font-size: 9px;
    line-height: 1;
    font-weight: 850;
    letter-spacing: .08em;
}

.decision-node-type {
    color: #6b7985;
}

.decision-entry-badge {
    background: #17232f;
    color: #fff;
    border-radius: 999px;
    padding: 4px 6px;
}

.decision-node-content strong {
    font-size: 13px;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.decision-node-content small {
    color: #89949d;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 9px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.decision-node-question {
    margin-top: 3px;
    color: #586975;
    font-size: 10px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.decision-tree-inspector {
    border-left: 1px solid #e2e7eb;
    background: #fff;
    min-width: 0;
    max-height: 660px;
    overflow: auto;
}

.decision-inspector-empty {
    min-height: 100%;
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    justify-content: center;
    text-align: center;
    color: #798791;
}

.decision-inspector-header {
    padding: 18px;
    border-bottom: 1px solid #e8ecef;
}

.decision-inspector-header h3 {
    margin: 5px 0 4px;
    font-size: 17px;
}

.decision-inspector-header code {
    color: #80909b;
    font-size: 10px;
}

.decision-inspector-section {
    padding: 15px 18px;
    border-bottom: 1px solid #edf0f2;
}

.decision-inspector-section h4 {
    margin: 0 0 10px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: #6c7a85;
}

.decision-inspector-section dl {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 7px 10px;
    margin: 0;
    font-size: 11px;
}

.decision-inspector-section dt {
    color: #8a969f;
}

.decision-inspector-section dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.decision-list-row,
.decision-transition-row {
    border-top: 1px solid #eef1f3;
    padding: 7px 0;
    font-size: 11px;
}

.decision-list-row:first-of-type,
.decision-transition-row:first-of-type {
    border-top: 0;
}

.decision-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.decision-list-row.stacked {
    flex-direction: column;
    align-items: flex-start;
}

.decision-list-row code,
.decision-transition-row code {
    color: #687985;
    font-size: 10px;
    overflow-wrap: anywhere;
}

.decision-transition-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 6px;
    align-items: center;
}

.decision-transition-row strong {
    overflow-wrap: anywhere;
}

.decision-tree-panel {
    margin-top: 20px;
}

@media (max-width: 980px) {
    .decision-tree-workspace {
        grid-template-columns: 1fr;
    }

    .decision-tree-inspector {
        border-left: 0;
        border-top: 1px solid #e2e7eb;
        max-height: none;
    }

    .decision-tree-svg,
    .decision-tree-canvas {
        min-height: 540px;
        height: 540px;
    }
}


.decision-tree-workspace.without-inspector {
    grid-template-columns: minmax(0, 1fr);
}

.decision-node-badges {
    display: flex;
    align-items: center;
    gap: 4px;
}

.decision-invalid-badge {
    background: #b42318;
    color: #fff;
    border-radius: 999px;
    padding: 4px 6px;
    font-size: 8px;
    font-weight: 850;
    letter-spacing: .05em;
}

.decision-node.invalid rect {
    stroke: #c13229;
    stroke-width: 3;
    stroke-dasharray: 7 4;
}

.decision-context-badge {
    margin-top: auto;
    max-width: 100%;
    border-top: 1px solid #e9edf0;
    padding-top: 5px;
    color: #657986;
    font-size: 9px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.decision-context-badge.invalid {
    color: #b42318;
}

.decision-diagnostics {
    background: #fff8f7;
}

.decision-diagnostic {
    display: flex;
    flex-direction: column;
    gap: 3px;
    border-top: 1px solid #f0d7d3;
    padding: 8px 0;
    font-size: 11px;
    color: #7a2e28;
}

.decision-diagnostic:first-of-type {
    border-top: 0;
}
