/* U-Chat Web - High Performance & Material You 3 System */
:root {
  --bg: #F0F2F6;
  --bg-elevated: #FFFFFF;
  --card: #FFFFFF;
  --card-2: #F6F7FA;
  --card-hover: #ECEEF4;
  --line: #E5E7ED;
  --line-subtle: #F0F1F5;
  
  --text: #16171B;
  --text-dim: #7C808D;
  --text-muted: #A1A5B2;
  
  --accent: #FF5E3A;
  --accent-hover: #E84D29;
  --accent-soft: #FFF0EB;
  --accent-tint: rgba(255, 94, 58, 0.14);
  
  --msg-in: #FFFFFF;
  --msg-out: #FFF0EB;
  --msg-out-border: rgba(255, 94, 58, 0.18);
  
  --online: #10B981;
  --danger: #EF4444;
  --danger-soft: #FEE2E2;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-float: 0 14px 44px rgba(0, 0, 0, 0.12);
  --shadow-pop: 0 16px 48px rgba(0, 0, 0, 0.2);
  
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-pill: 9999px;
  
  --ease-spring: cubic-bezier(0.18, 0.89, 0.32, 1.28);
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
  --info-width: 340px;
}

:root[data-theme="dark"] {
  --bg: #0C0D11;
  --bg-elevated: #16181E;
  --card: #181A20;
  --card-2: #21242D;
  --card-hover: #2A2D38;
  --line: #262934;
  --line-subtle: #1C1E26;
  
  --text: #F4F5F8;
  --text-dim: #9094A2;
  --text-muted: #646876;
  
  --accent: #FF5E3A;
  --accent-hover: #FF704E;
  --accent-soft: #2E1B16;
  --accent-tint: rgba(255, 94, 58, 0.24);
  
  --msg-in: #1E212A;
  --msg-out: #2F1E19;
  --msg-out-border: rgba(255, 94, 58, 0.32);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-float: 0 14px 44px rgba(0, 0, 0, 0.58);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg);
  color: var(--text);
  user-select: none;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* APP SHELL */
.app-shell {
  display: flex;
  width: 100vw;
  height: 100vh;
  padding: 12px;
  gap: 12px;
  background: var(--bg);
  overflow: hidden;
  position: relative;
}

/* 1. LEFT PANE */
.pane-left {
  width: 380px;
  min-width: 340px;
  max-width: 420px;
  height: 100%;
  background: var(--card);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  overflow: hidden;
  z-index: 10;
  transition: width 0.3s var(--ease-smooth), transform 0.3s var(--ease-smooth);
}

.pane-left-header {
  padding: 16px 18px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line-subtle);
  position: relative;
}

.me-avatar-btn {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  background: transparent;
  flex-shrink: 0;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.me-avatar-btn:hover {
  transform: scale(1.08);
  border-color: var(--accent);
}

.me-avatar-btn img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.header-search-box {
  flex: 1;
  height: 42px;
  background: var(--card-2);
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 8px;
  border: 1px solid transparent;
  transition: all 0.25s ease;
}

.header-search-box:focus-within {
  background: var(--card);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
  transform: scale(1.02);
}

.header-search-box svg {
  width: 18px;
  height: 18px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.header-search-box input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text);
  outline: none;
}

.round-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--card-2);
  border: none;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
  position: relative;
}

.round-icon-btn:hover {
  background: var(--card-hover);
  color: var(--accent);
  transform: scale(1.08);
}

.round-icon-btn:active {
  transform: scale(0.92);
}

.round-icon-btn svg {
  width: 20px;
  height: 20px;
}

/* Category Filter Chips (Только Чаты и Группы, БЕЗ каналов) */
.juna-chips-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line-subtle);
}
.juna-chips-row::-webkit-scrollbar {
  display: none;
}

.juna-chip {
  padding: 7px 18px;
  border-radius: var(--radius-pill);
  background: var(--card-2);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  border: none;
  transition: all 0.25s var(--ease-spring);
}

.juna-chip:hover {
  background: var(--card-hover);
  color: var(--text);
  transform: translateY(-1px);
}

.juna-chip.active {
  background: var(--accent);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 4px 14px var(--accent-tint);
  transform: translateY(-1px) scale(1.04);
}

/* Chat list items */
.chat-list-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px 16px;
}

.chat-item {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 4px;
  cursor: pointer;
  gap: 14px;
  transition: all 0.2s var(--ease-smooth);
  position: relative;
}

.chat-item:hover {
  background: var(--card-2);
  transform: translateX(3px);
}

.chat-item.active {
  background: var(--accent-soft);
}

.chat-item-avatar-wrap {
  position: relative;
  width: 50px;
  height: 50px;
  flex-shrink: 0;
}

.chat-item-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow-sm);
}

.chat-online-dot {
  position: absolute;
  bottom: 0px;
  right: 0px;
  width: 13px;
  height: 13px;
  background: var(--online);
  border: 2px solid var(--card);
  border-radius: 50%;
}

.chat-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-item-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.chat-item-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* SVG PIN ICON */
.pin-svg-icon {
  width: 14px;
  height: 14px;
  color: var(--accent);
  flex-shrink: 0;
}

.chat-item-time {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 400;
}

.chat-item-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.chat-item-snippet {
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.chat-item.active .chat-item-snippet {
  color: var(--text);
}

.chat-item-badge {
  background: var(--accent);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  flex-shrink: 0;
}

/* UNIFIED GLOBAL SEARCH RESULTS VIEW (PEOPLE + MESSAGES) */
.global-search-view {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.global-search-view.hidden {
  display: none;
}

.search-section-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 0 4px;
}

.search-people-list, .search-messages-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.search-person-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease;
}

.search-person-item:hover {
  background: var(--card-2);
}

.search-person-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.search-person-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.search-person-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.search-person-sub {
  font-size: 12px;
  color: var(--text-dim);
}

.search-msg-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--card-2);
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid var(--line-subtle);
}

.search-msg-item:hover {
  background: var(--card-hover);
  border-color: var(--accent);
  transform: translateX(2px);
}

.search-msg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.search-msg-chat-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}

.search-msg-time {
  font-size: 11px;
  color: var(--text-dim);
}

.search-msg-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
  word-break: break-word;
}

.search-highlight {
  background: rgba(255, 94, 58, 0.25);
  color: var(--accent-hover);
  font-weight: 700;
  padding: 1px 3px;
  border-radius: 4px;
}

/* 2. CHAT PANE */
.pane-chat {
  flex: 1;
  height: 100%;
  background: var(--card);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
  min-width: 0;
}

.chat-head-bar {
  height: 70px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border-bottom: 1px solid var(--line-subtle);
  z-index: 10;
  flex-shrink: 0;
  position: relative;
}

.chat-head-left {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-md);
  transition: background 0.2s ease;
}

.chat-head-left:hover {
  background: var(--card-2);
}

.chat-head-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}

.chat-head-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-head-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.chat-head-status {
  font-size: 12px;
  color: var(--online);
  font-weight: 500;
}

.chat-typing-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  font-weight: 600;
}

.typing-dot {
  width: 4px;
  height: 4px;
  background: var(--accent);
  border-radius: 50%;
  display: inline-block;
  animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.chat-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

/* DROPDOWN MENUS */
.dropdown-menu {
  position: absolute;
  top: 50px;
  right: 0;
  width: 230px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-pop);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 60;
  transform-origin: top right;
  animation: menuPopIn 0.2s var(--ease-spring) forwards;
}

.dropdown-menu.closing {
  animation: menuPopOut 0.15s ease forwards;
}

.dropdown-menu.hidden {
  display: none;
}

@keyframes menuPopIn {
  from { opacity: 0; transform: scale(0.9) translateY(-6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes menuPopOut {
  from { opacity: 1; transform: scale(1) translateY(0); }
  to { opacity: 0; transform: scale(0.9) translateY(-6px); }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  width: 100%;
}

.dropdown-item:hover {
  background: var(--card-2);
  color: var(--accent);
  transform: translateX(2px);
}

.dropdown-item svg {
  width: 18px;
  height: 18px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.dropdown-item:hover svg {
  color: var(--accent);
}

.dropdown-item.danger:hover {
  color: var(--danger);
}
.dropdown-item.danger:hover svg {
  color: var(--danger);
}

/* USER BURGER MENU */
.user-burger-menu {
  position: absolute;
  top: 68px;
  left: 14px;
  width: 260px;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-pop);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 60;
  transform-origin: top left;
  animation: menuPopIn 0.2s var(--ease-spring) forwards;
}

.user-burger-menu.closing {
  animation: menuPopOut 0.15s ease forwards;
}

.user-burger-menu.hidden {
  display: none;
}

.burger-user-header {
  padding: 10px 12px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line-subtle);
  margin-bottom: 4px;
}

.burger-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}

.burger-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.burger-email {
  font-size: 12px;
  color: var(--text-dim);
}

/* Messages area with CUSTOM WALLPAPER */
.chat-messages-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background-image: var(--chat-wall, none);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.chat-messages-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px 32px 110px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.chat-messages-wrap::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 24px;
  background: linear-gradient(to bottom, var(--card) 0%, transparent 100%);
  z-index: 5;
  pointer-events: none;
}

.date-divider {
  align-self: center;
  background: var(--card-2);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 16px;
  border-radius: var(--radius-pill);
  margin: 12px 0;
  border: 1px solid var(--line-subtle);
  backdrop-filter: blur(4px);
}

/* MESSAGE ROW */
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 68%;
  position: relative;
}

.msg-row.incoming {
  align-self: flex-start;
}

.msg-row.outgoing {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-row.new-animate {
  animation: msgPop 0.28s var(--ease-spring);
}

@keyframes msgPop {
  from { opacity: 0; transform: translateY(14px) scale(0.95); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.msg-bubble-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
}

.msg-bubble {
  position: relative;
  padding: 12px 16px;
  border-radius: var(--radius-bubble, 20px);
  box-shadow: var(--shadow-sm);
  font-size: var(--msg-font-size, 14.5px);
  line-height: 1.45;
  word-break: break-word;
  display: flex;
  flex-direction: column;
  gap: 6px;
  user-select: text;
  transition: transform 0.15s ease;
}

.msg-row.incoming .msg-bubble {
  background: var(--msg-in);
  color: var(--text);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--line);
}

.msg-row.outgoing .msg-bubble {
  background: var(--msg-out);
  color: var(--text);
  border-bottom-right-radius: 4px;
  border: 1px solid var(--msg-out-border);
}

/* QUICK ACTIONS BAR (STAYS OPEN) */
.msg-action-trigger {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.06);
  border: none;
  color: var(--text-dim);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  transition: all 0.15s ease;
}

.msg-bubble:hover .msg-action-trigger {
  display: flex;
}

.msg-action-trigger:hover {
  background: var(--card-2);
  color: var(--accent);
  transform: scale(1.1);
}

.msg-quick-bar {
  position: absolute;
  top: -40px;
  background: var(--bg-elevated);
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-pop);
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s var(--ease-spring);
  z-index: 25;
}

.msg-row.incoming .msg-quick-bar {
  left: 0;
}
.msg-row.outgoing .msg-quick-bar {
  right: 0;
}

.msg-row:hover .msg-quick-bar,
.msg-quick-bar.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.quick-action-btn {
  background: transparent;
  border: none;
  padding: 6px 8px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.15s ease;
}

.quick-action-btn:hover {
  background: var(--card-2);
  color: var(--accent);
  transform: scale(1.22);
}

/* Reply quote inside bubble */
.msg-reply-quote {
  border-left: 3px solid var(--accent);
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 4px;
  margin-bottom: 4px;
  font-size: 12.5px;
}

.msg-reply-author {
  font-weight: 700;
  color: var(--accent);
}

.msg-reply-snippet {
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* REAL AUDIO WAVEFORM BUBBLE & TRANSCRIPTION */
.voice-bubble-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 270px;
}

.voice-bubble-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.voice-play-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: #FFF;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--accent-tint);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.voice-play-btn:hover {
  transform: scale(1.08);
}

.voice-wave-bars {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 3.5px;
  height: 28px;
}

.voice-bar {
  width: 3.5px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: height 0.15s ease, background 0.15s ease;
}

.voice-bar.active {
  background: var(--accent);
}

.transcribe-btn {
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--accent);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.transcribe-btn:hover {
  background: var(--accent);
  color: #FFF;
  transform: scale(1.06);
}

.voice-speed-btn {
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--text-dim);
  border-radius: var(--radius-pill);
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.voice-speed-btn:hover {
  background: var(--accent);
  color: #FFF;
  border-color: var(--accent);
  transform: scale(1.08);
}

.voice-transcription-box {
  background: var(--card-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.45;
  border: 1px solid var(--line-subtle);
  animation: popUp 0.2s var(--ease-spring);
}

.voice-transcription-box.hidden {
  display: none;
}

/* File / Document Card */
.msg-doc-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--card-2);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all 0.2s ease;
}

.msg-doc-card:hover {
  background: var(--card-hover);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.msg-doc-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.msg-doc-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #FF6B4A, #FF451A);
  color: #fff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  box-shadow: 0 4px 12px var(--accent-tint);
  flex-shrink: 0;
}

.msg-doc-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.msg-doc-title {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-doc-sub {
  font-size: 11.5px;
  color: var(--text-dim);
}

.msg-doc-dl-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.msg-doc-card:hover .msg-doc-dl-btn {
  background: var(--accent);
  color: #FFF;
  border-color: var(--accent);
  transform: scale(1.1);
}

.msg-photo-preview {
  max-width: 100%;
  max-height: 280px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.msg-photo-preview:hover {
  transform: scale(1.02);
}

.msg-meta-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.msg-edited-badge {
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
  margin-right: 2px;
}

.msg-meta-row svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
  transition: color 0.25s ease;
}

.msg-meta-row svg.status-sent {
  color: var(--text-muted);
}

.msg-meta-row svg.status-read {
  color: var(--accent);
}

.msg-reactions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.msg-reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--card-2);
  border: 1px solid var(--line);
  font-size: 12px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  user-select: none;
}

.msg-reaction-chip:hover {
  transform: scale(1.12);
}

.msg-reaction-chip.mine {
  background: var(--accent-soft);
  border-color: var(--accent);
}

/* FLOATING COMPOSER DOCK */
.composer-dock {
  position: absolute;
  bottom: 20px;
  left: 28px;
  right: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 20;
  pointer-events: none;
  gap: 6px;
}

/* Reply Preview Bar */
.composer-reply-bar {
  pointer-events: auto;
  width: 100%;
  max-width: 820px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  animation: popUp 0.18s var(--ease-spring);
}

.composer-reply-bar.hidden {
  display: none;
}

.reply-bar-left {
  border-left: 3px solid var(--accent);
  padding-left: 8px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.reply-bar-author {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.reply-bar-text {
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reply-bar-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  padding: 4px;
}
.reply-bar-close:hover {
  color: var(--accent);
}

.composer-edit-bar .reply-bar-left {
  border-left-color: #2AABEE;
}
.composer-edit-bar .reply-bar-author {
  color: #2AABEE;
}

/* Fast Emoji Picker Popup */
.emoji-popup {
  pointer-events: auto;
  position: absolute;
  bottom: 74px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 380px;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-pop);
  padding: 12px 14px;
  z-index: 45;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: popUp 0.18s var(--ease-spring);
}

.emoji-popup.hidden {
  display: none;
}

.emoji-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.emoji-popup-close {
  background: transparent;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
}
.emoji-popup-close:hover {
  color: var(--text);
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  max-height: 210px;
  overflow-y: auto;
}

.emoji-item-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  border-radius: 8px;
  cursor: pointer;
  padding: 5px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, background 0.12s ease;
}

.emoji-item-btn:hover {
  background: var(--card-2);
  transform: scale(1.25);
}

/* Floating Scroll to Bottom Button */
.scroll-bottom-btn {
  position: absolute;
  right: 28px;
  bottom: 96px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-pop);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 25;
  transition: transform 0.2s var(--ease-spring), opacity 0.2s ease, background 0.15s ease;
}

.scroll-bottom-btn:hover {
  background: var(--card-2);
  color: var(--accent);
  transform: scale(1.1) translateY(-2px);
}

.scroll-bottom-btn.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.8);
}

/* IN-CAPSULE COMPOSER (MORPHING VOICE RECORDING) */
.composer-capsule {
  pointer-events: auto;
  width: 100%;
  max-width: 820px;
  height: 58px;
  background: var(--card);
  border-radius: 30px;
  padding: 6px 8px 6px 14px;
  box-shadow: var(--shadow-float);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.composer-capsule:focus-within {
  border-color: var(--accent);
  box-shadow: 0 12px 36px var(--accent-tint);
}

.composer-normal-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.composer-capsule.is-recording .composer-normal-wrap {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
  display: none;
}

.composer-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  color: var(--text);
  background: transparent;
  padding: 10px 4px;
}

.composer-input::placeholder {
  color: var(--text-dim);
}

.composer-action-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.composer-action-btn:hover {
  color: var(--accent);
  background: var(--card-2);
  transform: scale(1.1);
}

/* REAL AUDIO RECORDING LIVE WAVEFORM */
.composer-rec-wrap {
  flex: 1;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  animation: popUp 0.2s var(--ease-spring);
}

.composer-capsule.is-recording .composer-rec-wrap {
  display: flex;
}

.rec-pulse-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulseDot 0.8s infinite alternate;
  flex-shrink: 0;
}

@keyframes pulseDot {
  from { transform: scale(0.85); opacity: 0.5; }
  to { transform: scale(1.3); opacity: 1; }
}

.rec-timer {
  font-size: 15px;
  font-weight: 700;
  color: var(--danger);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.rec-live-waveform {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 4px;
}

.rec-live-bar {
  width: 4px;
  min-height: 6px;
  background: var(--accent);
  border-radius: 2px;
  animation: recWavePulse 0.9s ease-in-out infinite alternate;
}

.rec-live-bar:nth-child(1) { height: 8px; animation-delay: 0.1s; }
.rec-live-bar:nth-child(2) { height: 16px; animation-delay: 0.3s; }
.rec-live-bar:nth-child(3) { height: 24px; animation-delay: 0.2s; }
.rec-live-bar:nth-child(4) { height: 18px; animation-delay: 0.4s; }
.rec-live-bar:nth-child(5) { height: 26px; animation-delay: 0.15s; }
.rec-live-bar:nth-child(6) { height: 14px; animation-delay: 0.35s; }
.rec-live-bar:nth-child(7) { height: 20px; animation-delay: 0.25s; }
.rec-live-bar:nth-child(8) { height: 10px; animation-delay: 0.45s; }

@keyframes recWavePulse {
  0% { transform: scaleY(0.35); opacity: 0.55; }
  50% { transform: scaleY(1.1); opacity: 1; }
  100% { transform: scaleY(0.5); opacity: 0.7; }
}

.rec-cancel-btn {
  background: var(--card-2);
  border: none;
  color: var(--danger);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.rec-cancel-btn:hover {
  background: var(--danger-soft);
  transform: scale(1.05);
}

/* SOLID SEND BUTTON */
.composer-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #FFFFFF;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px var(--accent-tint);
  transition: transform 0.2s var(--ease-spring), background 0.2s ease;
  flex-shrink: 0;
  z-index: 10;
}

.composer-send-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.1) rotate(4deg);
}

.composer-send-btn:active {
  transform: scale(0.92);
}

.composer-send-btn svg {
  width: 20px;
  height: 20px;
  margin-left: 2px;
}

/* 3. RIGHT PANE: PEER PROFILE */
.pane-right {
  width: 0px;
  opacity: 0;
  pointer-events: none;
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.3s var(--ease-smooth), opacity 0.25s ease;
  z-index: 10;
}

.app-shell.has-info .pane-right {
  width: var(--info-width);
  opacity: 1;
  pointer-events: auto;
}

.right-header {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-subtle);
}

.right-header-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.right-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.profile-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  position: relative;
}

.peer-hero-banner-wrap {
  width: 100%;
  height: 110px;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  background: var(--card-2);
}

.peer-hero-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.peer-hero-avatar-wrap {
  position: relative;
  margin-top: -46px;
  z-index: 2;
}

.profile-hero-avatar {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow-md);
  border: 4px solid var(--card);
}

.profile-hero-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.profile-hero-username {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}

.profile-hero-actions {
  display: flex;
  gap: 16px;
  margin-top: 8px;
}

.profile-action-circle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  transition: color 0.2s ease;
}

.profile-action-circle:hover {
  color: var(--accent);
}

.profile-action-circle-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--card-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: all 0.2s ease;
}

.profile-action-circle:hover .profile-action-circle-icon {
  background: var(--accent);
  color: #FFF;
  transform: scale(1.08);
}

.profile-section-card {
  background: var(--card-2);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--line-subtle);
}

.profile-detail-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-detail-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.profile-detail-value {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

/* MODALS: PROFILE, SETTINGS, MEDIA VIEWER */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease forwards;
}

.modal-backdrop.closing {
  animation: fadeOut 0.2s ease forwards;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-dialog {
  width: 480px;
  max-width: 92vw;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: popUp 0.24s var(--ease-spring) forwards;
}

.modal-dialog.large {
  width: 580px;
}

.modal-backdrop.closing .modal-dialog {
  animation: popDown 0.2s ease forwards;
}

.modal-header {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-subtle);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.modal-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 72vh;
  overflow-y: auto;
}

/* PROFILE BANNER & AVATAR EDIT */
.profile-banner-wrap {
  position: relative;
  width: 100%;
  height: 120px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: linear-gradient(135deg, #FF6B4A, #FF451A);
  margin-bottom: 36px;
}

.profile-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.banner-edit-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  color: #FFF;
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s ease;
}

.banner-edit-btn:hover {
  background: rgba(0, 0, 0, 0.85);
}

.profile-avatar-overlay-wrap {
  position: absolute;
  bottom: -32px;
  left: 20px;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 3px solid var(--bg-elevated);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  cursor: pointer;
}

.profile-avatar-overlay-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-edit-badge {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFF;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.profile-avatar-overlay-wrap:hover .avatar-edit-badge {
  opacity: 1;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
}

.modal-input {
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--card-2);
  padding: 0 14px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease;
}

.modal-input:focus {
  border-color: var(--accent);
}

.modal-textarea {
  min-height: 80px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--card-2);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  resize: none;
}

.modal-textarea:focus {
  border-color: var(--accent);
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--line-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.primary-btn {
  height: 42px;
  padding: 0 20px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #FFF;
  font-weight: 600;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.primary-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.secondary-btn {
  height: 42px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  background: var(--card-2);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  border: 1px solid var(--line);
  cursor: pointer;
}

/* MEDIA & DOCUMENTS VIEWER MODAL */
.media-tabs-nav {
  display: flex;
  gap: 10px;
  padding: 0 22px 14px;
  border-bottom: 1px solid var(--line-subtle);
}

.media-nav-tab {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--card-2);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.media-nav-tab.active {
  background: var(--accent);
  color: #FFF;
}

.media-photos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.media-grid-img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.media-grid-img:hover {
  transform: scale(1.04);
}

.media-docs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* SETTINGS SCREEN CARDS */
.settings-section-card {
  background: var(--card-2);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--line-subtle);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
}

.settings-row-label {
  font-size: 13.5px;
  color: var(--text);
}

.settings-row-sub {
  font-size: 12px;
  color: var(--text-dim);
}

/* Color swatches */
.color-swatches-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.color-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.color-swatch:hover {
  transform: scale(1.15);
}

.color-swatch.active {
  border-color: var(--text);
  transform: scale(1.18);
  box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--text);
}

/* Range sliders */
.settings-range-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 170px;
}

.settings-range {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
  height: 6px;
}

.settings-range-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  min-width: 44px;
  text-align: right;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-switch {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--line);
  transition: .22s ease;
  border-radius: 24px;
}

.slider-switch:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .22s ease;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

input:checked + .slider-switch {
  background-color: var(--accent);
}

input:checked + .slider-switch:before {
  transform: translateX(20px);
}

/* Settings Select */
.settings-select {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
}

/* Reduce Motion */
body.reduce-motion * {
  animation-duration: 0.001ms !important;
  transition-duration: 0.001ms !important;
}

/* CHAT CONTEXT MENU (ON RIGHT CLICK) */
.chat-context-menu {
  position: fixed;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-pop);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 100;
  min-width: 180px;
  animation: menuPopIn 0.18s var(--ease-spring);
}

.chat-context-menu.hidden {
  display: none;
}

/* ANIMATIONS */
@keyframes popUp {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes popDown {
  from { opacity: 1; transform: scale(1) translateY(0); }
  to { opacity: 0; transform: scale(0.92) translateY(12px); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* RESPONSIVE */
@media (max-width: 900px) {
  .app-shell.has-info .pane-chat {
    display: none;
  }
}
@media (max-width: 768px) {
  .app-shell {
    padding: 0;
    gap: 0;
    height: 100dvh;
  }
  .pane-left {
    width: 100%;
    min-width: 100%;
    border-radius: 0;
    border: none;
  }
  .pane-chat {
    display: none;
    width: 100%;
    min-width: 100%;
    border-radius: 0;
    border: none;
  }
  .app-shell.chat-open .pane-left {
    display: none !important;
  }
  .app-shell.chat-open .pane-chat {
    display: flex !important;
  }
  .chat-back-btn {
    display: inline-flex !important;
  }
  .composer-dock {
    padding: 8px 12px 14px;
  }
  .modal-dialog {
    width: 94vw;
    margin: 10px;
    border-radius: 20px;
  }
  .composer-capsule {
    min-height: 48px;
    padding: 3px 6px 3px 12px;
  }
}

/* ==========================================================================
   AUTHENTICATION SCREEN (SLIMCHAT / MATERIAL YOU INSPIRED)
   ========================================================================== */
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  background-image: radial-gradient(circle at 50% 15%, rgba(255, 94, 58, 0.12) 0%, transparent 60%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.auth-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-elevated);
  border-radius: 28px;
  padding: 34px 30px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-float);
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: popUp 0.3s var(--ease-spring);
  position: relative;
}

.auth-brand-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.auth-logo-badge {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  overflow: hidden;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(43, 130, 246, 0.25);
  animation: popUp 0.35s var(--ease-spring);
}

.auth-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.auth-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  margin: 0;
  letter-spacing: -0.5px;
}

.auth-subtitle {
  font-size: 13.5px;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.4;
}

.auth-nav-tabs {
  display: flex;
  background: var(--card-2);
  border-radius: var(--radius-pill);
  padding: 4px;
  gap: 4px;
  border: 1px solid var(--line-subtle);
}

.auth-tab {
  flex: 1;
  padding: 9px 0;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.18s ease;
}

.auth-tab.active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
}

.auth-alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.45;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: popUp 0.2s var(--ease-spring);
}

.auth-alert.hidden {
  display: none;
}

.auth-alert.error {
  background: rgba(239, 68, 68, 0.12);
  color: #EF4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.auth-alert.success {
  background: rgba(16, 185, 129, 0.12);
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form.hidden {
  display: none;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.auth-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--card-2);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.auth-input-wrap:focus-within {
  border-color: var(--accent);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

.auth-field-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.auth-field-at {
  position: absolute;
  left: 14px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-muted);
  pointer-events: none;
}

.auth-input {
  flex: 1;
  padding: 12px 14px 12px 42px;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text);
  outline: none;
  width: 100%;
}

.auth-input.has-at {
  padding-left: 34px;
}

.auth-eye-btn {
  background: transparent;
  border: none;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.auth-eye-btn:hover {
  color: var(--text);
}

.auth-primary-btn {
  width: 100%;
  padding: 13px 20px;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #fff;
  font-size: 14.5px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 20px var(--accent-tint);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  margin-top: 4px;
}

.auth-primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px var(--accent-tint);
  filter: brightness(1.05);
}

.auth-primary-btn:active {
  transform: translateY(0);
}

.auth-demo-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0 2px 0;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-demo-divider::before,
.auth-demo-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.auth-demo-btn {
  width: 100%;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  background: var(--card-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--line);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.15s ease;
}

.auth-demo-btn:hover {
  background: var(--card-hover);
  border-color: var(--line);
  transform: translateY(-1px);
}

.demo-avatar-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

/* Avatar Selection & Presets */
.auth-avatar-selection {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}

.auth-avatar-preview-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid var(--accent);
  box-shadow: 0 4px 16px var(--accent-tint);
  overflow: hidden;
}

#regAvatarImg {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.auth-avatar-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.auth-avatar-preview-wrap:hover .auth-avatar-overlay {
  opacity: 1;
}

.auth-avatar-presets {
  display: flex;
  gap: 8px;
  align-items: center;
}

.avatar-preset {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.avatar-preset:hover {
  transform: scale(1.18);
}

.avatar-preset.active {
  border-color: var(--accent);
  transform: scale(1.1);
  box-shadow: 0 2px 8px var(--accent-tint);
}

.auth-footer-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 2px;
}

.auth-text-btn {
  background: transparent;
  border: none;
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
}

.auth-text-btn:hover {
  text-decoration: underline;
}

/* ==========================================================================
   MOBILE BACK BUTTON & ONLINE BADGES
   ========================================================================== */
.chat-back-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  margin-right: 6px;
  flex-shrink: 0;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-back-btn:hover {
  background: var(--bg-hover);
  color: var(--accent);
  transform: translateX(-2px);
}

.chat-back-btn:active {
  transform: scale(0.92);
}

.chat-head-avatar-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.chat-online-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #10B981;
  border: 2.5px solid var(--bg-surface);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.45);
  transition: all 0.3s ease;
}

.chat-online-badge.offline {
  background: var(--text-dim);
  box-shadow: none;
}

/* Server Status Indicator Dot on Me Button */
.me-avatar-btn {
  position: relative;
}

.me-status-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
  background: #10B981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
  transition: all 0.3s ease;
}

.me-status-dot.connecting {
  background: #F59E0B;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
}

.me-status-dot.offline {
  background: #94A3B8;
  box-shadow: none;
}

/* ==========================================================================
   COMPOSER CAPSULE CONTAINER & VISUALLY HIDDEN PICKERS
   ========================================================================== */
.composer-capsule-container {
  position: relative;
  width: 100%;
  max-width: 820px;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
}

.visually-hidden-picker {
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 1px !important;
  height: 1px !important;
  top: -100px !important;
  left: -100px !important;
}

/* ==========================================================================
   ATTACHMENT POPUP MENU
   ========================================================================== */
.attach-menu-popup {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-pop);
  border-radius: 18px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 240px;
  width: max-content;
  z-index: 100;
  backdrop-filter: blur(20px);
  pointer-events: auto;
  animation: popUp 0.18s var(--ease-spring) forwards;
}

.attach-menu-popup.hidden {
  display: none !important;
}

.attach-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
  text-align: left;
  white-space: nowrap;
}

.attach-menu-item span {
  white-space: nowrap;
}

.attach-menu-item:hover {
  background: var(--bg-hover);
  color: var(--accent);
  transform: translateX(3px);
}

.attach-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.attach-item-icon.photo {
  background: rgba(255, 94, 58, 0.12);
  color: var(--accent);
}

.attach-item-icon.doc {
  background: rgba(42, 171, 238, 0.12);
  color: #2AABEE;
}

/* Round Icon Button Highlight */
.round-icon-btn.highlight {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.round-icon-btn.highlight:hover {
  background: var(--accent-hover);
  transform: scale(1.08);
}

/* Registration Custom Photo Upload */
.auth-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-hover);
  border: 1px solid var(--line);
  padding: 7px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
  margin-top: 6px;
}

.auth-upload-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.auth-upload-hint {
  font-size: 11.5px;
  color: var(--text-dim);
  text-align: center;
  margin-top: 2px;
}

/* Empty Chat List State */
.empty-chatlist-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  gap: 14px;
  color: var(--text-secondary);
}

.empty-chatlist-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 94, 58, 0.1);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-chatlist-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.empty-chatlist-sub {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.4;
  max-width: 220px;
}

.empty-chatlist-btn {
  padding: 8px 18px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.empty-chatlist-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

/* ==========================================================================
   FIND USER MODAL CARDS
   ========================================================================== */
.user-search-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
}

.user-search-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--bg-hover);
  border: 1px solid var(--line-subtle);
  transition: all 0.15s ease;
}

.user-search-card:hover {
  background: var(--bg-elevated);
  border-color: var(--accent-tint);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.user-card-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.user-card-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.user-card-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-card-sub {
  font-size: 12px;
  color: var(--text-dim);
}

.user-card-bio {
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.user-card-action-btn {
  padding: 7px 15px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.user-card-action-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.04);
}

/* AVATAR SHAPE & SQUIRCLE */
body.shape-squircle .chat-item-avatar,
body.shape-squircle .me-avatar-img,
body.shape-squircle .header-chat-avatar,
body.shape-squircle .profile-avatar-img,
body.shape-squircle .search-person-avatar,
body.shape-squircle .user-card-avatar,
body.shape-squircle .msg-avatar {
  border-radius: 28% !important;
}

/* TYPING INDICATOR */
.typing-indicator-text {
  color: var(--accent);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.typing-indicator-text::after {
  content: "";
  display: inline-block;
  width: 10px;
  height: 4px;
  background: var(--accent);
  border-radius: 2px;
  animation: typingPulseBar 0.9s infinite alternate;
}
@keyframes typingPulseBar {
  0% { opacity: 0.3; transform: scaleX(0.5); }
  100% { opacity: 1; transform: scaleX(1); }
}

/* CHAT DRAFT SNIPPET */
.chat-draft-prefix {
  color: #ef4444;
  font-weight: 600;
  margin-right: 3px;
}

/* IN-CHAT SEARCH BAR */
.inchat-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-pane);
  border-bottom: 1px solid var(--line);
  z-index: 5;
  animation: slideDown 0.18s ease;
}

.inchat-search-icon {
  color: var(--text-dim);
  flex-shrink: 0;
}

#inchatSearchInput {
  flex: 1;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--text);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s ease;
}

#inchatSearchInput:focus {
  border-color: var(--accent);
}

.inchat-search-count {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
  padding: 0 4px;
  white-space: nowrap;
}

.round-icon-btn.small {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* PINNED MESSAGE BAR */
.pinned-msg-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--card-1);
  border-bottom: 1px solid var(--line);
  z-index: 5;
  cursor: pointer;
  transition: background 0.15s ease;
}

.pinned-msg-bar:hover {
  background: var(--card-2);
}

.pinned-indicator {
  width: 3px;
  height: 30px;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}

.pinned-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pinned-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pinned-snippet {
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pinned-unpin-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 6px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.pinned-unpin-btn:hover {
  background: var(--card-2);
  color: var(--text);
}

/* FLASH ANIMATION FOR HIGHLIGHTED MESSAGE */
.pinned-flash {
  animation: pinnedFlash 1.6s ease forwards;
}

@keyframes pinnedFlash {
  0% {
    box-shadow: 0 0 0 3px var(--accent);
    transform: scale(1.01);
  }
  50% {
    box-shadow: 0 0 0 3px var(--accent);
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
    transform: scale(1);
  }
}

/* GROUP MEMBERS CHECKLIST */
.group-members-checklist {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--card-1);
}

.group-member-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
  user-select: none;
}

.group-member-item:hover {
  background: var(--card-2);
}

.group-member-checkbox {
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.group-member-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.group-member-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.group-member-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-member-sub {
  font-size: 11.5px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

