/* ══════════════════════════════════════════
       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;
}

/* ══════════════════════════════════════════
   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;
    scroll-behavior: smooth;
}
.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 {
        position: absolute;
        inset: 0;
        z-index: 11;
        transform: translateX(100%);
        transition: transform 0.28s cubic-bezier(.4,0,.2,1);
    }

    .pm-chat--active {
        transform: translateX(0);
    }

    /* Показываем кнопку назад */
    .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     { 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; }

/* ══════════════════════════════════════════
   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-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; }

.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-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); }

/* Make pm-img clickable */
.pm-img { cursor: zoom-in; }

.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-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; }

/* ══ 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: 2px;
}
.pm-edit-hint {
    font-size: 11px;
    color: #949ba4;
    padding: 0 2px;
}

/* 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; }

.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.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; }

/* ── 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; }
