/* MFV Messaging Inbox — v1.8.0 Gmail-style redesign */

/* ═══════════════════════════════════════════════════════
 * LAYOUT — Gmail-style single panel with view transitions
 * ═══════════════════════════════════════════════════════ */

#mfv-inbox {
    max-width: 860px;
    margin: 0 auto;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--mfv-slate-800, #1e293b);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

/* ── Inbox Header Bar ── */
.mfv-inbox-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0 12px;
    border-bottom: 1px solid var(--mfv-slate-200, #e2e8f0);
    margin-bottom: 0;
}
.mfv-inbox-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    flex-shrink: 0;
}
.mfv-inbox-header h2 svg {
    vertical-align: -3px;
    margin-right: 6px;
    color: var(--mfv-primary, #0e7490);
}
.mfv-inbox-search {
    flex: 1;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--mfv-slate-200, #e2e8f0);
    border-radius: 8px;
    font-size: 13px;
    background: var(--mfv-slate-50, #f8fafc) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat 12px center;
    color: var(--mfv-slate-700, #374151);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    max-width: 280px;
    box-sizing: border-box;
}
.mfv-inbox-search:focus {
    border-color: var(--mfv-primary, #0e7490);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(var(--mfv-primary-rgb, 14,116,144),0.08);
}

/* ── Tabs: Inbox / Blocked Users ── */
.mfv-inbox-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--mfv-slate-200, #e2e8f0);
    margin-top: 4px;
}
.mfv-inbox-tab {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--mfv-slate-500, #64748b);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.15s, border-color 0.15s;
}
.mfv-inbox-tab:hover { color: var(--mfv-primary, #0e7490); }
.mfv-inbox-tab--active {
    color: var(--mfv-primary, #0e7490);
    border-bottom-color: var(--mfv-primary, #0e7490);
}
.mfv-inbox-tab svg { flex-shrink: 0; }

/* ── Filter Pills ── */
.mfv-inbox-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid var(--mfv-slate-100, #f1f5f9);
}
.mfv-inbox-filter-btn {
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--mfv-slate-200, #e2e8f0);
    border-radius: 20px;
    background: #fff;
    color: var(--mfv-slate-500, #64748b);
    cursor: pointer;
    transition: all 0.15s;
}
.mfv-inbox-filter-btn:hover { background: var(--mfv-slate-100, #f1f5f9); }
.mfv-inbox-filter-btn--active {
    background: var(--mfv-primary, #0e7490);
    color: #fff;
    border-color: var(--mfv-primary, #0e7490);
}
/* Shared select style for all toolbar filters */
.mfv-inbox-filter-sel {
    padding: 5px 28px 5px 10px;
    font-size: 12px;
    border: 1px solid var(--mfv-slate-200, #e2e8f0);
    border-radius: 20px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%2394a3b8' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E") no-repeat right 10px center;
    background-size: 10px 6px;
    color: var(--mfv-slate-500, #64748b);
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    max-width: 160px;
    flex-shrink: 0;
    transition: border-color 0.15s;
}
.mfv-inbox-filter-sel:focus { border-color: var(--mfv-primary, #0e7490); }
.mfv-inbox-filter-sel option { color: var(--mfv-slate-800, #1e293b); }
/* Legacy alias */
.mfv-inbox-listing-sel {
    padding: 5px 10px;
    font-size: 12px;
    border: 1px solid var(--mfv-slate-200, #e2e8f0);
    border-radius: 20px;
    background: #fff;
    color: var(--mfv-slate-500, #64748b);
    cursor: pointer;
    outline: none;
    max-width: 200px;
}
.mfv-inbox-listing-sel:focus { border-color: var(--mfv-primary, #0e7490); }

/* ═══════════════════════════════════════════════════════
 * THREAD LIST — Gmail-style rows
 * ═══════════════════════════════════════════════════════ */

.mfv-thread-list {
    border: 1px solid var(--mfv-slate-200, #e2e8f0);
    border-radius: 8px;
    overflow: hidden;
    margin-top: 4px;
    background: #fff;
}

.mfv-thread-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--mfv-slate-100, #f1f5f9);
    transition: background 0.12s;
    position: relative;
}
.mfv-thread-row:last-child { border-bottom: none; }
.mfv-thread-row:hover { background: var(--mfv-slate-50, #f8fafc); }
/* Unread: bold name, teal left border, tinted bg */
.mfv-thread-row--unread {
    background: #f0fdfa;
    border-left: 3px solid var(--mfv-primary, #0e7490);
}
.mfv-thread-row--unread .mfv-thread-row__name { font-weight: 700; color: #0f172a; }
.mfv-thread-row--unread .mfv-thread-row__snippet { color: #334155; font-weight: 500; }
.mfv-thread-row--unread .mfv-thread-row__time { color: var(--mfv-primary, #0e7490); font-weight: 600; }
/* Read: muted but fully legible */
.mfv-thread-row:not(.mfv-thread-row--unread) .mfv-thread-row__name { color: #334155; font-weight: 400; }
.mfv-thread-row:not(.mfv-thread-row--unread) .mfv-thread-row__snippet { color: var(--mfv-slate-500, #64748b); }
/* Active (expanded) */
.mfv-thread-row--active { background: #e0f2fe; border-left: 3px solid var(--mfv-primary, #0e7490); }

.mfv-thread-row__avatar {
    position: relative;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
}
.mfv-thread-row__avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}
.mfv-thread-row__avatar-initial {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--mfv-primary, #0e7490);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}
.mfv-thread-row__presence {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #fff;
    z-index: 1;
}
.mfv-thread-row__presence--online { background: #22c55e; }
.mfv-thread-row__presence--away { background: #f59e0b; }

.mfv-thread-row__content {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.mfv-thread-row__name {
    font-size: 14px;
    color: var(--mfv-slate-800, #1e293b);
    flex-shrink: 0;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mfv-thread-row__unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--mfv-primary, #0e7490);
    flex-shrink: 0;
    display: inline-block;
}
.mfv-thread-row__separator {
    color: var(--mfv-slate-300, #cbd5e1);
    flex-shrink: 0;
    font-size: 12px;
}
.mfv-thread-row__snippet {
    font-size: 13px;
    color: var(--mfv-slate-400, #94a3b8);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}
.mfv-thread-row__time {
    font-size: 11px;
    color: var(--mfv-slate-400, #94a3b8);
    flex-shrink: 0;
    white-space: nowrap;
}
.mfv-thread-row--unread .mfv-thread-row__time {
    color: var(--mfv-primary, #0e7490);
    font-weight: 600;
}

/* Empty thread list */
.mfv-thread-empty {
    padding: 48px 24px;
    text-align: center;
    color: var(--mfv-slate-400, #94a3b8);
}
.mfv-thread-empty svg { margin-bottom: 12px; }
.mfv-thread-empty__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--mfv-slate-500, #64748b);
    margin: 0 0 4px;
}
.mfv-thread-empty__sub {
    font-size: 13px;
    color: var(--mfv-slate-400, #94a3b8);
    margin: 0;
}

/* ═══════════════════════════════════════════════════════
 * ACCORDION EXPAND — inline conversation below thread row
 * ═══════════════════════════════════════════════════════ */

/* Chevron on thread row */
.mfv-thread-row__chevron {
    flex-shrink: 0;
    color: var(--mfv-slate-300, #cbd5e1);
    transition: transform 0.2s;
}
.mfv-thread-row--active .mfv-thread-row__chevron {
    transform: rotate(180deg);
    color: var(--mfv-primary, #0e7490);
}

/* Expand container */
.mfv-thread-expand {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: #eef7fa;
    border-left: 3px solid var(--mfv-primary, #0e7490);
}
.mfv-thread-expand--open {
    max-height: 600px;
    overflow: visible;
    border-bottom: 2px solid var(--mfv-primary, #0e7490);
}
.mfv-expand-loading {
    padding: 20px;
    text-align: center;
    color: var(--mfv-slate-400, #94a3b8);
    font-size: 13px;
}

/* Expand header */
.mfv-expand-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-bottom: 1px solid #d4e8ef;
    background: #e0f2fe;
}
.mfv-expand-header__name {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--mfv-slate-800, #1e293b);
}

/* Message scroll in accordion */
.mfv-expand-messages {
    height: 340px;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #f0f7fa;
}

/* Reply bar in accordion */
.mfv-expand-reply {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 8px 12px;
    border-top: 1px solid #d4e8ef;
    background: #e8f4f8;
}

/* Legacy compat alias */
.mfv-conv {
    display: flex;
    flex-direction: column;
}

/* Conversation header */
.mfv-conv__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--mfv-slate-200, #e2e8f0);
    background: #fafbfc;
    flex-shrink: 0;
}
.mfv-conv__back {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--mfv-slate-500, #64748b);
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: background 0.12s;
}
.mfv-conv__back:hover { background: var(--mfv-slate-100, #f1f5f9); color: var(--mfv-primary, #0e7490); }
.mfv-conv__info { flex: 1; min-width: 0; }
.mfv-conv__name {
    font-size: 15px;
    font-weight: 600;
    color: var(--mfv-slate-800, #1e293b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mfv-conv__listing {
    font-size: 12px;
    color: var(--mfv-slate-400, #94a3b8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mfv-conv__presence {
    font-size: 11px;
    color: var(--mfv-slate-400, #94a3b8);
    margin-left: 8px;
}
.mfv-conv__presence--online { color: #22c55e; }
.mfv-conv__presence--away { color: #f59e0b; }

.mfv-block-user-btn {
    background: none;
    border: 1px solid var(--mfv-slate-200, #e2e8f0);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    color: var(--mfv-slate-400, #94a3b8);
    transition: all 0.15s;
    flex-shrink: 0;
}
.mfv-block-user-btn:hover { background: #fef2f2; color: var(--mfv-error, #dc2626); border-color: #fca5a5; }
.mfv-block-user-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Message scroll area */
.mfv-conv__messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #fafbfc;
}

/* Message bubbles */
.mfv-msg-bubble {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    position: relative;
    transition: opacity 0.2s;
}
.mfv-msg-mine {
    align-self: flex-end;
    background: var(--mfv-primary, #0e7490);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.mfv-msg-other {
    align-self: flex-start;
    background: #fff;
    color: var(--mfv-slate-800, #1e293b);
    border: 1px solid var(--mfv-slate-200, #e2e8f0);
    border-bottom-left-radius: 4px;
}
.mfv-msg-auto {
    align-self: center;
    max-width: 85%;
    text-align: center;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
    font-style: italic;
    font-size: 13px;
}
.mfv-msg-system {
    align-self: center;
    max-width: 85%;
    text-align: center;
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #86efac;
    font-size: 12px;
}
.mfv-msg-payment {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #93c5fd;
}
.mfv-msg-sender {
    font-size: 11px;
    font-weight: 500;
    margin-bottom: 2px;
    opacity: 0.65;
}
.mfv-msg-time { font-weight: 400; opacity: 0.6; }
.mfv-msg-via { font-weight: 500; font-size: 10px; color: #6366f1; opacity: 0.8; margin-left: 4px; }
.mfv-msg-body { white-space: pre-wrap; }

/* Optimistic send */
.mfv-msg-bubble--sending { opacity: 0.6; }
.mfv-msg-bubble--sending .mfv-msg-time::after { content: ' \00b7 Sending\2026'; font-style: italic; }
.mfv-msg-bubble--failed { opacity: 1; border: 1px dashed var(--mfv-error, #dc2626) !important; }
.mfv-msg-retry { display: none; font-size: 11px; color: var(--mfv-error, #dc2626); cursor: pointer; margin-top: 4px; text-decoration: underline; }
.mfv-msg-bubble--failed .mfv-msg-retry { display: inline; }

/* Read receipts */
.mfv-msg-receipt { display: inline-flex; align-items: center; float: right; margin-top: 4px; margin-left: 8px; cursor: default; }
.mfv-msg-receipt svg { display: block; }
.mfv-msg-receipt--sent svg { stroke: rgba(255,255,255,0.4); }
.mfv-msg-receipt--read svg { stroke: #67e8f9; }
.mfv-msg-other .mfv-msg-receipt { display: none; }

.mfv-msg-pay-btn {
    display: inline-block;
    margin-top: 8px;
    padding: 7px 18px;
    background: var(--mfv-primary, #0e7490);
    color: #fff;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s;
}
.mfv-msg-pay-btn:hover { background: #0d6d8a; color: #fff; }

/* Typing indicator */
.mfv-conv__typing {
    padding: 4px 16px;
    font-size: 12px;
    color: var(--mfv-slate-400, #94a3b8);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.mfv-typing-dots { display: flex; gap: 3px; }
.mfv-typing-dots span {
    width: 5px; height: 5px; border-radius: 50%; background: var(--mfv-slate-400, #94a3b8);
    animation: mfvTypeBounce 1.2s infinite;
}
.mfv-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.mfv-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes mfvTypeBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

/* Emoji picker */
/* Emoji wrap — the toggle + popover live here */
.mfv-emoji-wrap {
    position: relative;
    flex-shrink: 0;
}

/* Popover panel */
.mfv-emoji-picker {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    width: 300px;
    max-height: 250px;
    background: #fff;
    border: 1px solid var(--mfv-slate-200, #e2e8f0);
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.13), 0 2px 8px rgba(0,0,0,0.07);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    padding: 8px 10px 6px;
    animation: mfvEmojiPop 0.14s ease-out;
}

/* Arrow tail pointing down toward toggle */
.mfv-emoji-picker::after {
    content: '';
    position: absolute;
    bottom: -7px;
    left: 12px;
    width: 12px;
    height: 12px;
    background: #fff;
    border-right: 1px solid var(--mfv-slate-200, #e2e8f0);
    border-bottom: 1px solid var(--mfv-slate-200, #e2e8f0);
    transform: rotate(45deg);
}

@keyframes mfvEmojiPop {
    from { opacity: 0; transform: translateY(6px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.mfv-emoji-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--mfv-slate-100, #f1f5f9);
    padding-bottom: 6px;
    flex-shrink: 0;
}
.mfv-emoji-tab {
    padding: 3px 8px;
    border: none;
    background: none;
    font-size: 15px;
    cursor: pointer;
    border-radius: 6px;
    opacity: 0.5;
    transition: all 0.1s;
}
.mfv-emoji-tab:hover { background: var(--mfv-slate-100, #f1f5f9); opacity: 1; }
.mfv-emoji-tab--active { background: #f0fdfa; opacity: 1; }
.mfv-emoji-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 1px;
    overflow-y: auto;
    flex: 1;
}
.mfv-emoji-item {
    width: 100%;
    aspect-ratio: 1;
    border: none;
    background: none;
    font-size: 20px;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s;
}
.mfv-emoji-item:hover { background: var(--mfv-slate-100, #f1f5f9); transform: scale(1.15); }

/* Reply bar */
.mfv-conv__reply {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid var(--mfv-slate-200, #e2e8f0);
    background: #fff;
    flex-shrink: 0;
}
.mfv-conv__emoji-toggle {
    width: 34px;
    height: 34px;
    border: none;
    background: none;
    font-size: 18px;
    cursor: pointer;
    border-radius: 50%;
    color: var(--mfv-slate-400, #94a3b8);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s;
    flex-shrink: 0;
}
.mfv-conv__emoji-toggle:hover { background: var(--mfv-slate-100, #f1f5f9); color: var(--mfv-primary, #0e7490); }
.mfv-conv__emoji-toggle--active { background: #f0fdfa; color: var(--mfv-primary, #0e7490); }
.mfv-conv__input {
    flex: 1;
    padding: 8px 14px;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    resize: none;
    overflow-y: auto;
    max-height: 100px;
    line-height: 1.4;
    transition: border-color 0.15s;
    min-width: 0;
}
.mfv-conv__input:focus { border-color: var(--mfv-primary, #0e7490); }
.mfv-conv__send {
    width: 36px;
    height: 36px;
    padding: 0;
    background: var(--mfv-primary, #0e7490);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.1s;
}
.mfv-conv__send:hover { background: #0c5f73; transform: scale(1.05); }
.mfv-conv__send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.mfv-conv__send svg { flex-shrink: 0; }

/* DM pay button in reply bar */
.mfv-msg-reply-bar { display: contents; }
.mfv-dm-pay-btn {
    padding: 8px 14px !important;
    background: var(--mfv-primary, #0e7490) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 20px !important;
    font-weight: 600 !important;
    font-size: 12px !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
}
.mfv-dm-pay-btn:hover { background: #0c5f73 !important; }

/* Block overlay + confirmation */
.mfv-block-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: mfvBlockFadeIn 0.15s ease-out;
}
.mfv-block-confirm {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #991b1b;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    max-width: 360px;
    width: 100%;
}
@keyframes mfvBlockFadeIn { from { opacity: 0; } to { opacity: 1; } }
.mfv-block-confirm button {
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    white-space: nowrap;
}
.mfv-block-confirm-yes { background: var(--mfv-error, #dc2626); color: #fff; }
.mfv-block-confirm-yes:hover { background: #b91c1c; }
.mfv-block-confirm-cancel { background: var(--mfv-slate-100, #f1f5f9); color: var(--mfv-slate-600, #475569); }
.mfv-block-confirm-cancel:hover { background: var(--mfv-slate-200, #e2e8f0); }

/* Blocked users table */
.mfv-blocked-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mfv-blocked-table th { text-align: left; padding: 8px 12px; border-bottom: 2px solid var(--mfv-slate-200, #e2e8f0); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--mfv-slate-500, #64748b); }
.mfv-blocked-table td { padding: 8px 12px; border-bottom: 1px solid var(--mfv-slate-100, #f1f5f9); }
.mfv-unblock-btn { padding: 4px 12px; background: var(--mfv-slate-100, #f1f5f9); border: 1px solid var(--mfv-slate-200, #e2e8f0); border-radius: 6px; font-size: 12px; cursor: pointer; color: var(--mfv-slate-600, #475569); transition: background 0.15s; }
.mfv-unblock-btn:hover { background: var(--mfv-slate-200, #e2e8f0); }
.mfv-unblock-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Badge */
.mfv-msg-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; background: #EF4444; color: #fff; border-radius: 999px; font-size: 10px; font-weight: 700; line-height: 1; vertical-align: middle; margin-left: 4px; }

/* Mobile */
@media (max-width: 640px) {
    #mfv-inbox { padding: 0 8px; }
    .mfv-inbox-header { flex-wrap: wrap; }
    .mfv-inbox-search { max-width: 100%; flex-basis: 100%; order: 3; }
    .mfv-thread-row { padding: 10px 12px; }
    .mfv-thread-row__name { max-width: 120px; }
    .mfv-conv { height: calc(100vh - 160px); border-radius: 0; border-left: none; border-right: none; }
    .mfv-emoji-grid { grid-template-columns: repeat(8, 1fr); }
    .mfv-inbox-toolbar { flex-wrap: wrap; }
    .mfv-inbox-filter-sel { max-width: calc(50% - 4px); flex: 1 1 auto; }

    /* On mobile the popover goes full-width, fixed above the reply bar */
    .mfv-emoji-picker {
        position: fixed;
        bottom: 72px;
        left: 8px;
        right: 8px;
        width: auto;
        max-height: 240px;
        border-radius: 14px;
    }
    .mfv-emoji-picker::after { display: none; }

    /* Payment cards — full width on mobile */
    .mfv-dmpay-card { max-width: 100%; }
    .mfv-dmpay-card__pay-btn { padding: 14px; font-size: 16px; }
    .mfv-dmpay-card__amount { font-size: 24px; }

    /* Accordion conversation — limit height so reply bar stays visible */
    .mfv-thread-expanded .mfv-conv { max-height: 50vh; overflow-y: auto; }

    /* Compact tabs on mobile */
    .mfv-inbox-tabs .mfv-inbox-tab { padding: 8px 12px; font-size: 12px; }

    /* Reply bar — compact on mobile */
    .mfv-conv-reply { gap: 6px; }
    .mfv-conv-reply textarea,
    .mfv-conv-reply input[type="text"] { font-size: 16px; } /* prevents iOS zoom */

    /* Collect Payment modal — already has 480px breakpoint, reinforce here */
    .mfv-cp-card { max-width: 100%; margin: 0 8px; }
}

/* ═══════════════════════════════════════════════════════
 * LEGACY COMPAT — Classes used by other IIFE modules
 * ═══════════════════════════════════════════════════════ */
/* Legacy layout classes — no longer used but kept for compat */
.mfv-msg-layout { display: contents; }
.mfv-msg-sidebar { display: none; }
.mfv-msg-main { display: contents; }
.mfv-msg-messages { display: contents; }
.mfv-msg-thread-header { display: none; }

/* ═══════════════════════════════════════════════════════
 * 8H-B: Collect Payment Modal (unchanged)
 * ═══════════════════════════════════════════════════════ */
.mfv-cp-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 100000; display: flex; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.mfv-cp-card { position: relative; background: #fff; border-radius: 16px; max-width: 440px; width: 100%; max-height: 90vh; overflow-y: auto; padding: 28px 24px 24px; box-shadow: 0 25px 60px rgba(0,0,0,0.3); animation: mfvCpSlideUp 0.25s ease-out; }
@keyframes mfvCpSlideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
.mfv-cp-close { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border: none; background: var(--mfv-slate-100, #f1f5f9); border-radius: 50%; font-size: 20px; line-height: 1; color: var(--mfv-slate-500, #64748b); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.15s; }
.mfv-cp-close:hover { background: var(--mfv-slate-200, #e2e8f0); }
.mfv-cp-header { text-align: center; margin-bottom: 16px; }
.mfv-cp-icon { font-size: 36px; margin-bottom: 8px; }
.mfv-cp-title { font-size: 20px; font-weight: 700; color: var(--mfv-slate-800, #1e293b); margin: 0 0 6px; }
.mfv-cp-subtitle { font-size: 13px; color: var(--mfv-slate-500, #64748b); margin: 0; line-height: 1.4; }
.mfv-cp-amount { text-align: center; font-size: 28px; font-weight: 800; color: var(--mfv-success, #059669); margin-bottom: 16px; }
.mfv-cp-qr { text-align: center; margin-bottom: 16px; }
.mfv-cp-qr-canvas, .mfv-cp-qr-img { width: 220px; height: 220px; border: 4px solid #fff; border-radius: 12px; box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.mfv-cp-link-row { display: flex; gap: 8px; margin-bottom: 16px; }
.mfv-cp-link-input { flex: 1; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 12px; color: #334155; background: var(--mfv-slate-50, #f8fafc); text-overflow: ellipsis; min-width: 0; }
.mfv-cp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; text-decoration: none; transition: background 0.15s, transform 0.1s; white-space: nowrap; }
.mfv-cp-btn:active { transform: scale(0.97); }
.mfv-cp-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.mfv-cp-btn--copy { background: var(--mfv-primary, #0e7490); color: #fff; flex-shrink: 0; }
.mfv-cp-btn--copy:hover { background: #0d6d8a; }
.mfv-cp-btn--sms { background: #7B35D8; color: #fff; flex: 1; }
.mfv-cp-btn--sms:hover { background: #6B25C8; color: #fff; }
.mfv-cp-btn--cancel { background: transparent; color: var(--mfv-error, #dc2626); border: 1px solid #fca5a5; flex: 1; }
.mfv-cp-btn--cancel:hover { background: #fef2f2; }
.mfv-cp-btn--done { background: var(--mfv-success, #059669); color: #fff; padding: 12px 32px; font-size: 15px; margin-top: 16px; }
.mfv-cp-btn--done:hover { background: #047857; }
.mfv-cp-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.mfv-cp-countdown { text-align: center; font-size: 12px; color: #d97706; font-weight: 600; margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.mfv-cp-countdown--expired { color: var(--mfv-error, #dc2626); }
.mfv-cp-poll-status { text-align: center; font-size: 12px; color: var(--mfv-slate-500, #64748b); display: flex; align-items: center; justify-content: center; gap: 6px; }
.mfv-cp-pulse { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--mfv-success, #059669); animation: mfvCpPulse 1.5s ease-in-out infinite; }
@keyframes mfvCpPulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.7); } }
.mfv-cp-success, .mfv-cp-expired, .mfv-cp-cancelled { text-align: center; padding: 24px 0; }
.mfv-cp-success-icon { font-size: 56px; width: 80px; height: 80px; margin: 0 auto 16px; background: #f0fdf4; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--mfv-success, #059669); animation: mfvCpBounce 0.5s ease-out; }
.mfv-cp-expired-icon { font-size: 48px; margin-bottom: 16px; }
@keyframes mfvCpBounce { 0% { transform: scale(0.3); opacity: 0; } 50% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }
.mfv-cp-confetti { position: absolute; width: 8px; height: 8px; border-radius: 2px; top: 0; animation: mfvCpConfetti 2s ease-out forwards; pointer-events: none; }
@keyframes mfvCpConfetti { 0% { transform: translateY(0) rotate(0deg); opacity: 1; } 100% { transform: translateY(400px) rotate(720deg); opacity: 0; } }
@media (max-width: 480px) { .mfv-cp-card { max-width: 100%; max-height: 100vh; border-radius: 0; padding: 20px 16px; } .mfv-cp-overlay { padding: 0; } .mfv-cp-qr-canvas, .mfv-cp-qr-img { width: 180px; height: 180px; } .mfv-cp-actions { flex-direction: column; } }

/* ═══════════════════════════════════════════════════════
 * P26: DM Payment Cards + Modal (unchanged)
 * ═══════════════════════════════════════════════════════ */
.mfv-dmpay-overlay { position: fixed; inset: 0; z-index: 99999; background: rgba(0,0,0,0.45); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.mfv-dmpay-modal { background: #fff; border-radius: 16px; box-shadow: 0 8px 32px rgba(0,0,0,0.15); max-width: 420px; width: 100%; padding: 24px; animation: mfvDmSlideUp .2s ease-out; }
@keyframes mfvDmSlideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.mfv-dmpay-field { margin-bottom: 14px; }
.mfv-dmpay-field label { display: block; font-size: 13px; font-weight: 600; color: var(--mfv-slate-600, #475569); margin-bottom: 4px; }
.mfv-dmpay-amount, .mfv-dmpay-desc { width: 100%; border: 1px solid var(--mfv-slate-200, #e2e8f0); border-radius: 8px; padding: 10px 12px; font-size: 15px; outline: none; transition: border-color .15s; }
.mfv-dmpay-amount:focus, .mfv-dmpay-desc:focus { border-color: var(--mfv-primary, #0e7490); }
.mfv-dmpay-amount { font-weight: 700; font-size: 20px; flex: 1; }
.mfv-dmpay-status { font-size: 13px; margin-bottom: 12px; padding: 8px; border-radius: 6px; background: #fef2f2; }
.mfv-dmpay-actions { display: flex; gap: 10px; }
.mfv-dmpay-btn { flex: 1; padding: 12px; border: none; border-radius: 10px; font-size: 14px; font-weight: 700; cursor: pointer; transition: background .15s; }
.mfv-dmpay-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.mfv-dmpay-btn--quick { background: var(--mfv-primary, #0e7490); color: #fff; }
.mfv-dmpay-btn--quick:hover:not(:disabled) { background: #0d6d8a; }
.mfv-dmpay-btn--invoice { background: #7B35D8; color: #fff; }
.mfv-dmpay-btn--invoice:hover:not(:disabled) { background: #6a2dc0; }
.mfv-dmpay-btn--cancel { background: none; border: none; color: var(--mfv-slate-400, #94a3b8); font-size: 13px; cursor: pointer; }
.mfv-dmpay-card { background: var(--mfv-slate-50, #f8fafc); border: 1px solid var(--mfv-slate-200, #e2e8f0); border-radius: 12px; padding: 16px; margin-top: 8px; max-width: 340px; }
.mfv-dmpay-card--paid { border-color: var(--mfv-success, #059669); background: #f0fdf4; }
.mfv-dmpay-card--cancelled, .mfv-dmpay-card--expired { border-color: #d1d5db; background: #f9fafb; opacity: 0.75; }
.mfv-dmpay-card__photo { width: 100%; border-radius: 8px; margin-bottom: 10px; max-height: 180px; object-fit: cover; }
.mfv-dmpay-card__header { font-size: 13px; font-weight: 700; color: var(--mfv-slate-600, #475569); margin-bottom: 6px; }
.mfv-dmpay-card--paid .mfv-dmpay-card__header { color: var(--mfv-success, #059669); }
.mfv-dmpay-card--cancelled .mfv-dmpay-card__header, .mfv-dmpay-card--expired .mfv-dmpay-card__header { color: #9ca3af; }
.mfv-dmpay-card__amount { font-size: 28px; font-weight: 800; color: var(--mfv-primary, #0e7490); margin-bottom: 4px; }
.mfv-dmpay-card--paid .mfv-dmpay-card__amount { color: var(--mfv-success, #059669); }
.mfv-dmpay-card__desc { font-size: 13px; color: var(--mfv-slate-500, #64748b); margin-bottom: 12px; }
.mfv-dmpay-card__footer { font-size: 12px; color: var(--mfv-slate-500, #64748b); }
.mfv-dmpay-card__footer--paid { color: var(--mfv-success, #059669); font-weight: 600; }
.mfv-dmpay-card__footer--muted { color: #9ca3af; }
.mfv-dmpay-card__pay-btn { display: block; width: 100%; padding: 12px; border: none; border-radius: 10px; background: var(--mfv-primary, #0e7490); color: #fff; font-size: 15px; font-weight: 700; cursor: pointer; text-align: center; text-decoration: none; transition: background .15s; }
.mfv-dmpay-card__pay-btn:hover { background: #0d6d8a; color: #fff; }
.mfv-dmpay-card__pay-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.mfv-dmpay-card__secure { font-size: 11px; color: var(--mfv-slate-400, #94a3b8); text-align: center; margin-top: 6px; }
.mfv-dmpay-card__cancel-btn { background: none; border: none; color: var(--mfv-error, #dc2626); font-size: 12px; cursor: pointer; margin-top: 8px; text-decoration: underline; }
.mfv-stripe-inline { margin-top: 12px; }
.mfv-stripe-error { color: var(--mfv-error, #dc2626); font-size: 13px; min-height: 18px; margin-top: 6px; }
.mfv-msg-dm-payment { max-width: 380px !important; }
.mfv-msg-dm-payment .mfv-msg-body { display: none; }
.mfv-dmpay-ml-bar { border-top: 1px solid var(--mfv-slate-200, #e2e8f0); }
.mfv-dmpay-ml-bar .mfv-dm-pay-btn { background: var(--mfv-primary, #0e7490) !important; color: #fff !important; border: none !important; border-radius: 8px !important; padding: 6px 14px !important; font-size: 13px !important; font-weight: 700 !important; cursor: pointer !important; line-height: 1.4 !important; }
.mfv-dmpay-ml-bar .mfv-dm-pay-btn:hover { background: #0d6d8a !important; }
@media (max-width: 600px) { .mfv-dmpay-modal { max-width: 100%; border-radius: 12px 12px 0 0; margin-top: auto; } .mfv-dmpay-card { max-width: 100%; } }

/* ── Compose Topbar ── */
.mfv-inbox-topbar {
    display: flex;
    justify-content: flex-end;
    padding: 12px 0;
}
.mfv-compose-btn {
    background: var(--mfv-primary, #0e7490); color: #fff; border: none;
    padding: 9px 20px; border-radius: 8px; font-size: 13px; font-weight: 600;
    cursor: pointer; white-space: nowrap; transition: background .15s;
}
.mfv-compose-btn:hover { background: #0c6580; }

/* ── Compose Form ── */
.mfv-compose-form {
    background: #f0f9ff; border: 1.5px solid #bae6fd; border-radius: 12px;
    padding: 20px 24px; margin-bottom: 20px;
}
.mfv-compose-form__title {
    margin: 0 0 16px; font-size: 16px; font-weight: 700;
    color: var(--mfv-slate-900, #0f172a);
}
.mfv-compose-label {
    display: block; font-size: 12px; font-weight: 600;
    color: var(--mfv-slate-600, #475569); margin-bottom: 4px;
    text-transform: uppercase; letter-spacing: .04em;
}
.mfv-compose-form__inner { display: flex; flex-direction: column; gap: 10px; position: relative; }
.mfv-compose-input,
.mfv-compose-textarea {
    width: 100%; padding: 10px 14px; border: 1.5px solid #e2e8f0; border-radius: 8px;
    font-size: 14px; font-family: inherit; background: #fff; box-sizing: border-box;
}
.mfv-compose-input:focus, .mfv-compose-textarea:focus { border-color: var(--mfv-primary, #0e7490); outline: none; box-shadow: 0 0 0 3px rgba(14,116,144,.1); }
.mfv-compose-suggestions {
    position: absolute; top: 44px; left: 0; right: 0; z-index: 100;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.1); max-height: 200px; overflow-y: auto;
}
.mfv-compose-suggestions:empty { display: none; }
.mfv-compose-sugg__item {
    padding: 10px 14px; cursor: pointer; font-size: 14px;
    display: flex; align-items: center; transition: background .1s;
}
.mfv-compose-sugg__item:hover { background: #f0f9ff; }
.mfv-compose-sugg__empty { padding: 10px 14px; color: #94a3b8; font-size: 13px; }
.mfv-compose-actions { display: flex; gap: 8px; justify-content: flex-end; }
.mfv-compose-send {
    background: var(--mfv-primary, #0e7490); color: #fff; border: none;
    padding: 8px 20px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.mfv-compose-send:disabled { opacity: .5; cursor: default; }
.mfv-compose-cancel {
    background: none; border: 1.5px solid #e2e8f0; color: #64748b;
    padding: 8px 16px; border-radius: 8px; font-size: 13px; cursor: pointer;
}
.mfv-compose-cancel:hover { background: #f1f5f9; }

/* ── Delete thread button ── */
.mfv-delete-thread-btn {
    background: none; border: none; cursor: pointer; font-size: 16px;
    color: #94a3b8; padding: 4px 6px; border-radius: 6px; transition: color .15s, background .15s;
}
.mfv-delete-thread-btn:hover { color: #ef4444; background: #fef2f2; }

/* ── Presence (listing pages) ── */
.mfv-listing-presence { position: absolute; bottom: 2px; right: 2px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; z-index: 1; }
.mfv-presence-online { background: #22c55e; }
.mfv-presence-away { background: #f59e0b; }
@keyframes mfvPulse { 0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34,197,94,.5); } 50% { opacity: .85; box-shadow: 0 0 0 4px rgba(34,197,94,0); } }
