:root {
    /* your exact brand color: rgb(80, 113, 184) */
    --brand: #5071B8;
    --muted: #f1f5f9;
    --text: #111827;
    --bg: #ffffff;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
}

/* Root: fills the iframe height perfectly */
.chat {
    min-height: 100%;
    height: 100dvh; /* mobile-friendly viewport */
    display: flex;
    flex-direction: column;
    background: linear-gradient(to bottom, #ffffff, #f3f4f6);
}

/* Header */
.chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--brand);
    color: #fff;
    height: 52px;
    min-height: 52px;
    flex: 0 0 52px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.35);
}

    /* Logo in header */
    .chat-header .logo {
        width: 28px;
        height: 28px;
        border-radius: 50%;
        background: #fff;
        object-fit: cover;
        flex-shrink: 0;
    }

    /* Title + subtitle wrapper */
    .chat-header .header-text {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .chat-header .title {
        font-weight: 600;
        font-size: 15px;
    }

    .chat-header .subtitle {
        font-size: 12px;
        opacity: 0.9;
    }

/* Scroll area */
#messages {
    flex: 1 1 auto;
    overflow: auto;
    padding: 12px;
    -webkit-overflow-scrolling: touch;
    background: #f9fafb;
}

/* Message rows */
.chat-message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin: 8px 0;
}

    .chat-message.user {
        justify-content: flex-end;
    }

    .chat-message.bot {
        justify-content: flex-start;
    }


.avatar {
    width: 28px;
    height: 28px;
    overflow: hidden;
    border-radius: 4px; 
    background: transparent;
}


    .avatar img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }


/* Message bubble */
.message-text {
    max-width: 80%;
    padding: 10px 12px;
    border-radius: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-word;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
    font-size: 14px;
}

.user .message-text {
    background: var(--brand);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.bot .message-text {
    background: var(--muted);
    color: var(--text);
    border-bottom-left-radius: 4px;
}

/* Composer */
.composer {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #e5e7eb;
    flex: 0 0 auto;
    background: #ffffffcc;
    backdrop-filter: blur(4px);
}

#user-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    outline: none;
    font-size: 16px;
}

    #user-input:focus {
        border-color: var(--brand);
        box-shadow: 0 0 0 1px rgba(80, 113, 184, 0.25);
    }

#send-btn {
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0 16px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

    #send-btn:hover:not(:disabled) {
        filter: brightness(0.95);
        transform: translateY(-1px);
    }

    #send-btn:disabled {
        opacity: 0.7;
        cursor: default;
        box-shadow: none;
    }

.chat-header .header-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-header .title {
    font-weight: 600;
    font-size: 15px;
}

.chat-header .subtitle {
    font-size: 12px;
    opacity: 0.9;
}

/* Hardening: avoid external styles collapsing elements */
img, iframe, canvas, video {
    max-width: none;
}
