.mm-messenger {
    --mm-fab: 60px;
    --mm-gap: 12px;
    --mm-edge: 16px;
    --mm-nav: 72px;
    position: fixed;
    z-index: 9999;
    right: max(var(--mm-edge), env(safe-area-inset-right, 0px));
    bottom: calc(var(--mm-nav) + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-end;
    gap: var(--mm-gap);
    max-height: calc(100dvh - var(--mm-nav) - var(--mm-edge) - env(safe-area-inset-bottom, 0px));
    pointer-events: none;
}
.mm-messenger > * { pointer-events: auto; }
.mm-messenger-fab {
    position: relative; display: grid; place-items: center; width: var(--mm-fab); height: var(--mm-fab); flex: 0 0 auto;
    border: 0; border-radius: 999px; cursor: pointer; color: #fff;
    background: linear-gradient(145deg, #f65a1b 0%, #e24a12 55%, #102a43 160%);
    box-shadow: 0 10px 28px rgba(246, 90, 27, .38), 0 2px 8px rgba(16, 42, 67, .18);
    transition: transform .28s cubic-bezier(.34, 1.4, .64, 1), box-shadow .25s ease, background .25s ease;
}
.mm-messenger-fab:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 16px 34px rgba(246, 90, 27, .42), 0 4px 12px rgba(16, 42, 67, .2); }
.mm-messenger-fab:active { transform: translateY(0) scale(.97); }
.mm-messenger-fab.is-open {
    background: linear-gradient(145deg, #102a43, #1e496c);
    box-shadow: 0 10px 24px rgba(16, 42, 67, .35);
}
.mm-messenger-fab-emoji { font-size: 26px; line-height: 1; display: block; animation: mm-fab-bob 2.8s ease-in-out infinite; }
.mm-messenger-fab.is-open .mm-messenger-fab-emoji { animation: none; }
.mm-messenger-badge {
    position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px;
    display: grid; place-items: center; border-radius: 999px; background: #102a43; color: #fff;
    font-size: 11px; font-weight: 900; line-height: 1; border: 2px solid #fff;
    box-shadow: 0 4px 10px rgba(16, 42, 67, .25); animation: mm-badge-pop .35s cubic-bezier(.34, 1.4, .64, 1);
}
.mm-messenger-panel {
    position: relative;
    display: flex; flex-direction: column;
    width: min(380px, calc(100vw - (var(--mm-edge) * 2)));
    height: min(520px, calc(100dvh - var(--mm-nav) - var(--mm-edge) - var(--mm-fab) - var(--mm-gap) - var(--mm-edge) - env(safe-area-inset-bottom, 0px)));
    max-height: calc(100dvh - var(--mm-nav) - var(--mm-edge) - var(--mm-fab) - var(--mm-gap) - var(--mm-edge) - env(safe-area-inset-bottom, 0px));
    overflow: hidden; border-radius: 22px; background: #fff;
    border: 1px solid rgba(16, 42, 67, .08);
    box-shadow: 0 24px 60px rgba(16, 42, 67, .22), 0 2px 8px rgba(16, 42, 67, .06);
    transform-origin: bottom right;
}
@keyframes mm-panel-in {
    from { opacity: 0; transform: translateY(8px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.mm-messenger-header {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 14px 14px 14px 16px; background: linear-gradient(135deg, #102a43 0%, #1a3d5c 100%); color: #fff;
}
.mm-messenger-header-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mm-messenger-avatar {
    display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 40px;
    border-radius: 999px; background: #f65a1b; color: #fff; font-size: 16px; font-weight: 900;
    box-shadow: 0 0 0 2px rgba(255,255,255,.2);
}
.mm-messenger-title { font-size: 15px; font-weight: 900; letter-spacing: -.02em; line-height: 1.2; }
.mm-messenger-subtitle { margin-top: 2px; font-size: 11px; opacity: .72; font-weight: 600; }
.mm-messenger-status { display: inline-flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 11px; font-weight: 650; color: rgba(255,255,255,.82); }
.mm-messenger-online-dot { width: 7px; height: 7px; border-radius: 999px; background: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, .25); animation: mm-pulse 2s ease infinite; }
.mm-messenger-icon-btn {
    display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px;
    border: 0; border-radius: 999px; background: rgba(255,255,255,.12); color: #fff; cursor: pointer;
    transition: background .15s ease, transform .15s ease;
}
.mm-messenger-icon-btn:hover { background: rgba(255,255,255,.22); transform: scale(1.05); }
.mm-messenger-listing-bar {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px;
    border-bottom: 1px solid #eef2f5; background: #fafbfc;
}
.mm-messenger-listing-thumb { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; background: #e8eef3; }
.mm-messenger-listing-title { display: block; font-size: 12px; font-weight: 800; color: #102a43; line-height: 1.3; }
.mm-messenger-listing-title:hover { color: #f65a1b; }
.mm-messenger-listing-price { font-size: 11px; font-weight: 800; color: #f65a1b; }
.mm-messenger-expand-link {
    display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
    color: #647789; font-weight: 800; background: #eef2f5; text-decoration: none;
}
.mm-messenger-expand-link:hover { color: #f65a1b; background: #fff1e9; }
.mm-messenger-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.mm-conversation-row {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px;
    border: 0; border-bottom: 1px solid #f0f4f7; background: #fff; cursor: pointer; text-align: left;
    transition: background .15s ease;
}
.mm-conversation-row:hover { background: #f8fafb; }
.mm-conversation-thumb { width: 48px; height: 48px; flex: 0 0 48px; border-radius: 12px; object-fit: cover; background: #e8eef3; }
.mm-conversation-name { font-size: 13px; font-weight: 900; color: #102a43; }
.mm-conversation-time { font-size: 10px; color: #94a3b8; font-weight: 650; white-space: nowrap; }
.mm-conversation-listing { margin-top: 1px; font-size: 11px; font-weight: 700; color: #f65a1b; }
.mm-conversation-preview { margin-top: 2px; font-size: 12px; color: #647789; }
.mm-conversation-offer-tag {
    display: inline-flex; margin-right: 4px; padding: 1px 6px; border-radius: 4px;
    background: #fff1e9; color: #d94912; font-size: 10px; font-weight: 900;
}
.mm-conversation-unread {
    display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
    border-radius: 999px; background: #f65a1b; color: #fff; font-size: 10px; font-weight: 900;
}
.mm-messenger-thread {
    flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px 14px;
    display: flex; flex-direction: column; gap: 14px;
    background: linear-gradient(180deg, #f7f9fb 0%, #fff 40%);
}
.mm-msg { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; animation: mm-msg-in .28s ease; }
.mm-msg.is-mine { justify-content: flex-end; }
.mm-msg.is-theirs { justify-content: flex-start; }
.mm-msg-avatar {
    display: grid; place-items: center; width: 28px; height: 28px; flex: 0 0 28px;
    border-radius: 999px; background: #102a43; color: #fff; font-size: 11px; font-weight: 900;
}
.mm-msg-avatar.is-mine { background: #f65a1b; }
.mm-msg-stack { display: flex; flex-direction: column; gap: 4px; max-width: min(78%, 260px); }
.mm-msg.is-mine .mm-msg-stack { align-items: flex-end; }
.mm-msg-bubble {
    padding: 10px 14px; border-radius: 18px; font-size: 13px; line-height: 1.5;
    box-shadow: 0 2px 8px rgba(16, 42, 67, .06);
}
.mm-msg.is-theirs .mm-msg-bubble { background: #102a43; color: #fff; border-bottom-left-radius: 6px; }
.mm-msg.is-mine .mm-msg-bubble { background: #eef2f5; color: #102a43; border-bottom-right-radius: 6px; }
.mm-msg-body { white-space: pre-wrap; word-break: break-word; }
.mm-msg-time { font-size: 10px; color: #94a3b8; font-weight: 650; padding-inline: 4px; }
.mm-messenger-composer {
    position: relative; display: flex; align-items: center; gap: 8px;
    padding: 12px 14px 14px; border-top: 1px solid #eef2f5; background: #fff;
}
.mm-messenger-input {
    flex: 1; min-height: 46px; border: 0; border-radius: 999px; background: #f0f4f7;
    padding: 10px 48px 10px 16px; color: #102a43; font-size: 13px; font-weight: 600; outline: none;
    transition: box-shadow .15s ease, background .15s ease;
}
.mm-messenger-input:focus { background: #e8eef3; box-shadow: 0 0 0 3px rgba(246, 90, 27, .18); }
.mm-messenger-input::placeholder { color: #9babb8; font-weight: 550; }
.mm-messenger-send {
    position: absolute; right: 22px; top: 50%; transform: translateY(calc(-50% - 1px));
    display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 999px;
    background: transparent; color: #f65a1b; cursor: pointer; transition: transform .15s ease, color .15s ease;
}
.mm-messenger-send:hover { color: #df4c14; transform: translateY(calc(-50% - 1px)) scale(1.08); }
.mm-messenger-error { position: absolute; left: 18px; bottom: 2px; font-size: 10px; }
.mm-messenger-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 24px; text-align: center; height: 100%; }
.mm-messenger-empty-emoji { font-size: 40px; line-height: 1; filter: grayscale(.15); }

/* Offer cards (chat + floating) */
.mm-offer-card {
    width: 100%; padding: 12px 14px; border-radius: 16px;
    background: linear-gradient(160deg, #fff8f4 0%, #fff 60%);
    border: 1px solid #ffd8c4; box-shadow: 0 4px 14px rgba(246, 90, 27, .08);
}
.mm-offer-card.is-mine {
    background: linear-gradient(160deg, #102a43 0%, #1a3d5c 100%);
    border-color: transparent; color: #fff;
}
.mm-offer-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.mm-offer-card-label {
    display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 6px;
    background: #fff1e9; color: #d94912; font-size: 10px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase;
}
.mm-offer-card.is-mine .mm-offer-card-label { background: rgba(246, 90, 27, .25); color: #ffc5ae; }
.mm-offer-card-status { font-size: 10px; font-weight: 800; color: #b45309; text-transform: capitalize; }
.mm-offer-card.is-accepted .mm-offer-card-status,
.mm-offer-card-status.is-accepted { color: #087a4d; }
.mm-offer-card.is-rejected .mm-offer-card-status,
.mm-offer-card-status.is-rejected { color: #b42318; }
.mm-offer-card.is-mine .mm-offer-card-status { color: #86efac; }
.mm-offer-card.is-mine.is-pending .mm-offer-card-status { color: #fde68a; }
.mm-offer-card.is-mine.is-rejected .mm-offer-card-status { color: #fca5a5; }
.mm-offer-card-amount { font-size: 18px; font-weight: 950; letter-spacing: -.03em; color: #102a43; line-height: 1.2; }
.mm-offer-card.is-mine .mm-offer-card-amount { color: #fff; }
.mm-offer-card-note { margin-top: 6px; font-size: 12px; line-height: 1.45; color: #526579; }
.mm-offer-card.is-mine .mm-offer-card-note { color: rgba(255,255,255,.78); }
.mm-offer-actions,
.mm-offer-inline-actions .mm-offer-actions {
    display: flex; gap: 8px; margin-top: 12px; width: 100%;
}
.mm-offer-accept, .mm-offer-reject {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 40px; padding: 0 14px; border-radius: 10px; border: 0; cursor: pointer;
    font-size: 13px; font-weight: 800; line-height: 1; letter-spacing: .01em;
    box-shadow: 0 4px 12px rgba(16, 42, 67, .12);
    transition: transform .12s ease, background .12s ease, box-shadow .12s ease, opacity .12s ease;
}
.mm-offer-accept {
    background: #16a34a; color: #fff !important;
    box-shadow: 0 6px 14px rgba(22, 163, 74, .28);
}
.mm-offer-accept:hover { background: #15803d; transform: translateY(-1px); box-shadow: 0 8px 18px rgba(22, 163, 74, .34); }
.mm-offer-reject {
    background: #dc2626; color: #fff !important;
    box-shadow: 0 6px 14px rgba(220, 38, 38, .28);
}
.mm-offer-reject:hover { background: #b91c1c; transform: translateY(-1px); box-shadow: 0 8px 18px rgba(220, 38, 38, .34); }
.mm-offer-card.is-mine .mm-offer-accept {
    background: #22c55e; color: #fff !important; box-shadow: 0 6px 14px rgba(34, 197, 94, .35);
}
.mm-offer-card.is-mine .mm-offer-reject {
    background: #ef4444; color: #fff !important; border: 0; box-shadow: 0 6px 14px rgba(239, 68, 68, .35);
}
.mm-offer-accept:disabled, .mm-offer-reject:disabled { opacity: .55; cursor: wait; transform: none; box-shadow: none; }
.mm-offer-inline-actions { display: flex; align-items: center; justify-content: flex-end; min-width: 180px; }
.mm-offer-inline-actions .mm-offer-actions { margin-top: 0; min-width: 180px; }

@keyframes mm-fab-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}
@keyframes mm-badge-pop {
    0% { transform: scale(.4); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes mm-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(52, 211, 153, .25); }
    50% { box-shadow: 0 0 0 5px rgba(52, 211, 153, .12); }
}
@keyframes mm-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 768px) {
    .mm-messenger {
        --mm-nav: 0px;
        --mm-edge: 20px;
        bottom: calc(var(--mm-edge) + env(safe-area-inset-bottom, 0px));
        max-height: calc(100dvh - var(--mm-edge) - env(safe-area-inset-bottom, 0px));
    }
    .mm-messenger-panel {
        width: min(400px, calc(100vw - (var(--mm-edge) * 2)));
        height: min(560px, calc(100dvh - var(--mm-edge) - var(--mm-fab) - var(--mm-gap) - var(--mm-edge) - env(safe-area-inset-bottom, 0px)));
        max-height: calc(100dvh - var(--mm-edge) - var(--mm-fab) - var(--mm-gap) - var(--mm-edge) - env(safe-area-inset-bottom, 0px));
    }
}