/* ── Google Fonts ──────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700;800&family=Geist+Mono:wght@400;500&display=swap');

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

:root {
  --bg:        #080a10;
  --bg2:       #0c0e16;
  --bg3:       #10131e;
  --bg4:       #161a27;
  --bg5:       #1e2336;
  --bg6:       #252c42;
  --border:    rgba(255,255,255,0.055);
  --border2:   rgba(255,255,255,0.09);
  --border3:   rgba(255,255,255,0.14);
  --text:      #e8edf5;
  --text2:     #8892a4;
  --text3:     #4a5568;
  --accent:    #6366f1;
  --accent2:   #4f46e5;
  --accent3:   #8b5cf6;
  --accent-glow: rgba(99,102,241,0.22);
  --green:     #10b981;
  --red:       #ef4444;
  --yellow:    #f59e0b;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --shadow:    0 8px 48px rgba(0,0,0,0.65), 0 2px 8px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 12px rgba(0,0,0,0.4);
  --shadow-accent: 0 4px 24px rgba(99,102,241,0.32);
  --tb-h:      38px;
  --font:      'Geist', system-ui, sans-serif;
  --font-mono: 'Geist Mono', monospace;
  --ease:      cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html.auth, body.auth-bg { overflow-y: auto; height: auto; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent3); }
input, textarea, button, select { font-family: var(--font); }

::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg6); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ── Titlebar ──────────────────────────────────────────────────────────────── */
#titlebar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--tb-h);
  background: rgba(8,10,16,0.94);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  -webkit-app-region: drag;
  z-index: 10000;
  user-select: none;
  flex-shrink: 0;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.tb-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.tb-logo img {
  width: 20px; height: 20px;
  object-fit: contain;
  background: transparent;
  filter: drop-shadow(0 0 6px rgba(99,102,241,0.6));
}

.tb-spacer { flex: 1; }
.tb-btns { display: flex; -webkit-app-region: no-drag; }

.tb-btn {
  width: 46px; height: var(--tb-h);
  display: flex; align-items: center; justify-content: center;
  background: none; border: none;
  color: var(--text3); cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.tb-btn:hover { background: var(--bg4); color: var(--text); }
.tb-btn.close:hover { background: var(--red); color: #fff; }
.tb-btn svg { width: 11px; height: 11px; }

/* ── Auth pages — split layout ─────────────────────────────────────────────── */
.auth-split-page { overflow-y: auto; height: auto; background: var(--bg); }

.auth-split {
  display: flex;
  min-height: 100vh;
}

/* Left panel */
.auth-left {
  flex: 1;
  background:
    radial-gradient(ellipse 100% 80% at 30% 20%, rgba(99,102,241,0.18), transparent 60%),
    radial-gradient(ellipse 60% 60% at 80% 80%, rgba(139,92,246,0.12), transparent 60%),
    var(--bg2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 48px;
  border-right: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.auth-left::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.auth-left-inner {
  position: relative;
  max-width: 420px;
  width: 100%;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 36px;
}

.auth-brand-logo {
  width: 36px; height: 36px;
  filter: drop-shadow(0 4px 16px rgba(99,102,241,0.6));
}

.auth-brand-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, #fff 0%, #c7d2fe 60%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-left-headline {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.04em;
  color: var(--text);
  margin-bottom: 14px;
}

.auth-left-sub {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.6;
  margin-bottom: 32px;
}

.auth-features { display: flex; flex-direction: column; gap: 16px; margin-bottom: 32px; }

.auth-feature {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.auth-feature-icon {
  width: 36px; height: 36px;
  background: rgba(99,102,241,0.15);
  color: var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.auth-feature-icon svg { width: 16px; height: 16px; }

.auth-feature-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.auth-feature-desc {
  font-size: 12px;
  color: var(--text3);
  line-height: 1.5;
}

/* Stats row for register */
.auth-stats {
  display: flex;
  gap: 0;
  margin-bottom: 32px;
  background: var(--bg4);
  border: 1px solid var(--border2);
  border-radius: 12px;
  overflow: hidden;
}
.auth-stat {
  flex: 1;
  padding: 16px 8px;
  text-align: center;
  border-right: 1px solid var(--border);
}
.auth-stat:last-child { border-right: none; }
.auth-stat-number {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--accent), var(--accent3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.auth-stat-label {
  font-size: 10px;
  color: var(--text3);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* Chat preview bubbles */
.auth-chat-preview {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: var(--bg4);
  border: 1px solid var(--border2);
  border-radius: 16px;
  animation: previewFloat 4s ease-in-out infinite;
}
@keyframes previewFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.preview-bubble {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.preview-bubble.right {
  flex-direction: row-reverse;
}
.preview-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.preview-text {
  background: var(--bg5);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text2);
  line-height: 1.4;
  max-width: 220px;
}
.preview-bubble.right .preview-text {
  background: rgba(99,102,241,0.15);
  border-color: rgba(99,102,241,0.25);
  color: var(--text);
}

/* Right panel */
.auth-right {
  width: 420px;
  flex-shrink: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
}

.auth-right-inner {
  width: 100%;
  max-width: 340px;
}

.auth-form-logo {
  margin-bottom: 24px;
}
.auth-form-logo img {
  width: 40px; height: 40px;
  filter: drop-shadow(0 4px 16px rgba(99,102,241,0.5));
}

.auth-form-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  margin-bottom: 6px;
}
.auth-form-sub {
  font-size: 13px;
  color: var(--text3);
  margin-bottom: 24px;
}

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

/* Input with icon */
.input-icon-wrap {
  position: relative;
}
.input-icon-wrap .input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  color: var(--text3);
  pointer-events: none;
}
.input-icon-wrap input {
  padding-left: 38px !important;
}
.input-eye {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  border-radius: 6px;
  transition: color 0.15s;
}
.input-eye:hover { color: var(--text2); }

.input-hint {
  font-size: 11px;
  color: var(--text3);
  margin-top: 5px;
  padding-left: 2px;
}

.auth-remember-row {
  margin-bottom: 18px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text2);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}
.checkbox-label input[type=checkbox] {
  width: 0; height: 0; opacity: 0; position: absolute;
}
.checkbox-custom {
  width: 16px; height: 16px;
  border: 1.5px solid var(--border2);
  border-radius: 4px;
  background: var(--bg4);
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
  position: relative;
}
.checkbox-label input:checked + .checkbox-custom {
  background: var(--accent);
  border-color: var(--accent);
}
.checkbox-label input:checked + .checkbox-custom::after {
  content: '';
  position: absolute;
  left: 4px; top: 1px;
  width: 5px; height: 9px;
  border: 2px solid #fff;
  border-top: none; border-left: none;
  transform: rotate(45deg);
}

.auth-tos {
  font-size: 11px;
  color: var(--text3);
  margin-bottom: 16px;
  line-height: 1.5;
}
.auth-tos a { color: var(--accent); }
.auth-tos a:hover { text-decoration: underline; }

.auth-err {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.2);
  color: #f87171;
  padding: 10px 14px; border-radius: 10px;
  font-size: 13px; margin-bottom: 18px;
}
.auth-success {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.25);
  color: #34d399;
  padding: 10px 14px; border-radius: 10px;
  font-size: 13px; margin-bottom: 18px;
  font-weight: 500;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 14px;
  color: var(--text3);
  font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-auth-outline {
  display: block;
  width: 100%;
  padding: 11px;
  background: transparent;
  border: 1.5px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text2);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  letter-spacing: -0.01em;
}
.btn-auth-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(99,102,241,0.06);
}

/* Legacy support — keep .auth-bg for any other pages that might use it */
.auth-bg {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  padding: 20px;
}

.auth-box { width: 100%; max-width: 400px; }

.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo-icon {
  display: block; margin: 0 auto 16px;
  width: 68px; height: 68px;
  filter: drop-shadow(0 8px 32px rgba(99,102,241,0.55));
  animation: bob 3.5s ease-in-out infinite;
}
@keyframes bob {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}

.auth-logo h1 {
  font-size: 28px; font-weight: 800; letter-spacing: -0.03em;
  background: linear-gradient(135deg, #fff 0%, #c7d2fe 50%, #a78bfa 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.auth-logo p { color: var(--text3); margin-top: 6px; font-size: 13px; }

.auth-card {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.auth-card::before {
  content: '';
  position: absolute; top: 0; left: 50%;
  transform: translateX(-50%);
  width: 60%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(99,102,241,0.5), transparent);
}
.auth-card h2 { font-size: 18px; font-weight: 700; margin-bottom: 22px; letter-spacing: -0.02em; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 13px; color: var(--text3); }
.auth-switch a { color: var(--accent); font-weight: 500; }

/* Responsive: stack on mobile */
@media (max-width: 860px) {
  .auth-split { flex-direction: column; }
  .auth-left {
    padding: 40px 24px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .auth-left-headline { font-size: 24px; }
  .auth-chat-preview { display: none; }
  .auth-right { width: 100%; padding: 32px 24px; }
  .auth-right-inner { max-width: 100%; }
}
@media (max-width: 480px) {
  .auth-left { display: none; }
}

/* ── Form elements ─────────────────────────────────────────────────────────── */
.fg { margin-bottom: 14px; }
label {
  display: block; font-size: 11px; font-weight: 600;
  color: var(--text3); text-transform: uppercase;
  letter-spacing: 0.6px; margin-bottom: 6px;
}

input[type=text], input[type=email], input[type=password], textarea, select {
  width: 100%; padding: 10px 13px;
  background: var(--bg4);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text); font-size: 14px; outline: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  background: var(--bg5);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
input::placeholder, textarea::placeholder { color: var(--text3); }
textarea { resize: vertical; min-height: 80px; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn-primary {
  width: 100%; padding: 11px;
  background: linear-gradient(135deg, var(--accent2), var(--accent), var(--accent3));
  background-size: 200%;
  color: #fff; border: none; border-radius: var(--radius);
  font-size: 14px; font-weight: 700; cursor: pointer;
  transition: opacity 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: var(--shadow-accent);
  letter-spacing: -0.01em;
}
.btn-primary:hover { opacity: 0.9; box-shadow: 0 6px 32px rgba(99,102,241,0.45); }
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  padding: 8px 16px;
  background: var(--bg4); color: var(--text2);
  border: 1px solid var(--border2); border-radius: var(--radius);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-secondary:hover { background: var(--bg5); color: var(--text); }

.btn-danger {
  padding: 8px 16px;
  background: rgba(239,68,68,0.08); color: #f87171;
  border: 1px solid rgba(239,68,68,0.2); border-radius: var(--radius);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background 0.15s;
}
.btn-danger:hover { background: rgba(239,68,68,0.16); }

.btn-icon {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: none; border: none;
  color: var(--text3); cursor: pointer; border-radius: 8px;
  transition: background 0.12s, color 0.12s;
}
.btn-icon:hover { background: var(--bg4); color: var(--text); }

/* ── Avatar ────────────────────────────────────────────────────────────────── */
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  overflow: hidden; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent2), var(--accent3));
  transform: translateZ(0);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 28px; height: 28px; font-size: 10px; }
.avatar.lg { width: 48px; height: 48px; font-size: 17px; }
.avatar.xl { width: 72px; height: 72px; font-size: 24px; }

.online-wrap { position: relative; display: inline-flex; }
.online-dot {
  position: absolute; bottom: 0; right: 0;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--bg2);
  box-shadow: 0 0 6px rgba(16,185,129,0.5);
}
.online-dot.offline { background: var(--text3); box-shadow: none; }

/* ── Toast ─────────────────────────────────────────────────────────────────── */
#toast {
  position: fixed; top: calc(var(--tb-h) + 12px); left: 50%;
  transform: translateX(-50%) translateY(-6px);
  padding: 9px 20px; border-radius: 99px;
  font-size: 13px; font-weight: 600;
  z-index: 99999; box-shadow: var(--shadow);
  transition: opacity 0.22s, transform 0.22s;
  opacity: 0; pointer-events: none; white-space: nowrap;
  letter-spacing: -0.01em;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.success { background: rgba(16,185,129,0.96); color: #fff; }
#toast.error { background: rgba(239,68,68,0.96); color: #fff; }
#toast.info { background: rgba(99,102,241,0.96); color: #fff; }

/* ── Modal ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.72);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 20px;
  animation: fadeIn 0.15s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-xl);
  padding: 24px;
  width: 100%; max-width: 440px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.7);
  animation: modalIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  max-height: 85vh; overflow-y: auto; overflow-x: hidden;
}
.modal::before {
  content: '';
  position: absolute; top: 0; left: 50%;
  transform: translateX(-50%);
  width: 40%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(99,102,241,0.5), transparent);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes slideUp {
  from { transform: translateY(16px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.modal-header h3 { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }

/* ── Shimmer loading ──────────────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg4) 25%, var(--bg5) 50%, var(--bg4) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease infinite;
  border-radius: 6px;
}

/* ── Settings page layout (full-page, not popup) ──────────────────────────── */
.settings-page { display: flex; flex-direction: column; height: 100vh; }
.settings-titlebar {
  height: var(--tb-h);
  background: rgba(8,10,16,0.94);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  -webkit-app-region: drag;
  font-size: 13px; font-weight: 600;
  backdrop-filter: blur(20px);
}
.settings-titlebar button {
  -webkit-app-region: no-drag;
  background: none; border: none;
  color: var(--text3); cursor: pointer;
  font-size: 16px; padding: 4px 8px; border-radius: 4px;
}
.settings-titlebar button:hover { background: var(--red); color: #fff; }
.settings-body { flex: 1; overflow-y: auto; padding: 24px; }
.settings-body h3 { font-size: 14px; font-weight: 700; margin-bottom: 16px; color: var(--text2); }

/* ── Search highlight styles ─────────────────────────────────────────────── */
.msg.search-match {
  background: rgba(245,158,11,0.06);
}
.msg.search-current {
  background: rgba(245,158,11,0.14);
  outline: 1px solid rgba(245,158,11,0.3);
  border-radius: 4px;
}

/* ── New message indicator ───────────────────────────────────────────────── */
#new-msg-ind {
  animation: slideUp 0.25s cubic-bezier(0.34,1.56,0.64,1);
}

/* ── Improved modal for group settings ───────────────────────────────────── */
.group-settings-modal {
  max-width: 480px;
}
.modal-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--bg4);
  border-radius: 10px;
  padding: 4px;
}
.modal-tab {
  flex: 1;
  padding: 6px 8px;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--text3);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  font-family: var(--font);
}
.modal-tab.active {
  background: var(--bg3);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* ── Member rows ──────────────────────────────────────────────────────────── */
.member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.member-row:last-child { border-bottom: none; }
.member-role-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(99,102,241,0.12);
  color: var(--accent);
  white-space: nowrap;
}
.member-role-badge.owner {
  background: rgba(245,158,11,0.12);
  color: var(--yellow);
}

/* ── Invite link box ─────────────────────────────────────────────────────── */
.invite-link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg4);
  border: 1px solid var(--border2);
  border-radius: 8px;
  margin-top: 8px;
}
.invite-link-text {
  flex: 1;
  font-size: 12px;
  color: var(--text2);
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Profile modal ───────────────────────────────────────────────────────── */
.profile-modal {
  text-align: center;
}
.profile-modal .actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}
.profile-modal .bio {
  font-size: 13px;
  color: var(--text2);
  margin: 4px 0;
}
.profile-modal .status { font-size: 12px; }

/* ── File preview — full styles in chat.css ──────────────────────────────── */
.file-preview-name {
  font-size: 12px;
  color: var(--text2);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Emoji grid ──────────────────────────────────────────────────────────── */
.emoji-picker-modal {
  max-width: 320px;
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 3px;
}
.emoji-btn {
  width: 32px; height: 32px;
  font-size: 17px;
  background: var(--bg4);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s, transform 0.1s;
  line-height: 1;
}
.emoji-btn:hover { background: var(--bg5); transform: scale(1.15); }

/* ── Lightbox ────────────────────────────────────────────────────────────── */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 99999;
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out;
  animation: fadeIn 0.15s ease;
}
.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 0 80px rgba(0,0,0,0.8);
}

/* ── Toast container ────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  pointer-events: all;
  animation: toastIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 300px;
  min-width: 180px;
  cursor: pointer;
}
.toast.out { animation: toastOut 0.2s ease forwards; }
.toast-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.toast.success .toast-dot { background: var(--green); }
.toast.error   .toast-dot { background: var(--red); }
.toast.info    .toast-dot { background: var(--accent); }
.toast.warning .toast-dot { background: var(--yellow); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

/* ── Danger zone card ────────────────────────────────────────────────────── */
.danger-zone-card {
  background: rgba(239,68,68,0.05);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}
.danger-zone-title { font-size: 14px; font-weight: 700; color: #f87171; margin-bottom: 6px; }
.danger-zone-desc { font-size: 12px; color: var(--text2); margin-bottom: 14px; line-height: 1.65; }

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  #toast-container { bottom: 72px; right: 12px; left: 12px; align-items: stretch; }
  .toast { max-width: 100%; }
  .modal { margin: 12px; }
}
