/* ============ CSS VARIABLES (Dark theme = default) ============ */
:root {
    --bg-app: #0b141a;
    --bg-sidebar: #111b21;
    --bg-chat-list: #111b21;
    --bg-chat-header: #202c33;
    --bg-input: #2a3942;
    --bg-input-field: #2a3942;
    --bg-msg-incoming: #202c33;
    --bg-msg-outgoing: #005c4b;
    --bg-hover: #202c33;
    --bg-active: #2a3942;
    --bg-login-box: #202c33;
    --bg-modal: #202c33;
    --bg-date-badge: #182229;
    --text-primary: #e9edef;
    --text-secondary: #8696a0;
    --text-muted: #667781;
    --text-msg: #e9edef;
    --text-time: rgba(255,255,255,0.45);
    --border-color: #222d34;
    --border-input: #374045;
    --accent: #25D366;
    --accent-hover: #1fba59;
    --scrollbar: #374045;
    --error: #ea4335;
    --msg-error-bg: rgba(234,67,53,0.08);
    --msg-error-border: rgba(234,67,53,0.2);
    --check-read: #53bdeb;
    --shadow-modal: rgba(0,0,0,0.5);
}

/* ============ LIGHT THEME ============ */
body.light-theme {
    --bg-app: #eae6df;
    --bg-sidebar: #ffffff;
    --bg-chat-list: #ffffff;
    --bg-chat-header: #f0f2f5;
    --bg-input: #f0f2f5;
    --bg-input-field: #ffffff;
    --bg-msg-incoming: #ffffff;
    --bg-msg-outgoing: #d9fdd3;
    --bg-hover: #f5f6f6;
    --bg-active: #e9edef;
    --bg-login-box: #ffffff;
    --bg-modal: #ffffff;
    --bg-date-badge: #e2ddd5;
    --text-primary: #111b21;
    --text-secondary: #54656f;
    --text-muted: #8696a0;
    --text-msg: #111b21;
    --text-time: rgba(0,0,0,0.4);
    --border-color: #e9edef;
    --border-input: #d1d7db;
    --accent: #25D366;
    --accent-hover: #1fba59;
    --scrollbar: #cccccc;
    --error: #ea4335;
    --msg-error-bg: rgba(234,67,53,0.08);
    --msg-error-border: rgba(234,67,53,0.2);
    --check-read: #53bdeb;
    --shadow-modal: rgba(0,0,0,0.3);
}

/* ============ RESET ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg-app); height: 100vh; overflow: hidden; transition: background 0.3s; }

/* ============ LOGIN ============ */
.login-overlay { position: fixed; inset: 0; background: var(--bg-app); display: flex; align-items: center; justify-content: center; z-index: 9999; }
.login-box { background: var(--bg-login-box); border-radius: 16px; padding: 40px; width: 360px; box-shadow: 0 20px 60px var(--shadow-modal); }
.login-box h2 { text-align: center; margin-bottom: 24px; color: var(--text-primary); }
.login-box .logo { text-align: center; font-size: 32px; margin-bottom: 16px; }
.login-field { margin-bottom: 16px; }
.login-field label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.login-field input { width: 100%; padding: 10px 14px; background: var(--bg-input); border: 1px solid var(--border-input); border-radius: 8px; color: var(--text-primary); font-size: 14px; outline: none; }
.login-field input:focus { border-color: var(--accent); }
.login-btn { width: 100%; padding: 12px; background: var(--accent); color: #111b21; border: none; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; }
.login-btn:hover { background: var(--accent-hover); }
.login-error { color: var(--error); font-size: 13px; margin-top: 8px; text-align: center; display: none; }

/* ============ APP LAYOUT ============ */
.app { display: flex; height: 100vh; }

/* ============ INSTANCES PANEL ============ */
.instances-panel { width: 72px; background: var(--bg-sidebar); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 4px; flex-shrink: 0; }
.instances-panel-header { font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; font-weight: 600; }
.instance-item { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; position: relative; font-weight: 700; font-size: 16px; color: #fff; flex-shrink: 0; }
.instance-item.active { outline: 2px solid var(--accent); outline-offset: 2px; }
.instance-item:hover { transform: scale(1.05); }
.instance-item .tooltip { display: none; position: absolute; left: 62px; top: 50%; transform: translateY(-50%); background: var(--bg-chat-header); color: var(--text-primary); padding: 6px 12px; border-radius: 6px; font-size: 12px; white-space: nowrap; z-index: 100; font-weight: 400; box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.instance-item:hover .tooltip { display: block; }
.instance-item .unread-badge { position: absolute; top: -2px; right: -2px; background: var(--accent); color: #111b21; font-size: 10px; font-weight: 700; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.instance-item .status-dot { position: absolute; bottom: 2px; right: 2px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--bg-sidebar); }
.status-dot.online { background: var(--accent); }
.status-dot.offline { background: var(--error); }
.instances-divider { width: 36px; height: 1px; background: var(--border-color); margin: 8px 0; }
.sidebar-btn { width: 52px; height: 52px; border-radius: 14px; border: 2px dashed var(--border-input); background: transparent; color: var(--text-muted); font-size: 22px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; flex-shrink: 0; }
.sidebar-btn:hover { border-color: var(--accent); color: var(--accent); }
.instances-spacer { flex: 1; }
.instance-avatar-img { width: 100%; height: 100%; border-radius: 14px; object-fit: cover; }
.admin-btn { width: 52px; height: 52px; border-radius: 14px; border: 2px dashed var(--border-input); background: transparent; color: var(--text-muted); font-size: 22px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.admin-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ============ CHAT LIST PANEL ============ */
.chat-list-panel { width: 340px; background: var(--bg-chat-list); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; flex-shrink: 0; }
.chat-list-header { padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; background: var(--bg-chat-header); }
.chat-list-title { font-size: 18px; font-weight: 600; color: var(--text-primary); }
.chat-list-actions { display: flex; gap: 12px; }
.chat-list-actions button { background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 18px; padding: 4px; border-radius: 50%; transition: background 0.2s; }
.chat-list-actions button:hover { background: rgba(255,255,255,0.05); }
.chat-search { padding: 8px 12px; background: var(--bg-chat-list); }
.chat-search-input { width: 100%; padding: 8px 12px; background: var(--bg-chat-header); border: none; border-radius: 8px; color: var(--text-primary); font-size: 13px; outline: none; }
.chat-search-input::placeholder { color: var(--text-muted); }
.chat-search-input:focus { background: var(--bg-input); }

/* Labels filter bar */
.labels-filter { padding: 6px 12px; display: flex; gap: 6px; overflow-x: auto; background: var(--bg-chat-list); flex-shrink: 0; }
.labels-filter::-webkit-scrollbar { height: 0; }
.label-filter-btn { padding: 4px 10px; border-radius: 12px; border: 1px solid var(--border-color); background: transparent; color: var(--text-secondary); font-size: 12px; cursor: pointer; white-space: nowrap; transition: all 0.2s; flex-shrink: 0; }
.label-filter-btn.active { background: var(--accent); color: #111b21; border-color: var(--accent); font-weight: 600; }
.label-filter-btn:hover:not(.active) { border-color: var(--accent); color: var(--accent); }

.chat-list { flex: 1; overflow-y: auto; }
.chat-list::-webkit-scrollbar { width: 6px; }
.chat-list::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 3px; }

/* ============ CHAT ITEM ============ */
.chat-item { display: flex; align-items: center; gap: 12px; padding: 10px 16px; cursor: pointer; transition: background 0.15s; border-bottom: 1px solid rgba(134,150,160,0.08); }
.chat-item:hover { background: var(--bg-hover); }
.chat-item.active { background: var(--bg-active); }
.chat-avatar { width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 600; color: #fff; overflow: hidden; }
.chat-avatar-img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.chat-info { flex: 1; min-width: 0; }
.chat-name-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.chat-name { font-size: 15px; color: var(--text-primary); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-time { font-size: 11px; color: var(--text-muted); flex-shrink: 0; margin-left: 8px; }
.chat-time.unread { color: var(--accent); }
.chat-preview-row { display: flex; justify-content: space-between; align-items: center; }
.chat-preview { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.chat-preview .check { color: var(--check-read); margin-right: 2px; }
.chat-unread { background: var(--accent); color: #111b21; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 10px; display: flex; align-items: center; justify-content: center; padding: 0 5px; flex-shrink: 0; margin-left: 8px; }
/* Label chips in chat list */
.chat-labels { display: flex; gap: 3px; margin-top: 2px; flex-wrap: wrap; }
.chat-label-chip { font-size: 10px; padding: 1px 6px; border-radius: 4px; color: #fff; font-weight: 600; line-height: 1.4; }

/* ============ CHAT WINDOW ============ */
.chat-window { flex: 1; display: flex; flex-direction: column; background: var(--bg-app); position: relative; min-width: 0; }
.chat-window::before { content: ''; position: absolute; inset: 0; background-image: url("data:image/svg+xml,%3Csvg width='400' height='400' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cpattern id='p' width='40' height='40' patternUnits='userSpaceOnUse'%3E%3Cpath d='M20 5 Q25 10 20 15 Q15 10 20 5z' fill='%23ffffff' opacity='0.02'/%3E%3C/pattern%3E%3C/defs%3E%3Crect fill='url(%23p)' width='400' height='400'/%3E%3C/svg%3E"); opacity: 0.5; pointer-events: none; z-index: 0; }
#activeChat { flex: 1; min-height: 0; overflow: hidden; }

.chat-header { padding: 10px 16px; background: var(--bg-chat-header); display: flex; align-items: center; gap: 12px; z-index: 5; border-bottom: 1px solid var(--border-color); position: relative; }
.chat-header-avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 600; color: #fff; flex-shrink: 0; overflow: hidden; }
.chat-header-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.chat-header-info { flex: 1; min-width: 0; display: flex; align-items: center; gap: 16px; }
.chat-header-wa-info { flex-shrink: 0; min-width: 0; max-width: 200px; }
.chat-header-name { font-size: 14px; color: var(--text-primary); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-header-status { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-header-center { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.chat-header-custom-name { display: flex; align-items: center; gap: 6px; padding: 5px 14px; background: var(--bg-input); border: 1px dashed var(--border-input); border-radius: 8px; cursor: pointer; min-width: 140px; max-width: 280px; transition: all 0.2s; }
.chat-header-custom-name:hover { border-color: var(--accent); border-style: solid; }
.chat-header-custom-name:hover .edit-name-icon { opacity: 1; }
.chat-header-custom-name span:first-child { font-size: 14px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; text-align: center; }
.chat-header-custom-name span:first-child:empty::before { content: '+ Внутреннее имя'; color: var(--text-muted); font-size: 13px; }
.edit-name-icon { opacity: 0; font-size: 12px; transition: opacity 0.2s; color: var(--text-muted); }
.chat-header-actions { display: flex; gap: 8px; }
.chat-header-actions button { background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 18px; padding: 4px; border-radius: 50%; transition: all 0.2s; }
.chat-header-actions button:hover { color: var(--accent); }
/* Labels in header */
.chat-header-labels { display: flex; gap: 4px; margin-top: 2px; flex-wrap: wrap; }
.header-label-chip { font-size: 10px; padding: 1px 6px; border-radius: 4px; color: #fff; font-weight: 600; }

/* ============ MESSAGES ============ */
.messages-area { flex: 1; overflow-y: auto; padding: 20px 60px; z-index: 0; display: flex; flex-direction: column; gap: 2px; position: relative; }
.messages-area::-webkit-scrollbar { width: 6px; }
.messages-area::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 3px; }

.load-more-indicator { text-align: center; padding: 12px; color: var(--text-muted); font-size: 13px; }
.load-more-indicator.loading::after { content: ''; display: inline-block; width: 16px; height: 16px; border: 2px solid var(--text-muted); border-top-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; margin-left: 8px; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

.msg-date { text-align: center; margin: 12px 0; }
.msg-date span { background: var(--bg-date-badge); color: var(--text-secondary); font-size: 12px; padding: 5px 12px; border-radius: 8px; display: inline-block; }

.msg { max-width: 65%; padding: 6px 8px 4px; border-radius: 8px; font-size: 14px; line-height: 1.45; position: relative; margin-bottom: 2px; word-wrap: break-word; }
.msg.incoming { background: var(--bg-msg-incoming); color: var(--text-msg); align-self: flex-start; border-top-left-radius: 0; }
.msg.outgoing { background: var(--bg-msg-outgoing); color: var(--text-msg); align-self: flex-end; border-top-right-radius: 0; }
.msg-text { margin-bottom: 2px; }
.msg-meta { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 2px; }
.msg-time { font-size: 11px; color: var(--text-time); }
.msg-check { font-size: 14px; color: var(--check-read); }
.msg-check.pending { color: rgba(255,255,255,0.35); }
.msg-check.sent { color: rgba(255,255,255,0.45); }

.msg.error { background: var(--msg-error-bg); border: 1px solid var(--msg-error-border); align-self: flex-end; border-top-right-radius: 0; }
.msg .msg-error-text { color: var(--error); font-size: 12px; display: flex; align-items: center; gap: 4px; }

.msg-image { border-radius: 6px; max-width: 300px; width: 100%; height: auto; display: block; margin-bottom: 4px; background: var(--bg-input); cursor: pointer; }

.msg-audio { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.msg-audio-play { width: 34px; height: 34px; border-radius: 50%; background: none; border: none; color: var(--text-primary); font-size: 18px; cursor: pointer; }

.msg-document { display: flex; align-items: center; gap: 10px; padding: 8px; background: rgba(0,0,0,0.15); border-radius: 6px; margin-bottom: 4px; cursor: pointer; text-decoration: none; color: var(--text-primary); }
.msg-document-icon { font-size: 24px; }
.msg-document-name { font-size: 13px; }

/* ============ INPUT AREA ============ */
.chat-input { padding: 10px 16px; background: var(--bg-chat-header); z-index: 2; display: flex; align-items: flex-end; gap: 10px; position: relative; }
.chat-input-actions { display: flex; gap: 8px; padding-bottom: 6px; }
.chat-input-actions button { background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 20px; padding: 4px; transition: color 0.2s; }
.chat-input-actions button:hover { color: var(--accent); }
.chat-input-field { flex: 1; background: var(--bg-input-field); border: none; border-radius: 8px; padding: 10px 14px; color: var(--text-primary); font-size: 14px; outline: none; resize: none; min-height: 40px; max-height: 120px; font-family: inherit; line-height: 1.4; }
.chat-input-field::placeholder { color: var(--text-muted); }
.chat-send { background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 22px; padding: 4px 0 6px; transition: color 0.2s; }
.chat-send:hover { color: var(--accent); }

/* Disabled input bar */
.chat-disabled-bar { padding: 14px 16px; background: var(--bg-sidebar); z-index: 1; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--text-secondary); font-size: 13px; border-top: 1px solid var(--border-color); }

/* ============ EMPTY STATE ============ */
.chat-empty { flex: 1; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 16px; z-index: 1; }
.chat-empty-icon { font-size: 80px; opacity: 0.15; }
.chat-empty-title { font-size: 28px; color: var(--text-primary); font-weight: 300; }
.chat-empty-text { font-size: 14px; color: var(--text-muted); text-align: center; line-height: 1.6; }

/* ============ NEW CHAT DIALOG ============ */
.new-chat-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 50; align-items: center; justify-content: center; }
.new-chat-overlay.show { display: flex; }
.new-chat-box { background: var(--bg-modal); border-radius: 12px; padding: 24px; width: 380px; box-shadow: 0 8px 32px var(--shadow-modal); }
.new-chat-box h3 { color: var(--text-primary); font-size: 16px; margin-bottom: 16px; }
.new-chat-box input { width: 100%; padding: 12px 16px; background: var(--bg-input); border: 1px solid var(--border-input); border-radius: 8px; color: var(--text-primary); font-size: 15px; outline: none; font-family: monospace; letter-spacing: 1px; }
.new-chat-box input:focus { border-color: var(--accent); }
.new-chat-box input::placeholder { color: var(--text-muted); font-family: -apple-system, sans-serif; letter-spacing: 0; }
.new-chat-hint { font-size: 12px; color: var(--text-muted); margin-top: 8px; }
.new-chat-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.new-chat-actions button { padding: 8px 20px; border-radius: 8px; cursor: pointer; font-size: 13px; border: none; }
.new-chat-actions .cancel { background: transparent; color: var(--text-secondary); border: 1px solid var(--border-input); }
.new-chat-actions .go { background: var(--accent); color: #111b21; font-weight: 600; }

/* ============ TEMPLATE POPUP ============ */
.template-popup { display: none; position: absolute; bottom: 100%; left: 0; right: 0; max-height: 240px; overflow-y: auto; background: var(--bg-modal); border: 1px solid var(--border-color); border-radius: 8px 8px 0 0; box-shadow: 0 -4px 16px var(--shadow-modal); z-index: 10; margin-bottom: 0; }
.template-popup.show { display: block; }
.template-popup-header { padding: 10px 14px; font-size: 12px; color: var(--text-muted); border-bottom: 1px solid var(--border-color); font-weight: 600; }
.template-item { padding: 10px 14px; cursor: pointer; transition: background 0.15s; border-bottom: 1px solid rgba(134,150,160,0.08); }
.template-item:hover { background: var(--bg-hover); }
.template-item-name { font-size: 14px; color: var(--text-primary); font-weight: 500; }
.template-item-text { font-size: 12px; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============ SETTINGS OVERLAY ============ */
.settings-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 50; align-items: center; justify-content: center; }
.settings-overlay.show { display: flex; }
.settings-box { background: var(--bg-modal); border-radius: 12px; width: 480px; max-height: 80vh; box-shadow: 0 8px 32px var(--shadow-modal); display: flex; flex-direction: column; }
.settings-header { padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); }
.settings-header h3 { color: var(--text-primary); font-size: 16px; }
.settings-close { background: none; border: none; color: var(--text-secondary); font-size: 20px; cursor: pointer; }
.settings-tabs { display: flex; border-bottom: 1px solid var(--border-color); }
.settings-tab { flex: 1; padding: 10px; text-align: center; cursor: pointer; font-size: 14px; color: var(--text-secondary); border-bottom: 2px solid transparent; transition: all 0.2s; background: none; border-top: none; border-left: none; border-right: none; }
.settings-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.settings-content { flex: 1; overflow-y: auto; padding: 16px 20px; }

/* Labels settings */
.label-list-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(134,150,160,0.08); }
.label-color-dot { width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0; }
.label-name { flex: 1; font-size: 14px; color: var(--text-primary); }
.label-delete-btn { background: none; border: none; color: var(--error); cursor: pointer; font-size: 16px; padding: 2px 4px; }
.label-add-form { margin-top: 16px; display: flex; gap: 8px; }
.label-add-form input { flex: 1; padding: 8px 12px; background: var(--bg-input); border: 1px solid var(--border-input); border-radius: 6px; color: var(--text-primary); font-size: 13px; outline: none; }
.label-add-form input:focus { border-color: var(--accent); }
.label-add-btn { padding: 8px 16px; background: var(--accent); color: #111b21; border: none; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; }
.color-palette { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.color-swatch { width: 28px; height: 28px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: all 0.2s; }
.color-swatch:hover, .color-swatch.active { border-color: var(--text-primary); transform: scale(1.15); }

/* Template settings */
.template-list-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(134,150,160,0.08); }
.template-info { flex: 1; min-width: 0; }
.template-info-name { font-size: 14px; color: var(--text-primary); font-weight: 500; }
.template-info-text { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.template-delete-btn { background: none; border: none; color: var(--error); cursor: pointer; font-size: 16px; padding: 2px 4px; }
.template-add-form { margin-top: 16px; }
.template-add-form input, .template-add-form textarea { width: 100%; padding: 8px 12px; background: var(--bg-input); border: 1px solid var(--border-input); border-radius: 6px; color: var(--text-primary); font-size: 13px; outline: none; margin-bottom: 8px; font-family: inherit; }
.template-add-form input:focus, .template-add-form textarea:focus { border-color: var(--accent); }
.template-add-form textarea { resize: vertical; min-height: 60px; }

/* ============ LABEL ASSIGN DROPDOWN ============ */
.label-dropdown { display: none; position: absolute; top: calc(100% + 4px); right: 0; background: var(--bg-modal); border: 1px solid var(--border-color); border-radius: 10px; box-shadow: 0 8px 24px var(--shadow-modal); z-index: 50; min-width: 240px; max-height: 320px; overflow-y: auto; padding: 4px 0; }
.label-dropdown.show { display: block; }
.label-dropdown-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin: 2px 4px; border-radius: 8px; cursor: pointer; transition: all 0.15s; user-select: none; }
.label-dropdown-item:hover { background: rgba(255,255,255,0.08); }
.label-dropdown-item:active { transform: scale(0.98); }
.label-dropdown-item.checked { background: rgba(37,211,102,0.15); }
.label-dropdown-item.checked:hover { background: rgba(37,211,102,0.22); }
.label-dropdown-check { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--border-input); display: flex; align-items: center; justify-content: center; font-size: 14px; color: transparent; flex-shrink: 0; transition: all 0.15s; }
.label-dropdown-item:hover .label-dropdown-check { border-color: var(--accent); }
.label-dropdown-item.checked .label-dropdown-check { background: var(--accent); color: #fff; border-color: var(--accent); }
.label-dropdown-dot { width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.label-dropdown-name { font-size: 14px; color: var(--text-primary); flex: 1; font-weight: 500; }
body.light-theme .label-dropdown-item:hover { background: rgba(0,0,0,0.05); }
body.light-theme .label-dropdown-item.checked { background: rgba(37,211,102,0.1); }
body.light-theme .label-dropdown-item.checked:hover { background: rgba(37,211,102,0.18); }

/* ============ CALL NOTIFICATION ============ */
.msg-call-notification { align-self: center; background: var(--bg-date-badge); color: var(--text-secondary); padding: 6px 16px; border-radius: 8px; font-size: 13px; display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.msg-call-notification .call-icon { font-size: 16px; }
.msg-call-notification .msg-time { font-size: 11px; color: var(--text-muted); margin-left: 4px; }

/* ============ THEME TOGGLE ============ */
.theme-toggle { background: none; border: none; font-size: 20px; cursor: pointer; padding: 4px; transition: transform 0.3s; }
.theme-toggle:hover { transform: scale(1.1); }

/* ============ DRAG-DROP OVERLAY ============ */
.drop-overlay { display: none; position: absolute; inset: 0; background: rgba(37,211,102,0.1); border: 3px dashed var(--accent); z-index: 10; align-items: center; justify-content: center; font-size: 20px; color: var(--accent); }
.drop-overlay.show { display: flex; }

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 3px; }
