/* ══════════════════════════════════════════
       ROOT
    ══════════════════════════════════════════ */
.pm-root {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: #313338;
    font-family: 'Roboto', sans-serif;
}

/* ══════════════════════════════════════════
   ICON RAIL (левая полоска как в Discord)
══════════════════════════════════════════ */
.pm-icon-rail {
    width: 72px;
    min-width: 72px;
    background: #1e1f22;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
}

.pm-rail-logo {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #5865f2;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: border-radius 0.2s, background 0.2s;
    flex-shrink: 0;
}

    .pm-rail-logo:hover {
        border-radius: 16px;
        background: #4752c4;
    }

.pm-rail-logo-inner {
    color: white;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}

.pm-rail-divider {
    width: 32px;
    height: 2px;
    background: #35373c;
    border-radius: 1px;
    flex-shrink: 0;
}

.pm-rail-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #36393f;
    color: #96989d;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-radius 0.2s, background 0.2s, color 0.2s;
    flex-shrink: 0;
    position: relative;
}

    .pm-rail-icon:hover, .pm-rail-icon-active {
        border-radius: 16px !important;
        background: #5865f2 !important;
        color: white !important;
    }

.pm-rail-server {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #36393f;
    color: #dbdee1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: border-radius 0.2s, background 0.2s;
    flex-shrink: 0;
    overflow: hidden;
    text-align: center;
    line-height: 1;
}

.pm-rail-server-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pm-rail-server:hover {
    border-radius: 16px;
    background: #5865f2;
    color: white;
}

.pm-rail-add-server {
    color: #3ba55d;
    background: #36393f;
    border: none;
    cursor: pointer;
}

    .pm-rail-add-server:hover {
        background: #3ba55d !important;
        color: white !important;
    }

/* ══ Join-server modal ══ */
.pm-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.pm-modal-box {
    background: #2b2d31;
    border-radius: 12px;
    padding: 28px 32px;
    width: 420px;
    max-width: 95vw;
    display: flex;
    flex-direction: column;
    gap: 12px;
    color: #dbdee1;
}

.pm-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #f2f3f5;
}

.pm-modal-hint {
    font-size: 13px;
    color: #949ba4;
    margin: 0;
}

.pm-modal-input {
    background: #1e1f22;
    border: 1px solid #3c3f44;
    border-radius: 6px;
    color: #dbdee1;
    font-size: 14px;
    padding: 10px 12px;
    outline: none;
    width: 100%;
    box-sizing: border-box;
}

    .pm-modal-input:focus {
        border-color: #5865f2;
    }

.pm-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.pm-modal-btn {
    background: #36393f;
    border: none;
    border-radius: 6px;
    color: #dbdee1;
    padding: 8px 18px;
    font-size: 14px;
    cursor: pointer;
}

.pm-modal-btn--primary {
    background: #5865f2;
    color: #fff;
}

    .pm-modal-btn--primary:hover {
        background: #4752c4;
    }

    .pm-modal-btn--primary:disabled {
        opacity: .5;
        cursor: default;
    }

.pm-modal-btn:not(.pm-modal-btn--primary):hover {
    background: #404349;
}

/* ══════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════ */
.pm-sidebar {
    width: 240px;
    min-width: 200px;
    background: #2b2d31;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.pm-sidebar-header {
    padding: 16px 16px 8px;
    border-bottom: 1px solid #1e1f22;
    display: flex;
    align-items: center;
}

.pm-sidebar-title {
    color: #f2f3f5;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .02em;
}

.pm-friends-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 8px;
}

.pm-friends-section-label {
    color: #96989d;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
    padding: 8px 8px 4px;
    text-transform: uppercase;
}

.pm-friends-loading, .pm-friends-empty {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px 16px;
    color: #72767d;
    font-size: 14px;
    text-align: center;
}

.pm-friend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    cursor: pointer;
    border-radius: 6px;
    margin: 1px 0;
    transition: background 0.12s;
    color: #96989d;
}

    .pm-friend-item:hover {
        background: rgba(79, 84, 92, 0.32);
        color: #dcddde;
    }

.pm-friend-active {
    background: rgba(88, 101, 242, 0.2) !important;
    color: #f2f3f5 !important;
}

.pm-friend-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.pm-friend-name {
    font-size: 15px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Read receipts (двойная галочка как в Telegram) ─────── */
.pm-msg-ticks {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    color: #80848e;
    line-height: 0;
}
.pm-msg-ticks--read { color: #4fc3f7; }

/* ── Forward plate (плашка «Переслано от X») ─────────────── */
.pm-msg-fwd {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 2px 0 4px;
    padding: 4px 8px;
    border-left: 3px solid #5865f2;
    background: rgba(88, 101, 242, 0.08);
    border-radius: 0 6px 6px 0;
    font-size: 12px;
    color: #b9bbbe;
}
.pm-msg-fwd b { color: #dcddde; font-weight: 600; }

/* ── Forward modal ───────────────────────────────────────── */
.pm-fwd-preview {
    margin: 8px 0 12px;
    padding: 8px 10px;
    background: rgba(0,0,0,0.2);
    border-left: 3px solid #5865f2;
    border-radius: 0 6px 6px 0;
    color: #dcddde;
    font-size: 13px;
    max-height: 64px;
    overflow: hidden;
    white-space: pre-wrap;
}
.pm-fwd-favorites { background: rgba(240, 178, 50, 0.06); }
.pm-fwd-favorites:hover { background: rgba(240, 178, 50, 0.14); }

/* Тост «Переслано → X» — позиционируется над полем ввода */
/* ─── Scroll to bottom button ────────────────────────────────── */
.chat-scroll-btn {
    position: absolute;
    bottom: 80px;
    right: 20px;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: #313338;
    border: 1px solid #4f545c;
    color: #dcddde;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,.5);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity .18s, transform .18s;
    z-index: 10;
}
.chat-scroll-btn--visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.chat-scroll-btn:hover {
    background: #5865f2;
    border-color: #5865f2;
    color: #fff;
}

.pm-fwd-toast {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #2f3136;
    color: #f2f3f5;
    padding: 8px 16px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    font-size: 13px;
    z-index: 1500;
    animation: pmToastIn 0.18s ease;
}

/* ══════════════════════════════════════════
   AVATARS
══════════════════════════════════════════ */
.pm-avatar {
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    font-size: 16px;
}

.pm-avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 13px;
}

.pm-avatar-xl {
    width: 80px;
    height: 80px;
    font-size: 32px;
    margin-bottom: 12px;
}

.pm-avatar-blue {
    background: #5865f2;
}

.pm-avatar-green {
    background: #3ba55d;
}

/* ══════════════════════════════════════════
   CHAT AREA
══════════════════════════════════════════ */
.pm-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: #313338;
    min-width: 0;
}

/* Header */
.pm-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    height: 56px;
    min-height: 56px;
    border-bottom: 1px solid #1e1f22;
    flex-shrink: 0;
}

.pm-chat-header-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    min-width: 0;
}

.pm-chat-header-name {
    color: #f2f3f5;
    font-weight: 600;
    font-size: 16px;
}

.pm-chat-typing {
    color: #b9bbbe;
    font-size: 12px;
    font-style: italic;
}

.pm-conn-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #ed4245;
    font-size: 12px;
}

/* ══════════════════════════════════════════
   MESSAGES
══════════════════════════════════════════ */
.pm-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 16px 8px;
    display: flex;
    flex-direction: column;
    scroll-behavior: smooth;
}

    /* Scrollbar */
    .pm-messages::-webkit-scrollbar {
        width: 8px;
    }

    .pm-messages::-webkit-scrollbar-track {
        background: transparent;
    }

    .pm-messages::-webkit-scrollbar-thumb {
        background: #1a1b1e;
        border-radius: 4px;
    }

/* Loading / empty states */
.pm-msgs-loading {
    display: flex;
    justify-content: center;
    padding: 48px;
}

.pm-msgs-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 16px 0 8px;
}

.pm-msgs-empty-name {
    color: #f2f3f5;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
}

.pm-msgs-empty-hint {
    color: #96989d;
    font-size: 16px;
}

/* ── Date separator ── */
.pm-date-sep {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 20px 0 12px;
}

.pm-date-sep-line {
    flex: 1;
    height: 1px;
    background: #3f4147;
}

.pm-date-sep-label {
    color: #96989d;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    padding: 0 4px;
}

/* ── Individual message ── */
.pm-msg {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 2px 0;
    border-radius: 4px;
    margin: 0 -8px;
    padding-left: 8px;
    padding-right: 8px;
    transition: background 0.08s;
}

    .pm-msg:not(.pm-msg-grouped) {
        margin-top: 16px;
    }

    .pm-msg:hover {
        background: rgba(0,0,0,0.06);
    }

.pm-msg-av {
    width: 40px;
    height: 40px;
    font-size: 16px;
    margin-top: 1px;
    flex-shrink: 0;
}

.pm-msg-av-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

/* ── Quote block (rendered inside messages) ── */
.pm-quote-block {
    display: flex;
    gap: 8px;
    background: rgba(255,255,255,.06);
    border-radius: 4px;
    padding: 6px 10px;
    margin-bottom: 4px;
    max-width: 100%;
    overflow: hidden;
}

.pm-quote-block-bar {
    width: 3px;
    min-width: 3px;
    border-radius: 2px;
    background: #5865f2;
    flex-shrink: 0;
}

.pm-quote-block-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.pm-quote-block-author {
    font-size: 12px;
    font-weight: 600;
    color: #5865f2;
}

.pm-quote-block-text {
    font-size: 13px;
    color: #b5bac1;
    white-space: pre-wrap;
    word-break: break-word;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* ── Quote preview (above input) ── */
.pm-quote-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,.05);
    border-radius: 6px 6px 0 0;
    padding: 6px 12px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.pm-quote-preview-bar {
    width: 3px;
    min-width: 3px;
    height: 32px;
    border-radius: 2px;
    background: #5865f2;
    flex-shrink: 0;
}

.pm-quote-preview-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.pm-quote-preview-author {
    font-size: 12px;
    font-weight: 600;
    color: #5865f2;
}

.pm-quote-preview-text {
    font-size: 12px;
    color: #b5bac1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pm-quote-preview-close {
    background: none;
    border: none;
    color: #949ba4;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1;
}

    .pm-quote-preview-close:hover {
        color: #dbdee1;
        background: rgba(255,255,255,.08);
    }

/* Spacer for grouped messages (держит выравнивание) */
.pm-msg-av-spacer {
    width: 40px;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* Timestamp for grouped messages — видно при hover */
.pm-msg-hover-time {
    color: #72767d;
    font-size: 10px;
    opacity: 0;
    transition: opacity 0.1s;
    white-space: nowrap;
    padding-right: 2px;
}

.pm-msg:hover .pm-msg-hover-time {
    opacity: 1;
}

.pm-msg-body {
    flex: 1;
    min-width: 0;
}

.pm-msg-meta {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 2px;
}

.pm-msg-author {
    font-weight: 600;
    font-size: 15px;
    color: #f2f3f5;
}

.pm-msg-author-me {
    color: #3ba55d;
}

.pm-msg-author-other {
    color: #f2f3f5;
}

.pm-msg-time {
    color: #72767d;
    font-size: 11px;
}

.pm-msg-text {
    color: #dcddde;
    font-size: 15px;
    line-height: 1.45;
    word-break: break-word;
    white-space: pre-wrap;
}

/* ══════════════════════════════════════════
   INPUT
══════════════════════════════════════════ */
/* ── ChatPanel messages container ── */
.pm-msgs {
    flex: 1;
    overflow-y: auto;
    padding: 16px 16px 8px;
    display: flex;
    flex-direction: column;
    /* auto, не smooth — иначе scrollTop=scrollHeight при открытии чата
       плавно анимируется с верха вниз на глазах у пользователя.
       Прыжок к сообщению по quote остаётся плавным: scrollIntoView там
       вызывается с явным behavior:'smooth'. */
    scroll-behavior: auto;
}

    .pm-msgs::-webkit-scrollbar {
        width: 8px;
    }

    .pm-msgs::-webkit-scrollbar-track {
        background: transparent;
    }

    .pm-msgs::-webkit-scrollbar-thumb {
        background: #1a1b1e;
        border-radius: 4px;
    }

.pm-input-wrap {
    padding: 0 16px 16px;
    flex-shrink: 0;
}

.pm-input-box {
    display: flex;
    align-items: flex-end;
    background: #383a40;
    border-radius: 8px;
    padding: 0 12px 0 4px;
    gap: 8px;
}

.pm-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #dcddde;
    font-size: 15px;
    padding: 12px 0;
    caret-color: white;
    font-family: inherit;
    resize: none;
    overflow-y: hidden;
    line-height: 1.45;
}

    .pm-input::placeholder {
        color: #72767d;
    }

.pm-send-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #b9bbbe;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

    .pm-send-btn:hover:not(.pm-send-disabled) {
        color: #dcddde;
        background: rgba(255,255,255,0.06);
    }

.pm-send-disabled {
    opacity: 0.3;
    cursor: default;
}

/* ══════════════════════════════════════════
   PLACEHOLDER (no dialog selected)
══════════════════════════════════════════ */
.pm-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.pm-placeholder-title {
    color: #f2f3f5;
    font-size: 20px;
    font-weight: 700;
}

.pm-placeholder-sub {
    color: #96989d;
    font-size: 14px;
}

/* ══ Images & links in messages ══ */
.pm-img {
    max-width: 320px;
    max-height: 280px;
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 8px;
    display: block;
    cursor: pointer;
    transition: filter 0.15s;
}

    .pm-img:hover {
        filter: brightness(0.88);
    }

.pm-img-caption {
    color: #dcddde;
    font-size: 13px;
    margin-top: 4px;
}

.pm-link {
    color: #00aff4;
    text-decoration: none;
    word-break: break-all;
}

    .pm-link:hover {
        text-decoration: underline;
    }

/* ══ Back button (hidden on desktop) ══ */
.pm-back-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: #96989d;
    padding: 6px;
    border-radius: 6px;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}

    .pm-back-btn:hover {
        color: #f2f3f5;
        background: rgba(255,255,255,0.06);
    }

/* ══════════════════════════════════════════
   MOBILE — ≤ 767px
══════════════════════════════════════════ */
@media (max-width: 767px) {

    /* dvh — правильная высота с учётом адресной строки iOS/Android */
    .pm-root {
        position: relative;
        height: 100vh;
        height: 100dvh;
    }

    /* Скрываем icon rail */
    .pm-icon-rail {
        display: none;
    }

    /* Sidebar — полный экран, уезжает влево когда чат открыт */
    .pm-sidebar {
        position: absolute;
        inset: 0;
        width: 100%;
        min-width: unset;
        z-index: 10;
        transition: transform 0.28s cubic-bezier(.4,0,.2,1);
    }

    .pm-sidebar--hidden {
        transform: translateX(-100%);
        pointer-events: none;
    }

    /* Chat — полный экран, приезжает справа */
    .pm-chat-wrap {
        position: absolute;
        inset: 0;
        z-index: 11;
        transform: translateX(100%);
        transition: transform 0.28s cubic-bezier(.4,0,.2,1);
    }

    .pm-chat-wrap--active {
        transform: translateX(0);
    }

    .pm-chat {
        position: relative;
        inset: unset;
        z-index: unset;
        transform: none;
        transition: none;
        flex: 1;
    }

    .pm-chat--active {
        transform: none;
    }

    /* Показываем кнопку назад */
    .pm-back-btn {
        display: flex;
    }

    /* Шапка чата */
    .pm-chat-header {
        padding: 0 12px;
        gap: 8px;
    }

    /* Сообщения */
    .pm-messages {
        padding: 12px 10px 6px;
    }

    /* Инпут */
    .pm-input-wrap {
        padding: 0 10px 10px;
    }

    /* Аватары чуть меньше */
    .pm-avatar {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .pm-msg-av {
        width: 36px;
        height: 36px;
    }

    .pm-msg-av-spacer {
        width: 36px;
        min-width: 36px;
    }

    /* Картинки — на всю ширину */
    .pm-img {
        max-width: 100%;
    }

    /* Пустой экран */
    .pm-msgs-empty-name {
        font-size: 22px;
    }

    .pm-msgs-empty-hint {
        font-size: 14px;
    }

    /* Заголовок sidebar */
    .pm-sidebar-header {
        padding: 14px 16px 10px;
    }

    /* Друзья */
    .pm-friend-item {
        padding: 10px 12px;
    }

    .pm-friend-name {
        font-size: 15px;
    }

    /* Отступы сообщений */
    .pm-msg:not(.pm-msg-grouped) {
        margin-top: 14px;
    }

    /* Разделитель дат */
    .pm-date-sep {
        margin: 16px 0 10px;
    }

    /* Call bar — compact on mobile */
    .pm-call-bar {
        padding: 4px 8px;
        gap: 6px;
        font-size: 12px;
        margin-left: auto;
        flex-shrink: 0;
    }

    .pm-call-bar-icon {
        display: none;
    }
    /* hide phone icon to save space */

    /* Screen share not supported on most mobile browsers — hide button */
    .pm-screen-btn {
        display: none;
    }

    /* Call overlay buttons — larger touch targets */
    .pm-ov-btn {
        width: 72px;
        height: 72px;
        font-size: 13px;
    }

    .pm-call-ov-actions {
        gap: 32px;
    }

    /* Screen share panel — less height on mobile */
    .pm-screen-panel {
        min-height: 160px;
        max-height: 40vh;
    }
}

/* ══════════════════════════════════════════
   EXTRA SMALL — ≤ 400px
══════════════════════════════════════════ */
@media (max-width: 400px) {
    .pm-chat-header-name {
        font-size: 15px;
    }

    .pm-msg-author {
        font-size: 13px;
    }

    .pm-msg-text {
        font-size: 14px;
    }

    .pm-input {
        font-size: 14px;
        padding: 10px 0;
    }

    .pm-avatar {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .pm-msg-av {
        width: 32px;
        height: 32px;
    }

    .pm-msg-av-spacer {
        width: 32px;
        min-width: 32px;
    }

    .pm-messages {
        padding: 10px 8px 4px;
    }

    .pm-input-wrap {
        padding: 0 8px 8px;
    }

    .pm-msgs-empty-name {
        font-size: 20px;
    }
}

/* ══════════════════════════════════════════
   CALL UI
══════════════════════════════════════════ */

/* Кнопка звонка в шапке */
.pm-call-btn {
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    color: #b5bac1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

    .pm-call-btn:hover {
        background: #3f4147;
        color: #fff;
    }

    .pm-call-btn:disabled {
        opacity: 0.4;
        cursor: default;
    }

/* Строка активного звонка в шапке */
.pm-call-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #2d7a4f;
    border-radius: 6px;
    padding: 4px 10px;
    margin-left: auto;
    color: #dcfce7;
    font-size: 13px;
    font-weight: 500;
}

.pm-call-bar-icon {
    display: flex;
    align-items: center;
    color: #86efac;
}

.pm-call-bar-time {
    min-width: 36px;
    font-variant-numeric: tabular-nums;
}

.pm-call-end-btn {
    width: 26px;
    height: 26px;
    border: none;
    background: #dc2626;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s;
}

    .pm-call-end-btn:hover {
        background: #b91c1c;
    }

.pm-call-bar-btn {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 4px;
    background: rgba(255,255,255,0.12);
    color: #dcfce7;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}

    .pm-call-bar-btn:hover {
        background: rgba(255,255,255,0.25);
    }

.pm-call-bar-btn--active {
    background: rgba(242,63,67,0.35);
    color: #fca5a5;
}

    .pm-call-bar-btn--active:hover {
        background: rgba(242,63,67,0.5);
    }

/* Оверлей звонка */
.pm-call-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: rgba(30, 31, 34, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.pm-call-overlay--outgoing {
    background: rgba(30, 31, 34, 0.85);
}

.pm-call-ov-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #5865f2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 0 0 4px rgba(88, 101, 242, 0.3);
    animation: pm-pulse 2s ease-in-out infinite;
}

@keyframes pm-pulse {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(88, 101, 242, 0.3);
    }

    50% {
        box-shadow: 0 0 0 12px rgba(88, 101, 242, 0.12);
    }
}

.pm-call-ov-name {
    font-size: 22px;
    font-weight: 600;
    color: #fff;
}

.pm-call-ov-hint {
    font-size: 14px;
    color: #b5bac1;
}

.pm-call-ov-actions {
    display: flex;
    gap: 24px;
    margin-top: 8px;
}

.pm-ov-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border: none;
    border-radius: 50%;
    width: 64px;
    height: 64px;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: filter 0.15s;
}

    .pm-ov-btn:hover {
        filter: brightness(1.15);
    }

.pm-ov-accept {
    background: #23a55a;
    color: #fff;
}

.pm-ov-decline {
    background: #f23f43;
    color: #fff;
}

/* ══ Онлайн-статус и бейджи ══ */
.pm-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.pm-online-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 2px solid #2b2d31;
}

.pm-online-dot--on,
.pm-online-dot--online {
    background: #23a55a;
}

.pm-online-dot--away {
    background: #f0b232;
}

.pm-online-dot--dnd {
    background: #ed4245;
}

    .pm-online-dot--dnd::after {
        content: '';
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        width: 55%;
        height: 2px;
        background: #fff;
        border-radius: 1px;
    }

.pm-online-dot--off {
    background: #80848e;
}

.pm-friend-status {
    font-size: 11px;
    color: #80848e;
    line-height: 1;
    margin-top: 2px;
}

.pm-unread-badge {
    margin-left: auto;
    flex-shrink: 0;
    background: #f23f43;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 6px;
    min-width: 18px;
    text-align: center;
    line-height: 16px;
}

/* Статус звонка (не в сети / отклонён) */
.pm-call-status-msg {
    font-size: 12px;
    color: #f87171;
    white-space: nowrap;
}

/* ══ Screen share button in call bar ══ */
.pm-screen-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    border: none;
    background: rgba(255,255,255,0.12);
    color: #dcfce7;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

    .pm-screen-btn:hover {
        background: rgba(255,255,255,0.2);
    }

.pm-screen-btn--active {
    background: #1d4ed8;
    color: #fff;
    animation: pm-screen-pulse 2s ease-in-out infinite;
}

@keyframes pm-screen-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(29,78,216,0.4);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(29,78,216,0);
    }
}

/* ══ Screen share panel ══ */
.pm-screen-panel {
    flex-shrink: 0;
    background: #1a1b1e;
    border-bottom: 1px solid #2c2e33;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    max-height: 55vh;
    position: relative;
    overflow: hidden;
}

.pm-screen-video {
    width: 100%;
    height: 100%;
    max-height: 55vh;
    object-fit: contain;
    background: #000;
    display: block;
}

.pm-screen-label {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.65);
    color: #e3e5e8;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.pm-screen-label--remote {
    color: #86efac;
}

.pm-screen-sharing-self {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #86efac;
    font-size: 15px;
    font-weight: 500;
    padding: 24px;
}

.pm-screen-stop-btn {
    border: 1px solid #dc2626;
    background: transparent;
    color: #f87171;
    border-radius: 6px;
    padding: 6px 18px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

    .pm-screen-stop-btn:hover {
        background: #dc2626;
        color: #fff;
    }

.pm-screen-remote-wrap {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: stretch;
    justify-content: center;
    overflow: hidden;
}

.pm-screen-fullscreen-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.55);
    border: none;
    border-radius: 6px;
    color: #e3e5e8;
    padding: 5px 7px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.pm-screen-remote-wrap:hover .pm-screen-fullscreen-btn {
    opacity: 1;
}

/* ── Overlay buttons (fullscreen + hide) on remote video ── */
.pm-screen-overlay-btns {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.pm-screen-remote-wrap:hover .pm-screen-overlay-btns {
    opacity: 1;
}

.pm-screen-overlay-btn {
    background: rgba(0,0,0,0.55);
    border: none;
    border-radius: 6px;
    color: #e3e5e8;
    padding: 5px 7px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

    .pm-screen-overlay-btn:hover {
        background: rgba(0,0,0,0.85);
        color: #fff;
    }

/* ── Camera PiP (picture-in-picture over remote video) ── */
.pm-camera-pip {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 140px;
    height: 90px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.25);
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    background: #000;
    z-index: 2;
}

.pm-camera-pip-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ── Camera solo view (when no remote video) ── */
.pm-camera-solo-wrap {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: stretch;
    justify-content: center;
    overflow: hidden;
}

    .pm-camera-solo-wrap:hover .pm-screen-overlay-btns {
        opacity: 1;
    }

.pm-camera-solo-video {
    width: 100%;
    height: 100%;
    max-height: 55vh;
    object-fit: contain;
    background: #000;
    display: block;
    transform: scaleX(-1); /* mirror the camera for a natural selfie view */
}

/* ── "Video hidden" badge ── */
.pm-video-hidden-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 8px 16px;
    color: #9ca3af;
    font-size: 13px;
}

/* ══════════════════════════════════════════
   ADD FRIEND / SEARCH
══════════════════════════════════════════ */

/* Кнопка в шапке сайдбара */
.pm-add-friend-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #96989d;
    padding: 4px 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: color .15s, background .15s;
    margin-left: auto;
}

    .pm-add-friend-btn:hover {
        color: #dbdee1;
        background: rgba(255,255,255,.08);
    }

/* Секция запросов */
.pm-requests-section {
    padding: 8px 8px 4px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.pm-requests-label {
    font-size: 11px;
    font-weight: 700;
    color: #96989d;
    letter-spacing: .5px;
    padding: 4px 8px 6px;
}

.pm-request-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background .1s;
}

    .pm-request-item:hover {
        background: rgba(255,255,255,.06);
    }

.pm-request-name {
    flex: 1;
    font-size: 14px;
    color: #dcddde;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pm-req-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s;
}

.pm-req-accept {
    background: rgba(35,165,90,.25);
    color: #23a55a;
}

    .pm-req-accept:hover {
        background: rgba(35,165,90,.45);
    }

.pm-req-decline {
    background: rgba(237,66,69,.2);
    color: #ed4245;
}

    .pm-req-decline:hover {
        background: rgba(237,66,69,.4);
    }

/* Модал добавления друга */
.pm-add-friend-modal {
    background: #2b2d31;
    border-radius: 12px;
    padding: 24px;
    width: 420px;
    max-width: 90vw;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 16px 48px rgba(0,0,0,.6);
    animation: pmModalIn .15s ease;
}

@keyframes pmModalIn {
    from {
        opacity: 0;
        transform: scale(.96) translateY(-8px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.pm-add-friend-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    color: #f2f3f5;
}

.pm-add-friend-hint {
    font-size: 14px;
    color: #96989d;
    margin: 0;
}

.pm-search-row {
    display: flex;
    gap: 8px;
}

.pm-search-input {
    flex: 1;
    background: #1e1f22;
    border: 1px solid #3f4147;
    border-radius: 6px;
    padding: 9px 12px;
    color: #dcddde;
    font-size: 14px;
    outline: none;
    transition: border-color .15s;
}

    .pm-search-input:focus {
        border-color: #5865f2;
    }

    .pm-search-input::placeholder {
        color: #72767d;
    }

.pm-search-btn {
    padding: 9px 18px;
    border-radius: 6px;
    border: none;
    background: #5865f2;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: background .15s;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

    .pm-search-btn:hover:not(:disabled) {
        background: #4752c4;
    }

    .pm-search-btn:disabled {
        background: #3f4147;
        color: #72767d;
        cursor: not-allowed;
    }

.pm-search-empty {
    text-align: center;
    color: #72767d;
    font-size: 14px;
    padding: 16px 0;
}

.pm-search-results {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 260px;
    overflow-y: auto;
}

.pm-search-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    transition: background .1s;
}

    .pm-search-result-item:hover {
        background: rgba(255,255,255,.06);
    }

.pm-search-result-name {
    flex: 1;
    font-size: 15px;
    color: #dcddde;
}

.pm-send-req-btn {
    padding: 6px 14px;
    border-radius: 6px;
    border: none;
    background: #5865f2;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: background .15s;
    flex-shrink: 0;
}

    .pm-send-req-btn:hover {
        background: #4752c4;
    }

.pm-req-sent-badge {
    font-size: 12px;
    color: #23a55a;
    background: rgba(35,165,90,.18);
    padding: 4px 10px;
    border-radius: 20px;
    flex-shrink: 0;
}

.pm-req-error-badge {
    font-size: 12px;
    color: #ed4245;
    background: rgba(237,66,69,.18);
    padding: 4px 10px;
    border-radius: 20px;
    flex-shrink: 0;
}

/* Кнопка "Начать чат" в результатах поиска */
.pm-search-result-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.pm-start-chat-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,.15);
    background: transparent;
    color: #dcddde;
    font-size: 13px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    flex-shrink: 0;
}

    .pm-start-chat-btn:hover {
        background: rgba(255,255,255,.08);
        border-color: rgba(255,255,255,.25);
    }

/* Элемент недавних контактов (не-друзья) */
.pm-friend-item--nonfriend .pm-avatar {
    border: 2px solid rgba(245,158,11,.4);
}

/* Обёртка для плашки + чат-панели */
.pm-chat-wrap {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

/* Плашка "не в контактах" над чатом */
.pm-not-contact-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: rgba(245, 158, 11, 0.12);
    border-bottom: 1px solid rgba(245, 158, 11, 0.3);
    color: #f59e0b;
    font-size: 13px;
    flex-shrink: 0;
}

    .pm-not-contact-banner span {
        flex: 1;
    }

.pm-not-contact-add-btn {
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid rgba(245,158,11,.5);
    background: transparent;
    color: #f59e0b;
    font-size: 12px;
    cursor: pointer;
    transition: background .15s;
    white-space: nowrap;
    flex-shrink: 0;
}

    .pm-not-contact-add-btn:hover {
        background: rgba(245,158,11,.18);
    }

/* Тост-уведомление о запросе */
.pm-friend-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    background: #2b2d31;
    border: 1px solid #3f4147;
    border-left: 3px solid #5865f2;
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.5);
    min-width: 280px;
    max-width: 380px;
    animation: pmToastIn .2s ease;
    color: #dcddde;
    font-size: 14px;
}

@keyframes pmToastIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pm-friend-toast svg {
    color: #5865f2;
    flex-shrink: 0;
}

.pm-friend-toast span {
    flex: 1;
}

.pm-friend-toast-close {
    background: none;
    border: none;
    color: #96989d;
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
    flex-shrink: 0;
    transition: color .15s;
}

    .pm-friend-toast-close:hover {
        color: #f2f3f5;
    }

/* pm-avatar-orange */
.pm-avatar-orange {
    background: #ed8c00 !important;
}

/* ══════════════════════════════════════════
   DRAG-DROP / IMAGE ATTACH
══════════════════════════════════════════ */
.pm-attach-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #96989d;
    padding: 6px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: color .15s;
}

    .pm-attach-btn:hover {
        color: #dbdee1;
    }

/* Кнопка "прикрепить файл" (папка) — курсор указывает на label */
.pm-file-btn { cursor: pointer; }

/* ─── Ожидающий файл (бар над полем ввода) ──────────────────── */
.pm-file-pending-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #2b2d31;
    border-top: 1px solid #1e1f22;
    font-size: 13px;
    flex-shrink: 0;
}
.pm-file-pending-icon { font-size: 22px; flex-shrink: 0; }
.pm-file-pending-info { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.pm-file-pending-name { color: #dbdee1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.pm-file-pending-size { color: #72767d; font-size: 11px; }
.pm-file-pending-error { color: #ed4245; font-size: 12px; flex: 1; }
.pm-file-pending-progress { color: #72767d; font-size: 12px; }

/* Прогресс-бар загрузки файла */
.pm-file-upload-progress {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.pm-file-upload-track {
    flex: 1;
    height: 4px;
    background: #2b2d31;
    border-radius: 2px;
    overflow: hidden;
}
.pm-file-upload-bar {
    height: 100%;
    background: linear-gradient(90deg, #5865f2, #57f287);
    border-radius: 2px;
    transition: width .2s ease;
}
.pm-file-upload-pct {
    color: #72767d;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 34px;
    text-align: right;
}
.pm-file-pending-send {
    background: #5865f2; border: none; border-radius: 50%;
    width: 30px; height: 30px; color: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: background .15s;
}
.pm-file-pending-send:hover { background: #4752c4; }
.pm-file-pending-cancel {
    background: none; border: none; color: #72767d; cursor: pointer;
    font-size: 14px; padding: 4px 6px; border-radius: 4px;
    flex-shrink: 0; transition: color .15s;
}
.pm-file-pending-cancel:hover { color: #ed4245; }

/* ─── Карточка файла в сообщении ────────────────────────────── */
.msg-file-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #2b2d31;
    border: 1px solid #3f4147;
    border-radius: 8px;
    padding: 10px 12px;
    margin-top: 4px;
    max-width: 340px;
}
.msg-file-emoji { font-size: 28px; flex-shrink: 0; line-height: 1; }
.msg-file-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.msg-file-name {
    color: #dbdee1; font-size: 13px; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.msg-file-size { color: #72767d; font-size: 11px; }
.msg-file-actions { display: flex; gap: 4px; flex-shrink: 0; }
.msg-file-btn {
    background: #40444b; border: none; border-radius: 6px;
    width: 30px; height: 30px; color: #b9bbbe; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    text-decoration: none; transition: background .15s, color .15s;
}
.msg-file-btn:hover { background: #5865f2; color: #fff; }

.pm-drop-overlay {
    position: absolute;
    inset: 0;
    z-index: 100;
    background: rgba(88, 101, 242, 0.18);
    border: 2px dashed #5865f2;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.pm-drop-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #5865f2;
    font-size: 16px;
    font-weight: 600;
}

.pm-img-preview-overlay {
    position: absolute;
    inset: 0;
    z-index: 200;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pm-img-preview-card {
    background: #2b2d31;
    border-radius: 8px;
    padding: 16px;
    max-width: 480px;
    width: 90%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.pm-img-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 16px;
    font-weight: 600;
    color: #f2f3f5;
}

.pm-img-preview-close {
    background: none;
    border: none;
    color: #96989d;
    cursor: pointer;
    font-size: 18px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color .15s;
}

    .pm-img-preview-close:hover {
        color: #f2f3f5;
    }

.pm-img-preview-img {
    width: 100%;
    max-height: 320px;
    object-fit: contain;
    border-radius: 6px;
    background: #1e1f22;
}

.pm-img-preview-img-wrap {
    position: relative;
    width: 100%;
}

.pm-img-upload-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.55);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #fff;
    font-size: 13px;
    pointer-events: none;
}

.pm-img-upload-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,255,255,0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pm-img-upload-spin 0.8s linear infinite;
}

@keyframes pm-img-upload-spin {
    to { transform: rotate(360deg); }
}

.pm-img-preview-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.pm-img-preview-cancel {
    padding: 8px 20px;
    border-radius: 6px;
    border: none;
    background: rgba(255,255,255,0.1);
    color: #dbdee1;
    font-size: 14px;
    cursor: pointer;
    transition: background .15s;
}

    .pm-img-preview-cancel:hover {
        background: rgba(255,255,255,0.18);
    }

.pm-img-preview-send {
    padding: 8px 20px;
    border-radius: 6px;
    border: none;
    background: #5865f2;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: background .15s;
}

    .pm-img-preview-send:hover:not(:disabled) {
        background: #4752c4;
    }

    .pm-img-preview-send:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

/* Caption input inside image preview */
.pm-img-caption-input {
    background: #1e1f22;
    border: 1px solid #3c3f44;
    border-radius: 6px;
    color: #dbdee1;
    font-size: 14px;
    padding: 8px 12px;
    outline: none;
    width: 100%;
    box-sizing: border-box;
}

    .pm-img-caption-input:focus {
        border-color: #5865f2;
    }

    .pm-img-caption-input::placeholder {
        color: #6d6f78;
    }

/* ══ Image viewer (fullscreen) ══ */
.pm-img-viewer-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0,0,0,.9);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn .15s ease;
    cursor: zoom-out;
    outline: none;
}

@keyframes fadeIn {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

.pm-img-viewer-img {
    max-width: 92vw;
    max-height: 92vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0,0,0,.7);
    cursor: default;
}

.pm-img-viewer-close {
    position: absolute;
    top: 18px;
    right: 22px;
    background: rgba(255,255,255,.12);
    border: none;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}

    .pm-img-viewer-close:hover {
        background: rgba(255,255,255,.22);
    }

/* Кнопки перелистывания в viewer'е */
.pm-img-viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,.12);
    border: none;
    color: #fff;
    font-size: 32px;
    line-height: 1;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    transition: background .15s;
}

    .pm-img-viewer-nav:hover {
        background: rgba(255,255,255,.25);
    }

.pm-img-viewer-prev { left: 18px; }
.pm-img-viewer-next { right: 18px; }

.pm-img-viewer-counter {
    position: absolute;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    background: rgba(0,0,0,.55);
    padding: 6px 14px;
    border-radius: 14px;
    font-size: 13px;
}

/* Make pm-img clickable */
.pm-img {
    cursor: zoom-in;
}

/* ══ Attachments grid в сообщении ══ */
.pm-attach-grid {
    display: grid;
    gap: 4px;
    margin: 4px 0;
    max-width: 420px;
    grid-template-columns: 1fr;
}

.pm-attach-grid--2 { grid-template-columns: 1fr 1fr; }
.pm-attach-grid--3,
.pm-attach-grid--4 { grid-template-columns: 1fr 1fr; }

.pm-attach-thumb {
    width: 100%;
    max-height: 260px;
    object-fit: cover;
    border-radius: 6px;
    cursor: zoom-in;
    display: block;
    background: #1e1f22;
}

.pm-attach-grid--1 .pm-attach-thumb { max-height: 340px; object-fit: contain; }

/* ══ Preview modal — сетка выбранных файлов ══ */
.pm-img-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 8px;
    padding: 12px 16px;
    max-height: 300px;
    overflow-y: auto;
}

.pm-img-preview-cell {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    background: #1e1f22;
}

.pm-img-preview-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pm-img-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,.75);
    color: #fff;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .pm-img-preview-remove:hover { background: #ed4245; }
    .pm-img-preview-remove:disabled { opacity: .5; cursor: default; }

.pm-img-preview-add {
    aspect-ratio: 1;
    border: 2px dashed #3f4248;
    border-radius: 6px;
    background: transparent;
    color: #9aa0a6;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color .15s, color .15s;
}

    .pm-img-preview-add:hover { border-color: #5865f2; color: #dcddde; }

/* ══ Channel password gate ══ */
.pm-channel-lock {
    position: absolute;
    inset: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2b2d31;
}

.pm-channel-lock-card {
    width: 360px;
    max-width: 90%;
    padding: 28px 28px 24px;
    background: #1e1f22;
    border: 1px solid #3f4147;
    border-radius: 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,.35);
}

.pm-channel-lock-icon {
    font-size: 40px;
    line-height: 1;
    margin-bottom: 4px;
}

.pm-channel-lock-title {
    font-size: 17px;
    font-weight: 600;
    color: #dcddde;
}

.pm-channel-lock-sub {
    font-size: 13px;
    color: #9aa0a6;
    margin-bottom: 6px;
}

.pm-channel-lock-input {
    width: 100%;
    background: #1e1f22;
    border: 1px solid #3f4147;
    color: #dcddde;
    padding: 10px 12px;
    border-radius: 6px;
    outline: none;
    font-size: 14px;
    transition: border-color .15s;
}

    .pm-channel-lock-input:focus { border-color: #5865f2; }
    .pm-channel-lock-input:disabled { opacity: .6; }

.pm-channel-lock-error {
    color: #ed4245;
    font-size: 12px;
    align-self: flex-start;
}

.pm-channel-lock-btn {
    margin-top: 6px;
    width: 100%;
    padding: 10px 14px;
    background: #5865f2;
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}

    .pm-channel-lock-btn:hover:not(:disabled) { background: #4752c4; }
    .pm-channel-lock-btn:disabled { opacity: .6; cursor: default; }

/* ══ Format toolbar ══ */
.pm-format-toolbar {
    display: flex;
    gap: 4px;
    padding: 4px 8px 2px;
    align-items: center;
}

.pm-fmt-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #b5bac1;
    width: 30px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .12s, color .12s, border-color .12s;
}

    .pm-fmt-btn:hover {
        background: #36373d;
        color: #dcddde;
        border-color: #3f4147;
    }

/* ══ Mute banner (заглушен на сервере) ══ */
.pm-mute-banner {
    margin: 0 16px 6px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(237, 66, 69, 0.15);
    border: 1px solid rgba(237, 66, 69, 0.4);
    border-radius: 6px;
    color: #f2b4b6;
    font-size: 13px;
}

.pm-mute-icon { font-size: 16px; }

.pm-mute-text { flex: 1; }

/* ══ TODO-список в сообщении ══ */
.pm-todo {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid #3f4147;
    border-radius: 6px;
    padding: 8px 10px;
    margin-top: 2px;
    max-width: 520px;
}

.pm-todo-header {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #b5bac1;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.pm-todo-progress {
    margin-left: auto;
    color: #949ba4;
    font-weight: 500;
    font-size: 11px;
}

.pm-todo-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 4px;
    border-radius: 4px;
    cursor: pointer;
    color: #dcddde;
    font-size: 14px;
    line-height: 1.4;
}

    .pm-todo-item:hover { background: rgba(255, 255, 255, 0.05); }

    .pm-todo-item input[type="checkbox"] {
        flex-shrink: 0;
        width: 15px;
        height: 15px;
        cursor: pointer;
        accent-color: #5865f2;
    }

.pm-todo-text { flex: 1; word-break: break-word; }

.pm-todo-item--done .pm-todo-text {
    text-decoration: line-through;
    color: #72767d;
}

.pm-todo-count {
    background: rgba(88, 101, 242, 0.25);
    color: #b5bac1;
    padding: 1px 7px;
    border-radius: 9px;
    font-size: 11px;
    min-width: 20px;
    text-align: center;
}

.pm-todo--pinned { margin-top: 6px; }

/* Inline code внутри сообщения */
.chat-inline-code {
    background: rgba(0, 0, 0, 0.45);
    padding: 1px 5px;
    border-radius: 4px;
    font-family: Consolas, Menlo, "Courier New", monospace;
    font-size: 0.92em;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.pm-screen-fullscreen-btn:hover {
    background: rgba(0,0,0,0.85);
    color: #fff;
}
/* ══ Server rail image ══ */
.pm-rail-server-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

/* ══ Server choice modal ══ */
.pm-server-choice-box {
    width: 460px;
    text-align: center;
}

.pm-server-choice-btns {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 8px;
}

.pm-server-choice-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: #1e1f22;
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 20px 12px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    color: #dbdee1;
}

    .pm-server-choice-btn:hover {
        border-color: #5865f2;
        background: #2b2d31;
    }

.pm-server-choice-label {
    font-size: 14px;
    font-weight: 600;
    color: #f2f3f5;
}

.pm-server-choice-hint {
    font-size: 12px;
    color: #949ba4;
}

/* ══ Create server modal ══ */
.pm-create-srv-modal {
    background: #2b2d31;
    border-radius: 12px;
    padding: 28px 32px;
    width: 440px;
    max-width: 95vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: #dbdee1;
}

.pm-create-srv-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #1e1f22;
    border: 2px dashed #4e5058;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: border-color .15s;
}

    .pm-create-srv-img:hover {
        border-color: #5865f2;
    }

.pm-create-srv-img-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pm-create-srv-img-hover {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.55);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #fff;
    font-weight: 600;
}

.pm-create-srv-img:hover .pm-create-srv-img-hover {
    display: flex;
}

.pm-modal-field {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pm-modal-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    color: #b5bac1;
    text-transform: uppercase;
}

/* ── Message edit/delete ── */
.pm-msg {
    position: relative;
}

.pm-msg-actions {
    position: absolute;
    right: 8px;
    top: -14px;
    background: #2b2d31;
    border: 1px solid #3c3f44;
    border-radius: 6px;
    display: flex;
    gap: 2px;
    padding: 3px 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,.4);
    z-index: 10;
}

.pm-msg-action-btn {
    background: none;
    border: none;
    color: #b5bac1;
    cursor: pointer;
    border-radius: 4px;
    padding: 3px 5px;
    display: flex;
    align-items: center;
    transition: color .15s, background .15s;
}

    .pm-msg-action-btn:hover {
        color: #dbdee1;
        background: rgba(255,255,255,.08);
    }

.pm-msg-action-btn--danger:hover {
    color: #ed4245;
    background: rgba(237,66,69,.1);
}

.pm-msg-deleted {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #6d6f78;
    font-style: italic;
    font-size: 13px;
    background: rgba(255,255,255,.03);
    border-radius: 4px;
    padding: 4px 8px;
    border: 1px solid rgba(255,255,255,.05);
}

.pm-msg-edited {
    font-size: 10px;
    color: #6d6f78;
    margin-left: 4px;
    font-style: italic;
}

.pm-msg-edit-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.pm-msg-edit-input {
    background: #1e1f22;
    border: 1px solid #5865f2;
    border-radius: 6px;
    color: #dbdee1;
    font-size: 14px;
    padding: 8px 10px;
    resize: none;
    outline: none;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
    line-height: 1.4;
}

/* ── Profile rail button & popup ── */
.pm-rail-spacer {
    flex: 1;
}

.pm-rail-profile-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 12px;
    flex-shrink: 0;
}

.pm-rail-profile-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #5865f2;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-radius 0.2s, background 0.2s;
    flex-shrink: 0;
}

    .pm-rail-profile-btn:hover {
        border-radius: 16px;
        background: #4752c4;
    }

.pm-profile-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999;
}

.pm-profile-popup {
    position: fixed;
    bottom: 70px;
    left: 80px;
    z-index: 1000;
    background: #18191c;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 12px;
    width: 240px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    animation: pm-popup-in 0.15s cubic-bezier(0.16,1,0.3,1) both;
}

@keyframes pm-popup-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pm-profile-popup-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 2px 8px;
}

.pm-profile-popup-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #5865f2;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    flex-shrink: 0;
}

.pm-profile-popup-info {
    overflow: hidden;
}

.pm-profile-popup-name {
    color: #f2f3f5;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pm-profile-popup-sub {
    color: #43b581;
    font-size: 12px;
    margin-top: 2px;
}

.pm-profile-popup-divider {
    height: 1px;
    background: rgba(255,255,255,0.07);
    margin: 4px 0 8px;
}

.pm-profile-popup-logout {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    color: #ed4245;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 7px 8px;
    border-radius: 6px;
    transition: background 0.15s;
    text-align: left;
}

    .pm-profile-popup-logout:hover {
        background: rgba(237,66,69,0.15);
    }

/* ── Reactions ── */
.pm-msg-reactions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    min-height: 24px;
    position: relative;
}

.pm-reaction-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 2px 8px;
    cursor: pointer;
    color: #dcddde;
    font-size: 13px;
    transition: background 0.15s;
    line-height: 1.4;
}

    .pm-reaction-btn:hover {
        background: rgba(255,255,255,0.12);
        border-color: rgba(255,255,255,0.2);
    }

.pm-reaction-btn--mine {
    background: rgba(88,101,242,0.25);
    border-color: rgba(88,101,242,0.5);
    color: #fff;
}

.pm-reaction-count {
    font-size: 11px;
    color: #b9bbbe;
}

.pm-reaction-btn--mine .pm-reaction-count {
    color: #c9cdff;
}

/* pm-reaction-add-btn убран — кнопка реакции теперь в pm-msg-actions */

.pm-msg-action-emoji-wrap {
    position: relative;
}

.pm-emoji-picker {
    position: absolute;
    bottom: calc(100% + 6px);
    right: 0;
    background: #2f3136;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 8px;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    z-index: 200;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

.pm-emoji-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 20px;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.1s;
    line-height: 1;
}

    .pm-emoji-btn:hover {
        background: rgba(255,255,255,0.1);
    }

.pm-msg-edit-hint {
    font-size: 11px;
    color: #6d6f78;
}

/* ══ Pinned messages — header button ══ */
.pm-pin-header-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: #b5bac1;
    cursor: pointer;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    transition: color .15s, background .15s;
}

    .pm-pin-header-btn:hover,
    .pm-pin-header-btn--active {
        color: #fff;
        background: rgba(255,255,255,.08);
    }

.pm-pin-header-btn--empty {
    color: #4e5058;
    cursor: default;
}

    .pm-pin-header-btn--empty:hover {
        color: #4e5058;
        background: none;
    }

.pm-pin-header-count {
    background: #5865f2;
    color: #fff;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    padding: 0 5px;
    min-width: 16px;
    text-align: center;
}

/* ══ Pinned messages panel ══ */
.pm-pinned-panel {
    position: absolute;
    top: 56px;
    right: 0;
    z-index: 50;
    width: 340px;
    max-height: 420px;
    overflow-y: auto;
    background: #2b2d31;
    border: 1px solid #1e1f22;
    border-radius: 0 0 0 8px;
    box-shadow: -4px 4px 16px rgba(0,0,0,.5);
    display: flex;
    flex-direction: column;
}

.pm-pinned-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 700;
    color: #b5bac1;
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
}

.pm-pinned-panel-close {
    margin-left: auto;
    background: none;
    border: none;
    color: #72767d;
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    display: flex;
    align-items: center;
}

    .pm-pinned-panel-close:hover {
        color: #dbdee1;
    }

.pm-pinned-item {
    position: relative;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,.04);
}

    .pm-pinned-item:last-child {
        border-bottom: none;
    }

.pm-pinned-item-meta {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 3px;
}

.pm-pinned-item-author {
    font-size: 13px;
    font-weight: 600;
    color: #f2f3f5;
}

.pm-pinned-item-time {
    font-size: 11px;
    color: #72767d;
}

.pm-pinned-item-content {
    font-size: 13px;
    color: #b5bac1;
    white-space: pre-wrap;
    word-break: break-word;
    padding-right: 20px;
}

.pm-pinned-img {
    display: block;
    max-width: 100%;
    max-height: 160px;
    width: auto;
    height: auto;
    border-radius: 6px;
    margin-bottom: 6px;
    cursor: zoom-in;
    object-fit: cover;
}

.pm-pinned-text {
    white-space: pre-wrap;
    word-break: break-word;
}

.pm-pinned-item-content .pm-quote-block {
    margin: 0 0 6px 0;
}

.pm-pinned-item-content a {
    color: #00a8fc;
    word-break: break-all;
}

.pm-pinned-item-unpin {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: #72767d;
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    opacity: 0;
    transition: opacity .15s, color .15s;
}

.pm-pinned-item:hover .pm-pinned-item-unpin {
    opacity: 1;
}

.pm-pinned-item-unpin:hover {
    color: #ed4245;
}

/* Кнопка "В чат" в панели закреплённых */
.pm-pinned-jump-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    padding: 2px 8px;
    font-size: 11px;
    color: #5865f2;
    background: transparent;
    border: 1px solid #3c3f45;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}
.pm-pinned-item:hover .pm-pinned-jump-btn {
    opacity: 1;
}
.pm-pinned-jump-btn:hover {
    background: #5865f2;
    color: #fff;
    border-color: #5865f2;
}

/* Оверлей «Поиск сообщения...» */
.pm-jump-overlay {
    position: absolute;
    top: 56px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 120;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px;
    background: #2b2d31;
    border: 1px solid #3c3f45;
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0,0,0,.4);
    font-size: 13px;
    color: #b5bac1;
    pointer-events: none;
}
.pm-jump-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #4e5058;
    border-top-color: #5865f2;
    border-radius: 50%;
    animation: chat-spin 0.7s linear infinite;
    flex-shrink: 0;
}

/* Подсветка найденного сообщения */
@keyframes pm-msg-highlight-fade {
    0%   { background: rgba(88, 101, 242, 0.25); }
    70%  { background: rgba(88, 101, 242, 0.15); }
    100% { background: transparent; }
}
.pm-msg--highlight {
    animation: pm-msg-highlight-fade 2.5s ease forwards;
    border-radius: 6px;
}

/* ══ Pin badge on message ══ */
.pm-msg-footer {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.pm-msg-pin-badge {
    color: #faa61a;
    display: inline-flex;
    align-items: center;
    opacity: .7;
}

/* ══ Pin button in action toolbar ══ */
.pm-msg-action-btn--pinned {
    color: #faa61a !important;
}

    .pm-msg-action-btn--pinned:hover {
        color: #ffb83a !important;
    }

/* ══════════════════════════════════════════
   ИЗБРАННОЕ (FAVORITES / PERSONAL NOTES)
══════════════════════════════════════════ */

/* Золотой аватар для Избранного */
.pm-avatar-gold {
    background: linear-gradient(135deg, #f5a623, #c8913e) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

/* Кнопка Избранного в сайдбаре — чуть выделяется */
.pm-favorites-item {
    border-bottom: 1px solid rgba(255,255,255,.04);
    margin-bottom: 6px;
    padding-bottom: 14px;
}

/* Подзаголовок в шапке чата (для Избранного) */
.pm-chat-header-sub {
    font-size: 11px;
    color: #80848e;
    line-height: 1;
}

/* Заметка: строка */
.fav-note {
    position: relative;
}

    /* Чтобы кнопки действий на заметке были справа */
    .fav-note .pm-msg-actions {
        right: auto;
        left: -4px;
        top: 2px;
    }

/* ══ ChatPanel — недостающие классы ══ */

/* Typing indicator */
.pm-typing {
    padding: 2px 16px 4px;
    font-size: 12px;
    color: #949ba4;
    min-height: 20px;
    font-style: italic;
}

/* Inline edit box */
.pm-edit-box {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pm-edit-hint {
    font-size: 11px;
    color: #949ba4;
    padding: 0 2px;
}

/* Строка с кнопками «Сохранить/Отмена» — видима на телефонах, где нет клавиатурных шорткатов */
.pm-edit-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.pm-edit-btn {
    border: none;
    border-radius: 4px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.12s;
}

.pm-edit-btn--save {
    background: #5865f2;
    color: #fff;
}
.pm-edit-btn--save:hover { background: #4752c4; }

.pm-edit-btn--cancel {
    background: transparent;
    color: #b9bbbe;
}
.pm-edit-btn--cancel:hover { background: rgba(79, 84, 92, 0.3); color: #dcddde; }

.pm-edit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pm-edit-img-wrap {
    position: relative;
    display: inline-block;
    align-self: flex-start;
    border-radius: 6px;
    overflow: hidden;
    background: #1e1f22;
}

.pm-edit-img {
    display: block;
    max-width: 240px;
    max-height: 200px;
    object-fit: contain;
}

.pm-edit-img-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s;
}

.pm-edit-img-remove:hover {
    background: #ed4245;
}

.pm-edit-actions .pm-edit-hint { margin-left: auto; }
@media (max-width: 640px) {
    .pm-edit-actions .pm-edit-hint { display: none; }
}

/* Reactions row */
.pm-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

/* Message body / meta wrappers (unified ChatPanel) */
.pm-msg-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.pm-msg-meta {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

/* ── Add-channel button in sidebar ── */
.srv-add-ch-btn {
    background: none;
    border: none;
    color: #949ba4;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 4px;
    border-radius: 4px;
    transition: color .15s;
}

    .srv-add-ch-btn:hover {
        color: #dbdee1;
    }

/* ── Own author name color ── */
.pm-msg-author--mine {
    color: #3ba55d;
}

/* ── Server members right panel ── */
.srv-root {
    display: flex;
}

/* Бейдж «ГОСТЬ» в заголовке сервера — показывается, когда пользователь
   не участник, но открыл канал с включённым IsGuestReadable. */
.srv-guest-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    font-size: 9px;
    font-weight: 700;
    color: #b5bac1;
    background: #3a3c41;
    border-radius: 4px;
    letter-spacing: 0.5px;
    vertical-align: middle;
}

/* ── Ban banner: показывается вместо сайдбара/чата при заходе на сервер,
      где пользователь забанен ── */
.srv-banned-overlay {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1e1f22;
    padding: 24px;
}

.srv-banned-card {
    max-width: 360px;
    text-align: center;
    background: #2b2d31;
    border: 1px solid #3a3c41;
    border-radius: 8px;
    padding: 28px 24px;
    color: #dbdee1;
}

.srv-banned-title {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 6px;
}

.srv-banned-sub {
    font-size: 14px;
    color: #b5bac1;
}

.srv-members-panel {
    width: 220px;
    min-width: 220px;
    background: #2b2d31;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 8px 0 16px;
    flex-shrink: 0;
}

    .srv-members-panel::-webkit-scrollbar {
        width: 6px;
    }

    .srv-members-panel::-webkit-scrollbar-track {
        background: transparent;
    }

    .srv-members-panel::-webkit-scrollbar-thumb {
        background: #1a1b1e;
        border-radius: 3px;
    }

.srv-members-header {
    padding: 16px 12px 6px;
    font-size: 11px;
    font-weight: 700;
    color: #949ba4;
    letter-spacing: .4px;
    text-transform: uppercase;
}

.srv-member-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 4px;
    margin: 0 4px;
    cursor: default;
    transition: background .12s;
}

    .srv-member-item:hover {
        background: rgba(255,255,255,.06);
    }

.srv-member-name {
    font-size: 13px;
    color: #dbdee1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.srv-member-owner {
    color: #f0b132;
}

@media (max-width: 700px) {
    .srv-members-panel {
        display: none;
    }
}

/* ══════════════════════════════════════════
   SERVER PAGE — мобильная адаптация (≤ 767px)
══════════════════════════════════════════ */
@media (max-width: 767px) {

    /* Сайдбар каналов на мобильном — на весь экран, уезжает влево при выборе канала.
       Базовые правила .pm-sidebar / .pm-sidebar--hidden уже есть выше; здесь только
       специфика server-page. */

    /* Заголовок сервера: больше тач-цели у иконок-кнопок. */
    .srv-header { padding: 12px !important; }
    .srv-hdr-btn {
        width: 36px;
        height: 36px;
        padding: 0;
    }

    /* Каналы в сайдбаре — больше отступ для удобного тапа. */
    .srv-ch-item { padding: 10px 12px; }

    /* Кнопка «+» для создания канала — крупнее. */
    .srv-add-ch-btn {
        font-size: 18px;
        padding: 2px 8px;
    }

    /* Кнопка тоггла участников и крестик «выйти из канала» —
       сдвигаем вниз, чтобы не наезжали на back-кнопку шапки. */
    .srv-members-toggle-btn {
        top: 10px;
        right: 8px;
        width: 36px;
        height: 36px;
    }

    /* Голосовые тайлы — меньше padding, чтобы помещались на узком экране. */
    .srv-voice-tile {
        padding: 12px;
        min-width: 88px;
    }
    .srv-voice-tile-av {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }
    .srv-voice-active { padding: 16px; gap: 16px; }
    .srv-voice-active-grid { gap: 10px; }

    /* Voice-кнопки управления — крупнее тач-цели. */
    .srv-vc-btn {
        padding: 12px 18px;
        font-size: 14px;
    }

    /* Voice lobby — компактнее. */
    .srv-voice-lobby { padding: 16px; gap: 12px; }
    .srv-voice-lobby-icon { font-size: 56px; }
    .srv-voice-lobby-name { font-size: 18px; }

    /* Бейдж «ГОСТЬ» — меньше шрифт на узком. */
    .srv-guest-tag { font-size: 8px; padding: 1px 5px; }

    /* Ban-карта — меньше padding, чтобы помещалась. */
    .srv-banned-card { padding: 22px 18px; }
}

/* ══ Server.razor — voice channel & members toggle ══ */

.srv-chat-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Кнопка тоггла участников — абсолютно в верхнем правом углу чата */
.srv-members-toggle-btn {
    position: absolute;
    top: 14px;
    right: 12px;
    background: none;
    border: none;
    color: #949ba4;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .15s, background .15s;
    z-index: 10;
}

    .srv-members-toggle-btn:hover {
        color: #dbdee1;
        background: rgba(255,255,255,.08);
    }

.srv-members-toggle-btn--active {
    color: #fff;
    background: rgba(88,101,242,.3);
}

/* ── Voice lobby ── */
.srv-voice-lobby {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px;
    color: #dbdee1;
}

.srv-voice-lobby-icon {
    font-size: 64px;
}

.srv-voice-lobby-name {
    font-size: 22px;
    font-weight: 700;
}

.srv-voice-lobby-hint {
    font-size: 13px;
    color: #949ba4;
    margin-top: 8px;
}

.srv-voice-lobby-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.srv-voice-lobby-user {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.srv-voice-lobby-av {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #5865f2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: #fff;
}

.srv-voice-join-btn {
    margin-top: 16px;
    padding: 10px 28px;
    background: #3ba55d;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}

    .srv-voice-join-btn:hover {
        background: #2d8049;
    }

.srv-voice-join-row {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.srv-voice-join-row .srv-voice-join-btn { margin-top: 0; }

.srv-voice-meeting-btn {
    padding: 10px 22px;
    background: #5865f2;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}

.srv-voice-meeting-btn:hover {
    background: #4752c4;
}

/* ── Create meeting dialog ── */
.meeting-dialog {
    background: #2b2d31;
    border-radius: 8px;
    width: min(90vw, 460px);
    max-height: 80vh;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    color: #dbdee1;
    display: flex;
    flex-direction: column;
}

.meeting-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #3c3f44;
    font-size: 16px;
    font-weight: 600;
    color: #f2f3f5;
}

.meeting-dialog-body {
    padding: 14px 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.meeting-dialog-section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #b9bbbe;
    letter-spacing: .5px;
}

.meeting-dialog-search {
    background: #1e1f22;
    border: 1px solid #3c3f44;
    border-radius: 6px;
    color: #dbdee1;
    font-size: 14px;
    padding: 8px 12px;
    outline: none;
    width: 100%;
    box-sizing: border-box;
}
.meeting-dialog-search:focus { border-color: #5865f2; }

.meeting-dialog-friend-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 320px;
    overflow-y: auto;
}

.meeting-dialog-friend {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .12s;
}
.meeting-dialog-friend:hover { background: rgba(79, 84, 92, .25); }
.meeting-dialog-friend--picked { background: rgba(88, 101, 242, .18); }

.meeting-dialog-friend input[type=checkbox] { accent-color: #5865f2; }
.meeting-dialog-friend-name { font-size: 14px; color: #dbdee1; }

.meeting-dialog-loading,
.meeting-dialog-empty {
    color: #949ba4;
    font-size: 13px;
    padding: 8px 0;
}

.meeting-dialog-hint {
    font-size: 13px;
    color: #b9bbbe;
}

.meeting-dialog-link {
    display: flex;
    gap: 6px;
}
.meeting-dialog-link input {
    flex: 1;
    background: #1e1f22;
    border: 1px solid #3c3f44;
    border-radius: 6px;
    color: #dbdee1;
    padding: 8px 10px;
    font-size: 13px;
    outline: none;
}

.meeting-dialog-actions {
    padding: 12px 16px;
    border-top: 1px solid #3c3f44;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ══ Meeting room ══ */
.meeting-room {
    min-height: 100vh;
    background: #1e1f22;
    color: #dbdee1;
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 16px;
}

.meeting-room-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #2b2d31;
    border-radius: 8px;
}

.meeting-reconnect-banner {
    background: #faa61a;
    color: #2b2d31;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.meeting-room-title { font-size: 17px; font-weight: 600; color: #fff; }
.meeting-room-id { font-size: 12px; color: #949ba4; font-family: monospace; }

.meeting-room-count {
    margin-left: auto;
    font-size: 12px;
    color: #949ba4;
}

.meeting-room-invite-btn {
    padding: 7px 16px;
    border-radius: 6px;
    border: none;
    background: #5865f2;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .12s;
}
.meeting-room-invite-btn:hover { background: #4752c4; }
.meeting-room-invite-btn--secondary { background: #4f545c; }
.meeting-room-invite-btn--secondary:hover { background: #5d6269; }

.meeting-dialog-friend-tag {
    margin-left: auto;
    font-size: 11px;
    color: #3ba55d;
    font-weight: 600;
}
.meeting-dialog-friend:disabled { opacity: .65; cursor: default; }

.meeting-room-status {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #949ba4;
    font-size: 14px;
    text-align: center;
}

.meeting-room-status-detail {
    font-size: 12px;
    color: #ed4245;
    margin-top: 8px;
    max-width: 480px;
}

.meeting-room-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    align-content: start;
}

.meeting-tile {
    background: #2b2d31;
    border-radius: 10px;
    padding: 18px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border: 2px solid transparent;
    transition: border-color .15s;
    position: relative;
}
.meeting-tile--me   { border-color: #5865f2; }
.meeting-tile--host { border-color: #faa61a; }
.meeting-tile--guest{ border-color: #949ba4; }

.meeting-tile-av {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #5865f2;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 600;
}

.meeting-tile-name {
    font-size: 14px;
    text-align: center;
    color: #dbdee1;
}

.meeting-tile-tag {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    background: #5865f2;
    color: #fff;
    text-transform: uppercase;
}
.meeting-tile-tag--guest { background: #4f545c; }

.meeting-tile-muted {
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 16px;
}

.meeting-tile-screen {
    position: absolute;
    top: 6px;
    left: 8px;
    font-size: 16px;
}

.meeting-tile-video,
.meeting-tile .mt-camera-video {
    width: 100%;
    max-width: 220px;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: #000;
    border-radius: 8px;
    display: block;
    cursor: zoom-in;
}
.meeting-tile-video:fullscreen,
.meeting-tile .mt-camera-video:fullscreen {
    width: 100vw;
    height: 100vh;
    max-width: none;
    object-fit: contain;
    cursor: zoom-out;
}
.mt-screen-video:fullscreen { cursor: zoom-out; }
.meeting-tile-video--hidden { display: none; }

/* Когда у пира есть видео — JS вставляет <video class="mt-camera-video"> внутрь tile,
   а аватар не рендерится (см. _peersWithCamera). */
.meeting-tile .mt-camera-video { margin-bottom: 6px; }

/* ── Screen-share area ── */
.mt-screen-share-wrap {
    position: relative;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
}
.mt-screen-share-wrap--hidden { display: none; }

.mt-screen-share-area {
    min-height: 200px;
    max-height: 65vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.mt-screen-share-toolbar {
    position: absolute;
    top: 8px;
    left: 12px;
    right: 12px;
    background: rgba(0,0,0,.55);
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.mt-fullscreen-btn {
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}
.mt-fullscreen-btn:hover { background: rgba(255,255,255,.28); }

.mt-screen-share-area .mt-screen-video {
    max-width: 100%;
    max-height: 65vh;
    object-fit: contain;
    background: #000;
}

.meeting-room-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 8px 0;
}

.meeting-ctl-btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    background: #4f545c;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .12s;
}
.meeting-ctl-btn:hover { background: #5d6269; }
.meeting-ctl-btn--off { background: #faa61a; color: #2b2d31; }
.meeting-ctl-btn--leave { background: #ed4245; }
.meeting-ctl-btn--leave:hover { background: #c53639; }

.meeting-room-listen-only {
    padding: 10px 16px;
    border-radius: 8px;
    background: #faa61a;
    color: #2b2d31;
    font-size: 13px;
    font-weight: 600;
}

.meeting-toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    background: #2b2d31;
    color: #dbdee1;
    padding: 10px 14px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.5);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 3000;
}
.meeting-toast button {
    background: transparent;
    border: none;
    color: #949ba4;
    cursor: pointer;
    font-size: 18px;
}

/* ── Guest join landing ── */
.meeting-join {
    min-height: 100vh;
    background: #1e1f22;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.meeting-join-card {
    background: #2b2d31;
    color: #dbdee1;
    padding: 28px 28px 24px;
    border-radius: 12px;
    width: min(92vw, 380px);
    box-shadow: 0 8px 32px rgba(0,0,0,.55);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    text-align: center;
}

.meeting-join-logo {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: rgba(88,101,242,.12);
    display: flex;
    align-items: center;
    justify-content: center;
}

.meeting-join-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.meeting-join-hint {
    font-size: 14px;
    color: #b9bbbe;
    line-height: 1.45;
}

.meeting-join-status {
    font-size: 14px;
    color: #949ba4;
    padding: 8px 0;
}

.meeting-join-input {
    width: 100%;
    box-sizing: border-box;
    background: #1e1f22;
    border: 1px solid #3c3f44;
    border-radius: 6px;
    color: #dbdee1;
    padding: 10px 14px;
    font-size: 15px;
    outline: none;
}
.meeting-join-input:focus { border-color: #5865f2; }

.meeting-join-error {
    color: #ed4245;
    font-size: 13px;
    align-self: flex-start;
}

.meeting-join-btn {
    width: 100%;
    padding: 11px;
    border-radius: 6px;
    border: none;
    background: #5865f2;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: background .12s;
}
.meeting-join-btn:hover:not(:disabled) { background: #4752c4; }
.meeting-join-btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── Toast: meeting invite ── */
.meeting-invite-toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    background: #2b2d31;
    color: #dbdee1;
    padding: 14px 16px;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,.55);
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 280px;
    max-width: 360px;
    z-index: 3000;
    border: 1px solid #5865f2;
    animation: meeting-invite-fade-in .25s ease;
}

@keyframes meeting-invite-fade-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.meeting-invite-toast-text {
    font-size: 14px;
    color: #dbdee1;
}

.meeting-invite-toast-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ── Voice active ── */
.srv-voice-active {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 24px;
}

.srv-voice-active-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
}

.srv-voice-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background: rgba(255,255,255,.05);
    border-radius: 12px;
    min-width: 100px;
}

.srv-voice-tile--me {
    border: 2px solid #3ba55d;
}

.srv-voice-tile-av {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #5865f2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.srv-voice-tile-name {
    font-size: 13px;
    color: #dbdee1;
}

/* Voice controls */
.srv-voice-controls {
    display: flex;
    gap: 12px;
}

.srv-vc-btn {
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    background: #4e5058;
    color: #fff;
    transition: background .15s;
}

    .srv-vc-btn:hover {
        background: #5d6069;
    }

.srv-vc-btn--active {
    background: #f04747;
}

    .srv-vc-btn--active:hover {
        background: #c03034;
    }

.srv-vc-btn--danger {
    background: #da373c;
}

    .srv-vc-btn--danger:hover {
        background: #c03034;
    }

/* ══ Screen share area ══ */
.srv-screen-share-area {
    width: 100%;
    background: #111;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 160px;
    max-height: 55vh;
    flex-shrink: 0;
}

.srv-screen-share-area--hidden {
    display: none;
}

/* видео вставляется через JS — растягиваем его */
.srv-screen-share-area video {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    object-fit: contain;
    border-radius: 0;
}

.srv-screen-share-self-label {
    padding: 12px 16px;
    color: #b5bac1;
    font-size: 13px;
    font-style: italic;
    text-align: center;
}

.srv-screen-share-toolbar {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
    z-index: 10;
}

.srv-screen-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    background: rgba(0,0,0,.65);
    color: #fff;
    backdrop-filter: blur(4px);
    transition: background .15s;
}

    .srv-screen-btn:hover {
        background: rgba(0,0,0,.85);
    }

.srv-screen-btn--stop {
    color: #f04747;
}

    .srv-screen-btn--stop:hover {
        background: rgba(240,71,71,.2);
    }

/* Кнопка демонстрации экрана (активная) */
.srv-vc-btn--screen {
    background: #5865f2;
}

    .srv-vc-btn--screen:hover {
        background: #4752c4;
    }

/* ── Members panel voice sections ── */
.srv-members-voice-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.srv-members-voice-count {
    background: rgba(88,101,242,.25);
    color: #5865f2;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    min-width: 18px;
    text-align: center;
}

.pm-avatar-green {
    background: #3ba55d;
}

/* ══ @Mention inline ══ */
.pm-mention {
    color: #7289da;
    background: rgba(114,137,218,.15);
    border-radius: 3px;
    padding: 0 2px;
    cursor: default;
}

.pm-mention--me {
    color: #faa61a;
    background: rgba(250,166,26,.15);
}

/* ══ @Mention dropdown ══ */
.pm-mention-dropdown {
    background: #2b2d31;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 8px;
    padding: 4px 0;
    margin-bottom: 4px;
    max-height: 220px;
    overflow-y: auto;
    box-shadow: 0 4px 16px rgba(0,0,0,.4);
}

.pm-mention-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 14px;
    color: #dcddde;
    transition: background .1s;
}

    .pm-mention-item:hover,
    .pm-mention-item--active {
        background: #404249;
    }

.pm-mention-av {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #5865f2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.pm-mention-name { font-weight: 500; }


/* ══════════════════════════════════════════
   CALL WIDGET (FloatingCallBar + Overlay)
══════════════════════════════════════════ */

/* ── Incoming / Outgoing overlay ── */
.cw-overlay {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(0,0,0,0.75);
    display: flex; align-items: center; justify-content: center;
    animation: cw-fade-in 0.2s ease;
}
@keyframes cw-fade-in { from { opacity: 0 } to { opacity: 1 } }

.cw-ov-card {
    background: #2b2d31;
    border-radius: 16px;
    padding: 36px 40px 28px;
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    min-width: 260px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.cw-ov-avatar {
    width: 72px; height: 72px; border-radius: 50%;
    background: linear-gradient(135deg,#5865f2,#7c4dff);
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; font-weight: 700; color: #fff;
    box-shadow: 0 0 0 4px rgba(88,101,242,.25);
}
.cw-ov-name  { font-size: 20px; font-weight: 700; color: #fff; }
.cw-ov-hint  { font-size: 13px; color: #96989d; }
.cw-ov-actions { display: flex; gap: 20px; margin-top: 8px; }

.cw-ov-btn {
    width: 56px; height: 56px; border-radius: 50%; border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: transform 0.15s, filter 0.15s;
}
.cw-ov-btn:hover { transform: scale(1.1); filter: brightness(1.15); }
.cw-ov-decline { background: #ed4245; color: #fff; }
.cw-ov-accept  { background: #3ba55c; color: #fff; }

/* ── Floating active call bar ── */
.cw-bar {
    position: fixed;
    bottom: 24px; right: 24px;
    z-index: 1900;
    background: #2b2d31;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 10px 12px 10px 10px;
    display: flex; align-items: center; gap: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.45);
    user-select: none;
    min-width: 220px;
    animation: cw-slide-in 0.25s cubic-bezier(.22,.68,0,1.2);
}
@keyframes cw-slide-in {
    from { opacity: 0; transform: translateY(20px) scale(0.95) }
    to   { opacity: 1; transform: translateY(0)   scale(1) }
}

/* Хэндл для перетаскивания */
.cw-drag-handle {
    width: 20px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    cursor: grab; flex-shrink: 0; border-radius: 4px;
    color: #72767d;
    transition: background 0.15s;
}
.cw-drag-handle:hover  { background: rgba(255,255,255,0.07); }
.cw-drag-handle:active { cursor: grabbing; }

/* Аватар + имя + таймер */
.cw-bar-info { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.cw-bar-avatar {
    width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg,#5865f2,#7c4dff);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: #fff;
}
.cw-bar-texts { display: flex; flex-direction: column; min-width: 0; }
.cw-bar-name  { font-size: 13px; font-weight: 600; color: #e3e5e8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-bar-time  { font-size: 11px; color: #57f287; font-variant-numeric: tabular-nums; }

/* Кнопки управления */
.cw-bar-btns { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.cw-btn {
    width: 30px; height: 30px; border-radius: 6px; border: none;
    background: rgba(255,255,255,0.06);
    color: #b5bac1; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.cw-btn:hover       { background: rgba(255,255,255,0.12); color: #e3e5e8; }
.cw-btn--active     { background: rgba(88,101,242,.25); color: #7289da; }
.cw-btn--active:hover { background: rgba(88,101,242,.4); }
.cw-btn--end        { background: rgba(237,66,69,.15); color: #ed4245; }
.cw-btn--end:hover  { background: #ed4245; color: #fff; }

/* Запись о звонке в ленте сообщений */
.pm-msg-call {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(88,101,242,.10);
    color: #b5bac1;
    font-size: 13px;
}
.pm-msg-call--missed {
    background: rgba(237,66,69,.10);
    color: #ed4245;
}
.pm-msg-call-icon { display: inline-flex; }
.pm-msg-call-title { font-weight: 600; }
.pm-msg-call-dur {
    color: #96989d;
    font-variant-numeric: tabular-nums;
    margin-left: 4px;
}
.pm-msg-call--missed .pm-msg-call-dur { color: rgba(237,66,69,.7); }

/* Превью удалённой демонстрации экрана в плавающей плашке */
.cw-screen-preview {
    width: 100%;
    max-width: 360px;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 8px;
    margin-top: 8px;
    overflow: hidden;
    cursor: pointer;
}
.cw-screen-preview video {
    width: 100%; height: 100%;
    object-fit: contain;
    display: block;
}
.cw-bar--with-screen {
    flex-direction: column;
    align-items: stretch;
    min-width: 260px;
}
.cw-bar--with-screen .cw-bar-row {
    display: flex; align-items: center; gap: 10px;
}

/* Мобильная адаптация: занимаем всю ширину у нижнего края, чтобы панель
   всегда была видна независимо от сохранённой позиции */
@media (max-width: 600px) {
    .cw-bar {
        left: 8px !important;
        right: 8px !important;
        bottom: 8px !important;
        top: auto !important;
        min-width: 0;
        width: auto;
        padding: 8px;
    }
    .cw-bar .cw-drag-handle { display: none; }
    .cw-bar-name { font-size: 12px; }
    .cw-btn { width: 34px; height: 34px; }  /* удобнее для пальца */
    .cw-screen-preview { max-width: none; }
}

/* ── Кликабельный ник (открывает профиль) ─────────────────── */
.pm-msg-author--click {
    cursor: pointer;
}
.pm-msg-author--click:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ── User profile modal ───────────────────────────────────── */
.user-profile-card {
    position: relative;
    background: #2f3136;
    border-radius: 8px;
    padding: 36px 24px 24px;
    min-width: 320px;
    max-width: 380px;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    animation: pmModalIn 0.18s ease;
}

.user-profile-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    color: #b9bbbe;
    font-size: 16px;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.user-profile-close:hover { background: rgba(79, 84, 92, 0.32); color: #fff; }

.user-profile-loading {
    padding: 32px 0;
    color: #b9bbbe;
    font-size: 14px;
}

.user-profile-avatar-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

.user-profile-avatar {
    width: 92px;
    height: 92px;
    font-size: 32px;
}
.user-profile-avatar .pm-msg-av-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-profile-name {
    color: #f2f3f5;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.user-profile-about {
    color: #dcddde;
    font-size: 14px;
    margin: 12px 0;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    white-space: pre-wrap;
    text-align: left;
}

.user-profile-meta {
    color: #949ba4;
    font-size: 12px;
    margin-top: 12px;
}

/* ══ Chat search ══ */

/* Header search/icon button */
.pm-hdr-icon-btn {
    background: none;
    border: none;
    color: #949ba4;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .15s, background .15s;
    flex-shrink: 0;
}
.pm-hdr-icon-btn:hover {
    color: #dbdee1;
    background: rgba(255,255,255,.08);
}
.pm-hdr-icon-btn--active {
    color: #fff;
    background: rgba(88,101,242,.25);
}

/* Search panel (same style as pinned panel) */
.pm-search-panel {
    background: #2b2d31;
    border-bottom: 1px solid #1e1f22;
    max-height: 380px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pm-search-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid #1e1f22;
}

.pm-search-input {
    flex: 1;
    background: #1e1f22;
    border: 1px solid #3c3f44;
    border-radius: 4px;
    color: #dbdee1;
    font-size: 14px;
    padding: 5px 10px;
    outline: none;
    min-width: 0;
}
.pm-search-input:focus { border-color: #5865f2; }

.pm-search-clear-btn {
    background: none;
    border: none;
    color: #949ba4;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.pm-search-clear-btn:hover { color: #dbdee1; }

.pm-search-count {
    padding: 6px 14px 2px;
    font-size: 11px;
    color: #5865f2;
    font-weight: 600;
}

.pm-search-empty {
    padding: 16px 14px;
    font-size: 13px;
    color: #5d6673;
    text-align: center;
}

.pm-search-results {
    overflow-y: auto;
    flex: 1;
}
.pm-search-results::-webkit-scrollbar { width: 4px; }
.pm-search-results::-webkit-scrollbar-thumb { background: #1a1b1e; border-radius: 2px; }

.pm-search-result-item {
    padding: 8px 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,.04);
    transition: background .1s;
}
.pm-search-result-item:hover { background: rgba(255,255,255,.06); }

.pm-search-result-meta {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 2px;
}
.pm-search-result-author {
    font-size: 13px;
    font-weight: 600;
    color: #c0c4cc;
}
.pm-search-result-time {
    font-size: 11px;
    color: #5d6673;
}
.pm-search-result-text {
    font-size: 13px;
    color: #949ba4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pm-search-mark {
    background: rgba(250, 166, 26, .35);
    color: #faa61a;
    border-radius: 2px;
    padding: 0 1px;
}

/* ══ Server management UI ══ */

/* Header buttons (invite / delete server) */
.srv-hdr-btn {
    background: none;
    border: none;
    color: #949ba4;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .15s, background .15s;
    flex-shrink: 0;
}
.srv-hdr-btn:hover {
    color: #dbdee1;
    background: rgba(255,255,255,.08);
}
.srv-hdr-btn--danger:hover {
    color: #f04747;
    background: rgba(240,71,71,.12);
}

/* Channel list items */
.srv-ch-item {
    position: relative;
    padding-right: 8px !important;
}

/* Gear settings button on channel item.
   На десктопе (есть hover) — скрыта до наведения на канал.
   На тач-устройствах (hover нет) — всегда видна, иначе её нельзя нажать. */
.srv-ch-gear {
    background: none;
    border: none;
    color: #949ba4;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    opacity: 0;
    transition: opacity .15s, color .15s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
.srv-ch-gear--hovered,
.srv-ch-item:hover .srv-ch-gear {
    opacity: 1;
}
@media (hover: none) {
    .srv-ch-gear { opacity: 1; }
}
.srv-ch-gear:hover {
    color: #dbdee1;
}

/* Channel badge (lock / readonly) */
.srv-ch-badge {
    font-size: 11px;
    margin-left: 2px;
    opacity: .7;
    flex-shrink: 0;
}

/* Members panel: banned state */
.srv-member-banned {
    opacity: .55;
}

/* Role badge next to name */
.srv-role-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 0 4px;
    margin-left: 4px;
    border-radius: 3px;
    vertical-align: middle;
    background: rgba(255,255,255,.08);
}
.srv-role-badge--owner { color: #f0b132; }

/* Member action buttons */
.srv-member-actions {
    display: flex;
    gap: 2px;
    margin-left: auto;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity .12s;
}
.srv-member-item:hover .srv-member-actions {
    opacity: 1;
}
.srv-member-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    padding: 2px 4px;
    border-radius: 3px;
    color: #949ba4;
    line-height: 1;
    transition: background .12s, color .12s;
}
.srv-member-action-btn:hover {
    background: rgba(255,255,255,.08);
    color: #dbdee1;
}
.srv-member-action-btn--danger:hover {
    background: rgba(240,71,71,.15);
    color: #f04747;
}
.srv-member-action-btn--success:hover {
    background: rgba(59,165,93,.15);
    color: #3ba55d;
}
.srv-member-action-btn--mod:hover {
    background: rgba(88,101,242,.15);
    color: #5865f2;
}

/* Маленький цветной кружок-индикатор роли рядом с именем */
.srv-role-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-left: 5px;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Voice header in members panel */
.srv-members-voice-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.srv-members-voice-count {
    font-size: 11px;
    background: rgba(255,255,255,.1);
    border-radius: 8px;
    padding: 0 6px;
}

/* ── Link Preview ── */
.link-preview {
    display: flex;
    flex-direction: column;
    margin-top: 6px;
    border-left: 3px solid #5865f2;
    border-radius: 4px;
    background: rgba(255,255,255,.05);
    overflow: hidden;
    max-width: 440px;
    text-decoration: none;
    color: inherit;
    transition: background .15s;
}
.link-preview:hover { background: rgba(255,255,255,.09); }
.link-preview__img {
    width: 100%;
    max-height: 220px;
    object-fit: cover;
}
.link-preview__body {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.link-preview__site {
    font-size: 11px;
    color: #5865f2;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.link-preview__title {
    font-size: 14px;
    font-weight: 600;
    color: #e3e5e8;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.link-preview__desc {
    font-size: 12px;
    color: #a3a6aa;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ─── Context Menu ─────────────────────────────────────────── */
.ctx-backdrop {
    position: fixed; inset: 0; z-index: 999;
}
.ctx-menu {
    position: fixed; z-index: 1000;
    min-width: 180px;
    background: #18191c;
    border: 1px solid #2e3035;
    border-radius: 6px;
    padding: 4px 0;
    box-shadow: 0 8px 32px rgba(0,0,0,.6);
    user-select: none;
}
.ctx-section-label {
    font-size: 10px;
    font-weight: 700;
    color: #72767d;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 6px 12px 2px;
}
.ctx-divider {
    height: 1px;
    background: #2e3035;
    margin: 4px 0;
}
.ctx-item {
    display: block; width: 100%;
    padding: 8px 14px;
    background: none; border: none;
    color: #dcddde;
    font-size: 14px; text-align: left;
    cursor: pointer;
    border-radius: 3px;
    transition: background .12s, color .12s;
}
.ctx-item:hover { background: #5865f2; color: #fff; }
.ctx-item--secret { color: #b9bbbe; }
.ctx-item--secret:hover { background: #45475a; color: #fff; }
.ctx-item--danger { color: #f04747; }
.ctx-item--danger:hover { background: #f04747; color: #fff; }

/* ─── Secret Chat Panel ─────────────────────────────────────── */
.secret-chat-panel {
    flex: 1; display: flex; flex-direction: column;
    height: 100%; overflow: hidden;
    background: #36393f;
}
.secret-chat-header {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 16px;
    background: #2f3136;
    border-bottom: 1px solid #202225;
    font-size: 14px;
    color: #dcddde;
}
.secret-chat-lock { font-size: 18px; }
.secret-chat-hint {
    font-size: 11px; color: #72767d;
}

/* ─── Secret chat header menu ─────────────────────────────── */
.sc-header-menu-wrap {
    margin-left: auto;
    position: relative;
    flex-shrink: 0;
}
.sc-header-menu-btn {
    background: none;
    border: none;
    color: #72767d;
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
    transition: color .15s, background .15s;
}
.sc-header-menu-btn:hover { color: #dcddde; background: rgba(255,255,255,.06); }
.sc-header-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 499;
}
.sc-header-dropdown {
    position: absolute;
    right: 0; top: calc(100% + 6px);
    z-index: 500;
    background: #18191c;
    border: 1px solid #040405;
    border-radius: 6px;
    padding: 4px 0;
    min-width: 200px;
    box-shadow: 0 8px 24px rgba(0,0,0,.6);
}
.sc-header-dd-item {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: #dcddde;
    font-size: 13px;
    text-align: left;
    padding: 8px 14px;
    cursor: pointer;
    transition: background .1s, color .1s;
}
.sc-header-dd-item:hover { background: #5865f2; color: #fff; }
.sc-header-dd-item--danger { color: #ed4245; }
.sc-header-dd-item--danger:hover { background: #ed4245; color: #fff; }
.sc-header-dd-sep { height: 1px; background: #3f4147; margin: 4px 0; }
.secret-chat-init {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 16px; color: #72767d; font-size: 14px;
}
.secret-chat-messages {
    flex: 1; overflow-y: auto;
    padding: 16px;
    display: flex; flex-direction: column; gap: 8px;
}
.sc-msg {
    max-width: 70%;
    display: flex; flex-direction: column;
    gap: 2px;
}
.sc-msg--mine  { align-self: flex-end;  align-items: flex-end; }
.sc-msg--theirs { align-self: flex-start; align-items: flex-start; }
.sc-msg-text {
    background: #40444b;
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 14px; color: #dcddde;
    word-break: break-word;
}
.sc-msg--mine .sc-msg-text { background: #5865f2; }
.sc-msg-time { font-size: 10px; color: #72767d; padding: 0 4px; }
.secret-chat-input {
    display: flex; align-items: flex-end; gap: 8px;
    padding: 12px 16px;
    background: #2f3136;
    border-top: 1px solid #202225;
}
.secret-chat-input textarea {
    flex: 1; resize: none;
    background: #40444b; border: none; border-radius: 8px;
    padding: 10px 12px;
    color: #dcddde; font-size: 14px;
    outline: none; max-height: 120px; overflow-y: auto;
}
.btn-send {
    background: #5865f2; border: none; border-radius: 50%;
    width: 36px; height: 36px;
    color: #fff; font-size: 16px;
    cursor: pointer; transition: background .15s;
    display: flex; align-items: center; justify-content: center;
}
.btn-send:hover:not(:disabled) { background: #4752c4; }
.btn-send:disabled { opacity: .4; cursor: default; }

/* ─── Read-only channel banner ──────────────────────────────── */
.pm-readonly-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #2f3136;
    border-top: 1px solid #202225;
    color: #72767d;
    font-size: 13px;
    user-select: none;
}

/* ─── @mention badges ───────────────────────────────────────── */
.pm-mention {
    display: inline-block;
    background: rgba(88,101,242,.25);
    color: #c9cdfb;
    border-radius: 4px;
    padding: 0 4px;
    font-weight: 500;
    cursor: default;
}
.pm-mention--me {
    background: rgba(250,166,26,.25);
    color: #faa61a;
}
.pm-mention--all {
    background: rgba(237,66,69,.25);
    color: #f87171;
    font-weight: 700;
}

/* ─── Channel icon badges (lock / readonly) ─────────────────── */
.srv-ch-icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 3px;
    color: #72767d;
    flex-shrink: 0;
    opacity: .85;
}

/* ─── Friend blocked badge ───────────────────────────────────── */
.pm-blocked-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: 5px;
    font-size: 10px;
    font-weight: 600;
    color: #ed4245;
    background: rgba(237,66,69,.15);
    border-radius: 3px;
    padding: 1px 4px;
    vertical-align: middle;
}

/* ─── Global checkbox style ──────────────────────────────────── */
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px; height: 16px;
    min-width: 16px;
    border: 2px solid #4f545c;
    border-radius: 3px;
    background: #2b2d31;
    cursor: pointer;
    position: relative;
    transition: background .12s, border-color .12s;
    vertical-align: middle;
    flex-shrink: 0;
}
input[type="checkbox"]:checked {
    background: #5865f2;
    border-color: #5865f2;
}
input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 3px; top: 0px;
    width: 5px; height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}
input[type="checkbox"]:hover:not(:checked) {
    border-color: #8e9297;
}
input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(88,101,242,.4);
}

/* ── Character counter ───────────────────────────────────────── */
.pm-char-counter {
    align-self: center;
    font-size: 11px;
    color: #72767d;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color .15s;
}
.pm-char-counter--warn { color: #faa61a; }
.pm-char-counter--over { color: #ed4245; font-weight: 600; }

/* ── Limit banner (Free / Ads) ───────────────────────────────── */
.pm-limit-banner {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    margin: 0 8px 4px;
    border-radius: 6px;
    background: rgba(237, 66, 69, .15);
    border: 1px solid rgba(237, 66, 69, .35);
    color: #ed4245;
    font-size: 13px;
    font-weight: 500;
    animation: pm-banner-in .15s ease;
}
@keyframes pm-banner-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Mic button ─────────────────────────────────────────────────────────── */
.pm-mic-btn {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #b9bbbe;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color .15s, background .15s;
}
.pm-mic-btn:hover { color: #dcddde; background: rgba(255,255,255,.06); }
.pm-mic-btn:disabled { opacity: .4; cursor: default; }

/* ── Voice recording bar ─────────────────────────────────────────────────── */
.voice-rec-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin: 0 8px 4px;
    border-radius: 8px;
    background: rgba(88, 101, 242, .12);
    border: 1px solid rgba(88, 101, 242, .3);
    animation: pm-banner-in .15s ease;
}
.voice-rec-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ed4245;
    flex-shrink: 0;
    animation: voice-dot-pulse 1s ease-in-out infinite;
}
@keyframes voice-dot-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: .5; transform: scale(.75); }
}
.voice-eq-canvas {
    flex: 1;
    max-width: 140px;
    height: 28px;
    border-radius: 4px;
}
.voice-rec-timer {
    font-size: 13px;
    font-weight: 600;
    color: #5865f2;
    min-width: 36px;
    text-align: right;
}
.voice-rec-send-btn,
.voice-rec-cancel-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}
.voice-rec-send-btn   { background: #5865f2; color: #fff; }
.voice-rec-send-btn:hover { background: #4752c4; }
.voice-rec-cancel-btn { background: rgba(237,66,69,.15); color: #ed4245; }
.voice-rec-cancel-btn:hover { background: rgba(237,66,69,.25); }

/* ── Voice preview bar ────────────────────────────────────────────────────── */
.voice-preview-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin: 0 8px 4px;
    border-radius: 8px;
    background: rgba(88, 101, 242, .10);
    border: 1px solid rgba(88, 101, 242, .25);
    animation: pm-banner-in .15s ease;
}
.voice-preview-play {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #5865f2;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s;
}
.voice-preview-play:hover { background: #4752c4; }
.voice-preview-label {
    flex: 1;
    font-size: 13px;
    color: #dcddde;
}
.voice-preview-send {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #57f287;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s;
}
.voice-preview-send:hover { background: #3ba55d; }
.voice-preview-cancel {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(237,66,69,.15);
    color: #ed4245;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s;
}
.voice-preview-cancel:hover { background: rgba(237,66,69,.28); }

/* ── Received voice message player ──────────────────────────────────────── */
.voice-player {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255,255,255,.08);
    min-width: 220px;
    max-width: 320px;
    margin: 2px 0;
}
.voice-play-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #5865f2;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s;
}
.voice-play-btn:hover { background: #4752c4; }
.voice-progress-wrap {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: rgba(255,255,255,.15);
    cursor: pointer;
    overflow: visible;
    position: relative;
    transition: height .15s;
}
.voice-progress-wrap:hover,
.voice-progress-wrap:active {
    height: 10px;
}
.voice-progress-fill {
    height: 100%;
    border-radius: 3px;
    background: #5865f2;
    width: 0%;
    transition: width .08s linear;
    pointer-events: none;
}
.voice-time {
    flex-shrink: 0;
    font-size: 11px;
    color: #72767d;
    white-space: nowrap;
}
