:root {
  --bg: #0a1119;
  --panel: #111b25;
  --panel-2: #182533;
  --panel-3: #1f2e3f;
  --text: #edf4fb;
  --muted: #90a8bd;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #3aa8ff;
  --accent-2: #238fe2;
  --accent-soft: rgba(58, 168, 255, 0.16);
  --my-msg: #23486a;
  --other-msg: #162432;
  --danger: #ff4d67;
  --radius: 12px;
  --surface-blur: blur(12px);
  --surface-alpha: 0.86;
  --item-gap: 8px;
  --pad-y: 10px;
  --speed: 220ms;
  --msg-duration: 0.2s;
  --font-scale: 1;
  --msg-max: min(72%, 580px);
  --msg-corner-me: 8px;
  --msg-corner-other: 8px;
  --panel-tilt-x: 0deg;
  --panel-tilt-y: 0deg;
  --cursor-x: 50%;
  --cursor-y: 50%;
  --scroll-glow: 0;
}

body[data-theme="purple"] {
  --bg: #0e0a19;
  --panel: #17112a;
  --panel-2: #1f1635;
  --panel-3: #281c45;
  --accent: #956bff;
  --accent-2: #7d53ef;
  --accent-soft: rgba(149, 107, 255, 0.18);
  --my-msg: #4c317c;
  --other-msg: #1d1731;
}

body[data-theme="light"] {
  --bg: #dbe7f2;
  --panel: #ffffff;
  --panel-2: #f4f8fc;
  --panel-3: #ebf2fa;
  --text: #1f2d3a;
  --muted: #62809a;
  --line: rgba(0, 0, 0, 0.09);
  --accent: #3390ec;
  --accent-2: #1e7acf;
  --accent-soft: rgba(51, 144, 236, 0.18);
  --my-msg: #d2e9ff;
  --other-msg: #edf3f9;
}

body[data-theme="red"] {
  --bg: #13090c;
  --panel: #1f1014;
  --panel-2: #2a141b;
  --panel-3: #351b24;
  --text: #ffeef3;
  --muted: #d6aeb8;
  --line: rgba(255, 173, 191, 0.14);
  --accent: #ff4b6a;
  --accent-2: #e33857;
  --accent-soft: rgba(255, 75, 106, 0.2);
  --my-msg: #5b2330;
  --other-msg: #231119;
  --danger: #ff2349;
}

body[data-theme="neon"] {
  --bg: #050913;
  --panel: #0b1020;
  --panel-2: #111a32;
  --panel-3: #172346;
  --text: #e5f9ff;
  --muted: #83acc9;
  --line: rgba(99, 208, 255, 0.16);
  --accent: #42d6ff;
  --accent-2: #26bee9;
  --accent-soft: rgba(66, 214, 255, 0.16);
  --my-msg: #0f415a;
  --other-msg: #101b2c;
}

body[data-theme="amoled"] {
  --bg: #000000;
  --panel: #060606;
  --panel-2: #101010;
  --panel-3: #181818;
  --text: #f2f2f2;
  --muted: #a8a8a8;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #4da6ff;
  --accent-2: #2f8ae6;
  --accent-soft: rgba(77, 166, 255, 0.2);
  --my-msg: #12355c;
  --other-msg: #111111;
}

body[data-theme="sunset"] {
  --bg: #140b18;
  --panel: #1f1126;
  --panel-2: #291633;
  --panel-3: #351d42;
  --text: #fff0f8;
  --muted: #d9b2c8;
  --line: rgba(255, 188, 214, 0.14);
  --accent: #ff8a86;
  --accent-2: #ff68be;
  --accent-soft: rgba(255, 138, 190, 0.18);
  --my-msg: #5a2849;
  --other-msg: #2a1830;
}

body[data-theme="forest"] {
  --bg: #0a1410;
  --panel: #102019;
  --panel-2: #163025;
  --panel-3: #1f3f31;
  --text: #e8f5ee;
  --muted: #a3ccb4;
  --line: rgba(141, 209, 171, 0.16);
  --accent: #38c992;
  --accent-2: #23ad77;
  --accent-soft: rgba(56, 201, 146, 0.16);
  --my-msg: #184f3b;
  --other-msg: #152c23;
}

body[data-theme="cyberpunk"] {
  --bg: #060510;
  --panel: #0c0f1f;
  --panel-2: #13182f;
  --panel-3: #1b2342;
  --text: #f2f4ff;
  --muted: #a4aed8;
  --line: rgba(125, 140, 255, 0.16);
  --accent: #8469ff;
  --accent-2: #39d5ff;
  --accent-soft: rgba(132, 105, 255, 0.18);
  --my-msg: #262a66;
  --other-msg: #171c39;
}

body[data-theme="spiderman"] {
  --bg: #060c19;
  --panel: #0e1a2e;
  --panel-2: #13243e;
  --panel-3: #18315a;
  --text: #f1f6ff;
  --muted: #aac0df;
  --line: rgba(138, 185, 255, 0.18);
  --accent: #e53935;
  --accent-2: #1e88e5;
  --accent-soft: rgba(30, 136, 229, 0.2);
  --my-msg: #9d232f;
  --other-msg: #17335a;
}

body[data-theme="symbiote"] {
  --bg: #020304;
  --panel: #0a0b0e;
  --panel-2: #11141b;
  --panel-3: #1a1e28;
  --text: #e7edf8;
  --muted: #95a2bb;
  --line: rgba(168, 188, 226, 0.14);
  --accent: #f5f7fa;
  --accent-2: #6f7d97;
  --accent-soft: rgba(175, 192, 225, 0.14);
  --my-msg: #2b2f39;
  --other-msg: #181c25;
}

body[data-density="compact"] {
  --item-gap: 4px;
  --pad-y: 8px;
  --radius: 10px;
}

body[data-density="comfy"] {
  --item-gap: 12px;
  --pad-y: 12px;
  --radius: 14px;
}

body[data-motion="off"] {
  --speed: 0ms;
  --msg-duration: 0ms;
}

body[data-motion="hyper"] {
  --speed: 320ms;
  --msg-duration: 0.36s;
}

body[data-font="sm"] {
  --font-scale: 0.92;
}

body[data-font="lg"] {
  --font-scale: 1.08;
}

body[data-chat-width="tight"] {
  --msg-max: min(62%, 510px);
}

body[data-chat-width="wide"] {
  --msg-max: min(86%, 760px);
}

body[data-bubble="telegram"] {
  --msg-corner-me: 4px;
  --msg-corner-other: 4px;
}

body[data-bubble="square"] {
  --radius: 8px;
  --msg-corner-me: 2px;
  --msg-corner-other: 2px;
}

body[data-glass="off"] {
  --surface-blur: blur(0px);
  --surface-alpha: 1;
}

body[data-sidebar-alpha="solid"] {
  --surface-alpha: 1;
}

body[data-sidebar-alpha="clear"] {
  --surface-alpha: 0.64;
}

body[data-avatar-size="sm"] {
  --avatar-list: 28px;
  --avatar-mini: 36px;
}

body[data-avatar-size="md"] {
  --avatar-list: 34px;
  --avatar-mini: 44px;
}

body[data-avatar-size="lg"] {
  --avatar-list: 40px;
  --avatar-mini: 52px;
}

body[data-compact-actions="on"] .msgActions button,
body[data-compact-actions="on"] .miniBtn {
  padding: 3px 6px;
  font-size: 11px;
}

body[data-hide-rail="on"] .appShell {
  grid-template-columns: 0 320px 1fr;
}

body[data-hide-rail="on"] .serverRail {
  width: 0;
  padding: 0;
  overflow: hidden;
  border-right: none;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", "Inter", sans-serif;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  font-size: calc(15px * var(--font-scale));
}

.hidden {
  display: none !important;
}

.appShell {
  display: grid;
  grid-template-columns: 72px 320px 1fr;
  width: 100%;
  height: 100vh;
}

body[data-settings-mode="on"] .appShell {
  grid-template-columns: 72px minmax(0, 1fr) 0;
}

body[data-settings-mode="on"] .chatPanel {
  display: none;
}

body[data-settings-mode="on"] .sidebar {
  border-right: none;
  padding: 14px;
}

body[data-settings-mode="on"] #sectionSettings {
  padding-right: 0;
  flex: 1;
  height: 100%;
  min-height: 0;
  overflow: auto;
}

body[data-settings-mode="on"] .settingsV2 {
  max-width: 1100px;
  margin: 0 auto;
}

.serverRail {
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 70%, black 30%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 10px;
}

.serverBtn {
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 16px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  transition: transform var(--speed) ease, border-radius var(--speed) ease,
    background var(--speed) ease;
}

.serverBtn:hover {
  transform: translateY(-2px) scale(1.03);
  background: var(--panel-3);
}

.serverBtn.active {
  border-radius: 13px;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 10px 20px color-mix(in srgb, var(--accent) 34%, transparent);
  animation: orbPulse 2.2s ease-in-out infinite;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) calc(var(--surface-alpha) * 100%), transparent);
  backdrop-filter: var(--surface-blur);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 10px;
  gap: var(--item-gap);
}

.mainMenu {
  display: flex;
  gap: 6px;
  background: transparent;
  border-radius: 12px;
  padding: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.mainMenu::-webkit-scrollbar {
  display: none;
}

.menuTab {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  padding: 7px 11px;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--speed) ease, color var(--speed) ease, border-color var(--speed) ease;
}

.sectionHeaderRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 2px;
}

.sectionHeaderRow h4 {
  font-size: 13px;
  color: var(--text);
}

.subBadge {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel-2) 78%, transparent);
  color: var(--muted);
  border-radius: 999px;
  font-size: 11px;
  padding: 4px 9px;
}

.menuTab:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 28%, var(--line));
}

.menuTab.active {
  background: color-mix(in srgb, var(--accent) 18%, var(--panel-2));
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 44%, var(--line));
}

.profileMini {
  border: none;
  width: 100%;
  background: transparent;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius);
  padding: var(--pad-y) 10px;
  transition: var(--speed) ease;
}

.profileMini:hover {
  background: rgba(255, 255, 255, 0.05);
}

.profileMini img {
  width: var(--avatar-mini, 44px);
  height: var(--avatar-mini, 44px);
  border-radius: 50%;
  object-fit: cover;
  background: var(--panel-2);
}

.profileText {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.profileText #miniName {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profileText small {
  color: var(--muted);
  font-size: 12px;
}

.searchWrap {
  padding: 0 4px;
}

.quickHub {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 4px;
  scrollbar-width: none;
}

.onlineHub {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel-2) 84%, transparent);
  padding: 8px 10px;
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}

.onlineHubRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.onlineHubRow b {
  color: var(--text);
}

.onlineUsersList {
  font-size: 11px;
  color: var(--muted);
  border-top: 1px dashed color-mix(in srgb, var(--line) 82%, transparent);
  padding-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quickHub::-webkit-scrollbar {
  display: none;
}

.hubChip {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel-2) 82%, transparent);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--speed) ease, border-color var(--speed) ease, background var(--speed) ease;
}

.hubChip:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 46%, var(--line));
  background: color-mix(in srgb, var(--accent) 16%, var(--panel-2));
}

.kpiRow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.kpiCard {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel-2) 78%, transparent);
  padding: 7px 8px;
  display: grid;
  gap: 3px;
}

.kpiCard small {
  color: var(--muted);
  font-size: 11px;
}

.kpiCard b {
  color: var(--text);
  font-size: 14px;
}

.sectionPane {
  min-height: 0;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
  animation: paneIn var(--speed) ease;
}

#sectionSettings {
  overflow: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

#sectionSettings,
.usersList,
.callsList,
.mediaList,
.chatList {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--accent) 40%, transparent) transparent;
}

#sectionSettings::-webkit-scrollbar,
.usersList::-webkit-scrollbar,
.callsList::-webkit-scrollbar,
.mediaList::-webkit-scrollbar,
.chatList::-webkit-scrollbar {
  width: 10px;
}

#sectionSettings::-webkit-scrollbar-thumb,
.usersList::-webkit-scrollbar-thumb,
.callsList::-webkit-scrollbar-thumb,
.mediaList::-webkit-scrollbar-thumb,
.chatList::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--accent) 35%, var(--panel-2));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

#search,
#text,
#nameInput,
#bioInput,
#themeSelect,
#densitySelect,
#motionSelect,
#fontSizeSelect,
#chatWidthSelect,
#bubbleStyleSelect,
#wallpaperSelect,
#composerPositionSelect,
#sidebarAlphaSelect,
#avatarSizeSelect,
#avatarInput,
#autoDeleteSelect,
#chatPinInput,
#planText,
#planChatSelect,
#planDateTime,
#plannerModeSelect {
  width: 100%;
  border: 1px solid transparent;
  background: var(--panel-2);
  color: var(--text);
  border-radius: var(--radius);
  padding: calc(var(--pad-y) + 1px) 12px;
  outline: none;
  transition: 0.2s ease;
}

#text {
  resize: none;
  min-height: 42px;
  max-height: 132px;
  line-height: 1.35;
}

#search:focus,
#text:focus,
#nameInput:focus,
#bioInput:focus,
#themeSelect:focus,
#densitySelect:focus,
#motionSelect:focus,
#fontSizeSelect:focus,
#chatWidthSelect:focus,
#bubbleStyleSelect:focus,
#wallpaperSelect:focus,
#composerPositionSelect:focus,
#sidebarAlphaSelect:focus,
#avatarSizeSelect:focus,
#avatarInput:focus,
#autoDeleteSelect:focus,
#chatPinInput:focus,
#planText:focus,
#planChatSelect:focus,
#planDateTime:focus,
#plannerModeSelect:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.chatList {
  overflow: auto;
  flex: 1;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: var(--item-gap);
}

.chatItem {
  border-radius: var(--radius);
  padding: var(--pad-y) 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  transition: transform var(--speed) ease, background var(--speed) ease,
    box-shadow var(--speed) ease;
}

.chatItem:hover {
  background: rgba(255, 255, 255, 0.06);
}

.chatItem.active {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.chatItem:hover {
  transform: translateX(2px);
}

.chatItem {
  position: relative;
  overflow: hidden;
}

.chatItem::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 10%, rgba(255, 255, 255, 0.08) 50%, transparent 90%);
  transform: translateX(-120%);
  transition: transform 0.45s ease;
  pointer-events: none;
}

.chatItem:hover::after {
  transform: translateX(120%);
}

.chatMeta {
  min-width: 0;
}

.chatMeta b {
  display: block;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chatMeta small {
  color: var(--muted);
  font-size: 12px;
}

.unreadBadge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  display: grid;
  place-items: center;
}

.sidebarBottom {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding-top: 4px;
}

#pinCurrentChatBtn {
  font-size: 12px;
}

.settingsCard {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel-2) 82%, transparent);
  border-radius: calc(var(--radius) + 2px);
  padding: 10px;
  display: grid;
  gap: 10px;
  animation: paneIn var(--speed) ease;
}

.securitySettings {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel-2) 70%, transparent);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.securitySettings h4 {
  font-size: 13px;
  color: var(--text);
}

.settingsV2 {
  display: grid;
  gap: 10px;
}

.settingsHero {
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  padding: 12px;
  background:
    radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 55%),
    color-mix(in srgb, var(--panel-2) 84%, transparent);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.settingsHero h3 {
  font-size: 16px;
  margin-bottom: 4px;
}

.settingsHero p {
  color: var(--muted);
  font-size: 12px;
}

.settingsLayout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  min-height: 0;
}

.settingsNav {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel-2) 76%, transparent);
  padding: 6px;
  display: flex;
  gap: 6px;
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  position: sticky;
  top: 0;
  z-index: 3;
}

#sectionSettings {
  scroll-behavior: smooth;
}

.settingsNav {
  scroll-behavior: smooth;
}

.settingsNav::-webkit-scrollbar {
  display: none;
}

.settingsNav .ghostBtn {
  text-decoration: none;
  text-align: center;
  border-radius: 999px;
  white-space: nowrap;
  padding: 8px 12px;
}

.settingsNav .settingsNavLink {
  border: 1px solid var(--line);
  background: var(--panel-2);
}

.settingsNav .settingsNavLink.active {
  border-color: color-mix(in srgb, var(--accent) 44%, var(--line));
  background: color-mix(in srgb, var(--accent) 18%, var(--panel-2));
  color: var(--text);
}

.settingsGroup {
  scroll-margin-top: 14px;
}

.settingsStack {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.settingsGroup {
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  background: color-mix(in srgb, var(--panel-2) 82%, transparent);
  padding: 10px;
  display: grid;
  gap: 10px;
  animation: paneIn var(--speed) ease;
}

.settingsGroupHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.settingsGroupHead h4 {
  font-size: 14px;
}

.settingGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.settingGrid.oneCol {
  grid-template-columns: 1fr;
}

.settingField {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.settingToggleGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.settingActions {
  display: grid;
  gap: 8px;
}

.pinRow {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.queueRow {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel-2) 74%, transparent);
  padding: 9px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.queueRow b {
  color: var(--text);
}

.dangerBtn {
  background: color-mix(in srgb, var(--danger) 14%, var(--panel-2));
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
}

.dangerBtn:hover {
  background: color-mix(in srgb, var(--danger) 20%, var(--panel-2));
}

.dangerMini {
  background: color-mix(in srgb, var(--danger) 22%, var(--panel-2)) !important;
}

.dangerMini:hover {
  background: color-mix(in srgb, var(--danger) 32%, var(--panel-2)) !important;
}

button,
select,
input {
  font: inherit;
}

.ghostBtn,
#send,
#voiceBtn,
#attachBtn,
#saveProfile,
#closeProfile,
#cancelReply {
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: 0.2s ease;
}

.ghostBtn,
#closeProfile {
  background: var(--panel-2);
  color: var(--text);
  padding: var(--pad-y) 12px;
}

.ghostBtn:hover,
#closeProfile:hover {
  filter: brightness(1.07);
}

.chatPanel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  background: radial-gradient(circle at top right, var(--accent-soft), transparent 38%);
  position: relative;
  transform: perspective(1200px) rotateX(var(--panel-tilt-x)) rotateY(var(--panel-tilt-y));
  transform-origin: center center;
  transition: transform 180ms ease;
}

.chatPanel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 34%),
    radial-gradient(circle at 0% 100%, color-mix(in srgb, var(--accent-2) 12%, transparent), transparent 36%);
  opacity: 0.95;
}

.chatPanel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at var(--cursor-x) var(--cursor-y), color-mix(in srgb, var(--accent) 16%, transparent), transparent 26%),
    radial-gradient(circle at calc(100% - var(--cursor-x)) calc(100% - var(--cursor-y)), color-mix(in srgb, var(--accent-2) 12%, transparent), transparent 30%);
  mix-blend-mode: screen;
  opacity: 0.48;
}

.chatHeader {
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--panel);
}

.chatHeaderActions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.headerToolBtn {
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  border: 1px solid color-mix(in srgb, var(--line) 86%, transparent);
}

.headerToolBtn.active {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 38%, var(--panel-2)), color-mix(in srgb, var(--accent-2) 28%, var(--panel-2)));
  color: #fff;
}

.chatHeaderAvatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--panel-2);
  position: relative;
}

.chatHeaderAvatar::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #29cc5f;
  border: 2px solid var(--panel);
  position: absolute;
  right: -1px;
  bottom: -1px;
}

.chatHeaderText h2 {
  font-size: 16px;
  line-height: 1.1;
}

.chatHeaderText p {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.connectionBanner {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 95%, transparent);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}

.connectionBanner[data-state="online"] {
  box-shadow: inset 3px 0 0 #26c96f;
}

.connectionBanner[data-state="syncing"] {
  box-shadow: inset 3px 0 0 #f2c84b;
}

.connectionBanner[data-state="degraded"] {
  box-shadow: inset 3px 0 0 #ff8a3d;
}

.connectionBanner[data-state="offline"] {
  box-shadow: inset 3px 0 0 #ff5c67;
}

.pinnedBar {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  padding: 8px 16px;
  font-size: 13px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.pinnedBar span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.messages {
  overflow: auto;
  min-height: 0;
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: calc(var(--item-gap) + 2px);
  background: linear-gradient(
      rgba(255, 255, 255, 0.015),
      rgba(255, 255, 255, 0.015)
    ),
    var(--bg);
  position: relative;
}

.messages::before,
.messages::after {
  content: "";
  position: sticky;
  left: 0;
  width: 100%;
  height: 24px;
  display: block;
  pointer-events: none;
  z-index: 1;
}

.messages::before {
  top: 0;
  margin-bottom: -24px;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 86%, transparent), transparent);
  opacity: calc(0.35 + var(--scroll-glow) * 0.5);
}

.messages::after {
  bottom: 0;
  margin-top: -24px;
  background: linear-gradient(to top, color-mix(in srgb, var(--bg) 88%, transparent), transparent);
  opacity: calc(0.3 + var(--scroll-glow) * 0.6);
}

body[data-wallpaper="aurora"] .messages {
  background:
    radial-gradient(circle at 12% 18%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 40%),
    radial-gradient(circle at 84% 12%, color-mix(in srgb, var(--accent-2) 22%, transparent), transparent 42%),
    linear-gradient(rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0.015)),
    var(--bg);
}

body[data-wallpaper="grid"] .messages {
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    var(--bg);
  background-size: 24px 24px, 24px 24px, auto;
}

body[data-wallpaper="dots"] .messages {
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.12) 1px, transparent 1px),
    var(--bg);
  background-size: 18px 18px;
}

body[data-wallpaper="plain"] .messages {
  background: var(--bg);
}

body[data-wallpaper="mesh"] .messages {
  background:
    radial-gradient(circle at 20% 22%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 38%),
    radial-gradient(circle at 80% 78%, color-mix(in srgb, var(--accent-2) 16%, transparent), transparent 40%),
    linear-gradient(120deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01)),
    var(--bg);
}

body[data-wallpaper="noise"] .messages {
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    radial-gradient(circle, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    var(--bg);
  background-size: 7px 7px, 11px 11px, auto;
  background-position: 0 0, 3px 5px, 0 0;
}

.msg {
  max-width: var(--msg-max);
  padding: var(--pad-y) 12px;
  border-radius: calc(var(--radius) + 2px);
  line-height: 1.4;
  animation: msgIn var(--msg-duration) cubic-bezier(0.2, 0.7, 0, 1);
  word-wrap: break-word;
  position: relative;
  transform-origin: bottom left;
  transition: transform var(--speed) ease, box-shadow var(--speed) ease,
    filter var(--speed) ease;
  backdrop-filter: blur(4px) saturate(1.05);
}

.msg.selected {
  outline: 2px solid color-mix(in srgb, var(--accent) 52%, transparent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

.msg.me {
  align-self: end;
  background: var(--my-msg);
  border-bottom-right-radius: var(--msg-corner-me);
  transform-origin: bottom right;
}

.msg.other {
  align-self: start;
  background: var(--other-msg);
  border-bottom-left-radius: var(--msg-corner-other);
}

.msg:hover {
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  transform: translateY(-2px) scale(1.007);
}

.msg::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(125deg, transparent, rgba(255, 255, 255, 0.065), transparent);
  opacity: 0;
  transition: opacity var(--speed) ease;
}

.msg:hover::after {
  opacity: 1;
}

.msg.me {
  box-shadow: 0 6px 18px color-mix(in srgb, var(--my-msg) 35%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 12%, transparent);
}

.msg.other {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.16);
  border: 1px solid color-mix(in srgb, var(--line) 85%, transparent);
}

.msgHead {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
  font-size: 11px;
  opacity: 0.7;
}

.replyBox {
  font-size: 12px;
  padding: 6px 8px;
  border-left: 3px solid var(--accent);
  background: rgba(255, 255, 255, 0.06);
  margin-bottom: 6px;
  border-radius: 8px;
}

.imgMsg {
  margin-top: 8px;
  max-width: 100%;
  border-radius: 10px;
}

.gifMsg {
  max-height: 240px;
  object-fit: cover;
}

.stickerMsg {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  line-height: 1;
}

img.stickerMsg {
  width: min(140px, 56vw);
  max-height: 140px;
  object-fit: contain;
  padding: 6px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel-2) 78%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
}

.audioMsg {
  margin-top: 8px;
  width: 240px;
  max-width: 100%;
}

.msgActions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.msgActions button {
  border: none;
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
  transition: transform var(--speed) ease, background var(--speed) ease, filter var(--speed) ease;
}

.msgActions button:hover {
  transform: translateY(-1px);
  background: var(--accent-soft);
  filter: brightness(1.06);
}

.reactions {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.threadMeta {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}

.reactItem {
  font-size: 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 2px 8px;
}

.replyPreview {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 16px;
  background: var(--panel);
  font-size: 13px;
  animation: panelSlide var(--speed) ease;
}

.typingHint {
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  color: var(--muted);
  font-size: 11px;
  padding: 4px 12px;
  line-height: 1.25;
  animation: panelSlide var(--speed) ease;
}

.threadBar,
.selectionBar,
.undoBar {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  animation: panelSlide var(--speed) ease;
}

.threadBar,
.selectionBar {
  flex-wrap: wrap;
}

.threadBar #threadTitle {
  font-size: 13px;
  color: var(--muted);
}

.selectionBar b,
.undoBar span {
  font-size: 13px;
}

.selectionActions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.composerDock {
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  backdrop-filter: var(--surface-blur);
  padding: 6px 10px 8px;
  position: sticky;
  bottom: 0;
  z-index: 6;
}

body[data-composer-pos="fixed"] .composerDock {
  position: sticky;
  bottom: 0;
  box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.16);
}

body[data-composer-pos="sticky"] .composerDock {
  position: sticky;
  bottom: 0;
  box-shadow: none;
}

.quickComposerBar {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 0 2px 6px;
}

.quickComposerBar span {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  border-radius: 999px;
  font-size: 12px;
  padding: 4px 10px;
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--speed) ease, color var(--speed) ease,
    border-color var(--speed) ease;
}

.quickComposerBar span:hover {
  transform: translateY(-1px);
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 36%, var(--line));
}

#cancelReply {
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.inputBox {
  display: grid;
  grid-template-columns: 42px 42px 42px 52px 42px 1fr 48px;
  gap: 8px;
  align-items: end;
  padding: 0;
  background: transparent;
}

#text {
  min-width: 0;
}

#attachBtn,
#voiceBtn,
#emojiBtn,
#gifBtn,
#stickerBtn {
  width: 42px;
  height: 42px;
  background: var(--panel-2);
  color: var(--text);
  position: relative;
  overflow: hidden;
}

.mediaActionBtn {
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  background:
    radial-gradient(90% 90% at 70% 10%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 70%),
    linear-gradient(160deg, color-mix(in srgb, var(--panel-2) 78%, #161b25), color-mix(in srgb, var(--panel-2) 56%, #0f131b));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 8px 18px rgba(0, 0, 0, 0.22);
  transition: transform var(--speed) ease, box-shadow var(--speed) ease, border-color var(--speed) ease;
}

.mediaActionBtn:hover {
  transform: translateY(-1px) scale(1.02);
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 10px 22px rgba(0, 0, 0, 0.28);
}

.mediaActionBtn:active {
  transform: translateY(0) scale(0.98);
}

.mediaActionEmoji {
  font-size: 18px;
}

.mediaActionGif {
  width: 52px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
}

.mediaActionSticker {
  font-size: 17px;
}

#emojiBtn {
  font-size: 18px;
}

#gifBtn {
  width: 52px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.mediaPicker {
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel) 92%, transparent), color-mix(in srgb, var(--panel-2) 62%, transparent));
  padding: 10px 14px;
  max-height: 280px;
  overflow: auto;
}

.pickerToolbar {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.pickerSearchRow {
  display: grid;
}

.pickerSearchInput {
  width: 100%;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel-2) 84%, transparent);
  color: var(--text);
  border-radius: 12px;
  height: 34px;
  padding: 0 11px;
  font-size: 13px;
  outline: none;
  transition: border-color var(--speed) ease, box-shadow var(--speed) ease;
}

.pickerSearchInput:focus {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.pickerSearchInput::placeholder {
  color: var(--muted);
}

.pickerPackRow {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pickerPackBtn {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel-2) 82%, transparent);
  color: var(--muted);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  padding: 4px 10px;
  cursor: pointer;
  transition: transform var(--speed) ease, border-color var(--speed) ease, color var(--speed) ease, background var(--speed) ease;
}

.pickerPackBtn:hover {
  transform: translateY(-1px);
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 36%, var(--line));
}

.pickerPackBtn.active {
  color: #fff;
  border-color: color-mix(in srgb, var(--accent) 56%, var(--line));
  background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 78%, #5b64ff), color-mix(in srgb, var(--accent-2) 66%, #c16bff));
}

.pickerUtilityBtn {
  border: 1px dashed color-mix(in srgb, var(--accent) 40%, var(--line));
  background: color-mix(in srgb, var(--panel-2) 76%, transparent);
  color: var(--text);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  cursor: pointer;
}

.pickerUtilityBtn:hover {
  border-style: solid;
  border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
}

.pickerGroup {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
}

.stickerPickerGrid {
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 6px;
}

.pickerItem {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel-2) 82%, transparent);
  color: var(--text);
  min-height: 88px;
  padding: 6px;
  cursor: pointer;
  display: grid;
  grid-template-rows: 66px auto;
  align-items: center;
  justify-items: center;
  gap: 4px;
  transition: transform var(--speed) ease, border-color var(--speed) ease, box-shadow var(--speed) ease;
}

.pickerItem:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 44%, var(--line));
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.22);
}

.pickerItem span {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gifItem {
  font-size: 16px;
}

.gifItem img {
  width: 100%;
  height: 66px;
  object-fit: cover;
  border-radius: 8px;
}

.stickerItem {
  font-size: 24px;
  min-height: 76px;
  grid-template-rows: 58px auto;
  border-radius: 14px;
}

.stickerItem img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.stickerItem span {
  font-size: 10px;
}

.recentStickerItem {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  background: linear-gradient(155deg, color-mix(in srgb, var(--accent) 14%, var(--panel-2)), color-mix(in srgb, var(--panel-2) 84%, transparent));
}

.mediaStickerThumb {
  width: min(120px, 60%);
  max-height: 120px;
  object-fit: contain;
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel-2) 78%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  padding: 6px;
}

body[data-blur-media="on"] .imgMsg,
body[data-blur-media="on"] .mediaItem img {
  filter: blur(12px);
  transition: filter var(--speed) ease;
}

body[data-blur-media="on"] .imgMsg:hover,
body[data-blur-media="on"] .mediaItem img:hover {
  filter: blur(0px);
}

#voiceBtn.recording {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 0 0 0 rgba(255, 77, 103, 0.5);
  animation: pulse 1.1s infinite;
}

#send {
  width: 48px;
  height: 42px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 35%, transparent);
}

#send:hover {
  background: var(--accent-2);
}

#send.editingSend {
  background: color-mix(in srgb, var(--accent) 72%, #2fd08f);
}

.uiSettings {
  display: grid;
  gap: 8px;
  margin-top: 2px;
}

.uiSettings select {
  width: 100%;
}

.usersList,
.callsList {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding-right: 4px;
}

.userCard,
.callCard {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel-2) 80%, transparent);
  border-radius: var(--radius);
  padding: 10px;
  display: grid;
  gap: 8px;
  animation: msgIn var(--msg-duration) ease;
  transition: transform var(--speed) ease, border-color var(--speed) ease,
    box-shadow var(--speed) ease;
}

.userCard:hover,
.callCard:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.2);
}

.userTop,
.callTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.userLeft {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.userAvatar {
  width: var(--avatar-list, 34px);
  height: var(--avatar-list, 34px);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 15px;
  background: var(--panel-3);
}

.statusDot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.statusDot.online {
  background: #32d77a;
  box-shadow: 0 0 0 4px rgba(50, 215, 122, 0.15);
}

.statusDot.offline {
  background: #7f8a93;
}

.userMeta {
  min-width: 0;
}

.userMeta b {
  display: block;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.userMeta small {
  color: var(--muted);
  font-size: 11px;
}

.userActions,
.callActions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.miniBtn {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 9px;
  padding: 6px 9px;
  font-size: 12px;
  cursor: pointer;
}

.callQuickGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.callCard p {
  color: var(--muted);
  font-size: 12px;
}

.mediaList {
  flex: 1;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding-right: 4px;
}

.savedList,
.plannerList {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding-right: 4px;
}

#sectionSaved,
#sectionPlanner,
.savedList,
.plannerList {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--accent) 40%, transparent) transparent;
}

#sectionSaved::-webkit-scrollbar,
#sectionPlanner::-webkit-scrollbar,
.savedList::-webkit-scrollbar,
.plannerList::-webkit-scrollbar {
  width: 10px;
}

#sectionSaved::-webkit-scrollbar-thumb,
#sectionPlanner::-webkit-scrollbar-thumb,
.savedList::-webkit-scrollbar-thumb,
.plannerList::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--accent) 35%, var(--panel-2));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.plannerComposer {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel-2) 70%, transparent);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.plannerComposer label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.plannerComposer button {
  width: 100%;
}

.mediaItem {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel-2) 86%, transparent);
  border-radius: var(--radius);
  padding: 8px;
  display: grid;
  gap: 8px;
  cursor: pointer;
  transition: transform var(--speed) ease, border-color var(--speed) ease,
    box-shadow var(--speed) ease;
}

.mediaItem:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
}

.mediaItem header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.mediaItem header b {
  font-size: 13px;
}

.mediaItem header small {
  color: var(--muted);
  font-size: 11px;
}

.mediaItem img {
  width: 100%;
  border-radius: 10px;
  max-height: 180px;
  object-fit: cover;
}

.mediaItem audio {
  width: 100%;
}

.mediaItem p {
  font-size: 12px;
  color: var(--muted);
}

.mediaEmpty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.chatEmptyState,
.messagesEmptyState {
  background: color-mix(in srgb, var(--panel-2) 84%, transparent);
}

.messagesWindowNotice {
  position: sticky;
  top: 8px;
  z-index: 2;
  align-self: center;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--line));
  background: color-mix(in srgb, var(--panel) 90%, transparent);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
}

.messagesWindowNotice:hover {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
}

.uiSettings label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.toggleLine {
  display: flex !important;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: var(--panel-2);
}

.toggleLine input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 30;
}

.paletteBox {
  width: min(620px, calc(100vw - 24px));
  max-height: min(76vh, 700px);
}

.paletteSearch {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel-2) 88%, transparent);
  color: var(--text);
  height: 40px;
  padding: 0 12px;
  outline: none;
}

.paletteSearch:focus {
  border-color: color-mix(in srgb, var(--accent) 56%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.paletteList {
  display: grid;
  gap: 8px;
  max-height: 48vh;
  overflow: auto;
  padding-right: 4px;
}

.paletteItem {
  text-align: left;
}

body[data-focus-mode="on"] .sidebar,
body[data-focus-mode="on"] .serverRail {
  opacity: 0.18;
  filter: saturate(0.75) blur(1px);
  transition: opacity var(--speed) ease, filter var(--speed) ease;
}

body[data-focus-mode="on"] .chatHeader,
body[data-focus-mode="on"] .composerDock {
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--panel) 86%, transparent);
}

body[data-focus-mode="on"] .messages {
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 46%),
    var(--bg);
}

.profileOverlayShown {
  animation: profileOverlayIn 180ms ease;
}

.profileBox {
  width: min(420px, calc(100vw - 24px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: 16px;
  display: grid;
  gap: 10px;
}

.profileEditorBox {
  width: min(980px, calc(100vw - 24px));
  max-height: min(88vh, 940px);
  overflow: auto;
  gap: 14px;
  background: color-mix(in srgb, var(--panel) 97%, #fff 3%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.26);
  transition: transform var(--speed) ease, box-shadow var(--speed) ease;
}

.profileEditorBox.profileEditorAnimate {
  animation: profileModalIn 220ms ease;
}

.profileEditorBox.profileEditorAnimate::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: calc(var(--radius) + 4px);
  background: linear-gradient(120deg, transparent 0%, color-mix(in srgb, var(--accent) 24%, transparent) 40%, transparent 75%);
  mix-blend-mode: screen;
  opacity: 0.35;
  animation: profileSweep 1.8s ease;
}

.profileEditorLayout {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: 14px;
  align-items: start;
}

.profileEditorForm {
  display: grid;
  gap: 10px;
  background: color-mix(in srgb, var(--panel-2) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  padding: 12px;
  animation: riseIn 380ms cubic-bezier(0.2, 0.78, 0, 1);
}

.profileAvatarRow {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  background: color-mix(in srgb, var(--panel-2) 94%, transparent);
}

.profileAvatarActions {
  display: grid;
  gap: 8px;
}

.profileFieldLabel {
  display: grid;
  gap: 6px;
  border: 1px solid color-mix(in srgb, var(--line) 92%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel-2) 96%, transparent);
  padding: 8px;
  transition: border-color var(--speed) ease, box-shadow var(--speed) ease;
  animation: fieldPop 320ms ease both;
}

.profileEditorForm .profileFieldLabel:nth-of-type(1) { animation-delay: 40ms; }
.profileEditorForm .profileFieldLabel:nth-of-type(2) { animation-delay: 80ms; }
.profileEditorForm .profileFieldLabel:nth-of-type(3) { animation-delay: 120ms; }
.profileEditorForm .profileFieldLabel:nth-of-type(4) { animation-delay: 160ms; }
.profileEditorForm .profileFieldLabel:nth-of-type(5) { animation-delay: 200ms; }

.profileFieldLabel:focus-within {
  border-color: color-mix(in srgb, var(--accent) 46%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 24%, transparent);
}

.profileFieldLabel > span {
  font-size: 12px;
  color: var(--muted);
}

.profileGrid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.profileLivePreview {
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  background: color-mix(in srgb, var(--panel-2) 96%, transparent);
  padding: 12px;
  display: grid;
  gap: 10px;
  position: sticky;
  top: 0;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 72%, transparent);
  animation: floatSoft 2.6s ease-in-out infinite;
}

.previewCard {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  transition: transform var(--speed) ease, box-shadow var(--speed) ease, border-color var(--speed) ease;
  animation: riseIn 420ms cubic-bezier(0.2, 0.78, 0, 1);
}

.previewCard:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 24%, transparent);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
  animation: pulseGlow 1.1s ease-in-out infinite;
}

.previewAvatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
  transition: transform var(--speed) ease, filter var(--speed) ease;
}

.previewCard:hover .previewAvatar {
  transform: scale(1.02);
  filter: saturate(1.02);
}

.previewMeta {
  display: grid;
  gap: 4px;
}

.previewMeta p {
  font-size: 12px;
  color: var(--muted);
}

.profileBox h3 {
  font-size: 18px;
}

.bigAvatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--panel-2);
  border: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
  transition: transform var(--speed) ease, box-shadow var(--speed) ease, border-color var(--speed) ease;
}

.bigAvatar:hover {
  transform: translateY(-1px) scale(1.015);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.profileAvatarRow:hover .bigAvatar {
  animation: avatarBreath 1.6s ease-in-out infinite;
}

.profileActions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.profileActions button {
  transition: transform var(--speed) ease, box-shadow var(--speed) ease, border-color var(--speed) ease;
}

.profileActions button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.14);
}

.profileActions button {
  animation: riseIn 360ms cubic-bezier(0.2, 0.78, 0, 1) both;
}

.profileActions button:nth-child(1) { animation-delay: 80ms; }
.profileActions button:nth-child(2) { animation-delay: 130ms; }
.profileActions button:nth-child(3) { animation-delay: 180ms; }

#saveProfile {
  position: relative;
  overflow: hidden;
}

#saveProfile::after {
  content: "";
  position: absolute;
  top: -120%;
  left: -30%;
  width: 42%;
  height: 300%;
  transform: rotate(25deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.38), transparent);
  animation: ctaShine 2.8s ease-in-out infinite;
}

.menuTab.active {
  animation: tabPulse 1.8s ease-in-out infinite;
}

.profileActions button:active {
  transform: translateY(0);
}

#saveProfile {
  background: var(--accent);
  color: #fff;
  padding: 10px 12px;
}

#bioInput {
  min-height: 96px;
  resize: vertical;
}

.profileEditorBox input,
.profileEditorBox textarea,
.profileEditorBox button {
  will-change: transform;
}

.profileEditorBox input,
.profileEditorBox textarea {
  background: color-mix(in srgb, var(--panel-2) 96%, transparent) !important;
  border: 1px solid color-mix(in srgb, var(--line) 92%, transparent) !important;
  color: var(--text);
}

.profileEditorBox input::placeholder,
.profileEditorBox textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 88%, transparent);
}

#displayNameInput,
#cityInput,
#birthInput {
  background: color-mix(in srgb, var(--panel-2) 96%, transparent) !important;
}

#birthInput {
  color-scheme: dark;
}

#birthInput::-webkit-datetime-edit,
#birthInput::-webkit-datetime-edit-text,
#birthInput::-webkit-datetime-edit-month-field,
#birthInput::-webkit-datetime-edit-day-field,
#birthInput::-webkit-datetime-edit-year-field {
  color: var(--text);
  background: transparent;
}

#birthInput::-webkit-calendar-picker-indicator {
  filter: invert(0.82);
  opacity: 0.9;
}

@keyframes profileOverlayIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes profileModalIn {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.995);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fieldPop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes floatSoft {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
  }
  50% {
    box-shadow: 0 12px 28px color-mix(in srgb, var(--accent) 24%, rgba(0, 0, 0, 0.2));
  }
}

@keyframes avatarBreath {
  0%, 100% { transform: translateY(-1px) scale(1.015); }
  50% { transform: translateY(-2px) scale(1.03); }
}

@keyframes ctaShine {
  0%, 70% { left: -40%; opacity: 0; }
  75% { opacity: 0.8; }
  100% { left: 130%; opacity: 0; }
}

@keyframes tabPulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); }
  50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 18%, transparent); }
}

@keyframes profileSweep {
  from { transform: translateX(-28%); opacity: 0; }
  30% { opacity: 0.35; }
  to { transform: translateX(45%); opacity: 0; }
}

@media (max-width: 840px) {
  .profileEditorLayout {
    grid-template-columns: 1fr;
  }

  .profileLivePreview {
    position: static;
  }

  .profileGrid2 {
    grid-template-columns: 1fr;
  }

  .profileActions {
    grid-template-columns: 1fr;
  }
}

.toastContainer {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msgMenu {
  position: fixed;
  z-index: 70;
  min-width: 210px;
  max-width: min(280px, calc(100vw - 16px));
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  backdrop-filter: var(--surface-blur);
  border-radius: 12px;
  padding: 6px;
  display: grid;
  gap: 4px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
}

.msgMenu button {
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  border-radius: 8px;
  padding: 8px 9px;
  cursor: pointer;
  font-size: 13px;
}

.msgMenu button:hover {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
}

.msgMenu button[data-action="delete"] {
  color: #ff8c9b;
}

.forwardBox {
  width: min(460px, calc(100vw - 20px));
}

.forwardChats {
  max-height: 260px;
  overflow: auto;
  display: grid;
  gap: 8px;
}

.undoBar {
  position: sticky;
  bottom: 0;
  z-index: 7;
}

.forwardItem {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  padding: 9px 10px;
  font-size: 13px;
  cursor: pointer;
}

.forwardItem.active {
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  background: var(--accent-soft);
}

.dropActive {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 52%, transparent);
}

.toast {
  min-width: 240px;
  max-width: 340px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius);
  padding: 10px 12px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
  animation: toastIn var(--msg-duration) ease;
}

.toast b {
  display: block;
  font-size: 13px;
}

.toast span {
  font-size: 12px;
  color: var(--muted);
}

.pinLabel {
  font-size: 11px;
  color: #f3c948;
  margin-bottom: 4px;
}

.editedMark {
  margin-top: 6px;
  font-size: 11px;
  opacity: 0.72;
}

.deliveryMark {
  margin-top: 6px;
  font-size: 11px;
  opacity: 0.82;
}

.deliveryMark.pending {
  color: #fbbf24;
}

.deliveryMark.sent {
  color: #93c5fd;
}

.deliveryMark.read {
  color: #4ade80;
}

.deliveryMark.failed {
  color: #fb7185;
}

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
}

@keyframes glowEnter {
  from {
    opacity: 0;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  }
  to {
    opacity: 1;
    box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 20%, transparent);
  }
}

@keyframes floatIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.composerDock,
.chatHeader,
.settingsCard,
.settingsGroup,
.userCard,
.callCard {
  animation: floatIn var(--speed) cubic-bezier(0.2, 0.75, 0, 1);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes panelSlide {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 77, 103, 0.45);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(255, 77, 103, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 77, 103, 0);
  }
}

@keyframes paneIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

@keyframes orbPulse {
  0%,
  100% {
    box-shadow: 0 10px 20px color-mix(in srgb, var(--accent) 34%, transparent);
  }
  50% {
    box-shadow: 0 14px 30px color-mix(in srgb, var(--accent) 42%, transparent);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 920px) {
  .appShell {
    grid-template-columns: 62px 132px 1fr;
  }

  .mainMenu,
  .serverRail .serverBtn:nth-child(n + 3) {
    display: none;
  }

  .threadBar,
  .selectionBar,
  .undoBar {
    padding: 8px;
    gap: 8px;
  }

  .selectionActions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .profileText,
  .chatMeta small,
  #newChat,
  #gifBtn {
    display: none;
  }

  .chatMeta b {
    font-size: 12px;
  }

  #search {
    display: block;
    font-size: 12px;
    padding: 8px 10px;
  }

  #search::placeholder {
    content: "Поиск";
  }

  .settingsLayout,
  .settingGrid,
  .settingToggleGrid {
    grid-template-columns: 1fr;
  }

  .settingsNav {
    position: static;
  }

  .inputBox {
    grid-template-columns: 42px 42px 42px 42px 1fr 48px;
  }

  #text {
    font-size: 14px;
  }

  #emojiBtn {
    display: none;
  }

  .searchWrap {
    min-height: 0;
  }

  .chatItem {
    justify-content: flex-start;
    padding-left: 8px;
    padding-right: 8px;
  }

  .chatItem .unreadBadge {
    position: absolute;
    transform: translate(12px, -12px);
  }

  .callQuickGrid {
    grid-template-columns: 1fr;
  }

  .quickComposerBar {
    padding-bottom: 6px;
  }
}
