/* ============================================
   VOLTIX MESSENGER — Telegram-like Design
   ============================================ */

:root {
  --bg-primary: #0f1923;
  --bg-secondary: #0a1118;
  --bg-chat: #0a1118;
  --bg-sidebar: #141e2b;
  --bg-input: #1c2938;
  --bg-hover: #1a2736;
  --bg-message-out: #1e4a73;
  --bg-message-in: #15202e;
  --text-primary: #edf2f7;
  --text-secondary: #8899aa;
  --text-muted: #5a6b7c;
  --accent: #5cacf5;
  --accent-hover: #4a9be4;
  --accent-dark: #1e4a73;
  --accent-glow: rgba(92, 172, 245, 0.15);
  --accent-gradient: linear-gradient(135deg, #5cacf5, #7c6cf5);
  --accent-gradient-vibrant: linear-gradient(135deg, #5cacf5, #a76cf5, #f56c9c);
  --danger: #f04747;
  --danger-glow: rgba(240, 71, 71, 0.15);
  --success: #43b581;
  --online: #43b581;
  --warning: #faa61a;
  --border: rgba(255,255,255,0.06);
  --shadow: rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.5);
  --glass: rgba(20, 30, 43, 0.85);
  --glass-border: rgba(255,255,255,0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Глобальное скрытие */
.hidden {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}

/* Smooth selection */
::selection {
  background: rgba(92, 172, 245, 0.3);
  color: var(--text-primary);
}

/* ============ SCREENS ============ */
.screen {
  display: none;
  width: 100%;
  height: 100vh;
}
.screen.active {
  display: flex;
}

/* ============ AUTH SCREEN ============ */
#auth-screen {
  justify-content: center;
  align-items: center;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

#auth-screen::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: 
    radial-gradient(ellipse at 20% 50%, rgba(92, 172, 245, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(124, 108, 245, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(245, 108, 156, 0.04) 0%, transparent 50%);
  animation: authBgFloat 20s ease-in-out infinite;
}

@keyframes authBgFloat {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(2%, -2%) rotate(1deg); }
  66% { transform: translate(-1%, 1%) rotate(-0.5deg); }
}

.auth-container {
  width: 100%;
  max-width: 420px;
  padding: 40px 32px;
  animation: fadeInUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  z-index: 1;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(40px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-logo {
  text-align: center;
  margin-bottom: 44px;
}

.logo-icon {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  font-size: 38px;
  color: white;
  box-shadow: 
    0 8px 32px rgba(92, 172, 245, 0.25),
    0 0 0 1px rgba(255,255,255,0.1) inset;
  position: relative;
  animation: logoBreath 4s ease-in-out infinite;
}

@keyframes logoBreath {
  0%, 100% { box-shadow: 0 8px 32px rgba(92, 172, 245, 0.25), 0 0 0 1px rgba(255,255,255,0.1) inset; }
  50% { box-shadow: 0 12px 48px rgba(92, 172, 245, 0.35), 0 0 0 1px rgba(255,255,255,0.15) inset; }
}

.auth-logo h1 {
  font-size: 34px;
  font-weight: 800;
  background: linear-gradient(135deg, #5cacf5, #a78bfa, #f59eb8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 6px;
  letter-spacing: 0.5px;
}

.auth-form {
  background: rgba(20, 30, 43, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-lg);
}

.auth-tabs {
  display: flex;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.04);
  padding: 4px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 11px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  font-family: inherit;
  position: relative;
}

.auth-tab.active {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 16px rgba(92, 172, 245, 0.3);
}

.auth-tab:not(.active):hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
}

.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.input-group {
  position: relative;
  margin-bottom: 16px;
}

.input-group i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  transition: color var(--transition-fast);
}

.input-group:focus-within i {
  color: var(--accent);
}

.input-group input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
  font-family: inherit;
}

.input-group input:focus {
  border-color: var(--accent);
  background: rgba(92, 172, 245, 0.04);
  box-shadow: 0 0 0 3px rgba(92, 172, 245, 0.1);
}

.input-group input::placeholder {
  color: var(--text-muted);
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius);
  color: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.01em;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(92, 172, 245, 0.35);
}

.btn-primary:hover::before {
  opacity: 1;
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(92, 172, 245, 0.2);
}

.btn-secondary {
  padding: 8px 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  backdrop-filter: blur(8px);
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(92, 172, 245, 0.2);
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-danger {
  width: 100%;
  padding: 12px;
  background: transparent;
  border: 1.5px solid var(--danger);
  border-radius: var(--radius);
  color: var(--danger);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
}

.btn-danger:hover {
  background: var(--danger);
  color: white;
  box-shadow: 0 4px 16px var(--danger-glow);
}

.auth-error {
  color: var(--danger);
  font-size: 13px;
  text-align: center;
  margin-top: 12px;
  min-height: 20px;
  font-weight: 500;
}

/* ============ MESSENGER LAYOUT ============ */
.messenger {
  display: flex;
  width: 100%;
  height: 100vh;
  position: relative;
}

/* ============ SIDEBAR ============ */
.sidebar {
  width: 360px;
  min-width: 360px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 10;
}

.sidebar-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(20, 30, 43, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.sidebar-header-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-header-top h2 {
  flex: 1;
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, #5cacf5, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
  position: relative;
}

.icon-btn:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
}

.icon-btn:active {
  transform: scale(0.92);
}

.icon-btn.small {
  width: 32px;
  height: 32px;
  font-size: 14px;
}

/* Search bar */
.search-bar {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-top: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  transition: var(--transition);
}

.search-bar.active {
  display: flex;
}

.search-bar:focus-within {
  border-color: rgba(92, 172, 245, 0.3);
  background: rgba(92, 172, 245, 0.04);
}

.search-bar i {
  color: var(--text-muted);
  font-size: 14px;
}

.search-bar input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
}

.search-bar input::placeholder {
  color: var(--text-muted);
}

/* Search results */
.search-results {
  display: none;
  overflow-y: auto;
  flex: 1;
}

.search-results.active {
  display: block;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: var(--transition);
}

.search-result-item:hover {
  background: var(--bg-hover);
}

.search-result-item .avatar {
  width: 44px;
  height: 44px;
}

.search-result-item .info {
  flex: 1;
}

.search-result-item .nickname {
  font-size: 14px;
  font-weight: 500;
}

.search-result-item .add-btn {
  padding: 6px 14px;
  background: var(--accent-gradient);
  border: none;
  border-radius: 20px;
  color: white;
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  font-weight: 600;
}

.search-result-item .add-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(92, 172, 245, 0.3);
}

.search-result-item .add-btn.added {
  background: var(--success);
}

.search-section-title {
  padding: 8px 16px 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}
.search-section-title:first-child { border-top: none; }

/* Chat list */
.chat-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  border-radius: 0;
}

.chat-item:hover {
  background: rgba(255,255,255,0.04);
}

.chat-item.active {
  background: rgba(92, 172, 245, 0.1);
  border-left: 3px solid var(--accent);
}

.chat-item .avatar {
  width: 50px;
  height: 50px;
  position: relative;
}

.avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar .online-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  background: var(--online);
  border: 2.5px solid var(--bg-sidebar);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(67, 181, 129, 0.5);
}

.chat-item .chat-info {
  flex: 1;
  min-width: 0;
}

.chat-item .chat-name {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-item .chat-name .time {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.chat-item .chat-last-msg {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-item .chat-last-msg .msg-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.unread-badge {
  background: var(--accent-gradient);
  color: white;
  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;
  margin-left: 8px;
  box-shadow: 0 2px 8px rgba(92, 172, 245, 0.3);
}

/* Sidebar category tabs */
.sidebar-categories {
  display: flex;
  padding: 6px 8px;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-sidebar);
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}

.sidebar-categories::-webkit-scrollbar {
  display: none;
}

.cat-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 13px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 20px;
  transition: var(--transition);
  white-space: nowrap;
  font-family: inherit;
  position: relative;
}

.cat-btn i {
  font-size: 13px;
}

.cat-btn:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
}

.cat-btn.active {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 2px 10px rgba(92, 172, 245, 0.25);
}

.cat-btn .badge {
  position: static;
  transform: none;
  font-size: 9px;
  min-width: 14px;
  height: 14px;
  margin-left: 2px;
}

/* Sidebar nav */
.sidebar-nav {
  display: flex;
  border-top: 1px solid var(--border);
  background: var(--bg-sidebar);
}

.nav-btn {
  flex: 1;
  padding: 10px 4px 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: var(--transition);
  position: relative;
  font-family: inherit;
}

.nav-btn i {
  font-size: 16px;
  transition: var(--transition-spring);
}

.nav-btn:hover {
  color: var(--text-secondary);
}

.nav-btn.active {
  color: var(--accent);
}

.nav-btn.active i {
  transform: scale(1.1);
  filter: drop-shadow(0 0 6px rgba(92, 172, 245, 0.4));
}

.badge {
  position: absolute;
  top: 4px;
  right: 50%;
  transform: translateX(16px);
  background: var(--danger);
  color: white;
  font-size: 10px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.badge.hidden {
  display: none;
}

/* ============ FRIENDS PANEL ============ */
.friends-panel,
.profile-panel {
  position: absolute;
  top: 0;
  left: 0;
  width: 360px;
  height: 100%;
  background: var(--bg-sidebar);
  z-index: 20;
  display: flex;
  flex-direction: column;
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.friends-panel.hidden,
.profile-panel.hidden {
  display: none;
}

@keyframes slideIn {
  from { transform: translateX(-100%); opacity: 0.8; }
  to { transform: translateX(0); opacity: 1; }
}

.friends-header,
.profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.friends-header h3,
.profile-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.friends-tabs {
  display: flex;
  padding: 8px;
  gap: 4px;
}

.friends-tab {
  flex: 1;
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  position: relative;
  font-family: inherit;
}

.friends-tab.active {
  background: var(--bg-input);
  color: var(--text-primary);
}

.friends-list {
  flex: 1;
  overflow-y: auto;
}

.friends-list.hidden {
  display: none;
}

.friend-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  transition: var(--transition);
}

.friend-item:hover {
  background: var(--bg-hover);
}

.friend-item .friend-info {
  flex: 1;
}

.friend-item .friend-name {
  font-size: 14px;
  font-weight: 500;
}

.friend-item .friend-status {
  font-size: 12px;
  color: var(--text-muted);
}

.friend-item .friend-actions {
  display: flex;
  gap: 6px;
}

.friend-item .friend-actions button {
  padding: 6px 12px;
  border: none;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.friend-item .accept-btn {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 2px 8px rgba(92, 172, 245, 0.25);
}

.friend-item .accept-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(92, 172, 245, 0.35);
}

.friend-item .reject-btn {
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
}

.friend-item .reject-btn:hover {
  background: var(--danger);
  color: white;
}

.friend-item .msg-btn {
  background: var(--accent-gradient);
  color: white;
}

.friend-item .msg-btn:hover {
  transform: scale(1.05);
}

/* ============ PROFILE PANEL ============ */
.profile-content {
  padding: 30px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.profile-avatar {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  color: white;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(92, 172, 245, 0.25);
  border: 3px solid rgba(255,255,255,0.1);
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-nickname {
  font-size: 20px;
  font-weight: 600;
}

/* ============ SETTINGS MENU ============ */
.settings-menu {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.settings-item {
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
  padding: 14px 20px;
  border: none;
  background: none;
  color: var(--text-primary);
  font-size: 15px;
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: left;
  font-family: inherit;
  border-radius: 0;
}

.settings-item:hover {
  background: rgba(255,255,255,0.04);
}

.settings-item:active {
  background: rgba(255,255,255,0.06);
}

.settings-item-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: var(--text-secondary);
  flex-shrink: 0;
  background: rgba(255,255,255,0.04);
  transition: var(--transition);
}

.settings-item:hover .settings-item-icon {
  background: rgba(255,255,255,0.08);
}

.settings-item-icon i {
  font-size: 17px;
}

.settings-item span:first-of-type:not(.settings-item-value) {
  flex: 1;
}

.settings-item-value {
  color: var(--accent);
  font-size: 14px;
  margin-left: auto;
}

.settings-icon-account {
  background: var(--accent-gradient) !important;
  color: #fff !important;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(92, 172, 245, 0.25);
}

.settings-icon-account img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#account-panel .profile-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

#account-panel .profile-header h3 {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
}

#account-panel .profile-header span {
  width: 32px;
}

/* ============ SETTINGS SUB-PANELS ============ */
.settings-sub-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.settings-sub-header h3 {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
}

.settings-sub-header span {
  width: 32px;
}

.settings-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.settings-section {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.settings-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.settings-toggle-row:last-child {
  border-bottom: none;
}

.settings-toggle-row > span:first-child {
  font-size: 14px;
  color: var(--text-primary);
}

.settings-toggle {
  width: 46px;
  height: 26px;
  background: rgba(255,255,255,0.12);
  border-radius: 13px;
  position: relative;
  transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  cursor: pointer;
}

.settings-toggle.active {
  background: var(--accent);
  box-shadow: 0 0 12px rgba(92, 172, 245, 0.3);
}

.settings-toggle-dot {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.settings-toggle.active .settings-toggle-dot {
  transform: translateX(20px);
}

.settings-select-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.settings-select-row:last-child {
  border-bottom: none;
}

.settings-select-row > span {
  font-size: 14px;
  color: var(--text-primary);
}

.settings-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.settings-select:focus {
  border-color: var(--accent);
}

.settings-radio-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  position: relative;
}

.settings-radio-row:last-child {
  border-bottom: none;
}

.settings-radio-row > span:first-child {
  font-size: 14px;
  color: var(--text-primary);
}

.settings-radio-row input[type="radio"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.settings-radio-mark {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--text-secondary);
  position: relative;
  transition: border-color 0.2s;
  flex-shrink: 0;
}

.settings-radio-row input[type="radio"]:checked ~ .settings-radio-mark {
  border-color: var(--accent);
}

.settings-radio-row input[type="radio"]:checked ~ .settings-radio-mark::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.settings-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.2s;
  width: 100%;
  justify-content: center;
}

.settings-action-btn:hover {
  opacity: 0.85;
}

.settings-empty-state {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-muted);
}

.settings-empty-state i {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.settings-empty-state p {
  font-size: 13px;
  line-height: 1.5;
}

.settings-language-list {
  display: flex;
  flex-direction: column;
}

/* ============ FOLDER ITEMS ============ */
.settings-folder-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.settings-folder-item:last-child {
  border-bottom: none;
}

.settings-folder-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.settings-folder-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-folder-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.settings-folder-count {
  font-size: 12px;
  color: var(--text-muted);
}

.settings-folder-actions {
  display: flex;
  gap: 4px;
}

.settings-folder-actions .icon-btn {
  width: 32px;
  height: 32px;
  font-size: 12px;
}

/* Folder tabs in sidebar */
.cat-btn.folder-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  white-space: nowrap;
}

.cat-btn.folder-tab i {
  font-size: 12px;
}

/* ============ FONT SIZE CLASSES ============ */
#messages-list.font-small .msg-text {
  font-size: 12px;
}

#messages-list.font-medium .msg-text {
  font-size: 14px;
}

#messages-list.font-large .msg-text {
  font-size: 17px;
}

#messages-list.font-large .msg-meta {
  font-size: 12px;
}

/* ============ NO ANIMATIONS MODE ============ */
body.no-animations,
body.no-animations * {
  animation-duration: 0s !important;
  transition-duration: 0s !important;
}

body.no-sticker-anim .emoji,
body.no-sticker-anim .sticker {
  animation: none !important;
}

body.no-autoplay-gif img[src$=".gif"] {
  animation-play-state: paused !important;
}

/* ============ DATA SAVER MODE ============ */
body.data-saver-mode .msg-photo img,
body.data-saver-mode .avatar img {
  image-rendering: pixelated;
}

body.data-saver-mode .msg-photo img {
  filter: blur(0.5px);
}

/* ============ CHAT AREA ============ */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-chat);
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.no-chat {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.no-chat.hidden {
  display: none;
}

.no-chat-content {
  text-align: center;
  color: var(--text-muted);
}

.no-chat-icon {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(92, 172, 245, 0.06);
  border: 1px solid rgba(92, 172, 245, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-size: 50px;
  color: var(--accent);
  opacity: 0.6;
  animation: noChat 4s ease-in-out infinite;
}

@keyframes noChat {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.05); opacity: 0.8; }
}

.no-chat-content h2 {
  font-size: 24px;
  margin-bottom: 10px;
  color: var(--text-secondary);
  font-weight: 700;
}

.no-chat-content p {
  font-size: 14px;
}

/* Active chat */
.active-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.active-chat.hidden {
  display: none;
}

/* Chat header */
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  min-height: 60px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.chat-header-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.chat-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-header-info {
  flex: 1;
}

.chat-header-name {
  font-size: 14px;
  font-weight: 600;
}

.chat-header-status {
  font-size: 12px;
  color: var(--text-muted);
}

.chat-header-status.online {
  color: var(--online);
}

.chat-header-status.typing {
  color: var(--accent);
}

.mobile-only {
  display: none;
}

/* Messages */
.messages-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  scroll-behavior: smooth;
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: auto;
}

.message {
  max-width: 65%;
  padding: 10px 14px;
  border-radius: 16px;
  position: relative;
  animation: msgIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  word-wrap: break-word;
  overflow-wrap: break-word;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.message.out {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--bg-message-out), #1a3d5c);
  border-bottom-right-radius: 4px;
}

.message.in {
  align-self: flex-start;
  background: var(--bg-message-in);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.message .msg-text,
.message .message-text {
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.message .msg-meta,
.message .message-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
}

.message .msg-time,
.message .message-time {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
}

.message .message-bubble {
  display: flex;
  flex-direction: column;
}

.message .msg-status {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}

.message .msg-status.read {
  color: var(--accent);
}

/* Фото сообщение */
.message .msg-photo {
  max-width: 300px;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 4px;
}

.message .msg-photo img {
  width: 100%;
  display: block;
  cursor: pointer;
}

/* Голосовое сообщение */
.message .msg-voice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
}

.message .msg-voice .play-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent-gradient);
  border: none;
  color: white;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
  box-shadow: 0 2px 10px rgba(92, 172, 245, 0.3);
}

.message .msg-voice .play-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 16px rgba(92, 172, 245, 0.4);
}

.message .msg-voice .voice-wave {
  flex: 1;
  height: 30px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.message .msg-voice .voice-wave .bar {
  width: 3px;
  background: rgba(255,255,255,0.4);
  border-radius: 2px;
  transition: var(--transition);
}

.message .msg-voice .voice-wave .bar.active {
  background: var(--accent);
}

.message .msg-voice .voice-duration {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  flex-shrink: 0;
}

/* Message input area */
.message-input-area {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 10px 12px;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.message-input-wrapper {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  transition: var(--transition);
}

.message-input-wrapper:focus-within {
  border-color: rgba(92, 172, 245, 0.3);
  background: rgba(92, 172, 245, 0.03);
}

.message-input-wrapper textarea {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  padding: 10px 0;
  resize: none;
  max-height: 120px;
  line-height: 1.4;
  font-family: inherit;
}

.message-input-wrapper textarea::placeholder {
  color: var(--text-muted);
}

.send-btn {
  color: var(--accent) !important;
}

.send-btn.hidden {
  display: none;
}

/* Voice recording */
.voice-recording {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border);
  z-index: 5;
}

.voice-recording.hidden {
  display: none;
}

.voice-recording-indicator {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.recording-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--danger);
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

#voice-timer {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
}

.send-voice {
  color: var(--accent) !important;
}

/* Photo preview */
.photo-preview {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.85);
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-preview.hidden {
  display: none;
}

.photo-preview-container {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.photo-preview-container img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: var(--radius);
  object-fit: contain;
}

#photo-preview-close {
  position: absolute;
  top: -50px;
  right: 0;
  color: white;
  font-size: 20px;
}

#photo-send-btn {
  width: auto;
  padding: 12px 30px;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--bg-input);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Empty states */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 14px;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  /* --- Основная раскладка --- */
  .messenger {
    overflow: hidden;
  }

  .sidebar {
    width: 100%;
    min-width: 100%;
  }

  .friends-panel,
  .profile-panel,
  .channels-panel,
  .groups-panel,
  .saved-panel,
  .codes-panel {
    width: 100%;
  }

  .chat-area {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 15;
    display: none;
    background: var(--bg-chat);
  }

  .chat-area.mobile-active {
    display: flex;
  }

  .mobile-only {
    display: flex;
  }

  .message {
    max-width: 85%;
  }

  .cat-btn span {
    display: none;
  }

  .cat-btn {
    padding: 8px 10px;
  }

  /* --- Capacitor safe area --- */
  body {
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  body.capacitor-app {
    padding-top: 0;
  }

  /* --- Sidebar header --- */
  .sidebar-header {
    padding: 10px 12px;
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--bg-sidebar);
  }

  .sidebar-header-top h2 {
    font-size: 20px;
  }

  /* Поиск */
  .search-bar {
    margin-top: 6px;
  }

  .search-bar input {
    font-size: 16px; /* предотвращает zoom на iOS/Android */
    padding: 10px 14px 10px 36px;
  }

  /* Stories bar */
  .stories-bar {
    padding: 8px 8px;
  }

  .story-avatar-item {
    min-width: 64px;
  }

  /* --- Chat list items --- */
  .chat-item {
    padding: 10px 12px;
    gap: 12px;
    min-height: 64px;
  }

  .chat-item .avatar {
    width: 50px;
    height: 50px;
    font-size: 20px;
  }

  .chat-item .chat-name {
    font-size: 15px;
  }

  .chat-item .chat-last-msg {
    font-size: 13px;
  }

  /* --- Nav bar --- */
  .sidebar-nav {
    padding: 6px 0;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border);
  }

  .nav-btn {
    padding: 8px 0;
    min-height: 44px;
  }

  .nav-btn i {
    font-size: 20px;
  }

  .nav-btn span {
    font-size: 10px;
  }

  /* --- Category tabs --- */
  .sidebar-categories {
    padding: 4px 6px;
    gap: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .sidebar-categories::-webkit-scrollbar {
    display: none;
  }

  .cat-btn {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 16px;
    white-space: nowrap;
    flex-shrink: 0;
    min-height: 36px;
  }

  .cat-btn i {
    font-size: 14px;
  }

  /* --- Chat header --- */
  .chat-header {
    padding: 8px 10px;
    min-height: 56px;
    gap: 8px;
  }

  .chat-header-avatar {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }

  .chat-header-name {
    font-size: 15px;
  }

  .chat-header-status {
    font-size: 11px;
  }

  .chat-header-actions .icon-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
  }

  /* --- Messages --- */
  .messages-container {
    padding: 10px 8px;
  }

  .message {
    padding: 8px 10px;
    border-radius: 14px;
    font-size: 15px;
  }

  .message .msg-text,
  .message .message-text {
    font-size: 15px;
    line-height: 1.45;
  }

  .message .msg-photo {
    max-width: 260px;
  }

  .message .msg-photo img {
    border-radius: 10px;
  }

  .message .msg-voice {
    min-width: 180px;
  }

  .message .msg-video-note {
    width: 180px;
    height: 180px;
  }
  .message .msg-video-note video {
    width: 180px;
    height: 180px;
  }
  .vnote-bubble-ring {
    width: 186px;
    height: 186px;
  }
  .vnote-play-btn {
    width: 40px;
    height: 40px;
  }
  .vnote-play-btn i {
    font-size: 15px;
  }

  .message .msg-meta {
    font-size: 11px;
  }

  /* --- Input area --- */
  .message-input-area {
    padding: 6px 8px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    gap: 4px;
  }

  .message-input-area .icon-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    font-size: 16px;
  }

  .message-input-wrapper {
    padding: 0 10px;
  }

  .message-input-wrapper textarea {
    font-size: 16px; /* предотвращает zoom */
    padding: 10px 0;
  }

  .emoji-toggle-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    font-size: 16px !important;
  }

  /* --- Attach dropdown --- */
  .attach-dropdown {
    bottom: 56px;
    left: 4px;
    right: 4px;
    border-radius: 16px;
  }

  /* --- Drawer --- */
  .drawer-overlay .drawer-panel {
    width: 85%;
    max-width: 320px;
  }

  .drawer-user-info h3 {
    font-size: 17px;
  }

  .drawer-item {
    min-height: 48px;
    padding: 12px 20px;
  }

  /* --- Settings panels --- */
  .settings-content {
    padding: 8px 12px;
  }

  .settings-section {
    margin-bottom: 16px;
  }

  .settings-toggle-row,
  .settings-select-row {
    padding: 12px 4px;
    font-size: 15px;
    min-height: 48px;
  }

  .settings-toggle {
    width: 46px;
    height: 26px;
  }

  .settings-toggle-dot {
    width: 20px;
    height: 20px;
  }

  .settings-item {
    min-height: 48px;
    padding: 12px 16px;
  }

  /* --- Call screen --- */
  .call-screen {
    border-radius: 0;
  }

  /* --- User info panel --- */
  .user-info-panel {
    width: 100vw;
    right: -100vw;
  }

  .user-info-panel.active {
    right: 0;
  }

  /* Photo preview */
  .photo-preview-container {
    max-width: 95%;
  }

  .photo-preview-container img {
    max-height: 65vh;
  }

  /* --- Reply/Edit preview --- */
  .reply-preview-bar,
  .edit-preview-bar {
    padding: 8px 10px;
    font-size: 13px;
  }

  /* --- Video note recording (mobile) --- */
  .vnote-rec-circle-wrap {
    width: 220px;
    height: 220px;
  }
  .vnote-rec-progress {
    width: 220px;
    height: 220px;
  }
  .vnote-rec-video {
    width: 208px;
    height: 208px;
  }
  .vnote-rec-glow {
    width: 236px;
    height: 236px;
    top: -8px; left: -8px;
  }

  /* --- Voice recording --- */
  .voice-recording {
    padding: 10px 12px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }

  /* --- Scrollbar hidden on mobile --- */
  ::-webkit-scrollbar {
    width: 0;
    display: none;
  }

  * {
    scrollbar-width: none;
  }

  /* --- Touch ripple --- */
  .settings-item,
  .chat-item,
  .drawer-item,
  .nav-btn,
  .cat-btn,
  .friend-item {
    -webkit-tap-highlight-color: rgba(94, 181, 247, 0.12);
    position: relative;
    overflow: hidden;
  }

  .settings-item:active,
  .chat-item:active,
  .drawer-item:active,
  .friend-item:active {
    background: rgba(94, 181, 247, 0.08);
    transition: background 0.05s;
  }

  /* --- Auth screen mobile --- */
  .auth-container {
    padding: 30px 20px;
  }

  .logo-icon {
    width: 70px;
    height: 70px;
    font-size: 30px;
  }

  .auth-logo h1 {
    font-size: 28px;
  }

  .auth-logo {
    margin-bottom: 30px;
  }

  .input-group input {
    padding: 12px 12px 12px 40px;
    font-size: 16px; /* предотвращает zoom */
  }

  .btn-primary {
    padding: 13px;
    font-size: 15px;
  }

  /* --- Emoji picker mobile --- */
  .emoji-picker {
    max-height: 250px;
    border-radius: 16px 16px 0 0;
  }

  /* --- Context menu mobile --- */
  .context-menu {
    min-width: 180px;
    border-radius: 12px;
  }

  .context-item {
    padding: 12px 16px;
    min-height: 44px;
  }

  /* --- Pinned message bar --- */
  .pinned-message-bar {
    padding: 8px 10px;
    font-size: 13px;
  }

  /* --- Chat search bar --- */
  .chat-search-bar {
    padding: 6px 10px;
  }

  .chat-search-bar input {
    font-size: 16px;
  }

  /* --- Date separator --- */
  .date-separator span {
    font-size: 12px;
    padding: 4px 12px;
  }
}

/* Extra small screens */
@media (max-width: 380px) {
  .sidebar-header-top h2 {
    font-size: 18px;
  }

  .chat-item .avatar {
    width: 44px;
    height: 44px;
  }

  .chat-item .chat-name {
    font-size: 14px;
  }

  .message {
    max-width: 90%;
    font-size: 14px;
  }

  .auth-container {
    padding: 24px 16px;
  }

  .logo-icon {
    width: 64px;
    height: 64px;
    font-size: 28px;
  }

  .auth-logo h1 {
    font-size: 26px;
  }

  .message-input-area .icon-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    font-size: 14px;
  }
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 3px;
  padding: 4px 0;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingDot 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Image lightbox */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.9);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lightbox img {
  max-width: 95%;
  max-height: 95%;
  object-fit: contain;
}

/* ============ CLIPS PANEL ============ */
.clips-panel {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-secondary);
  z-index: 50;
  display: flex;
  flex-direction: column;
}

.clips-panel.hidden {
  display: none;
}

.clips-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-sidebar);
}

.clips-header h3 {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.clips-header h3 i {
  color: var(--accent);
}

.clips-header-actions {
  display: flex;
  gap: 4px;
}

/* Clips feed */
.clips-feed {
  flex: 1;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  height: 0; /* Flex child: takes remaining height */
}

.clips-list {
  display: flex;
  flex-direction: column;
}

/* Single clip card — fullscreen, one at a time */
.clip-card {
  scroll-snap-align: start;
  scroll-snap-stop: always; /* Never skip a card */
  position: relative;
  background: #000;
  width: 100%;
  height: calc(100vh - 112px); /* panel header + tabs */
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.clip-card video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  cursor: pointer;
}

.clip-card .clip-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  pointer-events: none;
}

.clip-card .clip-overlay * {
  pointer-events: auto;
}

.clip-card .clip-author {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.clip-card .clip-author .avatar {
  width: 36px;
  height: 36px;
  font-size: 14px;
}

.clip-card .clip-author-name {
  font-size: 14px;
  font-weight: 600;
}

.clip-card .clip-caption {
  font-size: 13px;
  color: rgba(255,255,255,0.9);
  margin-bottom: 4px;
}

.clip-card .clip-views {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
}

/* Clip side actions */
.clip-actions {
  position: absolute;
  right: 12px;
  bottom: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.clip-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: none;
  background: none;
  color: white;
  cursor: pointer;
  font-family: inherit;
}

.clip-action-btn i {
  font-size: 24px;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5));
  transition: var(--transition);
}

.clip-action-btn span {
  font-size: 11px;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5));
}

.clip-action-btn.liked i {
  color: #ff4757;
}

.clip-action-btn:hover i {
  transform: scale(1.2);
}

/* Clip play overlay */
.clip-play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 60px;
  color: rgba(255,255,255,0.7);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.clip-play-overlay.show {
  opacity: 1;
}

/* Clip upload modal */
.clip-upload-modal {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
}

.clip-upload-modal.hidden {
  display: none;
}

.clip-upload-content {
  background: var(--bg-sidebar);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 90%;
  max-width: 420px;
  animation: modalIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.clip-upload-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.clip-upload-header h4 {
  font-size: 18px;
}

.clip-upload-dropzone {
  border: 2px dashed rgba(255,255,255,0.12);
  border-radius: var(--radius);
  padding: 44px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: rgba(255,255,255,0.02);
}

.clip-upload-dropzone:hover {
  border-color: var(--accent);
  background: rgba(92, 172, 245, 0.04);
}

.clip-upload-dropzone i {
  font-size: 40px;
  color: var(--accent);
  margin-bottom: 10px;
}

.clip-upload-dropzone p {
  font-size: 14px;
  color: var(--text-primary);
}

.clip-upload-dropzone span {
  font-size: 12px;
  color: var(--text-muted);
}

.clip-preview-video {
  width: 100%;
  max-height: 200px;
  border-radius: 12px;
  margin-top: 12px;
  background: #000;
}

.clip-preview-video.hidden {
  display: none;
}

.clip-upload-progress {
  margin-top: 12px;
  text-align: center;
}

.clip-upload-progress.hidden {
  display: none;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0;
  transition: width 0.3s;
  border-radius: 2px;
}

/* Clip comments modal */
.clip-comments-modal {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60%;
  background: var(--bg-sidebar);
  border-radius: 16px 16px 0 0;
  z-index: 56;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease;
}

.clip-comments-modal.hidden {
  display: none;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.clip-comments-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.clip-comments-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px;
}

.clip-comment-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
}

.clip-comment-item .avatar {
  width: 32px;
  height: 32px;
  font-size: 12px;
  flex-shrink: 0;
}

.clip-comment-item .comment-body {
  flex: 1;
}

.clip-comment-item .comment-author {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.clip-comment-item .comment-text {
  font-size: 13px;
  margin-top: 2px;
  line-height: 1.4;
}

.clip-comment-item .comment-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.clip-comment-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
}

.clip-comment-input-area input {
  flex: 1;
  padding: 10px 16px;
  background: var(--bg-input);
  border: none;
  border-radius: 20px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  font-family: inherit;
}

.clip-comment-input-area input::placeholder {
  color: var(--text-muted);
}

/* Clip share modal */
.clip-share-modal {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: var(--bg-sidebar);
  border-radius: 16px 16px 0 0;
  z-index: 56;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease;
}

.clip-share-modal.hidden {
  display: none;
}

.clip-share-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.clip-share-friends {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.clip-share-friend-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: var(--transition);
}

.clip-share-friend-item:hover {
  background: var(--bg-hover);
}

.clip-share-friend-item .avatar {
  width: 40px;
  height: 40px;
  font-size: 16px;
}

.clip-share-friend-item .friend-nickname {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}

.clip-share-friend-item .sent-label {
  color: var(--success);
  font-size: 12px;
}

/* ============ VIDEO NOTES (Кружки) — Recording ============ */
.vnote-rec-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.vnote-rec-overlay.active {
  opacity: 1;
}
.vnote-rec-overlay.hidden {
  display: none;
}

.vnote-rec-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  animation: vnoteRecIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes vnoteRecIn {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.vnote-rec-circle-wrap {
  position: relative;
  width: 260px;
  height: 260px;
}

.vnote-rec-progress {
  position: absolute;
  top: 0; left: 0;
  width: 260px;
  height: 260px;
  transform: rotate(-90deg);
  z-index: 2;
}
.vnote-rec-progress-bg {
  fill: none;
  stroke: rgba(255,255,255,0.1);
  stroke-width: 4;
}
.vnote-rec-progress-bar {
  fill: none;
  stroke: url(#vnoteGrad);
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
  filter: drop-shadow(0 0 6px var(--accent));
}

.vnote-rec-video {
  position: absolute;
  top: 6px; left: 6px;
  width: 248px;
  height: 248px;
  border-radius: 50%;
  object-fit: cover;
  background: #000;
  z-index: 1;
}

.vnote-rec-glow {
  position: absolute;
  top: -8px; left: -8px;
  width: 276px;
  height: 276px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(108,92,231,0.15) 60%, transparent 70%);
  animation: vnoteGlow 2s ease-in-out infinite;
  z-index: 0;
}
@keyframes vnoteGlow {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.06); opacity: 1; }
}

.vnote-rec-timer {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.5px;
}
.vnote-rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff4757;
  animation: vnoteDotPulse 1s ease-in-out infinite;
}
@keyframes vnoteDotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.8); }
}

.vnote-rec-actions {
  display: flex;
  gap: 32px;
  align-items: center;
}

.vnote-rec-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.vnote-rec-btn:active {
  transform: scale(0.9);
}
.vnote-rec-btn-cancel {
  background: rgba(255,255,255,0.12);
  color: #fff;
  backdrop-filter: blur(10px);
}
.vnote-rec-btn-cancel:hover {
  background: rgba(255,71,87,0.8);
}
.vnote-rec-btn-send {
  background: var(--accent);
  color: #fff;
}
.vnote-rec-btn-send:hover {
  background: var(--accent-hover, #5a4bd1);
  box-shadow: 0 4px 20px rgba(108,92,231,0.5);
}

.vnote-rec-hint {
  font-size: 12px;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.3px;
}

/* ============ VIDEO NOTES — Message Bubble ============ */
.message .msg-video-note {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  overflow: visible;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}

.message .msg-video-note video {
  width: 220px;
  height: 220px;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  background: #000;
  position: relative;
  z-index: 1;
}

.vnote-bubble-ring {
  position: absolute;
  top: -3px; left: -3px;
  width: 226px;
  height: 226px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.15);
  z-index: 2;
  transition: border-color 0.3s;
  box-sizing: border-box;
}
.vnote-bubble-ring.playing {
  border-color: var(--accent);
  animation: vnoteRingPlay 1.5s linear infinite;
}
@keyframes vnoteRingPlay {
  0% { border-color: var(--accent); box-shadow: 0 0 0 0 rgba(108,92,231,0.4); }
  50% { border-color: #a29bfe; box-shadow: 0 0 12px 2px rgba(108,92,231,0.25); }
  100% { border-color: var(--accent); box-shadow: 0 0 0 0 rgba(108,92,231,0.4); }
}

.vnote-play-btn {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.vnote-play-btn i {
  color: #fff;
  font-size: 18px;
  margin-left: 3px;
}

/* Clip in chat message */
.message .msg-clip {
  max-width: 280px;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  position: relative;
}

.message .msg-clip video {
  width: 100%;
  max-height: 300px;
  display: block;
}

.message .msg-clip .clip-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0,0,0,0.6);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  color: white;
}

/* ============ EMOJI PICKER ============ */
.emoji-picker {
  position: absolute;
  bottom: 60px;
  left: 12px;
  width: 320px;
  max-height: 280px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 40;
  overflow: hidden;
  animation: fadeInUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.emoji-picker.hidden {
  display: none;
}

.emoji-picker-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 10px;
  max-height: 280px;
  overflow-y: auto;
}

.emoji-picker-grid .emoji-item {
  font-size: 22px;
  padding: 6px;
  text-align: center;
  cursor: pointer;
  border-radius: 8px;
  transition: var(--transition);
  border: none;
  background: none;
  line-height: 1;
}

.emoji-picker-grid .emoji-item:hover {
  background: var(--bg-hover);
  transform: scale(1.2);
}

.emoji-toggle-btn {
  width: 32px !important;
  height: 32px !important;
  font-size: 16px !important;
  flex-shrink: 0;
}

/* ============ MESSAGE REACTIONS ============ */
.msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.msg-reaction {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 12px;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.msg-reaction:hover {
  background: rgba(255,255,255,0.2);
}

.msg-reaction.my-reaction {
  border-color: var(--accent);
  background: rgba(94,181,247,0.15);
}

.msg-reaction .reaction-count {
  font-size: 11px;
  color: var(--text-secondary);
}

/* ============ TOAST NOTIFICATIONS ============ */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 14px 18px;
  color: var(--text-primary);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  animation: slideInRight 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-weight: 500;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.leaving {
  animation: slideOutRight 0.3s ease forwards;
}

@keyframes slideOutRight {
  to { transform: translateX(100%); opacity: 0; }
}

.toast i {
  font-size: 16px;
}

.toast.success i { color: var(--success); }
.toast.error i { color: var(--danger); }
.toast.info i { color: var(--accent); }

/* ============ DOUBLE-TAP LIKE ANIMATION ============ */
.double-tap-heart {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-size: 80px;
  color: #ff4757;
  pointer-events: none;
  z-index: 99;
  animation: heartPop 0.8s ease forwards;
}

@keyframes heartPop {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
  50% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

/* ============ LAST SEEN / ONLINE ============ */
.last-seen-text {
  font-size: 11px;
  color: var(--text-muted);
}

/* ============ PROFILE STATUS SECTION ============ */
.profile-status-section {
  margin-top: 20px;
  width: 100%;
  max-width: 280px;
}

.profile-status-section label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============ CHAT HEADER AVATAR ONLINE DOT ============ */
.chat-header-avatar {
  position: relative;
}

.chat-header-avatar .online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: var(--online);
  border-radius: 50%;
  border: 2px solid var(--bg-sidebar);
}

/* ============ FORWARDED MESSAGE INDICATOR ============ */
.msg-forwarded {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.msg-forwarded i {
  font-size: 10px;
}

/* Fade in animation */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============ SCROLL TO BOTTOM BUTTON ============ */
.scroll-bottom-btn {
  position: absolute;
  bottom: 80px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: var(--transition);
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
}

.scroll-bottom-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.scroll-bottom-btn:hover {
  background: rgba(92, 172, 245, 0.15);
  color: var(--accent);
  border-color: rgba(92, 172, 245, 0.2);
}

.scroll-bottom-btn .unread-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ============ LOAD MORE MESSAGES ============ */
.load-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  margin: 8px auto;
  background: var(--bg-input);
  border: none;
  border-radius: 20px;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.load-more-btn:hover {
  background: var(--bg-hover);
}

.load-more-btn.loading {
  pointer-events: none;
  opacity: 0.6;
}

.load-more-btn i {
  font-size: 12px;
}

/* ============ DATE SEPARATOR ============ */
.date-separator {
  text-align: center;
  padding: 8px 0;
  position: relative;
}

.date-separator span {
  background: rgba(0,0,0,0.3);
  color: var(--text-muted);
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 12px;
}

/* ============ REPLY PREVIEW (above input) ============ */
.reply-preview-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  animation: fadeIn 0.2s ease;
}

.reply-preview-bar.hidden {
  display: none;
}

.reply-preview-bar .reply-info {
  flex: 1;
  min-width: 0;
}

.reply-preview-bar .reply-author {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.reply-preview-bar .reply-text {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reply-preview-bar .reply-close {
  flex-shrink: 0;
}

/* ============ REPLY IN MESSAGE BUBBLE ============ */
.msg-reply-block {
  padding: 6px 10px;
  background: rgba(255,255,255,0.05);
  border-left: 2px solid var(--accent);
  border-radius: 0 6px 6px 0;
  margin-bottom: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.msg-reply-block:hover {
  background: rgba(255,255,255,0.1);
}

.msg-reply-block .reply-author {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 2px;
}

.msg-reply-block .reply-text {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* ============ EDIT MESSAGE INDICATOR ============ */
.msg-edited {
  font-size: 10px;
  color: rgba(255,255,255,0.35);
  margin-right: 4px;
}

/* ============ EDIT MESSAGE INPUT BAR ============ */
.edit-preview-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border);
  border-left: 3px solid #ffa726;
  animation: fadeIn 0.2s ease;
}

.edit-preview-bar.hidden {
  display: none;
}

.edit-preview-bar .edit-info {
  flex: 1;
  min-width: 0;
}

.edit-preview-bar .edit-label {
  font-size: 12px;
  font-weight: 600;
  color: #ffa726;
}

.edit-preview-bar .edit-text {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.edit-preview-bar .edit-close {
  flex-shrink: 0;
}

/* ============ TYPING ANIMATION IN CHAT STATUS ============ */
.typing-dots {
  display: inline-flex;
  gap: 3px;
  align-items: center;
  margin-left: 4px;
}

.typing-dots span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  animation: typingBounce 1.4s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ============ MESSAGES SCROLLBAR ============ */
.messages-container::-webkit-scrollbar {
  width: 6px;
}

.messages-container::-webkit-scrollbar-track {
  background: transparent;
}

.messages-container::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.25);
}

/* ============ MSG PHOTO IMPROVEMENTS ============ */
.message .msg-photo img {
  max-width: 280px;
  max-height: 300px;
  border-radius: 8px;
  cursor: pointer;
  display: block;
}

/* ============ CONTEXT MENU - FIXED POSITION FIX ============ */
.msg-context-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 45;
}

.msg-context-menu {
  position: fixed;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 6px;
  min-width: 170px;
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 46;
  animation: contextIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes contextIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.msg-reaction-picker {
  position: fixed;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  padding: 6px 10px;
  display: flex;
  gap: 2px;
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 47;
  animation: contextIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============ SEARCH IN CHAT ============ */
.chat-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  animation: fadeIn 0.2s ease;
}

.chat-search-bar.hidden {
  display: none;
}

.chat-search-bar input {
  flex: 1;
  padding: 8px 14px;
  background: var(--bg-input);
  border: none;
  border-radius: 20px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  font-family: inherit;
}

.chat-search-bar input::placeholder {
  color: var(--text-muted);
}

.chat-search-bar .search-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.search-highlight {
  background: rgba(94,181,247,0.3);
  border-radius: 2px;
  padding: 0 1px;
}

.search-highlight.active {
  background: rgba(94,181,247,0.6);
}

/* ============ PINNED MESSAGE BAR ============ */
.pinned-message-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  animation: fadeIn 0.2s ease;
}

.pinned-message-bar.hidden {
  display: none;
}

.pinned-message-bar:hover {
  background: var(--bg-hover);
}

.pinned-message-bar .pinned-icon {
  color: var(--accent);
  font-size: 14px;
  flex-shrink: 0;
}

.pinned-message-bar .pinned-info {
  flex: 1;
  min-width: 0;
}

.pinned-message-bar .pinned-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.pinned-message-bar .pinned-text {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============ CALL SCREEN ============ */
.call-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #060d14 0%, #0f1923 50%, #0a1118 100%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.4s ease;
}

.call-screen.hidden {
  display: none;
}

/* Incoming call */
.call-incoming {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.call-incoming.hidden {
  display: none;
}

.call-incoming-content {
  text-align: center;
  animation: fadeInUp 0.5s ease;
}

.call-incoming-type {
  font-size: 14px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 24px;
}

.call-incoming-avatar {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  color: white;
  margin: 0 auto 20px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 8px 40px rgba(92, 172, 245, 0.3);
}

.call-incoming-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.call-incoming-avatar::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(94, 181, 247, 0.4);
  animation: callPulse 2s infinite;
}

@keyframes callPulse {
  0% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.1); opacity: 0.2; }
  100% { transform: scale(1); opacity: 0.6; }
}

.call-incoming-name {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 8px;
}

.call-incoming-label {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 40px;
  animation: blink 2s infinite;
}

.call-incoming-actions {
  display: flex;
  gap: 40px;
  justify-content: center;
}

.call-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  font-size: 24px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.call-btn:hover {
  transform: scale(1.1);
}

.call-btn-accept {
  background: var(--success);
  box-shadow: 0 4px 20px rgba(76, 175, 80, 0.4);
  animation: pulseAccept 2s infinite;
}

@keyframes pulseAccept {
  0%, 100% { box-shadow: 0 4px 20px rgba(76, 175, 80, 0.4); }
  50% { box-shadow: 0 4px 30px rgba(76, 175, 80, 0.7); }
}

.call-btn-reject {
  background: var(--danger);
  box-shadow: 0 4px 20px rgba(229, 57, 53, 0.4);
}

/* Active call */
.call-active {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

.call-active.hidden {
  display: none;
}

/* Video container */
.call-video-container {
  flex: 1;
  position: relative;
  background: #000;
  overflow: hidden;
}

.call-video-container.hidden {
  display: none;
}

.call-remote-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.call-local-video {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 160px;
  height: 120px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.2);
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  z-index: 5;
  cursor: move;
}

/* Avatar container (audio call) */
.call-avatar-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.call-avatar-container.hidden {
  display: none;
}

.call-avatar-large {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  color: white;
  overflow: hidden;
  position: relative;
  z-index: 2;
  box-shadow: 0 8px 40px rgba(92, 172, 245, 0.25);
}

.call-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.call-pulse-ring {
  position: absolute;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 2px solid rgba(94, 181, 247, 0.3);
  animation: callRingPulse 3s infinite;
}

@keyframes callRingPulse {
  0% { transform: scale(0.85); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0; }
  100% { transform: scale(0.85); opacity: 1; }
}

/* Call info overlay */
.call-info-overlay {
  position: absolute;
  top: 40px;
  left: 0;
  right: 0;
  text-align: center;
  z-index: 10;
  pointer-events: none;
}

.call-type-badge {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.call-peer-name {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.call-status {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.call-timer {
  font-size: 16px;
  font-weight: 500;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* Call controls */
.call-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  padding: 24px;
  background: linear-gradient(transparent, rgba(0,0,0,0.6));
}

.call-control-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-primary);
  font-family: inherit;
  transition: all 0.2s ease;
}

.call-control-btn i {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all 0.2s ease;
}

.call-control-btn span {
  font-size: 11px;
  color: var(--text-muted);
}

.call-control-btn:hover i {
  background: rgba(255,255,255,0.2);
}

.call-control-btn.active i {
  background: var(--accent);
  color: white;
}

.call-control-btn.hidden {
  display: none;
}

.call-control-btn.call-end i {
  background: var(--danger);
  color: white;
  width: 60px;
  height: 60px;
  font-size: 22px;
}

.call-control-btn.call-end:hover i {
  background: #c62828;
}

/* ============ CONTEXT MENU ITEM ============ */
.context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 14px;
  border: none;
  background: none;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  font-family: inherit;
  white-space: nowrap;
}

.context-menu-item:hover {
  background: rgba(255,255,255,0.06);
}

.context-menu-item:active {
  background: rgba(255,255,255,0.1);
}

.context-menu-item i {
  width: 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}

.context-menu-item.danger {
  color: var(--danger);
}

.context-menu-item.danger i {
  color: var(--danger);
}

/* ============ КАНАЛЫ И ГРУППЫ ============ */

/* Панели каналов/групп */
.channels-panel,
.groups-panel {
  position: absolute;
  top: 0;
  left: 0;
  width: 360px;
  height: 100%;
  background: var(--bg-sidebar);
  z-index: 20;
  display: flex;
  flex-direction: column;
  animation: slideIn 0.2s ease;
}

.channels-panel.hidden,
.groups-panel.hidden {
  display: none;
}

.create-modal.hidden {
  display: none;
}

.channel-readonly-notice.hidden {
  display: none;
}

.group-typing-area.hidden {
  display: none;
}

.channels-header,
.groups-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.channels-header h3,
.groups-header h3 {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.channels-header-actions,
.groups-header-actions {
  display: flex;
  gap: 8px;
}

.channels-search,
.groups-search {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.channels-list,
.groups-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

/* Элемент канала/группы */
.channel-item,
.group-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.2s;
  gap: 12px;
}

.channel-item:hover,
.group-item:hover {
  background: var(--bg-hover);
}

.channel-item-avatar,
.group-item-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.channel-item-avatar {
  background: linear-gradient(135deg, #7c6cf5, #5cacf5);
  color: white;
}

.group-item-avatar {
  background: linear-gradient(135deg, #43b581, #5cacf5);
  color: white;
}

.channel-item-info,
.group-item-info {
  flex: 1;
  min-width: 0;
}

.channel-item-name,
.group-item-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-item-meta,
.group-item-meta {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.owner-badge {
  color: #ffc107;
  font-size: 16px;
  flex-shrink: 0;
}

/* Иконки аватаров в хедере */
.channel-icon-avatar {
  background: linear-gradient(135deg, #7c6cf5, #5cacf5) !important;
  color: white !important;
}

.group-icon-avatar {
  background: linear-gradient(135deg, #43b581, #5cacf5) !important;
  color: white !important;
}

/* Модалки создания/редактирования */
.create-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.create-modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 90%;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.create-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.create-modal-header h4 {
  font-size: 18px;
  font-weight: 700;
}

/* Уведомление «только владелец может писать» */
.channel-readonly-notice {
  padding: 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Typing в группе */
.group-typing-area {
  padding: 4px 20px 8px;
  font-size: 13px;
  color: var(--accent);
  font-style: italic;
  animation: fadeIn 0.2s ease;
}

/* Список участников */
.members-list {
  max-height: 350px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.member-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  transition: background 0.2s;
}

.member-item:hover {
  background: var(--bg-hover);
}

.member-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.member-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.member-avatar span {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
}

.member-info {
  flex: 1;
  min-width: 0;
}

.member-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.member-role {
  font-size: 12px;
  color: var(--text-secondary);
}

.remove-member-btn {
  color: var(--danger) !important;
  opacity: 0;
  transition: opacity 0.2s;
}

.member-item:hover .remove-member-btn {
  opacity: 1;
}

.btn-small {
  padding: 6px 12px !important;
  font-size: 13px !important;
  border-radius: 8px;
}

.add-member-option {
  cursor: pointer;
}

/* Имя отправителя в группе */
.message-sender-name {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}

/* Навигация - 2 кнопки */
.sidebar-nav .nav-btn {
  padding: 10px 4px;
  min-width: 0;
}

.sidebar-nav .nav-btn span:not(.badge) {
  font-size: 10px;
}

/* ========== Расширенный редактор каналов/групп ========== */
.editor-expanded {
  max-height: 65vh;
  overflow-y: auto;
  padding-right: 4px;
}

.editor-expanded::-webkit-scrollbar {
  width: 5px;
}

.editor-expanded::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
}

.editor-section {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.editor-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.editor-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

/* Инвайт-ссылка */
.invite-link-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.invite-input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 8px 10px;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invite-link-row .btn {
  flex-shrink: 0;
  padding: 8px 10px;
  font-size: 12px;
}

/* Переключатель (toggle) */
.editor-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  cursor: pointer;
}

.editor-toggle > span {
  font-size: 13px;
  color: rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  gap: 8px;
}

.editor-toggle input[type="checkbox"] {
  display: none;
}

.toggle-slider {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  background: rgba(255,255,255,0.12);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.25s;
  flex-shrink: 0;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.25s;
  pointer-events: none;
}

.editor-toggle input[type="checkbox"]:checked + .toggle-slider {
  background: var(--accent);
}

.editor-toggle input[type="checkbox"]:checked + .toggle-slider::before {
  transform: translateX(18px);
}

/* Выпадающие списки в редакторе */
.editor-select-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}

.editor-select-row label {
  font-size: 13px;
  color: rgba(255,255,255,0.85);
}

.editor-select-row select {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: #fff;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  outline: none;
  min-width: 120px;
}

.editor-select-row select option {
  background: #1e1e2e;
  color: #fff;
}

/* Кнопка на полную ширину */
.btn-block {
  display: block;
  width: 100%;
  text-align: center;
  padding: 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.2s, opacity 0.2s;
}

.btn-block:hover {
  opacity: 0.85;
}

.btn-block + .btn-block {
  margin-top: 8px;
}

/* Действия участников */
.member-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-left: auto;
  flex-shrink: 0;
}

.member-actions .btn {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 6px;
}

.member-role-badge {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin-left: 6px;
}

/* ========== Групповые звонки ========== */
#group-call-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #16213e 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 30px 20px;
}

.group-call-header {
  text-align: center;
  flex-shrink: 0;
}

.group-call-title {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.group-call-status {
  font-size: 13px;
  color: rgba(255,255,255,0.55);
}

.group-call-timer {
  font-size: 16px;
  color: rgba(255,255,255,0.8);
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}

/* Сетка участников */
.group-call-grid {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  align-content: center;
  gap: 20px;
  padding: 20px;
  max-width: 600px;
  width: 100%;
  overflow-y: auto;
}

.group-call-participant {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  animation: gcFadeIn 0.3s ease;
}

@keyframes gcFadeIn {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

.group-call-avatar-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.3);
  position: relative;
}

.group-call-avatar-circle.speaking {
  box-shadow: 0 0 0 3px var(--accent), 0 0 25px rgba(124, 58, 237, 0.5);
  animation: gcPulse 1.5s infinite;
}

@keyframes gcPulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--accent), 0 0 25px rgba(124, 58, 237, 0.3); }
  50% { box-shadow: 0 0 0 5px var(--accent), 0 0 35px rgba(124, 58, 237, 0.5); }
}

.group-call-participant-name {
  font-size: 12px;
  color: rgba(255,255,255,0.8);
  text-align: center;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-call-participant video {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
}

/* Управление звонком */
.group-call-controls {
  display: flex;
  gap: 16px;
  flex-shrink: 0;
  padding-top: 20px;
}

.group-call-controls .call-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  transition: transform 0.15s, opacity 0.2s;
}

.group-call-controls .call-btn:hover {
  transform: scale(1.08);
}

.group-call-controls .call-btn:active {
  transform: scale(0.95);
}

.group-call-controls .call-btn.btn-mute {
  background: rgba(255,255,255,0.15);
}

.group-call-controls .call-btn.btn-mute.muted {
  background: #ef4444;
}

.group-call-controls .call-btn.btn-video {
  background: rgba(255,255,255,0.15);
}

.group-call-controls .call-btn.btn-video.active {
  background: var(--accent);
}

.group-call-controls .call-btn.btn-end {
  background: #ef4444;
  width: 64px;
  height: 64px;
  font-size: 24px;
}

/* Уведомление о звонке */
#group-call-notification {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border: 1px solid rgba(124, 58, 237, 0.4);
  border-radius: 16px;
  padding: 14px 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: gcSlideDown 0.35s ease;
  min-width: 280px;
}

@keyframes gcSlideDown {
  from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.group-call-notif-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.group-call-notif-content .notif-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
  animation: gcRing 1s infinite;
}

@keyframes gcRing {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(12deg); }
  30% { transform: rotate(-10deg); }
  45% { transform: rotate(6deg); }
  60% { transform: rotate(0); }
}

.group-call-notif-content .notif-text {
  flex: 1;
}

.group-call-notif-content .notif-text strong {
  display: block;
  color: #fff;
  font-size: 14px;
  margin-bottom: 2px;
}

.group-call-notif-content .notif-text span {
  color: rgba(255,255,255,0.55);
  font-size: 12px;
}

.group-call-notif-content .notif-actions {
  display: flex;
  gap: 8px;
}

.group-call-notif-content .notif-actions .btn {
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s;
}

.group-call-notif-content .notif-actions .btn:hover {
  opacity: 0.85;
}

.group-call-notif-content .notif-actions .btn-join {
  background: var(--accent);
  color: #fff;
}

.group-call-notif-content .notif-actions .btn-dismiss {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
}

/* Кнопка звонка в шапке группы */
.group-call-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 18px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
}

.group-call-btn:hover {
  background: rgba(255,255,255,0.08);
  color: var(--accent);
}

/* Модал передачи прав */
#channel-transfer-modal .modal-content,
#group-transfer-modal .modal-content {
  max-width: 360px;
}

.transfer-member-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}

.transfer-member-item:hover {
  background: rgba(255,255,255,0.06);
}

.transfer-member-item .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.transfer-member-item .name {
  flex: 1;
  font-size: 13px;
  color: #fff;
}

/* ============ СИСТЕМА СТАТУСОВ ============ */

/* Цветные точки статуса */
.status-dot-online {
  background: #4caf50 !important;
}

.status-dot-away {
  background: #ff9800 !important;
}

.status-dot-dnd {
  background: #e53935 !important;
}

.status-dot-invisible {
  background: #6c7883 !important;
}

/* Текст статуса в шапке чата */
.chat-header-status.status-online {
  color: #4caf50;
}

.chat-header-status.status-away {
  color: #ff9800;
}

.chat-header-status.status-dnd {
  color: #e53935;
}

/* Секция статуса в профиле */
.profile-online-status-section {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.profile-online-status-section label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.online-status-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.status-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.04);
  border: 2px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-primary);
  font-size: 13px;
}

.status-option:hover {
  background: rgba(255,255,255,0.08);
}

.status-option.active {
  border-color: var(--accent);
  background: rgba(94, 181, 247, 0.1);
}

.status-option .status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-option .status-dot.online {
  background: #4caf50;
}

.status-option .status-dot.away {
  background: #ff9800;
}

.status-option .status-dot.dnd {
  background: #e53935;
}

.status-option .status-dot.invisible {
  background: #6c7883;
}

.status-option .status-label {
  font-weight: 500;
}

/* ============ ИСТОРИИ (Stories) ============ */

/* Лента историй */
.stories-bar {
  padding: 12px 8px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  overflow: hidden;
}

.stories-list {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 4px 8px;
  scrollbar-width: none;
}

.stories-list::-webkit-scrollbar {
  display: none;
}

.story-avatar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  flex-shrink: 0;
  width: 64px;
}

.story-avatar-ring {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  padding: 3px;
  background: rgba(255,255,255,0.1);
  transition: all 0.2s;
}

.story-avatar-ring.has-story {
  background: var(--accent-gradient-vibrant);
  box-shadow: 0 0 12px rgba(92, 172, 245, 0.3);
}

.story-avatar-ring.viewed-story {
  background: rgba(255,255,255,0.2);
}

.story-avatar-ring.no-story {
  background: rgba(255,255,255,0.08);
  border: 2px dashed rgba(255,255,255,0.2);
}

.story-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

.story-avatar-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.story-avatar-item.my-story .story-avatar-img i {
  font-size: 18px;
  color: var(--accent);
}

.story-add-mini {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--bg-sidebar);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1;
}

.story-add-mini i {
  font-size: 9px;
  color: #fff;
}

.story-avatar-ring {
  position: relative;
}

.story-name {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Просмотр историй */
.story-viewer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.95);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-viewer-overlay.hidden {
  display: none;
}

.story-viewer {
  position: relative;
  width: 420px;
  max-width: 100vw;
  height: 95vh;
  max-height: 800px;
  background: #0e1621;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.story-progress-bar {
  display: flex;
  gap: 3px;
  padding: 8px 12px 0;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
}

.story-progress-segment {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
  overflow: hidden;
}

.story-progress-fill {
  width: 0;
  height: 100%;
  background: #fff;
  border-radius: 2px;
}

.story-progress-segment.complete .story-progress-fill {
  width: 100%;
  transition: none;
}

.story-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 12px 8px;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, transparent 100%);
}

.story-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.story-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.story-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.story-user-details {
  display: flex;
  flex-direction: column;
}

.story-user-name {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.story-time {
  color: rgba(255,255,255,0.6);
  font-size: 12px;
}

.story-actions-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.story-actions-top button {
  background: none;
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background 0.2s;
}

.story-actions-top button:hover {
  background: rgba(255,255,255,0.1);
}

.story-actions-top button span {
  font-size: 12px;
}

.story-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.story-content img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.story-content video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.story-text-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 600;
  color: #fff;
  text-align: center;
  padding: 40px 30px;
  word-break: break-word;
  line-height: 1.4;
}

.story-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 40px 16px 16px;
  background: linear-gradient(0deg, rgba(0,0,0,0.7) 0%, transparent 100%);
  color: #fff;
  font-size: 14px;
  text-align: center;
}

.story-caption:empty {
  display: none;
}

.story-nav {
  position: absolute;
  top: 60px;
  bottom: 60px;
  left: 0;
  right: 0;
  display: flex;
  pointer-events: none;
}

.story-nav-left,
.story-nav-right {
  flex: 1;
  cursor: pointer;
  pointer-events: auto;
}

/* Создание истории */
.story-create-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.7);
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-create-overlay.hidden {
  display: none;
}

.story-create-modal {
  background: var(--bg-secondary);
  border-radius: 16px;
  width: 400px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.story-create-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.story-create-header h3 {
  color: #fff;
  font-size: 16px;
  margin: 0;
}

.story-create-tabs {
  display: flex;
  padding: 12px 20px;
  gap: 8px;
}

.story-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.story-tab.active {
  background: rgba(94, 181, 247, 0.2);
  color: var(--accent);
}

.story-tab i {
  margin-right: 6px;
}

.story-create-body {
  padding: 0 20px 12px;
}

.story-upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  border: 2px dashed rgba(255,255,255,0.15);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  color: var(--text-secondary);
}

.story-upload-area:hover {
  border-color: var(--accent);
  background: rgba(94, 181, 247, 0.05);
}

.story-upload-area i {
  font-size: 36px;
  color: var(--accent);
}

.story-upload-area p {
  font-size: 13px;
  margin: 0;
}

.story-preview {
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
  max-height: 300px;
}

.story-preview img,
.story-preview video {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  background: #000;
}

.story-caption-input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: #fff;
  font-size: 13px;
  outline: none;
  margin-top: 8px;
}

.story-caption-input:focus {
  border-color: var(--accent);
}

.story-text-preview {
  width: 100%;
  height: 250px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
  background: #5eb5f7;
  margin-bottom: 12px;
}

.story-text-input {
  width: 80%;
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  font-weight: 600;
  text-align: center;
  resize: none;
  outline: none;
  height: 100%;
  padding: 20px;
}

.story-text-input::placeholder {
  color: rgba(255,255,255,0.5);
}

.story-bg-colors {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 8px 0;
}

.story-bg-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.story-bg-btn.active {
  border-color: #fff;
  transform: scale(1.15);
}

.story-bg-btn:hover {
  transform: scale(1.1);
}

.story-publish-btn {
  margin: 12px 20px 20px;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.story-publish-btn:hover {
  background: #4da1e0;
}

.story-publish-btn:active {
  transform: scale(0.98);
}

.story-publish-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.story-publish-btn i {
  margin-right: 6px;
}

/* ===== Панель информации о пользователе ===== */
.user-info-panel {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  max-width: 100vw;
  height: 100vh;
  background: var(--bg-secondary);
  z-index: 1100;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0,0,0,0.3);
  overflow-y: auto;
}
.user-info-panel.hidden {
  display: none;
}
.user-info-panel.open {
  right: 0;
  display: flex;
}
.user-info-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.user-info-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}
.user-info-avatar-section {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 30px 0 10px;
  background: linear-gradient(135deg, var(--accent-color), #764ba2);
}
.user-info-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 3px solid rgba(255,255,255,0.3);
}
.user-info-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.user-info-avatar i {
  font-size: 40px;
  color: var(--text-muted);
}
.user-info-online-dot {
  position: absolute;
  bottom: 15px;
  left: calc(50% + 33px);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid var(--bg-secondary);
  background: #4caf50;
}
.user-info-name {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  padding: 16px 20px 4px;
}
.user-info-status-line {
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  padding: 0 20px 16px;
}
.user-info-status-line.online {
  color: #4caf50;
}
.user-info-sections {
  padding: 8px 0;
}
.user-info-section {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}
.user-info-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 12px 20px;
  cursor: default;
  transition: background 0.15s;
}
.user-info-row:hover {
  background: var(--bg-hover);
}
.user-info-row > i {
  color: var(--text-muted);
  font-size: 18px;
  margin-top: 2px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}
.user-info-row-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.user-info-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.user-info-value {
  font-size: 15px;
  color: var(--text-primary);
  word-break: break-word;
}
.user-info-value.status-color-online { color: #4caf50; }
.user-info-value.status-color-away { color: #ff9800; }
.user-info-value.status-color-dnd { color: #f44336; }
.user-info-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
}
.user-info-action-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border: none;
  border-radius:10px;
  background: transparent;
  color: var(--text-primary);
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s;
}
.user-info-action-btn:hover {
  background: var(--bg-hover);
}
.user-info-action-btn i {
  font-size: 18px;
  color: var(--accent-color);
  width: 24px;
  text-align: center;
}
.user-info-action-btn.danger {
  color: #f44336;
}
.user-info-action-btn.danger i {
  color: #f44336;
}

@media (max-width: 600px) {
  .user-info-panel {
    width: 100vw;
    right: -100vw;
  }
}

/* Просмотры историй */
.story-viewers-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.6);
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-viewers-overlay.hidden {
  display: none;
}

.story-viewers-modal {
  background: var(--bg-secondary);
  border-radius: 16px;
  width: 340px;
  max-height: 60vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.story-viewers-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.story-viewers-header h3 {
  margin: 0;
  font-size: 15px;
  color: #fff;
}

.story-viewers-list {
  overflow-y: auto;
  padding: 8px 0;
  max-height: 50vh;
}

.story-viewer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
}

.story-viewer-item .avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}

.story-viewer-item .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.viewer-info {
  display: flex;
  flex-direction: column;
}

.viewer-name {
  color: #fff;
  font-size: 13px;
  font-weight: 500;
}

.viewer-time {
  color: var(--text-secondary);
  font-size: 11px;
}

/* ============ БОКОВОЕ МЕНЮ (Drawer) ============ */

.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0);
  z-index: 3000;
  transition: background 0.3s ease;
  pointer-events: none;
}

.drawer-overlay.open {
  background: rgba(0,0,0,0.5);
  pointer-events: auto;
}

.drawer-overlay.hidden {
  display: block !important;
  visibility: hidden;
}

.drawer-overlay.open {
  visibility: visible;
}

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 300px;
  height: 100vh;
  background: var(--bg-sidebar);
  z-index: 3001;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 4px 0 30px rgba(0,0,0,0.4);
}

.drawer.hidden {
  display: flex !important;
  visibility: hidden;
}

.drawer.open {
  transform: translateX(0);
  visibility: visible;
}

.drawer-header {
  padding: 28px 20px 24px;
  background: var(--accent-gradient-vibrant);
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

.drawer-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 70%, rgba(255,255,255,0.1) 0%, transparent 60%);
}

.drawer-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  border: 2px solid rgba(255,255,255,0.25);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  position: relative;
  z-index: 1;
}

.drawer-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.drawer-avatar span {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
}

.drawer-user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drawer-nickname {
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}

.drawer-status {
  color: rgba(255,255,255,0.7);
  font-size: 13px;
}

.drawer-menu {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

.drawer-item {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 14px 24px;
  border: none;
  background: none;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
}

.drawer-item:hover {
  background: var(--bg-hover);
}

.drawer-item i {
  width: 24px;
  text-align: center;
  font-size: 16px;
  color: var(--text-secondary);
}

.drawer-item span:first-of-type:not(.drawer-toggle) {
  flex: 1;
}

.drawer-item-danger {
  color: var(--danger);
}

.drawer-item-danger i {
  color: var(--danger);
}

.drawer-separator {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 4px 0;
}

.drawer-toggle {
  width: 42px;
  height: 24px;
  background: rgba(255,255,255,0.12);
  border-radius: 12px;
  position: relative;
  transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  margin-left: auto;
}

.drawer-toggle.active {
  background: var(--accent);
  box-shadow: 0 0 10px rgba(92, 172, 245, 0.3);
}

.drawer-toggle-dot {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.drawer-toggle.active .drawer-toggle-dot {
  transform: translateX(18px);
}

.drawer-footer {
  padding: 12px 24px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.drawer-footer span {
  font-size: 12px;
  color: var(--text-muted);
}

/* ============ СВЕТЛАЯ ТЕМА ============ */

.light-theme {
  --bg-primary: #f7f8fc;
  --bg-secondary: #eef0f5;
  --bg-chat: #e8e5de;
  --bg-sidebar: #ffffff;
  --bg-input: #f0f2f5;
  --bg-hover: #eef0f5;
  --bg-message-out: #d4f4ce;
  --bg-message-in: #ffffff;
  --text-primary: #0f1419;
  --text-secondary: #5b6b7a;
  --text-muted: #8192a4;
  --accent: #2d8cf0;
  --accent-hover: #2680db;
  --accent-dark: #d4f4ce;
  --accent-glow: rgba(45, 140, 240, 0.12);
  --accent-gradient: linear-gradient(135deg, #2d8cf0, #6c5ce7);
  --accent-gradient-vibrant: linear-gradient(135deg, #2d8cf0, #a76cf5, #f56c9c);
  --danger: #e53935;
  --danger-glow: rgba(229, 57, 53, 0.12);
  --success: #43b581;
  --online: #43b581;
  --warning: #faa61a;
  --border: rgba(0,0,0,0.06);
  --shadow: rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.08);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.12);
  --glass: rgba(255,255,255,0.9);
  --glass-border: rgba(0,0,0,0.06);
}

.light-theme .message.out .msg-text {
  color: #111b21;
}

.light-theme .message.in .msg-text {
  color: #111b21;
}

.light-theme .message .msg-meta {
  color: #667781;
}

.light-theme .sidebar {
  border-right: 1px solid var(--border);
}

.light-theme .sidebar-nav {
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
}

.light-theme .chat-item:hover,
.light-theme .chat-item.active {
  background: var(--bg-hover);
}

.light-theme .drawer-separator {
  background: rgba(0,0,0,0.08);
}

.light-theme .drawer-toggle {
  background: rgba(0,0,0,0.15);
}

.light-theme .auth-screen {
  background: linear-gradient(135deg, #e3f2fd, #f3e5f5);
}

/* ============ ИЗБРАННОЕ (Saved) PANEL ============ */
.saved-panel {
  position: absolute;
  top: 0;
  left: 0;
  width: 360px;
  height: 100%;
  background: var(--bg-sidebar);
  z-index: 20;
  display: flex;
  flex-direction: column;
  animation: slideIn 0.2s ease;
}

.saved-panel.hidden {
  display: none;
}

.saved-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.saved-header h3 {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.saved-header h3 i {
  color: var(--accent);
}

.saved-header-actions {
  display: flex;
  gap: 4px;
}

.saved-header-actions button {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: var(--transition);
}

.saved-header-actions button:hover {
  background: var(--bg-hover);
  color: var(--danger);
}

.saved-info {
  padding: 10px 16px;
  background: var(--bg-hover);
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.saved-info i {
  margin-right: 4px;
  color: var(--accent);
}

.saved-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.saved-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  margin-bottom: 6px;
  transition: var(--transition);
  position: relative;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.saved-item:hover {
  background: var(--bg-hover);
}

.saved-item.removing {
  animation: slideOutLeft 0.3s ease forwards;
}

@keyframes slideOutLeft {
  to { opacity: 0; transform: translateX(-100%); height: 0; padding: 0; margin: 0; }
}

.saved-item-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  flex-shrink: 0;
}

.saved-item-icon.photo {
  background: #4caf50;
}

.saved-item-icon.voice {
  background: #ff9800;
}

.saved-item-icon.video, .saved-item-icon.videonote, .saved-item-icon.clip {
  background: #e91e63;
}

.saved-item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.saved-source {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
}

.saved-text {
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-photo {
  max-width: 120px;
  max-height: 80px;
  border-radius: var(--radius-sm);
  margin-top: 4px;
}

.saved-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.saved-time {
  font-size: 11px;
  color: var(--text-muted);
}

.saved-remove-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  opacity: 0;
  transition: var(--transition);
}

.saved-item:hover .saved-remove-btn {
  opacity: 1;
}

.saved-remove-btn:hover {
  color: var(--danger);
  background: rgba(229, 57, 53, 0.1);
}

.saved-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.saved-empty i {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.3;
}

.saved-empty p {
  font-size: 14px;
}

/* ============ CODES PANEL (2FA) ============ */
.codes-panel {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-sidebar);
  z-index: 5;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.codes-panel.hidden {
  display: none;
}

.codes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.codes-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.codes-header h3 i {
  color: var(--accent);
}

.codes-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-input);
  font-size: 12px;
  color: var(--text-muted);
}

.codes-info i {
  font-size: 16px;
  color: var(--accent);
}

.codes-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.code-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--bg-input);
  border-radius: var(--radius);
  margin-bottom: 8px;
  transition: var(--transition);
}

.code-item:hover {
  background: var(--bg-hover);
}

.code-item.code-used {
  opacity: 0.5;
}

.code-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  flex-shrink: 0;
}

.code-item.code-used .code-icon {
  background: var(--success);
}

.code-content {
  flex: 1;
  min-width: 0;
}

.code-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  font-family: 'Courier New', monospace;
  letter-spacing: 3px;
}

.code-item.code-used .code-value {
  color: var(--text-muted);
  text-decoration: line-through;
}

.code-meta {
  display: flex;
  gap: 12px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.code-meta i {
  margin-right: 3px;
}

.code-device {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.code-status {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 4px;
}

.code-status.active {
  background: rgba(94, 181, 247, 0.15);
  color: var(--accent);
}

.code-status.used {
  background: rgba(76, 175, 80, 0.15);
  color: var(--success);
}

/* ============ CLOUD PASSWORD MODAL ============ */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-overlay.hidden {
  display: none;
}

/* VM SHOP */
.vm-shop-container, .my-gifts-container {
  background: var(--bg-secondary);
  border-radius: 20px;
  width: 420px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.vm-shop-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.vm-shop-logo {
  font-size: 18px;
  font-weight: 700;
  color: #f5a623;
  flex: 1;
}
.vm-shop-balance {
  font-size: 14px;
  color: var(--text-muted);
  background: var(--bg-sidebar);
  padding: 4px 12px;
  border-radius: 20px;
}
.vm-shop-body { padding: 20px; }
.vm-shop-packages {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.vm-pkg {
  background: var(--bg-sidebar);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.vm-pkg:hover { border-color: #f5a623; transform: translateY(-2px); box-shadow: 0 4px 16px rgba(245,166,35,0.2); }
.vm-pkg.selected { border-color: #f5a623; background: rgba(245,166,35,0.1); }
.vm-pkg-icon { font-size: 28px; margin-bottom: 6px; }
.vm-pkg-amount { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.vm-pkg-price { font-size: 14px; color: #f5a623; font-weight: 700; }
.vm-pkg-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #e74c3c;
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 8px;
}
.vm-shop-custom { margin-bottom: 16px; }
.vm-shop-custom label { font-size: 13px; color: var(--text-muted); }

/* MY GIFTS */
.my-gifts-list {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
  max-height: 60vh;
  overflow-y: auto;
}
.gift-card {
  background: var(--bg-sidebar);
  border-radius: 14px;
  padding: 16px 12px;
  text-align: center;
  border: 1px solid var(--border);
}
.gift-card .gift-emoji { font-size: 36px; margin-bottom: 6px; }
.gift-card .gift-name { font-size: 12px; font-weight: 600; margin-bottom: 2px; }
.gift-card .gift-from { font-size: 11px; color: var(--text-muted); }

/* CONFIRM DIALOG */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}
.confirm-modal {
  background: var(--bg-secondary);
  border-radius: 18px;
  padding: 28px 24px;
  width: 320px;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}
.confirm-icon { font-size: 40px; color: var(--accent); margin-bottom: 12px; }
.confirm-message { font-size: 15px; color: var(--text-primary); margin-bottom: 20px; line-height: 1.5; }
.confirm-btns { display: flex; gap: 10px; }
.confirm-btns button { flex: 1; padding: 12px; font-size: 15px; }

.modal-card {
  background: var(--bg-sidebar);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: modalIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
}

.modal-body p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.5;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

.btn-secondary {
  padding: 8px 20px;
  border: none;
  background: var(--bg-input);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

/* ============ 2FA AUTH FORM ============ */
.twofa-info {
  text-align: center;
  padding: 10px 0 20px;
}

.twofa-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #2b7de9);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-size: 24px;
  color: white;
}

.twofa-info h3 {
  color: var(--text-primary);
  font-size: 18px;
  margin-bottom: 6px;
}

.twofa-info p {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

#twofa-form .btn-secondary {
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  font-size: 15px;
}

/* ============ CLIPS TABS (SORT) ============ */
.clips-tabs {
  display: flex;
  padding: 8px;
  gap: 4px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
}

.clips-tab {
  flex: 1;
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  font-family: inherit;
}

.clips-tab.active {
  background: var(--bg-input);
  color: var(--text-primary);
}

.clips-tab:hover:not(.active) {
  background: var(--bg-hover);
}

/* ============ RESPONSIVE: SAVED & CODES PANEL ============ */
@media (max-width: 768px) {
  .saved-panel {
    width: 100%;
  }
  .codes-panel {
    width: 100%;
  }
  .modal-card {
    width: 94%;
    margin: 0 auto;
  }
}

/* ============ CAPACITOR / MOBILE APP ============ */
.server-url-group {
  margin-bottom: 10px;
}

.server-url-group input {
  font-size: 14px;
}

body.capacitor-app {
  /* Extra padding for Android status bar */
  padding-top: env(safe-area-inset-top, 24px);
}

body.capacitor-app .sidebar-header {
  padding-top: 4px;
}

body.capacitor-app .chat-header {
  padding-top: 4px;
}

/* ============ DROPDOWN ПРИКРЕПЛЕНИЯ ============ */
.attach-dropdown-wrapper {
  position: relative;
}

.attach-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  background: var(--bg-secondary, #2b2b3b);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  padding: 6px 0;
  min-width: 180px;
  z-index: 100;
  margin-bottom: 8px;
}

.attach-dropdown.hidden {
  display: none;
}

.attach-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  color: var(--text-primary, #fff);
  font-size: 14px;
  transition: background 0.15s;
}

.attach-option:hover {
  background: rgba(255,255,255,0.08);
}

.attach-option span:first-child {
  font-size: 18px;
}

/* ============ PREVIEW ВИДЕО И ДОКУМЕНТОВ ============ */
#video-preview, #doc-preview {
  position: absolute;
  bottom: 60px;
  left: 0;
  right: 0;
  background: var(--bg-secondary, #1e1e2e);
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 12px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
}

#video-preview.hidden, #doc-preview.hidden {
  display: none;
}

#video-preview video {
  max-height: 200px;
  max-width: 60%;
  border-radius: 8px;
}

.doc-preview-info {
  flex: 1;
}

#doc-preview-name {
  font-size: 14px;
  color: var(--text-primary, #fff);
  word-break: break-all;
}

#doc-preview-size {
  font-size: 12px;
  color: var(--text-secondary, #888);
  margin-top: 2px;
}

/* ============ УСТРОЙСТВА ============ */
#devices-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-primary, #1a1a2e);
  z-index: 1000;
  overflow-y: auto;
}

#devices-panel.hidden {
  display: none;
}

.devices-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.devices-header h3 {
  margin: 0;
  color: var(--text-primary, #fff);
  font-size: 18px;
}

.devices-section {
  padding: 16px;
}

.devices-section h4 {
  color: var(--accent, #6c5ce7);
  font-size: 13px;
  text-transform: uppercase;
  margin: 0 0 12px 0;
  letter-spacing: 0.5px;
}

.device-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--bg-secondary, #2b2b3b);
  margin-bottom: 8px;
}

.device-card.current-device {
  border: 1px solid var(--accent, #6c5ce7);
}

.device-icon {
  font-size: 28px;
  width: 40px;
  text-align: center;
}

.device-info {
  flex: 1;
  min-width: 0;
}

.device-name {
  font-size: 14px;
  color: var(--text-primary, #fff);
  font-weight: 500;
}

.device-meta {
  font-size: 12px;
  color: var(--text-secondary, #888);
  margin-top: 2px;
}

.device-terminate-btn {
  background: none;
  border: none;
  color: #e74c3c;
  font-size: 18px;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: background 0.15s;
}

.device-terminate-btn:hover {
  background: rgba(231,76,60,0.15);
}

.no-devices {
  text-align: center;
  color: var(--text-secondary, #888);
  padding: 20px;
  font-size: 14px;
}

#terminate-all-sessions-btn {
  width: 100%;
  padding: 12px;
  margin-top: 12px;
  background: rgba(231,76,60,0.15);
  color: #e74c3c;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

#terminate-all-sessions-btn:hover {
  background: rgba(231,76,60,0.25);
}

#terminate-all-sessions-btn.hidden {
  display: none;
}

/* Сообщение с документом */
.msg-document {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.msg-document .doc-icon {
  font-size: 28px;
}

.msg-document .doc-name {
  font-size: 14px;
  color: var(--accent, #6c5ce7);
  word-break: break-all;
}

/* ============ AUTH FORGOT PASSWORD LINK ============ */
.auth-forgot {
  text-align: center;
  margin-top: 12px;
}
.auth-forgot a {
  color: var(--accent);
  font-size: 13px;
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.auth-forgot a:hover {
  opacity: 1;
  text-decoration: underline;
}

/* === Пошаговая регистрация === */
.register-step {
  display: none;
  animation: fadeIn 0.35s ease;
}
.register-step.active {
  display: block;
}
.register-step-header {
  text-align: center;
  margin-bottom: 8px;
}
.register-step-header h3 {
  color: var(--text-primary);
}
.register-step-header p {
  color: var(--text-secondary);
}
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  transition: all 0.3s ease;
}
.step-dot.active {
  width: 28px;
  border-radius: 6px;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(92, 172, 245, 0.45);
}
.step-dot.done {
  background: #43b581;
  box-shadow: 0 0 6px rgba(67, 181, 129, 0.4);
}
.register-next-btn,
.register-prev-btn {
  width: 100%;
}
.register-step .btn-secondary {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-secondary);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.register-step .btn-secondary:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
}

/* ============ SET EMAIL MODAL BOX ============ */
.modal-box {
  background: var(--bg-sidebar);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 400px;
  padding: 28px 24px;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-box .input-group {
  margin-bottom: 12px;
}
.modal-box .btn-primary {
  width: 100%;
  margin-top: 8px;
}
.modal-box .auth-error {
  margin-top: 8px;
}

/* ============ VOLTIX MAIL ITEMS ============ */
.mail-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
}
.mail-item:hover {
  background: rgba(255,255,255,0.03);
}
.mail-item.unread {
  background: rgba(108, 92, 231, 0.08);
}
.mail-item-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.mail-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  flex-shrink: 0;
}
.mail-item.unread .mail-item-icon {
  background: var(--accent);
}
.mail-item:not(.unread) .mail-item-icon {
  background: var(--bg-input);
  color: var(--text-secondary);
}
.mail-item-info {
  flex: 1;
  min-width: 0;
}
.mail-item-subject {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mail-item-date {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.mail-item-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: pre-wrap;
  margin-left: 48px;
}

/* ============ СТИКЕРЫ ============ */
#sticker-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: var(--transition-fast);
}
#sticker-toggle:hover {
  color: var(--accent);
  background: var(--accent-glow);
}

#sticker-picker {
  position: absolute;
  bottom: 60px;
  left: 60px;
  width: 340px;
  max-height: 380px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  overflow: hidden;
  animation: fadeInUp 0.2s ease;
}

.sticker-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 6px 6px 0;
  gap: 2px;
  overflow-x: auto;
}
.sticker-tab {
  flex: 0 0 auto;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 20px;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  transition: var(--transition-fast);
}
.sticker-tab:hover {
  background: var(--hover);
}
.sticker-tab.active {
  border-bottom-color: var(--accent);
  color: var(--accent);
}
.sticker-add-tab {
  font-size: 16px;
  opacity: 0.5;
}
.sticker-add-tab:hover { opacity: 1; }

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 8px;
  max-height: 310px;
  overflow-y: auto;
}
.sticker-item.tg-sticker {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 12px;
  padding: 8px 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 76px;
}
.sticker-item.tg-sticker:hover {
  background: var(--hover);
  transform: scale(1.15);
}
.sticker-item.tg-sticker:active {
  transform: scale(0.9);
}
.tg-sticker-emoji {
  font-size: 36px;
  line-height: 1.1;
}
.tg-sticker-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sticker-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 30px;
  font-size: 13px;
}

/* Стикер в сообщении — Telegram стиль */
.msg-sticker-tg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 140px;
  padding: 8px;
}
.msg-sticker-tg[data-anim="bounce"] {
  animation: tgStickerBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.msg-sticker-tg[data-anim="shake"] {
  animation: tgStickerShake 0.6s ease;
}
.msg-sticker-tg[data-anim="pulse"] {
  animation: tgStickerPulse 0.8s ease;
}
.msg-sticker-tg[data-anim="float"] {
  animation: tgStickerFloat 1s ease;
}
@keyframes tgStickerBounce {
  0% { transform: scale(0.2); opacity: 0; }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes tgStickerShake {
  0% { transform: translateX(-8px) scale(0.8); opacity: 0; }
  25% { transform: translateX(6px) scale(1.05); }
  50% { transform: translateX(-4px) scale(1); }
  75% { transform: translateX(2px); }
  100% { transform: translateX(0); opacity: 1; }
}
@keyframes tgStickerPulse {
  0% { transform: scale(0.5); opacity: 0; }
  40% { transform: scale(1.1); }
  60% { transform: scale(0.95); }
  80% { transform: scale(1.03); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes tgStickerFloat {
  0% { transform: translateY(20px) scale(0.8); opacity: 0; }
  60% { transform: translateY(-5px) scale(1.02); }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
.tg-sticker-emoji-msg {
  font-size: 72px;
  line-height: 1;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.15));
}
.tg-sticker-label-msg {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 500;
}
/* Стикер-сообщение без пузыря */
.message:has(.msg-sticker-tg) .message-content {
  background: transparent !important;
  box-shadow: none !important;
  padding: 4px !important;
}

/* Стикер создание модалка */
.sticker-create-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.sticker-create-content {
  background: var(--bg-sidebar);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 320px;
  max-width: 90vw;
  animation: fadeInUp 0.3s ease;
}
.sticker-create-content h3 {
  text-align: center;
  margin-bottom: 16px;
}
.sticker-create-preview {
  width: 100px;
  height: 100px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  transition: background 0.3s;
}
.sticker-create-preview .sticker-emoji { font-size: 36px; }
.sticker-create-preview .sticker-label { font-size: 11px; color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.sticker-colors {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 12px 0;
}
.sticker-color-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
}
.sticker-color-btn.active {
  border-color: white;
  box-shadow: 0 0 8px rgba(255,255,255,0.3);
}

/* ============ КНОПКА УДАЛЕНИЯ ВИДЕО ============ */
.msg-video {
  position: relative;
}
.msg-video-delete-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(240, 71, 71, 0.85);
  border: none;
  color: white;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition-fast);
  z-index: 5;
}
.msg-video:hover .msg-video-delete-btn {
  opacity: 1;
}
.msg-video-delete-btn:hover {
  background: var(--danger);
  transform: scale(1.1);
}

/* ============ ЖУРНАЛ ОБНОВЛЕНИЙ ============ */
.invite-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  animation: fadeIn 0.3s ease;
}
.invite-modal {
  background: var(--bg-secondary);
  border-radius: 20px;
  padding: 32px 28px;
  width: 340px;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.invite-modal .invite-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent-gradient);
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: white;
  overflow: hidden;
}
.invite-modal .invite-avatar img { width: 100%; height: 100%; object-fit: cover; }
.invite-modal h3 { font-size: 22px; margin-bottom: 8px; }
.invite-modal .invite-desc { color: var(--text-muted); font-size: 14px; margin-bottom: 8px; }
.invite-modal .invite-meta { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }
.invite-modal .invite-btns { display: flex; flex-direction: column; gap: 10px; }
.invite-modal .invite-join-btn { width: 100%; padding: 14px; }
.invite-modal .invite-cancel-btn { width: 100%; padding: 12px; background: var(--bg-sidebar); border: none; border-radius: 12px; color: var(--text-muted); cursor: pointer; font-size: 15px; font-family: inherit; }

.changelog-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.changelog-content {
  background: var(--bg-sidebar);
  border-radius: var(--radius-xl);
  width: 400px;
  max-width: 90vw;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: fadeInUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-xl);
}
.changelog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 12px;
}
.changelog-header h3 {
  font-size: 18px;
  background: var(--accent-gradient-vibrant);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.changelog-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
}
.changelog-body {
  padding: 0 24px;
  overflow-y: auto;
  flex: 1;
}
.changelog-version {
  margin-bottom: 20px;
}
.changelog-version-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.changelog-ver-badge {
  background: var(--accent-gradient);
  color: white;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
}
.changelog-date {
  font-size: 12px;
  color: var(--text-muted);
}
.changelog-version h4 {
  font-size: 15px;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.changelog-list {
  list-style: none;
  padding: 0;
}
.changelog-list li {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 4px 0;
  padding-left: 8px;
  border-left: 2px solid var(--border);
  margin-bottom: 4px;
}
.changelog-ok-btn {
  margin: 16px 24px 20px;
  width: calc(100% - 48px);
}

/* ============ ПАНЕЛЬ ОФОРМЛЕНИЯ ============ */
.design-panel {
  position: fixed;
  top: 0;
  right: -100%;
  width: 360px;
  max-width: 100vw;
  height: 100vh;
  background: var(--bg-sidebar);
  z-index: 10000;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
}
.design-panel.open {
  right: 0;
}
.theme-toggle-row {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}
.theme-mode-btn {
  flex: 1;
  padding: 12px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.theme-mode-btn.active {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
}
.theme-mode-btn:hover {
  background: var(--bg-hover);
}
.accent-colors {
  display: flex;
  gap: 10px;
  margin: 12px 0;
  flex-wrap: wrap;
}
.accent-color-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
}
.accent-color-btn:hover {
  transform: scale(1.15);
}
.accent-color-btn.active {
  border-color: white;
  box-shadow: 0 0 12px rgba(255,255,255,0.3);
}
.chat-style-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 12px 0;
}
.chat-style-btn {
  padding: 12px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition-fast);
  text-align: center;
}
.chat-style-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}
.chat-style-btn:hover {
  background: var(--bg-hover);
}

/* ============ ЦВЕТОВЫЕ АКЦЕНТЫ ============ */
[data-accent="purple"] {
  --accent: #9c6cf5;
  --accent-hover: #8a5ae4;
  --accent-dark: #4a2d73;
  --accent-glow: rgba(156, 108, 245, 0.15);
  --accent-gradient: linear-gradient(135deg, #9c6cf5, #c76cf5);
  --bg-message-out: #3d2873;
}
[data-accent="green"] {
  --accent: #43b581;
  --accent-hover: #3aa070;
  --accent-dark: #1e5a3d;
  --accent-glow: rgba(67, 181, 129, 0.15);
  --accent-gradient: linear-gradient(135deg, #43b581, #6cf5b5);
  --bg-message-out: #1e4a3d;
}
[data-accent="pink"] {
  --accent: #f56c9c;
  --accent-hover: #e45a8a;
  --accent-dark: #732d4a;
  --accent-glow: rgba(245, 108, 156, 0.15);
  --accent-gradient: linear-gradient(135deg, #f56c9c, #f5a06c);
  --bg-message-out: #5a2040;
}
[data-accent="orange"] {
  --accent: #ff9800;
  --accent-hover: #e68a00;
  --accent-dark: #734400;
  --accent-glow: rgba(255, 152, 0, 0.15);
  --accent-gradient: linear-gradient(135deg, #ff9800, #ffcc00);
  --bg-message-out: #5a3a10;
}
[data-accent="red"] {
  --accent: #f04747;
  --accent-hover: #d93636;
  --accent-dark: #731e1e;
  --accent-glow: rgba(240, 71, 71, 0.15);
  --accent-gradient: linear-gradient(135deg, #f04747, #f57c6c);
  --bg-message-out: #5a1a1a;
}

/* ============ СТИЛИ ЧАТА ============ */
[data-chat-style="bubbles"] .message {
  border-radius: 20px;
  padding: 10px 16px;
}
[data-chat-style="bubbles"] .message.out {
  border-bottom-right-radius: 4px;
}
[data-chat-style="bubbles"] .message.in {
  border-bottom-left-radius: 4px;
}
[data-chat-style="minimal"] .message {
  background: transparent !important;
  border-left: 3px solid var(--accent);
  border-radius: 0;
  padding: 8px 12px;
  margin: 2px 0;
}
[data-chat-style="minimal"] .message.out {
  border-left: none;
  border-right: 3px solid var(--accent);
}
[data-chat-style="compact"] .message {
  padding: 6px 10px;
  border-radius: 8px;
  margin: 1px 0;
  max-width: 85%;
}
[data-chat-style="compact"] .msg-meta { font-size: 10px; }

/* ============ СВЕТЛАЯ ТЕМА (улучшенная) ============ */
.light-theme {
  --bg-primary: #ffffff;
  --bg-secondary: #f0f2f5;
  --bg-chat: #e8ecf0;
  --bg-sidebar: #ffffff;
  --bg-input: #f0f2f5;
  --bg-hover: #e8ecf0;
  --bg-message-out: #d9f0ff;
  --bg-message-in: #ffffff;
  --text-primary: #1a1a2e;
  --text-secondary: #65676b;
  --text-muted: #8e8e93;
  --border: rgba(0,0,0,0.08);
  --shadow: rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.1);
  --glass: rgba(255, 255, 255, 0.9);
  --glass-border: rgba(0,0,0,0.06);
}
.light-theme .message.in { box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.light-theme .message.out { box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.light-theme .sidebar { border-right: 1px solid var(--border); }
.light-theme .msg-context-menu { background: white; border: 1px solid var(--border); }
.light-theme .msg-reaction-picker { background: white; border: 1px solid var(--border); }
.light-theme .drawer { background: white; }
.light-theme .sticker-create-modal .sticker-create-content { background: white; }
.light-theme .changelog-content { background: white; }
.light-theme .design-panel { background: white; }

/* ============ CALL PIP WIDGET ============ */
.call-pip {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  background: var(--bg-sidebar);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
  cursor: pointer;
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  animation: pip-slide-in 0.3s ease;
}
@keyframes pip-slide-in {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.call-pip-content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}
.call-pip-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.call-pip-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  overflow: hidden;
  flex-shrink: 0;
}
.call-pip-details {
  display: flex;
  flex-direction: column;
}
.call-pip-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.call-pip-timer {
  font-size: 11px;
  color: var(--accent);
  font-weight: 500;
}
.call-pip-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.call-pip-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--bg-hover);
  color: var(--text-primary);
  font-size: 13px;
  transition: all 0.2s;
}
.call-pip-btn:hover {
  background: var(--accent);
  color: #fff;
}
.call-pip-btn.call-pip-end {
  background: #f44336;
  color: #fff;
}
.call-pip-btn.call-pip-end:hover {
  background: #d32f2f;
}

/* ============ BIRTHDAY MODAL ============ */
#set-birthdate-modal {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
#set-birthdate-modal .modal-content {
  background: var(--bg-main);
  border-radius: 16px;
  padding: 28px;
  max-width: 370px;
  width: 90%;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}
#set-birthdate-modal h3 {
  margin: 0 0 8px;
  color: var(--text-primary);
  font-size: 18px;
}
#set-birthdate-modal p {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 16px;
}
#set-birthdate-modal input[type="date"] {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 15px;
  margin-bottom: 16px;
  box-sizing: border-box;
}
#set-birthdate-modal .modal-btns {
  display: flex;
  gap: 10px;
}
#set-birthdate-modal .modal-btns button {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

/* ============ STICKER SEARCH & SERVER PACKS ============ */
.sticker-search {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
.sticker-search-field {
  flex: 1;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}
.sticker-search-field:focus {
  border-color: var(--accent);
}
.server-sticker-item {
  width: 72px;
  height: 72px;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sticker-pack-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  grid-column: 1 / -1;
}
.sticker-search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  grid-column: 1 / -1;
}
.sticker-search-pack-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sticker-pack-menu {
  position: absolute;
  bottom: 48px;
  right: 8px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  z-index: 100;
  overflow: hidden;
}
.sticker-pack-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 13px;
  white-space: nowrap;
  width: 100%;
  text-align: left;
}
.sticker-pack-menu-item:hover {
  background: var(--bg-hover);
}
.msg-sticker-image {
  padding: 4px 0;
}

/* ============ GROUP CALL IMPROVEMENTS ============ */
.recording-active {
  color: #f44336 !important;
  animation: pulse-recording 1s infinite;
}
@keyframes pulse-recording {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Group call screen share button */
#group-call-screen-btn.active {
  background: var(--accent);
  color: #fff;
}

/* ============ MULTI-PHOTO BADGE ============ */
.multi-photo-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--accent);
  color: #fff;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 13px;
  z-index: 10;
  font-weight: 600;
}

/* ===== Share Target Picker (Android Intent) ===== */
.share-target-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .2s;
}
.share-target-modal {
  background: var(--sidebar-bg, #17212b);
  border-radius: 14px;
  width: 340px; max-width: 92vw;
  max-height: 70vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,.45);
}
.share-target-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  font-size: 16px; font-weight: 600; color: #e1e3e6;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.share-target-close {
  background: none; border: none; color: #8e99a4; font-size: 22px; cursor: pointer;
}
.share-target-search {
  margin: 10px 14px 6px;
  padding: 8px 12px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  color: #e1e3e6; font-size: 14px; outline: none;
}
.share-target-search::placeholder { color: #6c7883; }
.share-target-list {
  overflow-y: auto; flex: 1; padding: 6px 0;
}
.share-target-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px; cursor: pointer;
  transition: background .15s;
}
.share-target-item:hover { background: rgba(255,255,255,.07); }
.share-target-icon { font-size: 22px; }
.share-target-name { color: #e1e3e6; font-size: 15px; }
