:root {
    color-scheme: dark;
    font-family: Arial, Helvetica, sans-serif;
    background: #202123;
    color: #ececf1;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: #343541;
}

button,
textarea {
    font: inherit;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px 1fr;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 14px;
    background: #202123;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
    font-weight: 700;
    font-size: 20px;
}

.new-chat,
.conversation-item {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    background: transparent;
    color: inherit;
    text-align: right;
    padding: 12px;
    cursor: pointer;
}

.new-chat:hover,
.conversation-item:hover,
.conversation-item.active {
    background: rgba(255, 255, 255, 0.07);
}

.conversation-list {
    flex: 1;
}

.conversation-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.conversation-item small,
.sidebar-footer,
.topbar span,
.composer-note {
    color: #a7a7b0;
}

.chat-layout {
    min-width: 0;
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
}

.topbar {
    min-height: 64px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(52, 53, 65, 0.92);
    position: sticky;
    top: 0;
    z-index: 2;
}

.topbar div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.menu-button {
    display: none;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 24px;
    cursor: pointer;
}

.messages {
    width: min(860px, 100%);
    margin: 0 auto;
    padding: 28px 18px 180px;
}

.message {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: #10a37f;
    color: white;
    font-size: 12px;
    font-weight: 700;
}

.user-message .avatar {
    background: #6f6f81;
}

.message-content {
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.message-content p {
    margin: 4px 0;
}

.agent-event {
    margin: 10px 0 14px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.045);
}

.agent-event strong,
.agent-event span {
    display: block;
}

.agent-event span {
    margin-top: 5px;
    color: #c5c5cd;
}

.composer-wrap {
    position: fixed;
    right: 260px;
    left: 0;
    bottom: 0;
    padding: 22px 18px 12px;
    background: linear-gradient(180deg, rgba(52, 53, 65, 0), #343541 35%);
}

.composer {
    width: min(820px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 16px;
    background: #40414f;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1), 0 8px 28px rgba(0, 0, 0, 0.28);
}

.composer textarea {
    width: 100%;
    max-height: 180px;
    resize: none;
    border: 0;
    outline: 0;
    background: transparent;
    color: inherit;
    line-height: 1.5;
    padding: 8px;
}

.composer button {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 10px;
    background: #10a37f;
    color: white;
    font-size: 22px;
    cursor: pointer;
}

.composer button:disabled {
    opacity: 0.55;
    cursor: wait;
}

.composer-note {
    margin: 8px auto 0;
    width: min(820px, 100%);
    text-align: center;
    font-size: 12px;
}

@media (max-width: 760px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(84vw, 300px);
        transform: translateX(-102%);
        transition: transform 160ms ease;
        z-index: 20;
        box-shadow: 16px 0 40px rgba(0, 0, 0, 0.42);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .menu-button {
        display: inline-block;
    }

    .composer-wrap {
        right: 0;
    }

    .messages {
        padding-inline: 14px;
    }
}
