/* ===== Designer container ===== */
.wf-designer-container {
    height: clamp(390px, 62vh, 620px);
    min-height: 320px;
    max-height: 90vh;
    resize: vertical;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    background: #fafafa;
    background-image:
        radial-gradient(circle, #d0d0d0 1px, transparent 1px);
    background-size: 24px 24px;
}

@media (max-width: 1440px), (max-height: 850px) {
    .wf-designer-container {
        height: clamp(350px, 55vh, 520px);
    }
}

/* ===== Designer footer ===== */
.wf-designer-footer {
    display: grid;
    margin: 10px 4px 0;
}

.wf-designer-hint {
    line-height: 1.35;
}

/* ===== Legend dialog ===== */
.wf-legend-modal-section {
    background: var(--mud-palette-background-grey);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 10px;
    padding: 12px;
}

.wf-legend-modal-title {
    border-bottom: 1px solid var(--mud-palette-lines-default);
    font-weight: 700;
    margin-bottom: 6px;
    padding-bottom: 8px;
}

.wf-legend-modal-item {
    border-bottom: 1px solid var(--mud-palette-lines-default);
    min-height: 52px;
    padding: 6px 2px;
}

.wf-legend-modal-item:last-child {
    border-bottom: 0;
}

.wf-legend-modal-label {
    font-weight: 700;
}

.wf-legend-phase-card {
    border: 2px solid;
    border-radius: 6px;
    flex: 0 0 38px;
    height: 26px;
    width: 38px;
}

.wf-legend-action-line {
    overflow: visible;
}

/* ===== Phase node card ===== */
.wf-node {
    position: relative;
    background: #ffffff;
    border: 2px solid #bdbdbd;
    border-radius: 8px;
    min-width: 170px;
    max-width: 220px;
    cursor: grab;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    user-select: none;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.wf-node:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.wf-node--selected {
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.4), 0 4px 16px rgba(0, 0, 0, 0.2) !important;
}

.wf-node-order-badge {
    position: absolute;
    top: -9px;
    right: -9px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #ffffff;
    z-index: 11;
    pointer-events: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.wf-node-header {
    padding: 8px 12px;
    border-radius: 6px 6px 0 0;
    font-weight: 700;
    font-size: 13px;
    color: #212121;
    word-break: break-word;
}

.wf-node-body {
    padding: 5px 12px 8px;
    font-size: 11px;
    font-weight: 600;
    color: #757575;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    text-align: center;
}

.wf-node-commission {
    margin-top: 3px;
    font-size: 10px;
    font-weight: 600;
    color: #2e7d32;
    text-transform: none;
    letter-spacing: 0;
}

/* ===== Ports (scoped inside .wf-node which has position:relative) ===== */
.wf-node .diagram-port {
    position: absolute !important;
    width: 14px !important;
    height: 14px !important;
    margin: -7px !important;
    background: #1976d2 !important;
    border: 2px solid #ffffff !important;
    border-radius: 50% !important;
    box-shadow: 0 0 0 1px #1976d2 !important;
    transition: transform 0.15s ease, background 0.15s ease !important;
    cursor: crosshair !important;
    z-index: 10 !important;
}

.wf-node .diagram-port.left {
    left: 0 !important;
    top: 50% !important;
}

.wf-node .diagram-port.right {
    right: 0 !important;
    top: 50% !important;
}

.wf-node .diagram-port:hover {
    background: #0d47a1 !important;
    transform: scale(1.4) !important;
    box-shadow: 0 0 0 2px #0d47a1 !important;
}

/* ===== Color picker (PhaseDialog) ===== */
.wf-color-picker-field input {
    text-align: center !important;
}

.wf-color-swatch {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid rgba(0, 0, 0, 0.18);
    pointer-events: none;
    z-index: 1;
}

/* ===== PhaseDialog scrollable content ===== */
.wf-phase-dialog-content {
    max-height: 70vh;
    overflow-y: auto;
}

/* ===== Link label chip ===== */
.wf-link-chip {
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.18));
}

/* ===== Links / arrows ===== */
.diagram-link path {
    stroke-width: 2px;
}

.diagram-link-label {
    font-size: 11px;
    font-weight: 600;
    fill: #424242;
    paint-order: stroke;
    stroke: #ffffff;
    stroke-width: 3px;
}
