.workflow-builder-shell {
    position: relative;
    min-height: calc(100vh - 140px);
    display: flex;
    overflow: hidden;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.workflow-builder-grid {
    position: absolute;
    inset: 0;
    opacity: 0.4;
    background-color: #f8fafc;
    background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
    background-size: 24px 24px;
    z-index: 0;
}

.workflow-canvas {
    position: relative;
    z-index: 1;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 16px 36px;
}

.workflow-start {
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0.75;
    margin-bottom: 8px;
}

.workflow-start-circle {
    width: 48px;
    height: 48px;
    border-radius: 999px;
    background: #e2e8f0;
    border: 2px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
}

.workflow-start-label {
    margin-top: 8px;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.workflow-start-line {
    position: relative;
    width: 2px;
    height: 36px;
    background: #cbd5e1;
    margin-top: 8px;
}

.workflow-start-line::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: -3px;
    width: 8px;
    height: 8px;
    border-bottom: 2px solid #cbd5e1;
    border-left: 2px solid #cbd5e1;
    transform: rotate(-45deg);
}

.wf-steps-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wf-step-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 4px;
}

.wf-step-card {
    position: relative;
    width: 320px;
    min-height: 98px;
    border: 2px solid #e2e8f0;
    border-radius: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px 14px 18px;
    background: #ffffff;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.10);
    cursor: pointer;
    transition: all .2s ease;
}

.wf-step-card:hover {
    border-color: #a5b4fc;
    transform: translateX(-3px);
}

.wf-step-card.selected {
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.16), 0 10px 28px rgba(15, 23, 42, 0.12);
    transform: scale(1.02);
}

.wf-step-index {
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: #475569;
    color: #fff;
    border: 2px solid #fff;
    font-size: 11px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wf-step-logo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.wf-step-logo img {
    max-height: 34px;
    max-width: 100%;
    object-fit: contain;
}

.wf-step-body {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.wf-step-title {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wf-step-sub {
    margin-top: 6px;
    font-size: 11px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wf-step-llm {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 999px;
    border: 1px solid #e9d5ff;
    background: #faf5ff;
    color: #7e22ce;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.wf-step-hint {
    margin-top: 6px;
    font-size: 10px;
    font-weight: 700;
    color: #4f46e5;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.wf-step-connector {
    width: 2px;
    height: 58px;
    background: #cbd5e1;
    margin-top: 8px;
    position: relative;
}

.wf-step-connector::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: -3px;
    width: 8px;
    height: 8px;
    border-bottom: 2px solid #cbd5e1;
    border-left: 2px solid #cbd5e1;
    transform: rotate(-45deg);
}

.wf-step-end {
    margin-top: 8px;
    width: 2px;
    height: 56px;
    border-left: 2px dashed #cbd5e1;
    position: relative;
}

.wf-step-end-label {
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    background: #f8fafc;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 10px;
    color: #94a3b8;
}

.wf-add-container {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.wf-add-btn {
    width: 48px;
    height: 48px;
    border-radius: 999px;
    border: 2px dashed #cbd5e1;
    color: #64748b;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s ease;
}

.wf-add-btn:hover:not(:disabled) {
    color: #4f46e5;
    border-color: #818cf8;
    background: #eef2ff;
}

.wf-add-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.wf-add-label {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 600;
}

.wf-icon-centered {
    margin-right: 0 !important;
    width: auto !important;
}

.workflow-drawer {
    position: relative;
    z-index: 2;
    width: 390px;
    background: #fff;
    border-left: 1px solid #e2e8f0;
    box-shadow: -10px 0 24px rgba(15, 23, 42, 0.08);
    display: flex;
    flex-direction: column;
}

.workflow-drawer-head {
    padding: 18px 20px;
    border-bottom: 1px solid #f1f5f9;
    background: #f8fafc;
}

.workflow-drawer-title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.workflow-drawer-sub {
    margin: 2px 0 0;
    font-size: 13px;
    color: #64748b;
}

.workflow-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px 20px;
}

.workflow-section-title {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    color: #4f46e5;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.wf-reorder-btn {
    background: none;
    border: none;
    padding: 0 4px;
    color: #4f46e5;
    cursor: pointer;
    line-height: 1;
}

.wf-reorder-btn:disabled {
    color: #c7c4f5;
    cursor: default;
}

.workflow-block {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
}

.workflow-drawer-foot {
    border-top: 1px solid #e2e8f0;
    padding: 14px 20px;
    background: #f8fafc;
}

.workflow-delete-btn {
    width: 100%;
}

.workflow-create-btn {
    width: 100%;
}

@media (max-width: 1100px) {
    .workflow-builder-shell {
        flex-direction: column;
    }

    .workflow-drawer {
        width: 100%;
        border-left: none;
        border-top: 1px solid #e2e8f0;
        box-shadow: none;
    }

    .wf-step-card {
        width: min(92vw, 360px);
    }
}
