/* ════════════════════════════════════════════════════════
   lahorechitchat.com — Redesigned Stylesheet (Light, Minimal)
   Drop-in replacement for css/style.css
   Linear / Notion-inspired · Inter · single coral accent
   All original class names preserved for JS compatibility.
════════════════════════════════════════════════════════ */

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

/* ─── Tokens ─── */
:root {
  --bg:        #FAFAF7;
  --bg2:       #F4F3EE;
  --surface:   #FFFFFF;
  --surface2:  #F4F3EE;
  --surface3:  #EDECE6;
  --hover:     #F0EFE9;
  --border:    #E8E6DE;
  --border2:   #DCDAD0;

  --text:      #0A0A0A;
  --text2:     #1F1F1D;
  --muted:     #6B6A63;
  --muted2:    #9A998F;

  --rose:      oklch(0.66 0.16 25);
  --rose2:     oklch(0.58 0.17 25);
  --rose-glow: oklch(0.92 0.04 25);
  --rose-ink:  oklch(0.45 0.14 25);
  --gold:      oklch(0.78 0.13 75);
  --cream:     #F4F3EE;

  --super:     oklch(0.78 0.13 75);
  --admin-c:   oklch(0.66 0.16 25);
  --mod-c:     oklch(0.62 0.13 240);
  --user-c:    #6B6A63;

  --danger:    oklch(0.62 0.20 25);
  --success:   oklch(0.65 0.15 155);
  --warning:   oklch(0.78 0.13 75);

  --radius:    14px;
  --shadow:    0 24px 60px rgba(20,20,15,.10), 0 2px 6px rgba(20,20,15,.05);
  --shadow-sm: 0 1px 2px rgba(20,20,15,.04);
  --shadow-rose: 0 8px 24px rgba(20,20,15,.06);

  /* Theme-aware semantic tokens.
     :root is the Rose theme — accent = rose. Other themes override these. */
  --accent:      var(--rose);
  --accent-2:    var(--rose2);
  --accent-glow: var(--rose-glow);
  --accent-ink:  var(--rose-ink);
  --bubble:      #F4F3EE;
  --bubble-me:   var(--accent-glow);
  --bubble-me-ink: var(--accent-ink);
  --room-grad-1: #e8607a;
  --room-grad-2: #f0c060;
}

/* ─── Modern theme — soft lavender, purple accent ─── */
[data-theme="modern"] {
  --bg:        oklch(0.97 0.012 290);
  --bg2:       oklch(0.95 0.018 290);
  --surface:   oklch(0.995 0.002 285);
  --surface2:  oklch(0.975 0.006 290);
  --surface3:  oklch(0.95 0.012 290);
  --hover:     oklch(0.95 0.018 290);
  --border:    oklch(0.93 0.008 290);
  --border2:   oklch(0.88 0.014 290);

  --text:      oklch(0.20 0.022 285);
  --text2:     oklch(0.32 0.022 285);
  --muted:     oklch(0.52 0.02 285);
  --muted2:    oklch(0.68 0.015 285);

  --accent:      oklch(0.58 0.17 293);
  --accent-2:    oklch(0.50 0.18 293);
  --accent-glow: oklch(0.92 0.05 293);
  --accent-ink:  oklch(0.38 0.16 293);
  --bubble:      oklch(0.965 0.004 290);
  --bubble-me:   oklch(0.91 0.055 292);
  --bubble-me-ink: oklch(0.34 0.09 293);

  /* Room avatars stay a soft purple gradient (per-room colors come later in Pass 2) */
  --room-grad-1: oklch(0.72 0.13 295);
  --room-grad-2: oklch(0.55 0.17 290);

  --shadow:      0 24px 60px oklch(0.4 0.08 285 / 0.15), 0 2px 6px oklch(0.4 0.08 285 / 0.06);
  --shadow-sm:   0 1px 3px oklch(0.4 0.08 285 / 0.08);
  --shadow-rose: 0 8px 24px oklch(0.6 0.15 290 / 0.18);
}
[data-theme="modern"] body { color-scheme: light; }

/* ─── Dark theme ─── */
[data-theme="dark"] {
  --bg:        #14130F;
  --bg2:       #1B1A16;
  --surface:   #1E1D18;
  --surface2:  #26241E;
  --surface3:  #2F2D26;
  --hover:     #292720;
  --border:    #34322A;
  --border2:   #423F36;

  --text:      #F5F3EC;
  --text2:     #E2E0D7;
  --muted:     #A6A399;
  --muted2:    #6F6D63;

  --rose:      oklch(0.70 0.15 25);
  --rose2:     oklch(0.64 0.16 25);
  --rose-glow: oklch(0.30 0.06 25);
  --rose-ink:  oklch(0.80 0.12 25);
  --gold:      oklch(0.80 0.13 75);
  --cream:     #26241E;

  --super:     oklch(0.82 0.13 75);
  --admin-c:   oklch(0.72 0.15 25);
  --mod-c:     oklch(0.70 0.13 240);
  --user-c:    #A6A399;

  --danger:    oklch(0.68 0.19 25);
  --success:   oklch(0.70 0.15 155);
  --warning:   oklch(0.80 0.13 75);

  --shadow:    0 24px 60px rgba(0,0,0,.45), 0 2px 6px rgba(0,0,0,.35);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.30);
  --shadow-rose: 0 8px 24px rgba(0,0,0,.35);

  /* Dark theme keeps rose as accent (familiar brand colour, just dark surfaces) */
  --accent:      var(--rose);
  --accent-2:    var(--rose2);
  --accent-glow: oklch(0.35 0.08 25);
  --accent-ink:  var(--rose-ink);
  --bubble:      #26241E;
  --bubble-me:   oklch(0.35 0.08 25);
  --bubble-me-ink: oklch(0.92 0.05 25);
  --room-grad-1: oklch(0.66 0.16 25);
  --room-grad-2: oklch(0.78 0.13 75);
}
[data-theme="dark"] body { color-scheme: dark; }
/* In dark mode, buttons that use --text as background need dark text on them */
[data-theme="dark"] .tb-btn.active,
[data-theme="dark"] .m-btn,
[data-theme="dark"] .f-add,
[data-theme="dark"] .copy-btn,
[data-theme="dark"] .int-btn.active,
[data-theme="dark"] .scal-day.done,
[data-theme="dark"] .onb-step.active,
[data-theme="dark"] .onb-step.done { color: #14130F; }
[data-theme="dark"] .tb-btn.active { background: var(--text); border-color: var(--text); }
/* Toggle knob stays light */
[data-theme="dark"] .tog.on { background: var(--accent); }

/* Dark mode: <img>-based SVG icons render their own (dark) strokes and ignore
   CSS currentColor, so invert them to appear light. Excludes room-avatar icons
   which already force white via brightness(0) invert(1) over a gradient. */
[data-theme="dark"] img.svg-ic-inline,
[data-theme="dark"] img.svg-ic-nav,
[data-theme="dark"] img.svg-ic-send,
[data-theme="dark"] img.svg-ic-close,
[data-theme="dark"] img.svg-ic-voice,
[data-theme="dark"] img.svg-ic-small,
[data-theme="dark"] .chat-header-icon img,
[data-theme="dark"] .i-btn img,
[data-theme="dark"] .ic-btn img,
[data-theme="dark"] .tb-btn img,
[data-theme="dark"] .more-item-icon img,
[data-theme="dark"] .input-tools img {
  filter: invert(1) brightness(1.6);
}
/* Send button sits on rose bg — keep its icon white in both themes */
[data-theme="dark"] .send-btn img.svg-ic-send { filter: brightness(0) invert(1); }
/* Room avatar icons stay white on gradient (no inversion) */
[data-theme="dark"] .room-avatar .room-icon img { filter: brightness(0) invert(1); }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex; flex-direction: column;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'cv11','ss01';
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted2); }

/* ─── Topbar ─── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; z-index: 50; position: relative;
}
.topbar::after { display: none; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: transparent;
  font-size: 0;
}
.brand-logo::after { display: none; }
.brand-logo img,
.brand-logo svg {
  width: 32px; height: 32px;
  display: block;
}
.brand-name {
  font-family: 'Inter', sans-serif;
  font-size: 15px; font-weight: 600;
  color: var(--text); letter-spacing: -0.025em;
  background: none; -webkit-background-clip: initial; -webkit-text-fill-color: initial;
}
.topbar-center {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-size: 11px; color: var(--muted);
  letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600;
  pointer-events: none;
}
/* Hide "Live Chat" label whenever there's any risk of collision with topbar buttons.
   1300px because logged-in admins have many topbar buttons (Admin, Audit, Blog,
   chip, online pill) that extend toward the absolutely-centered label. */
@media (max-width: 1300px) { .topbar-center { display: none; } }
.topbar-right { display: flex; align-items: center; gap: 6px; }

.online-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--surface2); border: 1px solid transparent;
  border-radius: 99px; font-size: 12px; color: var(--muted); font-weight: 500;
}
.online-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success);
  animation: blink 2.4s infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.5} }

/* ─── Buttons ─── */
.tb-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 11px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);  background: var(--surface);
  color: var(--text);
  font-family: inherit; font-size: 12.5px; font-weight: 500;
  cursor: pointer; transition: background .12s, border-color .12s, color .12s;
}
.tb-btn:hover { background: var(--hover); border-color: var(--border2); }
.tb-btn.active { background: var(--text); border-color: var(--text); color: #fff; }
.tb-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

/* Icon-only topbar buttons — square, no text label */
.tb-btn.icon-only {
  width: 32px; padding: 0;
  justify-content: center;
  position: relative; /* for DM unread badge positioning */
}
.tb-btn.icon-only .svg-ic-inline { margin: 0; }

.user-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 6px 3px 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 99px; cursor: pointer; transition: border-color .12s;
  flex-direction: row-reverse;
}
.user-chip:hover { border-color: var(--border2); }
.chip-name { font-size: 13px; font-weight: 500; max-width: 100px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-badge { font-size: 9.5px; padding: 1px 6px; border-radius: 4px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.badge-super { background: rgba(240,184,96,.12); color: oklch(0.55 0.13 75); }
.badge-admin { background: var(--accent-glow); color: var(--accent-ink); }
.badge-mod   { background: rgba(96,128,232,.10); color: var(--mod-c); }
.badge-user  { background: var(--surface2); color: var(--muted); }

.av {
  width: 30px; height: 30px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 11px; color: #fff;
  flex-shrink: 0; position: relative;
  background: linear-gradient(135deg,#FFB088,#FF6B8B);
}
.av.lg { width: 40px; height: 40px; font-size: 14px; }
.av::after {
  content: ''; position: absolute; bottom: 0; right: 0;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--success); border: 2px solid var(--surface);
}
.av.offline::after { background: var(--muted2); }

.ic-btn {
  background: none; border: 1px solid var(--border);
  color: var(--muted);
  width: 28px; height: 28px; border-radius: 7px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 12px; transition: all .12s;
}
.ic-btn:hover { border-color: var(--border2); color: var(--text); background: var(--hover); }
.ic-btn.danger:hover { border-color: var(--danger); color: var(--danger); background: transparent; }

/* ─── Layout ─── */
.main-layout { display: flex; flex: 1; overflow: hidden; position: relative; background: var(--bg); }

/* ─── Rooms sidebar (2026 polish) ─── */
.rooms-sidebar {
  width: 280px; background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0;
}
.sidebar-head {
  padding: 22px 20px 12px;
  flex-shrink: 0;
}
.sidebar-label {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--muted2);
}
.room-list { overflow-y: auto; flex: 1; padding: 4px 10px; }

.room-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background .15s ease;
  position: relative;
  margin-bottom: 2px;
  min-height: 56px;
}
.room-item:hover { background: var(--hover); }
.room-item.active {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

/* Avatar-style icon circle with brand gradient */
.room-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--room-grad-1) 0%, var(--room-grad-2) 100%);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 1px 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.room-avatar .room-icon {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
}
.room-avatar .room-icon img,
.room-avatar .room-icon svg {
  width: 20px; height: 20px;
  filter: brightness(0) invert(1);  /* makes SVG icon white */
}
.room-item.active .room-avatar {
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 28%, transparent);
  transform: scale(1.02);
}

/* ─── Per-room avatar colors (overrides theme default) ─── */
[data-color="purple"]  > .room-avatar { background: linear-gradient(140deg, oklch(0.72 0.13 295), oklch(0.55 0.17 290)); box-shadow: 0 1px 4px oklch(0.55 0.17 290 / 0.22); }
[data-color="orange"]  > .room-avatar { background: linear-gradient(140deg, oklch(0.80 0.14 60),  oklch(0.68 0.16 42));  box-shadow: 0 1px 4px oklch(0.68 0.16 42 / 0.22);  }
[data-color="coral"]   > .room-avatar { background: linear-gradient(140deg, oklch(0.78 0.13 25),  oklch(0.66 0.17 12));  box-shadow: 0 1px 4px oklch(0.66 0.17 12 / 0.22);  }
[data-color="teal"]    > .room-avatar { background: linear-gradient(140deg, oklch(0.78 0.10 200), oklch(0.62 0.12 215)); box-shadow: 0 1px 4px oklch(0.62 0.12 215 / 0.22); }
[data-color="green"]   > .room-avatar { background: linear-gradient(140deg, oklch(0.82 0.13 150), oklch(0.64 0.13 158)); box-shadow: 0 1px 4px oklch(0.64 0.13 158 / 0.22); }
.room-item.active[data-color="purple"]  > .room-avatar { box-shadow: 0 2px 10px oklch(0.55 0.17 290 / 0.36); }
.room-item.active[data-color="orange"]  > .room-avatar { box-shadow: 0 2px 10px oklch(0.68 0.16 42 / 0.36);  }
.room-item.active[data-color="coral"]   > .room-avatar { box-shadow: 0 2px 10px oklch(0.66 0.17 12 / 0.36);  }
.room-item.active[data-color="teal"]    > .room-avatar { box-shadow: 0 2px 10px oklch(0.62 0.12 215 / 0.36); }
.room-item.active[data-color="green"]   > .room-avatar { box-shadow: 0 2px 10px oklch(0.64 0.13 158 / 0.36); }

/* Active-now pulse dot (visible only when .has-active is on the item; populated in Commit 3) */
.active-dot {
  position: absolute;
  bottom: -1px; right: -1px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: #4ade80;
  border: 2px solid var(--bg);
  display: none;
  animation: dotPulse 2s ease-in-out infinite;
}
.room-item.has-active .active-dot,
.room-drawer-item.has-active .active-dot { display: block; }
@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.45); }
  50%      { box-shadow: 0 0 0 5px rgba(74, 222, 128, 0); }
}

.room-text {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 1px;
}
.room-name {
  font-size: 15px; font-weight: 500;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: -0.01em;
}
.room-item.active .room-name { font-weight: 600; }
.room-desc {
  font-size: 12.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.room-badge {
  min-width: 22px; height: 22px;
  border-radius: 11px;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 600;
  display: none; align-items: center; justify-content: center;
  padding: 0 7px;
  flex-shrink: 0;
}
.room-item.has-unread .room-badge { display: flex; }
.active-bar { display: none; }

.sidebar-bottom { padding: 12px; border-top: 1px solid var(--border); flex-shrink: 0; }
.invite-btn {
  width: 100%; padding: 8px;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit; font-weight: 500; font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: background .12s, border-color .12s;
  box-shadow: none;
}
.invite-btn:hover { background: var(--hover); border-color: var(--border2); }
.invite-btn:active { transform: scale(.99); }

/* ─── Chat area ─── */
.chat-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; min-width: 0; background: var(--surface); }
.chat-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 24px; min-height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-header-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--room-grad-1), var(--room-grad-2));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.chat-header-icon img, .chat-header-icon svg {
  width: 20px; height: 20px;
  filter: brightness(0) invert(1);
}
.chat-header-icon[data-color="purple"] { background: linear-gradient(140deg, oklch(0.72 0.13 295), oklch(0.55 0.17 290)); box-shadow: 0 1px 4px oklch(0.55 0.17 290 / 0.22); }
.chat-header-icon[data-color="orange"] { background: linear-gradient(140deg, oklch(0.80 0.14 60),  oklch(0.68 0.16 42));  box-shadow: 0 1px 4px oklch(0.68 0.16 42 / 0.22); }
.chat-header-icon[data-color="coral"]  { background: linear-gradient(140deg, oklch(0.78 0.13 25),  oklch(0.66 0.17 12));  box-shadow: 0 1px 4px oklch(0.66 0.17 12 / 0.22); }
.chat-header-icon[data-color="teal"]   { background: linear-gradient(140deg, oklch(0.78 0.10 200), oklch(0.62 0.12 215)); box-shadow: 0 1px 4px oklch(0.62 0.12 215 / 0.22); }
.chat-header-icon[data-color="green"]  { background: linear-gradient(140deg, oklch(0.82 0.13 150), oklch(0.64 0.13 158)); box-shadow: 0 1px 4px oklch(0.64 0.13 158 / 0.22); }
.chat-header-info { flex: 1; }
.chat-header-name {
  font-family: 'Inter', sans-serif;
  font-size: 16px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--text);
}
.chat-header-desc { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.chat-header-right { display: flex; gap: 6px; }

/* ─── Messages — bubble redesign ─── */
.messages-container {
  flex: 1; overflow-y: auto;
  padding: 16px 24px;
  display: flex; flex-direction: column; gap: 6px;
  scroll-behavior: smooth;
}

/* Date separator pill */
.date-sep {
  display: flex; justify-content: center;
  margin: 14px 0 8px;
}
.date-sep-pill {
  font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--muted);
  background: var(--surface2);
  padding: 4px 14px; border-radius: 99px;
  border: 1px solid var(--border);
}

.msg {
  display: flex; gap: 10px;
  align-items: flex-end;
  padding: 0 4px;
  max-width: 100%;
  animation: msgIn .2s ease-out both;
  position: relative;
}
@keyframes msgIn { from{opacity:0;transform:translateY(4px)} to{opacity:1;transform:none} }

.msg-av {
  width: 32px; height: 32px; border-radius: 50%;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12px; color: #fff;
  background: linear-gradient(135deg,#FFB088,#FF6B8B);
  align-self: flex-start;
  margin-top: 18px; /* sits next to the bubble, not the name line */
}

.msg-body {
  min-width: 0; max-width: 680px;
  display: flex; flex-direction: column; gap: 3px;
}

.msg-header {
  display: flex; align-items: baseline; gap: 8px;
  flex-wrap: wrap;
  padding: 0 4px;
}
.msg-name { font-weight: 600; font-size: 13px; color: var(--text); letter-spacing: -0.005em; }
.msg-time { font-size: 10.5px; color: var(--muted2); }
.msg-badge { font-size: 9.5px; padding: 1px 5px; border-radius: 4px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }

.msg-text {
  font-size: 14px; line-height: 1.5; color: var(--text);
  word-break: break-word; text-wrap: pretty;
  background: var(--bubble);
  padding: 9px 13px;
  border-radius: var(--radius);
  border-bottom-left-radius: 6px;
  max-width: fit-content;
}
.msg-text.filtered { color: var(--muted); font-style: italic; }

/* ── Me (current user's own messages) — right-aligned accent bubble ── */
.msg.me {
  flex-direction: row-reverse;
}
.msg.me .msg-av { display: none; } /* don't repeat your own avatar */
.msg.me .msg-body {
  align-items: flex-end;
}
.msg.me .msg-header {
  justify-content: flex-end;
}
.msg.me .msg-text {
  background: var(--bubble-me);
  color: var(--bubble-me-ink);
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: 6px;
}

/* Hover actions — float above the message */
.msg-actions {
  display: none; gap: 4px;
  position: absolute;
  top: -10px; right: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px 4px;
  box-shadow: var(--shadow-sm);
  z-index: 4;
}
.msg.me .msg-actions { right: auto; left: 8px; }
.msg:hover .msg-actions { display: flex; }
.msg-actions .ic-btn {
  width: 28px; height: 28px;
  font-size: 13px;
  padding: 0;
}

.msg.system { justify-content: center; padding: 4px 0; }
.sys-pill {
  font-size: 11.5px; color: var(--muted);
  background: var(--surface2);
  padding: 3px 12px; border-radius: 99px;
  border: none;
}

/* ─── Attachments ─── */
.att-card {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 12px; margin-top: 6px; max-width: 360px;
}
.att-icon2 { font-size: 18px; flex-shrink: 0; color: var(--muted); }
.att-meta2 { flex: 1; min-width: 0; }
.att-name2 { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-sz { font-size: 11px; color: var(--muted); margin-top: 1px; }
.att-ok {
  font-size: 10.5px; font-weight: 600; padding: 2px 6px; border-radius: 4px;
  background: rgba(72,184,120,.12); color: var(--success);
}
.att-dl {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  color: var(--muted); font-size: 12px; padding: 3px 10px; cursor: pointer; transition: all .12s;
}
.att-dl:hover { border-color: var(--border2); color: var(--text); background: var(--hover); }
.att-img2 {
  max-width: 280px; max-height: 200px; border-radius: 10px;
  display: block; margin-top: 6px; cursor: zoom-in; border: 1px solid var(--border);
}

/* ─── Input ─── */
.input-area {
  padding: 12px 24px 18px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.attach-strip { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.a-chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 4px 8px; font-size: 12px;
}
.a-chip button { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; }
.input-row {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  transition: border-color .15s, box-shadow .15s;
  box-shadow: var(--shadow-sm);
}
.input-row:focus-within {
  border-color: var(--text);
  box-shadow: 0 0 0 3px rgba(10,10,10,.05);
}
.chat-input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-family: inherit;
  font-size: 14px; resize: none; max-height: 120px; min-height: 22px; line-height: 1.5;
}
.chat-input::placeholder { color: var(--muted2); }
.input-tools { display: flex; gap: 2px; align-items: center; }
.i-btn {
  background: none; border: none; color: var(--muted);
  font-size: 16px; cursor: pointer;
  width: 30px; height: 30px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s;
}
.i-btn:hover { background: var(--hover); color: var(--text); }
.send-btn {
  background: var(--accent);
  border: none; color: #fff;
  width: 34px; height: 34px; border-radius: 9px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 14px; transition: filter .12s, transform .1s;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.send-btn:hover { filter: brightness(.96); }
.send-btn:active { transform: scale(.96); }

/* ─── Emoji ─── */
.emoji-picker {
  position: absolute; bottom: 84px; right: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--shadow);
  z-index: 300; display: none;
  flex-direction: column; gap: 8px; width: 320px;
  animation: popUp .18s ease-out;
}
.emoji-picker.open { display: flex; }
@keyframes popUp { from{opacity:0;transform:scale(.96) translateY(8px)} to{opacity:1;transform:none} }
.e-cats { display: flex; gap: 2px; overflow-x: auto; }
.e-cat-btn {
  background: none; border: none; font-size: 17px; cursor: pointer;
  padding: 5px 7px; border-radius: 6px; flex-shrink: 0;
  transition: background .12s;
}
.e-cat-btn:hover, .e-cat-btn.on { background: var(--hover); }
.e-grid { display: grid; grid-template-columns: repeat(8,1fr); gap: 2px; max-height: 180px; overflow-y: auto; }
.e-btn {
  background: none; border: none; font-size: 19px; cursor: pointer;
  padding: 4px; border-radius: 6px; transition: background .1s;
}
.e-btn:hover { background: var(--hover); }
.e-search {
  background: var(--surface2); border: 1px solid transparent;
  border-radius: 8px; padding: 7px 11px;
  color: var(--text); font-size: 13px; outline: none; width: 100%;
  font-family: inherit;
}
.e-search:focus { border-color: var(--text); background: var(--surface); }

/* ─── Overlay panels ─── */
.overlay-backdrop {
  position: absolute; inset: 0;
  background: rgba(20,20,15,.32);
  backdrop-filter: blur(2px);
  z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.overlay-backdrop.visible { opacity: 1; pointer-events: all; }
@media(min-width:769px) {
  .overlay-backdrop.visible { opacity: 0 !important; pointer-events: none !important; }
}
.side-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 380px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 210; display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .26s cubic-bezier(.4,0,.2,1);
  box-shadow: -16px 0 48px rgba(20,20,15,.06);
}
.side-panel.open { transform: translateX(0); }
.panel-header {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.panel-title {
  font-family: 'Inter', sans-serif;
  font-size: 15px; font-weight: 600; letter-spacing: -0.01em; color: var(--text);
  flex: 1;
}
.panel-close {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--surface2); border: 1px solid transparent;
  color: var(--muted); font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .12s;
}
.panel-close:hover { border-color: var(--border); color: var(--text); }
.panel-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 18px; }

/* ─── Panel sections ─── */
.p-section { display: flex; flex-direction: column; gap: 10px; }
.p-label {
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted2);
}
.p-note {
  font-size: 12.5px; color: var(--muted);
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px;
}
.protected-note {
  border-color: rgba(240,184,96,.25);
  background: rgba(240,184,96,.06);
  color: oklch(0.45 0.10 75);
}
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; background: var(--surface2);
  border-radius: 10px; border: 1px solid var(--border);
  font-size: 13px;
}
.tog {
  width: 36px; height: 20px;
  background: var(--border2); border-radius: 99px;
  cursor: pointer; position: relative; border: none;
  transition: background .2s; flex-shrink: 0;
}
.tog.on { background: var(--text); }
.tog::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: left .2s;
  box-shadow: var(--shadow-sm);
}
.tog.on::after { left: 18px; }

.f-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.f-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  background: var(--accent-glow);
  border: 1px solid transparent;
  border-radius: 99px; font-size: 12px;
  color: var(--accent-ink); font-weight: 500;
}
.f-tag button { background: none; border: none; color: var(--accent-ink); cursor: pointer; font-size: 14px; line-height: 1; }
.f-row { display: flex; gap: 6px; }
.f-input {
  flex: 1; background: var(--surface); border: 1px solid var(--border);
  border-radius: 9px; padding: 8px 11px;
  color: var(--text); font-size: 13px; outline: none; font-family: inherit;
  transition: border-color .12s, box-shadow .12s;
}
.f-input:focus { border-color: var(--text); box-shadow: 0 0 0 3px rgba(10,10,10,.05); }
.f-add {
  background: var(--text); border: none;
  border-radius: 9px; color: #fff;
  padding: 8px 14px; font-size: 13px; cursor: pointer; font-weight: 500;
  font-family: inherit;
  transition: background .12s;
}
.f-add:hover { background: var(--text2); }

.u-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: var(--surface);
  border-radius: 10px; border: 1px solid var(--border);
  transition: border-color .12s, background .12s;
}
.u-row:hover { background: var(--hover); border-color: var(--border2); }
.u-info { flex: 1; min-width: 0; }
.u-name-r { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-email-r { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.u-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.u-role-badge { font-size: 9.5px; padding: 2px 6px; border-radius: 4px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }

.b-row {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; background: var(--surface2);
  border-radius: 8px; font-size: 13px;
}
.unblock-btn {
  margin-left: auto; background: none;
  border: 1px solid var(--border); color: var(--danger);
  border-radius: 6px; padding: 3px 9px; font-size: 11.5px;
  cursor: pointer; transition: all .12s; font-family: inherit;
}
.unblock-btn:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

.p-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 14px; border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font-size: 13px; font-family: inherit; font-weight: 500;
  cursor: pointer; transition: all .12s; width: 100%;
}
.p-btn:hover { background: var(--hover); border-color: var(--border2); }
.p-btn.danger { color: var(--danger); }
.p-btn.danger:hover { border-color: var(--danger); background: rgba(232,80,96,.06); }
.p-btn.gold { color: oklch(0.55 0.13 75); }
.p-btn.gold:hover { background: rgba(240,184,96,.06); border-color: rgba(240,184,96,.4); }

.audit-item {
  padding: 9px 12px; border-radius: 8px;
  background: var(--surface2);
  border-left: 3px solid var(--border2);
  font-size: 12.5px; line-height: 1.5;
}
.audit-item.ok { border-left-color: var(--success); }
.audit-item.denied { border-left-color: var(--danger); }
.audit-item.role { border-left-color: var(--rose); }
.audit-ts { font-size: 10.5px; color: var(--muted); }

/* ─── Modals ─── */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(20,20,15,.45);
  backdrop-filter: blur(3px);
  z-index: 500; display: none;
  align-items: center; justify-content: center;
}
.modal-bg.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px 28px;
  width: 440px; max-width: 96vw; max-height: 88vh; overflow-y: auto;
  box-shadow: var(--shadow);
  animation: popUp .22s ease-out;
  display: flex; flex-direction: column; gap: 14px;
  position: relative;
}
.modal::before { display: none; }
.modal-title {
  font-family: 'Inter', sans-serif;
  font-size: 22px; font-weight: 600; letter-spacing: -0.02em;
  color: var(--text);
}
.modal-sub { font-size: 14px; color: var(--muted); }
.modal-close {
  position: absolute; top: 14px; right: 14px;
  background: none; border: none; color: var(--muted);
  font-size: 16px; cursor: pointer;
  width: 28px; height: 28px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  transition: all .12s;
}
.modal-close:hover { background: var(--hover); color: var(--text); }

.m-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 14px;
  color: var(--text); font-family: inherit;
  font-size: 14px; outline: none; width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
.m-input:focus { border-color: var(--text); box-shadow: 0 0 0 3px rgba(10,10,10,.05); }
.m-input::placeholder { color: var(--muted2); }

.m-btn {
  padding: 12px;
  border-radius: 10px;
  background: var(--text);
  border: none; color: #fff;
  font-family: inherit; font-weight: 500; font-size: 14px;
  cursor: pointer; transition: background .12s, opacity .12s;
  width: 100%;
}
.m-btn:hover { background: var(--text2); }

.divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--muted2);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.oauth-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background .12s, border-color .12s;
  width: 100%; font-family: inherit;
  justify-content: center;
}
.oauth-btn:hover { background: var(--hover); border-color: var(--border2); }
.o-icon {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}

.invite-link-box {
  display: flex; gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; align-items: center;
}
.inv-link {
  flex: 1; font-size: 12.5px; color: var(--muted);
  font-family: ui-monospace, 'SF Mono', monospace;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.copy-btn {
  background: var(--text); border: none; color: #fff;
  padding: 6px 12px; border-radius: 7px;
  font-size: 12px; font-weight: 500; cursor: pointer; flex-shrink: 0;
  font-family: inherit;
}
.copy-btn:hover { background: var(--text2); }

.share-row { display: flex; gap: 8px; justify-content: center; }
.shr-btn {
  width: 44px; height: 44px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .12s, transform .12s, background .12s;
}
.shr-btn:hover { border-color: var(--border2); background: var(--hover); transform: translateY(-1px); }

/* ─── Members ─── */
.members-sidebar {
  width: 220px; background: var(--bg);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0;
}
.members-inner { overflow-y: auto; flex: 1; padding: 4px 8px; }
.member-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: 8px;
  cursor: pointer; transition: background .12s;
}
.member-item:hover { background: var(--hover); }
.mem-name { font-size: 13px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text2); }

/* ─── Toast ─── */
.toast-wrap {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  z-index: 900; display: flex; flex-direction: column; gap: 6px;
  pointer-events: none;
}
.toast {
  background: var(--text); color: #fff;
  border: 1px solid var(--text);
  border-radius: 10px; padding: 10px 18px;
  font-size: 13px; display: flex; align-items: center; gap: 8px;
  box-shadow: var(--shadow);
  animation: toastIn .25s ease-out;
  white-space: nowrap;
}
@keyframes toastIn { from{opacity:0;transform:translateY(12px)} to{opacity:1;transform:none} }
.toast.ok   { background: var(--success); border-color: var(--success); }
.toast.warn { background: var(--warning); border-color: var(--warning); color: var(--text); }
.toast.err  { background: var(--danger); border-color: var(--danger); }
.toast.info { background: var(--text); }

/* ─── Lightbox ─── */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(20,20,15,.92);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.lightbox img {
  max-width: 92vw; max-height: 92vh;
  border-radius: 8px; object-fit: contain;
  box-shadow: 0 24px 80px rgba(0,0,0,.5);
  cursor: default;
}
.lightbox-close {
  position: absolute; top: 16px; right: 20px;
  background: rgba(255,255,255,.1); border: none; color: #fff;
  font-size: 22px; width: 40px; height: 40px; border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.lightbox-close:hover { background: rgba(255,255,255,.2); }

/* ─── Discover / Swipe ─── */
.disc-tab {
  flex: 1; padding: 12px; background: none; border: none;
  color: var(--muted); font-size: 13px; font-weight: 500;
  cursor: pointer; border-bottom: 2px solid transparent;
  transition: all .12s; font-family: inherit;
}
.disc-tab.active { color: var(--text); border-bottom-color: var(--text); }

.swipe-btn {
  width: 56px; height: 56px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 20px; cursor: pointer; transition: transform .12s, background .12s;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
  color: var(--text);
}
.swipe-btn:hover { transform: scale(1.05); background: var(--hover); }
.swipe-btn.pass { color: var(--muted); }
.swipe-btn.like { color: var(--rose); border-color: var(--rose); width: 64px; height: 64px; }

.swipe-card {
  position: absolute; inset: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px; overflow: hidden;
  cursor: grab; user-select: none;
  transition: transform .15s, opacity .15s;
  box-shadow: var(--shadow-rose);
}
.swipe-card:active { cursor: grabbing; }
.swipe-card .card-photo {
  width: 100%; height: 280px; object-fit: cover;
  background: linear-gradient(135deg, #FFB088, #FF6B8B);
  display: flex; align-items: center; justify-content: center;
  font-size: 64px; color: #fff;
}
.swipe-card .card-info { padding: 16px 18px 18px; }
.swipe-card .card-name { font-size: 22px; font-weight: 600; color: var(--text); letter-spacing: -0.02em; }
.swipe-card .card-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.swipe-card .card-bio  { font-size: 13.5px; color: var(--text2); margin-top: 10px; line-height: 1.5; text-wrap: pretty; }
.swipe-card .card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.swipe-card .card-tag  {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 99px; padding: 3px 10px; font-size: 11.5px; color: var(--text2);
}

.swipe-indicator {
  position: absolute; top: 24px;
  font-size: 28px; font-weight: 700;
  opacity: 0; transition: opacity .1s;
  border-radius: 8px; padding: 4px 14px;
  border: 3px solid;
  letter-spacing: 0.04em;
}
.swipe-indicator.like { left: 20px; color: var(--rose); border-color: var(--rose); }
.swipe-indicator.pass { right: 20px; color: var(--muted); border-color: var(--muted); }

/* ─── Profile setup ─── */
.gender-btn {
  flex: 1; padding: 11px;
  border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font-size: 13px; cursor: pointer;
  transition: all .12s; font-family: inherit;
}
.gender-btn:hover { background: var(--hover); border-color: var(--border2); }
.gender-btn.active {
  border-color: var(--text); background: var(--surface);
  color: var(--text); font-weight: 500;
  box-shadow: 0 0 0 3px rgba(10,10,10,.05);
}

.int-btn {
  padding: 6px 12px;
  border-radius: 99px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text2);
  font-size: 12.5px; cursor: pointer; transition: all .12s;
  font-family: inherit;
}
.int-btn:hover { background: var(--hover); border-color: var(--border2); }
.int-btn.active {
  border-color: var(--text); background: var(--text); color: #fff;
}

/* ─── Match cards ─── */
.match-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 8px; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.match-card:hover { background: var(--hover); border-color: var(--border2); }

@keyframes matchPop {
  from { transform: scale(.5); opacity: 0; }
  to   { transform: scale(1);  opacity: 1; }
}

/* ─── Coin balance & wallet ─── */
#coinBalance {
  background: var(--rose) !important;
  color: #fff !important;
  border: none !important;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 99px;
}
#coinBalance:hover { filter: brightness(.96); }

.scal-day {
  flex: 1; min-width: 32px; height: 44px;
  border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface2); color: var(--muted);
  gap: 2px;
}
.scal-day.done {
  background: var(--text); border-color: var(--text); color: #fff;
}
.scal-day.today {
  background: var(--surface); border: 1.5px solid var(--text); color: var(--text);
}

/* ─── Onboarding ─── */
.onb-step {
  flex: 1; height: 3px; border-radius: 99px;
  background: var(--surface2); border: none;
  transition: all .2s;
}
.onb-step.active { background: var(--text); }
.onb-step.done   { background: var(--text); }

/* ─── Mobile responsive ─── */
@media(max-width:780px) {
  .brand-name { font-size: 14px; }
  .topbar { padding: 0 12px; }
  .topbar-center { display: none; }
  .online-pill { padding: 4px 8px; font-size: 11px; }
  .chip-name { max-width: 70px; }

  .rooms-sidebar { width: 64px; flex-shrink: 0; }
  .sidebar-head { padding: 14px 8px 6px; }
  .sidebar-head .sidebar-label { display: none; }
  .room-list { padding: 4px 6px; }
  .room-item { justify-content: center; padding: 6px; gap: 0; border-radius: 12px; min-height: 56px; }
  .room-item .room-text, .room-badge { display: none; }
  .room-item.has-unread .room-badge {
    display: flex !important;
    position: absolute; top: 2px; right: 2px;
    min-width: 18px; height: 18px; font-size: 10px;
    padding: 0 5px;
  }
  /* Smaller avatar in collapsed view */
  .room-item .room-avatar { width: 36px; height: 36px; }
  .room-item .room-avatar .room-icon img,
  .room-item .room-avatar .room-icon svg { width: 18px; height: 18px; }
  .sidebar-bottom { padding: 8px 6px; }
  .invite-btn { font-size: 0; padding: 10px; border-radius: 9px; }
  .invite-btn::before { content: '+'; font-size: 18px; color: var(--muted); }

  .members-sidebar { display: none; }
  .side-panel { width: min(360px,96vw); }

  .messages-container { padding: 12px; }
  .msg-av { width: 32px; height: 32px; font-size: 12px; }

  .input-area { padding: 10px 12px; }
  .chat-input { font-size: 14px; }

  .toast { font-size: 12px; padding: 8px 14px; white-space: normal; text-align: center; }
  .toast-wrap { bottom: 70px; max-width: 90vw; }
}

@media(max-width:500px) {
  .topbar { height: 50px; padding: 0 10px; gap: 4px; }
  .brand-logo { width: 24px; height: 24px; flex-shrink: 0; }
  .brand-logo::after { inset: 5px; }
  .brand-name { font-size: 13px; }
  .tb-btn { padding: 5px 8px; font-size: 11.5px; height: 30px; }
  .chip-badge { display: none; }
  .chip-name { max-width: 60px; font-size: 12px; }
  .av { width: 26px; height: 26px; font-size: 11px; }

  #discoverBtn, #dmInboxBtn { font-size: 14px; padding: 5px 7px; }
  #signOutBtn { display: none !important; }
  #signInBtn  { font-size: 11.5px; padding: 5px 8px; }
  .online-pill { display: none; }

  .rooms-sidebar { display: none; }
  .chat-area { width: 100%; }

  .chat-header { padding: 10px 14px; min-height: 56px; }
  .chat-header-name { font-size: 14px; }
  .chat-header-desc { display: none; }

  .messages-container { padding: 10px 12px; gap: 4px; }
  .msg { padding: 0 2px; gap: 8px; }
  .msg-av { width: 28px; height: 28px; font-size: 11px; margin-top: 16px; }
  .msg-body { max-width: calc(100vw - 80px); }
  .msg-name { font-size: 12.5px; }
  .msg-text { font-size: 13.5px; padding: 8px 12px; }
  .msg-time { font-size: 10.5px; }
  .msg-badge { font-size: 9px; padding: 1px 4px; }

  .input-area { padding: 8px 10px 12px; }
  .input-row { padding: 8px 10px; border-radius: 12px; gap: 6px; }
  .chat-input { font-size: 15px; min-height: 24px; }
  .i-btn { font-size: 18px; }
  .send-btn { width: 38px; height: 38px; font-size: 15px; border-radius: 10px; }

  .emoji-picker { right: 10px; left: 10px; width: auto; bottom: 70px; }
  .e-grid { grid-template-columns: repeat(7,1fr); }

  .side-panel { width: 100vw; }

  .modal { padding: 24px 18px; border-radius: 14px; max-height: 95vh; }
  .modal-title { font-size: 18px; }

  .toast-wrap { bottom: 60px; left: 10px; right: 10px; transform: none; }
  .toast { justify-content: center; font-size: 12px; }

  #discoverBtn, #dmInboxBtn, #signOutBtn { display: none !important; }
}

/* ─── Mobile bottom nav ─── */
@media(max-width:500px) {
  .main-layout { padding-bottom: 56px; }

  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 56px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 400;
    align-items: stretch;
  }

  .mobile-nav-btn {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 3px; background: none; border: none;
    color: var(--muted2);
    font-size: 10px; font-family: inherit;
    cursor: pointer; transition: color .12s;
    position: relative;
  }
  .mobile-nav-btn:hover, .mobile-nav-btn.active { color: var(--text); }
  .mobile-nav-btn .nav-icon { font-size: 19px; line-height: 1; }
  .mobile-nav-btn .nav-label { font-size: 10px; font-weight: 500; }

  .mobile-nav-btn .nav-badge {
    position: absolute; top: 6px; right: calc(50% - 14px);
    min-width: 16px; height: 16px;
    border-radius: 99px; background: var(--accent);
    color: #fff; font-size: 9px; font-weight: 700;
    display: none; align-items: center; justify-content: center;
    padding: 0 4px;
  }
  .mobile-nav-btn.has-unread .nav-badge { display: flex; }
}

@media(min-width:501px) {
  .mobile-nav { display: none; }
}

/* ─── Mobile room drawer — slides from left edge ─── */
.room-drawer { position: fixed; inset: 0; z-index: 600; display: none; pointer-events: none; }
.room-drawer.open { display: block; pointer-events: auto; }
.room-drawer.dragging { display: block; pointer-events: auto; }
.room-drawer-backdrop {
  position: absolute; inset: 0;
  background: rgba(20,20,15,.45);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.22s cubic-bezier(0.4, 0.0, 0.2, 1);
  pointer-events: auto;
}
.room-drawer.open .room-drawer-backdrop { opacity: 1; }
.room-drawer-panel {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 84%;
  max-width: 320px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px 20px;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.22s cubic-bezier(0.4, 0.0, 0.2, 1);
  box-shadow: 8px 0 24px -8px rgba(0, 0, 0, 0.15);
  will-change: transform;
}
.room-drawer.open .room-drawer-panel { transform: translateX(0); }
.room-drawer-title {
  font-size: 12px; font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 16px; color: var(--muted);
  padding: 0 8px;
}
.room-drawer-grid { display: flex; flex-direction: column; gap: 2px; }
.room-drawer-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: transparent; border: 0;
  cursor: pointer;
  transition: background .14s ease;
  min-height: 60px;
  position: relative;
}
.room-drawer-item:active { background: var(--hover); }
.room-drawer-item.active { background: color-mix(in srgb, var(--accent) 6%, transparent); }

/* Reuse the avatar styling from sidebar (shared) */
.room-drawer-item .room-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--room-grad-1) 0%, var(--room-grad-2) 100%);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 1px 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.room-drawer-item .room-avatar .room-icon { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; }
.room-drawer-item .room-avatar .room-icon img,
.room-drawer-item .room-avatar .room-icon svg {
  width: 22px; height: 22px;
  filter: brightness(0) invert(1);
}
.room-drawer-item.active .room-avatar {
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 28%, transparent);
}

.room-drawer-item .room-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.room-drawer-item .room-name {
  font-size: 16px; font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.room-drawer-item.active .room-name { font-weight: 600; }
.room-drawer-item .room-desc {
  font-size: 13px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.room-drawer-item .room-badge {
  min-width: 22px; height: 22px;
  border-radius: 11px;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 600;
  display: none; align-items: center; justify-content: center;
  padding: 0 7px;
  flex-shrink: 0;
}
.room-drawer-item.has-unread .room-badge { display: flex; }

/* ─── Members drawer — slides from RIGHT edge (online users) ─── */
.members-drawer { position: fixed; inset: 0; z-index: 600; display: none; pointer-events: none; }
.members-drawer.open { display: block; pointer-events: auto; }
.members-drawer.dragging { display: block; pointer-events: auto; }
.members-drawer-backdrop {
  position: absolute; inset: 0;
  background: rgba(20,20,15,.45);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.22s cubic-bezier(0.4, 0.0, 0.2, 1);
  pointer-events: auto;
}
.members-drawer.open .members-drawer-backdrop { opacity: 1; }
.members-drawer-panel {
  position: absolute;
  top: 0; bottom: 0; right: 0;
  width: 78%;
  max-width: 300px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 24px 14px 20px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.22s cubic-bezier(0.4, 0.0, 0.2, 1);
  box-shadow: -8px 0 24px -8px rgba(0, 0, 0, 0.15);
  will-change: transform;
}
.members-drawer.open .members-drawer-panel { transform: translateX(0); }
.members-drawer-title {
  font-size: 12px; font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 16px; color: var(--muted);
  padding: 0 8px;
}
.members-drawer-list { display: flex; flex-direction: column; gap: 2px; }
.members-drawer-list .member-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 10px; border-radius: 10px;
  min-height: 48px;
}
.members-drawer-list .member-item:active { background: var(--hover); }
.members-drawer-list .mem-name { font-size: 14px; }
.members-drawer-empty {
  padding: 24px 12px; text-align: center;
  font-size: 13px; color: var(--muted); line-height: 1.5;
}

/* ─── Mobile "More" bottom sheet ─── */
.more-sheet { position: fixed; inset: 0; z-index: 650; display: none; }
.more-sheet.open { display: block; }
.more-sheet-backdrop {
  position: absolute; inset: 0;
  background: rgba(20,20,15,.45);
  backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .22s ease;
}
.more-sheet.open .more-sheet-backdrop { opacity: 1; }
.more-sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 80vh; overflow-y: auto;
  transform: translateY(100%);
  transition: transform .26s cubic-bezier(0.4, 0.0, 0.2, 1);
  box-shadow: 0 -8px 32px rgba(0,0,0,0.18);
}
.more-sheet.open .more-sheet-panel { transform: translateY(0); }
.more-sheet-handle {
  width: 40px; height: 4px; border-radius: 99px;
  background: var(--border2);
  margin: 4px auto 14px;
}
.more-sheet-title {
  font-size: 12px; font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 12px; padding: 0 4px;
}
.more-sheet-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.more-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 14px;
  border-radius: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 14px; font-weight: 500; color: var(--text);
  transition: background .14s, border-color .14s;
  min-height: 52px;
  text-decoration: none;
}
.more-item:active { background: var(--hover); }
.more-item .more-item-icon {
  width: 22px; height: 22px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.more-item .more-item-icon img { width: 20px; height: 20px; }
.more-item.full { grid-column: 1 / -1; }
.more-item.danger { color: var(--danger); }
.more-item .more-item-badge {
  margin-left: auto;
  min-width: 20px; height: 20px; border-radius: 10px;
  background: var(--rose); color: #fff;
  font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  padding: 0 6px;
}
/* Dark mode toggle row inside More */
.more-theme-row {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  border-radius: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  font-size: 14px; font-weight: 500; color: var(--text);
  min-height: 52px;
}
.more-theme-label { flex: 1; }
.more-theme-swatches { display: flex; gap: 8px; }
.theme-swatch-btn {
  background: none; border: 2px solid transparent; padding: 2px;
  border-radius: 50%; cursor: pointer;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .14s, transform .14s;
}
.theme-swatch-btn:hover { transform: scale(1.06); }
.theme-swatch-btn.active { border-color: var(--accent); }

.theme-swatch {
  display: block; width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.theme-swatch-rose   { background: linear-gradient(135deg, #e8607a 0%, #f0c060 100%); }
.theme-swatch-modern { background: linear-gradient(135deg, oklch(0.72 0.13 295), oklch(0.55 0.17 290)); }
.theme-swatch-dark   { background: linear-gradient(135deg, #1E1D18 50%, oklch(0.66 0.16 25) 50%); }

/* Topbar theme button — three little colored dots */
.theme-button-swatches {
  display: inline-flex; gap: 3px; align-items: center;
}
.theme-button-dot {
  width: 7px; height: 7px; border-radius: 50%;
  display: inline-block;
}
.theme-button-dot.dot-rose   { background: #e8607a; }
.theme-button-dot.dot-modern { background: oklch(0.58 0.17 293); }
.theme-button-dot.dot-dark   { background: #1E1D18; border: 1px solid var(--border2); }
#themeToggleBtn { padding: 6px 10px; }
#themeToggleBtn[data-current-theme="rose"]   .dot-rose,
#themeToggleBtn[data-current-theme="modern"] .dot-modern,
#themeToggleBtn[data-current-theme="dark"]   .dot-dark {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Theme picker popover anchored to topbar button */
.theme-picker {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 10px;
  width: 240px;
  z-index: 700;
  animation: themePickerIn .15s ease-out;
}
@keyframes themePickerIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.theme-picker-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
  padding: 4px 8px 8px;
}
.theme-option {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; border-radius: 10px;
  background: transparent; border: 1px solid transparent;
  cursor: pointer; width: 100%;
  font-family: inherit; text-align: left;
  transition: background .12s, border-color .12s;
}
.theme-option:hover { background: var(--hover); }
.theme-option.active { background: var(--accent-glow); border-color: var(--accent); }
.theme-option .theme-swatch { flex-shrink: 0; }
.theme-option-name { font-size: 14px; font-weight: 600; color: var(--text); }
.theme-option-desc { font-size: 12px; color: var(--muted); display: block; margin-top: 1px; }
.theme-option > div, .theme-option > span:not(.theme-swatch) { flex: 1; min-width: 0; }
.theme-option .theme-option-name, .theme-option .theme-option-desc { display: block; }

/* Legal links row inside More sheet — small unobtrusive footer */
.more-legal-row {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 6px;
  padding: 14px 8px 6px;
  font-size: 12.5px;
}
.more-legal-link {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 4px;
  transition: color .12s;
}
.more-legal-link:hover, .more-legal-link:active { color: var(--text); }
.more-legal-sep { color: var(--muted2); }

/* ─── Touch device tweaks ─── */
@media(hover:none) {
  .room-item { min-height: 44px; }
  .i-btn { min-width: 36px; min-height: 36px; }
  .ic-btn { min-width: 32px; min-height: 32px; }
  .tb-btn { min-height: 36px; }
  .send-btn { min-width: 44px; min-height: 44px; }
  .m-btn { min-height: 48px; font-size: 15px; }
  .oauth-btn { min-height: 48px; }
  .m-input { font-size: 16px; }
}

/* ─── Safe area for notched phones ─── */
@supports(padding-bottom: env(safe-area-inset-bottom)) {
  .input-area { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .mobile-nav { padding-bottom: env(safe-area-inset-bottom); height: calc(56px + env(safe-area-inset-bottom)); }
}

/* ─── SuperLike button ─── */
.swipe-btn.superlike {
  width: 50px; height: 50px;
  border: 1.5px solid #4a90e2;
  color: #4a90e2;
  background: var(--surface);
  position: relative;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  transition: all .15s;
}
.swipe-btn.superlike:hover {
  background: #4a90e2;
  color: #fff;
  transform: scale(1.05);
}


/* ─── Blog link in topbar ─── */
.tb-btn.tb-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

/* ─── Better responsive shrinking ─── */
@media(max-width: 900px) {
  /* Hide blog link on tablet — accessible via mobile nav */
  #blogLink { display: none !important; }
  /* Tighter brand name */
  .brand-name { font-size: 14px; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

@media(max-width: 780px) {
  /* Hide audit too on smaller tablet */
  #auditBtn { display: none !important; }
  /* Make brand name short to ensure topbar doesn't overflow */
  .brand-name { font-size: 13px; max-width: 100px; }
}

@media(max-width: 500px) {
  /* Brand name even shorter on phone */
  .brand-name { font-size: 12px; max-width: 90px; }
  /* Online pill very compact */
  .online-pill { padding: 3px 6px; font-size: 10px; }
  /* User chip ultra-compact */
  .user-chip { padding: 2px 4px 2px 6px; gap: 3px; }
  .chip-name { max-width: 50px; font-size: 11px; }
  .chip-badge { display: none; }
}

@media(max-width: 380px) {
  /* Truly tiny phone */
  .brand-name { display: none; }
  .topbar { padding: 0 8px; gap: 4px; }
  .chip-name { max-width: 40px; }
}

/* ─── Mobile blog button in bottom nav ─── */
@media(max-width: 500px) {
  #mobileBlogBtn { display: flex !important; }
}

/* ─── Unread Room Chips (mobile-first quick switcher) ─── */
.unread-chips {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
  scroll-snap-type: x proximity;
}
.unread-chips::-webkit-scrollbar { height: 0; display: none; }

.unread-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
  flex-shrink: 0;
  scroll-snap-align: start;
  position: relative;
}
.unread-chip:hover { border-color: var(--text); transform: translateY(-1px); }
.unread-chip:active { transform: translateY(0); }

.unread-chip-icon { font-size: 14px; line-height: 1; }
.unread-chip-name { font-size: 13px; font-weight: 500; }

.unread-chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--rose);
  color: white;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

/* DM chip variant */
.unread-chip.is-dm {
  background: linear-gradient(135deg, oklch(0.96 0.04 25), oklch(0.97 0.04 75));
  border-color: oklch(0.85 0.08 25);
}
.unread-chip.is-dm .unread-chip-count {
  background: linear-gradient(135deg, oklch(0.66 0.16 25), oklch(0.78 0.13 75));
}

/* Mobile: full-width strip, smaller padding */
@media(max-width: 720px) {
  .unread-chips {
    padding: 8px 10px;
    gap: 6px;
  }
  .unread-chip {
    padding: 6px 12px;
    font-size: 12.5px;
  }
}

/* Subtle entry animation when new chip appears */
@keyframes chipPop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.unread-chip { animation: chipPop 0.2s ease-out; }

/* Mobile bottom-nav unread badge */
.mobile-nav-btn .nav-badge {
  position: absolute;
  top: 4px;
  right: 18%;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--rose);
  color: white;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg, #FAFAF7);
}
