.pd-shell {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 110px);
    min-height: 620px;
    margin: 12px 16px 16px;
    color: #28323b;
    background: #fff;
    border: 1px solid #dce2e5;
    border-radius: 6px;
    overflow: hidden;
}

.pd-header, .pd-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid #e2e7e9;
    flex: 0 0 auto;
}

.pd-header { min-height: 68px; justify-content: space-between; }
.pd-heading { min-width: 0; }
.pd-heading h1 { margin: 0; font-size: 19px; font-weight: 600; line-height: 1.3; }
.pd-heading p { margin: 2px 0 0; font-size: 12px; color: #69757d; }
.pd-header-actions, .pd-toolbar-group { display: flex; align-items: center; gap: 4px; }
.pd-header-actions { flex-wrap: wrap; justify-content: flex-end; }
.pd-toolbar { min-height: 58px; justify-content: space-between; gap: 16px; }
.pd-toolbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.pd-process-picker { width: min(340px, 100%); min-width: 180px; }
.pd-dirty { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #d57b28; margin-right: 5px; }
.pd-status { color: #66737c; font-size: 12px; white-space: nowrap; }
.pd-toolbar-divider { width: 1px; height: 22px; margin: 0 6px; background: #dce2e5; }
.pd-workspace { display: grid; grid-template-columns: 170px minmax(0, 1fr) 290px; min-height: 0; flex: 1; }

.pd-palette, .pd-inspector { overflow: auto; background: #fff; }
.pd-palette { padding: 16px 10px; border-right: 1px solid #e2e7e9; }
.pd-inspector { padding: 17px 16px 24px; border-left: 1px solid #e2e7e9; }
.pd-side-heading { margin: 0 0 14px; font-size: 12px; font-weight: 700; color: #66737c; text-transform: uppercase; }
.pd-palette .mud-button-root { justify-content: flex-start; width: 100%; margin-bottom: 5px; text-align: left; }
.pd-inspector h2 { margin: 0 0 16px; font-size: 16px; font-weight: 600; }
.pd-inspector-meta { margin: 16px 0; padding-top: 14px; border-top: 1px solid #e8ecee; font-size: 12px; color: #69757d; }
.pd-inspector-meta > div { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.pd-inspector-meta strong { color: #34414a; font-weight: 500; overflow-wrap: anywhere; text-align: right; }
.pd-inspector .mud-input-control { margin-bottom: 11px; }
.pd-ruleset { margin-top: 14px; padding-top: 12px; border-top: 1px solid #e8ecee; }
.pd-ruleset-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 600; }
.pd-ruleset table { width: 100%; table-layout: fixed; }
.pd-ruleset th { width: 43%; font-weight: 500; }
.pd-ruleset td { overflow-wrap: anywhere; }
.pd-ruleset th, .pd-ruleset td { padding: 5px 2px; font-size: 12px; vertical-align: top; }
.pd-inspector-empty { color: #6e7a82; font-size: 13px; }
.pd-inspector-actions { margin-top: 18px; }
.pd-bundle-summary { margin: -8px 0 10px; color: #176e66; font-size: 13px; font-weight: 600; }
.pd-bundle-list { border-top: 1px solid #e8ecee; }
.pd-bundle-item { display: flex; align-items: flex-start; gap: 6px; padding: 10px 0; border-bottom: 1px solid #e8ecee; }
.pd-bundle-item-text { display: flex; flex: 1; flex-direction: column; gap: 3px; min-width: 0; }
.pd-bundle-item-text strong { color: #34414a; font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.pd-bundle-item-text span { color: #69757d; font-size: 11px; line-height: 1.35; overflow-wrap: anywhere; }
.pd-bundle-item .mud-icon-button { flex: 0 0 auto; }
.pd-route-actions { display: flex; align-items: center; gap: 8px; margin: 4px 0 12px; }
.pd-validation { margin-top: 19px; padding-top: 15px; border-top: 1px solid #e8ecee; }
.pd-validation h3 { margin: 0 0 8px; font-size: 13px; font-weight: 600; }
.pd-validation ul { padding-left: 18px; margin: 0; color: #9a4c30; font-size: 12px; line-height: 1.45; }

.pd-rules-dialog .mud-dialog-content { padding: 0; }
.pd-rules-layout { display: grid; grid-template-columns: clamp(270px, 30%, 360px) minmax(0, 1fr); min-height: 360px; max-height: min(70vh, 720px); }
.pd-rules-list { display: flex; flex-direction: column; gap: 3px; overflow: auto; padding: 12px; border-right: 1px solid #e2e7e9; }
.pd-rule-item { display: flex; justify-content: space-between; gap: 8px; width: 100%; padding: 9px 10px; border: 0; border-radius: 4px; background: transparent; color: #34414a; text-align: left; cursor: pointer; }
.pd-rule-item:hover, .pd-rule-item.is-active { background: #e8f2f0; color: #176e66; }
.pd-rule-item span { overflow-wrap: anywhere; }
.pd-rule-item small { color: #79858b; white-space: nowrap; }
.pd-rule-editor { min-width: 0; overflow: auto; padding: 18px 20px; }
.pd-rule-section-head { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 8px; border-bottom: 1px solid #e6ebed; }
.pd-rule-section-head h3 { margin: 0; padding-bottom: 7px; font-size: 14px; font-weight: 600; }
.pd-rule-note { margin: 12px 0; color: #6e7a82; font-size: 13px; }
.pd-success-editor { max-height: min(70vh, 720px); overflow: auto; padding: 18px 22px; }
.pd-success-destination { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.pd-rule-context { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; font-size: 14px; }
.pd-rule-context span { color: #637179; }
.pd-assignee-row, .pd-return-row { display: grid; gap: 8px; align-items: center; margin: 6px 0; }
.pd-assignee-row { grid-template-columns: minmax(140px, 1fr) minmax(150px, 1.4fr) 32px 32px; }
.pd-return-row { grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) 32px; }

.pd-canvas-wrap { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #f5f7f7; }
.pd-canvas {
    width: 100%;
    height: 100%;
    min-height: 420px;
    outline: none;
    cursor: grab;
    touch-action: none;
    background-image: radial-gradient(#d3dcdf 0.8px, transparent 0.8px);
    background-size: 20px 20px;
}
.pd-canvas:active { cursor: grabbing; }
.pd-stage { position: absolute; width: 6000px; height: 4000px; transform-origin: 0 0; }
.pd-edges, .pd-nodes { position: absolute; inset: 0; width: 6000px; height: 4000px; }
.pd-edges { overflow: visible; }
.pd-nodes { pointer-events: none; }

.pd-node {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 220px;
    height: 78px;
    padding: 9px 11px;
    border: 1px solid #cdd6d8;
    border-left: 4px solid #548d86;
    border-radius: 5px;
    background: #fff;
    box-shadow: 0 1px 3px #24333b16;
    pointer-events: auto;
    cursor: move;
    user-select: none;
}
.pd-node.is-selected { border-color: #277f77; box-shadow: 0 0 0 2px #277f7730, 0 2px 7px #24333b1c; }
.pd-node--start { border-left-color: #399365; }
.pd-node--user { border-left-color: #4784a2; }
.pd-node--action { border-left-color: #b56d36; }
.pd-node--decision { border-left-color: #a28436; }
.pd-node--external { border-left-color: #6f7595; }
.pd-node--end { border-left-color: #b26066; }
.pd-node-icon { display: grid; place-items: center; flex: 0 0 35px; width: 35px; height: 35px; border-radius: 5px; color: #395f5c; background: #e9f2ef; }
.pd-node--user .pd-node-icon { color: #376f8b; background: #e9f1f5; }
.pd-node--action .pd-node-icon { color: #a15f2d; background: #f8efe7; }
.pd-node--decision .pd-node-icon { color: #90732d; background: #f6f1df; }
.pd-node--external .pd-node-icon { color: #555f8c; background: #eceef5; }
.pd-node--end .pd-node-icon { color: #a44e54; background: #f7ebec; }
.pd-node-icon svg { width: 22px; height: 22px; }
.pd-node-content { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.pd-node-type { margin-bottom: 3px; color: #718089; font-size: 10px; line-height: 1.2; text-transform: uppercase; }
.pd-node-title { color: #2c383f; font-size: 13px; font-weight: 600; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.pd-port { position: absolute; width: 16px; height: 16px; border: 3px solid #fff; border-radius: 50%; background: #83939a; box-shadow: 0 0 0 1px #b5c3c7; opacity: 0; cursor: crosshair; transition: opacity 120ms; }
.pd-port--left { left: -10px; top: calc(50% - 8px); }
.pd-port--right { right: -10px; top: calc(50% - 8px); }
.pd-port--top { top: -10px; left: calc(50% - 8px); }
.pd-port--bottom { bottom: -10px; left: calc(50% - 8px); }
.pd-node:hover .pd-port, .pd-node.is-selected .pd-port, .pd-canvas.is-connecting .pd-port { opacity: 1; }
.pd-port:hover { background: #277f77; box-shadow: 0 0 0 2px #277f7730; }

.pd-edge-line { fill: none; stroke: #829096; stroke-width: 2; stroke-linejoin: round; }
.pd-edge--structural .pd-edge-line { stroke: #89979d; stroke-width: 1.7; }
.pd-edge--rule .pd-edge-line { stroke: #257e73; stroke-width: 2.3; }
.pd-edge--unassigned .pd-edge-line { stroke: #aa7d42; stroke-dasharray: 5 4; }
.pd-edge--return .pd-edge-line { stroke: #c6814d; stroke-dasharray: 6 5; }
.pd-edge.is-selected .pd-edge-line { stroke: #237e75; stroke-width: 3; }
.pd-edge--structural.is-selected .pd-edge-line { stroke: #5e747d; stroke-width: 2.7; }
.pd-edge--bundle .pd-edge-line { stroke-width: 2.5; }
.pd-edge--bundle .pd-edge-hit { cursor: pointer; }
.pd-edge-hit { fill: none; stroke: transparent; stroke-width: 16; cursor: pointer; }
.pd-edge-hit--horizontal { cursor: ns-resize; }
.pd-edge-hit--vertical { cursor: ew-resize; }
.pd-edge-label-bg { fill: #fff; stroke: #d8e0e2; stroke-width: 1; pointer-events: auto; cursor: pointer; }
.pd-edge-label { fill: #45545e; font-size: 11px; dominant-baseline: middle; pointer-events: auto; cursor: pointer; }
.pd-edge-preview { fill: none; stroke: #277f77; stroke-width: 2; stroke-dasharray: 5 4; pointer-events: none; }
.pd-route-handle { fill: #fff; stroke: #277f77; stroke-width: 2; cursor: move; }
.pd-endpoint-handle { fill: #277f77; stroke: #fff; stroke-width: 2; cursor: crosshair; }
.pd-canvas-footer { position: absolute; left: 12px; bottom: 10px; display: flex; gap: 9px; color: #65747c; font-size: 11px; pointer-events: none; }
.pd-canvas-footer span { padding: 3px 6px; background: #ffffffdc; border: 1px solid #e1e7e8; border-radius: 3px; }

@media (max-width: 1000px) {
    .pd-workspace { grid-template-columns: 132px minmax(0, 1fr) 250px; }
    .pd-palette { padding: 13px 6px; }
    .pd-inspector { padding: 14px 10px; }
}

@media (max-width: 760px) {
    .pd-shell { height: auto; min-height: 0; margin: 8px; }
    .pd-header, .pd-toolbar { flex-wrap: wrap; }
    .pd-header-actions { justify-content: flex-start; }
    .pd-workspace { display: flex; flex-direction: column; }
    .pd-palette { display: flex; align-items: center; gap: 6px; overflow-x: auto; border-right: 0; border-bottom: 1px solid #e2e7e9; }
    .pd-palette .pd-side-heading { margin: 0 8px 0 0; white-space: nowrap; }
    .pd-palette .mud-button-root { width: auto; flex: 0 0 auto; margin-bottom: 0; }
    .pd-canvas-wrap { height: 480px; flex: 0 0 auto; }
    .pd-inspector { border-left: 0; border-top: 1px solid #e2e7e9; min-height: 190px; }
    .pd-rules-layout { display: block; max-height: 75vh; overflow: auto; }
    .pd-rules-list { max-height: 145px; border-right: 0; border-bottom: 1px solid #e2e7e9; }
    .pd-success-destination { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .pd-assignee-row { grid-template-columns: minmax(0, 1fr) 32px 32px; }
    .pd-assignee-row > :first-child { grid-column: 1 / -1; }
}
