/* ── RESET ───────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── TOKENS ──────────────────────────────────────────────────────────────────── */
:root {
  /* Glass dark surfaces */
  --bg-void:      #04050a;
  --bg-base:      #07080f;
  --bg-surface:   rgba(12, 13, 22, 0.82);
  --bg-glass:     rgba(255, 255, 255, 0.04);
  --bg-glass-md:  rgba(255, 255, 255, 0.07);
  --bg-glass-hi:  rgba(255, 255, 255, 0.11);
  --bg-hover:     rgba(255, 255, 255, 0.06);
  --bg-active:    rgba(255, 255, 255, 0.09);

  --border-ultra: rgba(255,255,255,0.04);
  --border:       rgba(255,255,255,0.08);
  --border-mid:   rgba(255,255,255,0.12);
  --border-hi:    rgba(255,255,255,0.20);

  /* Accent palette — indigo/violet */
  --accent:        #6c7bff;
  --accent-2:      #a78bfa;
  --accent-3:      #c084fc;
  --accent-glow:   rgba(108,123,255,0.35);
  --accent-soft:   rgba(108,123,255,0.14);
  --accent-softer: rgba(108,123,255,0.07);

  /* Semantic */
  --green:     #30d888;
  --green-soft:rgba(48,216,136,0.12);
  --red:       #ff6b6b;
  --red-soft:  rgba(255,107,107,0.12);
  --amber:     #fbbf24;
  --pink:      #f472b6;
  --cyan:      #22d3ee;

  /* Text */
  --text-1: #eef0f9;
  --text-2: #7a84a0;
  --text-3: #3a4060;

  /* Chat bubbles */
  --bubble-sent: linear-gradient(135deg, #6c7bff 0%, #a78bfa 100%);
  --bubble-recv: rgba(255,255,255,0.06);

  /* Radii */
  --r-xs:  6px;
  --r-sm:  10px;
  --r-md:  14px;
  --r-lg:  20px;
  --r-xl:  28px;
  --r-2xl: 36px;
  --r-3xl: 48px;

  /* Shadows */
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.5);
  --shadow-md:   0 8px 32px rgba(0,0,0,0.6);
  --shadow-lg:   0 24px 64px rgba(0,0,0,0.8);
  --shadow-glow: 0 0 48px rgba(108,123,255,0.18);
  --shadow-inset:inset 0 1px 0 rgba(255,255,255,0.08);

  /* Blur */
  --blur-sm:  blur(8px);
  --blur-md:  blur(16px);
  --blur-lg:  blur(28px);
  --blur-xl:  blur(48px);

  /* Easing */
  --ease:    cubic-bezier(0.4,0,0.2,1);
  --ease-out:cubic-bezier(0,0,0.2,1);
  --ease-spring:cubic-bezier(0.34,1.56,0.64,1);
  --dur: 160ms;
  --dur-md: 240ms;

  /* Typography */
  --font-display: 'SF Pro Display', -apple-system, 'Space Grotesk', BlinkMacSystemFont, sans-serif;
  --font-body:    'SF Pro Text',    -apple-system, 'Inter',          BlinkMacSystemFont, sans-serif;

  --nav-w:   66px;
  --panel-w: 296px;
  --rail-w:  76px;
}

/* Light mode */
.light {
  --bg-void:     #e8ecf5;
  --bg-base:     #f0f3fc;
  --bg-surface:  rgba(255,255,255,0.75);
  --bg-glass:    rgba(255,255,255,0.55);
  --bg-glass-md: rgba(255,255,255,0.70);
  --bg-glass-hi: rgba(255,255,255,0.85);
  --bg-hover:    rgba(0,0,0,0.04);
  --bg-active:   rgba(0,0,0,0.07);
  --border-ultra:rgba(0,0,0,0.04);
  --border:      rgba(0,0,0,0.07);
  --border-mid:  rgba(0,0,0,0.11);
  --border-hi:   rgba(0,0,0,0.18);
  --text-1:      #0d0f1c;
  --text-2:      #4a5272;
  --text-3:      #99a0b8;
  --bubble-recv: rgba(0,0,0,0.05);
  --shadow-glow: 0 0 48px rgba(108,123,255,0.10);
  --shadow-lg:   0 24px 64px rgba(0,0,0,0.12);
}

/* ── BASE ────────────────────────────────────────────────────────────────────── */
html, body, #root { height: 100%; width: 100%; overflow: hidden; }

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

body {
  font-family: var(--font-body);
  background: var(--bg-void);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── MESH BACKGROUND ─────────────────────────────────────────────────────────── */
.app-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 15% 85%, rgba(108,123,255,0.12) 0%, transparent 55%),
    radial-gradient(ellipse 60% 50% at 85% 15%, rgba(167,139,250,0.09) 0%, transparent 50%),
    radial-gradient(ellipse 40% 40% at 50% 50%, rgba(192,132,252,0.04) 0%, transparent 60%),
    var(--bg-void);
}

/* ── APP SHELL ───────────────────────────────────────────────────────────────── */
.app {
  display: flex; height: 100vh; width: 100vw;
  overflow: hidden; position: relative; z-index: 1;
}

/* ── SIDEBAR NAV ─────────────────────────────────────────────────────────────── */
.sidebar-nav {
  width: var(--nav-w);
  height: 100vh;
  background: var(--bg-surface);
  backdrop-filter: var(--blur-lg);
  -webkit-backdrop-filter: var(--blur-lg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center;
  padding: 16px 0 18px; gap: 2px;
  flex-shrink: 0; z-index: 20;
  box-shadow: var(--shadow-inset), 1px 0 0 var(--border-ultra);
}

.sidebar-logo {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-3) 100%);
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 16px; color: #fff;
  margin-bottom: 16px; cursor: pointer;
  box-shadow: 0 4px 20px var(--accent-glow);
  transition: transform var(--dur) var(--ease-spring), box-shadow var(--dur) var(--ease);
  position: relative; overflow: hidden;
}
.sidebar-logo::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 50%;
  background: linear-gradient(to bottom, rgba(255,255,255,0.25), transparent);
  border-radius: 13px 13px 0 0;
}
.sidebar-logo:hover { transform: scale(1.08); box-shadow: 0 6px 28px var(--accent-glow); }
.sidebar-logo img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; position: relative; z-index: 1; }

.nav-item {
  width: 46px; height: 46px; border-radius: var(--r-md);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease-spring);
  color: var(--text-3); position: relative; border: none; background: none;
}
.nav-item:hover { background: var(--bg-glass-md); color: var(--text-2); transform: scale(1.04); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: var(--shadow-inset);
}
.nav-item.active::before {
  content: '';
  position: absolute; left: -1px; top: 28%; bottom: 28%;
  width: 3px; border-radius: 0 3px 3px 0;
  background: linear-gradient(to bottom, var(--accent), var(--accent-2));
}
.nav-item svg { width: 19px; height: 19px; flex-shrink: 0; stroke-width: 1.7; }
.nav-label { font-size: 8.5px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; line-height: 1; }

.nav-badge {
  position: absolute; top: 6px; right: 6px;
  min-width: 15px; height: 15px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 8px; font-size: 8px; font-weight: 700; color: #fff;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
  border: 1.5px solid var(--bg-void);
  box-shadow: 0 2px 8px var(--accent-glow);
}
.nav-spacer { flex: 1; }

.theme-toggle {
  cursor: pointer; width: 36px; height: 36px; border-radius: var(--r-md);
  background: var(--bg-glass); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2); margin-top: 6px;
  transition: all var(--dur) var(--ease);
  backdrop-filter: var(--blur-sm);
}
.theme-toggle:hover { background: var(--bg-glass-hi); color: var(--accent); border-color: var(--border-mid); }
.theme-toggle svg { width: 14px; height: 14px; }

/* ── PANEL ───────────────────────────────────────────────────────────────────── */
.panel {
  width: var(--panel-w); height: 100vh;
  background: var(--bg-surface);
  backdrop-filter: var(--blur-lg);
  -webkit-backdrop-filter: var(--blur-lg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  flex-shrink: 0; overflow: hidden;
  box-shadow: var(--shadow-inset), 1px 0 0 var(--border-ultra);
  transition: width var(--dur-md) var(--ease);
}

/* Collapsed icon rail — used once a hub/community is open, so the
   channel list, chat, and members panel get their room back. */
.panel.panel-rail { width: var(--rail-w); }

.community-rail {
  display: flex; flex-direction: column; align-items: center;
  height: 100vh; width: 100%;
  padding: 14px 0; gap: 4px;
}
.rail-expand-btn {
  width: 36px; height: 36px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2); background: var(--bg-glass);
  border: 1px solid var(--border);
  cursor: pointer; margin-bottom: 12px; flex-shrink: 0;
  transition: all var(--dur) var(--ease);
}
.rail-expand-btn svg { width: 14px; height: 14px; }
.rail-expand-btn:hover { background: var(--bg-glass-hi); color: var(--accent); border-color: var(--border-mid); }

.community-rail-list {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  overflow-y: auto; width: 100%; padding: 0 0 8px;
}
.community-rail-list::-webkit-scrollbar { width: 0; }

.rail-item {
  width: 44px; height: 44px; border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-glass); color: var(--text-2);
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  border: 1px solid var(--border);
  cursor: pointer; flex-shrink: 0; position: relative;
  transition: all var(--dur) var(--ease), border-radius var(--dur) var(--ease);
}
.rail-item:hover { border-radius: var(--r-md); background: var(--bg-glass-hi); color: var(--text-1); }
.rail-item.active {
  border-radius: var(--r-md);
  background: var(--accent-soft); color: var(--accent);
  border-color: rgba(108,123,255,0.35);
}
.rail-item.active::before {
  content: ''; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0;
  background: linear-gradient(to bottom, var(--accent), var(--accent-2));
}
.rail-item.rail-add { color: var(--text-3); border-style: dashed; margin-top: 2px; }
.rail-item.rail-add svg { width: 16px; height: 16px; }
.rail-item.rail-add:hover { color: var(--accent); border-color: rgba(108,123,255,0.35); }

.panel-header {
  padding: 20px 16px 14px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.panel-title {
  font-family: var(--font-display);
  font-size: 19px; font-weight: 700; flex: 1;
  letter-spacing: -0.4px; background: linear-gradient(135deg, var(--text-1), var(--text-2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.panel-action {
  width: 30px; height: 30px; border-radius: var(--r-sm);
  background: var(--bg-glass); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-2);
  transition: all var(--dur) var(--ease);
  backdrop-filter: var(--blur-sm);
}
.panel-action:hover { background: var(--bg-glass-hi); color: var(--accent); border-color: var(--border-mid); }
.panel-action svg { width: 13px; height: 13px; }

/* ── SEARCH ──────────────────────────────────────────────────────────────────── */
.search-wrap { padding: 10px 12px; flex-shrink: 0; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 12px; padding: 8px 12px;
  transition: all var(--dur) var(--ease);
  backdrop-filter: var(--blur-sm);
}
.search-box:focus-within {
  border-color: rgba(108,123,255,0.5);
  background: var(--bg-glass-md);
  box-shadow: 0 0 0 3px var(--accent-softer);
}
.search-box svg { width: 13px; height: 13px; color: var(--text-3); flex-shrink: 0; }
.search-box input {
  background: none; border: none; outline: none;
  color: var(--text-1); font-size: 13px; width: 100%;
  font-family: var(--font-body);
}
.search-box input::placeholder { color: var(--text-3); }

/* ── CONV LIST ───────────────────────────────────────────────────────────────── */
.conv-list { flex: 1; overflow-y: auto; padding: 4px 8px; }
.conv-list::-webkit-scrollbar { width: 3px; }
.conv-list::-webkit-scrollbar-track { background: transparent; }
.conv-list::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 3px; }

.conv-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: var(--r-lg);
  cursor: pointer;
  transition: background var(--dur) var(--ease);
  position: relative;
}
.conv-item:hover { background: var(--bg-glass-md); }
.conv-item.active {
  background: var(--accent-soft);
  box-shadow: var(--shadow-inset);
}

.avatar-wrap { position: relative; flex-shrink: 0; }
.avatar {
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 600;
  width: 44px; height: 44px; font-size: 15px;
}
.avatar.sm { width: 34px; height: 34px; font-size: 12px; }
.avatar.lg { width: 72px; height: 72px; font-size: 26px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.online-dot {
  position: absolute; bottom: 1px; right: 1px;
  width: 10px; height: 10px;
  background: var(--green); border-radius: 50%;
  border: 2px solid var(--bg-base);
  box-shadow: 0 0 6px rgba(48,216,136,0.5);
}

.conv-info { flex: 1; min-width: 0; }
.conv-name { font-weight: 600; font-size: 14px; margin-bottom: 2px; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-preview { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.conv-time { font-size: 10px; color: var(--text-3); font-weight: 500; }
.unread-badge {
  min-width: 18px; height: 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 9px; font-size: 10px; font-weight: 700; color: #fff;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.section-label {
  padding: 12px 18px 5px;
  font-size: 10px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 1.2px;
}

/* ── MAIN AREA ───────────────────────────────────────────────────────────────── */
.main {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; position: relative;
}
.main::before {
  content: '';
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(circle 600px at 30% 80%, rgba(108,123,255,0.04) 0%, transparent 60%),
    radial-gradient(circle 400px at 80% 20%, rgba(167,139,250,0.03) 0%, transparent 60%);
}

/* ── CHAT HEADER ─────────────────────────────────────────────────────────────── */
.chat-header {
  height: 58px; padding: 0 18px;
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-surface);
  backdrop-filter: var(--blur-lg);
  -webkit-backdrop-filter: var(--blur-lg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; position: relative; z-index: 10;
  box-shadow: var(--shadow-inset);
}
.chat-header-info { flex: 1; min-width: 0; }
.chat-header-name { font-family: var(--font-display); font-weight: 600; font-size: 15px; letter-spacing: -0.2px; }
.chat-header-status {
  font-size: 11.5px; color: var(--green);
  display: flex; align-items: center; gap: 5px; margin-top: 1px;
}
.chat-header-status.offline { color: var(--text-3); }
.status-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.header-actions { display: flex; gap: 2px; }

.icon-btn {
  width: 34px; height: 34px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-2);
  transition: all var(--dur) var(--ease);
  border: none; background: none;
}
.icon-btn:hover { background: var(--bg-glass-hi); color: var(--text-1); }
.icon-btn svg { width: 16px; height: 16px; }

/* ── MESSAGES ────────────────────────────────────────────────────────────────── */
.messages-area {
  flex: 1; overflow-y: auto;
  padding: 20px 24px 10px;
  display: flex; flex-direction: column;
  gap: 2px; position: relative; z-index: 1;
}
.messages-area::-webkit-scrollbar { width: 3px; }
.messages-area::-webkit-scrollbar-track { background: transparent; }
.messages-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.msg-date-sep {
  text-align: center; font-size: 11px; color: var(--text-3);
  padding: 10px 0 14px;
  display: flex; align-items: center; gap: 10px;
  font-weight: 500; letter-spacing: 0.4px;
}
.msg-date-sep::before, .msg-date-sep::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.msg-row {
  display: flex; gap: 8px; align-items: flex-end; max-width: 100%;
  animation: msgIn 200ms var(--ease-out) both;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}
.msg-row.sent { flex-direction: row-reverse; }
.msg-row.group-start { margin-top: 12px; }

.msg-avatar {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700;
}
.msg-avatar.invisible { visibility: hidden; }

.msg-content { display: flex; flex-direction: column; max-width: 66%; gap: 2px; }
.msg-row.sent .msg-content { align-items: flex-end; }

.msg-name { font-size: 10px; color: var(--text-3); padding: 0 10px; margin-bottom: 1px; font-weight: 600; letter-spacing: 0.2px; }

.bubble {
  padding: 10px 15px; border-radius: 20px;
  font-size: 14px; line-height: 1.55;
  position: relative; word-break: break-word;
  transition: opacity var(--dur) var(--ease);
}
.bubble.recv {
  background: var(--bubble-recv);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  border: 1px solid var(--border);
  color: var(--text-1);
  border-bottom-left-radius: 6px;
  box-shadow: var(--shadow-inset);
}
.bubble.sent {
  background: var(--bubble-sent);
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 20px rgba(108,123,255,0.3);
  position: relative; overflow: hidden;
}
.bubble.sent::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 50%;
  background: linear-gradient(to bottom, rgba(255,255,255,0.12), transparent);
}
.bubble.image-bubble { padding: 4px; overflow: hidden; }
.bubble.image-bubble img { width: 200px; height: 150px; object-fit: cover; border-radius: 16px; display: block; }

.msg-meta { display: flex; align-items: center; gap: 4px; padding: 0 6px; margin-top: 1px; }
.msg-time { font-size: 10px; color: var(--text-3); font-weight: 500; }
.read-tick { color: var(--accent); display: flex; }
.read-tick svg { width: 12px; height: 12px; }

.reactions-bar { display: flex; gap: 4px; padding: 2px 4px; flex-wrap: wrap; }
.reaction-chip {
  background: var(--bg-glass-md);
  backdrop-filter: var(--blur-sm);
  border: 1px solid var(--border);
  border-radius: 20px; padding: 2px 9px;
  font-size: 12px; cursor: pointer;
  transition: all var(--dur) var(--ease);
  display: flex; align-items: center; gap: 4px;
}
.reaction-chip:hover { background: var(--accent-soft); border-color: rgba(108,123,255,0.4); }
.reaction-count { font-size: 11px; color: var(--text-2); font-weight: 500; }

.typing-indicator { display: flex; align-items: center; gap: 10px; padding: 4px 0 8px; }
.typing-dots {
  display: flex; gap: 5px; padding: 10px 14px;
  background: var(--bubble-recv);
  backdrop-filter: var(--blur-sm);
  border: 1px solid var(--border);
  border-radius: 20px; border-bottom-left-radius: 6px;
}
.typing-dot {
  width: 6px; height: 6px; background: var(--text-3); border-radius: 50%;
  animation: typingBounce 1.3s var(--ease) infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.18s; }
.typing-dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes typingBounce {
  0%,80%,100% { transform: translateY(0); opacity: 0.4; }
  40%         { transform: translateY(-7px); opacity: 1; }
}

/* ── INPUT AREA ──────────────────────────────────────────────────────────────── */
.input-area {
  padding: 10px 18px 16px;
  background: var(--bg-surface);
  backdrop-filter: var(--blur-lg);
  -webkit-backdrop-filter: var(--blur-lg);
  border-top: 1px solid var(--border);
  flex-shrink: 0; position: relative; z-index: 10;
  box-shadow: var(--shadow-inset);
}

.reply-preview {
  background: var(--bg-glass-md);
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 6px 10px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
  backdrop-filter: var(--blur-sm);
}
.reply-preview-text { font-size: 12px; color: var(--text-2); flex: 1; }
.reply-close { cursor: pointer; color: var(--text-3); display: flex; }
.reply-close svg { width: 13px; height: 13px; }

.input-row {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--bg-glass-md);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-3xl);
  padding: 8px 8px 8px 16px;
  transition: all var(--dur) var(--ease);
  box-shadow: var(--shadow-inset);
}
.input-row:focus-within {
  border-color: rgba(108,123,255,0.45);
  background: var(--bg-glass-hi);
  box-shadow: var(--shadow-inset), 0 0 0 3px var(--accent-softer);
}
.msg-input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text-1); font-size: 14px; font-family: var(--font-body);
  resize: none; max-height: 120px; line-height: 1.55;
  padding: 4px 0; min-height: 24px;
}
.msg-input::placeholder { color: var(--text-3); }
.input-actions { display: flex; gap: 1px; align-items: flex-end; padding-bottom: 1px; }

.send-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--dur) var(--ease-spring);
  color: #fff; box-shadow: 0 4px 16px var(--accent-glow); flex-shrink: 0;
  position: relative; overflow: hidden;
}
.send-btn::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 50%;
  background: linear-gradient(to bottom, rgba(255,255,255,0.25), transparent);
}
.send-btn:hover { transform: scale(1.1); box-shadow: 0 6px 22px var(--accent-glow); }
.send-btn:active { transform: scale(0.92); }
.send-btn svg { width: 14px; height: 14px; }

/* ── EMOJI PICKER ────────────────────────────────────────────────────────────── */
.emoji-picker {
  position: absolute; bottom: 82px; left: 18px;
  background: var(--bg-surface);
  backdrop-filter: var(--blur-xl);
  -webkit-backdrop-filter: var(--blur-xl);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-xl);
  padding: 12px; z-index: 100;
  box-shadow: var(--shadow-lg);
  display: flex; flex-wrap: wrap; gap: 4px; width: 256px;
  animation: slideUp 160ms var(--ease) both;
}
.emoji-option {
  font-size: 19px; cursor: pointer; width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; transition: all var(--dur) var(--ease-spring);
}
.emoji-option:hover { background: var(--bg-glass-hi); transform: scale(1.3); }

/* ── EMPTY STATE ─────────────────────────────────────────────────────────────── */
.empty-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; color: var(--text-3); position: relative; z-index: 1;
}
.empty-state svg { width: 44px; height: 44px; opacity: 0.2; }
.empty-state h3 { font-family: var(--font-display); font-size: 17px; color: var(--text-2); font-weight: 600; }
.empty-state p { font-size: 13px; text-align: center; max-width: 240px; line-height: 1.6; }

/* ── NOTIFICATIONS ───────────────────────────────────────────────────────────── */
.notif-panel {
  position: absolute; bottom: 60px; left: 80px;
  width: 340px;
  background: var(--bg-surface);
  backdrop-filter: var(--blur-xl);
  -webkit-backdrop-filter: var(--blur-xl);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  z-index: 200; overflow: hidden;
  animation: slideUp 160ms var(--ease) both;
}
.notif-header {
  padding: 14px 16px;
  font-family: var(--font-display); font-weight: 700; font-size: 14px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.notif-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 11px 14px; cursor: pointer;
  transition: background var(--dur) var(--ease);
  border-bottom: 1px solid var(--border-ultra);
}
.notif-item:hover { background: var(--bg-glass-md); }
.notif-icon {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 16px; border: 1px solid var(--border);
}
.notif-text { flex: 1; }
.notif-title { font-size: 13px; font-weight: 600; }
.notif-desc { font-size: 12px; color: var(--text-2); margin-top: 1px; }
.notif-time { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.notif-unread-dot {
  width: 7px; height: 7px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 50%; margin-top: 6px; flex-shrink: 0;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ── FRIENDS ─────────────────────────────────────────────────────────────────── */
.friends-grid { display: flex; flex-direction: column; gap: 1px; padding: 6px 8px; overflow-y: auto; flex: 1; }
.friend-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: var(--r-lg);
  cursor: pointer; transition: background var(--dur) var(--ease);
}
.friend-item:hover { background: var(--bg-glass-md); }
.friend-info { flex: 1; min-width: 0; }
.friend-name { font-weight: 600; font-size: 13.5px; }
.friend-status { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.friend-status.online { color: var(--green); }
.friend-actions { display: flex; gap: 5px; }

.btn-sm {
  padding: 5px 12px; border-radius: var(--r-sm);
  font-size: 12px; font-weight: 600; cursor: pointer; border: none;
  transition: all var(--dur) var(--ease); font-family: var(--font-body);
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; box-shadow: 0 2px 10px var(--accent-glow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 14px var(--accent-glow); }
.btn-ghost {
  background: var(--bg-glass-md); color: var(--text-2);
  border: 1px solid var(--border-mid) !important;
  backdrop-filter: var(--blur-sm);
}
.btn-ghost:hover { background: var(--bg-glass-hi); color: var(--text-1); }
.btn-danger { background: var(--red-soft); color: var(--red); border: 1px solid rgba(255,107,107,0.2) !important; }
.btn-danger:hover { background: rgba(255,107,107,0.2); }

.req-banner {
  margin: 10px 12px;
  background: var(--accent-softer);
  border: 1px solid rgba(108,123,255,0.2);
  border-radius: var(--r-lg);
  padding: 11px 13px; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  transition: all var(--dur) var(--ease);
  backdrop-filter: var(--blur-sm);
}
.req-banner:hover { background: var(--accent-soft); }

/* ── COMMUNITIES ─────────────────────────────────────────────────────────────── */
.community-wrap { display: flex; flex: 1; overflow: hidden; position: relative; z-index: 1; }

.channel-sidebar {
  width: 196px; border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  background: var(--bg-surface);
  backdrop-filter: var(--blur-lg);
  -webkit-backdrop-filter: var(--blur-lg);
  flex-shrink: 0;
}
.community-header { padding: 14px 14px 12px; border-bottom: 1px solid var(--border); }
.community-name { font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.community-members { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }

.channel-section-label {
  padding: 14px 13px 5px;
  font-size: 10px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 1.2px;
  display: flex; align-items: center; gap: 4px;
}
.channel-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: var(--r-sm);
  margin: 0 7px; cursor: pointer;
  transition: all var(--dur) var(--ease);
  color: var(--text-2); font-size: 13.5px; font-weight: 500;
}
.channel-item:hover { background: var(--bg-glass-md); color: var(--text-1); }
.channel-item.active { background: var(--accent-soft); color: var(--accent); }
.channel-hash { font-size: 14px; opacity: 0.5; }

.members-sidebar {
  width: 172px; border-left: 1px solid var(--border);
  background: var(--bg-surface);
  backdrop-filter: var(--blur-lg);
  -webkit-backdrop-filter: var(--blur-lg);
  flex-shrink: 0; overflow-y: auto;
}
.members-list { padding: 10px 8px; display: flex; flex-direction: column; gap: 1px; }
.member-item {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 9px; border-radius: var(--r-sm);
  cursor: pointer; transition: background var(--dur) var(--ease);
}
.member-item:hover { background: var(--bg-glass-md); }
.member-name { font-size: 13px; font-weight: 500; }
.member-role { font-size: 11px; color: var(--text-3); }

/* ── STORIES ─────────────────────────────────────────────────────────────────── */
.stories-grid { display: flex; flex-direction: column; flex: 1; overflow-y: auto; }
.story-ring {
  background: linear-gradient(135deg, var(--accent), var(--pink));
  padding: 2px; border-radius: 50%; cursor: pointer;
  transition: transform var(--dur) var(--ease-spring), box-shadow var(--dur) var(--ease);
}
.story-ring:hover { transform: scale(1.06); box-shadow: 0 0 0 4px var(--accent-soft); }
.story-ring-inner { background: var(--bg-base); padding: 2px; border-radius: 50%; }
.story-ring-seen { background: var(--border-mid); }

.story-viewer {
  position: fixed; inset: 0; background: rgba(0,0,0,0.92);
  z-index: 1000; display: flex; flex-direction: column; align-items: center;
  backdrop-filter: var(--blur-lg);
}
.story-progress { display: flex; gap: 4px; padding: 16px 16px 8px; width: 100%; max-width: 480px; }
.story-prog-bar { flex: 1; height: 2px; background: rgba(255,255,255,0.15); border-radius: 2px; overflow: hidden; }
.story-prog-fill { height: 100%; background: #fff; transition: width 5s linear; }
.story-header { display: flex; align-items: center; gap: 12px; padding: 4px 16px 12px; width: 100%; max-width: 480px; }
.story-header-name { color: #fff; font-weight: 600; font-size: 14px; }
.story-header-time { color: rgba(255,255,255,0.45); font-size: 12px; }
.story-close { margin-left: auto; color: rgba(255,255,255,0.7); cursor: pointer; }
.story-close svg { width: 22px; height: 22px; }

/* ── PROFILE ─────────────────────────────────────────────────────────────────── */
.profile-page { flex: 1; overflow-y: auto; }
.profile-banner {
  height: 150px;
  background: linear-gradient(135deg, #0e103a, var(--accent) 50%, #7c2fff);
  position: relative; flex-shrink: 0;
}
.profile-avatar-wrap {
  position: absolute; bottom: -38px; left: 22px;
  border: 4px solid var(--bg-base); border-radius: 50%;
}
.profile-body { padding: 52px 22px 28px; }
.profile-name { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.4px; }
.profile-username { color: var(--text-3); font-size: 13px; margin-top: 2px; font-weight: 500; }
.profile-bio { color: var(--text-2); font-size: 13.5px; margin-top: 10px; line-height: 1.65; }
.profile-stats { display: flex; gap: 26px; margin-top: 16px; }
.stat-item { display: flex; flex-direction: column; }
.stat-number { font-family: var(--font-display); font-size: 19px; font-weight: 700; }
.stat-label { font-size: 11.5px; color: var(--text-3); margin-top: 1px; font-weight: 500; }
.profile-actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }

.btn-md {
  padding: 9px 18px; border-radius: var(--r-md);
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border-mid);
  transition: all var(--dur) var(--ease);
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-body);
  backdrop-filter: var(--blur-sm);
}
.btn-md svg { width: 13px; height: 13px; }
.btn-md.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; border-color: transparent;
  box-shadow: 0 4px 18px var(--accent-glow);
}
.btn-md.primary:hover { transform: translateY(-1px); box-shadow: 0 6px 24px var(--accent-glow); }
.btn-md.secondary { background: var(--bg-glass-md); color: var(--text-1); }
.btn-md.secondary:hover { background: var(--bg-glass-hi); }

/* ── AUTH SCREEN ─────────────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; position: relative; overflow: hidden;
  background: var(--bg-void);
}

/* Ambient orbs */
.auth-page::before {
  content: '';
  position: absolute; width: 700px; height: 700px;
  background: radial-gradient(circle, rgba(108,123,255,0.18) 0%, transparent 65%);
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  pointer-events: none;
}
.auth-page::after {
  content: '';
  position: absolute; width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(192,132,252,0.12) 0%, transparent 65%);
  bottom: 10%; right: 10%; pointer-events: none;
}

/* Pulse rings */
.pulse-ring-wrap {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
}
.pulse-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(108,123,255,0.18);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: pulseRingOut 3.6s var(--ease-out) infinite;
}
.pulse-ring:nth-child(1) { width: 420px; height: 420px; animation-delay: 0s; }
.pulse-ring:nth-child(2) { width: 580px; height: 580px; animation-delay: 0.9s; border-color: rgba(108,123,255,0.10); }
.pulse-ring:nth-child(3) { width: 740px; height: 740px; animation-delay: 1.8s; border-color: rgba(108,123,255,0.06); }
.pulse-ring:nth-child(4) { width: 900px; height: 900px; animation-delay: 2.7s; border-color: rgba(108,123,255,0.03); }

@keyframes pulseRingOut {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
  15%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

/* Center glow dot */
.pulse-core {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 20px var(--accent), 0 0 60px var(--accent-glow);
  animation: corePulse 3.6s ease-in-out infinite;
}
@keyframes corePulse {
  0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.4); }
}

/* Outer wrap — hosts the card-shaped ripples that expand outward from
   the border, plus the card itself. */
.auth-card-wrap {
  position: relative; z-index: 2;
  width: 400px; max-width: 100%;
  animation: cardIn 600ms var(--ease-out) both;
}

/* Card-shaped ripple rings — same rounded-rect outline as the card,
   expanding outward and fading, staggered so a new one starts as the
   last one fades. A clean, single-tone white ripple, like a pulse
   radiating off the border. */
.auth-ripple {
  position: absolute; inset: 0;
  border-radius: calc(var(--r-2xl) + 1.5px);
  border: 1px solid rgba(255,255,255,0.5);
  pointer-events: none;
  opacity: 0;
  animation: authRipple 3.6s ease-out infinite;
}
.auth-ripple-2 { animation-delay: 1.2s; }
.auth-ripple-3 { animation-delay: 2.4s; }

@keyframes authRipple {
  0%   { transform: scale(1);     opacity: 0.55; border-color: rgba(255,255,255,0.6); }
  70%  { opacity: 0.12; }
  100% { transform: scale(1.16);  opacity: 0;    border-color: rgba(255,255,255,0); }
}

/* Ring — a thin (1.5px) solid white border around the card, with a
   soft breathing glow synced to the ripple pulses outside it. */
.auth-card-ring {
  position: relative; z-index: 1;
  width: 100%;
  padding: 1.5px;
  border-radius: calc(var(--r-2xl) + 1.5px);
  background: rgba(255,255,255,0.16);
  animation: authGlowPulse 3.6s ease-in-out infinite 600ms;
}

/* Soft breathing glow around the ring, synced to the sweep */
@keyframes authGlowPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
  50%      { box-shadow: 0 0 34px 1px rgba(255,255,255,0.22); }
}

.auth-card {
  position: relative; z-index: 1;
  background: rgba(12, 13, 24, 0.86);
  backdrop-filter: var(--blur-xl);
  -webkit-backdrop-filter: var(--blur-xl);
  border-radius: var(--r-2xl);
  padding: 38px 36px;
  width: 100%;
  box-shadow: var(--shadow-lg), var(--shadow-inset);
  animation: authCardBreathe 3.6s ease-in-out infinite 600ms;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

/* A hair of scale breathing so the card feels alive, not just glowing */
@keyframes authCardBreathe {
  0%, 100% { scale: 1; }
  50%      { scale: 1.006; }
}

/* Subtle inner top highlight */
.auth-card::before {
  content: '';
  position: absolute; top: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  border-radius: 50%;
}

.auth-logo { display: flex; align-items: center; gap: 13px; margin-bottom: 30px; }
.auth-logo-mark {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-3) 100%);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 20px; color: #fff;
  box-shadow: 0 6px 24px var(--accent-glow);
  position: relative; overflow: hidden;
  flex-shrink: 0;
}
.auth-logo-mark::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 48%;
  background: linear-gradient(to bottom, rgba(255,255,255,0.25), transparent);
}
.auth-logo-mark img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; position: relative; z-index: 1; }
.auth-logo-text {}
.auth-logo-name {
  font-family: var(--font-display); font-size: 26px; font-weight: 700;
  letter-spacing: -0.6px;
  background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.7) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.auth-tagline { font-size: 12px; color: var(--text-3); margin-top: 1px; font-weight: 400; }

.form-field { margin-bottom: 14px; }
.form-label { font-size: 11.5px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; display: block; letter-spacing: 0.2px; }
.form-input {
  width: 100%; padding: 11px 14px;
  background: var(--bg-glass-md);
  backdrop-filter: var(--blur-sm);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-md);
  color: var(--text-1); font-size: 14px;
  font-family: var(--font-body); outline: none;
  transition: all var(--dur) var(--ease);
  box-shadow: var(--shadow-inset);
}
.form-input:focus {
  border-color: rgba(108,123,255,0.5);
  background: var(--bg-glass-hi);
  box-shadow: var(--shadow-inset), 0 0 0 3px var(--accent-softer);
}
.form-input::placeholder { color: var(--text-3); }

.btn-full {
  width: 100%; padding: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; border: none; border-radius: var(--r-md);
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all var(--dur) var(--ease);
  font-family: var(--font-body);
  box-shadow: 0 4px 20px var(--accent-glow);
  letter-spacing: 0.1px;
  position: relative; overflow: hidden;
}
.btn-full::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 50%;
  background: linear-gradient(to bottom, rgba(255,255,255,0.18), transparent);
}
.btn-full:hover { transform: translateY(-1px); box-shadow: 0 6px 28px var(--accent-glow); }
.btn-full:active { transform: translateY(0); }

.btn-full-ghost {
  background: var(--bg-glass-md) !important;
  color: var(--text-1) !important;
  box-shadow: none !important;
  border: 1px solid var(--border-mid) !important;
  backdrop-filter: var(--blur-sm) !important;
}
.btn-full-ghost:hover { background: var(--bg-glass-hi) !important; transform: translateY(-1px); }

.auth-link { color: var(--accent); cursor: pointer; font-weight: 500; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 13px; color: var(--text-3); }
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 18px 0; color: var(--text-3); font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── CAMERA ──────────────────────────────────────────────────────────────────── */
.camera-page {
  flex: 1; background: #000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.camera-top-actions {
  position: absolute; top: 24px; left: 0; right: 0;
  display: flex; justify-content: space-between; padding: 0 24px;
}
.camera-action-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.08);
  backdrop-filter: var(--blur-md);
  border: 1px solid rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #fff; transition: all var(--dur) var(--ease);
}
.camera-action-btn:hover { background: rgba(255,255,255,0.15); }
.camera-action-btn svg { width: 19px; height: 19px; }
.camera-preview-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end; padding: 48px;
}
.camera-capture-row { display: flex; align-items: center; gap: 36px; }
.capture-btn {
  width: 72px; height: 72px; border-radius: 50%;
  background: transparent; border: 3px solid rgba(255,255,255,0.8);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all var(--dur) var(--ease-spring);
}
.capture-btn-inner {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(255,255,255,0.9); transition: all var(--dur) var(--ease);
}
.capture-btn:hover .capture-btn-inner { background: rgba(255,255,255,0.7); transform: scale(0.92); }
.camera-side-btn {
  width: 50px; height: 50px; border-radius: 50%;
  background: rgba(0,0,0,0.4);
  backdrop-filter: var(--blur-md);
  border: 1px solid rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #fff; font-size: 22px;
}

/* ── TABS ────────────────────────────────────────────────────────────────────── */
.tab-bar {
  display: flex; border-bottom: 1px solid var(--border);
  padding: 0 14px; flex-shrink: 0;
}
.tab-item {
  padding: 11px 12px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; color: var(--text-3);
  border-bottom: 2px solid transparent;
  transition: all var(--dur) var(--ease); white-space: nowrap;
}
.tab-item.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-item:hover { color: var(--text-1); }

/* ── MOBILE NAV ──────────────────────────────────────────────────────────────── */
.mobile-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  height: 60px;
  background: var(--bg-surface);
  backdrop-filter: var(--blur-xl);
  -webkit-backdrop-filter: var(--blur-xl);
  border-top: 1px solid var(--border);
  z-index: 50; justify-content: space-around; align-items: center;
  box-shadow: var(--shadow-inset);
}
.mobile-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  cursor: pointer; color: var(--text-3); padding: 6px 12px;
  border-radius: var(--r-md);
  transition: all var(--dur) var(--ease); background: none; border: none;
}
.mobile-nav-item.active { color: var(--accent); }
.mobile-nav-item svg { width: 20px; height: 20px; }
.mobile-nav-item span { font-size: 9px; font-weight: 600; }
.mobile-nav-badge {
  position: absolute; top: -2px; right: -4px;
  width: 14px; height: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 50%; font-size: 8px; font-weight: 700; color: #fff;
  display: flex; align-items: center; justify-content: center;
}

/* ── MODAL ───────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.70);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  backdrop-filter: var(--blur-lg);
}
.modal {
  background: var(--bg-surface);
  backdrop-filter: var(--blur-xl);
  -webkit-backdrop-filter: var(--blur-xl);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-2xl);
  padding: 28px; width: 420px; max-width: 90vw;
  box-shadow: var(--shadow-lg);
  animation: modalIn 200ms var(--ease) both;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.93) translateY(12px); }
  to   { opacity: 1; transform: none; }
}
.modal-title { font-family: var(--font-display); font-size: 18px; font-weight: 700; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ── ANIMATIONS ──────────────────────────────────────────────────────────────── */
.fade-in  { animation: fadeIn  240ms var(--ease) both; }
.slide-up { animation: slideUp 240ms var(--ease) both; }
.pulse    { animation: pulseAnim 2s ease infinite; }

@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pulseAnim { 0%,100% { opacity:1; } 50% { opacity:0.5; } }

/* ── RESPONSIVE ──────────────────────────────────────────────────────────────── */
/* Give the chat column priority before things get truly cramped:
   drop the members list first, then trim the channel list a touch. */
@media (max-width: 1180px) {
  .members-sidebar { display: none; }
}
@media (max-width: 940px) {
  .channel-sidebar { width: 172px; }
  .panel.panel-rail { width: 64px; }
  .rail-item { width: 38px; height: 38px; font-size: 13px; }
}
@media (max-width: 768px) {
  .sidebar-nav { display: none; }
  .panel { width: 100%; border-right: none; }
  .main { width: 100%; }
  .mobile-nav { display: flex; }
  .members-sidebar { display: none; }
  .channel-sidebar { width: 190px; }
  .app { padding-bottom: 60px; }
}
@media (max-width: 480px) {
  .channel-sidebar { width: 160px; }
  .bubble.image-bubble img { width: 160px; height: 120px; }
  .notif-panel { width: 92vw; left: 4vw; }
  .auth-card { padding: 28px 22px; }
}

/* ─── Spinner ─── */
@keyframes spin { to { transform: rotate(360deg); } }

