/* سیستم دپارتمان پشتیبانی — ویجت چت و صفحات پنل مشتری
   همه کلاس‌ها با پیشوند sdw- هستند تا با قالب تداخل نداشته باشند */
.sdw, .sdw-thread {
    --sd-c: var(--sd-color, var(--brand, #e11d48));
    --sd-c-soft: color-mix(in oklab, var(--sd-c) 10%, white);
    --sd-c-dark: color-mix(in oklab, var(--sd-c) 82%, black);
    --sd-ink: var(--c-text, #0f172a);
    --sd-muted: var(--c-muted, #64748b);
    --sd-line: #e7e9ee;
    --sd-bg: #f5f6f8;
    --sd-in: #ffffff;
    --sd-radius: 18px;
    --sd-shadow: 0 24px 60px -18px rgb(16 24 40 / .35), 0 2px 10px -2px rgb(16 24 40 / .08);
    font-family: var(--font-main, "Vazirmatn"), "Vazirmatn", ui-sans-serif, system-ui, sans-serif;
    color: var(--sd-ink);
    line-height: 1.7;
    -webkit-tap-highlight-color: transparent;
}
.sdw *, .sdw-thread * { box-sizing: border-box; }
.sdw button, .sdw-thread button { font: inherit; cursor: pointer; }
.sdw svg, .sdw-thread svg { display: block; flex-shrink: 0; }

/* ---------- دکمه شناور ---------- */
.sdw-launcher {
    position: fixed; z-index: 60; bottom: calc(var(--sd-bottom, 24px) + env(safe-area-inset-bottom, 0px));
    display: inline-flex; align-items: center; gap: .55rem;
    height: 56px; min-width: 56px; padding: 0 1.1rem 0 1.1rem; border: 0; border-radius: 999px;
    background: var(--sd-c); color: #fff; font-weight: 700; font-size: .875rem;
    box-shadow: 0 12px 28px -8px color-mix(in oklab, var(--sd-c) 65%, transparent), inset 0 1px 0 rgb(255 255 255 / .2);
    transition: transform .25s cubic-bezier(.2,.9,.3,1.3), opacity .2s, box-shadow .2s;
}
.sdw-launcher:hover { transform: translateY(-2px); box-shadow: 0 16px 34px -8px color-mix(in oklab, var(--sd-c) 70%, transparent); }
.sdw-launcher:focus-visible { outline: 3px solid color-mix(in oklab, var(--sd-c) 40%, white); outline-offset: 3px; }
.sdw-launcher.is-icon { width: 56px; padding: 0; justify-content: center; }
.sdw-launcher svg { width: 26px; height: 26px; }
.sdw-pos-left .sdw-launcher { left: 24px; }
.sdw-pos-right .sdw-launcher { right: 24px; }
.sdw-mobile.sdw-pos-left .sdw-launcher { left: 16px; }
.sdw-mobile.sdw-pos-right .sdw-launcher { right: 16px; }
.sdw-mobile .sdw-launcher { width: 54px; height: 54px; min-width: 54px; padding: 0; justify-content: center; }
.sdw-mobile .sdw-launcher-label { display: none; }
.sdw.is-open .sdw-launcher { transform: scale(.6); opacity: 0; pointer-events: none; }
.sdw-badge {
    position: absolute; top: -4px; inset-inline-end: -4px; min-width: 22px; height: 22px; padding: 0 6px;
    border-radius: 999px; background: #ef4444; color: #fff; font-size: 11px; font-weight: 800; line-height: 22px; text-align: center;
    box-shadow: 0 0 0 3px #fff; animation: sdw-pop .35s cubic-bezier(.2,.9,.3,1.4);
}
.sdw-badge[hidden] { display: none; }
.sdw-dot { position: absolute; top: 6px; inset-inline-end: 6px; width: 11px; height: 11px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 2px var(--sd-c); }
.sdw-launcher:not(.is-icon) .sdw-dot { position: static; box-shadow: none; width: 8px; height: 8px; }

/* پیش‌نمایش پیام جدید کنار دکمه */
.sdw-peek {
    position: fixed; z-index: 60; bottom: calc(var(--sd-bottom, 24px) + 66px + env(safe-area-inset-bottom, 0px));
    max-width: min(320px, calc(100vw - 32px)); padding: .8rem 1rem; border-radius: 16px; background: #fff;
    box-shadow: var(--sd-shadow); font-size: .8125rem; color: var(--sd-ink); cursor: pointer; text-align: start;
    border: 1px solid rgb(16 24 40 / .06); animation: sdw-rise .35s cubic-bezier(.2,.9,.3,1.2);
}
.sdw-peek b { display: block; font-size: .75rem; color: var(--sd-c); margin-bottom: .15rem; }
.sdw-peek span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sdw-pos-left .sdw-peek { left: 24px; }
.sdw-pos-right .sdw-peek { right: 24px; }
.sdw-mobile.sdw-pos-left .sdw-peek { left: 16px; }
.sdw-mobile.sdw-pos-right .sdw-peek { right: 16px; }
.sdw-peek-x { position: absolute; top: 6px; inset-inline-end: 6px; width: 22px; height: 22px; border: 0; border-radius: 50%; background: var(--sd-bg); color: var(--sd-muted); display: grid; place-items: center; }

/* ---------- پنل ---------- */
.sdw-panel {
    position: fixed; z-index: 90; bottom: calc(var(--sd-bottom, 24px) + env(safe-area-inset-bottom, 0px));
    width: 380px; height: min(640px, calc(100vh - 48px)); max-height: calc(100vh - 48px);
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--sd-bg); border-radius: 22px; box-shadow: var(--sd-shadow); border: 1px solid rgb(16 24 40 / .06);
    opacity: 0; visibility: hidden; transform: translateY(18px) scale(.97); transform-origin: bottom center;
    transition: opacity .22s ease, transform .28s cubic-bezier(.2,.9,.3,1.15), visibility .22s;
}
.sdw-pos-left .sdw-panel { left: 24px; transform-origin: bottom left; }
.sdw-pos-right .sdw-panel { right: 24px; transform-origin: bottom right; }
.sdw.is-open .sdw-panel { opacity: 1; visibility: visible; transform: none; }
.sdw-mobile .sdw-panel {
    inset: 0 !important; width: 100%; height: var(--sd-vh, 100dvh); max-height: none; border-radius: 0; border: 0;
    transform: translateY(24px);
}
html.sdw-lock, html.sdw-lock body { overflow: hidden !important; }

.sdw-head {
    position: relative; flex-shrink: 0; display: flex; align-items: center; gap: .65rem;
    padding: 14px 14px 14px 14px; padding-top: max(14px, env(safe-area-inset-top, 0px));
    background: linear-gradient(135deg, var(--sd-c), var(--sd-c-dark)); color: #fff;
}
.sdw-head-icon { width: 42px; height: 42px; border-radius: 14px; background: rgb(255 255 255 / .18); display: grid; place-items: center; }
.sdw-head-icon svg { width: 24px; height: 24px; }
.sdw-head-text { flex: 1; min-width: 0; }
.sdw-head-title { display: block; font-weight: 800; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sdw-head-sub { display: flex; align-items: center; gap: .35rem; font-size: .72rem; opacity: .92; }
.sdw-status { width: 8px; height: 8px; border-radius: 50%; background: #fbbf24; flex-shrink: 0; }
.sdw-status.is-online { background: #4ade80; box-shadow: 0 0 0 3px rgb(74 222 128 / .25); }
.sdw-hbtn { width: 36px; height: 36px; border: 0; border-radius: 12px; background: transparent; color: #fff; display: grid; place-items: center; transition: background .15s; }
.sdw-hbtn:hover, .sdw-hbtn:focus-visible { background: rgb(255 255 255 / .16); outline: none; }
.sdw-hbtn svg { width: 22px; height: 22px; }
.sdw-hbtn[hidden] { display: none; }

.sdw-body { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sdw-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sdw-view[hidden] { display: none; }
.sdw-view > .sdw-thread { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sdw-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }

/* ---------- صفحه شروع ---------- */
.sdw-home { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.sdw-welcome { display: flex; gap: .55rem; align-items: flex-end; }
.sdw-form { background: #fff; border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--sd-line); }
.sdw-label { display: block; font-size: .75rem; font-weight: 700; color: var(--sd-muted); margin-bottom: .3rem; }
.sdw-label small { font-weight: 400; }
.sdw-input, .sdw-textarea, .sdw-select {
    display: block; width: 100%; border: 1px solid var(--sd-line); background: #fafbfc; border-radius: 12px;
    padding: .6rem .8rem; font: inherit; font-size: .875rem; color: var(--sd-ink); outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
.sdw-input { height: 44px; }
.sdw-textarea { resize: none; min-height: 88px; line-height: 1.8; }
.sdw-input:focus, .sdw-textarea:focus, .sdw-select:focus { background: #fff; border-color: var(--sd-c); box-shadow: 0 0 0 4px color-mix(in oklab, var(--sd-c) 12%, transparent); }
.sdw-input.is-invalid, .sdw-textarea.is-invalid { border-color: #ef4444; }
.sdw-err { font-size: .72rem; color: #dc2626; margin-top: .25rem; }
.sdw-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 360px) { .sdw-row2 { grid-template-columns: 1fr; } }
.sdw-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sdw-chip {
    border: 1px solid var(--sd-line); background: #fff; color: var(--sd-ink); border-radius: 999px; padding: .35rem .8rem;
    font-size: .78rem; transition: all .15s;
}
.sdw-chip:hover { border-color: var(--sd-c); color: var(--sd-c); }
.sdw-chip.is-active { border-color: var(--sd-c); background: var(--sd-c-soft); color: var(--sd-c); font-weight: 700; }
.sdw-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem; height: 46px; padding: 0 1.1rem;
    border: 0; border-radius: 14px; background: var(--sd-c); color: #fff; font-weight: 700; font-size: .875rem;
    box-shadow: 0 8px 18px -8px color-mix(in oklab, var(--sd-c) 70%, transparent); transition: filter .15s, transform .1s;
}
.sdw-btn:hover { filter: brightness(1.06); }
.sdw-btn:active { transform: scale(.98); }
.sdw-btn[disabled] { opacity: .6; pointer-events: none; }
.sdw-btn svg { width: 18px; height: 18px; }
.sdw-btn-ghost { background: #fff; color: var(--sd-ink); border: 1px solid var(--sd-line); box-shadow: none; }
.sdw-btn-ghost:hover { border-color: var(--sd-c); color: var(--sd-c); filter: none; }
.sdw-link-row {
    display: flex; align-items: center; justify-content: space-between; gap: .5rem; width: 100%; padding: .8rem 1rem;
    border: 1px solid var(--sd-line); border-radius: 16px; background: #fff; color: var(--sd-ink); font-size: .8125rem; text-align: start;
}
.sdw-link-row:hover { border-color: var(--sd-c); color: var(--sd-c); }
.sdw-link-row svg { width: 18px; height: 18px; }
.sdw-notice { border-radius: 14px; padding: .7rem .9rem; font-size: .8rem; background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }

/* ---------- فهرست گفتگوها ---------- */
.sdw-list { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.sdw-conv {
    display: flex; gap: .7rem; align-items: center; width: 100%; padding: .8rem; border-radius: 16px; background: #fff;
    border: 1px solid var(--sd-line); text-align: start; color: inherit; transition: border-color .15s, box-shadow .15s; text-decoration: none;
}
.sdw-conv:hover { border-color: color-mix(in oklab, var(--sd-c) 45%, white); box-shadow: 0 6px 16px -10px rgb(16 24 40 / .25); }
.sdw-conv-icon { width: 40px; height: 40px; border-radius: 13px; background: var(--sd-c-soft); color: var(--sd-c); display: grid; place-items: center; flex-shrink: 0; }
.sdw-conv-icon svg { width: 20px; height: 20px; }
.sdw-conv-main { flex: 1; min-width: 0; }
.sdw-conv-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.sdw-conv-title { font-weight: 700; font-size: .8125rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sdw-conv-time { font-size: .68rem; color: var(--sd-muted); flex-shrink: 0; }
.sdw-conv-prev { display: flex; align-items: center; gap: .4rem; font-size: .75rem; color: var(--sd-muted); margin-top: .1rem; }
.sdw-conv-prev span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sdw-pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 0 .5rem; height: 20px; font-size: .65rem; font-weight: 700; flex-shrink: 0; }
.sdw-pill-open { background: #dcfce7; color: #15803d; }
.sdw-pill-closed { background: #f1f5f9; color: #64748b; }
.sdw-count { min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--sd-c); color: #fff; font-size: .65rem; font-weight: 800; display: inline-grid; place-items: center; flex-shrink: 0; }

/* ---------- گفتگو (مشترک ویجت و صفحه پنل مشتری) ---------- */
.sdw-msgs { padding: 14px 12px 6px; display: flex; flex-direction: column; gap: 3px; }
.sdw-day { align-self: center; margin: 10px 0 6px; padding: .15rem .7rem; border-radius: 999px; background: rgb(15 23 42 / .06); color: var(--sd-muted); font-size: .68rem; font-weight: 600; }
.sdw-m { display: flex; gap: .45rem; align-items: flex-end; max-width: 100%; animation: sdw-in .25s ease; }
.sdw-m.is-first { margin-top: 8px; }
.sdw-m.is-mine { align-self: flex-start; }
.sdw-m.is-theirs { align-self: flex-end; flex-direction: row-reverse; }
.sdw-av { width: 30px; height: 30px; border-radius: 50%; background: var(--sd-c-soft); color: var(--sd-c); display: grid; place-items: center; font-size: .72rem; font-weight: 800; flex-shrink: 0; }
.sdw-av svg { width: 17px; height: 17px; }
.sdw-av.is-ghost { visibility: hidden; }
.sdw-b {
    position: relative; max-width: min(78vw, 290px); padding: .5rem .8rem .35rem; border-radius: 18px; font-size: .84rem;
    white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
}
.sdw-thread.is-page .sdw-b { max-width: min(78vw, 560px); }
.sdw-m.is-mine .sdw-b { background: var(--sd-c); color: #fff; }
.sdw-m.is-mine.is-first .sdw-b { border-start-start-radius: 6px; }
.sdw-m.is-theirs .sdw-b { background: var(--sd-in); color: var(--sd-ink); border: 1px solid var(--sd-line); }
.sdw-m.is-theirs.is-first .sdw-b { border-start-end-radius: 6px; }
.sdw-m.is-mine .sdw-b a { color: #fff; text-decoration: underline; }
.sdw-m.is-theirs .sdw-b a { color: var(--sd-c); text-decoration: underline; }
.sdw-name { display: block; font-size: .68rem; font-weight: 800; color: var(--sd-c); margin-bottom: .1rem; white-space: normal; }
.sdw-meta { display: flex; align-items: center; justify-content: flex-end; gap: .25rem; margin-top: .1rem; font-size: .62rem; opacity: .72; white-space: nowrap; direction: ltr; }
.sdw-m.is-mine .sdw-meta { justify-content: flex-start; }
.sdw-meta svg { width: 15px; height: 15px; }
.sdw-meta .is-seen { color: #bbf7d0; opacity: 1; }
.sdw-m.is-pending .sdw-b { opacity: .7; }
.sdw-m.is-failed .sdw-b { background: #fee2e2; color: #991b1b; }
.sdw-retry { align-self: center; border: 0; background: none; color: #dc2626; font-size: .7rem; text-decoration: underline; padding: .2rem; }
.sdw-sys { align-self: center; max-width: 90%; margin: 8px 0; padding: .3rem .8rem; border-radius: 12px; background: #fff; border: 1px dashed var(--sd-line); color: var(--sd-muted); font-size: .72rem; text-align: center; }
.sdw-sys a { color: var(--sd-c); font-weight: 700; }
.sdw-typing-sp { height: 6px; }

.sdw-closed-bar { margin: 6px 12px 0; border-radius: 12px; padding: .5rem .8rem; background: #f1f5f9; color: #475569; font-size: .75rem; text-align: center; }
.sdw-net { margin: 6px 12px 0; border-radius: 12px; padding: .45rem .8rem; background: #fef3c7; color: #92400e; font-size: .72rem; text-align: center; }
.sdw-net[hidden], .sdw-closed-bar[hidden] { display: none; }

.sdw-composer { flex-shrink: 0; display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom, 0px)); background: #fff; border-top: 1px solid var(--sd-line); }
.sdw-thread.is-page .sdw-composer { padding-bottom: 10px; border-radius: 0 0 var(--r-card, 1rem) var(--r-card, 1rem); }
.sdw-composer textarea {
    flex: 1; min-width: 0; resize: none; border: 1px solid var(--sd-line); background: #fafbfc; border-radius: 16px;
    padding: .62rem .9rem; font: inherit; font-size: .875rem; line-height: 1.6; max-height: 140px; min-height: 44px; outline: none; color: var(--sd-ink);
}
.sdw-composer textarea:focus { background: #fff; border-color: var(--sd-c); box-shadow: 0 0 0 4px color-mix(in oklab, var(--sd-c) 12%, transparent); }
.sdw-send { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--sd-c); color: #fff; display: grid; place-items: center; flex-shrink: 0; transition: transform .12s, opacity .15s; }
.sdw-send:active { transform: scale(.92); }
.sdw-send[disabled] { opacity: .45; }
.sdw-send svg { width: 20px; height: 20px; }
[dir="rtl"] .sdw-send svg { transform: scaleX(-1); }
.sdw-foot-actions { display: flex; justify-content: center; padding: 0 12px 4px; background: #fff; }
.sdw-mini-link { border: 0; background: none; color: var(--sd-muted); font-size: .7rem; padding: .2rem .5rem; text-decoration: underline; }
.sdw-mini-link:hover { color: #dc2626; }
.sdw-confirm { display: flex; align-items: center; justify-content: center; gap: .5rem; padding: .5rem 12px; background: #fff; font-size: .75rem; }
.sdw-confirm button { border: 1px solid var(--sd-line); background: #fff; border-radius: 10px; padding: .25rem .7rem; font-size: .72rem; }
.sdw-confirm button.is-danger { background: #dc2626; border-color: #dc2626; color: #fff; }

.sdw-loading { flex: 1; display: grid; place-items: center; padding: 2rem; }
.sdw-spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--sd-line); border-top-color: var(--sd-c); animation: sdw-spin .8s linear infinite; }
.sdw-empty { padding: 2rem 1rem; text-align: center; color: var(--sd-muted); font-size: .8rem; }
.sdw-powered { text-align: center; font-size: .62rem; color: #94a3b8; padding: 2px 0 6px; background: #fff; }

/* ---------- صفحه گفتگو در پنل مشتری ---------- */
.sdw-thread.is-page {
    display: flex; flex-direction: column; height: calc(100vh - 340px); min-height: 420px; max-height: 720px;
    background: var(--sd-bg); border-radius: var(--r-card, 1rem); overflow: hidden; border: 1px solid rgb(16 24 40 / .06);
}
.is-mobile .sdw-thread.is-page { height: calc(var(--sd-vh, 100dvh) - 250px); min-height: 360px; }

@keyframes sdw-spin { to { transform: rotate(360deg); } }
@keyframes sdw-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes sdw-pop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes sdw-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .sdw *, .sdw-thread * { animation: none !important; transition: none !important; } }
@media print { .sdw { display: none !important; } }

/* ---------- صفحات پنل مشتری (my-account/support) ---------- */
.sdp-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.sdp-head h1 { font-size: 1.125rem; font-weight: 800; margin: 0; }
.sdp-head p { font-size: .75rem; color: var(--color-muted, #64748b); margin: .2rem 0 0; }
.sdp-tabs { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .75rem; margin-bottom: .25rem; scrollbar-width: none; }
.sdp-list { display: flex; flex-direction: column; border: 1px solid var(--color-line, #e7e9ee); border-radius: 14px; overflow: hidden; }
.sdp-row { display: flex; align-items: center; gap: .85rem; padding: .9rem 1rem; color: inherit; text-decoration: none; transition: background .15s; }
.sdp-row + .sdp-row { border-top: 1px solid var(--color-line, #e7e9ee); }
.sdp-row:hover { background: #fafbfc; }
.sdp-row.is-unread { background: color-mix(in oklab, var(--brand, #e11d48) 4%, white); }
.sdp-ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; flex-shrink: 0; background: color-mix(in oklab, var(--brand, #e11d48) 10%, white); color: var(--brand, #e11d48); }
.sdp-ic svg { width: 22px; height: 22px; }
.sdp-main { flex: 1; min-width: 0; }
.sdp-top { display: flex; align-items: center; gap: .5rem; }
.sdp-title { font-weight: 700; font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sdp-time { margin-inline-start: auto; font-size: .7rem; color: var(--color-muted, #64748b); flex-shrink: 0; }
.sdp-sub { display: flex; align-items: center; gap: .5rem; margin-top: .2rem; font-size: .75rem; color: var(--color-muted, #64748b); }
.sdp-sub span.sdp-prev { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sdp-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .35rem; }
.sdp-tag { display: inline-flex; align-items: center; gap: .25rem; height: 22px; padding: 0 .55rem; border-radius: 999px; background: #f1f5f9; color: #475569; font-size: .68rem; font-weight: 600; }
.sdp-tag svg { width: 13px; height: 13px; }
.sdp-st { display: inline-flex; align-items: center; height: 22px; padding: 0 .6rem; border-radius: 999px; font-size: .68rem; font-weight: 700; flex-shrink: 0; }
.sdp-st-wait { background: #fef3c7; color: #92400e; }
.sdp-st-ans { background: #dcfce7; color: #15803d; }
.sdp-st-closed { background: #f1f5f9; color: #64748b; }
.sdp-unread { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--brand, #e11d48); color: #fff; font-size: .7rem; font-weight: 800; display: inline-grid; place-items: center; flex-shrink: 0; }
.sdp-empty { text-align: center; padding: 2.5rem 1rem; }
.sdp-empty-ic { width: 72px; height: 72px; margin: 0 auto 1rem; border-radius: 24px; display: grid; place-items: center; background: color-mix(in oklab, var(--brand, #e11d48) 10%, white); color: var(--brand, #e11d48); }
.sdp-empty-ic svg { width: 36px; height: 36px; }
.sdp-empty b { display: block; font-size: .95rem; }
.sdp-empty p { font-size: .8rem; color: var(--color-muted, #64748b); margin: .35rem 0 1.25rem; }
.sdp-form { display: grid; gap: 1rem; }
.sdp-grid2 { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .sdp-grid2 { grid-template-columns: 1fr 1fr; } }
.sdp-depts { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.sdp-dept { position: relative; display: block; cursor: pointer; }
.sdp-dept input { position: absolute; opacity: 0; pointer-events: none; }
.sdp-dept span { display: block; height: 100%; padding: .75rem .9rem; border: 1.5px solid var(--color-line, #e7e9ee); border-radius: 14px; background: #fff; transition: all .15s; }
.sdp-dept b { display: block; font-size: .84rem; }
.sdp-dept small { display: block; font-size: .7rem; color: var(--color-muted, #64748b); margin-top: .15rem; line-height: 1.6; }
.sdp-dept input:checked + span { border-color: var(--brand, #e11d48); background: color-mix(in oklab, var(--brand, #e11d48) 6%, white); box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand, #e11d48) 12%, transparent); }
.sdp-dept input:focus-visible + span { outline: 2px solid var(--brand, #e11d48); outline-offset: 2px; }
.sdp-textarea { height: auto !important; min-height: 150px; padding-top: .7rem !important; padding-bottom: .7rem !important; line-height: 1.9; resize: vertical; }
.sdp-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; }
.sdp-thread-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .9rem; }
.sdp-thread-head h1 { font-size: 1rem; font-weight: 800; margin: 0; }
.sdp-back { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; color: var(--color-muted, #64748b); margin-bottom: .6rem; text-decoration: none; }
.sdp-back:hover { color: var(--brand, #e11d48); }
.sdp-back svg { width: 16px; height: 16px; }
.sdp-order-box { margin-top: 1rem; }
.sdp-order-box h2 { font-size: .95rem; font-weight: 700; margin: 0 0 .6rem; }
.sdp-dash-row { display: flex; align-items: center; gap: .6rem; padding: .6rem 0; border-top: 1px solid var(--color-line, #e7e9ee); font-size: .82rem; color: inherit; text-decoration: none; }
.sdp-dash-row:hover { color: var(--brand, #e11d48); }

/* رفع شکستن کلمات کوتاه (مثلاً «سلام» به «سلا / م»): عرض حباب بر اساس متن و شکستن فقط کلمات بلند */
.sdw-m { max-width: 88%; }
.sdw-b { width: max-content; min-width: 0; overflow-wrap: break-word; word-break: normal; }
.sdw-thread .sdw-b { max-width: min(290px, 100%); }
.sdw-thread.is-page .sdw-b { max-width: min(560px, 100%); }
.sdw-name, .sdw-meta { white-space: nowrap; }

/* ---------- تصویر و پیام صوتی ---------- */
.sdw-attach { width: 40px; height: 44px; flex-shrink: 0; border: 0; border-radius: 12px; background: transparent; color: var(--sd-muted); display: grid; place-items: center; transition: color .15s, background .15s; }
.sdw-attach:hover { color: var(--sd-c); background: var(--sd-c-soft); }
.sdw-attach svg { width: 23px; height: 23px; }
.sdw-attach[hidden], .sdw-composer textarea[hidden] { display: none; }
.sdw-send.is-mic { background: var(--sd-c-soft); color: var(--sd-c); }
.sdw-send.is-mic svg { transform: none !important; }
.sdw-send[data-mode="rec"] { background: #ef4444; }
.sdw-preview { display: flex; align-items: center; gap: 10px; margin: 0; padding: 8px 12px; background: #fff; border-top: 1px solid var(--sd-line); font-size: .78rem; color: var(--sd-muted); }
.sdw-preview[hidden] { display: none; }
.sdw-preview img { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; border: 1px solid var(--sd-line); }
.sdw-preview span { flex: 1; }
.sdw-preview-x { width: 30px; height: 30px; border: 0; border-radius: 50%; background: var(--sd-bg); color: var(--sd-muted); display: grid; place-items: center; }
.sdw-preview-x svg { width: 16px; height: 16px; }
.sdw-b.is-media { padding: 4px 4px 3px; }
.sdw-b.is-media .sdw-name { padding: 2px 8px 0; }
.sdw-b.is-media .sdw-meta { padding: 0 8px 2px; }
.sdw-b.is-voice { padding: 6px 10px 4px; }
.sdw-b.is-media .sdm-img { border-radius: 14px; margin: 0; }
.sdw-caption { padding: 4px 8px 0; white-space: pre-wrap; }
.sdw-b.is-voice .sdw-caption { padding: 4px 0 0; }
.sdw-b.is-media .sdm-progress { margin: 6px 8px 4px; }

/* بدون دکمه شناور: پنل از پایین صفحه باز می‌شود و پیش‌نمایش پیام هم نمایش داده نمی‌شود */
.sdw-launcher[hidden] { display: none !important; }
.sdw-no-launcher .sdw-peek { display: none; }

/* ---------- دستیار هوشمند: کارت‌ها، پاسخ سریع و «در حال نوشتن» ---------- */
.sdw-b.has-cards { width: min(290px, 100%); }
.sdw-thread.is-page .sdw-b.has-cards { width: min(420px, 100%); }
.sdw-cards { display: grid; gap: 6px; margin: 8px 0 2px; white-space: normal; }
.sdw-card { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 12px; background: var(--sd-bg); border: 1px solid var(--sd-line); color: var(--sd-ink) !important; text-decoration: none !important; transition: border-color .15s, background .15s; }
a.sdw-card:hover { border-color: var(--sd-c); background: #fff; }
.sdw-card-product img { width: 54px; height: 54px; flex-shrink: 0; object-fit: contain; border-radius: 10px; background: #fff; }
.sdw-card-body { flex: 1; min-width: 0; }
.sdw-card-title { font-size: .78rem; font-weight: 700; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sdw-card-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; margin-top: 2px; font-size: .78rem; }
.sdw-card-price b { color: var(--c-price, var(--sd-ink)); }
.sdw-card-price s { color: #94a3b8; font-size: .7rem; }
.sdw-card-stock { color: var(--sd-muted); font-size: .72rem; }
.sdw-card-product.is-out { opacity: .75; }
.sdw-card-order { display: block; }
.sdw-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .8rem; }
.sdw-card-st { padding: 1px 8px; border-radius: 99px; background: var(--sd-c-soft); color: var(--sd-c); font-size: .68rem; font-weight: 700; white-space: nowrap; }
.sdw-card-sub { font-size: .7rem; color: var(--sd-muted); margin-top: 2px; }
.sdw-card-lines { margin-top: 6px; font-size: .74rem; line-height: 1.9; }
.sdw-card-link { justify-content: space-between; font-size: .78rem; font-weight: 700; color: var(--sd-c) !important; }
.sdw-card-link svg { width: 16px; height: 16px; }
.sdw-qr { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; padding: 4px 0 6px 38px; animation: sdw-in .25s ease; }
.sdw-qr-btn { border: 1px solid color-mix(in oklab, var(--sd-c) 45%, white); background: #fff; color: var(--sd-c); border-radius: 999px; padding: .3rem .8rem; font-size: .76rem; font-weight: 600; transition: all .15s; }
.sdw-qr-btn:hover { background: var(--sd-c); color: #fff; }
.sdw-typing .sdw-b { padding: .7rem .9rem; }
.sdw-dots { display: inline-flex; gap: 4px; }
.sdw-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--sd-muted); opacity: .4; animation: sdw-dot 1.2s infinite; }
.sdw-dots i:nth-child(2) { animation-delay: .15s; }
.sdw-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes sdw-dot { 30% { opacity: 1; transform: translateY(-3px); } 60% { opacity: .4; transform: none; } }
