/* ─────────────── پیام‌رسان محفل — چیدمان اصلی ─────────────── */
.msg-app {
    display: flex;
    gap: 0;
    height: calc(100dvh - 11rem);
    min-height: 480px;
    border: 1px solid var(--default-border);
    border-radius: 1rem;
    overflow: hidden;
    background: var(--custom-white, #fff);
    box-shadow: var(--default-box-shadow);
    position: relative;
}

/* ─────────────── ستون فهرست گفت‌وگوها ─────────────── */
.msg-side {
    width: 21.5rem;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-inline-end: 1px solid var(--default-border);
    background: var(--custom-white, #fff);
    min-width: 0;
}

.msg-side-head {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .9rem 1rem .6rem;
}

.msg-side-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--default-text-color);
    margin: 0;
    flex: 1;
    min-width: 0;
}

.msg-new-wrap { position: relative; }

.msg-new-btn {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 50%;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, var(--primary-color), rgba(var(--primary-rgb), .7));
    box-shadow: 0 6px 14px rgba(var(--primary-rgb), .35);
    transition: transform .15s ease, box-shadow .15s ease;
}
.msg-new-btn:hover { transform: translateY(-1px) scale(1.04); box-shadow: 0 8px 18px rgba(var(--primary-rgb), .45); }

.msg-menu {
    position: absolute;
    top: calc(100% + .45rem);
    inset-inline-end: 0;
    min-width: 12.5rem;
    background: var(--custom-white, #fff);
    border: 1px solid var(--default-border);
    border-radius: .8rem;
    box-shadow: 0 14px 34px rgba(15, 23, 42, .16);
    padding: .35rem;
    z-index: 60;
    animation: msg-pop .16s ease;
}
@keyframes msg-pop { from { opacity: 0; transform: translateY(-6px) scale(.97); } to { opacity: 1; transform: none; } }

.msg-menu-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    width: 100%;
    padding: .55rem .7rem;
    border: none;
    background: none;
    border-radius: .55rem;
    font-size: .83rem;
    font-weight: 600;
    color: var(--default-text-color);
    text-align: start;
    cursor: pointer;
}
.msg-menu-item:hover { background: rgba(var(--primary-rgb), .08); color: var(--primary-color); }
.msg-menu-item svg { flex-shrink: 0; }
.msg-menu-item.danger:hover { background: rgba(220, 38, 38, .08); color: #dc2626; }
.msg-menu-sep { height: 1px; background: var(--default-border); margin: .3rem .5rem; }

.msg-search { padding: 0 1rem .55rem; position: relative; }
.msg-search input {
    width: 100%;
    border: 1px solid var(--default-border);
    background: var(--default-body-bg-color, #f8f9fb);
    border-radius: .75rem;
    padding: .5rem 2.2rem .5rem .8rem;
    font-size: .82rem;
    color: var(--default-text-color);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.msg-search input:focus { border-color: rgba(var(--primary-rgb), .5); box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .12); }
.msg-search .msg-search-ic {
    position: absolute;
    inset-inline-start: 1.75rem;
    top: 50%;
    transform: translateY(-58%);
    color: var(--text-muted);
    pointer-events: none;
}

.msg-tabs {
    display: flex;
    gap: .25rem;
    padding: 0 1rem .6rem;
    border-bottom: 1px solid var(--default-border);
}
.msg-tab {
    border: none;
    background: none;
    font-size: .8rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: .35rem .75rem .55rem;
    position: relative;
    cursor: pointer;
    border-radius: .4rem;
}
.msg-tab:hover { color: var(--default-text-color); }
.msg-tab.active { color: var(--primary-color); }
.msg-tab.active::after {
    content: "";
    position: absolute;
    inset-inline: .4rem;
    bottom: -1px;
    height: .18rem;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--primary-color), rgba(var(--primary-rgb), .55));
}

.msg-list { flex: 1; overflow-y: auto; padding: .5rem .6rem; }
.msg-list::-webkit-scrollbar { width: .35rem; }
.msg-list::-webkit-scrollbar-thumb { background: rgba(0,0,0,.12); border-radius: 4px; }

.msg-item {
    display: flex;
    gap: .7rem;
    align-items: center;
    padding: .6rem .65rem;
    border-radius: .8rem;
    cursor: pointer;
    position: relative;
    transition: background .12s;
}
.msg-item:hover { background: rgba(var(--primary-rgb), .05); }
.msg-item.active { background: rgba(var(--primary-rgb), .1); }
.msg-item.active::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: .7rem;
    bottom: .7rem;
    width: .22rem;
    border-radius: 3px;
    background: var(--primary-color);
}

.msg-avatar {
    width: 2.9rem;
    height: 2.9rem;
    border-radius: 1rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 1.05rem;
    position: relative;
    text-shadow: 0 1px 2px rgba(0,0,0,.18);
}
.msg-avatar.sm { width: 2.3rem; height: 2.3rem; border-radius: .8rem; font-size: .85rem; }
.msg-avatar.lg { width: 3.6rem; height: 3.6rem; border-radius: 1.15rem; font-size: 1.35rem; }
.msg-avatar .msg-online-dot {
    position: absolute;
    bottom: -.05rem;
    inset-inline-end: -.05rem;
    width: .8rem;
    height: .8rem;
    border-radius: 50%;
    background: #22c55e;
    border: 2.5px solid var(--custom-white, #fff);
}
.msg-avatar-badge {
    position: absolute;
    bottom: -.2rem;
    inset-inline-end: -.2rem;
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 50%;
    background: var(--custom-white, #fff);
    border: 1px solid var(--default-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.msg-item-body { flex: 1; min-width: 0; }
.msg-item-top { display: flex; align-items: center; gap: .4rem; }
.msg-item-name {
    font-size: .87rem;
    font-weight: 700;
    color: var(--default-text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}
.msg-item-time { font-size: .68rem; color: var(--text-muted); flex-shrink: 0; }
.msg-item-bottom { display: flex; align-items: center; gap: .45rem; margin-top: .15rem; }
.msg-item-preview {
    flex: 1;
    font-size: .76rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msg-item-preview.typing { color: var(--primary-color); font-weight: 600; }
.msg-item-meta { display: flex; align-items: center; gap: .3rem; flex-shrink: 0; }

.msg-unread {
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 .32rem;
    border-radius: 1rem;
    background: linear-gradient(135deg, var(--primary-color), rgba(var(--primary-rgb), .75));
    color: #fff;
    font-size: .68rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 8px rgba(var(--primary-rgb), .35);
}
.msg-pin-ic { color: var(--text-muted); opacity: .7; }

.msg-list-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: .8rem;
    padding: 2.2rem 1rem;
}

/* ─────────────── ناحیهٔ گفت‌وگو ─────────────── */
.msg-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(1200px 500px at 85% -10%, rgba(var(--primary-rgb), .06), transparent 60%),
        radial-gradient(900px 400px at 0% 110%, rgba(var(--primary-rgb), .05), transparent 55%),
        var(--default-body-bg-color, #f7f8fb);
}

/* حالت خالی */
.msg-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    text-align: center;
}
.msg-empty-art {
    position: relative;
    width: 11rem;
    height: 11rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.msg-empty-art::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 120deg, rgba(var(--primary-rgb), .25), rgba(34, 197, 94, .18), rgba(var(--primary-rgb), .25));
    filter: blur(2px);
    animation: msg-spin 14s linear infinite;
}
@keyframes msg-spin { to { transform: rotate(360deg); } }
.msg-empty-art::after {
    content: "";
    position: absolute;
    inset: .9rem;
    border-radius: 50%;
    background: var(--custom-white, #fff);
    box-shadow: inset 0 0 0 1px var(--default-border), 0 18px 40px rgba(15, 23, 42, .1);
}
.msg-empty-icon {
    position: relative;
    z-index: 1;
    width: 4.6rem;
    height: 4.6rem;
    border-radius: 1.6rem;
    background: linear-gradient(135deg, var(--primary-color), rgba(var(--primary-rgb), .65));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 14px 28px rgba(var(--primary-rgb), .4);
    animation: msg-float 3.4s ease-in-out infinite;
}
@keyframes msg-float { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-8px) rotate(3deg); } }
.msg-empty-spark {
    position: absolute;
    z-index: 2;
    color: var(--primary-color);
    opacity: .85;
    animation: msg-float 4s ease-in-out infinite;
}
.msg-empty-spark.s1 { top: 1.1rem; inset-inline-start: 1.3rem; animation-delay: .4s; }
.msg-empty-spark.s2 { bottom: 1.4rem; inset-inline-end: 1rem; animation-delay: 1.1s; }
.msg-empty-spark.s3 { top: 2.2rem; inset-inline-end: .6rem; animation-delay: 1.8s; }

.msg-empty h5 { font-weight: 800; color: var(--default-text-color); margin: 0; }
.msg-empty p { color: var(--text-muted); font-size: .85rem; max-width: 26rem; margin: 0; }
.msg-empty-actions { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; margin-top: .4rem; }

.msg-cta {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    border: 1px solid var(--default-border);
    background: var(--custom-white, #fff);
    color: var(--default-text-color);
    font-size: .83rem;
    font-weight: 700;
    padding: .55rem 1.15rem;
    border-radius: 2rem;
    cursor: pointer;
    transition: all .15s;
}
.msg-cta:hover { border-color: rgba(var(--primary-rgb), .5); color: var(--primary-color); transform: translateY(-1px); }
.msg-cta.primary {
    background: linear-gradient(135deg, var(--primary-color), rgba(var(--primary-rgb), .72));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 8px 18px rgba(var(--primary-rgb), .35);
}
.msg-cta.primary:hover { box-shadow: 0 10px 22px rgba(var(--primary-rgb), .45); color: #fff; }

/* هدر گفت‌وگو */
.msg-chat-head {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem 1.1rem;
    border-bottom: 1px solid var(--default-border);
    background: rgba(255,255,255,.72);
    backdrop-filter: blur(8px);
}
.msg-back-btn { display: none; }
.msg-chat-head .msg-avatar { width: 2.6rem; height: 2.6rem; border-radius: .9rem; font-size: .95rem; }
.msg-chat-title { font-size: .95rem; font-weight: 800; color: var(--default-text-color); line-height: 1.3; }
.msg-chat-sub { font-size: .72rem; color: var(--text-muted); }
.msg-chat-sub.online { color: #16a34a; font-weight: 700; }
.msg-chat-sub.typing { color: var(--primary-color); font-weight: 700; }
.msg-chat-actions { margin-inline-start: auto; display: flex; gap: .35rem; position: relative; }

.msg-icon-btn {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: .7rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .13s;
}
.msg-icon-btn:hover { background: rgba(var(--primary-rgb), .09); color: var(--primary-color); }

/* ناحیهٔ پیام‌ها */
.msg-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 1.1rem 1.3rem .6rem;
    scroll-behavior: smooth;
}
.msg-scroll::-webkit-scrollbar { width: .4rem; }
.msg-scroll::-webkit-scrollbar-thumb { background: rgba(0,0,0,.14); border-radius: 4px; }

.msg-day {
    display: flex;
    justify-content: center;
    margin: .9rem 0 .6rem;
}
.msg-day span {
    font-size: .7rem;
    font-weight: 700;
    color: var(--text-muted);
    background: rgba(255,255,255,.85);
    border: 1px solid var(--default-border);
    padding: .22rem .8rem;
    border-radius: 2rem;
    box-shadow: 0 2px 6px rgba(15,23,42,.05);
}

.msg-unread-line {
    display: flex;
    align-items: center;
    gap: .7rem;
    margin: .8rem 0 .5rem;
    color: var(--primary-color);
    font-size: .72rem;
    font-weight: 800;
}
.msg-unread-line::before, .msg-unread-line::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(var(--primary-rgb), .5), transparent);
}

.msg-sys {
    text-align: center;
    margin: .55rem 0;
}
.msg-sys span {
    display: inline-block;
    font-size: .71rem;
    color: var(--text-muted);
    background: rgba(var(--primary-rgb), .07);
    border-radius: 2rem;
    padding: .25rem .9rem;
}

.msg-row {
    display: flex;
    margin-bottom: .35rem;
    gap: .5rem;
}
.msg-row.mine { flex-direction: row-reverse; }
.msg-row .msg-avatar.xs {
    width: 1.9rem;
    height: 1.9rem;
    border-radius: .6rem;
    font-size: .7rem;
    align-self: flex-end;
}

.msg-bubble-wrap { position: relative; max-width: min(72%, 34rem); }
.msg-row.mine .msg-bubble-wrap { margin-inline-start: auto; }

.msg-bubble {
    position: relative;
    padding: .55rem .8rem .45rem;
    border-radius: 1.05rem;
    font-size: .86rem;
    line-height: 1.75;
    word-break: break-word;
    white-space: pre-wrap;
    box-shadow: 0 1px 3px rgba(15,23,42,.07);
}
.msg-row:not(.mine) .msg-bubble {
    background: var(--custom-white, #fff);
    border: 1px solid var(--default-border);
    border-start-start-radius: .3rem;
    color: var(--default-text-color);
}
.msg-row.mine .msg-bubble {
    background: linear-gradient(135deg, var(--primary-color), rgba(var(--primary-rgb), .78));
    color: #fff;
    border-end-end-radius: .3rem;
}
.msg-bubble.deleted {
    font-style: italic;
    opacity: .75;
    font-size: .8rem;
}
.msg-sender {
    font-size: .72rem;
    font-weight: 800;
    margin-bottom: .1rem;
}
.msg-reply-quote {
    display: block;
    border-inline-start: 3px solid rgba(var(--primary-rgb), .65);
    background: rgba(var(--primary-rgb), .07);
    border-radius: .45rem;
    padding: .3rem .55rem;
    margin-bottom: .35rem;
    font-size: .74rem;
}
.msg-row.mine .msg-reply-quote {
    border-inline-start-color: rgba(255,255,255,.7);
    background: rgba(255,255,255,.14);
}
.msg-reply-quote b { display: block; font-size: .7rem; opacity: .9; }
.msg-reply-quote span {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    opacity: .85;
}
.msg-bubble-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .3rem;
    margin-top: .1rem;
    font-size: .64rem;
    opacity: .78;
}
.msg-edited { font-size: .62rem; opacity: .8; }
.msg-ticks { display: inline-flex; }
.msg-ticks svg { display: block; }
.msg-ticks.seen { color: #7dd3fc; }
.msg-row:not(.mine) .msg-ticks { color: var(--text-muted); }
.msg-row:not(.mine) .msg-ticks.seen { color: var(--primary-color); }

.msg-imgs { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .35rem; }
.msg-imgs a { display: block; border-radius: .7rem; overflow: hidden; }
.msg-imgs img {
    max-width: 15rem;
    max-height: 12rem;
    object-fit: cover;
    display: block;
    border-radius: .7rem;
}
.msg-file-chip {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .4rem .6rem;
    margin-bottom: .3rem;
    border-radius: .65rem;
    background: rgba(var(--primary-rgb), .08);
    color: var(--default-text-color);
    font-size: .76rem;
    text-decoration: none;
}
.msg-row.mine .msg-file-chip { background: rgba(255,255,255,.16); color: #fff; }
.msg-file-chip:hover { filter: brightness(.97); }
.msg-file-chip small { opacity: .75; }

/* اکشن‌های شناور روی حباب */
.msg-hover {
    position: absolute;
    top: -.85rem;
    inset-inline-end: .4rem;
    display: none;
    gap: .1rem;
    background: var(--custom-white, #fff);
    border: 1px solid var(--default-border);
    border-radius: .7rem;
    box-shadow: 0 8px 20px rgba(15,23,42,.14);
    padding: .15rem;
    z-index: 5;
}
.msg-bubble-wrap:hover .msg-hover { display: flex; }
.msg-hover button {
    width: 1.7rem;
    height: 1.7rem;
    border: none;
    background: none;
    border-radius: .45rem;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.msg-hover button:hover { background: rgba(var(--primary-rgb), .1); color: var(--primary-color); }
.msg-hover button.danger:hover { background: rgba(220,38,38,.1); color: #dc2626; }

/* تایپینگ */
.msg-typing-dots { display: inline-flex; gap: .22rem; align-items: center; }
.msg-typing-dots i {
    width: .38rem; height: .38rem; border-radius: 50%;
    background: currentColor;
    animation: msg-dot 1.2s ease-in-out infinite;
}
.msg-typing-dots i:nth-child(2) { animation-delay: .15s; }
.msg-typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes msg-dot { 0%,60%,100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }

/* کامپوزر */
.msg-composer {
    padding: .6rem 1rem .8rem;
    border-top: 1px solid var(--default-border);
    background: rgba(255,255,255,.8);
    backdrop-filter: blur(8px);
    position: relative;
}
.msg-composer-banner {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .75rem;
    padding: .4rem .7rem;
    margin-bottom: .45rem;
    border-radius: .6rem;
    background: rgba(var(--primary-rgb), .07);
    border-inline-start: 3px solid var(--primary-color);
}
.msg-composer-banner b { color: var(--primary-color); }
.msg-composer-banner span {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-muted);
}
.msg-composer-banner button {
    border: none;
    background: none;
    color: var(--text-muted);
    display: inline-flex;
    padding: .15rem;
    cursor: pointer;
}
.msg-composer-banner button:hover { color: #dc2626; }

.msg-composer-row { display: flex; align-items: flex-end; gap: .5rem; }
.msg-composer textarea {
    flex: 1;
    resize: none;
    border: 1px solid var(--default-border);
    border-radius: 1rem;
    padding: .6rem .9rem;
    font-size: .86rem;
    font-family: inherit;
    line-height: 1.7;
    max-height: 8.5rem;
    color: var(--default-text-color);
    background: var(--custom-white, #fff);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    field-sizing: content;
}
.msg-composer textarea:focus { border-color: rgba(var(--primary-rgb), .55); box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .12); }

.msg-send-btn {
    width: 2.6rem;
    height: 2.6rem;
    flex-shrink: 0;
    border-radius: 50%;
    border: none;
    color: #fff;
    background: linear-gradient(135deg, var(--primary-color), rgba(var(--primary-rgb), .72));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(var(--primary-rgb), .35);
    transition: transform .13s, box-shadow .13s;
}
.msg-send-btn:hover:not(:disabled) { transform: scale(1.06); }
.msg-send-btn:disabled { opacity: .45; box-shadow: none; cursor: default; }
.msg-send-btn svg { transform: scaleX(-1); }

.msg-attach-btn {
    width: 2.4rem;
    height: 2.4rem;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1px solid var(--default-border);
    background: var(--custom-white, #fff);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .13s;
    margin-bottom: .1rem;
}
.msg-attach-btn:hover { color: var(--primary-color); border-color: rgba(var(--primary-rgb), .5); }

.msg-emoji-pop {
    position: absolute;
    bottom: calc(100% + .4rem);
    inset-inline-start: 1rem;
    background: var(--custom-white, #fff);
    border: 1px solid var(--default-border);
    border-radius: .9rem;
    box-shadow: 0 16px 38px rgba(15,23,42,.18);
    padding: .55rem;
    display: grid;
    grid-template-columns: repeat(8, 1.9rem);
    gap: .15rem;
    z-index: 40;
    animation: msg-pop .15s ease;
}
.msg-emoji-pop button {
    width: 1.9rem; height: 1.9rem;
    border: none; background: none;
    font-size: 1.15rem;
    border-radius: .45rem;
    cursor: pointer;
}
.msg-emoji-pop button:hover { background: rgba(var(--primary-rgb), .1); }

.msg-file-strip { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .45rem; }
.msg-file-pill {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .72rem;
    background: rgba(var(--primary-rgb), .08);
    border: 1px solid rgba(var(--primary-rgb), .2);
    padding: .28rem .6rem;
    border-radius: 2rem;
    color: var(--default-text-color);
}
.msg-file-pill button { border: none; background: none; color: var(--text-muted); display: inline-flex; padding: 0; cursor: pointer; }
.msg-file-pill button:hover { color: #dc2626; }

/* ─────────────── دراور اعضا ─────────────── */
.msg-drawer {
    width: 19rem;
    flex-shrink: 0;
    border-inline-start: 1px solid var(--default-border);
    background: var(--custom-white, #fff);
    display: flex;
    flex-direction: column;
    animation: msg-slide-in .2s ease;
}
@keyframes msg-slide-in { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
.msg-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--default-border);
    font-weight: 800;
    font-size: .9rem;
    color: var(--default-text-color);
}
.msg-drawer-body { flex: 1; overflow-y: auto; padding: .8rem 1rem; }
.msg-member {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .45rem .3rem;
    border-radius: .6rem;
}
.msg-member:hover { background: rgba(var(--primary-rgb), .05); }
.msg-member-name { flex: 1; min-width: 0; font-size: .83rem; font-weight: 600; color: var(--default-text-color); }
.msg-member-name small { display: block; font-size: .66rem; color: var(--text-muted); font-weight: 400; }
.msg-member-role {
    font-size: .62rem;
    font-weight: 800;
    color: var(--primary-color);
    background: rgba(var(--primary-rgb), .1);
    padding: .12rem .45rem;
    border-radius: 1rem;
}
.msg-member-kick {
    border: none; background: none; color: var(--text-muted);
    display: inline-flex; padding: .25rem; border-radius: .4rem; cursor: pointer;
}
.msg-member-kick:hover { color: #dc2626; background: rgba(220,38,38,.08); }

/* ─────────────── مودال ─────────────── */
.msg-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    backdrop-filter: blur(3px);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: msg-fade .15s ease;
}
@keyframes msg-fade { from { opacity: 0; } to { opacity: 1; } }
.msg-modal {
    width: 100%;
    max-width: 26rem;
    background: var(--custom-white, #fff);
    border-radius: 1.1rem;
    box-shadow: 0 30px 70px rgba(15,23,42,.3);
    overflow: hidden;
    animation: msg-modal-up .2s ease;
}
@keyframes msg-modal-up { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
.msg-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.2rem .4rem;
}
.msg-modal-head h6 { margin: 0; font-size: .95rem; font-weight: 800; color: var(--default-text-color); }
.msg-modal-sub { font-size: .74rem; color: var(--text-muted); padding: 0 1.2rem; margin-bottom: .4rem; }
.msg-modal-body { padding: .5rem 1.2rem 1.1rem; }
.msg-modal-foot {
    display: flex;
    gap: .5rem;
    justify-content: flex-start;
    padding: 0 1.2rem 1.1rem;
}
.msg-modal-x {
    border: none; background: none; color: var(--text-muted);
    display: inline-flex; padding: .3rem; border-radius: .5rem; cursor: pointer;
}
.msg-modal-x:hover { background: rgba(0,0,0,.06); color: var(--default-text-color); }

.msg-field label { display: block; font-size: .74rem; font-weight: 700; color: var(--default-text-color); margin-bottom: .3rem; }
.msg-field label .req { color: #dc2626; }
.msg-field input {
    width: 100%;
    border: 1px solid var(--default-border);
    border-radius: .7rem;
    padding: .55rem .8rem;
    font-size: .85rem;
    color: var(--default-text-color);
    background: var(--default-body-bg-color, #f8f9fb);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.msg-field input:focus { border-color: rgba(var(--primary-rgb), .55); box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .12); }
.msg-field + .msg-field { margin-top: .7rem; }
.msg-field-hint { font-size: .66rem; color: var(--text-muted); margin-top: .3rem; }

.msg-chip-row { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .55rem; }
.msg-chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .74rem;
    font-weight: 600;
    background: rgba(var(--primary-rgb), .1);
    color: var(--primary-color);
    border-radius: 2rem;
    padding: .28rem .35rem .28rem .7rem;
}
.msg-chip button {
    border: none; background: rgba(var(--primary-rgb), .18); color: inherit;
    width: 1.05rem; height: 1.05rem; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .6rem; cursor: pointer;
}
.msg-user-pick {
    max-height: 12rem;
    overflow-y: auto;
    border: 1px solid var(--default-border);
    border-radius: .7rem;
    margin-top: .5rem;
}
.msg-user-pick-item {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
    padding: .45rem .7rem;
    border: none;
    background: none;
    text-align: start;
    cursor: pointer;
    font-size: .8rem;
    color: var(--default-text-color);
}
.msg-user-pick-item:hover { background: rgba(var(--primary-rgb), .06); }
.msg-user-pick-item small { color: var(--text-muted); margin-inline-start: auto; font-size: .68rem; }

.msg-error {
    font-size: .74rem;
    color: #dc2626;
    background: rgba(220,38,38,.07);
    border-radius: .55rem;
    padding: .45rem .7rem;
    margin-top: .6rem;
}

.msg-empty-hint {
    font-size: .78rem;
    color: var(--text-muted);
    text-align: center;
    padding: .9rem .5rem;
    border: 1px dashed var(--default-border);
    border-radius: .6rem;
    margin-top: .5rem;
}

/* ─────────────── ریسپانسیو ─────────────── */
@media (max-width: 991.98px) {
    .msg-app { height: calc(100dvh - 9.5rem); }
    .msg-side { width: 17rem; }
}
@media (max-width: 767.98px) {
    .msg-app { height: calc(100dvh - 8.5rem); position: relative; }
    .msg-side {
        position: absolute;
        inset: 0;
        width: 100%;
        z-index: 30;
        border-inline-end: none;
    }
    .msg-app.chat-open .msg-side { display: none; }
    .msg-main { display: none; }
    .msg-app.chat-open .msg-main { display: flex; position: absolute; inset: 0; z-index: 31; }
    .msg-back-btn { display: inline-flex; }
    .msg-bubble-wrap { max-width: 85%; }
    .msg-drawer { position: absolute; inset: 0; width: 100%; z-index: 35; border: none; }
}
