:root {
  --primary: #0f8f5a;
  --primary-strong: #067247;
  --secondary: #8bea78;
  --bg: #020b08;
  --surface: #0d1813;
  --surface-2: #14241c;
  --text: #edf7f1;
  --muted: #93aa9d;
  --accent: #9cff87;
  --message-me: #0f8f5a;
  --message-peer: #12221a;
  --danger: #e95050;
  --border: rgba(255,255,255,.08);
  --shadow: 0 24px 80px rgba(0,0,0,.44);
}
body.light-theme {
  --primary: #0f8f5a;
  --primary-strong: #08744b;
  --secondary: #4ecf7a;
  --bg: #edf7f1;
  --surface: #ffffff;
  --surface-2: #dff0e7;
  --text: #102018;
  --muted: #597066;
  --accent: #08744b;
  --message-me: #0f8f5a;
  --message-peer: #ffffff;
  --border: rgba(9,41,25,.12);
  --shadow: 0 24px 70px rgba(8,54,32,.18);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, Segoe UI, Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); overflow: hidden; }
body.offline::after { content: "\041d\0435\0442 \043f\043e\0434\043a\043b\044e\0447\0435\043d\0438\044f. \041f\0435\0440\0435\043f\043e\0434\043a\043b\044e\0447\0430\0435\043c\0441\044f..."; position: fixed; left: 50%; top: 12px; z-index: 80; transform: translateX(-50%); padding: 9px 14px; border-radius: 999px; color: #ffecec; background: rgba(120,28,28,.94); border: 1px solid rgba(255,141,141,.35); box-shadow: 0 14px 38px rgba(0,0,0,.34); font-weight: 900; pointer-events: none; animation: dropIn .18s ease both; }
.hidden { display: none !important; }
input, button, textarea { font: inherit; }
button { border: 0; color: var(--text); cursor: pointer; background: linear-gradient(135deg, var(--primary), var(--primary-strong)); border-radius: 10px; font-weight: 850; transition: transform .16s ease, filter .16s ease, opacity .16s ease, background .16s ease; }
button:focus { outline: 0; }
button:focus-visible { outline: 0; box-shadow: none; }
button:hover { transform: translateY(-1px); filter: brightness(1.08); }
button:active { transform: translateY(0) scale(.99); }
button.ghost { background: #09120d; color: var(--muted); border: 1px solid var(--border); }
.danger { background: var(--danger) !important; }
.loading { opacity: .64; pointer-events: none; }
.no-animations *, .no-animations *::before, .no-animations *::after { animation: none !important; transition: none !important; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 18% 16%, rgba(15,143,90,.28), transparent 30%), radial-gradient(circle at 80% 86%, rgba(139,234,120,.12), transparent 34%), var(--bg); }
.auth-panel { width: min(440px, calc(100vw - 32px)); display: grid; gap: 12px; padding: 30px; background: rgba(13,24,19,.92); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); backdrop-filter: blur(18px); animation: panelIn .35s ease both; }
.brand-mark { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 18px; background: linear-gradient(135deg, var(--primary), #073d2a); color: white; font-size: 30px; font-weight: 950; box-shadow: 0 16px 40px rgba(15,143,90,.28); }
.eyebrow { color: var(--accent); margin: 0 0 4px; font-weight: 900; }
h1 { margin: 0 0 10px; font-size: 28px; }
.auth-copy { margin: -4px 0 6px; color: var(--muted); font-weight: 700; line-height: 1.35; }
.auth-panel input, .search-box input, #messageInput { border: 0; outline: 0; color: var(--text); background: transparent; }
.auth-panel input { height: 48px; padding: 0 14px; border-radius: 10px; background: #07120d; border: 1px solid var(--border); transition: border .18s ease, box-shadow .18s ease, transform .18s ease; }
.auth-panel input:focus { border-color: rgba(156,255,135,.52); box-shadow: 0 0 0 4px rgba(15,143,90,.14); transform: translateY(-1px); }
.auth-panel button { height: 46px; }
.auth-recovery { color: var(--muted); text-align: center; font-size: 13px; font-weight: 800; text-decoration: none; }
.auth-recovery:hover { color: var(--accent); text-decoration: underline; }
.error { color: #ff8d8d; min-height: 20px; margin: 0; font-weight: 800; }

.messenger { height: 100vh; display: grid; grid-template-columns: 380px 1fr; background: var(--bg); }
.messenger.dragging-files::after { content: "\041e\0442\043f\0443\0441\0442\0438\0442\0435, \0447\0442\043e\0431\044b \043e\0442\043f\0440\0430\0432\0438\0442\044c"; position: fixed; inset: 16px; z-index: 70; display: grid; place-items: center; border: 2px dashed rgba(156,255,135,.62); border-radius: 24px; color: var(--text); font-size: 24px; font-weight: 950; background: rgba(5,16,11,.72); backdrop-filter: blur(8px); pointer-events: none; animation: fadeIn .12s ease both; }
.sidebar { position: relative; margin: 16px 0 16px 20px; padding: 10px; border-radius: 14px; background: rgba(13,24,19,.94); border: 1px solid var(--border); box-shadow: 0 18px 60px rgba(0,0,0,.28); overflow: hidden; display: flex; flex-direction: column; min-width: 0; animation: slideInLeft .28s ease both; }
.side-top { display: grid; grid-template-columns: 44px 1fr; gap: 8px; align-items: center; padding: 0 0 8px; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; background: transparent; color: var(--muted); border: 0; border-radius: 999px; font-size: 20px; }
.icon-btn:focus-visible { box-shadow: none; }
.icon-btn:hover { background: rgba(255,255,255,.07); color: white; }
.search-box { height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 14px; border-radius: 999px; background: #07120d; border: 1px solid rgba(255,255,255,.05); color: var(--muted); transition: border .18s ease, box-shadow .18s ease; }
.search-box:focus-within { border-color: rgba(156,255,135,.34); box-shadow: 0 0 0 4px rgba(15,143,90,.1); }
.search-box input { width: 100%; font-size: 16px; }
.notice { text-align: left; display: grid; gap: 4px; padding: 14px 16px; background: linear-gradient(135deg, rgba(15,143,90,.18), rgba(139,234,120,.08)); border: 1px solid rgba(156,255,135,.12); border-radius: 12px; margin-bottom: 8px; }
.notice span { color: var(--muted); font-weight: 600; }
.global-search-results { max-height: min(360px, 45vh); overflow: auto; margin-bottom: 8px; padding: 7px; border-radius: 14px; background: rgba(5,15,10,.92); border: 1px solid rgba(156,255,135,.12); box-shadow: inset 0 1px 0 rgba(255,255,255,.04); animation: fadeUp .16s ease both; }
.global-section-title { padding: 7px 8px 4px; color: var(--accent); font-size: 12px; font-weight: 950; text-transform: uppercase; letter-spacing: .02em; }
.global-result { width: 100%; min-height: 52px; display: grid; grid-template-columns: 42px 1fr auto; gap: 10px; align-items: center; padding: 7px; border-radius: 11px; background: transparent; text-align: left; color: var(--text); }
.global-result:hover { transform: none; filter: none; background: rgba(255,255,255,.06); }
.global-result strong, .global-result span { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.global-result span, .global-result small { color: var(--muted); font-size: 12px; font-weight: 750; }
.global-result mark { color: #04110a; background: var(--accent); border-radius: 4px; padding: 0 2px; }
.folder-tabs { display: flex; gap: 7px; overflow-x: auto; padding: 2px 0 9px; scrollbar-width: none; }
.folder-tabs::-webkit-scrollbar { display: none; }
.folder-tab { flex: 0 0 auto; min-height: 34px; padding: 0 12px; border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.055); font-size: 13px; font-weight: 900; }
.folder-tab:hover { transform: none; filter: none; background: rgba(255,255,255,.075); }
.folder-tab.active { color: white; background: linear-gradient(135deg, var(--primary), var(--primary-strong)); border-color: rgba(156,255,135,.22); }
.chat-list, .contacts { overflow: auto; scrollbar-width: thin; scrollbar-color: #235c3e transparent; }
.chat-list { max-height: 310px; }
.chat-item, .contact-item { display: grid; grid-template-columns: 54px 1fr auto; gap: 10px; align-items: center; min-height: 64px; padding: 9px; border-radius: 12px; color: inherit; transition: background .16s ease; }
.chat-item:hover, .contact-item:hover { background: rgba(255,255,255,.05); }
.chat-item.active { background: linear-gradient(135deg, var(--primary), #126c48); }
.avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: white; background: linear-gradient(135deg, var(--primary), var(--secondary)); font-weight: 900; overflow: hidden; }
.avatar.big { width: 86px; height: 86px; font-size: 30px; margin: 0 auto; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.item-main { min-width: 0; }
.item-main strong, .item-main span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-main span, .item-meta { color: var(--muted); font-size: 13px; font-weight: 700; }
.chat-item.active .item-main span, .chat-item.active .item-meta { color: rgba(255,255,255,.82); }
.contacts-title { color: var(--accent); font-weight: 900; margin: 10px 8px 6px; padding-top: 12px; border-top: 1px solid #0a120e; }
.compose-fab { position: absolute; right: 20px; bottom: 20px; width: 56px; height: 56px; border-radius: 50%; font-size: 24px; box-shadow: 0 16px 38px rgba(15,143,90,.26); }
.compose-fab.open { transform: rotate(45deg); }
.compose-menu { position: fixed; left: 178px; bottom: 82px; z-index: 18; width: 202px; padding: 8px; border-radius: 14px; background: rgba(28,31,29,.98); border: 1px solid rgba(255,255,255,.07); box-shadow: 0 18px 48px rgba(0,0,0,.42); display: grid; gap: 2px; animation: menuPop .18s cubic-bezier(.2,.9,.2,1) both; }
.compose-menu button { min-height: 38px; display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: center; padding: 7px 10px; background: transparent; border-radius: 9px; text-align: left; }
.compose-menu button:hover { background: rgba(255,255,255,.07); transform: none; filter: none; }
.compose-menu span { color: var(--accent); text-align: center; font-size: 18px; }

.chat-pane { position: relative; min-width: 0; background-color: var(--bg); background-image: linear-gradient(rgba(2,11,8,.08), rgba(2,11,8,.08)), radial-gradient(circle at 20px 20px, rgba(15,143,90,.18) 1px, transparent 1.5px), radial-gradient(circle at 50px 55px, rgba(139,234,120,.1) 1px, transparent 1.5px); background-size: auto, 74px 74px, 74px 74px; overflow: hidden; }
body[data-chat-wallpaper="clean"] .chat-pane { background-color: #020b08; background-image: radial-gradient(circle at 86% 12%, rgba(15,143,90,.16), transparent 30%), linear-gradient(180deg, rgba(3,19,12,.9), rgba(1,7,5,1)); background-size: auto; }
body[data-chat-wallpaper="paper"] .chat-pane { background-color: #06110c; background-image: linear-gradient(135deg, rgba(156,255,135,.05) 25%, transparent 25%), linear-gradient(225deg, rgba(156,255,135,.045) 25%, transparent 25%), radial-gradient(circle at 18% 20%, rgba(15,143,90,.18), transparent 32%); background-size: 42px 42px, 42px 42px, auto; }
body[data-chat-wallpaper="mosaic"] .chat-pane { background-color: #020b08; background-image: radial-gradient(circle at 20px 20px, rgba(156,255,135,.18) 1px, transparent 1.5px), radial-gradient(circle at 48px 54px, rgba(15,143,90,.22) 1px, transparent 1.5px), linear-gradient(135deg, rgba(20,80,54,.14), transparent 45%); background-size: 64px 64px, 64px 64px, auto; }
.chat-header { position: absolute; top: 16px; left: min(420px, 26%); right: 24px; max-width: 760px; height: 64px; display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 12px; background: rgba(13,24,19,.94); border: 1px solid var(--border); border-radius: 999px; z-index: 3; box-shadow: 0 10px 30px rgba(0,0,0,.28); backdrop-filter: blur(14px); animation: dropIn .25s ease both; }
.chat-header-actions { position: relative; display: flex; align-items: center; gap: 4px; justify-self: end; }
.chat-actions-menu { position: absolute; right: 12px; top: 58px; width: 210px; padding: 6px; border-radius: 12px; background: rgba(28,31,29,.98); border: 1px solid rgba(255,255,255,.07); box-shadow: 0 18px 48px rgba(0,0,0,.42); display: grid; gap: 2px; animation: menuPop .16s ease both; }
.chat-actions-menu button { min-height: 38px; padding: 0 12px; border-radius: 8px; background: transparent; text-align: left; }
.chat-actions-menu button:hover { background: rgba(255,255,255,.07); transform: none; filter: none; }
.chat-actions-menu .danger-text { color: #ffb0b0; }
.chat-search-panel { position: absolute; top: 86px; left: min(420px, 26%); right: 24px; max-width: 640px; height: 48px; z-index: 4; display: grid; grid-template-columns: 1fr auto 34px 34px 34px; gap: 6px; align-items: center; padding: 5px; border-radius: 999px; background: rgba(13,24,19,.96); border: 1px solid var(--border); box-shadow: 0 12px 34px rgba(0,0,0,.32); animation: dropIn .18s ease both; }
.chat-search-panel input { min-width: 0; height: 38px; padding: 0 12px; border: 0; outline: 0; border-radius: 999px; color: var(--text); background: #07120d; }
.chat-search-panel span { color: var(--muted); font-weight: 850; min-width: 44px; text-align: center; }
.chat-search-panel button, .reply-preview button { height: 34px; min-width: 34px; border-radius: 999px; background: transparent; color: var(--muted); }
.header-copy { min-width: 0; }
.header-copy strong, .header-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-copy span { color: var(--muted); font-size: 13px; }
.empty-state { height: 100%; display: grid; place-items: center; color: var(--muted); font-weight: 800; }
.empty-card { display: grid; justify-items: center; gap: 10px; max-width: 320px; text-align: center; padding: 24px; color: var(--muted); animation: fadeUp .28s ease both; }
.empty-card strong { color: var(--text); font-size: 22px; }
.empty-logo { width: 74px; height: 74px; display: grid; place-items: center; border-radius: 24px; color: white; background: linear-gradient(135deg, var(--primary), #073d2a); font-size: 34px; font-weight: 950; box-shadow: 0 18px 48px rgba(15,143,90,.24); }
.messages { height: 100%; overflow: auto; padding: 98px 24px 86px; display: flex; flex-direction: column; gap: 8px; }
.pinned-message-bar {
  position: absolute;
  left: clamp(12px, 9vw, 140px);
  right: clamp(12px, 9vw, 140px);
  top: 92px;
  z-index: 12;
  min-height: 52px;
  display: grid;
  grid-template-columns: 28px 1fr 34px;
  gap: 10px;
  align-items: center;
  padding: 8px 10px 8px 14px;
  border-radius: 18px;
  background: rgba(8, 30, 20, .86);
  border: 1px solid rgba(104, 255, 164, .18);
  box-shadow: 0 16px 36px rgba(0, 0, 0, .25);
  backdrop-filter: blur(16px);
  animation: panelIn .18s ease both;
}
.pinned-message-bar strong { display: block; color: var(--accent); font-size: 12px; }
.pinned-message-bar small { display: block; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voice-room-bar { margin: 8px auto 0; width: min(760px, calc(100% - 32px)); display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 18px; background: rgba(15,143,90,.14); border: 1px solid rgba(156,255,135,.18); box-shadow: 0 14px 42px rgba(0,0,0,.18); }
.voice-room-bar strong, .voice-room-bar span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-room-bar span { color: var(--muted); font-size: 12px; font-weight: 800; }
.voice-room-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 999px; color: white; background: linear-gradient(135deg, var(--primary), var(--primary-strong)); }
.voice-room-bar button { min-height: 36px; padding: 0 14px; border-radius: 999px; background: var(--primary); color: white; font-weight: 950; }
.pinned-message-bar button { width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.06); }
.bubble { max-width: min(540px, 74%); padding: 9px 11px; border-radius: 14px 14px 14px 5px; background: var(--message-peer); align-self: flex-start; box-shadow: 0 2px 0 rgba(0,0,0,.18); animation: messageIn .18s ease both; }
.bubble.me { background: linear-gradient(135deg, var(--message-me), #12764d); border-radius: 14px 14px 5px 14px; align-self: flex-end; }
.bubble.no-animate { animation: none !important; }
.bubble.search-hit { outline: 2px solid var(--accent); }
.bubble mark { border-radius: 4px; padding: 0 2px; color: #06110c; background: var(--accent); }
.reply-chip { margin-bottom: 6px; padding: 5px 8px; border-left: 3px solid var(--accent); border-radius: 8px; background: rgba(0,0,0,.16); color: rgba(255,255,255,.8); font-size: 12px; font-weight: 800; }
.edited-label { color: rgba(255,255,255,.58); font-size: 11px; margin-left: 5px; }
.bubble .name { color: var(--accent); font-size: 12px; font-weight: 900; margin-bottom: 3px; }
.bubble .time { color: rgba(255,255,255,.68); font-size: 11px; text-align: right; margin-left: 10px; }
.bubble-row { display: flex; align-items: flex-end; gap: 6px; }
.delete-message { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.22); color: rgba(255,255,255,.8); opacity: 0; transition: opacity .16s ease, background .16s ease; }
.bubble:hover .delete-message { opacity: 1; }
.delete-message:hover { background: var(--danger); color: #fff; }
.composer { position: absolute; left: min(420px, 26%); right: 24px; bottom: 16px; max-width: 740px; height: 54px; display: grid; grid-template-columns: 46px 1fr 46px 46px 46px; align-items: center; gap: 4px; padding: 4px; background: rgba(13,24,19,.94); border: 1px solid var(--border); border-radius: 999px; z-index: 3; box-shadow: 0 14px 40px rgba(0,0,0,.3); backdrop-filter: blur(14px); animation: riseIn .24s ease both; }
.reply-preview { position: absolute; left: min(420px, 26%); right: 24px; bottom: 76px; max-width: 700px; min-height: 48px; z-index: 3; display: grid; grid-template-columns: 1fr 40px; gap: 8px; align-items: center; padding: 8px 10px 8px 14px; border-radius: 16px; background: rgba(13,24,19,.96); border: 1px solid var(--border); box-shadow: 0 14px 40px rgba(0,0,0,.26); }
.voice-record-panel { position: absolute; left: min(420px, 26%); right: 24px; bottom: 76px; max-width: 700px; min-height: 52px; z-index: 4; display: grid; grid-template-columns: 14px auto 1fr auto auto; gap: 10px; align-items: center; padding: 9px 10px 9px 14px; border-radius: 18px; background: rgba(13,24,19,.98); border: 1px solid rgba(31,185,108,.34); box-shadow: 0 18px 50px rgba(0,0,0,.32); animation: riseIn .18s ease both; }
.voice-record-panel strong { color: var(--text); font-size: 16px; }
.voice-record-panel span:not(.record-dot) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-weight: 800; }
.voice-record-panel button { min-height: 34px; padding: 0 12px; border-radius: 999px; background: rgba(255,255,255,.07); }
.voice-record-panel button:last-child { color: #fff; background: var(--primary); }
.record-dot { width: 10px; height: 10px; border-radius: 50%; background: #ff4f4f; box-shadow: 0 0 0 0 rgba(255,79,79,.45); animation: recordPulse 1.2s ease infinite; }
.voice-btn.recording { color: #ffb0b0; background: rgba(255,79,79,.18); }
.reply-preview strong, .reply-preview span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-preview strong { color: var(--accent); font-size: 12px; }
.reply-preview span { color: var(--muted); font-weight: 750; }
.upload-queue { position: absolute; left: min(420px, 26%); right: 24px; bottom: 76px; max-width: 740px; z-index: 4; display: grid; gap: 6px; animation: riseIn .18s ease both; }
.upload-item { min-height: 42px; display: grid; grid-template-columns: 24px minmax(0, 1fr) auto auto; gap: 9px; align-items: center; padding: 8px 10px; border-radius: 16px; background: rgba(13,24,19,.96); border: 1px solid rgba(156,255,135,.14); box-shadow: 0 12px 34px rgba(0,0,0,.24); }
.upload-item strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.upload-item small { color: var(--muted); font-weight: 850; }
.upload-item.failed { border-color: rgba(255,141,141,.28); }
.upload-item.failed small { color: #ff9c9c; }
.upload-item button { width: 28px; height: 28px; border-radius: 999px; background: transparent; color: var(--muted); }
.upload-spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(156,255,135,.25); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.upload-item.failed .upload-spinner { border-color: rgba(255,141,141,.35); border-top-color: #ff9c9c; animation: none; }
.message-context-menu { position: fixed; z-index: 80; width: 176px; padding: 7px; border-radius: 14px; background: rgba(22,27,24,.98); border: 1px solid rgba(255,255,255,.08); box-shadow: 0 18px 48px rgba(0,0,0,.42); display: grid; gap: 3px; animation: menuPop .12s ease both; overflow: hidden; }
.message-context-menu button { min-height: 36px; padding: 0 12px; background: transparent; border: 0; box-shadow: none; border-radius: 9px; text-align: left; }
.message-context-menu button:hover { background: rgba(255,255,255,.07); transform: none; filter: none; }
.message-context-menu button:focus,
.message-context-menu button:focus-visible { outline: 0; box-shadow: none; }
.message-context-menu .danger-text { color: #ffb0b0; }
.message-reaction-row { display: flex; gap: 3px; padding: 2px; }
.message-reaction-row button { flex: 1; min-height: 32px; padding: 0; text-align: center; font-size: 17px; background: rgba(255,255,255,.06); border: 0; box-shadow: none; }
.reaction-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.reaction-chip { min-height: 24px; padding: 2px 8px; border-radius: 999px; color: var(--text); background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.08); font-size: 12px; font-weight: 900; }
.reaction-chip:hover { transform: none; filter: brightness(1.08); }
.message-media { display: block; width: min(320px, 64vw); max-height: 340px; object-fit: cover; border-radius: 12px; background: rgba(0,0,0,.24); }
.media-thumb-button { display: block; padding: 0; background: transparent; border-radius: 12px; overflow: hidden; text-align: left; }
.media-thumb-button:hover { transform: none; filter: brightness(1.06); }
.message-album { width: min(320px, 64vw); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
.message-album.count-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.message-album.count-3 .album-thumb:first-child { grid-row: span 2; }
.album-thumb { position: relative; width: 100%; aspect-ratio: 1; }
.album-thumb .message-media { width: 100%; height: 100%; max-height: none; border-radius: 0; }
.message-album .album-thumb:first-child { border-radius: 12px 4px 4px 12px; }
.message-album .album-thumb:last-child { border-radius: 4px 12px 12px 4px; }
.album-extra { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.52); color: white; font-size: 28px; font-weight: 950; }
.message-audio { width: min(310px, 64vw); max-width: 100%; display: block; }
.media-link { display: block; color: inherit; }
.bubble small { display: block; margin-top: 6px; color: rgba(237,247,241,.76); font-weight: 750; }
.document-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.08); color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; }
.document-chip:hover { background: rgba(255,255,255,.12); }
#messageInput { height: 44px; font-size: 16px; }
.send-btn { width: 46px; height: 46px; border-radius: 50%; font-size: 18px; }

.call-modal { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: rgba(0,0,0,.62); backdrop-filter: blur(6px); }
.call-card { width: 320px; padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; text-align: center; box-shadow: 0 20px 80px rgba(0,0,0,.5); animation: callPulse .34s ease both; }
.call-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.call-actions button, .compact { height: 44px; padding: 0 14px; }
.call-window { position: fixed; top: 86px; right: 22px; z-index: 12; width: min(360px, calc(100vw - 24px)); min-width: 300px; max-width: calc(100vw - 16px); overflow: hidden; border-radius: 18px; background: rgba(13,24,19,.97); border: 1px solid var(--border); box-shadow: 0 24px 80px rgba(0,0,0,.48); animation: dropIn .22s ease both; backdrop-filter: blur(14px); }
.media-viewer { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(0, 0, 0, .84); backdrop-filter: blur(16px); animation: fadeIn .14s ease both; }
.media-viewer-stage { max-width: min(92vw, 1180px); max-height: 82vh; display: grid; place-items: center; }
.media-viewer-stage img, .media-viewer-stage video { max-width: min(92vw, 1180px); max-height: 82vh; border-radius: 16px; object-fit: contain; box-shadow: 0 28px 90px rgba(0,0,0,.46); background: #020604; }
.media-viewer-close, .media-viewer-nav { position: fixed; z-index: 91; border-radius: 999px; background: rgba(13,24,19,.86); color: white; border: 1px solid rgba(255,255,255,.12); backdrop-filter: blur(12px); }
.media-viewer-close { top: 18px; right: 18px; width: 44px; height: 44px; font-size: 28px; }
.media-viewer-nav { top: 50%; width: 52px; height: 70px; font-size: 48px; transform: translateY(-50%); }
.media-viewer-nav.prev { left: 18px; }
.media-viewer-nav.next { right: 18px; }
.media-viewer-caption { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); min-width: min(520px, calc(100vw - 28px)); display: grid; grid-template-columns: 1fr auto; gap: 2px 14px; align-items: center; padding: 11px 14px; border-radius: 16px; background: rgba(13,24,19,.88); border: 1px solid rgba(255,255,255,.1); color: var(--text); backdrop-filter: blur(12px); }
.media-viewer-caption strong, .media-viewer-caption span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-viewer-caption span { color: var(--muted); font-size: 12px; }
.media-viewer-caption a { grid-row: 1 / span 2; grid-column: 2; color: var(--accent); font-weight: 900; }
.call-window.minimized { width: min(300px, calc(100vw - 24px)); min-width: 0; border-radius: 999px; }
.call-window.minimized .call-media-stage, .call-window.minimized .call-window-actions { display: none; }
.call-window.dragging, .call-window.resizing { transition: none !important; user-select: none; }
.call-window.fullscreen { inset: 16px !important; width: auto !important; max-width: none; border-radius: 18px; transform: none !important; }
.call-window.fullscreen .call-media-stage { min-height: calc(100vh - 170px); }
.call-window.fullscreen .call-media-stage video { height: calc(100vh - 170px); }
.call-window.fullscreen .call-window-actions { position: absolute; top: 74px; right: 14px; z-index: 2; width: min(260px, calc(100vw - 28px)); border: 1px solid rgba(255,255,255,.08); border-radius: 999px; background: rgba(13,24,19,.86); backdrop-filter: blur(14px); }
.call-window:fullscreen { inset: 0 !important; width: 100vw !important; height: 100vh !important; border: 0; border-radius: 0; background: rgba(5,7,6,.98); }
.call-window:fullscreen .call-media-stage { min-height: calc(100vh - 138px); }
.call-window:fullscreen .call-media-stage video { height: calc(100vh - 138px); }
.call-window:fullscreen .call-window-actions { position: absolute; top: calc(74px + env(safe-area-inset-top)); right: 14px; z-index: 2; width: min(260px, calc(100vw - 28px)); border: 1px solid rgba(255,255,255,.08); border-radius: 999px; background: rgba(13,24,19,.86); backdrop-filter: blur(14px); }
.call-window-header { min-height: 62px; display: grid; grid-template-columns: 46px 1fr 40px 40px; gap: 10px; align-items: center; padding: 9px 10px; cursor: move; touch-action: none; }
.call-window-header strong, .call-window-header span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-window-header span { color: var(--muted); font-size: 12px; font-weight: 800; }
.call-media-stage { min-height: 190px; height: var(--call-media-height, 220px); display: grid; place-items: center; background: radial-gradient(circle at 50% 30%, rgba(15,143,90,.28), transparent 36%), #050706; }
.call-media-stage video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.call-avatar-stage { width: 104px; height: 104px; border-radius: 50%; display: grid; place-items: center; color: white; font-size: 36px; font-weight: 950; background: linear-gradient(135deg, var(--primary), var(--secondary)); box-shadow: 0 18px 46px rgba(15,143,90,.28); }
.call-window-actions { display: grid; grid-template-columns: 46px 46px 1fr; gap: 8px; align-items: center; padding: 10px; border-top: 1px solid rgba(255,255,255,.06); }
.call-resize-handle { position: absolute; z-index: 3; background: transparent; }
.call-resize-right { top: 62px; right: 0; bottom: 18px; width: 10px; cursor: ew-resize; }
.call-resize-bottom { left: 18px; right: 18px; bottom: 0; height: 10px; cursor: ns-resize; }
.call-resize-corner { right: 0; bottom: 0; width: 22px; height: 22px; cursor: nwse-resize; }
.call-resize-corner::after { content: ""; position: absolute; right: 6px; bottom: 6px; width: 9px; height: 9px; border-right: 2px solid rgba(156,255,135,.48); border-bottom: 2px solid rgba(156,255,135,.48); border-radius: 1px; }
.call-window.minimized .call-resize-handle,
.call-window.fullscreen .call-resize-handle,
.call-window:fullscreen .call-resize-handle { display: none; }
body.call-fullscreen .composer,
body.call-fullscreen .reply-preview,
body.call-fullscreen .voice-record-panel,
body.call-fullscreen .compose-fab,
body.call-fullscreen .compose-menu { display: none !important; }
.screen-quality-backdrop { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 18px; background: rgba(0,0,0,.7); backdrop-filter: blur(10px); animation: fadeIn .14s ease both; }
.screen-quality-card { width: min(920px, 100%); display: grid; gap: 18px; padding: 18px; border-radius: 18px; background: #171c19; border: 1px solid rgba(156,255,135,.12); box-shadow: 0 28px 90px rgba(0,0,0,.55); animation: panelIn .18s ease both; }
.screen-quality-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 5px; border-radius: 12px; background: rgba(0,0,0,.34); }
.screen-quality-tabs button { min-height: 38px; display: inline-flex; gap: 8px; align-items: center; justify-content: center; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 900; }
.screen-quality-tabs button.active { background: rgba(255,255,255,.08); color: var(--text); }
.screen-quality-tabs button:disabled { opacity: .5; cursor: not-allowed; }
.screen-quality-preview { display: grid; gap: 8px; }
.screen-quality-preview small { color: var(--muted); font-weight: 800; }
.screen-preview-frame { position: relative; aspect-ratio: 16 / 9; max-height: 420px; border-radius: 14px; overflow: hidden; border: 2px solid rgba(156,255,135,.18); background: radial-gradient(circle at 15% 20%, rgba(15,143,90,.28), transparent 34%), linear-gradient(135deg, #07120d, #050706); box-shadow: inset 0 0 0 1px rgba(255,255,255,.04); }
.screen-preview-frame::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(156,255,135,.18) 1px, transparent 1px); background-size: 26px 26px; opacity: .28; }
.screen-preview-top { position: absolute; left: 7%; right: 7%; top: 8%; height: 9%; border-radius: 999px; background: rgba(255,255,255,.08); }
.screen-preview-chat { position: absolute; left: 8%; bottom: 11%; width: 34%; height: 52%; border-radius: 14px; background: rgba(13,24,19,.9); border: 1px solid rgba(255,255,255,.08); box-shadow: 0 18px 44px rgba(0,0,0,.25); }
.screen-preview-code { position: absolute; right: 8%; bottom: 13%; width: 42%; height: 46%; border-radius: 14px; background: rgba(0,0,0,.36); border: 1px solid rgba(255,255,255,.08); }
.screen-preview-code::before, .screen-preview-chat::before { content: ""; position: absolute; left: 16px; right: 16px; top: 18px; height: 10px; border-radius: 999px; background: linear-gradient(90deg, var(--primary), rgba(156,255,135,.2)); box-shadow: 0 24px 0 rgba(255,255,255,.12), 0 48px 0 rgba(255,255,255,.08), 0 72px 0 rgba(255,255,255,.1); }
.screen-preview-frame [data-start-screen] { position: absolute; z-index: 1; left: 50%; top: 50%; transform: translate(-50%, -50%); min-height: 46px; padding: 0 22px; border-radius: 12px; background: #f4fff8; color: #05120c; font-weight: 950; box-shadow: 0 16px 42px rgba(0,0,0,.36); }
.screen-quality-footer { display: grid; grid-template-columns: 1fr auto 40px; gap: 12px; align-items: center; }
.screen-quality-footer strong, .screen-quality-footer span { display: block; }
.screen-quality-footer span { color: var(--muted); font-size: 12px; font-weight: 800; margin-top: 3px; }
.screen-quality-pills { display: flex; gap: 6px; padding: 5px; border-radius: 12px; background: rgba(0,0,0,.34); }
.screen-quality-pills button { min-width: 88px; display: grid; gap: 2px; justify-items: center; padding: 8px 10px; border-radius: 9px; color: var(--muted); background: transparent; font-weight: 950; }
.screen-quality-pills button small { color: inherit; font-size: 10px; font-weight: 800; opacity: .78; }
.screen-quality-pills button.active { color: #9cff87; background: rgba(15,143,90,.24); }

.peer-profile-panel { position: absolute; top: 16px; right: 16px; bottom: 16px; width: min(360px, calc(100vw - 32px)); z-index: 8; overflow: auto; border-radius: 18px; background: rgba(13,24,19,.97); border: 1px solid var(--border); box-shadow: 0 24px 80px rgba(0,0,0,.48); animation: slideInRight .2s cubic-bezier(.2,.9,.2,1) both; }
.peer-profile-panel header { position: sticky; top: 0; z-index: 2; min-height: 56px; display: grid; grid-template-columns: 42px 1fr; gap: 8px; align-items: center; padding: 8px 12px; background: rgba(13,24,19,.96); backdrop-filter: blur(12px); }
.peer-profile-panel header strong { font-size: 20px; }
.peer-profile-hero { display: grid; justify-items: center; gap: 7px; padding: 24px 18px; text-align: center; }
.peer-profile-hero h2, .peer-profile-hero p { margin: 0; }
.peer-profile-hero p { color: var(--muted); font-weight: 750; }
.peer-profile-card { margin: 0 14px 14px; overflow: hidden; border-radius: 16px; background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.055); }
.peer-profile-card div, .peer-profile-card button { width: 100%; min-height: 56px; display: grid; grid-template-columns: 38px 1fr; gap: 10px; align-items: center; padding: 9px 14px; color: var(--text); background: transparent; border: 0; border-bottom: 1px solid rgba(255,255,255,.055); text-align: left; }
.peer-profile-card button:focus-visible { box-shadow: none; }
.peer-profile-card div:last-child, .peer-profile-card button:last-child { border-bottom: 0; }
.peer-profile-card span { color: var(--accent); text-align: center; font-size: 20px; }
.peer-profile-card strong, .peer-profile-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peer-profile-card small { color: var(--muted); font-weight: 750; }
.peer-card-title { min-height: 38px !important; display: block !important; padding: 14px 14px 4px !important; color: #a78bfa !important; font-weight: 900; border-bottom: 0 !important; }
.peer-members-list { display: grid; padding: 4px 8px 10px; }
.peer-member-row { min-height: 46px; display: grid; grid-template-columns: 36px 1fr auto; gap: 9px; align-items: center; padding: 6px; border-radius: 10px; }
.peer-member-row:hover { background: rgba(255,255,255,.055); }
.peer-member-row strong, .peer-member-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peer-member-row small { color: var(--muted); font-weight: 750; }
.peer-member-row i { color: var(--accent); font-size: 11px; font-style: normal; font-weight: 900; }
.peer-media-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 0 14px 12px; padding: 4px; border-radius: 999px; background: rgba(255,255,255,.045); }
.peer-media-tabs button { min-height: 34px; border-radius: 999px; background: transparent; color: var(--muted); font-size: 12px; }
.peer-media-tabs button.active { background: var(--primary); color: #fff; }
.peer-media-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0 14px 18px; }
.peer-media-list img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.peer-media-file { grid-column: 1 / -1; display: grid; gap: 4px; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.06); color: var(--text); text-decoration: none; }
.peer-media-file small { color: var(--muted); font-weight: 750; }

.menu-overlay { position: fixed; inset: 0; z-index: 20; background: transparent; animation: fadeIn .12s ease both; }
.side-menu { position: fixed; left: 30px; top: 66px; width: 236px; z-index: 21; padding: 6px; border-radius: 12px; background: rgba(28,31,29,.98); border: 1px solid rgba(255,255,255,.07); box-shadow: 0 18px 48px rgba(0,0,0,.42); display: grid; gap: 2px; animation: menuPop .18s cubic-bezier(.2,.9,.2,1) both; }
.menu-user-row, .menu-item, .menu-more-panel button { min-height: 36px; display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: 6px 10px; text-align: left; background: transparent; border-radius: 8px; border: 0; color: var(--text); font-weight: 850; }
.menu-user-row { grid-template-columns: 34px 1fr; min-height: 44px; }
.menu-avatar { width: 30px; height: 30px; font-size: 13px; border: 2px solid rgba(156,255,135,.35); }
.menu-item span, .menu-more-panel span { color: rgba(237,247,241,.82); font-size: 20px; text-align: center; }
.menu-item i { color: var(--muted); font-style: normal; font-size: 24px; }
.menu-user-row:hover, .menu-item:hover, .menu-more-panel button:hover { background: rgba(255,255,255,.07); transform: none; filter: none; }
.menu-accounts { display: grid; gap: 2px; }
.menu-account-row { width: 100%; min-height: 46px; display: grid; grid-template-columns: 36px 1fr; gap: 10px; align-items: center; padding: 6px 8px; border: 0; border-radius: 10px; background: transparent; color: var(--text); text-align: left; }
.menu-account-row:hover { background: rgba(255,255,255,.07); transform: none; filter: none; }
.menu-account-row span:last-child { min-width: 0; }
.menu-account-row strong, .menu-account-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-account-row small { color: var(--muted); font-weight: 750; }
.avatar.mini { width: 30px; height: 30px; font-size: 12px; }
.menu-separator { height: 1px; margin: 3px -6px; background: rgba(255,255,255,.07); }
.side-menu .danger { color: #ffb0b0; background: transparent !important; }
.menu-more-panel { position: absolute; left: calc(100% - 8px); top: 214px; width: 254px; padding: 6px; border-radius: 12px; background: rgba(28,31,29,.98); border: 1px solid rgba(255,255,255,.07); box-shadow: 0 18px 48px rgba(0,0,0,.42); display: grid; gap: 2px; animation: menuPop .16s cubic-bezier(.2,.9,.2,1) both; }
.menu-more-panel button { grid-template-columns: 28px 1fr; }
.menu-more-panel small { padding: 8px 12px 6px 48px; color: var(--muted); font-weight: 800; }

.settings-panel { position: fixed; left: 20px; top: 16px; bottom: 16px; width: 360px; z-index: 22; overflow: auto; border-radius: 16px; background: rgba(13,24,19,.96); border: 1px solid var(--border); box-shadow: 0 24px 80px rgba(0,0,0,.48); animation: slideInLeft .22s cubic-bezier(.2,.9,.2,1) both; }
.settings-header { position: sticky; top: 0; z-index: 2; height: 58px; display: grid; grid-template-columns: 44px 1fr 38px 38px 38px; gap: 6px; align-items: center; padding: 8px 12px; background: rgba(13,24,19,.96); backdrop-filter: blur(12px); }
.settings-header strong { font-size: 20px; }
.settings-profile { display: grid; justify-items: center; gap: 7px; padding: 24px 20px 28px; }
.settings-avatar { width: 108px; height: 108px; font-size: 42px; background: linear-gradient(135deg, #0f8f5a, #e95f94); box-shadow: 0 18px 44px rgba(0,0,0,.34); }
.settings-profile h2 { margin: 8px 0 0; font-size: 20px; }
.settings-profile p { margin: 0; color: var(--muted); font-weight: 750; }
.settings-card { margin: 0 16px 14px; overflow: hidden; border-radius: 18px; background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.055); box-shadow: inset 0 1px 0 rgba(255,255,255,.025); }
.settings-row, .settings-card button { width: 100%; min-height: 58px; display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; align-items: center; padding: 9px 16px; color: var(--text); background: transparent; border: 0; border-radius: 0; box-shadow: inset 0 -1px 0 rgba(255,255,255,.045); text-align: left; font-weight: 850; }
.settings-row:last-child, .settings-card button:last-child { border-bottom: 0; box-shadow: none; }
.settings-row > span, .settings-card button > span { color: rgba(237,247,241,.72); font-size: 22px; text-align: center; }
.settings-row strong, .settings-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-row small { margin-top: 4px; color: var(--muted); font-weight: 750; }
.settings-card button:hover { background: rgba(255,255,255,.055); transform: none; filter: none; }
.settings-card button:focus,
.settings-card button:focus-visible { outline: 0; box-shadow: inset 0 -1px 0 rgba(255,255,255,.045); }
.settings-card button em { color: var(--muted); font-style: normal; font-weight: 800; }
.settings-dots-menu { position: absolute; right: 10px; top: 50px; width: 134px; padding: 6px; border-radius: 12px; background: rgba(28,31,29,.98); border: 1px solid rgba(255,255,255,.07); box-shadow: 0 18px 48px rgba(0,0,0,.42); animation: menuPop .16s ease both; }
.settings-dots-menu button { width: 100%; min-height: 38px; padding: 0 12px; background: transparent; color: #ffb0b0; text-align: left; border-radius: 8px; }
.settings-dots-menu button:hover { background: rgba(255,255,255,.07); transform: none; filter: none; }
.settings-header.compact { grid-template-columns: 44px 1fr; }
.panel-search { height: 42px; display: flex; align-items: center; gap: 10px; padding: 0 14px; border-radius: 999px; background: #171c19; border: 2px solid rgba(156,131,255,.78); color: #a78bfa; }
.panel-search input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-weight: 750; }
.panel-list { display: grid; padding: 10px 8px 84px; }
.panel-item { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center; min-height: 60px; padding: 8px 10px; border-radius: 12px; cursor: pointer; transition: background .16s ease, transform .16s ease; }
.panel-item:hover, .panel-item.active { background: rgba(255,255,255,.06); transform: translateX(2px); }
.panel-item strong, .panel-item span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-item span { color: var(--muted); font-weight: 750; }
.pin-mark { color: var(--accent); font-size: 10px; font-style: normal; margin-left: 5px; vertical-align: 1px; }
.panel-fab { position: absolute; right: 20px; bottom: 22px; width: 56px; height: 56px; border-radius: 50%; font-size: 28px; box-shadow: 0 16px 38px rgba(15,143,90,.26); }
.notify-section { margin: 16px 16px 0; padding: 18px; border-radius: 18px; background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.055); display: grid; gap: 14px; }
.notify-section h3 { margin: 0 0 6px; color: #a78bfa; font-size: 16px; }
.notify-note { margin: 10px 28px; color: var(--muted); line-height: 1.28; font-weight: 750; }
.toggle-row, .range-row, .select-row { min-height: 34px; display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; color: var(--text); font-weight: 850; }
.toggle-row input { display: none; }
.toggle-row span { width: 36px; height: 20px; border-radius: 999px; background: #3a413d; position: relative; transition: background .16s ease; }
.toggle-row span::after { content: ''; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; border-radius: 50%; background: #97a49d; transition: transform .16s ease, background .16s ease; }
.toggle-row input:checked + span { background: #8b6ff0; }
.toggle-row input:checked + span::after { transform: translateX(16px); background: #151515; }
.range-row em, .select-row em { color: var(--muted); font-style: normal; font-weight: 850; }
.range-row input { grid-column: 1 / -1; accent-color: #8b6ff0; }
.notify-enable { height: 42px; background: transparent; color: #a78bfa; text-align: left; padding: 0 4px; }
.danger-text { color: #ffb0b0 !important; }
.settings-line, .privacy-row { min-height: 54px; display: grid; gap: 3px; padding: 8px 0; background: transparent; color: var(--text); text-align: left; border-radius: 10px; }
.settings-line:hover, .privacy-row:hover { background: rgba(255,255,255,.055); transform: none; filter: none; }
.settings-line strong, .settings-line small, .privacy-row strong, .privacy-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-line small, .privacy-row small { color: var(--muted); font-weight: 750; }
.cache-head { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.cache-head button { background: transparent; color: #a78bfa; font-weight: 900; }
.cache-row { min-height: 42px; display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; }
.cache-row span { color: rgba(237,247,241,.7); font-size: 22px; text-align: center; }
.cache-row small { color: var(--muted); font-weight: 750; }
.theme-swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.color-grid { display: grid; gap: 10px; }
.color-grid label { min-height: 44px; display: grid; grid-template-columns: 1fr 54px; gap: 12px; align-items: center; color: var(--text); font-weight: 850; }
.color-grid input { width: 54px; height: 34px; padding: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: transparent; cursor: pointer; }
.theme-swatch { height: 72px; border-radius: 18px; border: 2px solid transparent; background: radial-gradient(circle at 24% 18%, rgba(156,255,135,.18), transparent 28%), #06110c; color: white; font-size: 24px; }
.theme-swatch:nth-child(2) { background: radial-gradient(circle at 70% 20%, rgba(156,255,135,.22), transparent 30%), #080d09; }
.theme-swatch:nth-child(3) { background: radial-gradient(circle at 70% 20%, rgba(83,155,210,.24), transparent 30%), #071018; }
.theme-swatch:nth-child(4) { background: radial-gradient(circle at 70% 20%, rgba(118,180,222,.28), transparent 30%), #08131a; }
.theme-swatch.active { border-color: #8b6ff0; box-shadow: 0 0 0 2px rgba(139,111,240,.18); }
.radio-row { min-height: 42px; display: grid; grid-template-columns: 44px 1fr; align-items: center; color: var(--text); font-weight: 850; }
.radio-row input { width: 22px; height: 22px; accent-color: #8b6ff0; }
.radio-row small { display: block; grid-column: 2; color: var(--muted); font-weight: 750; }
body.light-theme .sidebar,
body.light-theme .settings-panel,
body.light-theme .profile-card { background: rgba(255,255,255,.94); }
body.light-theme .side-menu,
body.light-theme .menu-more-panel,
body.light-theme .compose-menu,
body.light-theme .settings-dots-menu,
body.light-theme .chat-actions-menu { background: rgba(255,255,255,.98); border-color: rgba(9,41,25,.12); }
body.light-theme .chat-pane { background-color: var(--bg); }
body.light-theme .profile-grid input,
body.light-theme .profile-grid textarea,
body.light-theme .auth-panel input,
body.light-theme .search-box,
body.light-theme .panel-search { background: #f7fbf8; }
body.light-theme .settings-card,
body.light-theme .profile-info-card,
body.light-theme .notify-section { background: rgba(9,41,25,.045); border-color: rgba(9,41,25,.08); }

.profile-backdrop { position: fixed; inset: 0; z-index: 52; display: grid; place-items: center; padding: 22px; background: rgba(0,0,0,.62); backdrop-filter: blur(8px); animation: fadeIn .16s ease both; }
.profile-card { position: relative; width: min(640px, 100%); max-height: calc(100vh - 44px); overflow: auto; display: grid; gap: 14px; padding: 0 18px 18px; border-radius: 20px; background: linear-gradient(145deg, rgba(13,24,19,.98), rgba(7,18,13,.98)); border: 1px solid rgba(156,255,135,.13); box-shadow: var(--shadow); animation: panelIn .22s ease both; }
.profile-close { position: absolute; top: 12px; right: 12px; z-index: 3; font-size: 26px; background: rgba(0,0,0,.24); color: white; }
.profile-hero { position: relative; min-height: 260px; display: grid; place-items: end center; margin: 0 -18px; padding: 34px 18px 22px; overflow: hidden; border-radius: 20px 20px 0 0; background: linear-gradient(145deg, #123d2a, #050706); }
.profile-banner-pattern { position: absolute; inset: 0; opacity: .72; background-image: linear-gradient(115deg, transparent 0 44%, rgba(156,255,135,.13) 44% 45%, transparent 45% 100%), radial-gradient(circle at 22% 18%, rgba(63,194,106,.28), transparent 28%), radial-gradient(circle at 84% 0%, rgba(156,255,135,.14), transparent 32%); background-size: 54px 54px, auto, auto; }
.profile-avatar-wrap { position: relative; z-index: 1; display: grid; justify-items: center; cursor: pointer; }
.profile-avatar-wrap input, .profile-action input { display: none; }
.profile-avatar-wrap .avatar { width: 92px; height: 92px; font-size: 32px; border: 4px solid rgba(237,247,241,.92); box-shadow: 0 18px 42px rgba(0,0,0,.38); transition: transform .18s ease, filter .18s ease; }
.profile-avatar-wrap:hover .avatar { transform: translateY(-2px) scale(1.02); filter: brightness(1.08); }
.profile-title-block { position: relative; z-index: 1; display: grid; justify-items: center; gap: 4px; text-align: center; }
.profile-title-block h2 { margin: 0; max-width: 440px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 24px; }
.profile-title-block p { margin: 0; color: var(--accent); font-weight: 900; }
.profile-title-block span { color: rgba(237,247,241,.72); font-size: 13px; font-weight: 750; }
.profile-quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 2px; }
.profile-action { min-height: 66px; display: grid; justify-items: center; align-content: center; gap: 5px; border-radius: 14px; color: var(--text); background: #101613; border: 1px solid var(--border); cursor: pointer; transition: transform .16s ease, background .16s ease; }
.profile-action:hover { transform: translateY(-1px); background: #16251d; }
.profile-action span { color: var(--accent); font-size: 20px; line-height: 1; }
.profile-action strong { font-size: 13px; }
.profile-info-card { display: grid; border-radius: 14px; background: #101613; border: 1px solid var(--border); overflow: hidden; }
.profile-info-row { display: grid; grid-template-columns: 42px 1fr; gap: 10px; align-items: center; min-height: 58px; padding: 8px 14px; border-bottom: 1px solid rgba(255,255,255,.06); }
.profile-info-row:last-child { border-bottom: 0; }
.profile-info-row > span { color: var(--accent); font-size: 20px; text-align: center; font-weight: 900; }
.profile-info-row strong, .profile-info-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-info-row small { margin-top: 3px; color: var(--muted); font-weight: 750; }
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.profile-grid label { display: grid; gap: 7px; color: var(--muted); font-weight: 850; }
.profile-grid label.wide { grid-column: 1 / -1; }
.profile-grid input, .profile-grid textarea { width: 100%; min-height: 46px; padding: 11px 12px; border-radius: 12px; color: var(--text); background: #07120d; border: 1px solid var(--border); outline: 0; resize: vertical; transition: border .18s ease, box-shadow .18s ease, transform .18s ease; }
.profile-grid textarea { min-height: 92px; line-height: 1.35; }
.profile-grid input:focus, .profile-grid textarea:focus { border-color: rgba(156,255,135,.52); box-shadow: 0 0 0 4px rgba(15,143,90,.14); transform: translateY(-1px); }
.profile-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.profile-actions button { height: 46px; }

.toast-host { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: grid; gap: 10px; pointer-events: none; }
.toast { min-width: 260px; max-width: 360px; padding: 12px 14px; border-radius: 12px; background: rgba(13,24,19,.96); border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow); animation: toastIn .22s ease both; }
.toast strong { display: block; margin-bottom: 2px; }
.toast span { color: var(--muted); font-weight: 700; }
.dialog-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,.58); backdrop-filter: blur(7px); animation: fadeIn .16s ease both; }
.dialog-card { width: min(430px, 100%); display: grid; gap: 12px; padding: 20px; border-radius: 16px; background: rgba(13,24,19,.98); border: 1px solid var(--border); box-shadow: var(--shadow); animation: panelIn .22s ease both; }
.dialog-card h2 { margin: 0; }
.dialog-card p { margin: 0; color: var(--muted); font-weight: 700; line-height: 1.4; }
.dialog-fields { display: grid; gap: 10px; }
.dialog-fields label { display: grid; gap: 6px; color: var(--muted); font-weight: 800; }
.dialog-fields input, .dialog-fields textarea { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 10px; color: var(--text); background: #07120d; border: 1px solid var(--border); outline: 0; resize: vertical; }
.dialog-fields input:focus, .dialog-fields textarea:focus { border-color: rgba(156,255,135,.52); box-shadow: 0 0 0 4px rgba(15,143,90,.14); }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes panelIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes slideInLeft { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes dropIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes messageIn { from { opacity: 0; transform: translateY(5px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes callPulse { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes menuPop { from { opacity: 0; transform: translateY(-6px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes recordPulse { 70% { box-shadow: 0 0 0 9px rgba(255,79,79,0); } 100% { box-shadow: 0 0 0 0 rgba(255,79,79,0); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* WizME Pine redesign: shared brand, strict web shell. */
:root {
  --primary: #58c77a;
  --primary-strong: #399e5b;
  --secondary: #78d694;
  --bg: #0b100d;
  --surface: #101713;
  --surface-2: #151e18;
  --text: #e8f0ea;
  --muted: #91a396;
  --accent: #58c77a;
  --message-me: #28643d;
  --message-peer: #151e18;
  --danger: #e06161;
  --border: #27362c;
  --shadow: 0 14px 34px rgba(0, 0, 0, .24);
  --ease-smooth: cubic-bezier(.2, 0, 0, 1);
  --ease-soft: cubic-bezier(.2, 0, 0, 1);
}
body.light-theme {
  --primary: #338f53;
  --primary-strong: #286f41;
  --secondary: #5eaa76;
  --bg: #dfe7e1;
  --surface: #e8eee9;
  --surface-2: #d5dfd7;
  --text: #17221a;
  --muted: #607064;
  --accent: #286f41;
  --message-me: #acd2b8;
  --message-peer: #e5ebe6;
  --danger: #bd4949;
  --border: #b7c5ba;
  --shadow: 0 10px 26px rgba(35, 59, 42, .12);
}
button { background: var(--primary); border: 0; border-radius: 10px; font-weight: 700; transition: transform .18s var(--ease-smooth), background .18s ease, opacity .18s ease; }
button:hover { transform: translateY(-2px); filter: none; }
button:active { transform: translateY(0) scale(.97); }
button.ghost { background: var(--surface); }
.auth-shell { background: radial-gradient(circle at 16% 14%, rgba(88,199,122,.15), transparent 30%), radial-gradient(circle at 84% 88%, rgba(88,199,122,.08), transparent 32%), var(--bg); }
.auth-panel, .sidebar, .settings-panel, .dialog-card, .profile-card, .call-window { background: var(--surface); border-color: var(--border); border-radius: 12px; box-shadow: var(--shadow); backdrop-filter: none; }
.brand-mark, .empty-logo, .avatar, .call-avatar-stage { background: linear-gradient(145deg, var(--primary), #245f38); font-weight: 700; }
.messenger { grid-template-columns: minmax(320px, 370px) 1fr; gap: 1px; background: var(--border); }
.sidebar { margin: 0; padding: 12px; border-width: 0 1px 0 0; border-radius: 0; box-shadow: none; }
.chat-pane { background-color: var(--bg); }
.search-box, .auth-panel input, .chat-search-panel input, .profile-grid input, .profile-grid textarea, .dialog-fields input, .dialog-fields textarea { background: var(--bg); border-color: var(--border); border-radius: 9px; }
.folder-tab { border-radius: 8px; background: var(--surface-2); border-color: var(--border); font-weight: 600; }
.folder-tab.active, .chat-item.active { color: var(--text); background: #203c2a; border-color: #315e40; }
.chat-item, .contact-item { border-radius: 9px; }
.chat-header, .composer { background: color-mix(in srgb, var(--surface) 92%, transparent); border-color: var(--border); box-shadow: var(--shadow); }
.bubble { border: 1px solid var(--border); border-radius: 11px 11px 11px 4px; box-shadow: none; animation: messagePeerIn .22s var(--ease-soft) both; }
.bubble.me { background: var(--message-me); border-color: #34784a; border-radius: 11px 11px 4px 11px; animation-name: messageMeIn; }
.notice, .voice-room-bar { background: #14261a; border-color: #294c34; }
.compose-fab { box-shadow: 0 12px 28px rgba(88,199,122,.22); }
.settings-avatar { background: linear-gradient(145deg, var(--primary), #245f38); }
.panel-search { background: var(--bg); border: 1px solid var(--border); color: var(--accent); }
.notify-section h3, .peer-card-title, .cache-head button, .notify-enable { color: var(--accent) !important; }
.toggle-row input:checked + span { background: var(--primary); }
.range-row input, .radio-row input { accent-color: var(--primary); }
.theme-swatch.active { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(88,199,122,.18); }

@keyframes fadeIn { from { opacity: 0; transform: scale(.992); } to { opacity: 1; transform: none; } }
@keyframes panelIn { from { opacity: .86; transform: translateY(8px) scale(.995); } to { opacity: 1; transform: none; } }
@keyframes slideInLeft { from { opacity: .88; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
@keyframes slideInRight { from { opacity: .88; transform: translateX(12px); } to { opacity: 1; transform: none; } }
@keyframes fadeUp { from { opacity: .88; transform: translateY(7px); } to { opacity: 1; transform: none; } }
@keyframes dropIn { from { opacity: .88; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes riseIn { from { opacity: .88; transform: translateY(7px); } to { opacity: 1; transform: none; } }
@keyframes messagePeerIn { from { opacity: .9; transform: translateX(-8px) scale(.995); } to { opacity: 1; transform: none; } }
@keyframes messageMeIn { from { opacity: .9; transform: translateX(8px) scale(.995); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateX(18px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes callPulse { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes menuPop { from { opacity: 0; transform: translateY(-8px) scale(.97); transform-origin: top; } to { opacity: 1; transform: none; } }

.auth-panel { animation-duration: .28s; animation-timing-function: var(--ease-smooth); }
.sidebar { animation-duration: .24s; animation-timing-function: var(--ease-smooth); }
.chat-header, .composer, .voice-record-panel, .upload-queue { animation-duration: .22s; animation-timing-function: var(--ease-smooth); }
.side-menu, .menu-more-panel, .compose-menu, .chat-actions-menu, .message-context-menu, .settings-dots-menu { animation-duration: .18s; animation-timing-function: var(--ease-smooth); }
.settings-panel, .peer-profile-panel, .profile-card, .dialog-card, .screen-quality-card, .call-window, .call-card { animation-duration: .24s; animation-timing-function: var(--ease-smooth); }
.toast { animation-duration: .22s; animation-timing-function: var(--ease-smooth); }
.global-search-results, .empty-card { animation-duration: .2s; animation-timing-function: var(--ease-smooth); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .12s !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

@media (max-width: 820px) {
  body { overflow: hidden; }
  .messenger { grid-template-columns: 1fr; }
  .sidebar { margin: 0; border-radius: 0; height: 100vh; }
  .chat-pane { display: none; }
  .messenger.chat-open .sidebar { display: none; }
  .messenger.chat-open .chat-pane { display: block; height: 100vh; }
  .chat-header, .composer, .chat-search-panel, .reply-preview, .upload-queue, .voice-record-panel { left: 10px; right: 10px; max-width: none; }
  .chat-search-panel { top: 76px; }
  .messages { padding-left: 10px; padding-right: 10px; }
  .side-menu { left: 10px; right: 10px; width: auto; top: 58px; }
  .menu-more-panel { position: static; width: auto; margin-top: 2px; }
  .compose-menu { left: auto; right: 76px; bottom: 80px; }
  .settings-panel { left: 0; top: 0; bottom: 0; width: min(390px, 100vw); border-radius: 0; }
  .peer-profile-panel { top: 0; right: 0; bottom: 0; width: min(390px, 100vw); border-radius: 0; }
  .profile-backdrop { padding: 10px; align-items: end; }
  .profile-card { max-height: calc(100vh - 20px); overflow: auto; border-radius: 18px 18px 0 0; }
  .profile-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; padding-right: 0; }
  .profile-grid, .profile-actions { grid-template-columns: 1fr; }
  .toast-host { left: 12px; right: 12px; }
  .toast { min-width: 0; max-width: none; }
}

@media (max-width: 560px) {
  .sidebar { padding: 12px 10px calc(18px + env(safe-area-inset-bottom)); }
  .side-top { grid-template-columns: 42px 1fr; position: sticky; top: 0; z-index: 3; background: rgba(13,24,19,.96); padding-bottom: 10px; }
  .notice { margin: 2px 0 8px; }
  .chat-list { padding-bottom: 86px; }
  .contacts-title, .contacts { display: none; }
  .chat-item { min-height: 68px; grid-template-columns: 52px minmax(0,1fr) auto; padding: 10px 8px; }
  .chat-header { top: 8px; height: 58px; grid-template-columns: 42px minmax(0,1fr) auto; padding: 7px 8px; border-radius: 18px; }
  .chat-header-actions .icon-btn { width: 34px; height: 34px; font-size: 17px; }
  .messages { padding: 78px 9px calc(86px + env(safe-area-inset-bottom)); gap: 7px; }
  .bubble { max-width: min(86%, 420px); }
  .composer { bottom: calc(10px + env(safe-area-inset-bottom)); height: 52px; grid-template-columns: 42px 1fr 38px 38px 42px; border-radius: 18px; }
  #messageInput { min-width: 0; }
  .reply-preview { bottom: calc(70px + env(safe-area-inset-bottom)); border-radius: 14px; }
  .upload-queue { bottom: calc(70px + env(safe-area-inset-bottom)); }
  .voice-record-panel { bottom: calc(70px + env(safe-area-inset-bottom)); grid-template-columns: 12px auto 1fr auto; border-radius: 14px; }
  .voice-record-panel span:not(.record-dot) { display: none; }
  .compose-fab { right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); }
  .settings-panel, .peer-profile-panel { width: 100vw; max-width: none; }
  .profile-card { width: 100%; max-height: calc(100dvh - 16px); }
  .profile-quick-actions { grid-template-columns: 1fr; }
  .call-window { left: 10px; right: 10px; top: auto; bottom: calc(12px + env(safe-area-inset-bottom)); width: auto; border-radius: 18px; }
  .call-window.minimized { left: 10px; right: 10px; width: auto; }
  .call-media-stage { min-height: 160px; }
  .call-media-stage video { height: 170px; }
  .call-window-actions { grid-template-columns: 46px 46px 1fr; }
}
