/* ================================================================
   B2B SINGLE PRODUCT — PREMIUM MODALS & CHAT
   Login Popup / Inquiry Modal / Chat Modal
================================================================ */

:root {
    --b2b-sp-primary:   #012c5c;
    --b2b-sp-blue:      #0051a8;
    --b2b-sp-accent:    #3b82f6;
    --b2b-sp-success:   #16a34a;
    --b2b-sp-danger:    #dc2626;
    --b2b-sp-radius:    16px;
    --b2b-sp-shadow:    0 24px 60px rgba(1,44,92,.22);
    --b2b-sp-border:    #e2e8f0;
    --b2b-sp-gray:      #64748b;
    --b2b-sp-light:     #f8fafc;
}

/* ── Overlay backdrop ── */
.b2b-sp-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(4px);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    animation: b2b-fadeIn .2s ease;
    overflow-y: auto;
}
.b2b-sp-modal.b2b-sp-open {
    display: flex;
}
@keyframes b2b-fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Dialog box ── */
.b2b-sp-modal-dialog {
    background: #fff;
    border-radius: var(--b2b-sp-radius);
    box-shadow: var(--b2b-sp-shadow);
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: b2b-slideUp .28s cubic-bezier(.34,1.56,.64,1);
    margin: auto;
}
.b2b-sp-modal-sm  { max-width: 420px; }
.b2b-sp-modal-chat { max-width: 480px; display: flex; flex-direction: column; max-height: 88vh; }

@keyframes b2b-slideUp {
    from { transform: translateY(40px) scale(.96); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* ── Modal Header ── */
.b2b-sp-modal-header {
    background: linear-gradient(135deg, var(--b2b-sp-primary), var(--b2b-sp-blue));
    padding: 20px 22px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-radius: var(--b2b-sp-radius) var(--b2b-sp-radius) 0 0;
    position: relative;
}
.b2b-sp-modal-header-icon {
    width: 44px; height: 44px;
    background: rgba(255,255,255,.18);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.2rem; flex-shrink: 0;
}
.b2b-sp-modal-title {
    color: #fff; font-size: 1.1rem; font-weight: 700; margin: 0; line-height: 1.2;
}
.b2b-sp-modal-subtitle {
    color: rgba(255,255,255,.75); font-size: .8rem; margin: 3px 0 0;
}
.b2b-sp-modal-close {
    margin-left: auto; flex-shrink: 0;
    width: 34px; height: 34px; border-radius: 50%;
    background: rgba(255,255,255,.18); border: none; color: #fff;
    font-size: 1.3rem; cursor: pointer; display: flex;
    align-items: center; justify-content: center;
    transition: background .2s;
    line-height: 1;
}
.b2b-sp-modal-close:hover { background: rgba(255,255,255,.35); }

/* ── Modal Body ── */
.b2b-sp-modal-body {
    padding: 22px 22px 24px;
    background: var(--b2b-sp-light);
}

/* ── Form elements ── */
.b2b-sp-form-group {
    margin-bottom: 16px;
}
.b2b-sp-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 16px;
}
.b2b-sp-label {
    display: block;
    font-size: .82rem;
    font-weight: 700;
    color: var(--b2b-sp-primary);
    margin-bottom: 6px;
}
.b2b-sp-required { color: #dc2626; margin-left: 2px; }
.b2b-sp-input, .b2b-sp-select, .b2b-sp-textarea {
    width: 100%; box-sizing: border-box;
    padding: 11px 14px;
    border: 2px solid var(--b2b-sp-border);
    border-radius: 10px;
    font-size: .9rem;
    color: #1e293b;
    background: #fff;
    outline: none;
    transition: border .2s, box-shadow .2s;
    font-family: inherit;
}
.b2b-sp-input:focus, .b2b-sp-select:focus, .b2b-sp-textarea:focus {
    border-color: var(--b2b-sp-accent);
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.b2b-sp-textarea { min-height: 120px; resize: vertical; }
.b2b-sp-qty-wrap { display: grid; grid-template-columns: 1fr 110px; gap: 8px; }

/* Password toggle */
.b2b-sp-input-wrap { position: relative; }
.b2b-sp-input-wrap .b2b-sp-input { padding-right: 44px; }
.b2b-sp-pwd-toggle {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    background: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px 8px;
    font-size: .9rem;
    border-radius: 6px;
    transition: color .2s;
}
.b2b-sp-pwd-toggle:hover {
    background: none !important;
    color: #475569;
}

/* ── Buttons ── */
.b2b-sp-btn-primary {
    background: linear-gradient(135deg, var(--b2b-sp-primary), var(--b2b-sp-blue));
    color: #fff; border: none;
    padding: 13px 28px; border-radius: 10px;
    font-weight: 700; font-size: .9rem; cursor: pointer;
    display: inline-flex; align-items: center; gap: 8px;
    transition: all .2s;
    box-shadow: 0 6px 18px rgba(0,81,168,.3);
}
.b2b-sp-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(0,81,168,.4);
}
.b2b-sp-btn-secondary {
    background: #fff; color: var(--b2b-sp-primary);
    border: 2px solid var(--b2b-sp-border);
    padding: 11px 22px; border-radius: 10px;
    font-weight: 600; font-size: .9rem; cursor: pointer;
    display: inline-flex; align-items: center; gap: 8px;
    transition: all .2s;
}
.b2b-sp-btn-secondary:hover { border-color: var(--b2b-sp-accent); color: var(--b2b-sp-accent); }

/* ── Modal action row ── */
.b2b-sp-modal-actions {
    display: flex; gap: 12px; align-items: center;
    margin-top: 6px; flex-wrap: wrap;
}

/* ── Alert ── */
.b2b-sp-alert {
    padding: 11px 14px; border-radius: 10px;
    font-size: .85rem; margin-bottom: 14px;
    display: flex; align-items: center; gap: 8px;
}
.b2b-sp-alert-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.b2b-sp-alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* ── Footer links ── */
.b2b-sp-modal-footer-links {
    text-align: center; margin-top: 14px;
    font-size: .82rem; color: var(--b2b-sp-gray);
    display: flex; justify-content: center; gap: 8px; align-items: center;
}
.b2b-sp-link { color: var(--b2b-sp-blue); text-decoration: none; font-weight: 600; }
.b2b-sp-link:hover { text-decoration: underline; }

/* ── Inquiry status message ── */
.b2b-inquiry-status {
    margin-top: 12px; font-size: .85rem; text-align: center;
    padding: 0; border-radius: 8px;
}
.b2b-inquiry-status.is-success {
    color: var(--b2b-sp-success); background: #f0fdf4;
    padding: 10px; border: 1px solid #bbf7d0;
}
.b2b-inquiry-status.is-error {
    color: var(--b2b-sp-danger); background: #fef2f2;
    padding: 10px; border: 1px solid #fecaca;
}

/* ══════════════════════════════════════
   CHAT MODAL
══════════════════════════════════════ */
.b2b-chat-modal-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--b2b-sp-primary), var(--b2b-sp-blue));
    display: flex; align-items: center; gap: 12px;
    border-radius: var(--b2b-sp-radius) var(--b2b-sp-radius) 0 0;
    flex-shrink: 0;
}
.b2b-chat-modal-avatar {
    width: 42px; height: 42px; border-radius: 50%;
    background: rgba(255,255,255,.22);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 1rem; color: #fff;
    flex-shrink: 0; border: 2px solid rgba(255,255,255,.3);
}
.b2b-chat-modal-name {
    color: #fff; font-weight: 700; font-size: 1rem; line-height: 1.2;
}
.b2b-chat-modal-status {
    color: rgba(255,255,255,.7); font-size: .75rem;
    display: flex; align-items: center; gap: 5px;
}
.b2b-chat-online-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: #4ade80; flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(74,222,128,.3);
}

/* Messages area */
.b2b-chat-modal-messages {
    flex: 1; overflow-y: auto; padding: 18px 16px;
    display: flex; flex-direction: column; gap: 14px;
    background: #f0f4f8; min-height: 280px; max-height: 380px;
}
.b2b-chat-loading {
    text-align: center; color: var(--b2b-sp-gray);
    font-size: .875rem; margin: auto;
}

/* Message bubbles */
.b2b-chat-msg {
    display: flex; align-items: flex-end; gap: 8px; max-width: 85%;
}
.b2b-chat-msg.b2b-chat-mine {
    margin-left: auto; flex-direction: row-reverse;
}
.b2b-chat-msg-av {
    width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, #64748b, #94a3b8);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .7rem; color: #fff;
}
.b2b-chat-msg.b2b-chat-mine .b2b-chat-msg-av {
    background: linear-gradient(135deg, var(--b2b-sp-primary), var(--b2b-sp-blue));
}
.b2b-chat-msg-body { display: flex; flex-direction: column; gap: 2px; }
.b2b-chat-msg-mine .b2b-chat-msg-body { align-items: flex-end; }
.b2b-chat-bubble {
    padding: 10px 14px; border-radius: 16px;
    font-size: .875rem; line-height: 1.5;
    max-width: 100%; word-break: break-word;
}
.b2b-chat-msg.b2b-chat-mine .b2b-chat-bubble {
    background: linear-gradient(135deg, var(--b2b-sp-primary), var(--b2b-sp-blue));
    color: #fff; border-bottom-right-radius: 4px;
}
.b2b-chat-msg:not(.b2b-chat-mine) .b2b-chat-bubble {
    background: #fff; color: #1e293b;
    border: 1px solid var(--b2b-sp-border);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.b2b-chat-msg-time {
    font-size: .7rem; color: var(--b2b-sp-gray); padding: 0 4px;
}

/* Inquiry card bubble */
.b2b-chat-inq-card {
    background: #eff6ff; border: 1px solid #bfdbfe;
    border-radius: 12px; padding: 12px 14px; font-size: .82rem;
}
.b2b-chat-inq-card strong { color: var(--b2b-sp-primary); display: block; margin-bottom: 4px; }
.b2b-chat-inq-meta { color: var(--b2b-sp-gray); margin-top: 4px; font-size: .78rem; }

/* Input area */
.b2b-chat-modal-input-wrap {
    padding: 12px 14px;
    background: #fff;
    border-top: 1px solid var(--b2b-sp-border);
    display: flex; gap: 10px; align-items: flex-end;
    flex-shrink: 0;
    border-radius: 0 0 var(--b2b-sp-radius) var(--b2b-sp-radius);
}
.b2b-chat-modal-input {
    flex: 1; border: 2px solid var(--b2b-sp-border);
    border-radius: 12px; padding: 10px 14px;
    font-size: .9rem; outline: none; resize: none;
    line-height: 1.4; font-family: inherit;
    transition: border .2s; max-height: 100px; overflow-y: auto;
    background: var(--b2b-sp-light);
}
.b2b-chat-modal-input:focus { border-color: var(--b2b-sp-accent); }
.b2b-chat-modal-send {
    width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--b2b-sp-primary), var(--b2b-sp-blue));
    border: none; color: #fff; cursor: pointer; font-size: 1rem;
    display: flex; align-items: center; justify-content: center;
    transition: all .2s; box-shadow: 0 4px 12px rgba(0,81,168,.3);
}
.b2b-chat-modal-send:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,81,168,.4); }
.b2b-chat-modal-send:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* ══════════════════════════════════════
   SUPPLIER INQUIRY REPLY (Dashboard)
══════════════════════════════════════ */
.b2b-inq-row { border-bottom: 1px solid #f1f5f9; }
.b2b-inq-row:last-child { border-bottom: none; }
.b2b-inq-main { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 16px; align-items: start; }
.b2b-inq-info { flex: 1; }
.b2b-inq-product { font-weight: 700; color: var(--b2b-sp-primary); font-size: .9rem; }
.b2b-inq-buyer { font-size: .8rem; color: var(--b2b-sp-gray); margin-top: 3px; }
.b2b-inq-msg-preview { font-size: .85rem; color: #374151; margin-top: 6px; line-height: 1.4; }
.b2b-inq-meta { font-size: .75rem; color: var(--b2b-sp-gray); margin-top: 4px; }
.b2b-inq-meta span { margin-right: 12px; }

.b2b-inq-reply-btn {
    padding: 7px 16px; border-radius: 8px;
    background: var(--b2b-sp-primary); color: #fff;
    border: none; cursor: pointer; font-size: .8rem; font-weight: 600;
    display: flex; align-items: center; gap: 6px; white-space: nowrap;
    transition: background .2s;
}
.b2b-inq-reply-btn:hover { background: var(--b2b-sp-blue); }
.b2b-inq-reply-btn.b2b-inq-view-btn {
    background: #eff6ff; color: var(--b2b-sp-blue);
    border: 1px solid #bfdbfe;
}
.b2b-inq-reply-btn.b2b-inq-view-btn:hover { background: #dbeafe; }

/* Thread panel */
.b2b-inq-thread {
    display: none;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 16px;
}
.b2b-inq-thread.active { display: block; }
.b2b-inq-thread-msgs { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; max-height: 300px; overflow-y: auto; }

.b2b-inq-bubble-wrap { display: flex; gap: 10px; align-items: flex-end; }
.b2b-inq-bubble-wrap.mine { flex-direction: row-reverse; }
.b2b-inq-bav {
    width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .72rem; color: #fff;
}
.b2b-inq-bubble-wrap:not(.mine) .b2b-inq-bav { background: linear-gradient(135deg, #64748b, #94a3b8); }
.b2b-inq-bubble-wrap.mine .b2b-inq-bav { background: linear-gradient(135deg, var(--b2b-sp-primary), var(--b2b-sp-blue)); }

.b2b-inq-bub {
    max-width: 75%; padding: 9px 13px; border-radius: 14px;
    font-size: .85rem; line-height: 1.5;
}
.b2b-inq-bubble-wrap:not(.mine) .b2b-inq-bub {
    background: #fff; border: 1px solid #e2e8f0; border-bottom-left-radius: 4px;
}
.b2b-inq-bubble-wrap.mine .b2b-inq-bub {
    background: linear-gradient(135deg, var(--b2b-sp-primary), var(--b2b-sp-blue));
    color: #fff; border-bottom-right-radius: 4px;
}
.b2b-inq-bub-inq { background: #eff6ff !important; border: 1px solid #bfdbfe !important; color: #1e3a5f !important; }
.b2b-inq-bub-inq strong { display: block; font-size: .78rem; color: var(--b2b-sp-blue); margin-bottom: 3px; }
.b2b-inq-btime { font-size: .7rem; color: var(--b2b-sp-gray); margin-top: 2px; padding: 0 3px; }
.b2b-inq-bubble-wrap.mine .b2b-inq-btime { text-align: right; }

.b2b-inq-reply-form { display: flex; gap: 10px; align-items: flex-end; }
.b2b-inq-reply-input {
    flex: 1; border: 2px solid #e2e8f0; border-radius: 10px;
    padding: 9px 13px; font-size: .875rem; resize: none;
    outline: none; font-family: inherit; max-height: 80px; overflow-y: auto;
    transition: border .2s; background: #fff;
}
.b2b-inq-reply-input:focus { border-color: var(--b2b-sp-accent); }
.b2b-inq-reply-send {
    width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--b2b-sp-primary), var(--b2b-sp-blue));
    border: none; color: #fff; cursor: pointer; font-size: .95rem;
    display: flex; align-items: center; justify-content: center;
    transition: all .2s;
}
.b2b-inq-reply-send:hover { transform: translateY(-1px); }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
    .b2b-sp-modal-dialog { border-radius: 14px; }
    .b2b-sp-form-row { grid-template-columns: 1fr; }
    .b2b-sp-qty-wrap { grid-template-columns: 1fr 90px; }
    .b2b-sp-modal-actions { flex-direction: column; }
    .b2b-sp-modal-actions .b2b-sp-btn-primary,
    .b2b-sp-modal-actions .b2b-sp-btn-secondary { width: 100%; justify-content: center; }
    .b2b-chat-modal-messages { min-height: 240px; max-height: 300px; }
    .b2b-inq-main { grid-template-columns: 1fr; }
}
@media (max-width: 400px) {
    .b2b-sp-modal-header { padding: 16px; }
    .b2b-sp-modal-body { padding: 16px; }
}

/* ================================================================
   INQUIRY CARD SYSTEM — v1.3.2 (Buyer + Supplier Dashboard)
================================================================ */

/* List wrapper */
.b2b-inq-list-wrap {
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 16px rgba(1,44,92,.07);
    overflow: hidden;
}
.b2b-inq-list-header {
    padding: 12px 20px;
    background: linear-gradient(90deg,#f8fafc,#f1f5f9);
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.b2b-inq-count-badge {
    background: linear-gradient(135deg,#012c5c,#0051a8);
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
    padding: 3px 12px;
    border-radius: 20px;
}

/* ── Individual Card ── */
.b2b-inq-card {
    border-bottom: 1px solid #f1f5f9;
    transition: background .15s, opacity .3s, transform .3s;
}
.b2b-inq-card:last-child { border-bottom: none; }
.b2b-inq-card:hover { background: #fafbff; }
.b2b-inq-card.b2b-inq-unread {
    border-left: 3px solid #3b82f6;
    background: linear-gradient(90deg,rgba(59,130,246,.04),transparent);
}
.b2b-inq-card.b2b-inq-deleting {
    opacity: 0;
    transform: translateX(-20px);
}

/* Card top row */
.b2b-inq-card-top {
    display: grid;
    grid-template-columns: 48px 1fr auto;
    gap: 14px;
    padding: 16px 18px;
    align-items: start;
    cursor: pointer;
    transition: background .15s;
}
.b2b-inq-card-top:hover { background: rgba(0,81,168,.025); }

/* Avatar */
.b2b-inq-buyer-av {
    width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg,#012c5c,#0051a8);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: .95rem;
    box-shadow: 0 3px 8px rgba(0,81,168,.22);
}

/* Info */
.b2b-inq-card-info { min-width: 0; }
.b2b-inq-card-title {
    font-weight: 700; font-size: .93rem; color: #0f172a;
    margin-bottom: 5px; line-height: 1.3;
    display: flex; align-items: center; flex-wrap: wrap; gap: 5px;
}
.b2b-inq-card-meta {
    display: flex; flex-wrap: wrap; gap: 6px 14px;
    font-size: .77rem; color: #64748b; margin-bottom: 5px;
}
.b2b-inq-card-meta span { display: flex; align-items: center; gap: 4px; }
.b2b-inq-card-meta a { color: #0051a8; text-decoration: none; }
.b2b-inq-card-meta a:hover { text-decoration: underline; }
.b2b-inq-card-contact {
    display: flex; flex-wrap: wrap; gap: 10px;
    font-size: .77rem; margin-bottom: 5px;
}
.b2b-inq-card-contact a {
    color: #0051a8; text-decoration: none;
    display: flex; align-items: center; gap: 4px;
}
.b2b-inq-card-contact a:hover { text-decoration: underline; }
.b2b-inq-card-msg {
    font-size: .83rem; color: #374151; line-height: 1.5; margin-top: 3px;
}

/* Actions */
.b2b-inq-card-actions {
    display: flex; flex-direction: column; align-items: flex-end;
    gap: 7px; flex-shrink: 0; min-width: 120px;
}
.b2b-inq-badge {
    background: #eff6ff; color: #1d4ed8;
    font-size: .71rem; font-weight: 700;
    padding: 2px 10px; border-radius: 20px; white-space: nowrap;
}
.b2b-inq-badge.b2b-inq-badge-replied { background: #f0fdf4; color: #15803d; }
.b2b-inq-reply-btn {
    background: linear-gradient(135deg,#012c5c,#0051a8);
    color: #fff; border: none; padding: 8px 14px;
    border-radius: 9px; font-size: .78rem; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; gap: 6px; white-space: nowrap;
    transition: all .2s; box-shadow: 0 2px 8px rgba(0,81,168,.22);
}
.b2b-inq-reply-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,81,168,.32); }
.b2b-inq-reply-btn.open { background: linear-gradient(135deg,#374151,#1f2937); }


/* ── Thread Panel ── */
.b2b-inq-thread {
    display: none !important;
    border-top: 1px solid #e8edf3;
}
.b2b-inq-thread.active { display: block !important; }
.b2b-inq-thread-inner {
    padding: 16px 18px;
    background: #f8fafc;
}
.b2b-inq-thread-msgs {
    display: flex; flex-direction: column; gap: 12px;
    margin-bottom: 14px; max-height: 360px; overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,81,168,.2) transparent;
}
.b2b-inq-thread-msgs::-webkit-scrollbar { width: 4px; }
.b2b-inq-thread-msgs::-webkit-scrollbar-thumb { background:rgba(0,81,168,.2); border-radius:99px; }

/* Thread status messages */
.b2b-thread-loading, .b2b-thread-empty, .b2b-thread-error {
    text-align: center; padding: 20px; color: #94a3b8; font-size: .84rem;
}
.b2b-thread-error { color: #dc2626; }
.b2b-thread-retry-btn {
    background: none; border: 1px solid #dc2626; color: #dc2626;
    padding: 3px 10px; border-radius: 6px; cursor: pointer; font-size: .78rem;
    margin-left: 8px;
}
.b2b-thread-send-error {
    color: #dc2626; font-size: .78rem; padding: 4px 0;
    text-align: center; display: none;
}

/* ── Thread Bubbles ── */
.b2b-inq-bubble-wrap {
    display: flex; gap: 8px; align-items: flex-end;
    max-width: 78%;
}
.b2b-inq-bubble-wrap.mine {
    margin-left: auto; flex-direction: row-reverse;
}
.b2b-inq-bav {
    width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .68rem; color: #fff;
    background: linear-gradient(135deg,#64748b,#94a3b8);
}
.b2b-inq-bubble-wrap.mine .b2b-inq-bav {
    background: linear-gradient(135deg,#012c5c,#0051a8);
}
.b2b-inq-bub-wrap-body { display: flex; flex-direction: column; gap: 2px; }
.b2b-inq-bubble-wrap.mine .b2b-inq-bub-wrap-body { align-items: flex-end; }

.b2b-inq-bub {
    padding: 9px 13px; border-radius: 14px;
    font-size: .85rem; line-height: 1.5; word-break: break-word;
}
.b2b-inq-bubble-wrap:not(.mine) .b2b-inq-bub {
    background: #fff; color: #1e293b;
    border: 1px solid #e2e8f0; border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.b2b-inq-bubble-wrap.mine .b2b-inq-bub {
    background: linear-gradient(135deg,#012c5c,#0051a8);
    color: #fff; border-bottom-right-radius: 4px;
    box-shadow: 0 4px 10px rgba(0,81,168,.22);
}
/* Original inquiry bubble */
.b2b-inq-bub-inq {
    background: #eff6ff !important; color: #1e3a5f !important;
    border: 1px solid #bfdbfe !important; box-shadow: none !important;
    border-bottom-left-radius: 4px !important;
}
.b2b-inq-bub-inq strong {
    display: block; font-size: .76rem; color: #1d4ed8; margin-bottom: 4px;
}
.b2b-inq-bub-inq p { margin: 0 0 6px; font-size: .83rem; }
.b2b-inq-bub-meta {
    display: flex; flex-wrap: wrap; gap: 8px;
    font-size: .74rem; color: #475569; margin-top: 4px;
}
.b2b-inq-bub-meta span { display: flex; align-items: center; gap: 4px; }
.b2b-inq-btime { font-size: .69rem; color: #94a3b8; padding: 0 3px; }
.b2b-inq-bubble-wrap.mine .b2b-inq-btime { text-align: right; }

/* ── Reply Form ── */
.b2b-inq-reply-form {
    display: flex; gap: 10px; align-items: flex-end;
}
.b2b-inq-reply-input {
    flex: 1; border: 2px solid #e2e8f0; border-radius: 10px;
    padding: 9px 13px; font-size: .875rem; resize: none; outline: none;
    font-family: inherit; max-height: 100px; overflow-y: auto;
    transition: border .2s; background: #fff; line-height: 1.4;
    box-sizing: border-box;
}
.b2b-inq-reply-input:focus { border-color: #3b82f6; }
.b2b-inq-reply-input:disabled { opacity: .6; cursor: not-allowed; }
.b2b-inq-reply-send {
    width: 42px; height: 42px; border-radius: 10px; flex-shrink: 0;
    background: linear-gradient(135deg,#012c5c,#0051a8);
    border: none; color: #fff; cursor: pointer; font-size: .9rem;
    display: flex; align-items: center; justify-content: center;
    transition: all .2s; box-shadow: 0 3px 8px rgba(0,81,168,.25);
}
.b2b-inq-reply-send:hover { transform: translateY(-1px); }
.b2b-inq-reply-send:disabled { opacity: .5; transform: none; cursor: not-allowed; }

/* ── Empty state ── */
.b2b-inq-empty {
    text-align: center; padding: 60px 20px; color: #94a3b8;
    background: #fff; border-radius: 14px; border: 1px solid #e2e8f0;
}
.b2b-inq-empty i { font-size: 3rem; display: block; margin-bottom: 14px; opacity: .22; }
.b2b-inq-empty h3 { color: #475569; margin: 0 0 8px; font-size: 1rem; }
.b2b-inq-empty p  { margin: 0; font-size: .875rem; }

/* ── Toast ── */
#b2b-inq-toast {
    position: fixed; bottom: 24px; right: 24px; z-index: 99999;
    background: linear-gradient(135deg,#012c5c,#0051a8);
    color: #fff; padding: 12px 18px; border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,81,168,.4);
    font-size: .86rem; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; gap: 10px;
    max-width: 320px; word-break: break-word;
    animation: b2b-slideInRight .35s ease;
}
.b2b-toast-refresh {
    text-decoration: underline; opacity: .85; white-space: nowrap;
}
@keyframes b2b-slideInRight {
    from { transform: translateX(60px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}



/* ════════════════════════════════════════
   RESPONSIVE — Mobile / Tablet / Desktop
════════════════════════════════════════ */

/* Tablet (768px and below) */
@media (max-width: 768px) {
    .b2b-inq-card-top {
        grid-template-columns: 40px 1fr;
        grid-template-rows: auto auto;
        gap: 10px;
        padding: 14px;
    }
    .b2b-inq-card-actions {
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: flex-end;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px;
        padding: 0 14px 12px;
    }
    /* Remove actions from grid flow */
    .b2b-inq-card-top .b2b-inq-card-actions {
        grid-row: 2;
        grid-column: 1 / -1;
    }
    /* Move actions outside grid on mobile - use flexbox on card */
    .b2b-inq-card { display: flex; flex-direction: column; }
    .b2b-inq-reply-btn { font-size: .75rem; padding: 7px 12px; }
    .b2b-inq-bubble-wrap { max-width: 90%; }
    .b2b-inq-thread-inner { padding: 12px 14px; }
    .b2b-inq-thread-msgs { max-height: 280px; }
}

/* Mobile (480px and below) */
@media (max-width: 480px) {
    .b2b-inq-card-top {
        grid-template-columns: 36px 1fr;
        padding: 12px;
        gap: 8px;
    }
    .b2b-inq-buyer-av { width: 36px; height: 36px; font-size: .82rem; }
    .b2b-inq-card-title { font-size: .86rem; }
    .b2b-inq-card-meta { font-size: .72rem; gap: 4px 10px; }
    .b2b-inq-card-msg { font-size: .78rem; }
    .b2b-inq-card-actions { padding: 0 12px 10px; gap: 6px; }
    .b2b-inq-reply-btn { font-size: .72rem; padding: 6px 10px; }
    .b2b-inq-bubble-wrap { max-width: 94%; }
    .b2b-inq-reply-form { gap: 7px; }
    .b2b-inq-reply-input { padding: 8px 11px; font-size: .83rem; }
    .b2b-inq-reply-send { width: 38px; height: 38px; }
    .b2b-inq-thread-msgs { max-height: 240px; }
    .b2b-inq-list-header { padding: 10px 14px; }
    #b2b-inq-toast {
        bottom: 12px; right: 12px; left: 12px;
        max-width: none; font-size: .82rem;
    }
}

/* ── Card structure (actions outside grid) ── */
.b2b-inq-card {
    border-bottom: 1px solid #f1f5f9;
    transition: background .15s, opacity .3s, transform .3s;
}
/* Card-top: simple 3-column grid — avatar | info | actions */
.b2b-inq-card-top {
    display: grid;
    grid-template-columns: 48px 1fr auto;
    gap: 14px;
    padding: 16px 18px;
    align-items: center;
    cursor: pointer;
}
.b2b-inq-card-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

/* ── Role badges ── */
.b2b-inq-role-badge {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: .68rem; font-weight: 700; padding: 2px 8px;
    border-radius: 10px; letter-spacing: .2px;
}
.b2b-inq-role-badge.sent     { background:#eff6ff; color:#1d4ed8; }
.b2b-inq-role-badge.received { background:#f0fdf4; color:#15803d; }
.b2b-inq-role-badge.pending  { background:#fef9c3; color:#854d0e; }

/* ── Delete (Trash) button ── */
.b2b-inq-delete-btn {
    width: 36px; height: 36px; border-radius: 8px;
    background: #fff; border: 1.5px solid #fecaca; color: #dc2626;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: .84rem; transition: all .2s; flex-shrink: 0;
}
.b2b-inq-delete-btn:hover { background: #fef2f2; border-color: #dc2626; transform: scale(1.06); }
.b2b-inq-delete-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* Reply + Trash side by side */
.b2b-inq-action-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ═══════════════════════════════════════════
   BOOST PAYMENT — Duration Grid + Payment UI
═══════════════════════════════════════════ */

/* Sub-tabs */
.b2b-boost-subtabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 2px solid #e5e7eb;
}
.b2b-boost-subtab {
    padding: 10px 22px;
    border: none;
    background: none;
    font-weight: 600;
    font-size: .88rem;
    color: #94a3b8;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all .2s;
}
.b2b-boost-subtab.active,
.b2b-boost-subtab:hover {
    color: #012c5c;
    border-bottom-color: #012c5c;
}

/* Duration selection grid */
.b2b-duration-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 6px;
}
.b2b-duration-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px 10px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all .2s;
    background: #fff;
    text-align: center;
    user-select: none;
}
.b2b-duration-card:hover {
    border-color: #93c5fd;
    background: #f0f9ff;
}
.b2b-duration-card.selected {
    border-color: #0051a8;
    background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(0,81,168,.1);
}
.b2b-dur-days {
    font-size: 1.3rem;
    font-weight: 800;
    color: #012c5c;
    line-height: 1;
}
.b2b-dur-days small {
    font-size: .7rem;
    font-weight: 500;
    color: #64748b;
    display: block;
    margin-top: 2px;
}
.b2b-dur-price {
    font-size: .78rem;
    font-weight: 700;
    color: #0051a8;
    margin-top: 6px;
    background: #eff6ff;
    padding: 2px 8px;
    border-radius: 20px;
}
.b2b-duration-card.selected .b2b-dur-price {
    background: #0051a8;
    color: #fff;
}

/* Order summary box */
.b2b-order-summary-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Bank info card */
.b2b-bank-info-card {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 14px;
}
.b2b-bank-info-card h4 {
    margin: 0 0 10px;
    color: #1d4ed8;
    font-size: .88rem;
}
.b2b-bank-info-card table {
    width: 100%;
    font-size: 13px;
    border-collapse: collapse;
}
.b2b-bank-info-card td {
    padding: 5px 10px 5px 0;
    vertical-align: top;
}
.b2b-bank-info-card td:first-child {
    padding-right: 16px;
    white-space: nowrap;
    min-width: 120px;
}

/* Pay method buttons hover */
.b2b-pay-method-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
}

/* Responsive */
@media (max-width: 600px) {
    .b2b-duration-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .b2b-boost-subtab {
        padding: 8px 12px;
        font-size: .8rem;
    }
}
