.tb-chat {
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 480px;
    overflow: hidden;
    color: #20242c;
    background: #f5f7fb;
    font-family: "Segoe UI", Arial, sans-serif;
}

.tb-chat.is-busy {
    cursor: progress;
}

.tb-chat__sidebar {
    display: flex;
    flex: 0 0 270px;
    flex-direction: column;
    min-width: 220px;
    border-right: 1px solid #d8dee7;
    background: #fff;
}

.tb-chat__sidebar-header {
    padding: 14px 16px 10px;
    border-bottom: 1px solid #e4e8ee;
}

.tb-chat__sidebar-header h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.tb-chat__conversation-list {
    flex: 1 1 auto;
    overflow-y: auto;
}

.tb-chat__conversation {
    display: block;
    width: 100%;
    padding: 11px 14px;
    border: 0;
    border-bottom: 1px solid #edf0f4;
    color: inherit;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.tb-chat__conversation:hover {
    background: #f1f6fc;
}

.tb-chat__conversation.is-selected {
    color: #fff;
    background: #1976c9;
}

.tb-chat__conversation-title,
.tb-chat__conversation-preview {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tb-chat__conversation-title {
    font-size: 13px;
    white-space: normal;
}

.tb-chat__conversation-preview {
    margin-top: 4px;
    opacity: .78;
    font-size: 11px;
    white-space: nowrap;
}

.tb-chat__sidebar-footer {
    padding: 9px;
    border-top: 1px solid #dfe4ea;
}

.tb-chat__actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin-bottom: 5px;
}

.tb-chat__action,
.tb-chat__send,
.tb-chat__model {
    min-height: 34px;
    border: 1px solid #c8d0da;
    border-radius: 5px;
    background: #fff;
}

.tb-chat__action {
    margin: 2px 0;
    padding: 6px 9px;
    cursor: pointer;
}

.tb-chat__action:disabled,
.tb-chat__send:disabled {
    cursor: default;
    opacity: .5;
}

.tb-chat__archived-option {
    display: block;
    margin-top: 5px;
    font-size: 12px;
}

.tb-chat__main {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.tb-chat__messages {
    flex: 1 1 auto;
    min-height: 0;
    padding: 18px;
    overflow-y: auto;
}

.tb-chat__bubble,
.tb-chat .message {
    max-width: 75%;
    margin: 0 0 12px;
    padding: 10px 13px;
    border: 1px solid #dce1e8;
    border-radius: 11px;
    background: #fff;
    box-shadow: 0 2px 7px rgba(30, 45, 70, .06);
    overflow-wrap: anywhere;
}

.tb-chat__bubble.is-outgoing,
.tb-chat .message-user {
    margin-left: auto;
    background: #e1f1ff;
    border-color: #b9d8f2;
}

.tb-chat--whatsapp .tb-chat__messages,
.tb-chat--site .tb-chat__messages {
    background: #efeae2;
}

.tb-chat--whatsapp .tb-chat__bubble.is-outgoing,
.tb-chat--site .tb-chat__bubble.is-outgoing {
    background: #d9fdd3;
    border-color: #c5efbd;
}

.tb-chat__bubble header,
.tb-chat .message-header {
    margin-bottom: 5px;
    color: #687686;
    font-size: 11px;
}

.tb-chat .message-assistant {
    margin-right: auto;
}

.tb-chat .message-error {
    border-color: #efb7b7;
    background: #fff0f0;
    color: #8a1f1f;
}

.tb-chat .message-content {
    overflow-x: auto;
}

.tb-chat .message-content pre {
    padding: 12px;
    overflow-x: auto;
    border-radius: 7px;
    color: #e6edf3;
    background: #1f242c;
}

.tb-chat .message-content img {
    max-width: 100%;
    height: auto;
}

.tb-chat__composer {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #d6dce5;
    background: #fff;
}

.tb-chat__input {
    flex: 1 1 auto;
    min-height: 64px;
    max-height: 180px;
    padding: 9px 11px;
    resize: vertical;
    border: 1px solid #bfc8d4;
    border-radius: 5px;
    font: inherit;
}

.tb-chat__composer-actions {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 6px;
}

.tb-chat__model {
    max-width: 220px;
    padding: 5px 7px;
}

.tb-chat__send {
    padding: 7px 16px;
    color: #fff;
    background: #1976c9;
    cursor: pointer;
}

.tb-chat__empty,
.tb-chat__empty-list {
    padding: 18px;
    color: #6d7784;
    text-align: center;
}

@media (max-width: 760px) {
    .tb-chat {
        flex-direction: column;
    }

    .tb-chat__sidebar {
        flex: 0 0 210px;
        width: 100%;
        border-right: 0;
        border-bottom: 1px solid #d8dee7;
    }

    .tb-chat__bubble,
    .tb-chat .message {
        max-width: 90%;
    }
}
