* { margin: 0; padding: 0; box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #0e1621; --sidebar: #17212b; --hover: #202b36;
  --active: #2b5278; --out: #2b5278; --in: #182533;
  --text: #ffffff; --muted: #708499; --accent: #64b5ef;
  --border: #101921; --online: #4dcd5e; --danger: #e74c3c;
  --app-font-size: 14px;
  --shadow: rgba(0,0,0,0.5);
  --reply-bg: rgba(255,255,255,0.1);
  --sidebar-width: 380px;
}

[data-theme="light"] {
  --bg: #f4f4f5; --sidebar: #ffffff; --hover: #f0f0f0;
  --active: #e3f2fd; --out: #e3f2fd; --in: #ffffff;
  --text: #000000; --muted: #707579; --accent: #3390ec;
  --border: #e0e0e0; --online: #4dcd5e; --danger: #e53935;
  --shadow: rgba(0,0,0,0.1);
  --reply-bg: rgba(0,0,0,0.05);
}

[data-theme="red"] {
  --bg: #1a0d0d; --sidebar: #261414; --hover: #361e1e;
  --active: #8b2828; --out: #8b2828; --in: #261414;
  --text: #ffffff; --muted: #b08888; --accent: #ff6b6b;
  --border: #1a0d0d; --online: #4dcd5e; --danger: #e74c3c;
  --shadow: rgba(0,0,0,0.5);
  --reply-bg: rgba(255,255,255,0.1);
}

[data-theme="blue"] {
  --bg: #0a1424; --sidebar: #102033; --hover: #1a2f4a;
  --active: #1e4d8f; --out: #1e4d8f; --in: #102033;
  --text: #ffffff; --muted: #7a92b5; --accent: #5ba3ff;
  --border: #0a1424; --online: #4dcd5e; --danger: #e74c3c;
  --shadow: rgba(0,0,0,0.5);
  --reply-bg: rgba(255,255,255,0.1);
}

[data-theme="purple"] {
  --bg: #120a24; --sidebar: #1c1233; --hover: #291a4a;
  --active: #4a2b8f; --out: #4a2b8f; --in: #1c1233;
  --text: #ffffff; --muted: #9888bb; --accent: #a56bff;
  --border: #120a24; --online: #4dcd5e; --danger: #e74c3c;
  --shadow: rgba(0,0,0,0.5);
  --reply-bg: rgba(255,255,255,0.1);
}

html, body { height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-size: var(--app-font-size); }
body, .sidebar, .chat-area, .modal, .modal-body, .chat-header, .chat-input-wrap, .messages, .message { transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; outline: none; }
input, textarea, select { font-family: inherit; outline: none; border: none; background: none; color: inherit; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: var(--muted); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }
.hidden { display: none !important; }

.auth-wrap { position: fixed; inset: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; padding: 20px; background: var(--bg); z-index: 1; }
.auth-card { background: var(--sidebar); border-radius: 16px; padding: 32px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px var(--shadow); position: relative; margin: auto; flex-shrink: 0; }
.auth-logo { width: 80px; height: 80px; border-radius: 50%; background: linear-gradient(135deg, #2aabee, #229ed9); display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; }
.auth-title { text-align: center; font-size: 22px; margin-bottom: 8px; }
.auth-sub { text-align: center; color: var(--muted); margin-bottom: 28px; font-size: 14px; }
.auth-tabs { display: flex; margin-bottom: 20px; background: var(--bg); border-radius: 10px; padding: 4px; }
.auth-tab { flex: 1; padding: 10px; text-align: center; border-radius: 8px; color: var(--muted); font-weight: 500; cursor: pointer; user-select: none; }
.auth-tab.active { background: var(--active); color: var(--text); }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-input { width: 100%; padding: 12px 14px; background: var(--bg); border-radius: 10px; color: var(--text); font-size: 15px; border: 1px solid transparent; transition: border-color 0.2s; }
.form-input:focus { border-color: var(--accent); }
.btn-primary { width: 100%; padding: 14px; background: var(--active); border-radius: 10px; color: var(--text); font-weight: 600; font-size: 15px; margin-top: 8px; transition: background 0.2s; }
.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.7; cursor: not-allowed; }
.btn-danger { width: 100%; padding: 14px; background: rgba(231, 76, 60, 0.1); color: var(--danger); border-radius: 10px; font-weight: 600; font-size: 15px; margin-top: 12px; transition: background 0.2s; }
.btn-danger:hover { background: rgba(231, 76, 60, 0.2); }
.auth-error { color: var(--danger); font-size: 13px; text-align: center; margin-top: 12px; min-height: 18px; }
.auth-avatar { width: 80px; height: 80px; border-radius: 50%; margin: 0 auto 16px; background: #5288c1; display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 600; position: relative; overflow: hidden; cursor: pointer; color: #fff; }
.auth-avatar img, .auth-avatar video { width: 100%; height: 100%; object-fit: cover; }
.auth-avatar::after { content: '📷'; position: absolute; bottom: 0; right: 0; background: var(--active); width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; border: 2px solid var(--sidebar); }

.app { display: flex; height: 100vh; height: 100dvh; }
.sidebar { width: var(--sidebar-width, 380px); background: var(--sidebar); display: flex; flex-direction: column; border-right: 1px solid var(--border); flex-shrink: 0; position: relative; }
.resizer { width: 4px; background: transparent; cursor: col-resize; flex-shrink: 0; position: relative; z-index: 15; }
.resizer::after { content: ''; position: absolute; top: 0; left: 1px; width: 2px; height: 100%; background: transparent; transition: background 0.15s; }
.resizer:hover::after, .resizer.dragging::after { background: var(--accent); }
.sidebar-header { padding: 12px 16px; display: flex; flex-direction: column; gap: 12px; border-bottom: 1px solid var(--border); position: relative; z-index: 10; }
.profile-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.profile-info { display: flex; align-items: center; gap: 12px; cursor: pointer; border-radius: 10px; padding: 4px; transition: background 0.2s; min-width: 0; flex: 1; }
.profile-info:hover { background: var(--hover); }
.profile-info > div:last-child { min-width: 0; }
.profile-name-header { font-weight: 600; font-size: 15px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-username-header { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar-btn { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; flex-shrink: 0; position: relative; background: #5288c1; display: flex; align-items: center; justify-content: center; font-weight: 600; color: #fff; font-size: 16px; cursor: pointer; }
.avatar-btn img, .avatar-btn video { width: 100%; height: 100%; object-fit: cover; }
.search-wrap { flex: 1; position: relative; display: flex; align-items: center; background: var(--bg); border-radius: 20px; padding: 0 14px; min-width: 0; }
.search-wrap svg { color: var(--muted); flex-shrink: 0; margin-right: 8px; }
.search-wrap input { width: 100%; padding: 9px 0; background: transparent; color: var(--text); font-size: 14px; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--muted); transition: background 0.15s; flex-shrink: 0; }
.icon-btn:hover { background: var(--hover); color: var(--accent); }
.chat-list { flex: 1; overflow-y: auto; position: relative; }
.chat-item { display: flex; padding: 10px 16px; gap: 12px; cursor: pointer; transition: background 0.15s, outline 0.1s; align-items: center; position: relative; }
.chat-item:hover { background: var(--hover); }
.chat-item.active { background: var(--active); }
.chat-item.drag-target { background: var(--active) !important; outline: 2px solid var(--accent); outline-offset: -2px; }
.chat-item .avatar-btn { width: 54px; height: 54px; font-size: 20px; cursor: default; }
.chat-item-body { flex: 1; min-width: 0; }
.chat-item-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.chat-item-name { font-weight: 500; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px;}
.chat-item-time { color: var(--muted); font-size: 12px; flex-shrink: 0; margin-left: 8px; }
.chat-item-preview { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item.active .chat-item-time, .chat-item.active .chat-item-preview { color: var(--muted); }
.empty-sidebar { color: var(--muted); text-align: center; padding: 40px 20px; font-size: 14px; line-height: 1.6; }

.chat-area { flex: 1; display: flex; flex-direction: column; position: relative; background: var(--bg); min-width: 0; }
.chat-placeholder { flex: 1; display: flex; align-items: center; justify-content: center; flex-direction: column; color: var(--muted); gap: 12px; }
.chat-header { padding: 10px 20px; display: flex; align-items: center; gap: 12px; background: var(--sidebar); border-bottom: 1px solid var(--border); min-height: 60px; position: relative; z-index: 5;}
.chat-header-info { flex: 1; min-width: 0; cursor: pointer; }
.chat-header-info:hover .chat-header-name { color: var(--accent); }
.chat-header-name { font-weight: 500; font-size: 15px; transition: color 0.2s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-header-status { font-size: 12px; }
.status-online { color: var(--online); }
.status-offline { color: var(--muted); }

.selection-bar { display: flex; align-items: center; gap: 12px; width: 100%; }
.selection-count { font-weight: 600; font-size: 16px; color: var(--accent); margin-right: auto; }

.messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 4px; position: relative; }
.message-wrap { display: flex; flex-direction: column; max-width: 75%; position: relative; }
.message-wrap.out { align-self: flex-end; align-items: flex-end; }
.message-wrap.in { align-self: flex-start; align-items: flex-start; }
.message-wrap, .message { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

.select-checkbox {
  position: absolute; left: -30px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--muted);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  background: var(--sidebar); transition: all 0.2s;
}
.select-checkbox.selected { background: var(--accent); border-color: var(--accent); color: #fff; }

.message { padding: 8px 12px; border-radius: 12px; font-size: 14px; line-height: 1.4; word-wrap: break-word; position: relative; width: fit-content; max-width: 100%; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.message.out { background: var(--out); border-bottom-right-radius: 4px; color: var(--text); }
.message.in { background: var(--in); border-bottom-left-radius: 4px; color: var(--text); }

.message .time { font-size: 11px; color: var(--muted); margin-left: 8px; float: right; margin-top: 4px; display: inline-flex; align-items: center; gap: 3px; }
.message .time svg { color: var(--muted); }
.message .time svg.read { color: var(--accent); }

.message img, .message video { max-width: 100%; max-height: 320px; border-radius: 8px; display: block; margin-bottom: 4px; cursor: pointer; object-fit: contain; }
.message .caption { display: block; }
.message-photo, .message-video { padding: 4px; }
.message-photo .time, .message-video .time { position: absolute; bottom: 8px; right: 12px; background: rgba(0,0,0,0.5); padding: 2px 6px; border-radius: 8px; margin: 0; color: #fff; }

.message-sticker { background: transparent !important; padding: 0 !important; border-radius: 0 !important; margin: 8px 0 !important; border-left: none !important; max-width: 100%; overflow: hidden; }
.message-sticker img { width: 150px; height: 150px; object-fit: contain; margin: 0; border-radius: 0; background: transparent; cursor: pointer; }
.message-sticker .time { position: absolute; bottom: 0; right: 0; background: rgba(0,0,0,0.5); padding: 2px 6px; border-radius: 8px; margin: 0; color: #fff; }
.message-sticker .reactions-container { margin-top: 8px; padding-top: 8px; border-top: none; }

.message-author-wrap { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; cursor: pointer; width: fit-content; flex-wrap: wrap;}
.message-author-wrap:hover .message-author { text-decoration: underline; }
.message-author-mini { width: 20px; height: 20px; border-radius: 50%; background: #5288c1; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; color: #fff; overflow: hidden; }
.message-author-mini img, .message-author-mini video { width: 100%; height: 100%; object-fit: cover; margin: 0; border-radius: 0; }
.message-author { font-size: 12px; font-weight: 600; margin: 0; }

.message-edited { font-size: 11px; color: var(--muted); margin-left: 4px; float: left; margin-top: 4px; }
.forwarded-label { font-size: 12px; font-weight: 600; color: var(--accent); margin-bottom: 4px; display: block; }

.reply-block { background: var(--reply-bg); border-left: 3px solid var(--accent); border-radius: 4px; padding: 4px 8px; margin-bottom: 6px; font-size: 13px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; opacity: 0.9; transition: opacity 0.2s; width: 100%; }
.reply-block:hover { opacity: 1; }
.reply-block .reply-author { font-weight: 600; color: var(--accent); font-size: 12px; }
.reply-block .reply-text { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

.reply-preview-bar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--sidebar); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); z-index: 10; }
.reply-preview-content { flex: 1; border-left: 3px solid var(--accent); padding-left: 10px; overflow: hidden; }
.reply-preview-author { font-weight: 600; color: var(--accent); font-size: 13px; }
.reply-preview-text { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.reactions-container { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,0.1); }
[data-theme="light"] .reactions-container { border-top-color: rgba(0,0,0,0.1); }
.reaction-chip { display: inline-flex; align-items: center; gap: 4px; background: rgba(0,0,0,0.2); padding: 2px 8px; border-radius: 12px; font-size: 13px; cursor: pointer; border: 1px solid transparent; transition: transform 0.1s; }
.reaction-chip:hover { transform: scale(1.05); background: rgba(0,0,0,0.3); }
.reaction-chip.mine { border-color: var(--accent); background: rgba(100, 181, 239, 0.2); }

.chat-input-wrap { padding: 12px 20px 16px; background: var(--sidebar); display: flex; align-items: flex-end; gap: 10px; position: relative; transition: background 0.2s, outline 0.1s; }
.chat-input-wrap.drag-target-input { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--active); }
.chat-input { flex: 1; padding: 11px 16px; background: var(--bg); border-radius: 20px; color: var(--text); font-size: 14px; max-height: 120px; resize: none; line-height: 1.4; overflow-y: auto; min-width: 0; user-select: text; -webkit-user-select: text; }
.send-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--active); display: flex; align-items: center; justify-content: center; color: var(--text); flex-shrink: 0; transition: transform 0.15s, background 0.15s; }
.send-btn:hover { opacity: 0.9; }
.send-btn:active { transform: scale(0.95); }
.attach-btn { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--muted); flex-shrink: 0; }
.attach-btn:hover { background: var(--hover); color: var(--accent); }

.sticker-panel { position: absolute; bottom: 70px; left: 20px; background: var(--sidebar); border-radius: 10px; padding: 10px; display: flex; flex-wrap: wrap; gap: 10px; max-width: 300px; max-height: 300px; overflow-y: auto; box-shadow: 0 10px 30px var(--shadow); z-index: 50; border: 1px solid var(--border); }
.sticker-item { width: 60px; height: 60px; object-fit: contain; cursor: pointer; transition: transform 0.1s; }
.sticker-item:hover { transform: scale(1.1); }

.blocked-banner { padding: 16px; background: var(--sidebar); text-align: center; color: var(--muted); font-size: 14px; border-top: 1px solid var(--border); }
.btn-unblock { background: var(--danger); color: #fff; padding: 10px 20px; border-radius: 10px; font-weight: 600; margin-top: 8px; }

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal { background: var(--sidebar); border-radius: 16px; width: 100%; max-width: 440px; max-height: 85vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px var(--shadow); position: relative; }
.modal-header { padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 17px; font-weight: 600; }
.modal-body { padding: 16px 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.modal-close { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.modal-close:hover { background: var(--hover); color: var(--text); }

.user-result { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; cursor: pointer; }
.user-result:hover { background: var(--hover); }
.user-result .info { flex: 1; min-width: 0; }
.user-result .name { font-weight: 500; font-size: 15px; display: flex; align-items: center; gap: 6px;}
.user-result .uname { color: var(--muted); font-size: 13px; }
.user-result input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }

.tag-owner { background: #e6b800; color: #000; padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; margin-left: 4px;}
.tag-admin { background: var(--active); color: var(--text); padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; margin-left: 4px;}

.profile-avatar { width: 110px; height: 110px; border-radius: 50%; margin: 0 auto 8px; background: #5288c1; display: flex; align-items: center; justify-content: center; font-size: 44px; font-weight: 600; position: relative; overflow: hidden; color: #fff; }
.profile-avatar img, .profile-avatar video { width: 100%; height: 100%; object-fit: cover; }
.profile-hint { text-align: center; color: var(--muted); font-size: 12px; margin-bottom: 16px; }
.profile-name { text-align: center; font-size: 19px; font-weight: 600; margin-bottom: 4px; }

.profile-uname { text-align: center; color: var(--accent); margin-bottom: 4px; font-weight: 500; cursor: pointer; display: inline-block; padding: 2px 8px; border-radius: 6px; transition: background 0.2s; width: fit-content; margin-left: auto; margin-right: auto; }
.profile-uname:hover { background: var(--hover); text-decoration: underline; }

.profile-status { text-align: center; font-size: 13px; margin-bottom: 16px; color: var(--muted); }

.profile-info-block { background: var(--bg); border-radius: 12px; padding: 4px 16px; display: flex; flex-direction: column; }
.profile-info-row { padding: 14px 0; border-bottom: 1px solid var(--border); }
.profile-info-row:last-child { border-bottom: none; }
.profile-info-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.profile-info-value { font-size: 15px; line-height: 1.4; word-wrap: break-word; }
.profile-username-link { color: var(--accent); font-weight: 500; cursor: pointer; display: inline-block; }
.profile-username-link:hover { text-decoration: underline; }

.theme-swatch { cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; user-select: none; }
.theme-swatch .swatch-circle { width: 44px; height: 44px; border-radius: 50%; border: 3px solid transparent; transition: border-color 0.2s, transform 0.1s; box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.theme-swatch:hover .swatch-circle { transform: scale(1.08); }
.theme-swatch.active .swatch-circle { border-color: var(--accent); box-shadow: 0 0 0 2px var(--sidebar), 0 0 0 4px var(--accent); }
.theme-swatch span { font-size: 11px; color: var(--muted); }
.theme-swatch.active span { color: var(--accent); font-weight: 600; }

.menu-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 10px; cursor: pointer; transition: background 0.15s; }
.menu-item:hover { background: var(--hover); }
.menu-item .icon { width: 24px; display: flex; justify-content: center; color: var(--muted); }
.menu-item .label { flex: 1; }
.menu-item .sub { color: var(--muted); font-size: 12px; }
.menu-item.danger { color: var(--danger); }
.menu-item.danger .icon { color: var(--danger); }

.context-menu { position: fixed; background: var(--sidebar); border-radius: 12px; box-shadow: 0 4px 20px var(--shadow); z-index: 150; min-width: 200px; overflow: hidden; border: 1px solid var(--border); display: flex; flex-direction: column; }
.emoji-bar-wrapper { background: var(--bg); border-bottom: 1px solid var(--border); padding: 4px 8px; display: flex; align-items: center; gap: 4px; }
.emoji-quick-list { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.emoji-btn { font-size: 20px; padding: 4px; border-radius: 8px; cursor: pointer; transition: transform 0.1s, background 0.1s; display: flex; align-items: center; justify-content: center; }
.emoji-btn:hover { transform: scale(1.2); background: var(--hover); }
.emoji-expand-btn { color: var(--muted); padding: 4px; cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.emoji-expand-btn:hover { background: var(--hover); color: var(--text); }
.emoji-full-panel { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; padding: 8px; max-height: 200px; overflow-y: auto; background: var(--bg); border-bottom: 1px solid var(--border); }
.emoji-full-panel .emoji-btn { font-size: 22px; padding: 4px; }
.context-menu-item { padding: 10px 16px; font-size: 14px; cursor: pointer; display: flex; align-items: center; gap: 10px; color: var(--text); transition: background 0.15s; }
.context-menu-item:hover { background: var(--hover); }
.context-menu-item.danger { color: var(--danger); }

.settings-back-btn { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 8px 0; color: var(--accent); font-weight: 500; margin-bottom: 8px; }
.settings-back-btn:hover { opacity: 0.8; }
.settings-item { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-radius: 10px; transition: background 0.15s; }
.settings-item-label { font-size: 15px; flex: 1; }

.privacy-select { background: var(--bg); color: var(--text); border: 1px solid var(--border); padding: 6px 30px 6px 10px; border-radius: 8px; font-size: 14px; cursor: pointer; outline: none; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23708499%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E"); background-repeat: no-repeat; background-position: right 8px top 50%; background-size: 10px auto; }
[data-theme="light"] .privacy-select { background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23707579%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E"); }

.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--muted); transition: .4s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--accent); }
input:checked + .slider:before { transform: translateX(20px); }

.photo-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.photo-gallery img { width: 100%; height: 100px; object-fit: cover; border-radius: 4px; cursor: pointer; }

.upload-progress { width: 100%; height: 4px; background: var(--border); border-radius: 2px; margin-top: 10px; overflow: hidden; }
.upload-progress-bar { height: 100%; background: var(--accent); width: 0%; transition: width 0.2s; }

.call-modal { position: fixed; inset: 0; background: var(--sidebar); z-index: 500; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.call-avatar { width: 140px; height: 140px; border-radius: 50%; background: #5288c1; display: flex; align-items: center; justify-content: center; font-size: 56px; font-weight: 600; color: #fff; margin-bottom: 20px; overflow: hidden; }
.call-avatar img, .call-avatar video { width: 100%; height: 100%; object-fit: cover; }
.call-name { font-size: 24px; font-weight: 600; margin-bottom: 8px; text-align: center; }
.call-status { font-size: 16px; color: var(--muted); margin-bottom: 40px; text-align: center; }
.call-actions { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; z-index: 10; margin-bottom: 20px; }
.call-btn { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; cursor: pointer; }
.call-btn.accept { background: var(--online); }
.call-btn.decline, .call-btn.end { background: var(--danger); }
.call-btn.mute { background: var(--hover); color: var(--text); }
.call-btn.mute.active { background: var(--accent); color: #fff; }

.call-devices { display: flex; gap: 10px; margin-top: 10px; z-index: 10; flex-wrap: wrap; justify-content: center; }
.device-select { background: var(--bg); color: var(--text); padding: 10px 14px; border-radius: 10px; font-size: 13px; max-width: 200px; border: 1px solid var(--border); outline: none; cursor: pointer; }

.drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  background: var(--out);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 12px;
  max-width: 280px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  font-size: 13px;
  line-height: 1.4;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid var(--accent);
}

@media (max-width: 768px) {
  .sidebar { width: 100%; position: absolute; inset: 0; z-index: 10; }
  .sidebar.hidden { display: none; }
  .chat-area { position: absolute; inset: 0; z-index: 20; display: none; }
  .chat-area.mobile-open { display: flex; }
  .resizer { display: none; }
  .select-checkbox { left: 10px; z-index: 10; }
  .message-wrap.in { padding-left: 30px; }
}

.back-btn { display: flex; }
.toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); background: var(--sidebar); color: var(--text); padding: 12px 20px; border-radius: 10px; font-size: 14px; z-index: 200; box-shadow: 0 10px 30px var(--shadow); border: 1px solid var(--border); }
.photo-viewer { position: fixed; inset: 0; background: rgba(0,0,0,0.95); z-index: 300; display: flex; align-items: center; justify-content: center; padding: 20px; cursor: zoom-out; }
.photo-viewer img, .photo-viewer video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }

#sticker-preview-container { width: 300px; height: 300px; overflow: hidden; position: relative; background: rgba(0,0,0,0.2); border-radius: 10px; cursor: grab; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; }
#sticker-preview-container:active { cursor: grabbing; }
#sticker-preview-img { position: absolute; transform-origin: center; user-select: none; pointer-events: none; max-width: none; top: 50%; left: 50%; }

.menu-screen { display: flex; flex-direction: column; padding: 16px; gap: 12px; overflow-y: auto; height: 100%; }
.menu-list { display: flex; flex-direction: column; background: var(--bg); border-radius: 12px; overflow: hidden; }
.menu-list-item { display: flex; align-items: center; gap: 16px; padding: 14px 16px; cursor: pointer; transition: background 0.15s; border-bottom: 1px solid var(--border); }
.menu-list-item:last-child { border-bottom: none; }
.menu-list-item:hover { background: var(--hover); }
.menu-list-item .icon { color: var(--muted); display: flex; }
.menu-list-item .label { flex: 1; font-size: 15px; font-weight: 500; }
.menu-list-item .switch { flex-shrink: 0; }

.account-chip { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; cursor: pointer; margin-bottom: 4px; transition: background 0.15s; }
.account-chip:hover { background: var(--hover); }
.account-chip.active { background: var(--active); }
.account-chip .avatar-btn { width: 36px; height: 36px; font-size: 14px; cursor: pointer; }
.account-chip-name { font-weight: 500; font-size: 14px; }