.support-chat-launcher {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 9000;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 12px 17px;
    border: 0;
    border-radius: 50px;
    background: #0F172A;
    color: #fff;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .28);
    font: 700 13px Inter, sans-serif;
    cursor: pointer;
}

.support-chat-launcher i { font-size: 18px; }
.support-chat-launcher .chat-unread {
    display: none;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    align-items: center;
    justify-content: center;
    border-radius: 50px;
    background: #C9A227;
    color: #0F172A;
    font-size: 10px;
}

.support-chat-panel {
    position: fixed;
    right: 22px;
    bottom: 82px;
    z-index: 9001;
    width: min(380px, calc(100vw - 24px));
    height: min(590px, calc(100vh - 110px));
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e5e5e5;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 18px 55px rgba(0, 0, 0, .2);
    font-family: Inter, sans-serif;
}

.support-chat-panel.open { display: flex; }
.support-chat-header {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 15px 16px;
    background: linear-gradient(135deg, #020617, #0F172A);
    color: #fff;
}

.support-chat-header .chat-agent-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .18);
}

.support-chat-header-text { flex: 1; min-width: 0; }
.support-chat-header-text strong { display: block; font-size: 14px; }
.support-chat-header-text small { display: block; opacity: .82; font-size: 11px; }
.support-chat-close { color: #fff; font-size: 19px; }

.support-chat-login {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 25px;
    text-align: center;
    color: #666;
}

.support-chat-login i { font-size: 42px; color: #C9A227; }
.support-chat-login a {
    padding: 10px 20px;
    border-radius: 8px;
    background: #C9A227;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 13px;
}

.support-chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 15px;
    background: #f5f5f5;
}

.support-chat-empty {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #888;
    text-align: center;
    font-size: 12px;
}

.support-chat-empty i { font-size: 36px; opacity: .45; }
.chat-message { display: flex; margin-bottom: 10px; }
.chat-message.mine { justify-content: flex-end; }
.chat-message-bubble {
    max-width: 82%;
    padding: 9px 11px 7px;
    border-radius: 12px 12px 12px 3px;
    background: #fff;
    color: #1d1d1b;
    box-shadow: 0 1px 3px rgba(0,0,0,.07);
    word-break: break-word;
}

.chat-message.mine .chat-message-bubble {
    border-radius: 12px 12px 3px 12px;
    background: #C9A227;
    color: #fff;
}

.chat-message-text { white-space: pre-wrap; font-size: 13px; line-height: 1.45; }
.chat-message-time { margin-top: 4px; text-align: right; font-size: 9px; opacity: .65; }
.support-chat-form {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #e5e5e5;
    background: #fff;
}

.support-chat-form textarea {
    flex: 1;
    min-height: 42px;
    max-height: 100px;
    resize: none;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 10px;
    outline: none;
    font: 13px Inter, sans-serif;
}

.support-chat-form textarea:focus { border-color: #C9A227; }
.support-chat-send {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border: 0;
    border-radius: 10px;
    background: #C9A227;
    color: #fff;
    cursor: pointer;
}

/* Supplier inbox */
.supplier-chat-layout {
    min-height: 620px;
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    overflow: hidden;
    border: 1px solid #e5e5e5;
    border-radius: 16px;
    background: #fff;
}

.supplier-chat-list {
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
    border-right: 1px solid #e5e5e5;
    background: #fafafa;
}

.supplier-chat-list-header { padding: 17px; border-bottom: 1px solid #e5e5e5; }
.supplier-chat-list-header h3 { font-size: 16px; margin: 0 0 4px; }
.supplier-chat-list-header p { margin: 0; color: #777; font-size: 11px; }
.supplier-thread {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 15px;
    border: 0;
    border-bottom: 1px solid #eee;
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: background-color .2s ease;
}

.supplier-thread:hover, .supplier-thread.active { background: #fff; }
.supplier-thread.active { border-left: 3px solid #C9A227; }
.supplier-thread-avatar {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    background: #C9A227;
    color: #fff;
    font-weight: 800;
}

.supplier-thread-info {
    display: flex;
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    flex-direction: column;
    gap: 4px;
}

.supplier-thread-name {
    display: block;
    overflow: hidden;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.supplier-thread-preview {
    display: block;
    width: 100%;
    overflow: hidden;
    color: #777;
    font-size: 11px;
    line-height: 1.35;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.supplier-thread-unread {
    min-width: 18px;
    height: 18px;
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #C9A227;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
}

.supplier-chat-conversation { display: flex; min-width: 0; flex-direction: column; }
.supplier-chat-conversation-header {
    min-height: 65px;
    padding: 14px 17px;
    border-bottom: 1px solid #e5e5e5;
}

.supplier-chat-conversation-header strong { display: block; font-size: 14px; }
.supplier-chat-conversation-header small { color: #777; font-size: 11px; }
.supplier-chat-conversation .support-chat-messages { min-height: 420px; }
.supplier-chat-back {
    display: none;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: #f3f3f3;
    color: #333;
    cursor: pointer;
}

@media (max-width: 700px) {
    .support-chat-launcher {
        right: 12px;
        bottom: calc(76px + env(safe-area-inset-bottom));
        padding: 12px;
    }
    .support-chat-launcher .launcher-label { display: none; }
    .support-chat-panel {
        top: var(--chat-viewport-top, 0);
        right: 0;
        bottom: auto;
        left: 0;
        width: 100%;
        max-width: none;
        height: var(--chat-viewport-height, 100dvh);
        max-height: none;
        border: 0;
        border-radius: 0;
    }
    .support-chat-header {
        flex-shrink: 0;
        padding: calc(13px + env(safe-area-inset-top)) 14px 13px;
    }
    .support-chat-close {
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .support-chat-messages {
        padding: 12px;
    }
    .chat-message-bubble {
        max-width: 88%;
        padding: 10px 12px 8px;
    }
    .chat-message-text {
        font-size: 14px;
    }
    .support-chat-form {
        flex-shrink: 0;
        align-items: flex-end;
        padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
    }
    .support-chat-form textarea {
        min-height: 46px;
        padding: 12px;
        font-size: 16px;
        line-height: 1.35;
    }
    .support-chat-send {
        width: 46px;
        height: 46px;
    }
    .supplier-chat-layout {
        min-height: calc(100dvh - 180px);
        display: block;
        border-radius: 12px;
    }
    .supplier-chat-list {
        max-height: none;
        border-right: 0;
        border-bottom: 0;
    }
    .supplier-chat-conversation {
        display: none;
        min-height: calc(100dvh - 180px);
    }
    .supplier-chat-layout.thread-open .supplier-chat-list {
        display: none;
    }
    .supplier-chat-layout.thread-open .supplier-chat-conversation {
        display: flex;
    }
    .supplier-chat-conversation-header {
        display: flex;
        align-items: center;
        gap: 10px;
        min-width: 0;
        padding: 10px 12px;
    }
    .supplier-chat-conversation-header > span {
        min-width: 0;
    }
    .supplier-chat-conversation-header strong,
    .supplier-chat-conversation-header small {
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    .supplier-chat-back {
        display: flex;
    }
    .supplier-chat-conversation .support-chat-messages {
        min-height: 0;
    }
}
