/**
 * PultChat Messenger — CSS
 * 3-колоночный layout: левая панель | чат | инфо-панель
 * CSS-переменные наследуются из app.css
 */

/* ═══════════════════════════════════════════ */
/* APP CONTAINER                               */
/* ═══════════════════════════════════════════ */
.pc-app {
    display: flex;
    height: calc(100vh - 0px);
    background: var(--bg-primary);
    overflow: hidden;
    position: relative;
}

/* Remove main-content padding when messenger is active */
.main-content:has(.pc-app) {
    padding: 0 !important;
    overflow: hidden !important;
}

/* ═══════════════════════════════════════════ */
/* LEFT PANEL (320px)                          */
/* ═══════════════════════════════════════════ */
.pc-left {
    width: 320px;
    min-width: 320px;
    border-right: 1px solid var(--border-color, #2e4052);
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary, #1a2836);
}

/* Folder tabs */
.pc-folders {
    display: flex;
    gap: 0;
    padding: 4px 8px 0;
    border-bottom: 1px solid var(--border-color, #2e4052);
    overflow-x: auto;
    flex-shrink: 0;
}
.pc-folders::-webkit-scrollbar { height: 0; }

.pc-folder {
    flex: 1;
    min-width: 0;
    padding: 8px 4px 6px;
    border: none;
    background: none;
    color: var(--text-muted, #6e767d);
    font-size: .72rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all .15s;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
}
.pc-folder:hover { color: var(--text-primary, #e7e9ea); }
.pc-folder.active { color: var(--accent, #1da1f2); border-bottom-color: var(--accent, #1da1f2); }
.pc-folder span { display: inline; }
.pc-folder-cnt {
    background: var(--accent, #1da1f2);
    color: #fff;
    font-size: .62rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Search */
.pc-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 10px;
    padding: 7px 12px;
    background: var(--bg-primary, #0f1923);
    border-radius: 22px;
    border: 1px solid var(--border-color, #2e4052);
    transition: border .15s;
    flex-shrink: 0;
}
.pc-search-box:focus-within { border-color: var(--accent, #1da1f2); }
.pc-search-icon { color: var(--text-muted); flex-shrink: 0; }
.pc-search {
    flex: 1;
    border: none;
    background: none;
    color: var(--text-primary, #e7e9ea);
    font-size: .82rem;
    outline: none;
}
.pc-search::placeholder { color: var(--text-muted, #6e767d); }

/* Channel filter pills */
.pc-ch-pills {
    display: flex;
    gap: 4px;
    padding: 4px 10px 6px;
    overflow-x: auto;
    flex-shrink: 0;
}
.pc-ch-pills::-webkit-scrollbar { height: 0; }
.pc-ch-pill {
    padding: 4px 10px;
    border: 1px solid var(--border-color, #2e4052);
    border-radius: 14px;
    background: none;
    color: var(--text-secondary, #8b98a5);
    font-size: .72rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
}
.pc-ch-pill:hover { border-color: var(--accent, #1da1f2); color: var(--text-primary); }
.pc-ch-pill.active { background: var(--accent, #1da1f2); color: #fff; border-color: var(--accent); }

/* Dialog list */
.pc-dialog-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}
.pc-dialog-list::-webkit-scrollbar { width: 4px; }
.pc-dialog-list::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

/* Dialog item */
.pc-dialog {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background .12s;
    border-left: 3px solid transparent;
}
.pc-dialog:hover { background: var(--bg-hover, rgba(29,161,242,.08)); }
.pc-dialog.active { background: rgba(29,161,242,.12); border-left-color: var(--accent, #1da1f2); }
.pc-dialog.unread { background: rgba(29,161,242,.06); }
.pc-dialog.unread .pc-dialog-name { font-weight: 700; }
.pc-dialog.unread .pc-dialog-preview { color: var(--text-primary); font-weight: 500; }
.pc-dialog.unanswered { border-left-color: var(--danger, #e0245e); }
.pc-dialog.pinned { border-right: 3px solid var(--accent, #1da1f2); }

/* Avatar */
.pc-ava {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .82rem;
    color: #fff;
    flex-shrink: 0;
    letter-spacing: .5px;
}
.pc-ava-sm { width: 36px; height: 36px; font-size: .72rem; }
.pc-ava-lg { width: 64px; height: 64px; font-size: 1.1rem; }

/* Dialog body */
.pc-dialog-body { flex: 1; min-width: 0; overflow: hidden; }
.pc-dialog-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.pc-dialog-name { font-size: .85rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-dialog-time { font-size: .7rem; color: var(--text-muted); flex-shrink: 0; margin-left: 8px; }
.pc-dialog-bot { display: flex; align-items: center; gap: 6px; }
.pc-dialog-preview { font-size: .78rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; display: flex; align-items: center; gap: 4px; }
.pc-ch-dot { flex-shrink: 0; display: inline-flex; }
.pc-badge { background: var(--accent, #1da1f2); color: #fff; font-size: .68rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 5px; flex-shrink: 0; }
.pc-pin-ic { color: var(--text-muted); flex-shrink: 0; margin-right: 2px; }
.pc-sla-warn { color: var(--danger, #e0245e); flex-shrink: 0; }

/* ═══════════════════════════════════════════ */
/* CENTER PANEL                                */
/* ═══════════════════════════════════════════ */
.pc-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary, #0f1923);
    min-width: 0;
}
.pc-empty-center { align-items: center; justify-content: center; }
.pc-empty-box { text-align: center; }
.pc-empty-ic { color: var(--text-muted); opacity: .15; margin-bottom: 12px; }
.pc-empty-t { font-size: 1.15rem; font-weight: 600; color: var(--text-secondary); }
.pc-empty-sub { font-size: .82rem; color: var(--text-muted); margin-top: 4px; }

/* Chat header */
.pc-chat-hdr {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-color, #2e4052);
    background: var(--bg-secondary, #1a2836);
    flex-shrink: 0;
}
.pc-back-btn {
    display: none;
    width: 36px; height: 36px;
    border: none; background: none;
    color: var(--text-primary);
    cursor: pointer;
    align-items: center; justify-content: center;
    border-radius: 50%;
}
.pc-back-btn:hover { background: var(--bg-hover); }
.pc-chat-hdr-ava { flex-shrink: 0; }
.pc-chat-info { flex: 1; min-width: 0; overflow: hidden; }
.pc-chat-name { font-weight: 600; font-size: .9rem; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-chat-meta { font-size: .73rem; color: var(--text-muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 1px; }
.pc-chat-meta span { display: inline-flex; align-items: center; gap: 3px; }
.pc-ch-tag { font-weight: 600; }
.pc-status-tag { padding: 1px 8px; border-radius: 10px; font-size: .68rem; font-weight: 600; }

.pc-icon-btn {
    width: 34px; height: 34px;
    border: none; background: none;
    color: var(--text-secondary, #8b98a5);
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all .15s;
    flex-shrink: 0;
}
.pc-icon-btn:hover { background: var(--bg-hover); color: var(--accent, #1da1f2); }

.pc-resolve-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--success, #17bf63);
    background: rgba(23,191,99,.1);
    color: var(--success, #17bf63);
    border-radius: 18px;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    flex-shrink: 0;
    white-space: nowrap;
}
.pc-resolve-btn:hover { background: rgba(23,191,99,.2); }

/* Typing indicator */
.pc-typing { display: inline-flex; align-items: center; gap: 4px; font-size: .73rem; color: var(--accent); }
.pc-typing-dots { display: inline-flex; gap: 3px; }
.pc-typing-dots i { width: 4px; height: 4px; background: var(--accent); border-radius: 50%; display: inline-block; animation: pcTypeBounce .6s infinite; }
.pc-typing-dots i:nth-child(2) { animation-delay: .15s; }
.pc-typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes pcTypeBounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* Chat search */
.pc-chat-search { display: flex; align-items: center; gap: 6px; padding: 6px 16px; border-bottom: 1px solid var(--border-color); background: var(--bg-secondary); flex-shrink: 0; }
.pc-csearch-input { flex: 1; padding: 6px 10px; background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: 16px; color: var(--text-primary); font-size: .8rem; outline: none; }
.pc-csearch-input:focus { border-color: var(--accent); }
.pc-csearch-count { font-size: .7rem; color: var(--text-muted); min-width: 36px; text-align: center; }
.pc-csearch-btn { width: 26px; height: 26px; border: none; background: none; color: var(--text-muted); border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.pc-csearch-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ═══════════════════════════════════════════ */
/* MESSAGES                                    */
/* ═══════════════════════════════════════════ */
.pc-msgs {
    flex: 1;
    overflow-y: auto;
    padding: 16px 40px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.pc-msgs::-webkit-scrollbar { width: 5px; }
.pc-msgs::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
.pc-no-msgs { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--text-muted); gap: 8px; opacity: .3; }

/* Date separator */
.pc-date-sep { display: flex; justify-content: center; padding: 12px 0 8px; }
.pc-date-sep span { background: rgba(0,0,0,.35); color: var(--text-muted); font-size: .71rem; padding: 4px 14px; border-radius: 12px; backdrop-filter: blur(8px); }

/* Message bubble wrap */
.pc-bwrap { display: flex; gap: 8px; align-items: flex-end; padding: 2px 0; }
.pc-bwrap.out { flex-direction: row-reverse; }
.pc-bwrap.in { justify-content: flex-start; }

/* Message avatar */
.pc-msg-ava {
    width: 30px; height: 30px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .65rem; color: #fff;
    flex-shrink: 0; position: relative;
}
.pc-ava-badge {
    position: absolute; bottom: -2px; right: -2px;
    width: 14px; height: 14px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 1.5px solid var(--bg-primary, #0f1923);
}

/* Bubble */
.pc-bubble { max-width: 520px; padding: 6px 12px 4px; border-radius: 12px; word-break: break-word; position: relative; }
.pc-b-out { background: rgba(29,161,242,.08); border: 1px solid rgba(29,161,242,.15); border-bottom-right-radius: 4px; }
.pc-b-in { background: var(--bg-secondary, #1a2836); border: 1px solid var(--border-color, #2e4052); border-bottom-left-radius: 4px; }
.pc-b-sender { font-size: .66rem; margin-bottom: 2px; display: flex; align-items: center; gap: 3px; opacity: .8; }
.pc-b-text { font-size: .84rem; color: var(--text-primary); line-height: 1.55; white-space: pre-wrap; }
.pc-b-text a { color: var(--accent); }
.pc-b-special { color: var(--text-muted, #8899aa); font-style: italic; display: flex; align-items: center; gap: 4px; }
.pc-b-foot { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 2px; }
.pc-b-time { font-size: .66rem; color: var(--text-muted); }
.pc-ai-tag { color: #f59e0b; display: inline-flex; }
.pc-bubble.highlight { animation: pcHighlight 1.5s ease; }
@keyframes pcHighlight { 0%,30% { background: rgba(29,161,242,.3); } 100% { background: transparent; } }
mark { background: #FFF176; color: #000; border-radius: 2px; padding: 0 1px; }

/* Reply in bubble */
.pc-b-reply { display: flex; gap: 6px; padding: 4px 8px; margin: -2px -4px 4px; background: rgba(29,161,242,.06); border-radius: 6px; cursor: pointer; }
.pc-b-reply-line { width: 2px; background: var(--accent); border-radius: 1px; flex-shrink: 0; }
.pc-b-reply-text { font-size: .73rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Media in bubble */
.pc-b-img-wrap { margin: 4px 0; }
.pc-b-img { max-width: 300px; max-height: 250px; border-radius: 8px; cursor: pointer; object-fit: cover; }
.pc-b-file { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--bg-primary); border-radius: 8px; margin: 4px 0; }
.pc-b-file-ic { color: var(--accent); flex-shrink: 0; }
.pc-b-file-link { color: var(--accent); font-size: .8rem; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-b-file-link:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════ */
/* REPLY BAR & FILE BAR                        */
/* ═══════════════════════════════════════════ */
.pc-reply-bar { display: flex; align-items: center; padding: 8px 16px; border-top: 1px solid var(--border-color); background: var(--bg-secondary); gap: 8px; flex-shrink: 0; }
.pc-reply-preview { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.pc-reply-line { width: 3px; height: 32px; background: var(--accent); border-radius: 2px; flex-shrink: 0; }
.pc-reply-name { font-size: .73rem; font-weight: 700; color: var(--accent); }
.pc-reply-text { font-size: .76rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-reply-close, .pc-file-remove { width: 26px; height: 26px; border: none; background: none; color: var(--text-muted); border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

.pc-file-bar { display: flex; align-items: center; padding: 8px 16px; border-top: 1px solid var(--border-color); background: var(--bg-secondary); gap: 8px; flex-shrink: 0; }
.pc-file-preview { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.pc-file-thumb { display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pc-file-fname { font-size: .8rem; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ═══════════════════════════════════════════ */
/* INPUT AREA                                  */
/* ═══════════════════════════════════════════ */
.pc-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid var(--border-color, #2e4052);
    background: var(--bg-secondary, #1a2836);
    flex-shrink: 0;
    position: relative;
}
.pc-ch-indicator {
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    opacity: .7;
}
.pc-attach-btn {
    width: 34px; height: 34px;
    border: none; background: none;
    color: var(--text-muted);
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all .15s; flex-shrink: 0;
}
.pc-attach-btn:hover { background: var(--bg-hover); color: var(--accent); }
.pc-input {
    flex: 1;
    padding: 8px 14px;
    background: var(--bg-primary, #0f1923);
    border: 1px solid var(--border-color, #2e4052);
    border-radius: 20px;
    color: var(--text-primary, #e7e9ea);
    font-size: .84rem;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    outline: none;
    line-height: 1.4;
}
.pc-input:focus { border-color: var(--accent, #1da1f2); }
.pc-input::placeholder { color: var(--text-muted, #6e767d); }
.pc-send-btn {
    width: 38px; height: 38px;
    border: none;
    background: var(--accent, #1da1f2);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: all .15s;
}
.pc-send-btn:hover { opacity: .85; transform: scale(1.05); }
.pc-send-btn.sending { opacity: .5; pointer-events: none; }

/* Template popup */
.pc-tpl-popup {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0; right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px 10px 0 0;
    max-height: 240px;
    overflow-y: auto;
    box-shadow: 0 -4px 16px rgba(0,0,0,.15);
    z-index: 20;
}
.pc-tpl-item {
    display: flex; gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background .1s;
    align-items: baseline;
}
.pc-tpl-item:hover, .pc-tpl-item.active { background: var(--bg-hover); }
.pc-tpl-cmd { font-weight: 700; color: var(--accent); font-size: .82rem; flex-shrink: 0; min-width: 85px; }
.pc-tpl-text { font-size: .82rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ═══════════════════════════════════════════ */
/* PHASE 2: EMOJI BUTTON                       */
/* ═══════════════════════════════════════════ */
.pc-emoji-btn {
    width: 34px; height: 34px;
    border: none; background: none;
    color: var(--text-muted);
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all .15s; flex-shrink: 0;
}
.pc-emoji-btn:hover { background: var(--bg-hover); color: #f59e0b; }

/* Emoji Picker */
.ep-wrap { z-index: 1000; }
.ep-picker {
    width: 320px;
    background: var(--bg-primary, #0f1923);
    border: 1px solid var(--border-color, #2e4052);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,.4);
    overflow: hidden;
}
.ep-search { padding: 8px; }
.ep-search-input {
    width: 100%; box-sizing: border-box;
    padding: 6px 12px;
    background: var(--bg-secondary, #1a2836);
    border: 1px solid var(--border-color, #2e4052);
    border-radius: 8px;
    color: var(--text-primary, #e7e9ea);
    font-size: .82rem;
    outline: none;
}
.ep-search-input:focus { border-color: var(--accent); }
.ep-cats {
    display: flex; gap: 2px; padding: 0 8px 6px;
    border-bottom: 1px solid var(--border-color, #2e4052);
}
.ep-cat {
    width: 32px; height: 32px;
    border: none; background: none;
    font-size: 1.1rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .1s;
    opacity: .6;
}
.ep-cat:hover { background: var(--bg-hover); opacity: .9; }
.ep-cat.active { opacity: 1; background: var(--bg-hover); }
.ep-grid {
    display: flex; flex-wrap: wrap; gap: 2px;
    padding: 8px;
    max-height: 260px;
    overflow-y: auto;
}
.ep-grid::-webkit-scrollbar { width: 4px; }
.ep-grid::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }
.ep-emoji {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background .1s;
}
.ep-emoji:hover { background: var(--bg-hover); transform: scale(1.2); }
.ep-empty { padding: 20px; text-align: center; color: var(--text-muted); font-size: .82rem; width: 100%; }

/* ═══════════════════════════════════════════ */
/* PHASE 2: VOICE RECORDING                    */
/* ═══════════════════════════════════════════ */
.pc-voice-btn {
    width: 34px; height: 34px;
    border: none; background: none;
    color: var(--text-muted);
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all .15s; flex-shrink: 0;
    user-select: none;
    -webkit-user-select: none;
}
.pc-voice-btn:hover { background: var(--bg-hover); color: #ef4444; }
.pc-voice-rec {
    display: none;
    align-items: center;
    gap: 12px;
    flex: 1;
    padding: 0 8px;
    animation: pcVoiceFadeIn .2s ease;
}
@keyframes pcVoiceFadeIn { from { opacity: 0; } to { opacity: 1; } }
.pc-voice-cancel {
    width: 32px; height: 32px;
    border: none; background: rgba(239,68,68,.15);
    color: #ef4444;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.pc-voice-cancel:hover { background: rgba(239,68,68,.3); }
.pc-voice-pulse {
    width: 12px; height: 12px;
    background: #ef4444;
    border-radius: 50%;
    animation: pcVoicePulse 1s infinite;
    flex-shrink: 0;
}
@keyframes pcVoicePulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.5); opacity: .5; } }
.pc-voice-time { font-size: .9rem; font-weight: 600; color: #ef4444; font-variant-numeric: tabular-nums; }
.pc-voice-hint { font-size: .75rem; color: var(--text-muted); }

/* ═══════════════════════════════════════════ */
/* PHASE 2: DRAG & DROP OVERLAY                */
/* ═══════════════════════════════════════════ */
.pc-drop-overlay {
    position: absolute;
    inset: 0;
    background: rgba(29,161,242,.08);
    border: 2px dashed var(--accent, #1da1f2);
    border-radius: 12px;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.pc-drop-content {
    text-align: center;
    color: var(--accent, #1da1f2);
    font-size: 1rem;
    font-weight: 600;
    display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.pc-drop-content svg { opacity: .7; }

/* ═══════════════════════════════════════════ */
/* RIGHT PANEL (360px)                         */
/* ═══════════════════════════════════════════ */
.pc-right {
    width: 360px;
    min-width: 360px;
    border-left: 1px solid var(--border-color, #2e4052);
    background: var(--bg-secondary, #1a2836);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: width .2s, min-width .2s, opacity .2s;
}
.pc-right::-webkit-scrollbar { width: 4px; }
.pc-right::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }
.pc-right-hidden { width: 0; min-width: 0; border: none; overflow: hidden; opacity: 0; }

.pc-right-hdr {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.pc-right-title { font-weight: 700; font-size: .88rem; color: var(--text-primary); }

/* Contact section */
.pc-contact-section {
    display: flex; flex-direction: column; align-items: center;
    padding: 20px 16px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}
.pc-contact-name { font-weight: 700; font-size: 1rem; color: var(--text-primary); margin-top: 10px; word-break: break-word; }
.pc-contact-id { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }
.pc-contact-ch { display: flex; align-items: center; gap: 4px; margin-top: 6px; font-size: .82rem; font-weight: 600; }

/* Info sections */
.pc-info-section {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
}
.pc-info-label {
    font-weight: 700; font-size: .73rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
    letter-spacing: .3px;
}
.pc-info-row {
    font-size: .8rem; color: var(--text-secondary);
    display: flex; align-items: center; gap: 6px;
    padding: 3px 0;
}

/* Status badges */
.pc-status-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.pc-status-btn {
    padding: 5px 12px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: none;
    color: var(--text-secondary);
    font-size: .75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
}
.pc-status-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.pc-status-btn.active { font-weight: 700; }

/* SLA info */
.pc-sla-info {
    display: flex; align-items: center; gap: 6px;
    font-size: .82rem; color: var(--success, #17bf63);
    padding: 4px 0;
}
.pc-sla-info.overdue { color: var(--danger, #e0245e); }

/* Assign button */
.pc-assign-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: none;
    color: var(--text-primary);
    font-size: .82rem;
    cursor: pointer;
    transition: all .15s;
    width: 100%;
}
.pc-assign-btn:hover { border-color: var(--accent); background: var(--bg-hover); }

/* ═══════════════════════════════════════════ */
/* PHASE 3: RIGHT PANEL TABS + AI              */
/* ═══════════════════════════════════════════ */
.pc-right-tabs {
    display: flex;
    gap: 4px;
}
.pc-rtab {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border: none;
    background: none;
    color: var(--text-muted, #6e767d);
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 16px;
    transition: all .15s;
}
.pc-rtab:hover { color: var(--text-primary); background: var(--bg-hover); }
.pc-rtab.active { color: var(--accent, #1da1f2); background: rgba(29,161,242,.1); }

.pc-ai-section {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color, #2e4052);
}
.pc-ai-hdr {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: .76rem;
    text-transform: uppercase;
    color: var(--text-muted, #6e767d);
    margin-bottom: 10px;
    letter-spacing: .3px;
}
.pc-ai-refresh {
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    padding: 2px;
    border-radius: 50%;
    transition: all .15s;
    margin-left: auto;
}
.pc-ai-refresh:hover { color: var(--accent); background: var(--bg-hover); }
.pc-ai-spin {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-color, #2e4052);
    border-top-color: var(--accent, #1da1f2);
    border-radius: 50%;
    animation: pcSpin .8s linear infinite;
    margin-left: auto;
}
.pc-ai-sentiment {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .88rem;
    font-weight: 600;
    padding: 6px 0;
}
.pc-ai-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.pc-ai-suggest {
    padding: 10px 12px;
    background: var(--bg-primary, #0f1923);
    border: 1px solid var(--border-color, #2e4052);
    border-radius: 10px;
    cursor: pointer;
    transition: all .15s;
    margin-bottom: 8px;
}
.pc-ai-suggest:last-child { margin-bottom: 0; }
.pc-ai-suggest:hover { border-color: var(--accent, #1da1f2); background: rgba(29,161,242,.04); }
.pc-ai-suggest-text {
    font-size: .82rem;
    color: var(--text-primary, #e7e9ea);
    line-height: 1.45;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.pc-ai-suggest-use {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: .7rem;
    font-weight: 600;
    color: var(--accent, #1da1f2);
    opacity: 0;
    transition: opacity .15s;
}
.pc-ai-suggest:hover .pc-ai-suggest-use { opacity: 1; }
.pc-ai-summary {
    font-size: .82rem;
    color: var(--text-secondary, #8b98a5);
    line-height: 1.6;
    white-space: pre-wrap;
}
.pc-ai-summary strong { color: var(--text-primary); font-weight: 600; }
.pc-ai-summary ul { margin: 4px 0; padding-left: 16px; }
.pc-ai-summary li { margin-bottom: 4px; }
.pc-ai-empty {
    font-size: .78rem;
    color: var(--text-muted, #6e767d);
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: .7;
}

/* ═══════════════════════════════════════════ */
/* OVERLAYS & POPUPS                           */
/* ═══════════════════════════════════════════ */
.pc-ctx-menu {
    position: fixed; z-index: 500;
    background: var(--bg-secondary, #1a2836);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.3);
    overflow: hidden;
    min-width: 160px;
}
.pc-ctx-item {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: .82rem;
    color: var(--text-primary);
    transition: background .1s;
}
.pc-ctx-item:hover { background: var(--bg-hover); }

.pc-qa-overlay, .pc-assign-overlay {
    position: fixed; inset: 0;
    z-index: 400;
    background: rgba(0,0,0,.3);
}
.pc-qa-popup, .pc-assign-popup {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    background: var(--bg-secondary);
    border-radius: 14px;
    z-index: 401;
    box-shadow: 0 12px 40px rgba(0,0,0,.3);
    border: 1px solid var(--border-color);
    overflow: hidden;
    max-height: 80vh;
    overflow-y: auto;
}
.pc-qa-title {
    padding: 14px 16px;
    font-weight: 700; font-size: .88rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}
.pc-qa-item {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    font-size: .82rem;
    color: var(--text-primary);
    transition: background .1s;
}
.pc-qa-item:hover { background: var(--bg-hover); }
.pc-qa-item.active { background: rgba(29,161,242,.08); }

/* ═══════════════════════════════════════════ */
/* LOADING & EMPTY STATES                      */
/* ═══════════════════════════════════════════ */
.pc-loading {
    display: flex; align-items: center; justify-content: center;
    gap: 10px; padding: 40px;
    color: var(--text-muted); font-size: .82rem;
}
.pc-spinner {
    width: 18px; height: 18px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: pcSpin .8s linear infinite;
}
@keyframes pcSpin { to { transform: rotate(360deg); } }
.pc-empty-list {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted); gap: 8px; text-align: center;
}
.pc-empty-hint { font-size: .76rem; opacity: .6; }

/* ═══════════════════════════════════════════ */
/* RESPONSIVE                                  */
/* ═══════════════════════════════════════════ */
@media (max-width: 1200px) {
    .pc-right { width: 300px; min-width: 300px; }
}

@media (max-width: 1024px) {
    .pc-left { width: 280px; min-width: 280px; }
    .pc-right { width: 0; min-width: 0; border: none; overflow: hidden; opacity: 0; }
    .pc-msgs { padding: 16px 20px; }
    .pc-resolve-btn span { display: none; }
    .pc-info-toggle { display: none; }
}

@media (max-width: 768px) {
    .pc-left { width: 100%; min-width: 100%; }
    .pc-center {
        position: absolute; inset: 0;
        z-index: 10;
        transform: translateX(100%);
        transition: transform .25s ease;
    }
    .pc-app.chat-open .pc-center { transform: translateX(0); }
    .pc-back-btn { display: flex !important; }
    .pc-bubble { max-width: 85%; }
    .pc-msgs { padding: 12px 12px; }
    .pc-right { display: none; }
    .pc-resolve-btn span { display: none; }
    .pc-info-toggle { display: none; }
}

/* ═══════════════════════════════════════════ */
/* LIGHT THEME ADJUSTMENTS                     */
/* ═══════════════════════════════════════════ */
[data-theme="light"] .pc-date-sep span { background: rgba(0,0,0,.08); color: var(--text-secondary); }
[data-theme="light"] .pc-b-out { background: rgba(29,161,242,.06); border-color: rgba(29,161,242,.12); }
[data-theme="light"] .pc-b-in { background: #f5f6f8; border-color: #e1e4e8; }
[data-theme="light"] .pc-dialog.unanswered { border-left-color: var(--danger); }
[data-theme="light"] .pc-ava-badge { border-color: #fff; }
