#pipelines-container { display: flex; height: 100%; }

#pipelines-sidebar {
    width: 280px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}
#pipelines-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
#pipelines-runs-header {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    margin-top: 4px;
}
#pipelines-list {
    overflow-y: auto;
    padding: 6px;
    flex-shrink: 0;
    max-height: 40%;
}
#pipelines-runs-list { flex: 1; overflow-y: auto; padding: 6px; }

#pipeline-detail { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
#pipeline-detail .detail-scroll-inner { flex: 1; overflow-y: auto; padding: 16px; }

/* ── Pipeline list items ── */
.pipeline-item {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.pipeline-item:hover  { border-color: var(--accent); background: var(--surface3); }
.pipeline-item.active { border-color: var(--accent); background: var(--accent-dim); }
.pipeline-item-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 3px;
}
.pipeline-item.active .pipeline-item-name { color: var(--accent); }
.pipeline-item-desc {
    font-size: 10px;
    color: var(--text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pipeline-item-meta { font-size: 10px; color: var(--text-faint); margin-top: 4px; }

/* ── Run list items ── */
.run-item {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    margin-bottom: 5px;
    cursor: pointer;
    transition: border-color 0.15s;
}
.run-item:hover  { border-color: var(--accent); }
.run-item.active { border-color: var(--accent); background: var(--accent-dim); }
.run-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
}
.run-item-name   { font-size: 12px; font-weight: 600; color: var(--text); }
.run-item-status {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
}
.run-status-running   { background: var(--accent-dim);   color: var(--accent);   }
.run-status-completed { background: var(--success-dim);  color: var(--success);  }
.run-status-failed    { background: var(--error-dim);    color: var(--error);    }
.run-status-cancelled { background: var(--surface3);     color: var(--text-dim); }
.run-status-pending   { background: var(--warning-dim);  color: var(--warning);  }
.run-item-meta {
    font-size: 10px;
    color: var(--text-faint);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Pipeline detail view ── */
.pipeline-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
    gap: 12px;
}
.pipeline-detail-title { font-size: 16px; font-weight: 700; color: var(--accent); }
.pipeline-detail-desc  { font-size: 12px; color: var(--text-dim); margin-top: 4px; line-height: 1.5; }

.pipeline-steps-title {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    margin-top: 4px;
}

/* ── Step rows ── */
.pipeline-step-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--surface2);
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 12px;
}
.step-index {
    font-size: 10px;
    color: var(--text-faint);
    width: 18px;
    text-align: right;
    flex-shrink: 0;
}
.step-id   { color: var(--text); font-weight: 600; flex: 1; }
.step-type {
    font-size: 10px;
    color: var(--text-faint);
    background: var(--surface3);
    padding: 2px 6px;
    border-radius: 3px;
    flex-shrink: 0;
}
.step-type-condition { color: var(--warning); }
.step-type-script    { color: var(--accent);  }

/* ── Collapsible step cards ── */
.pipeline-step-card { margin-bottom: 2px; }
.pipeline-step-card .pipeline-step-row {
    cursor: pointer;
    transition: background 0.1s;
}
.pipeline-step-card .pipeline-step-row:hover { background: var(--surface3); }
.step-expand-icon {
    font-size: 10px;
    color: var(--text-faint);
    margin-left: auto;
    flex-shrink: 0;
    transition: transform 0.15s;
}
.pipeline-step-card.expanded .step-expand-icon { transform: rotate(90deg); }
.pipeline-step-summary {
    font-size: 11px;
    color: var(--text-dim);
    padding: 0 10px 4px 36px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}
.pipeline-step-full { display: none; padding: 6px 10px 8px 36px; }
.pipeline-step-card.expanded .pipeline-step-full { display: block; }
.step-full-label {
    font-size: 9px;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 6px;
    margin-bottom: 2px;
}
.step-full-label:first-child { margin-top: 0; }
.step-full-pre {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 11px;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
    margin: 0;
    line-height: 1.5;
}

/* ── Run detail view ── */
.run-detail-header  { margin-bottom: 14px; }
.run-detail-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
    word-break: break-all;
}
.run-detail-meta { font-size: 11px; color: var(--text-dim); line-height: 1.6; }
.run-detail-error {
    background: var(--error-dim);
    border: 1px solid var(--error);
    color: var(--error);
    border-radius: var(--radius);
    padding: 8px 12px;
    font-size: 12px;
    margin-bottom: 12px;
    white-space: pre-wrap;
}

.step-results-title {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

/* ── Step result cards ── */
.step-result-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    overflow: hidden;
}
.step-result-card.step-ok   { border-color: var(--success-dim); }
.step-result-card.step-fail { border-color: var(--error); }
.step-result-card.step-skip { border-color: var(--text-faint); opacity: 0.7; }
.step-result-card.step-run  { border-color: var(--accent); }

.step-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    background: var(--surface3);
}
.step-result-id    { font-size: 12px; font-weight: 600; }
.step-result-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 3px;
}
.badge-completed { background: var(--success-dim);  color: var(--success);   }
.badge-failed    { background: var(--error-dim);    color: var(--error);     }
.badge-running   { background: var(--accent-dim);   color: var(--accent);    }
.badge-skipped   { background: var(--surface3);     color: var(--text-faint);}
.badge-pending   { background: var(--warning-dim);  color: var(--warning);   }

.step-result-body         { padding: 10px 12px; display: none; font-size: 12px; line-height: 1.5; }
.step-result-body.open    { display: block; }
.step-result-body pre {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 8px 10px;
    font-size: 11px;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 4px;
}
.step-result-label {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 8px;
    margin-bottom: 2px;
}

/* ── Trigger modal ── */
.pipeline-modal-content {
    min-width: 420px;
    max-width: 560px;
    text-align: left;
}
.pipeline-modal-desc {
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 14px;
    line-height: 1.5;
    text-align: left;
}
#pipeline-modal-fields { display: flex; flex-direction: column; gap: 10px; margin-bottom: 4px; }

/* ── Pipeline creator modal ── */
.pipeline-creator-content button           { width: auto; }
.pipeline-creator-content .confirm-buttons button { flex: 1; }

.creator-header {
    /* inherits from modal heading flow */
}
.creator-mode-toggle { display: flex; gap: 4px; margin-left: auto; }
.creator-mode-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 3px 10px;
    font-family: var(--font);
    font-size: 11px;
    border-radius: var(--radius);
    cursor: pointer;
    width: auto !important;
}
.creator-mode-btn.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }

.creator-panel { /* container for visual / yaml panels */ }

.creator-fields  { margin-bottom: 8px; }
.creator-row     { display: flex; gap: 8px; }

.creator-steps-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-top: 1px solid var(--border);
    margin-top: 8px;
    overflow: hidden;
}
.creator-steps-header .btn-new {
    flex-shrink: 0;
    font-size: 10px;
    padding: 2px 8px;
    width: auto !important;
}
.creator-steps-list { /* list of step blocks */ }

.creator-step-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    overflow: hidden;
}
.creator-step-grip {
    color: var(--text-faint);
    font-size: 12px;
    cursor: grab;
    flex: 0 0 14px;
    user-select: none;
    text-align: center;
}
.creator-step-num {
    font-size: 9px;
    color: var(--text-faint);
    background: var(--surface3);
    border-radius: 3px;
    padding: 1px 4px;
    flex: 0 0 auto;
}
.creator-step-id-input {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 3px 6px;
    font-family: var(--font);
    font-size: 11px;
    border-radius: 4px;
    flex: 0 0 110px;
    min-width: 0;
}
.creator-step-id-input:focus { outline: none; border-color: var(--accent); }
.creator-step-type-select {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 3px 6px;
    font-family: var(--font);
    font-size: 11px;
    border-radius: 4px;
    flex: 0 0 90px;
    min-width: 0;
}
.creator-step-type-select:focus { outline: none; border-color: var(--accent); }
.creator-step-remove {
    background: none;
    border: none;
    color: var(--error);
    font-size: 11px;
    cursor: pointer;
    flex: 0 0 20px;
    padding: 0;
    opacity: 0.5;
    line-height: 1;
    text-align: center;
    width: 20px !important;
}
.creator-step-remove:hover { opacity: 1; }
.creator-step-fields { display: flex; flex-direction: column; gap: 6px; }
.creator-step-field  { display: flex; flex-direction: column; gap: 2px; }
.creator-step-field label {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.creator-step-field input,
.creator-step-field textarea,
.creator-step-field select {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 5px 8px;
    font-family: var(--font);
    font-size: 12px;
    border-radius: 4px;
    width: 100%;
}
.creator-step-field input:focus,
.creator-step-field textarea:focus,
.creator-step-field select:focus   { outline: none; border-color: var(--accent); }
.creator-step-field textarea { resize: vertical; min-height: 50px; line-height: 1.4; tab-size: 2; }
