/* =====================================================
   Pipeline editor — outsend
   Layout : sidebar(220) | canvas(flex) | config(320, slide)
   ===================================================== */

.pipeline-shell {
    display: grid;
    grid-template-columns: 220px 1fr auto;
    height: calc(100vh - 60px); /* moins le header */
    overflow: hidden;
    background: var(--bg);
}

/* ---------- Sidebar (gauche) ---------- */

.pipeline-sidebar {
    border-right: 1px solid var(--border);
    background: var(--bg-soft);
    padding: 16px 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pipeline-sidebar-title {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: 4px;
    padding: 0 4px;
}

.pipeline-block-template {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, transform 0.05s;
    text-align: left;
    color: var(--ink);
    font-family: inherit;
    font-size: 13px;
}
.pipeline-block-template:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
}
.pipeline-block-template:active {
    transform: scale(0.98);
}
.pipeline-block-icon {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}
.pipeline-block-tlabel {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.pipeline-sidebar-hint {
    margin-top: 16px;
    padding: 12px;
    background: var(--bg);
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-md);
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--ink-muted);
}
.pipeline-sidebar-hint strong {
    color: var(--ink);
    font-weight: 600;
    display: block;
    margin-bottom: 6px;
}
.pipeline-sidebar-hint ol {
    margin: 0;
    padding-left: 18px;
}
.pipeline-sidebar-hint li {
    margin-bottom: 4px;
}
.port-icon {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid var(--accent);
    background: var(--bg);
    vertical-align: middle;
    margin: 0 2px;
}
.port-icon.out {
    background: var(--accent);
}

/* ---------- Canvas (centre) ---------- */

.pipeline-canvas-wrap {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
}

.pipeline-toolbar {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-soft);
}
.pipeline-name-input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    font-family: inherit;
    font-size: 14px;
    color: var(--ink);
    outline: none;
    transition: border-color 0.15s;
}
.pipeline-name-input:focus {
    border-color: var(--accent);
}
.pipeline-toolbar-actions {
    display: flex;
    gap: 8px;
}

.pipeline-canvas {
    flex: 1;
    position: relative;
    overflow: auto;
    /* grille pointillée subtile */
    background-image:
        radial-gradient(circle, var(--ink-faint) 1px, transparent 1px);
    background-size: 24px 24px;
    background-color: var(--bg);
    user-select: none;
}
.pipeline-canvas.is-edge-dragging,
.pipeline-canvas.is-edge-dragging *,
.pipeline-canvas.is-arming,
.pipeline-canvas.is-arming * {
    cursor: crosshair !important;
    user-select: none;
}

/* Hint visuel quand on est en mode "armé" : highlight subtil du canvas */
.pipeline-canvas.is-arming {
    background-color: color-mix(in srgb, var(--accent-soft, #DEEDED) 35%, var(--bg));
}

.pipeline-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    color: var(--ink-muted);
    text-align: center;
    padding: 0 24px;
}

/* Banner d'instruction qui apparaît en haut du canvas quand un port output
   est armé. Indique clairement à l'user qu'il faut cliquer un input port. */
.pipeline-arming-hint {
    position: sticky;
    top: 12px;
    left: 12px;
    right: 12px;
    z-index: 50;
    background: var(--accent, #0D5D5C);
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    pointer-events: none;
    animation: pipeline-arming-slide-in 180ms ease-out;
    margin: 12px auto 0;
    max-width: 720px;
    width: fit-content;
}
.pipeline-arming-hint .text-xs {
    color: rgba(255, 255, 255, 0.8);
}
@keyframes pipeline-arming-slide-in {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.pipeline-empty-icon {
    font-size: 64px;
    opacity: 0.25;
    margin-bottom: 12px;
}
.pipeline-empty-text {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--ink);
}
.pipeline-empty-sub {
    font-size: 13px;
    max-width: 420px;
}

/* ---------- Edges (SVG layer) ---------- */

.pipeline-edges {
    position: absolute;
    inset: 0;
    pointer-events: none;
    color: var(--ink-faint);
}
.pipeline-edge {
    /* SVG group container — pointer-events activé sur les <path> enfants */
    pointer-events: none;
    cursor: pointer;
}
.pipeline-edge-path {
    stroke: var(--ink-faint);
    stroke-width: 2;
    pointer-events: stroke;
    transition: stroke 0.15s, stroke-width 0.15s;
}
.pipeline-edge-hit {
    /* Path invisible 16px de large → zone de clic généreuse pour supprimer */
    pointer-events: stroke;
    cursor: pointer;
}
.pipeline-edge:hover .pipeline-edge-path {
    stroke: var(--danger);
    stroke-width: 3.5;
}
.pipeline-edge-path.pending {
    stroke: var(--accent);
    stroke-width: 2.5;
    stroke-dasharray: 6 4;
    animation: pipeline-edge-flow 0.6s linear infinite;
}
@keyframes pipeline-edge-flow {
    to { stroke-dashoffset: -10; }
}

/* ---------- Block (node) ---------- */

.pipeline-node {
    position: absolute;
    width: 220px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.06);
    transition: box-shadow 0.15s, border-color 0.15s, transform 0.05s;
    z-index: 2;
}
.pipeline-node:hover {
    box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 6px 18px rgba(0,0,0,0.10);
}
.pipeline-node.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft), 0 6px 18px rgba(0,0,0,0.10);
    z-index: 3;
}
.pipeline-node.invalid {
    border-color: var(--danger);
}
.pipeline-node.is-target {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 6px rgba(48, 138, 116, 0.1);
    animation: pipeline-target-pulse 1s ease-in-out infinite;
}
@keyframes pipeline-target-pulse {
    50% { box-shadow: 0 0 0 5px var(--accent-soft), 0 0 0 10px rgba(48, 138, 116, 0.08); }
}

.pipeline-node-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border);
    border-top-left-radius: var(--r-lg);
    border-top-right-radius: var(--r-lg);
    font-size: 13px;
    font-weight: 600;
    cursor: grab;
}
.pipeline-node-header:active {
    cursor: grabbing;
}
/* Couleur de l'header par type de bloc — léger code couleur */
.pipeline-node-header.type-scrap     { background: rgba(48, 138, 116, 0.08); }
.pipeline-node-header.type-reviews   { background: rgba(180, 130, 60, 0.08); }
.pipeline-node-header.type-emails    { background: rgba(110, 100, 200, 0.08); }
.pipeline-node-header.type-verify    { background: rgba(60, 160, 110, 0.10); }
.pipeline-node-header.type-socials   { background: rgba(220, 100, 140, 0.08); }
.pipeline-node-header.type-dead_check{ background: rgba(180, 60, 60, 0.08); }
.pipeline-node-header.type-techstack { background: rgba(80, 100, 130, 0.08); }
.pipeline-node-header.type-import    { background: rgba(48, 138, 116, 0.08); }
.pipeline-node-header.type-filter    { background: rgba(180, 150, 60, 0.10); }
.pipeline-node-header.type-sort      { background: rgba(150, 100, 200, 0.08); }

.pipeline-node-icon {
    font-size: 16px;
    line-height: 1;
}
.pipeline-node-title {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.pipeline-node-close {
    width: 18px;
    height: 18px;
    border: none;
    background: transparent;
    color: var(--ink-muted);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.pipeline-node-close:hover {
    background: var(--danger);
    color: #fff;
}

.pipeline-node-body {
    padding: 12px 12px 14px;
    min-height: 50px;
    cursor: pointer;
}
.pipeline-node-summary {
    font-size: 12px;
    color: var(--ink-muted);
    line-height: 1.4;
    font-family: var(--font-mono);
}
.pipeline-node.invalid .pipeline-node-summary {
    color: var(--danger);
}

/* ---------- Ports ---------- */

.pipeline-port {
    position: absolute;
    width: 18px;
    height: 18px;
    background: var(--bg);
    border: 2.5px solid var(--ink-muted);
    border-radius: 50%;
    cursor: pointer;
    top: 50%;
    transform: translateY(-50%);
    transition: background 0.12s, border-color 0.12s, transform 0.08s, box-shadow 0.15s, width 0.1s, height 0.1s;
    z-index: 4;
}
.pipeline-port::after {
    /* Zone de hit invisible plus large pour capturer le drop facilement.
       18px d'expansion = doigt-friendly et tolère un drop approximatif sans
       interférer avec les ports voisins (les nodes ont min 110px de hauteur). */
    content: "";
    position: absolute;
    inset: -18px;
    border-radius: 50%;
}
.pipeline-port:hover {
    border-color: var(--accent);
    background: var(--accent);
    box-shadow: 0 0 0 5px var(--accent-soft);
    transform: translateY(-50%) scale(1.15);
}
.pipeline-port-in {
    left: -10px;
}
.pipeline-port-out {
    right: -10px;
}
.pipeline-port-out.pending {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 0 5px var(--accent-soft);
    animation: pipeline-port-pulse 1s ease-in-out infinite;
}

/* Pendant un drag d'edge, les inputs compatibles se mettent en évidence
   et les inputs incompatibles deviennent visiblement bloqués. */
.pipeline-port-in.is-compatible {
    border-color: var(--accent);
    background: var(--accent);
    box-shadow: 0 0 0 6px var(--accent-soft);
    animation: pipeline-port-pulse 1s ease-in-out infinite;
}
.pipeline-port-in.is-incompatible {
    border-color: var(--danger);
    background: var(--bg);
    cursor: not-allowed;
    opacity: 0.55;
}
.pipeline-port-in.is-incompatible::before {
    /* Croix rouge pour indiquer "interdit" */
    content: "";
    position: absolute;
    width: 14px;
    height: 2px;
    background: var(--danger);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    border-radius: 1px;
    z-index: 1;
}
/* Signal visuel "ça va remplacer la connexion existante" : compat ET déjà
   connecté → pulsé orange/warning au lieu du vert standard. */
.pipeline-port-in.is-will-replace {
    border-color: #d4a017;
    background: #d4a017;
    box-shadow: 0 0 0 6px rgba(212, 160, 23, 0.18);
    animation: pipeline-port-pulse-warn 1s ease-in-out infinite;
}
@keyframes pipeline-port-pulse-warn {
    50% { box-shadow: 0 0 0 9px rgba(212, 160, 23, 0.10); }
}

@keyframes pipeline-port-pulse {
    50% { box-shadow: 0 0 0 8px rgba(48, 138, 116, 0.18); }
}

/* ---------- Config panel (droite, slide-in) ---------- */

.pipeline-config {
    width: 340px;
    border-left: 1px solid var(--border);
    background: var(--bg-soft);
    overflow-y: auto;
    animation: pipeline-config-slide 0.18s ease-out;
}
@keyframes pipeline-config-slide {
    from { transform: translateX(20px); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

.pipeline-config-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--border);
    gap: 8px;
}
.pipeline-config-eyebrow {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: 4px;
}
.pipeline-config-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
}
.pipeline-config-close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--ink-muted);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.pipeline-config-close:hover {
    background: var(--bg);
    color: var(--ink);
}
.pipeline-config-body {
    padding: 14px 16px 24px;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .pipeline-shell {
        grid-template-columns: 180px 1fr;
    }
    .pipeline-config {
        position: fixed;
        right: 0;
        top: 60px;
        bottom: 0;
        width: 320px;
        z-index: 50;
        box-shadow: -8px 0 24px rgba(0,0,0,0.1);
    }
}

/* ---- Mobile : sidebar = drawer offcanvas, config = bottom sheet ---- */
@media (max-width: 720px) {
    .pipeline-shell {
        display: block;
        height: auto;
        min-height: calc(100vh - 60px);
    }

    /* Bouton hamburger pour ouvrir la sidebar */
    .pipeline-mobile-toggle {
        display: inline-flex !important;
    }

    /* Sidebar : offcanvas drawer depuis la gauche */
    .pipeline-sidebar {
        position: fixed;
        top: 60px;
        bottom: 0;
        left: 0;
        width: 260px;
        max-width: 80vw;
        z-index: 60;
        transform: translateX(-100%);
        transition: transform 0.22s ease-out;
        overflow-y: auto;
        box-shadow: 8px 0 24px rgba(0,0,0,0.15);
    }
    .pipeline-shell.sidebar-open .pipeline-sidebar {
        transform: translateX(0);
    }
    .pipeline-shell.sidebar-open::before {
        content: "";
        position: fixed;
        inset: 60px 0 0 0;
        background: rgba(0,0,0,0.4);
        z-index: 55;
    }

    /* Canvas : prend toute la largeur */
    .pipeline-canvas-wrap {
        width: 100%;
        min-height: calc(100vh - 60px);
    }

    .pipeline-toolbar {
        padding: 10px 12px;
        gap: 8px;
        flex-wrap: wrap;
    }
    .pipeline-name-input {
        font-size: 14px;
        padding: 8px 10px;
        min-width: 0;
        flex: 1;
    }
    .pipeline-toolbar-actions { gap: 6px; }
    .pipeline-toolbar-actions .btn {
        padding: 8px 12px;
        font-size: 12px;
        min-height: 38px;
    }

    /* Canvas : hauteur = viewport - header - toolbar */
    .pipeline-canvas {
        min-height: calc(100vh - 130px);
    }

    /* Empty state plus compact */
    .pipeline-empty-icon { font-size: 48px; }
    .pipeline-empty-text { font-size: 13.5px; padding: 0 8px; }
    .pipeline-empty-sub { font-size: 12px; }

    /* Config panel = bottom sheet sur mobile.
       max-height: 60vh laisse ~40vh de canvas visible pour voir le bloc.
       overflow-y: auto pour scroll interne du panneau sans étendre le sheet. */
    .pipeline-config {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        width: 100%;
        max-height: 60vh;
        overflow-y: auto;
        z-index: 60;
        border-left: none;
        border-top: 1px solid var(--border);
        border-top-left-radius: 14px;
        border-top-right-radius: 14px;
        box-shadow: 0 -8px 24px rgba(0,0,0,0.15);
        animation: pipeline-config-slide-up 0.2s ease-out;
    }
    @keyframes pipeline-config-slide-up {
        from { transform: translateY(20px); opacity: 0; }
        to   { transform: translateY(0);    opacity: 1; }
    }
    /* Hamburger toggle reste cliquable au-dessus du bottom sheet (sinon le
       sheet à z-index:60 intercepte les clicks du bouton ☰ Blocs). */
    .pipeline-mobile-toggle {
        position: relative;
        z-index: 70;
    }
}

@media (max-width: 480px) {
    .pipeline-toolbar-actions .btn { padding: 6px 10px; font-size: 11px; }
    .pipeline-block-template { padding: 8px 10px; font-size: 12px; }
    .pipeline-block-icon { font-size: 16px; }
    /* Bloc node un peu plus petit pour tenir à l'écran */
    .pipeline-node { width: 180px; }
    .pipeline-node-header { font-size: 12px; padding: 6px 8px; }
    .pipeline-node-body { padding: 8px 10px 10px; }
    .pipeline-node-summary { font-size: 11px; }
}

/* Bouton hamburger : caché par défaut, visible mobile uniquement */
.pipeline-mobile-toggle {
    display: none;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    color: var(--ink);
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.pipeline-mobile-toggle:hover {
    background: var(--bg-soft);
    border-color: var(--accent);
}

/* ---------- Barre de progression pipeline (page détail) ----------
   Plus haute + transition douce + rayures animées en mouvement quand ça tourne :
   feedback visuel net "la pipeline avance" même si le % bouge lentement. */
.pipeline-progress { height: 12px; }
.pipeline-progress .progress-bar {
    transition: width 600ms cubic-bezier(0.22, 1, 0.36, 1);
}
.pipeline-progress .progress-bar.is-active {
    background-image: linear-gradient(135deg,
        rgba(255,255,255,0.24) 25%, transparent 25%,
        transparent 50%, rgba(255,255,255,0.24) 50%,
        rgba(255,255,255,0.24) 75%, transparent 75%, transparent);
    background-size: 20px 20px;
    animation: pipeline-progress-stripes 0.9s linear infinite;
}
@keyframes pipeline-progress-stripes {
    from { background-position: 0 0; }
    to   { background-position: 20px 0; }
}
/* Reflet qui balaie TOUTE la piste quand ça tourne : signale l'activité même
   quand le remplissage est faible (début de pipeline) et que les rayures du
   fill ne sont pas encore visibles. */
.pipeline-progress.is-running-track { position: relative; }
.pipeline-progress.is-running-track::after {
    content: ''; position: absolute; inset: 0; border-radius: 999px; pointer-events: none;
    background: linear-gradient(90deg, transparent 0%, rgba(13,93,92,0.12) 50%, transparent 100%);
    background-size: 45% 100%;
    background-repeat: no-repeat;
    animation: pipeline-track-sweep 1.8s ease-in-out infinite;
}
@keyframes pipeline-track-sweep {
    0%   { background-position: -45% 0; }
    100% { background-position: 145% 0; }
}

/* ---------- Pipeline detail page (step list) ---------- */

.pipeline-step-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-left: 2px solid var(--border);
    padding-left: 0;
    margin-left: 8px;
    position: relative;
}
.pipeline-step {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 14px 14px 20px;
    margin-left: -2px;
    border-left: 2px solid transparent;
    text-decoration: none;
    color: var(--ink);
    transition: background 0.12s, border-color 0.12s;
    position: relative;
}
.pipeline-step:hover {
    background: var(--bg-soft);
    border-left-color: var(--accent);
}
.pipeline-step-marker {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--ink-faint);
    flex-shrink: 0;
    margin-left: -27px;
    z-index: 1;
}
.pipeline-step-marker.status-running   { background: var(--accent); border-color: var(--accent); animation: pipeline-port-pulse 1.5s ease-in-out infinite; }
.pipeline-step-marker.status-pending   { background: var(--bg); border-color: var(--ink-muted); }
.pipeline-step-marker.status-done      { background: var(--success); border-color: var(--success); }
.pipeline-step-marker.status-failed    { background: var(--danger); border-color: var(--danger); }
.pipeline-step-marker.status-cancelled { background: var(--ink-muted); border-color: var(--ink-muted); }

.pipeline-step-content {
    flex: 1;
    min-width: 0;
}
.pipeline-step-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}
.pipeline-step-icon { font-size: 16px; }
.pipeline-step-status {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--bg-soft);
    color: var(--ink-muted);
}
.pipeline-step-status.status-running { background: var(--accent-soft); color: var(--accent-text); }
.pipeline-step-status.status-done    { background: rgba(60, 160, 110, 0.15); color: var(--success); }
.pipeline-step-status.status-failed  { background: rgba(180, 60, 60, 0.15); color: var(--danger); }
.pipeline-step-status.status-cancelled,
.pipeline-step-status.status-expired { background: var(--bg-soft); color: var(--ink-muted); }

/* Étape en cours : surlignage discret pour la repérer du premier coup d'œil. */
.pipeline-step.is-running { background: var(--accent-soft); border-left-color: var(--accent); }
.pipeline-step.is-running .pipeline-step-title { color: var(--accent-text); }

.pipeline-step-meta {
    margin-top: 4px;
}
.pipeline-step-arrow {
    color: var(--ink-faint);
    font-size: 18px;
    flex-shrink: 0;
}

/* ============================================================
   Pipeline FLOW (page détail) — plan complet, étape par étape
   Rendu de TOUS les nodes définis (pas seulement les jobs créés) :
   états done / running / pending / upcoming / failed, progression par étape,
   timeline verticale avec marqueurs + connecteurs.
   ============================================================ */
.pflow-header { margin-bottom: 16px; }
.pflow { display: flex; flex-direction: column; }
.pflow-step { display: flex; gap: 14px; }

.pflow-rail { display: flex; flex-direction: column; align-items: center; width: 22px; flex-shrink: 0; }
.pflow-marker {
    width: 20px; height: 20px; border-radius: 50%; margin-top: 13px;
    border: 2px solid var(--ink-faint); background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; line-height: 1; color: #fff; flex-shrink: 0;
    transition: background 0.2s, border-color 0.2s;
}
.pflow-marker.state-done      { background: var(--success); border-color: var(--success); }
.pflow-marker.state-failed,
.pflow-marker.state-expired   { background: var(--danger); border-color: var(--danger); }
/* Arrêt volontaire (partiel) : ton neutre/muted, ce n'est pas une erreur. */
.pflow-marker.state-cancelled { background: var(--ink-muted); border-color: var(--ink-muted); }
.pflow-marker.state-running   { background: var(--accent); border-color: var(--accent); animation: pipeline-port-pulse 1.5s ease-in-out infinite; }
.pflow-marker.state-pending   { background: var(--bg); border-color: var(--ink-muted); }
.pflow-marker.state-upcoming  { background: var(--bg); border-color: var(--ink-faint); border-style: dashed; }
.pflow-connector { flex: 1; width: 2px; background: var(--border); margin: 4px 0 0; min-height: 16px; }

.pflow-card {
    flex: 1; min-width: 0; padding: 12px 14px; margin-bottom: 10px;
    border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg);
    transition: background 0.2s, border-color 0.2s;
}
.pflow-step.state-running .pflow-card  { background: var(--accent-soft); border-color: var(--accent); }
.pflow-step.state-upcoming .pflow-card { background: var(--bg-soft); border-style: dashed; }
.pflow-step.state-upcoming             { opacity: 0.72; }

.pflow-row { display: flex; align-items: center; gap: 8px; }
.pflow-icon { font-size: 16px; flex-shrink: 0; }
.pflow-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.pflow-step.state-running .pflow-name { color: var(--accent-text); }
.pflow-badge {
    margin-left: auto; font-family: var(--font-mono); font-size: 10px;
    letter-spacing: 0.08em; text-transform: uppercase; padding: 2px 8px;
    border-radius: 999px; background: var(--bg-soft); color: var(--ink-muted);
}
.pflow-badge.state-running   { background: var(--accent); color: #fff; }
.pflow-badge.state-done      { background: rgba(61, 107, 61, 0.16); color: var(--success); }
.pflow-badge.state-failed,
.pflow-badge.state-expired   { background: var(--danger-soft); color: var(--danger); }
.pflow-badge.state-cancelled { background: var(--bg-soft); color: var(--ink-muted); }
.pflow-badge.state-pending   { background: var(--bg-soft); color: var(--ink-muted); }
.pflow-badge.state-upcoming  { background: transparent; color: var(--ink-faint); border: 1px dashed var(--border-strong); }
.pflow-open { color: var(--ink-faint); font-size: 16px; text-decoration: none; line-height: 1; }
.pflow-open:hover { color: var(--accent); }

.pflow-bar { height: 6px; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.pflow-bar-fill {
    height: 100%; width: 0; background-color: var(--accent); border-radius: 999px;
    transition: width 600ms cubic-bezier(0.22, 1, 0.36, 1);
    background-image: linear-gradient(135deg,
        rgba(255,255,255,0.28) 25%, transparent 25%,
        transparent 50%, rgba(255,255,255,0.28) 50%,
        rgba(255,255,255,0.28) 75%, transparent 75%, transparent);
    background-size: 16px 16px;
    animation: pipeline-progress-stripes 0.9s linear infinite;
}
.pflow-bar.is-indeterminate .pflow-bar-fill {
    width: 40%;
    animation: pflow-indeterminate 1.3s ease-in-out infinite;
}
@keyframes pflow-indeterminate {
    0%   { margin-left: -40%; }
    100% { margin-left: 100%; }
}

.pflow-meta { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.pflow-meta .pflow-sep { color: var(--ink-faint); }
/* Pont « Continuer avec les résultats » posé sur la ligne de flux, ENTRE deux
   étapes (et non dans la carte du step). Aligné sur le rail (22px) comme les steps. */
.pflow-item { display: flex; flex-direction: column; }
.pflow-bridge { display: flex; gap: 14px; align-items: stretch; margin: -2px 0 8px; }
.pflow-bridge-rail {
    width: 22px; flex-shrink: 0; position: relative;
    display: flex; align-items: center; justify-content: center;
}
/* segment de ligne accent (pointillé) qui prolonge le flux à travers le pont */
.pflow-bridge-rail::before {
    content: ''; position: absolute; left: 50%; top: 0; bottom: 0;
    width: 2px; transform: translateX(-50%);
    background: repeating-linear-gradient(var(--accent) 0 5px, transparent 5px 9px);
    opacity: 0.7;
}
.pflow-bridge-arrow {
    position: relative; z-index: 1; width: 18px; height: 18px; border-radius: 50%;
    background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; line-height: 1;
}
.pflow-bridge-cta {
    flex: 1; min-width: 0;
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 10px 14px;
    background: var(--accent-soft);
    border: 1px dashed var(--accent);
    border-radius: var(--r-md);
}
.pflow-bridge-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pflow-bridge-title { font-size: 13px; font-weight: 600; color: var(--accent-text); }
.pflow-bridge-hint { font-size: 12px; color: var(--ink-muted); }
.pflow-bridge-btn { flex-shrink: 0; }
