* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    overflow: hidden;
    background: #d7d6d3c4;
    color: #242424;
    font-family: Helvetica, Arial, sans-serif;
}

.app {
    width: min(900px, calc(100% - 48px));
    height: 100dvh;
    margin: 0 auto;

    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
}

/* HEADER */

.app-header {
    padding: 28px 0 18px;
    box-shadow: 0 8px 16px -16px rgba(0, 0, 0, 0.35);
}

h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 600;
}

.subtitle {
    margin: 6px 0 0;
    font-size: 14px;
    color: rgba(36, 36, 36, 0.55);
}

/* CHAT */

.chat-area {
    min-height: 0;
    overflow-y: auto;
    padding: 28px 4px 24px 0;
    scrollbar-gutter: stable;
}

#chat {
    display: flex;
    flex-direction: column;
    gap: 34px;
}

.message {
    width: 55%;
}

.user-message {
    align-self: flex-end;
    text-align: right;
}

.agent-message {
    align-self: flex-start;
}

.message-label {
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 700;
}

.user-message .message-label {
    color: #927878;
}

.agent-message .message-label {
    color: #000280;
}

.message-content {
    font-size: 17px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.message-content h2 {
    margin: 0 0 14px;
    font-size: 19px;
    line-height: 1.3;
    font-weight: 600;
}

.message-content p:first-child {
    margin-top: 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content li {
    margin-bottom: 8px;
}

.message-end {
    height: 3px;
    margin-top: 14px;
}

.user-message .message-end {
    background: linear-gradient(
        270deg,
        rgba(93, 66, 66, 0.587) 0%,
        rgba(93, 66, 66, 0.587) 8%,
        rgba(93, 66, 66, 0.587) 20%,
        transparent 40%
    );
}

.agent-message .message-end {
    background: linear-gradient(
        90deg,
        rgba(0, 2, 128, 0.9) 0%,
        rgba(0, 2, 128, 0.9) 8%,
        rgba(0, 2, 128, 0.9) 20%,
        transparent 40%
    );
}

/* AGENT WORKING */

#status {
    width: 55%;
    margin-top: 26px;
    font-size: 14px;
    color: rgba(0, 2, 128, 0.7);
}

#status:empty {
    display: none;
}

.typing-label {
    margin-bottom: 10px;
    color: #000280;
    font-size: 14px;
    font-weight: 700;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 18px;
}

.typing-indicator span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(0, 2, 128, 0.65);

    animation: typing 1.2s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes typing {
    0%,
    60%,
    100% {
        opacity: 0.25;
        transform: translateY(0);
    }

    30% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

/* COMPOSER */

#chat-form {
    display: flex;
    align-items: flex-end;
    gap: 12px;

    margin: 18px 0 24px;
    padding: 14px;

    background: white;
    border-radius: 14px;

    box-shadow:
        0 4px 18px rgba(0, 0, 0, 0.06),
        0 1px 3px rgba(0, 0, 0, 0.04);
}

textarea {
    flex: 1;

    min-height: 60px;
    max-height: 180px;

    padding: 10px;

    border: none;
    outline: none;
    resize: vertical;

    background: transparent;

    font: inherit;
    font-size: 16px;
    line-height: 1.5;
}

textarea::placeholder {
    color: #aaa;
}

button {
    padding: 11px 20px;

    border: none;
    border-radius: 9px;

    background: rgba(0, 2, 128, 0.7);
    color: white;

    font: inherit;
    font-size: 15px;

    cursor: pointer;
}

button:hover {
    background: rgba(0, 2, 128, 1);
}

button:disabled {
    opacity: 0.45;
    cursor: default;
}

/* MOBILE */

@media (max-width: 650px) {
    .app {
        width: min(100% - 28px, 900px);
    }

    .app-header {
        padding-top: 22px;
    }

    h1 {
        font-size: 25px;
    }

    .chat-area {
        padding-top: 22px;
    }

    .message,
    #status {
        width: 92%;
    }

    #chat-form {
        margin-bottom: 14px;
    }
}
