 :root {
            --primary-bg: #ffffff;          
            --secondary-bg: #f3f4f6;     
            --accent-color: #3b5bdb;      
            --text-primary: #111827;      
            --text-secondary: #6b7280;    
            --border-color: #d1d5db;     
            --hover-bg: #e5e7eb;        
            --bright-hover: #101010;      
            --success-color: #059669;     
            --error-color: #dc2626;         
            --warning-color: #d97706;      
        }
        .overlay {
            position: absolute;
            inset: 0;
            background: rgba(0, 0, 0, 0.7);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 10;
            pointer-events: all;
        }
        .spinner2 {
            width: 60px;
            height: 60px;
            border: 7px solid rgb(255 255 255 / 37%);
            border-top: 7px solid var(--accent-color);
            border-radius: 50%;
            animation: spin 0.6s linear infinite;
            flex-shrink: 0;
        }
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
            background: var(--accent-color);
            color: var(--text-primary);
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 50px;
        }

        .container {
            display: flex;
            width: 100%;
            max-width: 1150px;
            background: var(--accent-color);
            border-radius: 8px;
            overflow: hidden;
            min-height: 600px;
            margin-right: auto;
            margin-left: auto;
            padding-right: 100px;
            display: none
        }
        .auth-section {
            flex: 1;
            padding: 60px 40px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            background: var(--primary-bg);
            border-radius: 8px;
            box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
            max-width: 400px;
            position: relative;
        }

        .auth-form {
            width: 100%;
            max-width: 400px;
        }

        .form-container {
            position: relative;
            width: 100%;
            overflow: hidden;
            transition: height 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        }

        .form-slide {
            width: 100%;
            transition: opacity 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
            position: absolute;
            top: 0;
            left: 0;
            opacity: 0;
            pointer-events: none;
            z-index: 1;
        }

        .form-slide.active {
            opacity: 1;
            position: relative;
            pointer-events: auto;
            z-index: 10;
        }

        .form-slide.slide-out {
            opacity: 0;
            pointer-events: none;
        }


        .welcome-section {
            flex: 1;
            background: var(--accent-color);
            color: var(--text-primary);
            padding: 60px 40px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: left;
            text-align: left;
        }

        .auth-title {
            font-size: 24px;
            font-weight: 600;
            margin-bottom: 8px;
            text-align: center;
            color: var(--text-primary);
        }

        .auth-subtitle {
            font-size: 14px;
            color: var(--text-secondary);
            text-align: center;
            margin-bottom: 40px;
        }

        .form-group {
            margin-bottom: 20px;
            position: relative;
        }

        .form-input {
            width: 100%;
            padding: 15px 20px 15px 50px;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            font-size: 14px;
            background: var(--secondary-bg);
            color: var(--text-primary);
            outline: none;
            transition: all 0.2s ease;
        }

        .form-input:focus {
            border-color: var(--accent-color);
            box-shadow: 0 0 0 2px rgba(93, 124, 255, 0.2);
        }

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

        .form-input.error {
            border-color: var(--error-color);
            box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
        }

        .input-icon {
            position: absolute;
            left: 18px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-secondary);
            font-size: 16px;
        }

        .password-toggle {
            position: absolute;
            right: 18px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--accent-color);
            cursor: pointer;
            font-size: 16px;
        }

        .auth-btn, .google-btn, .apple-btn {
            width: 100%;
            padding: 15px;
            background: var(--accent-color);
            color: white;
            border: none;
            border-radius: 6px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            margin-bottom: 20px;
        }

        .auth-btn:hover, .google-btn:hover, .apple-btn:hover {
            background: #4a6aff;
            box-shadow: 0 6px 16px rgba(93, 124, 255, 0.4);
        }

        .auth-btn:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }

        .switch-link {
            text-align: center;
            margin-bottom: 20px;
            color: var(--text-secondary);
            font-size: 14px;
        }

        .switch-link a {
            color: var(--accent-color);
            text-decoration: none;
            cursor: pointer;
        }

        .switch-link a:hover {
            text-decoration: underline;
        }

        .forgot-password {
            text-align: right;
            margin-top: -10px;
            margin-bottom: 20px;
        }

        .forgot-password a {
            color: var(--accent-color);
            text-decoration: none;
            font-size: 12px;
        }

        .forgot-password a:hover {
            text-decoration: underline;
        }

        .back-to-login {
            text-align: center;
            margin-top: 20px;
        }

        .back-to-login a {
            color: var(--accent-color);
            text-decoration: none;
            font-size: 14px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 5px;
        }

        .back-to-login a:hover {
            text-decoration: underline;
        }

        .divider {
            text-align: center;
            margin: 20px 0;
            color: var(--text-secondary);
            position: relative;
            font-size: 14px;
        }

        .divider::before,
        .divider::after {
            content: '';
            position: absolute;
            top: 50%;
            width: 40%;
            height: 1px;
            background: var(--border-color);
        }

        .divider::before {
            left: 0;
        }

        .divider::after {
            right: 0;
        }

        .social-btn {
            width: 100%;
            padding: 15px;
            margin-bottom: 10px;
            border-radius: 6px;
            background: var(--accent-color);
            color: white;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            border: none;
        }

        .terms {
            text-align: center;
            font-size: 12px;
            color: var(--text-secondary);
            margin-top: 20px;
        }

        .terms a {
            color: var(--accent-color);
            text-decoration: none;
        }

        .welcome-title {
            font-size: 28px;
            font-weight: 700;
            margin-bottom: 20px;
        }

        .welcome-subtitle {
            font-size: 16px;
            margin-bottom: 40px;
            opacity: 0.9;
        }

        .company-logos {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 20px;
            width: 100%;
            opacity: 0.8;
        }

        .company-logo {
            background: transparent;
            text-align: center;
            display: flex;
            align-items: center;
            justify-content: center;
            min-height: 80px;
            transition: all 0.3s ease;
        }

        .company-logo:hover {
            transform: translateY(-2px);
        }

        .company-logo img {
            max-height: 60px;
            max-width: 100%;
            filter: brightness(0) invert(1);
            transition: all 0.3s ease;
            opacity: 0.9;
        }

        .company-logo:hover img {
            opacity: 1;
            transform: scale(1.05);
        }

        .company-logo.ams img {
            max-height: 25px;
        }

        .company-logo.custom-powder img,
        .company-logo.littlebrothers img,
        .company-logo.enviro-clean img,
        .company-logo.sycodal img,
        .company-logo.ics img {
            max-height: 50px;
        }

        .reset-info {
            background: var(--secondary-bg);
            border: 1px solid var(--border-color);
            border-radius: 6px;
            padding: 15px;
            margin-bottom: 20px;
            font-size: 14px;
            color: var(--text-secondary);
            text-align: center;
        }

        .reset-info i {
            color: var(--accent-color);
            margin-right: 8px;
        }

        /* Error Message Styles */
        .error-message {
            background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.05));
            border: 1px solid var(--error-color);
            border-radius: 6px;
            padding: 12px 16px;
            margin-bottom: 20px;
            font-size: 13px;
            color: var(--error-color);
            display: none;
            animation: errorSlideIn 0.3s ease-out;
        }

        .error-message.show {
            display: block;
        }

        .error-message i {
            margin-right: 8px;
        }

        .success-message {
            background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
            border: 1px solid var(--success-color);
            border-radius: 6px;
            padding: 12px 16px;
            margin-bottom: 20px;
            font-size: 13px;
            color: var(--success-color);
            display: none;
            animation: errorSlideIn 0.3s ease-out;
        }

        .success-message.show {
            display: block;
        }

        .success-message i {
            margin-right: 8px;
        }

        @keyframes errorSlideIn {
            from {
                opacity: 0;
                transform: translateY(-10px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .loading-spinner {
            border: 2px solid transparent;
            border-top: 2px solid currentColor;
            border-radius: 50%;
            width: 16px;
            height: 16px;
            animation: spin 1s linear infinite;
            margin-right: 8px;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        @media (max-width: 768px) {
            .container {
                flex-direction: column;
                margin: 0;
                padding-right: 0;
            }
            
            .auth-section {
                flex: none;
                border-radius: 8px 8px 0 0;
                padding: 40px 30px;
                max-width: none;
            }

            .welcome-section {
                border-left: none;
                border-top: 1px solid var(--border-color);
                padding: 40px 30px;
            }

            .company-logos {
                grid-template-columns: repeat(2, 1fr);
            }
            .connect-form {
                margin-top: 30px !important;
            }
            #logoutBtn {
                margin-top: 23px !important;
            }
        }

        /* Sticky Header */
        
        /* Sticky Header */
        .sticky-header {
            position: sticky;
            top: 0;
            left: 0;
            right: 0;
            background: var(--primary-bg);
            border-bottom: 1px solid var(--border-color);
            padding: 20px 0;
            z-index: 100;
            backdrop-filter: blur(10px);
        }

        .crm-title {
            font-size: 24px;
            font-weight: 700;
            color: var(--text-primary);
            text-align: center;
        }

        /* CRM Integrations Container */
        .crm-container {
            padding: 40px 60px;
            background: var(--primary-bg);
            min-height: 600px;
            height: calc(100vh - 200px);
            overflow: scroll;
        }

        .crm-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
            gap: 20px;
            margin: 0 auto;
        }

        .crm-card {
            background: var(--secondary-bg);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            overflow: hidden;
            transition: all 0.3s ease;
            position: relative;
            display: flex;
            flex-direction: column;
        }


        .crm-logo {
            width: 100%;
            background: white;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
            overflow: hidden;
        }

        .crm-logo img {
            width: 100%;
            height: 100%;
            object-fit: contain;
        }

        .crm-info {
            padding: 16px;
            flex-grow: 1;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
        }

        .crm-name {
            font-size: 16px;
            font-weight: 600;
            margin-bottom: 12px;
            color: var(--text-primary);
        }

        .connect-btn {
            width: 100%;
            padding: 10px 16px;
            background: var(--bright-hover);
            color: white;
            border: none;
            border-radius: 6px;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
        }

        .connect-btn:hover {
            background: #4a6aff;
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(93, 124, 255, 0.3);
        }
        #logoutBtn:hover {
            color: rgb(223, 223, 223) !important;
        }

        .connect-btn:active {
            transform: translateY(0);
        }

.api-key-info {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.api-key-info i {
    color: var(--accent-color);
    flex-shrink: 0;
}

.api-key-help {
    text-align: center;
    margin-top: -10px;
    margin-bottom: 20px;
}

.api-key-help a {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.api-key-help a:hover {
    text-decoration: underline;
    color: #4a6aff;
}

.api-key-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.api-submit-btn {
    background: var(--success-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.api-submit-btn:hover {
    background: #059669;
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.api-cancel-btn {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.api-cancel-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
    border-color: var(--accent-color);
    box-shadow: 0 4px 12px rgba(93, 124, 255, 0.2);
}

.api-submit-btn:disabled,
.api-cancel-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}


/* Mobile responsiveness for API key form */
@media (max-width: 768px) {
    .api-key-actions {
        gap: 10px;
    }
    
    .api-key-help a {
        font-size: 12px;
    }
    
    .api-key-info {
        padding: 12px;
        font-size: 13px;
    }
}

        @media (max-width: 768px) {
            .container {
                flex-direction: column;
                margin: 0;
                padding-right: 0;
                max-width: none;
            }
            
            .auth-section {
                flex: none;
                border-radius: 8px 8px 0 0;
                padding: 40px 30px;
                max-width: none;
            }

            .welcome-section {
                border-left: none;
                border-top: 1px solid var(--border-color);
                padding: 40px 30px;
                display: none !important
            }
  


            .crm-logo {
                height: 120px;
            }

            .crm-info {
                padding: 12px;
            }
        }

        @media (max-width: 480px) {
            body {
                padding: 10px;
            }

            .crm-container {
                padding: 20px 20px;
            }

            .crm-title {
                font-size: 18px;
            }

            .sticky-header {
                padding: 15px 0;
            }

            .crm-grid {
                grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
                gap: 12px;
            }


            .crm-logo {
                height: 100%;
            }

        }