/* ═══════════════════════════════════════════════════════════════
   NovaClub — Main Stylesheet
   Theme: Dark Nova | Colors: #0d1117 bg | #7c3aed accent | #06b6d4 cyan
   ═══════════════════════════════════════════════════════════════ */

/* ── Variables ── */
:root {
  --bg-base:       #0d1117;
  --bg-surface:    #161b22;
  --bg-elevated:   #1c2128;
  --bg-hover:      #21262d;
  --bg-active:     #2d333b;

  --accent:        #7c3aed;
  --accent-light:  #9d5cf5;
  --accent-dim:    rgba(124,58,237,.15);
  --cyan:          #06b6d4;
  --cyan-dim:      rgba(6,182,212,.15);

  --text-primary:  #e6edf3;
  --text-secondary:#8b949e;
  --text-muted:    #484f58;

  --border:        rgba(255,255,255,.07);
  --border-accent: rgba(124,58,237,.4);

  --danger:        #f85149;
  --success:       #3fb950;
  --warning:       #d29922;

  --radius-sm:     6px;
  --radius-md:     10px;
  --radius-lg:     16px;
  --radius-xl:     22px;

  --shadow-sm:     0 1px 3px rgba(0,0,0,.4);
  --shadow-md:     0 4px 16px rgba(0,0,0,.5);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.6);
  --shadow-glow:   0 0 24px rgba(124,58,237,.25);

  --sidebar-w:     260px;
  --members-w:     220px;
  --header-h:      52px;
  --input-h:       68px;

  --font-fa:       'Segoe UI', Tahoma, 'Vazirmatn', sans-serif;
  --transition:    .18s cubic-bezier(.4,0,.2,1);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: var(--font-fa); background: var(--bg-base); color: var(--text-primary); line-height: 1.6; overflow: hidden; height: 100dvh; }
a { color: var(--accent-light); text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; }
textarea { resize: none; }
img { max-width: 100%; border-radius: var(--radius-sm); }
[x-cloak] { display: none !important; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-active); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ══════════════════════════════════════════════
   AUTH PAGES
   ══════════════════════════════════════════════ */
.auth-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100dvh; overflow: auto;
  background: var(--bg-base);
}

/* Grid background */
.bg-grid {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(124,58,237,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124,58,237,.04) 1px, transparent 1px);
  background-size: 40px 40px;
}

.bg-glow {
  position: fixed; border-radius: 50%; filter: blur(120px);
  pointer-events: none; z-index: 0; opacity: .35;
}
.bg-glow-1 { width: 600px; height: 600px; background: var(--accent); top: -200px; right: -200px; }
.bg-glow-2 { width: 400px; height: 400px; background: var(--cyan); bottom: -100px; left: -100px; opacity: .2; }

.auth-container {
  position: relative; z-index: 1;
  width: 100%; max-width: 420px; margin: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(124,58,237,.1);
}

/* Logo */
.auth-logo {
  display: flex; align-items: center; gap: 12px;
  justify-content: center; margin-bottom: 28px;
}
.auth-logo-text {
  font-size: 1.6rem; font-weight: 700; color: var(--text-primary);
}
.auth-logo-text span { color: var(--accent-light); }

/* Tabs */
.auth-tabs {
  position: relative; display: flex;
  background: var(--bg-base);
  border-radius: var(--radius-md);
  padding: 4px; gap: 4px;
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1; padding: 9px;
  border-radius: calc(var(--radius-md) - 2px);
  font-size: .9rem; font-weight: 600;
  color: var(--text-secondary);
  transition: var(--transition); z-index: 1; position: relative;
}
.auth-tab.active { color: var(--text-primary); }
.auth-tab-indicator {
  position: absolute; top: 4px; left: 4px;
  width: calc(50% - 6px); height: calc(100% - 8px);
  background: var(--bg-elevated);
  border-radius: calc(var(--radius-md) - 2px);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition);
}

/* Alert */
.auth-alert {
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: .88rem; margin-bottom: 16px;
  border-right: 3px solid;
}
.alert-error   { background: rgba(248,81,73,.1); border-color: var(--danger); color: #ff7b72; }
.alert-success { background: rgba(63,185,80,.1); border-color: var(--success); color: #7ee787; }

/* Form */
.auth-form { display: flex; flex-direction: column; gap: 18px; }
.form-group { display: flex; flex-direction: column; gap: 7px; }
.form-label {
  font-size: .82rem; font-weight: 600;
  color: var(--text-secondary); letter-spacing: .3px;
  display: flex; align-items: center; justify-content: space-between;
}
.form-hint { font-weight: 400; color: var(--text-muted); font-size: .78rem; }

.input-wrapper { position: relative; display: flex; align-items: center; }
.input-icon {
  position: absolute; right: 12px;
  color: var(--text-muted); display: flex; align-items: center;
  font-size: .9rem; pointer-events: none;
}
.form-input {
  width: 100%;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 40px 11px 40px;
  color: var(--text-primary);
  font-size: .92rem;
  transition: var(--transition);
  outline: none;
}
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-input::placeholder { color: var(--text-muted); }

textarea.form-input {
  padding: 11px 14px; resize: vertical; min-height: 80px;
}

.input-eye, .input-status {
  position: absolute; left: 12px;
  color: var(--text-muted); display: flex; align-items: center;
  font-size: .85rem;
}
.input-eye:hover { color: var(--text-secondary); }
.status-ok    { color: var(--success); font-weight: 700; }
.status-error { color: var(--danger); font-weight: 700; }

/* Password strength */
.pass-strength {
  display: flex; align-items: center; gap: 8px; margin-top: 4px;
}
.pass-bar {
  height: 3px; border-radius: 3px; transition: width .3s, background .3s;
  max-width: 120px;
}
.strength-weak      { background: var(--danger); }
.strength-medium    { background: var(--warning); }
.strength-strong    { background: var(--success); }
.strength-very-strong { background: var(--cyan); }
.pass-label { font-size: .78rem; color: var(--text-muted); }

/* Buttons */
.btn-primary {
  width: 100%; padding: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: white; border-radius: var(--radius-md);
  font-size: .95rem; font-weight: 700;
  transition: var(--transition); position: relative; overflow: hidden;
  box-shadow: 0 4px 15px rgba(124,58,237,.3);
  margin-top: 6px;
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(124,58,237,.45);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

/* Loading dots */
.loading-dots span {
  animation: blink 1.4s infinite;
  display: inline-block;
}
.loading-dots span:nth-child(2) { animation-delay: .2s; }
.loading-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100%{opacity:0} 40%{opacity:1} }

.auth-footer {
  text-align: center; margin-top: 20px;
  font-size: .77rem; color: var(--text-muted);
}

/* Transitions */
.fade-in { animation: fadeIn .25s ease; }
@keyframes fadeIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:none} }

/* ══════════════════════════════════════════════
   APP LAYOUT
   ══════════════════════════════════════════════ */
.app-body {
  display: flex; height: 100dvh; overflow: hidden;
  background: var(--bg-base);
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden; z-index: 200;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: 0 16px;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1rem; color: var(--text-primary);
}
.sidebar-close { display: none; color: var(--text-muted); padding: 4px; }

/* Search */
.sidebar-search { padding: 12px; position: relative; }
.search-input-wrap {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
}
.search-icon { color: var(--text-muted); flex-shrink: 0; }
.search-input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text-primary); font-size: .85rem;
}
.search-input::placeholder { color: var(--text-muted); }
.search-results {
  position: absolute; top: 100%; right: 12px; left: 12px; z-index: 50;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  max-height: 250px; overflow-y: auto;
}
.search-result-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; cursor: pointer;
  transition: var(--transition);
}
.search-result-item:hover { background: var(--bg-hover); }
.result-name { font-size: .88rem; font-weight: 600; }
.result-username { font-size: .78rem; color: var(--text-muted); }

/* Section */
.sidebar-section { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 0; }
.section-header {
  padding: 6px 16px 4px;
  font-size: .72rem; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .8px;
  display: flex; align-items: center; justify-content: space-between;
}
.section-btn {
  width: 18px; height: 18px; border-radius: 4px;
  background: var(--bg-hover); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; line-height: 1;
  transition: var(--transition);
}
.section-btn:hover { background: var(--accent-dim); color: var(--accent-light); }

/* Room items */
.room-list { display: flex; flex-direction: column; gap: 1px; padding: 0 8px; }
.room-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: .88rem;
  transition: var(--transition); position: relative;
  text-decoration: none;
}
.room-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.room-item.active {
  background: var(--accent-dim);
  color: var(--text-primary);
}
.room-item.active::before {
  content: ''; position: absolute; right: -8px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%; background: var(--accent);
  border-radius: 3px;
}
.room-hash { font-size: .9rem; width: 18px; text-align: center; flex-shrink: 0; }
.room-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-badge {
  background: var(--danger); color: white;
  font-size: .7rem; font-weight: 700;
  min-width: 18px; height: 18px;
  border-radius: 9px; padding: 0 5px;
  display: flex; align-items: center; justify-content: center;
}

/* DM items */
.dm-item { gap: 10px; }
.dm-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; color: white; flex-shrink: 0;
}
.dm-info { flex: 1; overflow: hidden; }
.dm-name { font-size: .85rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-preview { font-size: .75rem; color: var(--text-muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Profile bar */
.sidebar-profile {
  padding: 10px 12px;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.profile-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem; color: white;
  overflow: hidden;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-info { flex: 1; overflow: hidden; }
.profile-name { font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-username { font-size: .75rem; color: var(--text-muted); }
.profile-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: var(--transition);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-secondary); }
.icon-btn-danger:hover { background: rgba(248,81,73,.15); color: var(--danger); }

/* ── CHAT MAIN ── */
.chat-main {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; min-width: 0;
}

.chat-header {
  height: var(--header-h); flex-shrink: 0;
  padding: 0 16px;
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.menu-btn {
  display: none; color: var(--text-secondary);
  padding: 6px; border-radius: var(--radius-sm);
  transition: var(--transition);
}
.menu-btn:hover { background: var(--bg-hover); }
.chat-header-icon { font-size: 1.1rem; }
.chat-header-name { font-size: .95rem; font-weight: 700; }
.chat-header-desc { font-size: .78rem; color: var(--text-muted); }
.chat-header-actions { margin-right: auto; display: flex; gap: 4px; }
.dm-avatar-sm {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; color: white; flex-shrink: 0;
}

/* Messages area */
.messages-area {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 16px 0 8px;
  display: flex; flex-direction: column;
  scroll-behavior: smooth;
}

/* Welcome */
.welcome-screen {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 24px; text-align: center; gap: 16px;
  animation: fadeIn .4s ease;
}
.welcome-logo svg { filter: drop-shadow(0 0 30px rgba(124,58,237,.4)); }
.welcome-title { font-size: 1.5rem; font-weight: 700; }
.welcome-sub { color: var(--text-secondary); font-size: .95rem; }
.welcome-tips {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 28px; text-align: right;
}
.tip-item {
  display: flex; align-items: center; gap: 12px;
  font-size: .88rem; color: var(--text-secondary);
}

/* Loading spinner */
.messages-loading {
  flex: 1; display: flex; align-items: center; justify-content: center;
}
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Messages list */
.messages-list { display: flex; flex-direction: column; padding: 0 16px; gap: 2px; }

/* Message group */
.message-group {
  display: flex; gap: 12px; padding: 3px 8px;
  border-radius: var(--radius-md);
  transition: background var(--transition);
  position: relative;
}
.message-group:hover { background: var(--bg-hover); }
.message-group:hover .msg-actions { opacity: 1; pointer-events: all; }
.message-continued { margin-top: 0; }
.message-continued .msg-meta { display: none; }

.msg-avatar-wrap { flex-shrink: 0; padding-top: 2px; }
.msg-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem; color: white;
}
.msg-avatar-placeholder { width: 36px; flex-shrink: 0; }

.msg-body { flex: 1; min-width: 0; }
.msg-meta {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px;
}
.msg-author { font-weight: 700; font-size: .9rem; }
.msg-time { font-size: .75rem; color: var(--text-muted); }

.msg-bubble {
  font-size: .9rem; line-height: 1.65;
  color: var(--text-primary); word-break: break-word;
  white-space: pre-wrap;
}
.msg-bubble.deleted .deleted-text {
  color: var(--text-muted); font-style: italic; font-size: .85rem;
}

/* Reactions */
.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction-chip {
  display: flex; align-items: center; gap: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px; padding: 2px 8px;
  font-size: .82rem; transition: var(--transition);
  cursor: pointer;
}
.reaction-chip:hover, .reaction-chip.reaction-mine {
  background: var(--accent-dim);
  border-color: var(--border-accent);
}

/* Message actions */
.msg-actions {
  position: absolute; top: -14px; left: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px 6px;
  display: flex; gap: 2px;
  opacity: 0; pointer-events: none;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  z-index: 10;
}
.msg-action-btn {
  padding: 4px 8px; border-radius: var(--radius-sm);
  font-size: .82rem; transition: var(--transition);
  color: var(--text-secondary);
}
.msg-action-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.msg-action-btn.danger:hover { background: rgba(248,81,73,.15); color: var(--danger); }

/* Typing indicator */
.typing-indicator {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; font-size: .82rem; color: var(--text-muted);
}
.typing-dots { display: flex; gap: 3px; }
.typing-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-muted);
  animation: typing 1.4s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes typing { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-6px)} }

/* Reply preview */
.reply-preview { padding: 0 16px 8px; }
.reply-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-elevated);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  border-right: 3px solid var(--accent);
}
.reply-label { color: var(--text-muted); font-size: .8rem; }
.reply-author { color: var(--accent-light); font-weight: 600; font-size: .85rem; }
.reply-content { color: var(--text-secondary); font-size: .82rem; }
.reply-cancel { color: var(--text-muted); font-size: .85rem; padding: 2px 6px; }
.reply-cancel:hover { color: var(--danger); }

/* Input area */
.input-area {
  padding: 0 16px 16px; flex-shrink: 0;
}
.input-box {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px;
  transition: var(--transition);
}
.input-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.message-input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text-primary); font-size: .92rem;
  padding: 6px 4px; max-height: 150px; overflow-y: auto;
  line-height: 1.5;
}
.message-input::placeholder { color: var(--text-muted); }
.attach-btn, .emoji-btn, .send-btn {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: var(--transition);
  color: var(--text-muted);
}
.attach-btn:hover, .emoji-btn:hover { color: var(--text-secondary); background: var(--bg-hover); }
.send-btn {
  background: var(--accent); color: white;
  box-shadow: 0 2px 8px rgba(124,58,237,.3);
}
.send-btn:hover:not(:disabled) {
  background: var(--accent-light);
  box-shadow: 0 4px 12px rgba(124,58,237,.5);
  transform: scale(1.05);
}
.send-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

/* ── MEMBERS PANEL ── */
.members-panel {
  width: var(--members-w); flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.members-header {
  padding: 16px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: .8rem; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .6px;
  border-bottom: 1px solid var(--border);
}
.members-count {
  background: var(--bg-active); color: var(--text-secondary);
  font-size: .75rem; padding: 1px 7px; border-radius: 10px;
}
.members-list { flex: 1; overflow-y: auto; padding: 8px; }
.member-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: var(--radius-sm);
  cursor: pointer; transition: var(--transition);
}
.member-item:hover { background: var(--bg-hover); }
.member-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem; color: white; flex-shrink: 0;
}
.member-info { flex: 1; overflow: hidden; }
.member-name { font-size: .85rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-role { font-size: .72rem; color: var(--text-muted); }
.members-empty { text-align: center; padding: 24px; font-size: .85rem; color: var(--text-muted); }

/* Online dot */
.online-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px rgba(63,185,80,.6);
  flex-shrink: 0;
}

/* ── MINI AVATAR ── */
.mini-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; color: white; flex-shrink: 0;
}

/* ── MODALS ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  padding: 20px;
}
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%; max-width: 480px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-header {
  padding: 20px 24px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; }
.modal-header button { color: var(--text-muted); padding: 4px 8px; border-radius: var(--radius-sm); }
.modal-header button:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; }
.setting-row { display: flex; flex-direction: column; gap: 7px; }
.setting-row label { font-size: .82rem; font-weight: 600; color: var(--text-secondary); }

/* ── TOASTS ── */
.toast-container {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px;
  z-index: 2000; pointer-events: none;
  align-items: center;
}
.toast {
  padding: 10px 20px; border-radius: var(--radius-md);
  font-size: .88rem; font-weight: 600;
  box-shadow: var(--shadow-md);
  pointer-events: all;
}
.toast.success { background: rgba(63,185,80,.9); color: white; }
.toast.error   { background: rgba(248,81,73,.9); color: white; }
.toast.info    { background: rgba(124,58,237,.9); color: white; }
.toast-in  { animation: toastIn .3s ease; }
.toast-out { animation: toastOut .3s ease; }
@keyframes toastIn  { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:none} }
@keyframes toastOut { from{opacity:1} to{opacity:0;transform:translateY(-10px)} }

/* ── Sidebar overlay (mobile) ── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 150;
  background: rgba(0,0,0,.6); backdrop-filter: blur(2px);
}
.fade-out { animation: fadeOut .2s ease forwards; }
@keyframes fadeOut { to { opacity: 0; } }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .members-panel { display: none; }
  .members-panel.members-open { display: flex; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 280px; }

  .sidebar {
    position: fixed; right: 0; top: 0; bottom: 0;
    transform: translateX(100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.sidebar-open { transform: translateX(0); }
  .sidebar-close { display: flex; }
  .sidebar-overlay { display: block; }

  .menu-btn { display: flex; }

  .members-panel { display: none; }

  .chat-header { padding: 0 12px; }
  .messages-list { padding: 0 8px; }
  .input-area { padding: 0 8px 12px; }
  .reply-preview { padding: 0 8px 6px; }
}

@media (max-width: 480px) {
  .auth-container { padding: 24px 20px; margin: 12px; }
  .auth-logo-text { font-size: 1.4rem; }
}
