﻿/* ========== GLOBAL RESET & TYPOGRAPHY ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #1a1a1a;
    background: #fafafa;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

a {
    color: #0066cc;
    text-decoration: none;
    transition: color 0.2s;
}

    a:hover {
        color: #004499;
    }

/* ========== LAYOUT CONTAINERS ========== */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.page-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
    width: 100%;
}

.main-content {
    flex: 1;
    padding: 3rem 3rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* ========== NAVIGATION ========== */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 3rem;
    background: #ffffff;
    border-bottom: 1px solid #e5e5e5;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-brand h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

    .nav-links a {
        font-size: 0.95rem;
        font-weight: 500;
        color: #666;
        transition: color 0.2s;
    }

        .nav-links a:hover {
            color: #1a1a1a;
        }

.nav-actions .btn-menu {
    padding: 0.5rem 1.25rem;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
}

    .nav-actions .btn-menu:hover {
        background: #f5f5f5;
        border-color: #bbb;
    }

/* ========== PAGE HEADERS ========== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e5e5;
}

    .page-header h1 {
        font-size: 2rem;
        font-weight: 700;
        color: #1a1a1a;
        margin: 0 0 0.25rem 0;
    }

.page-subtitle {
    font-size: 0.95rem;
    color: #666;
    margin: 0;
}

/* Detail Page Header */
.detail-header {
    margin-bottom: 2.5rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid #e5e5e5;
}

.header-title {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    flex: 1;
}

    .header-title > div {
        flex: 1;
    }

    .header-title h1 {
        margin: 0 0 0.5rem 0;
        font-size: 2rem;
        font-weight: 700;
        color: #1a1a1a;
    }

.header-actions {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* ========== BUTTONS ========== */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: #1a1a1a;
    color: #fff;
}

    .btn-primary:hover {
        background: #000;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

.btn-secondary {
    background: transparent;
    color: #333;
    border: 1px solid #ddd;
}

    .btn-secondary:hover {
        background: #f8f8f8;
        border-color: #999;
    }

.btn-danger {
    background: #dc3545;
    color: #fff;
}

    .btn-danger:hover {
        background: #c82333;
        box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
    }

.btn-outline {
    background: #fff;
    color: #333;
    border: 1px solid #ddd;
}

    .btn-outline:hover {
        background: #f8f8f8;
        border-color: #999;
    }

.btn-sm {
    padding: 0.6rem 1.25rem;
    font-size: 0.9rem;
}

.btn-icon-only {
    padding: 0.5rem 0.75rem;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.25rem;
    transition: all 0.2s;
}

    .btn-icon-only:hover {
        background: #e0e0e0;
        border-color: #bbb;
        transform: translateY(-1px);
    }

.btn-back {
    background: none;
    border: none;
    color: #666;
    font-size: 0.95rem;
    cursor: pointer;
    padding: 0.5rem 0;
    transition: color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

    .btn-back:hover {
        color: #1a1a1a;
    }

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========== CARDS ========== */
.card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 0;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card-simple {
    padding: 2rem;
}

    .card-simple:hover {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: #fafafa;
    border-bottom: 1px solid #e5e5e5;
}

    .card-header h2 {
        margin: 0;
        font-size: 1.25rem;
        font-weight: 600;
        display: flex;
        align-items: center;
        gap: 0.75rem;
        color: #1a1a1a;
    }

.card-body {
    padding: 0;
}

.card-footer {
    padding: 1rem 1.5rem;
    background: #fafafa;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 0.75rem;
}

/* ========== LISTS ========== */
.item-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.list-item {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    padding: 1.5rem;
    transition: all 0.2s;
    cursor: pointer;
}

    .list-item:hover {
        border-color: #ccc;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }

.list-item-horizontal {
    display: flex;
    gap: 1.25rem;
}

.list-item-content {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    font-size: 1.35rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 0.5rem 0;
}

.list-item-subtitle {
    font-size: 0.95rem;
    color: #666;
    margin: 0 0 1.25rem 0;
}

.list-item-actions {
    display: flex;
    gap: 0.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid #f0f0f0;
}

/* Nested Lists */
.list-group {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.list-group-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.5rem 2rem;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
    cursor: pointer;
    gap: 2rem;
}

    .list-group-item:hover {
        background: #fafafa;
    }

    .list-group-item:last-child {
        border-bottom: none;
    }

    .list-group-item h4 {
        margin: 0 0 0.75rem 0;
        font-size: 1.1rem;
        font-weight: 600;
        color: #1a1a1a;
    }

    .list-group-item p {
        margin: 0 0 0.5rem 0;
        font-size: 0.9rem;
        color: #666;
        line-height: 1.5;
    }

/* ========== GRID LAYOUTS ========== */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.grid-auto {
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.5rem 2rem;
    border-right: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
}

    .info-item:nth-child(2n) {
        border-right: none;
    }

    .info-item:last-child,
    .info-item:nth-last-child(2) {
        border-bottom: none;
    }

.info-label {
    font-size: 0.7rem;
    color: #999;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.info-value {
    font-size: 0.9rem;
    color: #333;
    font-weight: 500;
}

.info-item code {
    font-family: 'Courier New', monospace;
    background: #f8f8f8;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #333;
    word-break: break-all;
    border: 1px solid #e5e5e5;
}

/* ========== AVATARS & ICONS ========== */
.avatar {
    flex-shrink: 0;
}

.avatar-sm {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.avatar-md {
    width: 60px;
    height: 60px;
    border-radius: 8px;
}

.avatar-lg {
    width: 80px;
    height: 80px;
    border-radius: 12px;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    border-radius: inherit;
}

.avatar-sm .avatar-placeholder {
    font-size: 1rem;
}

.avatar-md .avatar-placeholder {
    font-size: 1.75rem;
}

.avatar-lg .avatar-placeholder {
    font-size: 2rem;
}

/* ========== BADGES & PILLS ========== */
.badge {
    padding: 0.35rem 0.85rem;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
}

.badge-success {
    background: #d1e7dd;
    color: #0a3622;
}

.badge-danger {
    background: #f8d7da;
    color: #58151c;
}

.badge-warning {
    background: #fff3cd;
    color: #664d03;
}

.badge-info {
    background: #cfe2ff;
    color: #084298;
}

.badge-muted {
    background: #e9ecef;
    color: #6c757d;
}

.count-badge {
    background: #e0e0e0;
    color: #555;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
}

/* ========== FORMS ========== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
    color: #1a1a1a;
}

    .form-control:focus {
        outline: none;
        border-color: #1a1a1a;
        box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.1);
    }

    .form-control:disabled {
        background-color: #f5f5f5;
        opacity: 0.6;
        cursor: not-allowed;
    }

.form-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: #6c757d;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-check {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    cursor: pointer;
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
    transition: background 0.2s;
}

    .form-check:hover {
        background: #f0f0f0;
    }

.form-check-input {
    width: 20px;
    height: 20px;
    cursor: pointer;
    margin-right: 0.75rem;
}

/* ========== ALERTS ========== */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ========== MODALS ========== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9998;
    backdrop-filter: blur(2px);
}

.modal-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 9999;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e5e5;
}

    .modal-header h2 {
        margin: 0;
        font-size: 1.25rem;
        color: #1a1a1a;
    }

.modal-body {
    padding: 1.5rem;
    max-height: calc(90vh - 180px);
    overflow-y: auto;
}

.btn-close {
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

    .btn-close:hover {
        color: #333;
    }


/* ========== MODAL FOOTER ========== */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid #e5e5e5;
    background: #fafafa;
}

    .modal-footer .btn {
        min-width: 120px;
        padding: 0.75rem 1.5rem;
    }

    /* Ensure primary button stands out */
    .modal-footer .btn-primary {
        background: #1a1a1a;
        color: #fff;
    }

        .modal-footer .btn-primary:hover {
            background: #000;
        }

    .modal-footer .btn-secondary {
        background: #fff;
        color: #333;
        border: 1px solid #ddd;
    }

        .modal-footer .btn-secondary:hover {
            background: #f5f5f5;
            border-color: #bbb;
        }


/* ========== LOADING & EMPTY STATES ========== */
.state-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.spinner {
    border: 4px solid #f0f0f0;
    border-top: 4px solid #1a1a1a;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

.spinner-sm {
    border: 2px solid #f3f3f3;
    border-top: 2px solid #1a1a1a;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.empty-state {
    background: #fafafa;
    border: 2px dashed #e0e0e0;
    border-radius: 12px;
    padding: 5rem 2rem;
}

.empty-icon {
    font-size: 5rem;
    margin-bottom: 1.5rem;
    opacity: 0.3;
}

.empty-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 0.5rem 0;
}

.empty-text {
    font-size: 1rem;
    color: #666;
    margin: 0 0 2rem 0;
    max-width: 500px;
}

/* ========== UTILITIES ========== */
.text-muted {
    color: #666 !important;
}

.text-primary {
    color: #1a1a1a !important;
}

.text-danger {
    color: #dc3545 !important;
}

.text-success {
    color: #28a745 !important;
}

.text-center {
    text-align: center;
}

.text-monospace {
    font-family: 'Courier New', monospace;
}

.d-block {
    display: block;
}

.d-flex {
    display: flex;
}

.d-none {
    display: none;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.gap-sm {
    gap: 0.5rem;
}

.gap-md {
    gap: 1rem;
}

.gap-lg {
    gap: 1.5rem;
}

/* ========== FOOTER ========== */
.app-footer {
    padding: 2rem 3rem;
    background: #ffffff;
    border-top: 1px solid #e5e5e5;
    text-align: center;
    color: #999;
    font-size: 0.875rem;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 992px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .info-item {
        border-right: none;
    }
}

@media (max-width: 768px) {
    .top-nav {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .nav-links {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }

    .main-content {
        padding: 1.5rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .header-content {
        flex-direction: column;
        gap: 1.5rem;
    }

    .header-title {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-actions {
        width: 100%;
    }

        .header-actions button {
            flex: 1;
        }

    .grid, .grid-2, .grid-3, .grid-4, .grid-auto {
        grid-template-columns: 1fr;
    }

    .list-item-horizontal {
        flex-direction: column;
    }

    .list-item-actions {
        flex-direction: column;
    }

    .list-group-item {
        flex-direction: column;
        gap: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }
}


/* ========== WORKFLOW STEP BUILDER ========== */
.workflow-step-card {
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.workflow-step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #f8f8f8;
    border-bottom: 1px solid #e5e5e5;
}

.workflow-step-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.workflow-step-card:hover {
    border-color: #6366f1;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
}

.btn-icon-only {
    background: transparent;
    border: 1px solid #ddd;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

    .btn-icon-only:hover {
        background: #f0f0f0;
        border-color: #999;
    }
/* ========== WORKFLOW STEP DETAILS (READ-ONLY) ========== */
.step-detail-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.step-detail-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #666;
    letter-spacing: 0.5px;
}

.step-detail-row code {
    background: #f0f0f0;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    width: fit-content;
}


/* ========== WORKFLOW FLOW DIAGRAM ========== */
.workflow-flow-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 2rem 0;
}

.workflow-step-block {
    width: 100%;
    max-width: 600px;
    border: 2px solid #e5e5e5;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
}

    .workflow-step-block:hover {
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        transform: translateY(-2px);
    }

.step-block-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(255,255,255,0.25);
    border-radius: 50%;
    font-size: 0.9rem;
    font-weight: 700;
}

.step-type-icon {
    font-size: 1.25rem;
}

.step-type-label {
    font-size: 0.95rem;
    letter-spacing: 0.3px;
}

.step-block-body {
    padding: 1.25rem;
    font-size: 0.95rem;
    line-height: 1.6;
}

    .step-block-body strong {
        color: #333;
        font-weight: 600;
    }

    .step-block-body .text-muted {
        color: #666;
        font-size: 0.85rem;
    }

/* Step Type Colors */
.step-collect .step-block-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.step-api .step-block-header {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.step-condition .step-block-header {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    color: #333;
}

.step-return .step-block-header {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #333;
}

.step-clear .step-block-header {
    background: linear-gradient(135deg, #d299c2 0%, #fef9d7 100%);
    color: #333;
}

.step-unknown .step-block-header {
    background: #f0f0f0;
    color: #666;
}

/* Workflow Arrow */
.workflow-arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0.5rem 0;
}

.arrow-line {
    width: 2px;
    height: 24px;
    background: linear-gradient(to bottom, #667eea, #764ba2);
}

.arrow-head {
    color: #764ba2;
    font-size: 1.5rem;
    line-height: 1;
    margin-top: -8px;
}






* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Loading & Empty States */
.loading-container, .empty-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 80vh;
    gap: 1rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e0e0e0;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Header Bar */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.workflow-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

    .workflow-info h1 {
        margin: 0;
        font-size: 1.25rem;
        font-weight: 600;
        color: #212529;
    }

.badge-active {
    background: #d1fae5;
    color: #065f46;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-inactive {
    background: #fee2e2;
    color: #991b1b;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

button {
    padding: 0.6rem 1.25rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.btn-back {
    background: white;
    color: #6c757d;
    border-color: #dee2e6;
}

    .btn-back:hover {
        background: #e9ecef;
    }

.btn-primary {
    background: #6366f1;
    color: white;
}

    .btn-primary:hover {
        background: #4f46e5;
    }

.btn-secondary {
    background: white;
    color: #6c757d;
    border-color: #dee2e6;
}

    .btn-secondary:hover {
        background: #e9ecef;
    }

.btn-success {
    background: #10b981;
    color: white;
}

    .btn-success:hover {
        background: #059669;
    }

    .btn-success:disabled {
        background: #d1d5db;
        cursor: not-allowed;
    }

/* Main Layout */
.main-layout {
    display: flex;
    height: calc(100vh - 70px);
    background: #ffffff;
}

/* Left Sidebar */
.sidebar-left {
    width: 260px;
    background: #f8f9fa;
    border-right: 1px solid #dee2e6;
    overflow-y: auto;
}

.sidebar-header {
    padding: 1.25rem;
    background: white;
    border-bottom: 1px solid #dee2e6;
}

    .sidebar-header h3 {
        margin: 0;
        font-size: 1rem;
        font-weight: 600;
        color: #212529;
    }

.node-category {
    padding: 1rem;
}

.category-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
    padding: 0 0.5rem;
}

.palette-node {
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    cursor: grab;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s;
}

    .palette-node:hover {
        border-color: #6366f1;
        transform: translateX(4px);
        box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
    }

    .palette-node:active {
        cursor: grabbing;
    }

.node-icon {
    font-size: 1.25rem;
}

/* Canvas Stage */
.canvas-stage {
    flex: 1;
    position: relative;
    overflow: auto;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.02) 1px, transparent 1px), linear-gradient(rgba(0, 0, 0, 0.02) 1px, transparent 1px);
    background-size: 40px 40px;
}

.connection-layer {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
}

.empty-stage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #6c757d;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-stage h3 {
    margin: 0 0 0.5rem 0;
    color: #212529;
}

.empty-stage p {
    margin: 0;
    font-size: 0.9rem;
}

/* Canvas Nodes */
.canvas-node {
    position: absolute;
    width: 200px;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

    .canvas-node:hover {
        border-color: #6366f1;
        box-shadow: 0 4px 16px rgba(99, 102, 241, 0.2);
        transform: translateY(-2px);
    }

    .canvas-node.selected {
        border-color: #6366f1;
        border-width: 3px;
        box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
    }

.node-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #212529;
}

.node-type-collect .node-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-bottom-color: transparent;
}

.node-type-api .node-header {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
    border-bottom-color: transparent;
}

.node-type-condition .node-header {
    background: linear-gradient(135deg, #fb923c, #f97316);
    color: white;
    border-bottom-color: transparent;
}

.node-type-return .node-header {
    background: linear-gradient(135deg, #4ade80, #22c55e);
    color: white;
    border-bottom-color: transparent;
}

.node-type-clear .node-header {
    background: linear-gradient(135deg, #a78bfa, #8b5cf6);
    color: white;
    border-bottom-color: transparent;
}

.node-number {
    width: 22px;
    height: 22px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.node-title {
    flex: 1;
}

.btn-delete-node {
    width: 24px;
    height: 24px;
    padding: 0;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

    .btn-delete-node:hover {
        background: rgba(239, 68, 68, 0.9);
    }

.node-body {
    padding: 0.75rem;
    font-size: 0.8rem;
    line-height: 1.5;
    color: #495057;
}

/* Right Sidebar */
.sidebar-right {
    width: 320px;
    background: #f8f9fa;
    border-left: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    line-height: 1;
    color: #6c757d;
    padding: 0;
    cursor: pointer;
}

    .btn-close:hover {
        color: #212529;
    }

.properties-form {
    padding: 1.25rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

    .form-group label {
        display: block;
        font-size: 0.8rem;
        font-weight: 600;
        color: #495057;
        margin-bottom: 0.5rem;
    }

.form-input {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: inherit;
}

    .form-input:focus {
        outline: none;
        border-color: #6366f1;
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    }

.readonly-field {
    background: #e9ecef;
    padding: 0.6rem;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #495057;
}

.info-box {
    background: #e7f3ff;
    border-left: 4px solid #3b82f6;
    padding: 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #1e40af;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-box {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    border-bottom: 1px solid #dee2e6;
}

    .modal-header h3 {
        margin: 0;
        font-size: 1.1rem;
        font-weight: 600;
    }

.modal-body {
    padding: 1.25rem;
    overflow: auto;
    flex: 1;
}

    .modal-body pre {
        margin: 0;
        background: #f8f9fa;
        padding: 1rem;
        border-radius: 4px;
        font-size: 0.85rem;
        overflow-x: auto;
    }
.canvas-node.dragging {
    opacity: 0.5;
    cursor: grabbing !important;
}

/* ========== STANDARD MODAL OVERLAY & PANEL ========== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55); /* dark translucent overlay */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

/* Main popup block */
.modal-panel {
    width: 100%;
    max-width: 520px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header: title + close button */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
}

    .modal-header h2 {
        margin: 0;
        font-size: 1.25rem;
        font-weight: 600;
        color: #111827;
    }

/* Close icon button */
.btn-icon {
    border: none;
    background: transparent;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    color: #6b7280;
    transition: background 0.15s, color 0.15s, transform 0.15s;
}

    .btn-icon:hover {
        background: #e5e7eb;
        color: #111827;
        transform: translateY(-1px);
    }

/* Body content */
.modal-body {
    padding: 1.5rem;
    background: #ffffff;
}

/* Footer buttons */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem 1.25rem 1.5rem;
    border-top: 1px solid #f3f4f6;
    background: #fafafa;
}

/* Form layout inside modals */
.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

    .form-group label {
        font-size: 0.85rem;
        font-weight: 500;
        color: #4b5563;
    }

    .form-control,
    .form-group input[type="text"],
    .form-group input[type="email"],
    .form-group input[type="password"] {
        border-radius: 8px;
        border: 1px solid #d1d5db;
        padding: 0.6rem 0.75rem;
        font-size: 0.95rem;
        outline: none;
        transition: border-color 0.15s, box-shadow 0.15s;
        background: #ffffff;
    }

        .form-control:focus,
        .form-group input:focus {
            border-color: #111827;
            box-shadow: 0 0 0 1px #1118270f;
        }

/* Checkbox group */
.form-check {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.form-check-label {
    font-size: 0.9rem;
    color: #374151;
}

/* Small screens */
@media (max-width: 640px) {
    .modal-panel {
        margin: 0 1rem;
        max-width: 100%;
    }
}
/* ========== AUTH PAGES ========== */

.auth-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
    background: #ffffff;
}

.auth-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem;
    max-width: 480px;
    margin: 0 auto;
}

.auth-header {
    margin-bottom: 3rem;
}

.auth-logo {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2rem;
}

.auth-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.auth-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 0.95rem;
    background: #f9fafb;
    transition: all 0.2s;
}

    .auth-input:focus {
        outline: none;
        border-color: #667eea;
        background: #ffffff;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    }

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6b7280;
    cursor: pointer;
}

    .checkbox-label input[type="checkbox"] {
        width: 18px;
        height: 18px;
        cursor: pointer;
    }

.link-primary {
    color: #667eea;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s;
}

    .link-primary:hover {
        color: #5568d3;
    }

.btn-auth-primary {
    width: 100%;
    padding: 0.875rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

    .btn-auth-primary:hover:not(:disabled) {
        transform: translateY(-2px);
        box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
    }

    .btn-auth-primary:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

.auth-footer {
    text-align: center;
    font-size: 0.9rem;
    color: #6b7280;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.alert-error {
    padding: 0.875rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
    font-size: 0.9rem;
}

.alert-success {
    padding: 0.875rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    color: #16a34a;
    font-size: 0.9rem;
}

/* Right decoration panel */
.auth-decoration {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}

    .auth-decoration h1 {
        font-size: 3.5rem;
        font-weight: 700;
        color: #ffffff;
        line-height: 1.2;
        z-index: 1;
    }

/* Responsive */
@media (max-width: 1024px) {
    .auth-container {
        grid-template-columns: 1fr;
    }

    .auth-decoration {
        display: none;
    }

    .auth-card {
        max-width: 100%;
        padding: 2rem;
    }
}



/* ========== STATS GRID ========== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s;
}

    .stat-card:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        transform: translateY(-2px);
    }

.stat-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.stat-content h3 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 0.25rem 0;
    color: #1a1a1a;
}

.stat-content p {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
}






/* ===== HOME / HERO AS PART OF PAGE ===== */

.app-root {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Hero now uses the page background directly, no inner card */
.hero {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5rem 1.5rem 3rem;
    background: radial-gradient(circle at top left, rgba(99, 102, 241, 0.12), transparent 55%), radial-gradient(circle at bottom right, rgba(56, 189, 248, 0.12), transparent 60%), #f9fafb;
}

.hero-inner {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    text-align: center;
}

/* Title + subtitle */

.hero-title {
    font-size: clamp(2.7rem, 5vw, 3.4rem);
    font-weight: 700;
    letter-spacing: -0.05em;
    color: #020617;
    margin-bottom: 0.8rem;
}

    .hero-title span {
        font-style: italic;
        color: #111827;
    }

.hero-subtitle {
    font-size: 0.98rem;
    color: #6b7280;
    max-width: 460px;
    margin: 0 auto 2.4rem;
}

/* Prompt bar */

.hero-panel {
    max-width: 680px;
    margin: 0 auto;
    padding: 0.9rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid #e5e7eb;
    box-shadow: 0 22px 55px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(16px);
}

.hero-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 0.75rem;
}

.hero-input-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 1rem;
    border-radius: 999px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
}

.hero-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.98rem;
    color: #0f172a;
}

    .hero-input::placeholder {
        color: #9ca3af;
    }

.hero-submit {
    border: none;
    outline: none;
    cursor: pointer;
    padding: 0.7rem 1.7rem;
    border-radius: 999px;
    background: #020617;
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

    .hero-submit span {
        font-size: 1.1rem;
        transform: translateY(1px);
    }

    .hero-submit:hover {
        background: #020617;
        transform: translateY(-1px);
        box-shadow: 0 14px 32px rgba(15, 23, 42, 0.4);
    }

.hero-footnote {
    margin-top: 1.5rem;
    font-size: 0.82rem;
    color: #9ca3af;
}

/* ===== CAPABILITIES SECTION UNDER HERO ===== */

.hero-capabilities {
    padding: 2.5rem 1.75rem 4rem;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
}

.hero-capabilities-title {
    text-align: center;
    font-size: 1.4rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 0.5rem;
}

.hero-capabilities-subtitle {
    text-align: center;
    font-size: 0.95rem;
    color: #6b7280;
    max-width: 520px;
    margin: 0 auto 2rem;
}

.hero-capabilities-grid {
    max-width: 960px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
}

.hero-capability {
    padding: 1.4rem 1.3rem;
    border-radius: 1rem;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

    .hero-capability h3 {
        margin: 0 0 0.5rem;
        font-size: 1rem;
        font-weight: 600;
        color: #111827;
    }

    .hero-capability p {
        margin: 0;
        font-size: 0.9rem;
        color: #6b7280;
        line-height: 1.6;
    }

/* Responsive */

@media (max-width: 900px) {
    .hero {
        padding: 4rem 1.5rem 3rem;
    }

    .hero-panel {
        border-radius: 1.2rem;
    }

    .hero-form {
        grid-template-columns: 1fr;
        row-gap: 0.75rem;
    }

    .hero-submit {
        width: 100%;
        justify-content: center;
    }

    .hero-capabilities-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .hero-title {
        font-size: 2.2rem;
    }
}
