/* ═══════════════════════════════════════════════════════════════════════
   MRRECIPE — Support Chat Widget CSS  •  Premium Edition v2.1
   - موقعیت: پایین-چپ صفحه  ← تغییر: نسخه قبلی پایین-راست بود
   - هماهنگ با ۶ تم (light/dark/sky/emerald/purple/gold)
   - موبایل: bottom-sheet با dvh و safe-area + سایز لمسی بزرگ‌تر
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ───────────────────────────────────────────────────── */
.mr-sc {
    --mr-sc-primary:    var(--primary, #1a56db);
    --mr-sc-secondary:  var(--secondary, #6366f1);
    --mr-sc-primary-10: color-mix(in srgb, var(--mr-sc-primary) 10%, transparent);
    --mr-sc-primary-20: color-mix(in srgb, var(--mr-sc-primary) 20%, transparent);
    --mr-sc-primary-40: color-mix(in srgb, var(--mr-sc-primary) 40%, transparent);

    --mr-sc-bg:        var(--bg-card, #ffffff);
    --mr-sc-surface:   var(--surface-2, #f8fafc);
    --mr-sc-text:      var(--text, #0f172a);
    --mr-sc-text-muted:var(--text-muted, #64748b);
    --mr-sc-border:    var(--border, #e2e8f0);
    --mr-sc-border-2:  color-mix(in srgb, var(--mr-sc-border) 70%, transparent);

    --mr-sc-radius-sm: 10px;
    --mr-sc-radius:    14px;
    --mr-sc-radius-lg: 20px;

    --mr-sc-shadow-sm: 0 1px 2px rgba(15,23,42,.05), 0 2px 6px rgba(15,23,42,.04);
    --mr-sc-shadow:    0 4px 12px rgba(15,23,42,.06), 0 12px 32px rgba(15,23,42,.10);
    --mr-sc-shadow-lg: 0 12px 28px rgba(15,23,42,.12), 0 32px 64px -16px rgba(15,23,42,.28);
    --mr-sc-shadow-primary: 0 8px 20px -4px var(--mr-sc-primary-40), 0 4px 10px -2px var(--mr-sc-primary-20);

    --mr-sc-ease: cubic-bezier(.22,.9,.32,1.05);
    --mr-sc-ease-out: cubic-bezier(.16,1,.3,1);

    --mr-sc-font: 'Vazirmatn', 'Segoe UI', Tahoma, system-ui, -apple-system, sans-serif;
}

.mr-sc, .mr-sc * { box-sizing: border-box; }
.mr-sc [hidden],
.mr-sc-panel[hidden] { display: none !important; }

/* ── Container — پایین-چپ (P0-fix: قبلاً پایین-راست بود) ───────────── */
.mr-sc {
    position: fixed;
    bottom: 22px;
    left: 22px;              /* ← تغییر: چپ */
    right: auto;             /* ← تغییر */
    z-index: 9998;
    font-family: var(--mr-sc-font);
    direction: rtl;
    line-height: 1.6;
    color: var(--mr-sc-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
	
}

/* ── Floating Action Button ──────────────────────────────────────────── */
.mr-sc-toggle {
    position: relative;
    width: 60px; height: 60px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.22);
    background:
        radial-gradient(120% 120% at 30% 20%, rgba(255,255,255,.28), transparent 55%),
        linear-gradient(135deg, var(--mr-sc-primary), var(--mr-sc-secondary));
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow:
        var(--mr-sc-shadow-primary),
        inset 0 1px 0 rgba(255,255,255,.35),
        inset 0 -2px 6px rgba(0,0,0,.08);
    transition: transform .35s var(--mr-sc-ease),
                box-shadow .35s var(--mr-sc-ease),
                filter .25s ease;
    isolation: isolate;
    overflow: hidden;
}

.mr-sc-toggle::before {
    content: "";
    position: absolute; inset: -2px;
    background: conic-gradient(from 0deg,
        transparent 0deg,
        rgba(255,255,255,.35) 60deg,
        transparent 120deg,
        transparent 360deg);
    border-radius: inherit;
    opacity: 0;
    transition: opacity .35s ease;
    z-index: -1;
    animation: mrScSpin 6s linear infinite;
}
.mr-sc-toggle:hover::before { opacity: .9; }

.mr-sc-toggle:hover {
    transform: translateY(-3px) scale(1.06);
    box-shadow:
        0 14px 32px -6px var(--mr-sc-primary-40),
        0 8px 16px -4px var(--mr-sc-primary-20),
        inset 0 1px 0 rgba(255,255,255,.45);
}
.mr-sc-toggle:active { transform: translateY(-1px) scale(1.02); }

.mr-sc-toggle:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 4px var(--mr-sc-primary-20),
        0 0 0 8px var(--mr-sc-bg),
        0 12px 28px -6px var(--mr-sc-primary-40);
}

@keyframes mrScSpin { to { transform: rotate(360deg); } }

/* ── Badge — سمت راست دکمه (P0-fix: قبلاً سمت چپ بود) ──────────────── */
.mr-sc-badge {
    position: absolute; top: -3px; right: -3px; left: auto;  /* ← تغییر */
    min-width: 22px; height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    font-size: 11px; font-weight: 800;
    letter-spacing: .3px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 0 2px var(--mr-sc-bg), 0 4px 10px -2px rgba(220,38,38,.5);
    animation: mrScBadgePulse 2.2s var(--mr-sc-ease) infinite;
}
@keyframes mrScBadgePulse {
    0%, 100% { box-shadow: 0 0 0 2px var(--mr-sc-bg), 0 4px 10px -2px rgba(220,38,38,.5), 0 0 0 0 rgba(239,68,68,.5); }
    50%      { box-shadow: 0 0 0 2px var(--mr-sc-bg), 0 4px 10px -2px rgba(220,38,38,.5), 0 0 0 8px rgba(239,68,68,0); }
}

/* ── Chat Panel — باز شدن به سمت راست دکمه ─────────────────────────── */
.mr-sc-panel {
    position: absolute;
    bottom: 78px;
    left: 0;                 /* ← تغییر: چپ‌تراز با دکمه */
    right: auto;             /* ← تغییر */
    width: 400px;
    max-width: calc(100vw - 44px);
    max-height: 620px;
    display: flex; flex-direction: column;
    background: var(--mr-sc-bg);
    color: var(--mr-sc-text);
    border: 1px solid var(--mr-sc-border-2);
    border-radius: var(--mr-sc-radius-lg);
    box-shadow: var(--mr-sc-shadow-lg);
    overflow: hidden;
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    transform-origin: bottom left;   /* ← تغییر: از گوشه چپ-پایین باز شود */
    animation: mrScPanelIn .38s var(--mr-sc-ease-out);
}
@keyframes mrScPanelIn {
    from { opacity: 0; transform: translateY(14px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.mr-sc-panel::before {
    content: "";
    position: absolute; inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg,
        var(--mr-sc-primary),
        var(--mr-sc-secondary),
        var(--mr-sc-primary));
    background-size: 200% 100%;
    animation: mrScGradientShift 6s ease infinite;
    z-index: 2;
}
@keyframes mrScGradientShift {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

/* ── Header ──────────────────────────────────────────────────────────── */
.mr-sc-header {
    position: relative;
    padding: 14px 16px;
    display: flex; align-items: center; justify-content: space-between;
    color: #fff;
    background:
        radial-gradient(140% 140% at 90% 0%, rgba(255,255,255,.16), transparent 55%),
        linear-gradient(135deg, var(--mr-sc-primary), var(--mr-sc-secondary));
    overflow: hidden;
}
.mr-sc-header::after {
    content: "";
    position: absolute; inset: 0;
    background:
        repeating-linear-gradient(45deg, rgba(255,255,255,.05) 0 2px, transparent 2px 8px);
    pointer-events: none;
    opacity: .6;
}

.mr-sc-title {
    display: flex; align-items: center; gap: 10px;
    font-weight: 700; font-size: .95rem;
    letter-spacing: .15px;
    position: relative; z-index: 1;
}

.mr-sc-title::before {
    content: "";
    width: 9px; height: 9px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 0 0 rgba(74,222,128,.9);
    animation: mrScOnline 2s ease-out infinite;
    flex-shrink: 0;
}
@keyframes mrScOnline {
    0%   { box-shadow: 0 0 0 0 rgba(74,222,128,.85); }
    70%  { box-shadow: 0 0 0 8px rgba(74,222,128,0); }
    100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); }
}

.mr-sc-title small {
    font-size: .72rem;
    opacity: .85;
    font-weight: 500;
    margin-inline-start: 6px;
    padding-inline-start: 8px;
    border-inline-start: 1px solid rgba(255,255,255,.35);
}

.mr-sc-close {
    position: relative; z-index: 1;
    width: 32px; height: 32px;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.18);
    color: #fff;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s ease, transform .2s var(--mr-sc-ease);
    backdrop-filter: blur(6px);
}
.mr-sc-close:hover {
    background: rgba(255,255,255,.22);
    transform: rotate(90deg);
}
.mr-sc-close:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255,255,255,.4);
}

/* ── Identify (Guest form) ───────────────────────────────────────────── */
.mr-sc-identify {
    padding: 18px 18px 20px;
    overflow-y: auto;
}
.mr-sc-welcome {
    font-size: .9rem;
    line-height: 1.9;
    margin: 0 0 16px;
    color: var(--mr-sc-text);
    padding: 12px 14px;
    background: linear-gradient(135deg, var(--mr-sc-primary-10), transparent 80%);
    border: 1px solid var(--mr-sc-border-2);
    border-radius: var(--mr-sc-radius);
    border-inline-start: 3px solid var(--mr-sc-primary);
}

.mr-sc-field { margin-bottom: 14px; }
.mr-sc-field label {
    display: block;
    font-size: .82rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--mr-sc-text);
    letter-spacing: .1px;
}
.mr-sc-field label span { color: #dc2626; }

.mr-sc-field input {
    width: 100%;
    padding: 11px 14px;
    font-family: inherit;
    font-size: .9rem;
    background: var(--mr-sc-surface);
    color: var(--mr-sc-text);
    border: 1.5px solid var(--mr-sc-border);
    border-radius: var(--mr-sc-radius-sm);
    transition: border-color .2s ease,
                box-shadow .2s ease,
                background .2s ease;
}
.mr-sc-field input::placeholder { color: var(--mr-sc-text-muted); opacity: .7; }
.mr-sc-field input:hover { border-color: color-mix(in srgb, var(--mr-sc-border) 50%, var(--mr-sc-primary)); }
.mr-sc-field input:focus {
    outline: none;
    border-color: var(--mr-sc-primary);
    background: var(--mr-sc-bg);
    box-shadow: 0 0 0 4px var(--mr-sc-primary-10);
}
.mr-sc-field input[dir="ltr"] { text-align: left; }

.mr-sc-consent {
    font-size: .73rem;
    color: var(--mr-sc-text-muted);
    margin: 8px 0 14px;
    line-height: 1.75;
    padding-inline-start: 10px;
    border-inline-start: 2px solid var(--mr-sc-border);
}

.mr-sc-submit {
    position: relative;
    width: 100%;
    padding: 12px;
    font-family: inherit;
    font-size: .9rem;
    font-weight: 700;
    letter-spacing: .2px;
    color: #fff;
    background: linear-gradient(135deg, var(--mr-sc-primary), var(--mr-sc-secondary));
    border: none;
    border-radius: var(--mr-sc-radius-sm);
    cursor: pointer;
    overflow: hidden;
    box-shadow: var(--mr-sc-shadow-primary);
    transition: transform .2s var(--mr-sc-ease),
                box-shadow .25s ease,
                filter .2s ease;
}
.mr-sc-submit::before {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(120deg, transparent 20%, rgba(255,255,255,.35) 50%, transparent 80%);
    transform: translateX(-120%);
    transition: transform .6s var(--mr-sc-ease-out);
}
.mr-sc-submit:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
    box-shadow:
        0 12px 26px -6px var(--mr-sc-primary-40),
        0 6px 14px -4px var(--mr-sc-primary-20);
}
.mr-sc-submit:hover::before { transform: translateX(120%); }
.mr-sc-submit:active { transform: translateY(0) scale(.99); }
.mr-sc-submit:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px var(--mr-sc-primary-20);
}
.mr-sc-submit:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.mr-sc-error {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: var(--mr-sc-radius-sm);
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #7f1d1d;
    font-size: .82rem;
    font-weight: 600;
    border-inline-start: 3px solid #dc2626;
    animation: mrScShake .35s ease;
}
@keyframes mrScShake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-4px); }
    75%      { transform: translateX(4px); }
}

/* ── Chat Container ──────────────────────────────────────────────────── */
.mr-sc-chat {
    display: flex; flex-direction: column;
    flex: 1; min-height: 340px; max-height: 500px;
}

.mr-sc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex; flex-direction: column; gap: 12px;
    background:
        radial-gradient(80% 60% at 100% 0%, var(--mr-sc-primary-10), transparent 70%),
        var(--mr-sc-surface);
    scroll-behavior: smooth;
}

.mr-sc-messages::-webkit-scrollbar { width: 6px; }
.mr-sc-messages::-webkit-scrollbar-track { background: transparent; }
.mr-sc-messages::-webkit-scrollbar-thumb {
    background: var(--mr-sc-border);
    border-radius: 999px;
    transition: background .2s;
}
.mr-sc-messages::-webkit-scrollbar-thumb:hover { background: var(--mr-sc-primary-40); }
.mr-sc-messages { scrollbar-width: thin; scrollbar-color: var(--mr-sc-border) transparent; }

/* ── Messages ────────────────────────────────────────────────────────── */
.mr-sc-msg {
    display: flex;
    animation: mrScMsgIn .32s var(--mr-sc-ease-out) both;
}
@keyframes mrScMsgIn {
    from { opacity: 0; transform: translateY(6px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.mr-sc-msg-user { justify-content: flex-start; }
.mr-sc-msg-bot  { justify-content: flex-end; }

.mr-sc-bubble {
    position: relative;
    max-width: 84%;
    padding: 11px 15px;
    border-radius: 16px;
    font-size: .88rem;
    line-height: 1.85;
    word-wrap: break-word;
    overflow-wrap: anywhere;

    /* ✅ FIX Bidi: pre-line + isolate (رفع بریده‌شدن حرف اول در RTL) */
    white-space: pre-line;
    unicode-bidi: isolate;
    direction: rtl;
    text-align: right;

    box-shadow: var(--mr-sc-shadow-sm);
}

/* پیام کاربر */
.mr-sc-msg-user .mr-sc-bubble {
    background:
        radial-gradient(120% 120% at 100% 0%, rgba(255,255,255,.14), transparent 55%),
        linear-gradient(135deg, var(--mr-sc-primary), var(--mr-sc-secondary));
    color: #fff;
    border-bottom-right-radius: 5px;
    box-shadow:
        0 4px 12px -3px var(--mr-sc-primary-40),
        inset 0 1px 0 rgba(255,255,255,.22);
}
.mr-sc-msg-user .mr-sc-bubble::after {
    content: "";
    position: absolute; bottom: 0; right: -6px;
    width: 12px; height: 12px;
    background: inherit;
    -webkit-mask: radial-gradient(circle at top left, #000 69%, transparent 71%);
    mask: radial-gradient(circle at top left, #000 69%, transparent 71%);
    border-bottom-right-radius: 12px;
}

/* پیام ربات */
.mr-sc-msg-bot .mr-sc-bubble {
    background: var(--mr-sc-bg);
    color: var(--mr-sc-text);
    border: 1px solid var(--mr-sc-border-2);
    border-bottom-left-radius: 5px;
    box-shadow:
        0 2px 8px -2px rgba(15,23,42,.08),
        inset 0 1px 0 rgba(255,255,255,.5);
}
.mr-sc-msg-bot .mr-sc-bubble::after {
    content: "";
    position: absolute; bottom: 0; left: -6px;
    width: 12px; height: 12px;
    background: inherit;
    border-bottom: 1px solid var(--mr-sc-border-2);
    border-left: 1px solid var(--mr-sc-border-2);
    -webkit-mask: radial-gradient(circle at top right, #000 69%, transparent 71%);
    mask: radial-gradient(circle at top right, #000 69%, transparent 71%);
    border-bottom-left-radius: 12px;
}
.mr-sc-msg-bot .mr-sc-bubble em {
    font-style: normal;
    font-size: .78rem;
    color: var(--mr-sc-text-muted);
    display: inline-block;
    margin-top: 4px;
}

/* ── Typing Indicator ────────────────────────────────────────────────── */
.mr-sc-msg-typing .mr-sc-bubble {
    font-style: normal;
    opacity: 1;
    padding: 14px 18px;
    min-width: 60px;
    color: var(--mr-sc-text-muted);
}
.mr-sc-msg-typing .mr-sc-bubble::before {
    content: "";
    display: inline-flex;
    gap: 4px;
    width: 34px; height: 8px;
    background-image:
        radial-gradient(circle, currentColor 40%, transparent 45%),
        radial-gradient(circle, currentColor 40%, transparent 45%),
        radial-gradient(circle, currentColor 40%, transparent 45%);
    background-size: 8px 8px;
    background-position: 0 0, 13px 0, 26px 0;
    background-repeat: no-repeat;
    animation: mrScTyping 1.3s ease-in-out infinite;
    vertical-align: middle;
}
@keyframes mrScTyping {
    0%, 60%, 100% { opacity: .35; transform: translateY(0); }
    30%           { opacity: 1;   transform: translateY(-2px); }
}

/* ── Financial Message ───────────────────────────────────────────────── */
.mr-sc-msg-financial .mr-sc-bubble {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    color: #78350f;
    border: 1px solid #fde68a;
    box-shadow:
        0 4px 14px -4px rgba(245,158,11,.35),
        inset 0 1px 0 rgba(255,255,255,.6);
    position: relative;
}
.mr-sc-msg-financial .mr-sc-bubble::before {
    content: "⚠";
    display: inline-block;
    margin-inline-end: 6px;
    font-size: 1rem;
    vertical-align: -1px;
}

/* ── Input Row ───────────────────────────────────────────────────────── */
.mr-sc-inputrow {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--mr-sc-border-2);
    background: var(--mr-sc-bg);
    align-items: flex-end;
}
.mr-sc-inputrow textarea {
    flex: 1;
    resize: none;
    font-family: inherit;
    font-size: .9rem;
    line-height: 1.6;
    padding: 11px 14px;
    border-radius: 12px;
    background: var(--mr-sc-surface);
    color: var(--mr-sc-text);
    border: 1.5px solid var(--mr-sc-border);
    max-height: 120px;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.mr-sc-inputrow textarea::placeholder { color: var(--mr-sc-text-muted); opacity: .7; }
.mr-sc-inputrow textarea:hover { border-color: color-mix(in srgb, var(--mr-sc-border) 50%, var(--mr-sc-primary)); }
.mr-sc-inputrow textarea:focus {
    outline: none;
    border-color: var(--mr-sc-primary);
    background: var(--mr-sc-bg);
    box-shadow: 0 0 0 4px var(--mr-sc-primary-10);
}

.mr-sc-send {
    width: 46px; height: 46px;
    flex-shrink: 0;
    border: none;
    border-radius: 12px;
    background:
        radial-gradient(120% 120% at 30% 20%, rgba(255,255,255,.22), transparent 55%),
        linear-gradient(135deg, var(--mr-sc-primary), var(--mr-sc-secondary));
    color: #fff;
    font-size: 1.05rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--mr-sc-shadow-primary);
    transition: transform .2s var(--mr-sc-ease),
                box-shadow .25s ease,
                filter .2s ease;
}
.mr-sc-send:hover {
    transform: translateY(-2px) scale(1.04);
    filter: brightness(1.06);
    box-shadow:
        0 12px 24px -6px var(--mr-sc-primary-40),
        0 6px 12px -4px var(--mr-sc-primary-20);
}
.mr-sc-send:active { transform: translateY(0) scale(.98); }
.mr-sc-send:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px var(--mr-sc-primary-20);
}
.mr-sc-send:disabled { opacity: .5; cursor: not-allowed; transform: none; filter: grayscale(.3); }

/* ═══════════════════════════════════════════════════════════════════════
   MOBILE — bottom-sheet + safe-area + dvh
   P0-fix: دکمه به چپ منتقل شد + safe-area-inset-left + سایز لمسی بزرگ‌تر
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {

    .mr-sc {
        position: fixed !important;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
        left:  calc(16px + env(safe-area-inset-left,  0px)) !important;   /* ← تغییر */
        right: auto !important;                                           /* ← تغییر */
        top: auto !important;
        z-index: 2147483000 !important;
        transform: none !important;
        filter: none !important;
        will-change: auto !important;
        contain: none !important;
    }

    /* دکمه بزرگ‌تر برای لمس راحت‌تر */
    .mr-sc-toggle {
        width: 60px; height: 60px;   /* ← تغییر: از 56 به 60 */
        font-size: 22px;             /* ← تغییر */
    }

    /* Badge بزرگ‌تر در موبایل برای خوانایی */
    .mr-sc-badge {
        min-width: 24px; height: 24px;
        font-size: 12px;
    }

    /* پنل تمام‌عرض bottom-sheet */
    .mr-sc-panel {
        position: fixed !important;
        inset: auto 0 0 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 78dvh;
        max-height: 78dvh;
        border-radius: 22px 22px 0 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        transform-origin: bottom center;
        animation: mrScPanelInMobile .42s var(--mr-sc-ease-out);
        z-index: 2147483000 !important;
    }
    @keyframes mrScPanelInMobile {
        from { opacity: 0; transform: translateY(100%); }
        to   { opacity: 1; transform: translateY(0); }
    }
    .mr-sc-panel::before { border-radius: 22px 22px 0 0; }

    .mr-sc-chat { min-height: 0; max-height: none; flex: 1; }
    .mr-sc-messages { padding: 14px 12px; flex: 1; min-height: 0; }
    .mr-sc-inputrow {
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }

    .mr-sc-bubble { max-width: 88%; }

    /* حذف دنباله حباب در موبایل (تمیزتر) */
    .mr-sc-msg-user .mr-sc-bubble::after,
    .mr-sc-msg-bot  .mr-sc-bubble::after { display: none; }
}

/* موبایل‌های خیلی کوچک — کاهش بیشتر فاصله‌ها */
@media (max-width: 360px) {
    .mr-sc {
        bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
        left:  calc(12px + env(safe-area-inset-left,  0px)) !important;
    }
    .mr-sc-toggle {
        width: 54px; height: 54px;
        font-size: 20px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   Dark Theme
   ═══════════════════════════════════════════════════════════════════════ */
[data-theme="dark"] .mr-sc-msg-financial .mr-sc-bubble {
    background: linear-gradient(135deg, #422006, #451a03);
    color: #fde68a;
    border-color: #78350f;
    box-shadow:
        0 4px 14px -4px rgba(245,158,11,.25),
        inset 0 1px 0 rgba(255,255,255,.06);
}
[data-theme="dark"] .mr-sc-error {
    background: linear-gradient(135deg, #450a0a, #7f1d1d);
    color: #fecaca;
    border-inline-start-color: #ef4444;
}
[data-theme="dark"] .mr-sc-msg-bot .mr-sc-bubble {
    box-shadow:
        0 2px 8px -2px rgba(0,0,0,.4),
        inset 0 1px 0 rgba(255,255,255,.04);
}
[data-theme="dark"] .mr-sc-welcome {
    background: linear-gradient(135deg, var(--mr-sc-primary-10), transparent 80%);
}

/* ── Reduced Motion ──────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .mr-sc *, .mr-sc *::before, .mr-sc *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ── Print ───────────────────────────────────────────────────────────── */
@media print {
    .mr-sc { display: none !important; }
}

/* ── پاسخ‌های ادمین (تیکت مهمان) ── */
.mr-sc-msg-admin .mr-sc-bubble {
    background: linear-gradient(135deg, #dbeafe, #e0e7ff);
    border: 2px solid var(--primary, #1a56db);
    color: #1e3a8a;
    font-weight: 500;
    position: relative;
}
.mr-sc-msg-admin .mr-sc-bubble::before {
    content: "👤 پاسخ پشتیبان";
    display: block;
    font-size: .72rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--primary, #1a56db);
}
[data-theme="dark"] .mr-sc-msg-admin .mr-sc-bubble {
    background: linear-gradient(135deg, #1e3a8a, #312e81);
    color: #dbeafe;
    border-color: #60a5fa;
}
[data-theme="dark"] .mr-sc-msg-admin .mr-sc-bubble::before {
    color: #93c5fd;
}