* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f3f5f7;
    font-family: Arial, Helvetica, sans-serif;
    color: #1f2937;
}

.container {
    width: 900px;
    max-width: 95%;
    margin: 30px auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

header {
    background: #002147;
    color: white;
    text-align: center;
    padding: 28px 20px;
}

header h1 {
    margin: 0;
    font-size: 32px;
}

header p {
    margin: 12px 0 0;
    opacity: 0.9;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px 20px 0;
}

.quick-action {
    width: auto;
    margin: 0;
    padding: 10px 16px;
    border: 1px solid #002147;
    border-radius: 20px;
    background: white;
    color: #002147;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.quick-action:hover {
    background: #002147;
    color: white;
}

#chat-box {
    height: 430px;
    overflow-y: auto;
    padding: 20px;
    scroll-behavior: smooth;
}

.message {
    max-width: 85%;
    margin-bottom: 15px;
    padding: 12px 14px;
    border-radius: 10px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.user {
    margin-left: auto;
    background: #dceeff;
    text-align: right;
    white-space: pre-wrap;
}

.ai {
    margin-right: auto;
    background: #f0f0f0;
}

.ai-heading {
    margin-top: 14px;
    margin-bottom: 8px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #002147;
}

.ai-spacing {
    height: 8px;
}

.message.ai ol,
.message.ai ul {
    margin-top: 8px;
    margin-bottom: 10px;
    padding-left: 28px;
}

.message.ai li {
    margin-bottom: 5px;
}

.message.ai strong {
    font-weight: 700;
}

.message.ai a {
    color: #0057c2;
    text-decoration: underline;
    overflow-wrap: anywhere;
}

.message.ai a:hover {
    text-decoration: none;
}

.lead-form-container {
    margin: 15px 20px;
    padding: 20px;
    border: 1px solid #d5dbe3;
    border-radius: 12px;
    background: #f8fafc;
}

.hidden {
    display: none;
}

.lead-form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.lead-form-header h2 {
    margin: 0;
    font-size: 20px;
    color: #002147;
}

#close-lead-form {
    width: auto;
    margin: 0;
    padding: 2px 10px;
    border: 0;
    background: transparent;
    color: #333;
    font-size: 28px;
    cursor: pointer;
}

#lead-form {
    display: grid;
    gap: 10px;
}

#lead-form label {
    font-weight: 600;
}

#lead-form input,
#lead-form select,
#lead-form textarea {
    width: 100%;
    padding: 11px;
    border: 1px solid #aeb7c2;
    border-radius: 6px;
    background: white;
    font: inherit;
}

#lead-form textarea {
    resize: vertical;
}

#lead-form input:focus,
#lead-form select:focus,
#lead-form textarea:focus,
#message:focus {
    outline: 2px solid #7db8f0;
    outline-offset: 1px;
    border-color: #4f92cf;
}

#submit-lead {
    width: 100%;
    margin: 8px 0 0;
    padding: 12px;
    border: 0;
    border-radius: 6px;
    background: #002147;
    color: white;
    font-weight: 700;
    cursor: pointer;
}

#submit-lead:hover {
    background: #00356f;
}

#submit-lead:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.lead-form-status {
    min-height: 20px;
    font-size: 14px;
}

.lead-form-status.success {
    color: #176b32;
}

.lead-form-status.error {
    color: #b42318;
}

.input-area {
    display: flex;
    gap: 10px;
    padding: 15px;
    border-top: 1px solid #ddd;
    background: white;
}

#message {
    flex: 1;
    min-width: 0;
    padding: 12px;
    border: 1px solid #777;
    font-size: 16px;
}

#send {
    width: 120px;
    margin: 0;
    border: 1px solid #777;
    background: #f4f4f4;
    cursor: pointer;
}

#send:hover {
    background: #e5e7eb;
}

#send:disabled,
#message:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

@media (max-width: 700px) {
    .container {
        max-width: 100%;
        margin: 0;
        min-height: 100vh;
        border-radius: 0;
    }

    header {
        padding: 22px 15px;
    }

    header h1 {
        font-size: 26px;
    }

    #chat-box {
        height: 380px;
        padding: 14px;
    }

    .quick-actions {
        padding: 12px 12px 0;
    }

    .quick-action {
        flex: 1 1 140px;
    }

    .lead-form-container {
        margin: 12px;
        padding: 16px;
    }

    .input-area {
        padding: 12px;
        gap: 8px;
    }

    #send {
        width: 90px;
    }

    .message {
        max-width: 92%;
    }
}

@media (max-width: 480px) {
    .input-area {
        flex-direction: column;
    }

    #send {
        width: 100%;
        min-height: 44px;
    }

    #message {
        width: 100%;
    }

    .quick-action {
        flex: 1 1 100%;
        text-align: center;
    }

    #chat-box {
        height: 360px;
    }
}