* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: Arial, Helvetica, sans-serif;
    background: #f3f5f7;
    color: #1f2933;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 24px;
}

.chat-shell {
    width: min(900px, 100%);
    height: min(760px, calc(100vh - 48px));
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid #d9e0e6;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
}

.chat-header {
    padding: 18px 22px;
    border-bottom: 1px solid #d9e0e6;
}

.chat-header h1 {
    margin: 0;
    font-size: 1.2rem;
}

.chat-header p {
    margin: 5px 0 0;
    font-size: 0.9rem;
    color: #64707d;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mensagem {
    max-width: 78%;
    padding: 11px 14px;
    border-radius: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.mensagem.assistente {
    align-self: flex-start;
    background: #eef2f5;
    border-bottom-left-radius: 4px;
}

.mensagem.usuario {
    align-self: flex-end;
    background: #dce9f7;
    border-bottom-right-radius: 4px;
}

.mensagem.sistema {
    align-self: center;
    max-width: 90%;
    font-size: 0.9rem;
    color: #65717d;
    background: transparent;
    text-align: center;
}

.chat-input-area {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    padding: 16px;
    border-top: 1px solid #d9e0e6;
    background: #fafbfc;
}

#campoMensagem {
    flex: 1;
    resize: none;
    min-height: 48px;
    max-height: 140px;
    padding: 12px;
    border: 1px solid #c8d0d8;
    border-radius: 10px;
    font: inherit;
    line-height: 1.4;
}

#campoMensagem:focus {
    outline: 2px solid #9ab8d8;
    outline-offset: 1px;
}

#botaoEnviar {
    height: 48px;
    padding: 0 20px;
    border: 0;
    border-radius: 10px;
    background: #253b53;
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

#botaoEnviar:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

@media (max-width: 640px) {
    body {
        padding: 0;
    }

    .chat-shell {
        width: 100%;
        height: 100vh;
        border: 0;
        border-radius: 0;
    }

    .mensagem {
        max-width: 88%;
    }
}
