.exim-chat-root {
    position: relative;
    z-index: 2000;
}

.exim-chat-launcher {
    position: fixed;
    right: 22px;
    bottom: 22px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 0 16px;
    border: 0;
    border-radius: 999px;
    background: #111827;
    color: #fff;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.24);
    font-weight: 800;
    cursor: pointer;
}

.exim-chat-launcher strong,
.exim-chat-conversation-meta b {
    display: inline-grid;
    min-width: 22px;
    height: 22px;
    place-items: center;
    border-radius: 999px;
    background: #0f94d2;
    color: #fff;
    font-size: 12px;
}

.exim-chat-shell {
    position: fixed;
    inset: 0;
    z-index: 2010;
}

.exim-chat-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.18);
}

.exim-chat-panel {
    position: absolute;
    top: 18px;
    right: 18px;
    bottom: 18px;
    display: grid;
    grid-template-columns: minmax(260px, 330px) minmax(360px, 520px);
    width: min(880px, calc(100vw - 36px));
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
}

.exim-chat-sidebar {
    display: flex;
    min-width: 0;
    flex-direction: column;
    border-right: 1px solid #e5e7eb;
    background: #f8fafc;
}

.exim-chat-panel-head,
.exim-chat-thread-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
}

.exim-chat-panel-head span,
.exim-chat-thread-head span {
    display: block;
    margin-bottom: 3px;
    color: #0f94d2;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.exim-chat-panel-head strong,
.exim-chat-thread-head strong {
    display: block;
    color: #111827;
    font-size: 16px;
}

.exim-chat-panel-head button {
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    cursor: pointer;
}

.exim-chat-search {
    display: block;
    padding: 12px 14px;
}

.exim-chat-search span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.exim-chat-search input {
    width: 100%;
    min-height: 40px;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    padding: 0 12px;
    background: #fff;
}

.exim-chat-list {
    min-height: 0;
    overflow: auto;
    padding: 0 10px 12px;
}

.exim-chat-conversation {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 10px;
    width: 100%;
    min-height: 70px;
    margin-bottom: 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 10px;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.exim-chat-conversation:hover,
.exim-chat-conversation.active {
    border-color: #cfe8f6;
    background: #fff;
}

.exim-chat-avatar {
    display: inline-grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 999px;
    background: #e0f2fe;
    color: #075985;
    font-weight: 900;
}

.exim-chat-conversation-copy {
    min-width: 0;
}

.exim-chat-conversation-copy strong,
.exim-chat-conversation-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.exim-chat-conversation-copy strong {
    color: #111827;
    font-size: 14px;
}

.exim-chat-conversation-copy small,
.exim-chat-conversation-meta time,
.exim-chat-thread-head small {
    color: #64748b;
    font-size: 12px;
}

.exim-chat-conversation-meta {
    display: grid;
    justify-items: end;
    gap: 7px;
}

.exim-chat-main {
    display: grid;
    min-width: 0;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    background: #fff;
}

.exim-chat-messages {
    min-height: 0;
    overflow: auto;
    padding: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
}

.exim-chat-message {
    display: flex;
    margin: 0 0 12px;
}

.exim-chat-message.mine {
    justify-content: flex-end;
}

.exim-chat-message div {
    max-width: min(74%, 420px);
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
}

.exim-chat-message.mine div {
    border-color: #0f94d2;
    background: #eaf7fd;
}

.exim-chat-message p {
    margin: 0;
    color: #111827;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.exim-chat-message time {
    display: block;
    margin-top: 5px;
    color: #64748b;
    font-size: 11px;
}

.exim-chat-edit {
    border: 0;
    background: transparent;
    color: #0f94d2;
    font-size: 11px;
    font-weight: 800;
    padding: 3px 0 0;
}

.exim-chat-typing {
    padding: 0 18px 8px;
    color: #0f94d2;
    font-size: 12px;
}

.exim-chat-composer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 14px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
}

.exim-chat-composer textarea {
    width: 100%;
    min-height: 44px;
    max-height: 110px;
    resize: vertical;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    padding: 10px 12px;
    font: inherit;
}

.exim-chat-composer button,
.exim-chat-auth a {
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    padding: 0 18px;
    background: #0f94d2;
    color: #fff;
    font-weight: 900;
    cursor: pointer;
}

.exim-chat-composer button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.exim-chat-empty,
.exim-chat-auth {
    margin: 18px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 18px;
    background: #fff;
    color: #475569;
}

.exim-chat-empty strong,
.exim-chat-auth strong {
    display: block;
    margin-bottom: 6px;
    color: #111827;
}

.exim-chat-auth a {
    display: inline-flex;
    align-items: center;
    margin-top: 10px;
    text-decoration: none;
}

@media (max-width: 840px) {
    .exim-chat-panel {
        inset: 0;
        width: 100%;
        border-radius: 0;
        grid-template-columns: 1fr;
    }

    .exim-chat-sidebar {
        max-height: 38vh;
        border-right: 0;
        border-bottom: 1px solid #e5e7eb;
    }

    .exim-chat-launcher {
        right: 14px;
        bottom: 14px;
    }

    .exim-chat-message div {
        max-width: 86%;
    }
}
