#gmx-buyer-chat-panel {
    position: fixed;
    inset-inline-end: 20px;
    bottom: 20px;
    z-index: 2147483645;
    display: flex;
    flex-direction: column;
    width: min(456px, calc(100vw - 24px));
    height: min(660px, calc(100dvh - 40px));
    box-sizing: border-box;
    overflow: hidden;
    background: white;
    border: 1px solid #cfd8df;
    border-radius: 16px;
    box-shadow: 0 12px 44px #172f4a29, 0 2px 8px #172f4a14;
}

#gmx-buyer-chat-panel > header,
.buyer-chat-embedded .chat-widget-heading {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    min-height: 58px;
    padding-block: 4px;
    padding-inline: 16px 9px;
    background: #162f48;
    color: white;
}
#gmx-buyer-chat-panel > header span { flex: 1; font: 600 16px/1.3 sans-serif; }
#gmx-buyer-chat-panel > header button,
.buyer-chat-embedded .chat-widget-heading button {
    display: grid;
    place-items: center;
    flex: none;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #fff;
    font: 300 24px/1 "Segoe UI", sans-serif;
    cursor: pointer;
}
#gmx-buyer-chat-panel > header button:hover,
.buyer-chat-embedded .chat-widget-heading button:hover { background: #ffffff22; }
#gmx-buyer-chat-panel > header[hidden], .buyer-chat-embedded [hidden] { display: none !important; }
#gmx-buyer-chat-panel iframe { display: block; flex: 1; width: 100%; min-height: 0; border: 0; }

.buyer-chat-embedded {
    margin: 0;
    color: #192e43;
    background: #fff;
    font: 14px/1.45 "Segoe UI", "Microsoft YaHei", sans-serif;
}
.buyer-chat-embedded *, .buyer-chat-embedded *::before, .buyer-chat-embedded *::after { box-sizing: border-box; }
.buyer-chat-embedded .buyer-chat {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}
.buyer-chat-embedded .chat-widget-heading::before {
    content: "";
    flex: none;
    width: 32px;
    height: 32px;
    margin-inline-end: 6px;
    border-radius: 10px;
    background: #2b4258 url("/static/images/buyer-platform/buyer-center/icon-messages.svg") center / 19px no-repeat;
}
.buyer-chat-embedded .chat-widget-heading h1 {
    flex: 1;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    font-size: 15px;
    line-height: 1.4;
    font-weight: 650;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.buyer-chat-embedded svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.buyer-chat-embedded .buyer-inquiry-message,
.buyer-chat-embedded .message_main {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}
.buyer-chat-embedded .message_thread {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #bdcbd7 transparent;
    padding: 16px;
    background: #f5f7f9;
}
.buyer-chat-embedded .buyer-chat-more {
    display: block;
    margin: 0 auto 18px;
    padding: 5px 12px;
    border: 1px solid #d5dfe6;
    border-radius: 20px;
    background: #fff;
    color: #495e71;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}
.buyer-chat-embedded .message_item { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin: 0 0 14px; }
.buyer-chat-embedded .message_item:last-child { margin-bottom: 0; }
.buyer-chat-embedded .message_item.is-buyer { align-items: flex-end; }
.buyer-chat-embedded .message_bubble {
    min-width: 0;
    max-width: 89%;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #dce4ea;
    border-radius: 12px;
    border-end-start-radius: 3px;
}
.buyer-chat-embedded .is-buyer .message_bubble {
    background: #e5eff9;
    border-color: #d3e2f0;
    border-radius: 12px;
    border-end-end-radius: 3px;
}
.buyer-chat-embedded .message_meta {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 2px 8px;
    color: #52687a;
    font-size: 11px;
}
.buyer-chat-embedded .message_sender { font-weight: 650; overflow-wrap: anywhere; }
.buyer-chat-embedded .message_meta time { font-variant-numeric: tabular-nums; }
.buyer-chat-embedded .message_content { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.buyer-chat-embedded .message_content:empty { display: none; }
.buyer-chat-embedded .message_attachments { display: grid; gap: 6px; min-width: 0; margin-top: 7px; }
.buyer-chat-embedded .message_bubble:has(> .message_content:empty) { border: 0; background: transparent; padding: 0; }
.buyer-chat-embedded .message_content:empty + .message_attachments { margin: 0; }
.buyer-chat-embedded .message_attachments video,
.buyer-chat-embedded .message_attachment_image img {
    display: block;
    max-width: 100%;
    max-height: 180px;
    border-radius: 7px;
}
.buyer-chat-embedded .message_attachments video { width: 250px; aspect-ratio: 16 / 9; background: #192d41; }
.buyer-chat-embedded .message_attachment_image img { width: 230px; height: 150px; object-fit: contain; background: #edf2f5; }
.buyer-chat-embedded .chat-widget-file {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 1px 10px;
    min-width: 0;
    padding: 9px 12px 9px 9px;
    border: 1px solid #d1dde5;
    border-radius: 8px;
    background: #fff;
    color: #1b354a;
    text-decoration: none;
}
.buyer-chat-embedded .chat-widget-file:hover { border-color: #8fa9be; background: #f9fcfe; }
.buyer-chat-embedded .chat-file-type {
    grid-column: 1;
    grid-row: 1 / span 2;
    display: grid;
    place-items: center;
    width: 35px;
    height: 37px;
    border-radius: 3px;
    clip-path: polygon(0 0, 70% 0, 100% 28%, 100% 100%, 0 100%);
    background: #e4edf9;
    color: #345881;
    font: 700 10px/1 "Segoe UI", sans-serif;
}
.buyer-chat-embedded [data-extension^="XLS"] .chat-file-type { background: #d9eee5; color: #24654d; }
.buyer-chat-embedded [data-extension="MP4"] .chat-file-type { background: #eae7f7; color: #65518b; }
.buyer-chat-embedded [data-extension="PDF"] .chat-file-type { background: #fae8dd; color: #8d481f; }
.buyer-chat-embedded .message_attachment_name {
    align-self: end;
    font-size: 13px;
    line-height: 1.4;
    font-weight: 600;
    overflow-wrap: anywhere;
}
.buyer-chat-embedded .message_attachment_name:last-child { grid-row: 1 / span 2; align-self: center; }
.buyer-chat-embedded .chat-widget-file small { grid-column: 2; align-self: start; color: #566b7a; font-size: 11px; }
.buyer-chat-embedded .chat-file-expired { color: #566b7a; overflow-wrap: anywhere; }

.buyer-chat-embedded .reply_box {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 8px;
    align-items: center;
    padding: 12px 14px 14px;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
    border-top: 1px solid #dce4ea;
    background: white;
}
.buyer-chat-embedded .reply_box > div { display: contents; }
.buyer-chat-embedded .reply_box h2 {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
.buyer-chat-embedded .buyer-chat-image-tools {
    grid-column: 1;
    order: 2;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}
.buyer-chat-embedded .buyer-chat-image-tools button,
.buyer-chat-embedded .buyer-chat-file-pending button {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    min-height: 30px;
    padding: 4px 7px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #455d70;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}
.buyer-chat-embedded .buyer-chat-image-tools button:hover,
.buyer-chat-embedded .buyer-chat-file-pending button:hover { background: #edf2f5; }
.buyer-chat-embedded textarea {
    grid-column: 1 / -1;
    width: 100%;
    height: 54px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #c9d5de;
    border-radius: 8px;
    background: #fff;
    color: inherit;
    resize: none;
    font: inherit;
}
.buyer-chat-embedded textarea::placeholder { color: #647786; }
.buyer-chat-embedded .btn_reply {
    grid-column: 2;
    order: 2;
    max-width: 40vw;
    min-height: 38px;
    padding: 7px 15px;
    border: 0;
    border-radius: 8px;
    background: #ffac2e;
    color: #242b32;
    font-family: inherit;
    font-size: 14px;
    font-weight: 650;
    line-height: 1.2;
    white-space: normal;
    overflow-wrap: anywhere;
    cursor: pointer;
}
.buyer-chat-embedded .btn_reply:hover { background: #ff9f0a; }
.buyer-chat-embedded button:disabled { opacity: .55; cursor: default; }
.buyer-chat-embedded :focus-visible, #gmx-buyer-chat-panel > header button:focus-visible {
    outline: 2px solid #4282ba;
    outline-offset: 1px;
}
.buyer-chat-embedded .buyer-chat-files, .buyer-chat-embedded .buyer-chat-file-pending {
    grid-column: 1 / -1;
    order: 1;
    max-height: 16dvh;
    margin: 0;
    overflow: auto;
    overflow-wrap: anywhere;
    color: #455d70;
    font-size: 12px;
}
.buyer-chat-embedded .buyer-chat-file-pending { display: flex; align-items: center; gap: 6px; }
.buyer-chat-embedded [data-chat-file-name] { flex: 1; min-width: 0; }
.buyer-chat-embedded progress { width: 50px; }
.buyer-chat-embedded .buyer-chat-files:empty, .buyer-chat-embedded [data-chat-send-error]:empty { display: none; }
.buyer-chat-embedded .notice, .buyer-chat-embedded [data-chat-send-error] {
    flex: none;
    max-height: 20dvh;
    overflow: auto;
    margin: 0;
    padding: 6px 14px;
    background: #fff2ed;
    color: #98351a;
    font-size: 13px;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

@media (max-width: 480px) {
    #gmx-buyer-chat-panel {
        inset-inline-end: 6px;
        bottom: 6px;
        width: calc(100vw - 12px);
        height: calc(100dvh - 12px);
    }
    .buyer-chat-embedded textarea { font-size: 16px; }
}
