/* Agent Registry Styles */

/* View Tabs */
.view-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    background: var(--card-bg);
    border-radius: 14px;
    padding: 4px;
    border: 1px solid var(--card-border);
}

.view-tab {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: none;
    color: var(--text-gray);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.view-tab:hover {
    color: var(--text-white);
}

.view-tab.active {
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-blue));
    color: white;
}

.wf-badge {
    background: rgba(255, 255, 255, 0.25);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}

/* Category Pills */
.category-filters,
.tool-filters,
.provider-pills {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cat-pill,
.tool-pill,
.lib-pill {
    background: var(--text-white);
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-dark);
    transition: all 0.2s;
    font-weight: 500;
    text-align: left;
    width: 100%;
}

.cat-pill:hover,
.tool-pill:hover,
.lib-pill:hover {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
    background: rgba(59, 130, 246, 0.05);
}

.cat-pill.active,
.lib-pill.active {
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-blue));
    border-color: var(--primary-blue);
    color: var(--text-white);
}

.tool-pill.active {
    background: var(--bg-dark);
    border-color: var(--primary-blue);
    color: var(--text-white);
}

/* Agent Count */
.agent-count {
    color: var(--text-gray);
    font-size: 14px;
    font-weight: 500;
    background: var(--card-bg);
    padding: 6px 14px;
    border-radius: 20px;
}

/* Agents Grid */
.agents-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* Agent Card */
.agent-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 22px;
    transition: all 0.25s;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.agent-card:hover {
    border-color: var(--primary-blue);
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(59, 130, 246, 0.15);
}

.agent-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.agent-icon {
    font-size: 28px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-darker);
    border-radius: 12px;
}

.agent-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.agent-badge.generic {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

.agent-badge.coding {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.agent-badge.writing {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.agent-badge.research {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
}

.agent-badge.data {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.agent-badge.payments {
    background: rgba(236, 72, 153, 0.2);
    color: #f472b6;
}

.agent-badge.support {
    background: rgba(14, 165, 233, 0.2);
    color: #38bdf8;
}

.agent-badge.hr {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
}

.agent-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-white);
}

.agent-provider {
    font-size: 12px;
    color: var(--text-gray);
    margin-top: 2px;
}

.agent-desc {
    font-size: 13px;
    color: var(--text-gray);
    line-height: 1.5;
}

.agent-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.agent-tool-tag {
    font-size: 11px;
    padding: 4px 10px;
    background: var(--bg-darker);
    color: var(--text-gray);
    border-radius: 6px;
    font-weight: 500;
}

.agent-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--card-border);
}

.agent-stats {
    display: flex;
    gap: 14px;
    font-size: 12px;
    color: var(--text-gray);
}

.agent-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pull-btn {
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-blue));
    border: none;
    color: white;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.pull-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* Action Buttons */
.action-btn {
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-family: inherit;
}

.action-btn.primary {
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-blue));
    color: white;
    flex: 1;
}

.action-btn.primary:hover {
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.action-btn.primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.action-btn.secondary {
    background: var(--input-bg);
    color: var(--text-gray);
    border: 1px solid var(--card-border);
}

.action-btn.secondary:hover {
    color: var(--text-white);
    border-color: var(--text-gray);
}

/* Pull Modal Body */
.detail-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    align-items: flex-start;
}

.detail-label {
    font-size: 13px;
    color: var(--text-gray);
    width: 80px;
    flex-shrink: 0;
    font-weight: 500;
}

.detail-value {
    font-size: 14px;
    color: var(--text-white);
}

/* Form Inputs */
.form-input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 12px;
    color: var(--text-white);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    resize: vertical;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.form-input::placeholder {
    color: var(--text-gray);
}

/* Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.tool-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-darker);
    border-radius: 10px;
    font-size: 13px;
    color: var(--text-gray);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.tool-check:hover {
    border-color: var(--card-border);
    color: var(--text-white);
}

.tool-check input {
    accent-color: var(--primary-blue);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 14px 28px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    transition: all 0.35s;
    z-index: 2000;
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.4);
    pointer-events: none;
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 8px 32px rgba(239, 68, 68, 0.4);
}

.toast.warn {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 8px 32px rgba(245, 158, 11, 0.4);
}

/* Deployed Workflow Cards */
.deployed-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 14px;
    transition: all 0.2s;
}

.deployed-card:hover {
    border-color: var(--primary-blue);
}

.deployed-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.deployed-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-white);
    display: flex;
    align-items: center;
    gap: 10px;
}

.deployed-status {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.deployed-pipeline {
    display: flex;
    align-items: center;
    gap: 0;
    overflow-x: auto;
    padding: 10px 0;
}

.deployed-agent {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-darker);
    border-radius: 10px;
    flex-shrink: 0;
}

.deployed-agent-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-white);
}

.deployed-agent-cat {
    font-size: 10px;
    color: var(--text-gray);
}

.deployed-arrow {
    color: var(--primary-blue);
    font-size: 18px;
    padding: 0 6px;
    flex-shrink: 0;
}

.deployed-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--card-border);
}

.deployed-time {
    font-size: 12px;
    color: var(--text-gray);
}

.deployed-delete {
    background: none;
    border: 1px solid var(--card-border);
    color: var(--text-gray);
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.deployed-delete:hover {
    border-color: #ef4444;
    color: #ef4444;
}

/* Responsive */
@media (max-width: 1024px) {
    .agents-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .tools-grid {
        grid-template-columns: 1fr;
    }
}

/* ─── Graph Workflow Modal ─────────────────────────────────────────────────── */
.wf-graph-modal {
    max-width: min(92vw, 1100px);
    width: min(92vw, 1100px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 88vh;
}

.wf-graph-modal .modal-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.wf-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wf-name-input {
    width: 220px;
    padding: 8px 12px;
    font-size: 13px;
}

.wf-toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-blue));
    color: #fff;
    transition: all 0.2s;
}

.wf-toolbar-btn:hover {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.wf-toolbar-btn.secondary {
    background: var(--input-bg);
    color: var(--text-gray);
    border: 1px solid var(--card-border);
}

.wf-toolbar-btn.secondary:hover {
    color: var(--text-white);
    border-color: var(--text-gray);
    transform: none;
    box-shadow: none;
}

/* Canvas */
.wf-canvas-wrap {
    flex: 1;
    position: relative;
    overflow: hidden;
    background-color: var(--bg-darker);
    background-image: radial-gradient(circle, rgba(51, 65, 85, 0.9) 1px, transparent 1px);
    background-size: 24px 24px;
    cursor: default;
    user-select: none;
}

.wf-svg {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    overflow: visible;
}

.wf-svg path.wf-edge {
    pointer-events: stroke;
    cursor: pointer;
    stroke: var(--primary-blue);
    stroke-width: 2;
    fill: none;
    opacity: 0.75;
    transition: stroke 0.15s, opacity 0.15s;
}

.wf-svg path.wf-edge:hover {
    stroke: #ef4444;
    opacity: 1;
    stroke-width: 2.5;
}

.wf-svg path.wf-edge.pending {
    stroke: var(--accent-blue);
    stroke-dasharray: 6 4;
    opacity: 0.6;
    pointer-events: none;
}

.wf-nodes {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
}

/* Empty state */
.wf-empty-state {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
}

.wf-empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.3; }
.wf-empty-title { font-size: 16px; font-weight: 600; color: var(--text-gray); margin-bottom: 8px; }
.wf-empty-sub { font-size: 13px; color: var(--text-gray); opacity: 0.6; max-width: 340px; line-height: 1.6; }

/* Node cards */
.wf-node {
    position: absolute;
    width: 180px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 12px;
    pointer-events: all;
    cursor: grab;
    user-select: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.wf-node:hover {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2), 0 8px 24px rgba(0, 0, 0, 0.4);
}

.wf-node.dragging {
    cursor: grabbing;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.3), 0 16px 40px rgba(0, 0, 0, 0.5);
    z-index: 100;
}

.wf-node-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 8px;
}

.wf-node-icon {
    font-size: 22px;
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-darker);
    border-radius: 8px;
    flex-shrink: 0;
}

.wf-node-delete {
    background: none;
    border: none;
    color: var(--text-gray);
    font-size: 16px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
    pointer-events: all;
}

.wf-node-delete:hover { color: #ef4444; background: rgba(239, 68, 68, 0.1); }

.wf-node-name {
    font-size: 13px; font-weight: 600; color: var(--text-white);
    margin-bottom: 3px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.wf-node-meta {
    font-size: 11px; color: var(--text-gray);
    margin-bottom: 7px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.wf-node-tools { display: flex; flex-wrap: wrap; gap: 4px; }
.wf-node-tool {
    font-size: 10px; padding: 2px 7px;
    background: var(--bg-darker); color: var(--text-gray);
    border-radius: 4px; font-weight: 500;
}

/* Ports */
.wf-port {
    position: absolute;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 2px solid var(--card-border);
    cursor: crosshair;
    pointer-events: all;
    transition: border-color 0.15s, background 0.15s, transform 0.15s;
    z-index: 10;
}

.wf-port-out {
    right: -7px; top: 33px;
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-blue));
    border-color: var(--accent-blue);
}

.wf-port-out:hover {
    background: var(--accent-blue);
    transform: scale(1.4);
    box-shadow: 0 0 8px rgba(14, 165, 233, 0.6);
}

.wf-port-in { left: -7px; top: 33px; }

.wf-port-in:hover {
    border-color: #10b981; background: #10b981;
    transform: scale(1.4);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.wf-port-in.accept {
    border-color: #10b981; background: #10b981;
    transform: scale(1.5);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.8);
}

/* Footer */
.wf-footer { flex-shrink: 0; align-items: center; }
.wf-node-count { margin-left: auto; font-size: 13px; color: var(--text-gray); }

/* Agent Picker */
.wf-picker-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(2, 6, 23, 0.6);
    backdrop-filter: blur(3px);
    z-index: 1200;
    display: flex; align-items: center; justify-content: center;
}

.wf-picker {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    width: 480px; max-height: 560px;
    display: flex; flex-direction: column;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
}

.wf-picker-header {
    display: flex; align-items: center; gap: 10px;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--card-border);
    flex-shrink: 0;
}

.wf-picker-search { flex: 1; padding: 10px 14px; font-size: 14px; }
.wf-picker-list { overflow-y: auto; padding: 8px; flex: 1; }

.wf-picker-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 10px;
    cursor: pointer; transition: background 0.15s;
}

.wf-picker-item:hover { background: var(--bg-darker); }
.wf-picker-item.already-added { opacity: 0.4; cursor: not-allowed; }

.wf-picker-icon {
    font-size: 20px; width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-darker); border-radius: 8px; flex-shrink: 0;
}

.wf-picker-info { flex: 1; min-width: 0; }
.wf-picker-name { font-size: 13px; font-weight: 600; color: var(--text-white); }
.wf-picker-sub { font-size: 11px; color: var(--text-gray); }

.wf-picker-add-btn {
    padding: 5px 12px; font-size: 12px; font-weight: 600;
    border: none; border-radius: 7px;
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-blue));
    color: #fff; cursor: pointer; flex-shrink: 0;
}

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

/* ─── Node Config Button ───────────────────────────────────────────────────── */
.wf-node-cfg {
    background: none;
    border: none;
    color: var(--text-gray);
    font-size: 13px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
    pointer-events: all;
}

.wf-node-cfg:hover { color: var(--primary-blue-light); background: rgba(59, 130, 246, 0.1); }

/* ─── Zoom Controls ────────────────────────────────────────────────────────── */
.wf-zoom-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 4px 8px;
}

.wf-zoom-controls span {
    font-size: 12px;
    color: var(--text-gray);
    min-width: 36px;
    text-align: center;
    font-weight: 600;
}

.wf-zoom-btn {
    background: none;
    border: none;
    color: var(--text-gray);
    font-size: 15px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
    font-family: inherit;
}

.wf-zoom-btn:hover { color: var(--text-white); background: var(--card-border); }

/* ─── Node Config Panel ────────────────────────────────────────────────────── */
.wf-config-panel {
    position: absolute;
    top: 12px; right: 12px;
    width: 260px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.wf-config-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--card-border);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-white);
}

.wf-config-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
}

.wf-config-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    display: block;
}

.wf-config-textarea {
    font-size: 12px;
    resize: vertical;
    min-height: 80px;
}

.wf-config-footer {
    padding: 12px 14px;
    border-top: 1px solid var(--card-border);
}

/* ─── Execution History Modal ──────────────────────────────────────────────── */
.history-run {
    border: 1px solid var(--card-border);
    border-radius: 12px;
    margin-bottom: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s;
}

.history-run:hover { border-color: var(--primary-blue); }

.history-run-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-darker);
}

.history-time {
    font-size: 11px;
    color: var(--text-gray);
    flex-shrink: 0;
    min-width: 56px;
}

.history-input {
    font-size: 12px;
    color: var(--text-white);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-detail {
    display: none;
    padding: 12px 14px;
    border-top: 1px solid var(--card-border);
}

.history-detail.open { display: block; }

.history-step {
    padding: 8px 12px;
    background: var(--bg-darker);
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 12px;
}

.history-step b { color: var(--text-white); display: block; margin-bottom: 4px; }
.history-step p { color: var(--text-gray); margin: 0; line-height: 1.5; }

/* ─── Step Warning / Error Cards ───────────────────────────────────────────── */
.step-warning {
    margin-top: 8px;
    padding: 7px 12px;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 8px;
    font-size: 12px;
    color: #fbbf24;
}

.step-error-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
    font-size: 14px;
}

/* ─── Live Pipeline Cards ───────────────────────────────────────────────────── */
.pipeline-card {
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    transition: border-color 0.3s, box-shadow 0.3s, opacity 0.3s;
}

.pipeline-card.pending {
    opacity: 0.4;
}

.pipeline-card.running {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
    animation: pipeline-glow 2s ease-in-out infinite;
    opacity: 1;
}

.pipeline-card.done {
    border-left: 3px solid #34d399;
    border-color: rgba(52, 211, 153, 0.35);
    opacity: 1;
}

.pipeline-card.done.review {
    border-left: 3px solid #a78bfa;
    border-color: rgba(167, 139, 250, 0.35);
}

.pipeline-card.card-error {
    border-left: 3px solid #ef4444;
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.06);
    opacity: 1;
}

.pipeline-card.card-deferred {
    border-left: 3px solid #3b82f6;
    border-color: rgba(59, 130, 246, 0.35);
    opacity: 1;
}

@keyframes pipeline-glow {
    0%, 100% { box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12); }
    50%       { box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.22); }
}

.card-icon-spin {
    display: inline-block;
    animation: card-spin 0.9s linear infinite;
}

@keyframes card-spin {
    to { transform: rotate(360deg); }
}

.pipeline-output {
    background: var(--bg-darker);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--text-gray);
    line-height: 1.6;
    max-height: 150px;
    overflow-y: auto;
    white-space: pre-wrap;
    margin-top: 8px;
}

.running-dots::after {
    content: '';
    animation: running-dots 1.4s steps(4, end) infinite;
}

@keyframes running-dots {
    0%   { content: ''; }
    25%  { content: '.'; }
    50%  { content: '..'; }
    75%  { content: '...'; }
}

/* ─── Reflection Toggle ─────────────────────────────────────────────────────── */
.reflection-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-gray);
    margin-bottom: 12px;
    cursor: pointer;
    user-select: none;
}

.reflection-toggle input[type="checkbox"] {
    accent-color: var(--primary-blue);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

/* ─── Follow-up Monitoring Badges ─────────────────────────────── */
.deployed-status.monitoring {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    margin-left: 8px;
}

.deployed-status.replied {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    margin-left: 8px;
}

.deployed-status.expired {
    background: rgba(107, 114, 128, 0.2);
    color: #9ca3af;
    margin-left: 8px;
}

.deployed-status.cancelled {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    margin-left: 8px;
}

/* ─── Edit Prompts Modal ───────────────────────────────────────── */
.prompt-agent-block {
    margin-bottom: 20px;
}

.prompt-agent-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-white);
    margin-bottom: 6px;
}

.prompt-agent-label span.agent-icon {
    font-size: 18px;
}

.prompt-agent-label small {
    font-size: 11px;
    color: var(--text-gray);
    font-weight: 400;
}

.prompt-textarea {
    width: 100%;
    min-height: 90px;
    background: var(--bg-darker);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: var(--text-white);
    font-size: 12px;
    font-family: 'Courier New', monospace;
    padding: 10px 12px;
    resize: vertical;
    box-sizing: border-box;
    line-height: 1.5;
    transition: border-color 0.2s;
}

.prompt-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.prompt-textarea::placeholder {
    color: var(--text-gray);
    font-style: italic;
}

.prompt-hint {
    font-size: 11px;
    color: var(--text-gray);
    margin-top: 4px;
}

/* ─── Agent Run Debugger ──────────────────────────────────────────────────── */
.history-run-stats {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 12px;
    flex-shrink: 0;
}

.history-step-trace {
    padding: 0;
    background: var(--bg-darker);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
    cursor: default;
}

.trace-step-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(255,255,255,.02);
    border-bottom: 1px solid var(--card-border);
    flex-wrap: wrap;
}

.trace-step-num {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: rgba(96,165,250,.15);
    color: #60a5fa;
    font-weight: 700;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.trace-step-icon { font-size: 18px; flex-shrink: 0; }
.trace-step-name {
    font-weight: 600;
    color: var(--text-white);
    font-size: 14px;
    flex-shrink: 0;
}

.trace-step-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-left: auto;
}

.trace-badge {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 100px;
    border: 1px solid;
    font-weight: 500;
    white-space: nowrap;
}

.trace-step-body { padding: 6px 10px 10px; }

.trace-section {
    margin-top: 6px;
    background: rgba(0,0,0,.25);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    overflow: hidden;
}

.trace-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    cursor: pointer;
    user-select: none;
    transition: background .15s;
}
.trace-section-header:hover { background: rgba(255,255,255,.03); }

.trace-section-caret {
    color: var(--text-gray);
    font-size: 10px;
    transition: transform .2s;
    width: 12px;
    text-align: center;
}
.trace-section.open .trace-section-caret { transform: rotate(90deg); }

.trace-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-white);
    letter-spacing: .02em;
}

.trace-section-body {
    display: none;
    padding: 0 12px 12px;
    border-top: 1px solid var(--card-border);
}
.trace-section.open .trace-section-body { display: block; }

.trace-pre {
    margin: 10px 0 0;
    padding: 10px 12px;
    background: rgba(0,0,0,.35);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.55;
    color: #d1d5db;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'SF Mono', Menlo, monospace;
    max-height: 360px;
    overflow-y: auto;
}
.trace-pre-muted { color: #9ca3af; opacity: .85; }

.trace-kv {
    font-size: 12px;
    color: var(--text-gray);
    line-height: 1.6;
    margin-top: 8px;
}
.trace-kv b { color: var(--text-white); margin-right: 4px; }

.trace-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.trace-tool-pill {
    background: rgba(251,191,36,.1);
    color: #fbbf24;
    border: 1px solid rgba(251,191,36,.25);
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 500;
}

.trace-warning {
    background: rgba(248,113,113,.08);
    border: 1px solid rgba(248,113,113,.25);
    color: #f87171;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    margin-top: 10px;
}

.trace-final-result {
    margin-top: 8px;
    background: rgba(52,211,153,.05);
    border: 1px solid rgba(52,211,153,.2);
    border-radius: 8px;
}

/* ─── Workflow Analytics Dashboard ────────────────────────────────────────── */
.analytics-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--card-border);
}
.analytics-workflow-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-white);
}
.analytics-subtitle {
    font-size: 13px;
    color: var(--text-gray);
    margin-top: 4px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}
.kpi-grid-small { margin-bottom: 24px; }
.kpi-grid-small .kpi-value { font-size: 22px; }

.kpi-card {
    background: var(--bg-darker);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 16px;
    text-align: left;
}
.kpi-label {
    font-size: 11px;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 600;
    margin-bottom: 8px;
}
.kpi-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-white);
    line-height: 1.1;
}
.kpi-sublabel {
    font-size: 11px;
    color: var(--text-gray);
    margin-top: 4px;
}

.chart-card {
    background: var(--bg-darker);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 16px;
}
.chart-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 14px;
    letter-spacing: .02em;
}

.chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 720px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .chart-grid { grid-template-columns: 1fr; }
}