/* ==========================================================================
   Relay — Design Tokens
   ========================================================================== */
:root {
  /* Color */
  --bg-canvas: #0D0B14;
  --bg-surface: #161224;
  --bg-surface-raised: #1E1836;
  --bubble-in: #221C35;
  --bubble-out: #3B2E58;
  --text-primary: #F1EEF9;
  --text-muted: #9A93B0;
  --accent: #6E56CF;
  --accent-hover: #7F68DC;
  --accent-active: #5E48B8;
  --highlight: #9C81F5;
  --border-hairline: rgba(241, 238, 249, 0.07);
  --online: #4ADE80;
  --danger: #E5606B;

  /* Type */
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-base: 0.9375rem;
  --fs-md: 1rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;

  /* Spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 999px;

  /* Motion */
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 120ms;
  --duration-med: 220ms;

  /* Layout */
  --sidebar-w: 360px;
  --header-h: 68px;
}


/* ==========================================================================
   Reset & Base
   ========================================================================== */
*, *::before, *::after { 
  box-sizing: border-box; 
  -webkit-tap-highlight-color: transparent !important;
}

[hidden] { display: none !important; }

html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent !important;
}

body {
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

button, 
a, 
[role="button"], 
.icon-btn, 
.conv-item, 
.fab, 
.chat__identity, 
.bubble-reaction-pill, 
.reaction-btn, 
.smart-reply-chip, 
.group-member-item, 
.group-selected-chip, 
.menu__item, 
.context-menu__item, 
.auth-submit, 
.mute-opt-btn, 
.profile-btn,
.pill-btn,
.ai-tone-chip,
.ai-tab-btn {
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent !important;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
  outline: none;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
[role="button"]:focus:not(:focus-visible) {
  outline: none !important;
}

input, textarea {
  font-family: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent !important;
}

img, svg { 
  display: block; 
  -webkit-user-select: none;
  user-select: none;
}

a { color: inherit; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Visible keyboard focus only */
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--highlight) !important;
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   Custom Scrollbars
   ========================================================================== */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(156, 129, 245, 0.25) transparent;
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(156, 129, 245, 0.25);
  border-radius: var(--radius-full);
  transition: background var(--duration-fast) var(--ease-standard);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--highlight);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Reusable min touch target */
.icon-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  transition: background var(--duration-fast) var(--ease-standard),
              color var(--duration-fast) var(--ease-standard);
}
.icon-btn:hover { background: var(--bg-surface-raised); color: var(--text-primary); }
.icon-btn:active { transform: scale(0.94); }

/* ==========================================================================
   App Shell
   ========================================================================== */
.app {
  height: 100%;
  height: 100dvh;
  width: 100%;
  max-height: 100%;
  overflow: hidden;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  background: var(--bg-canvas);
}

/* ==========================================================================
   Sidebar
   ========================================================================== */
.sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  position: relative;
}

.sidebar__header {
  height: var(--header-h);
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-5);
  background: var(--bg-surface-raised);
  border-bottom: 1px solid rgba(110, 86, 207, 0.25);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  position: relative;
  z-index: 10;
}

.logo {
  font-size: var(--fs-xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}
.logo__dot { color: var(--accent); }

.logo__link {
  color: inherit;
  text-decoration: none;
}
.logo__link:hover { color: inherit; }

.sidebar__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text-primary);
  background-color: var(--accent);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}
.avatar--sm { width: 40px; height: 40px; font-size: var(--fs-xs); }
.avatar--md { width: 44px; height: 44px; font-size: var(--fs-sm); }
.avatar--xl { width: 72px; height: 72px; font-size: var(--fs-lg); }

.avatar-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  padding: 2px;
  box-shadow: 0 0 0 2px var(--accent);
  display: inline-flex;
  text-decoration: none;
  cursor: pointer;
  transition: box-shadow var(--duration-fast) var(--ease-standard);
}
.avatar-badge:hover { box-shadow: 0 0 0 2px var(--accent-hover); }
.avatar--me { width: 100%; height: 100%; font-size: var(--fs-xs); }

/* Search reveal */
.search-bar {
  padding: 0 var(--sp-5) var(--sp-3);
}
.search-bar input {
  width: 100%;
  height: 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-hairline);
  background: var(--bg-canvas);
  color: var(--text-primary);
  padding: 0 var(--sp-4);
  font-size: var(--fs-sm);
}
.search-bar input::placeholder { color: var(--text-muted); }

/* Conversation list */
.conv-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-2) var(--sp-3) var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.conv-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-3) var(--sp-3);
  border-radius: var(--radius-md);
  border-left: 3px solid transparent;
  text-align: left;
  min-height: 44px;
  transition: background var(--duration-fast) var(--ease-standard);
}

.conv-item:hover { background: rgba(241, 238, 249, 0.03); }

.conv-item.is-active {
  background: var(--bg-surface-raised);
  border-left-color: var(--accent);
}

.conv-item__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.conv-item__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2);
}

.conv-item__name {
  font-size: var(--fs-base);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-item__time {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  flex-shrink: 0;
}
.conv-item.is-active .conv-item__time,
.conv-item.has-unread .conv-item__time { color: var(--highlight); }

.conv-item__preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}

.conv-item__preview {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-item.has-unread .conv-item__preview { color: var(--text-primary); }

.unread-badge {
  flex-shrink: 0;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--highlight);
  color: #1A0F33;
  font-size: 0.6875rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.avatar-wrap { position: relative; flex-shrink: 0; }
.presence-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 11px;
  height: 11px;
  border-radius: var(--radius-full);
  background: var(--online);
  border: 2px solid var(--bg-surface);
}

.fab {
  position: absolute;
  bottom: var(--sp-6);
  right: var(--sp-6);
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(110, 86, 207, 0.45);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard);
}
.fab:hover { background: var(--accent-hover); }
.fab:active { transform: scale(0.94); }

.fab--ai {
  width: 40px;
  height: 40px;
  right: calc(var(--sp-6) + 6px);
  bottom: calc(var(--sp-6) + 52px + var(--sp-3));
  background: linear-gradient(135deg, #6e56cf 0%, #9c81f5 100%);
  box-shadow: 0 6px 18px rgba(156, 129, 245, 0.35);
  border: none;
}
.fab--ai svg {
  width: 16px;
  height: 16px;
}
.fab--ai:hover {
  background: linear-gradient(135deg, #7c65d8 0%, #aa90f7 100%);
}

/* ==========================================================================
   Chat Window
   ========================================================================== */
.chat {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  background:
    radial-gradient(ellipse 900px 500px at 85% -10%, rgba(110, 86, 207, 0.16), transparent 60%),
    var(--bg-canvas);
}

.chat__header {
  height: var(--header-h);
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-5);
  background: var(--bg-surface-raised);
  border-bottom: 1px solid rgba(110, 86, 207, 0.25);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  position: relative;
  z-index: 10;
  flex-shrink: 0;
}

.back-btn { display: none; }

.chat__identity {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex: 1;
  min-width: 0;
  cursor: pointer;
  border-radius: var(--radius-md);
  padding: 4px 6px;
  margin: -4px -6px;
  transition: background var(--duration-fast) var(--ease-standard);
}
.chat__identity:hover {
  background: rgba(110, 86, 207, 0.14);
}

.chat__who {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat__name {
  font-size: var(--fs-base);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat__status {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.chat__handle { color: var(--text-muted); }
.chat__status.is-online { color: var(--online); font-weight: 500; }
.chat__status-sep { color: var(--border-hairline); }

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  background: var(--online);
  flex-shrink: 0;
}

.chat__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

/* Chat header dropdown menu */
.menu {
  position: relative;
}

.menu__dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  padding: var(--sp-2);
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  z-index: 10;
}

.menu__item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-primary);
  text-align: left;
  min-height: 40px;
  transition: background var(--duration-fast) var(--ease-standard);
}
.menu__item:hover { background: var(--bg-surface); }
.menu__item svg { flex-shrink: 0; }

.menu__item--danger { color: var(--danger); }

/* Empty chat pane, shown once every conversation has been deleted */
.chat__empty {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp-6);
  gap: var(--sp-2);
}

.chat__empty-title {
  font-size: var(--fs-md);
  font-weight: 700;
  margin: 0;
}

.chat__empty-body {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin: 0;
  max-width: 32ch;
}

/* Message thread */
.thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--sp-6) var(--sp-6) var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Themed scrollbars — matches the app's violet/purple palette instead
   of the OS default. Applied to any scrollable pane (thread, conv list,
   settings, adduser). */
.thread,
.conv-list,
.settings-body,
.adduser-body {
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: var(--bg-surface-raised) transparent; /* Firefox */
}

.thread::-webkit-scrollbar,
.conv-list::-webkit-scrollbar,
.settings-body::-webkit-scrollbar,
.adduser-body::-webkit-scrollbar {
  width: 8px;
}

.thread::-webkit-scrollbar-track,
.conv-list::-webkit-scrollbar-track,
.settings-body::-webkit-scrollbar-track,
.adduser-body::-webkit-scrollbar-track {
  background: transparent;
}

.thread::-webkit-scrollbar-thumb,
.conv-list::-webkit-scrollbar-thumb,
.settings-body::-webkit-scrollbar-thumb,
.adduser-body::-webkit-scrollbar-thumb {
  background-color: var(--bg-surface-raised);
  border-radius: var(--radius-full);
  border: 2px solid transparent;
  background-clip: padding-box;
}

.thread::-webkit-scrollbar-thumb:hover,
.conv-list::-webkit-scrollbar-thumb:hover,
.settings-body::-webkit-scrollbar-thumb:hover,
.adduser-body::-webkit-scrollbar-thumb:hover {
  background-color: var(--accent);
}

.day-divider {
  text-align: center;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  margin: var(--sp-4) 0;
}

.msg-row {
  display: flex;
  position: relative;
  margin-bottom: 2px;
  max-width: 100%;
}
.msg-row.is-out { justify-content: flex-end; }
.msg-row.is-in { justify-content: flex-start; }

/* Grouping spacing: extra gap before a new sender block */
.msg-row.group-start { margin-top: var(--sp-4); }

.bubble {
  max-width: min(480px, 68%);
  padding: 10px var(--sp-4);
  border-radius: var(--radius-lg);
  font-size: var(--fs-base);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bubble__text { white-space: pre-wrap; word-break: break-word; }

.bubble__meta {
  align-self: flex-end;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.6875rem;
  opacity: 0.7;
}

.is-in .bubble {
  background: var(--bubble-in);
  color: var(--text-primary);
  border-bottom-left-radius: var(--radius-sm);
}
.is-out .bubble {
  background: var(--bubble-out);
  color: var(--text-primary);
  border-bottom-right-radius: var(--radius-sm);
}

/* Consecutive message grouping — flatten shared edge */
.msg-row.is-in.group-mid .bubble,
.msg-row.is-in.group-end .bubble { border-top-left-radius: var(--radius-sm); }
.msg-row.is-in.group-start .bubble,
.msg-row.is-in.group-mid .bubble { border-bottom-left-radius: var(--radius-sm); }

.msg-row.is-out.group-mid .bubble,
.msg-row.is-out.group-end .bubble { border-top-right-radius: var(--radius-sm); }
.msg-row.is-out.group-start .bubble,
.msg-row.is-out.group-mid .bubble { border-bottom-right-radius: var(--radius-sm); }

.checkmarks { display: inline-flex; }
.checkmarks.is-read { color: var(--highlight); opacity: 1; }

/* Composer */
.composer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  padding-bottom: calc(var(--sp-3) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border-hairline);
  background: var(--bg-canvas);
}

.composer__input {
  flex: 1;
  height: 44px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  padding: 0 var(--sp-5);
  font-size: var(--fs-base);
}
.composer__input::placeholder { color: var(--text-muted); }

.send-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  background: var(--bg-surface-raised);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--duration-fast) var(--ease-standard),
              color var(--duration-fast) var(--ease-standard),
              transform var(--duration-fast) var(--ease-standard);
}
.send-btn.is-active {
  background: var(--accent);
  color: var(--text-primary);
}
.send-btn.is-active:hover { background: var(--accent-hover); }
.send-btn:active { transform: scale(0.92); }
.send-btn:disabled { cursor: default; }

.ai-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-hairline);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-standard),
              color var(--duration-fast) var(--ease-standard),
              border-color var(--duration-fast) var(--ease-standard),
              transform var(--duration-fast) var(--ease-standard);
}
.ai-btn:hover {
  background: var(--accent);
  border-color: transparent;
}
.ai-btn:active {
  transform: scale(0.92);
}

/* ==========================================================================
   Responsive: Mobile (< 768px)
   ========================================================================== */
@media (max-width: 767px) {
  .sidebar__header,
  .chat__header,
  .adduser-topbar,
  .auth-topbar {
    background: #181328;
    border-bottom: 1px solid rgba(156, 129, 245, 0.25);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
    position: relative;
    z-index: 10;
  }

  .app {
    grid-template-columns: 1fr;
    height: 100%;
    height: 100dvh;
    max-height: 100%;
    overflow: hidden;
  }

  .sidebar,
  .chat {
    grid-column: 1 / -1;
    grid-row: 1 / -1;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
  }

  /* Sidebar and chat occupy the same slot; visibility is toggled */
  .app:not(.is-chat-open) .chat { display: none; }
  .app.is-chat-open .sidebar { display: none; }

  .back-btn { display: inline-flex; }

  .thread { padding: var(--sp-4) var(--sp-4) var(--sp-2); }
  .bubble { max-width: 82%; }

  .fab { bottom: calc(var(--sp-5) + env(safe-area-inset-bottom)); right: var(--sp-5); }
  .fab--ai { bottom: calc(var(--sp-5) + 52px + var(--sp-2) + env(safe-area-inset-bottom)); right: calc(var(--sp-5) + 6px); }
}

@media (min-width: 768px) {
  .sidebar { display: flex; }
  .chat { display: flex; }
}
/* ==========================================================================
   Relay — Login Page
   Extends styles.css tokens. Loaded after styles.css.
   ========================================================================== */

.auth-body {
  overflow-y: auto;
  height: auto;
  min-height: 100%;
}

/* Top bar — same logo treatment as the app shell, no actions since
   there's no session yet. */
.auth-topbar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-6);
  border-bottom: 1px solid var(--border-hairline);
}

.auth-main {
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100dvh - var(--header-h));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  background:
    radial-gradient(ellipse 700px 460px at 18% 0%, rgba(110, 86, 207, 0.14), transparent 60%),
    radial-gradient(ellipse 600px 420px at 100% 100%, rgba(156, 129, 245, 0.08), transparent 55%),
    var(--bg-canvas);
}

.auth-card {
  width: 100%;
  max-width: 840px;
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
}

@media (min-width: 768px) {
  .auth-card {
    grid-template-columns: 320px 1fr;
  }
}

.auth-card__info {
  background: linear-gradient(145deg, rgba(110, 86, 207, 0.18) 0%, rgba(22, 18, 36, 0.95) 100%);
  padding: var(--sp-6);
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

@media (min-width: 768px) {
  .auth-card__info {
    border-bottom: none;
    border-right: 1px solid var(--border-hairline);
    padding: calc(var(--sp-6) * 1.5) var(--sp-6);
  }
}

.auth-info__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: rgba(110, 86, 207, 0.18);
  border: 1px solid rgba(156, 129, 245, 0.3);
  color: var(--highlight);
  font-size: var(--fs-xs);
  font-weight: 600;
  width: fit-content;
  margin-bottom: var(--sp-4);
}

.auth-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--highlight);
  box-shadow: 0 0 6px var(--highlight);
}

.auth-info__title {
  font-size: var(--fs-lg);
  font-weight: 800;
  line-height: 1.25;
  margin: 0 0 var(--sp-2);
  color: var(--text-primary);
}

.auth-info__subtitle {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0 0 var(--sp-5);
}

.auth-info__features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.auth-info__features li {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--fs-xs);
  color: var(--text-primary);
}

.auth-info__features svg {
  color: var(--highlight);
  flex-shrink: 0;
}

/* A quiet callback to the 3px accent line used on active conversations —
   the one place this page spends its "boldness". */
.auth-card__accent {
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--highlight));
}

.auth-card__content {
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

@media (min-width: 580px) {
  .auth-card__content {
    padding: calc(var(--sp-6) * 1.25) calc(var(--sp-6) * 1.25);
  }
}

.auth-title {
  font-size: var(--fs-xl);
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 var(--sp-1);
}

.auth-subtitle {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin: 0 0 var(--sp-5);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.field__label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.field__label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.field__link {
  font-size: var(--fs-xs);
  color: var(--highlight);
  text-decoration: none;
}
.field__link:hover { text-decoration: underline; }

.field__input {
  height: 46px;
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  background: var(--bg-canvas);
  padding: 0 var(--sp-4);
  font-size: var(--fs-base);
  transition: border-color var(--duration-fast) var(--ease-standard);
}
.field__textarea {
  height: auto;
  min-height: 84px;
  padding: var(--sp-3) var(--sp-4);
  resize: vertical;
  line-height: 1.5;
  font-family: inherit;
}
.field__input::placeholder { color: var(--text-muted); }
.field__input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(110, 86, 207, 0.25);
}

.field.has-error .field__input {
  border-color: var(--danger);
}
.field.has-error .field__input:focus-visible {
  box-shadow: 0 0 0 3px rgba(229, 96, 107, 0.2);
}

.field__error {
  font-size: var(--fs-xs);
  color: var(--danger);
  margin: 0;
}

.field__hint {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin: 0;
}

/* Password strength meter */
.strength-meter {
  display: flex;
  gap: 5px;
}
.strength-meter__bar {
  flex: 1;
  height: 3px;
  border-radius: var(--radius-full);
  background: var(--border-hairline);
  transition: background var(--duration-med) var(--ease-standard);
}
.strength-meter.is-weak [data-bar]:nth-child(1) { background: var(--danger); }
.strength-meter.is-fair [data-bar]:nth-child(-n+2) { background: var(--highlight); }
.strength-meter.is-strong [data-bar] { background: var(--online); }

/* Username field */
.username-wrap { position: relative; }

.username-prefix {
  position: absolute;
  left: var(--sp-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: var(--fs-base);
  pointer-events: none;
}

.field__input.has-prefix {
  padding-left: 26px;
  padding-right: 40px;
}

.username-status {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.username-status .spinner {
  width: 14px;
  height: 14px;
  border-width: 2px;
}

.username-status svg { display: block; }
.username-status .icon-available { color: var(--online); }
.username-status .icon-taken { color: var(--danger); }

.field__hint.is-checking { color: var(--text-muted); }
.field__hint.is-available { color: var(--online); }
.field__hint.is-taken,
.field__hint.is-invalid { color: var(--danger); }

.field__input-wrap { position: relative; }
.field__input-wrap .field__input { padding-right: 46px; }

.field__reveal {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  transition: color var(--duration-fast) var(--ease-standard);
}
.field__reveal:hover { color: var(--text-primary); }

/* Checkbox */
.field--row { flex-direction: row; }

.checkbox {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  cursor: pointer;
  min-height: 44px;
}

.checkbox input {
  position: absolute;
  opacity: 0;
  width: 20px;
  height: 20px;
  margin: 0;
  cursor: pointer;
}

.checkbox__box {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border-radius: 5px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-canvas);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--duration-fast) var(--ease-standard),
              border-color var(--duration-fast) var(--ease-standard);
}

.checkbox input:checked + .checkbox__box {
  background: var(--accent);
  border-color: var(--accent);
}
.checkbox input:checked + .checkbox__box::after {
  content: "";
  width: 10px;
  height: 6px;
  border-left: 2px solid var(--text-primary);
  border-bottom: 2px solid var(--text-primary);
  transform: rotate(-45deg) translateY(-1px);
}
.checkbox input:focus-visible + .checkbox__box {
  outline: 2px solid var(--highlight);
  outline-offset: 2px;
}

.checkbox__label {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

/* Form-level error banner */
.form-error {
  font-size: var(--fs-sm);
  color: var(--danger);
  background: rgba(229, 96, 107, 0.1);
  border: 1px solid rgba(229, 96, 107, 0.3);
  border-radius: var(--radius-sm);
  padding: var(--sp-3);
  margin: 0;
}

/* Submit button */
.auth-submit {
  height: 46px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--text-primary);
  font-size: var(--fs-base);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  transition: background var(--duration-fast) var(--ease-standard),
              transform var(--duration-fast) var(--ease-standard),
              opacity var(--duration-fast) var(--ease-standard);
}
.auth-submit:hover { background: var(--accent-hover); }
.auth-submit:active { transform: scale(0.98); }
.auth-submit:disabled { opacity: 0.6; cursor: default; }

.auth-submit.is-loading .auth-submit__label { opacity: 0.85; }

.spinner {
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  border: 2px solid rgba(241, 238, 249, 0.35);
  border-top-color: var(--text-primary);
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--sp-6) 0 var(--sp-4);
  color: var(--text-muted);
  font-size: var(--fs-xs);
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-hairline);
}

/* Horizontal Field Grid */
.field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-4);
}

@media (min-width: 580px) {
  .field-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Horizontal Actions Row */
.auth-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-3);
  margin-top: var(--sp-2);
}

@media (min-width: 480px) {
  .auth-actions {
    grid-template-columns: 1fr 1fr;
  }
  .auth-actions .auth-social {
    margin-bottom: 0;
  }
}

.auth-switch {
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-top: var(--sp-5);
  margin-bottom: 0;
}
.auth-switch a {
  color: var(--highlight);
  text-decoration: none;
  font-weight: 600;
}
.auth-switch a:hover { text-decoration: underline; }

/* Social sign-in (Google) */
.auth-social {
  height: 46px;
  width: 100%;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-hairline);
  color: var(--text-primary);
  font-size: var(--fs-base);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
  transition: background var(--duration-fast) var(--ease-standard),
              transform var(--duration-fast) var(--ease-standard),
              opacity var(--duration-fast) var(--ease-standard);
}
.auth-social:hover { background: var(--bg-surface); border-color: var(--text-muted); }
.auth-social:active { transform: scale(0.98); }
.auth-social:disabled { opacity: 0.6; cursor: default; }
.auth-social__icon { flex-shrink: 0; }
.auth-social.is-loading .auth-social__label { opacity: 0.85; }


@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
}

/* ==========================================================================
   Relay — New Message / Add User
   Extends styles.css tokens. Loaded after styles.css.
   ========================================================================== */

.adduser-body {
  overflow-y: auto;
  height: auto;
  min-height: 100%;
}

.adduser-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.adduser-topbar {
  height: var(--header-h);
  min-height: var(--header-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-6);
  background: var(--bg-canvas);
  box-shadow: 0 1px 0 var(--border-hairline);
  position: relative;
  z-index: 1;
}

.adduser-main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: calc(var(--sp-6) * 1.5) var(--sp-6) var(--sp-6);
  background:
    radial-gradient(ellipse 900px 650px at 25% 0%, rgba(110, 86, 207, 0.25), transparent 60%),
    radial-gradient(ellipse 700px 550px at 90% 25%, rgba(156, 129, 245, 0.12), transparent 55%),
    var(--bg-surface);
}

.adduser-block {
  width: 100%;
  max-width: 680px;
  margin-top: var(--sp-4);
}

.adduser-heading {
  font-size: clamp(1.75rem, 3.5vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.015em;
  margin: 0 0 var(--sp-1);
}

.adduser-subtitle {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin: 0 0 var(--sp-5);
}

.adduser-searchbar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: 56px;
  padding: 0 var(--sp-5);
  border-radius: var(--radius-full);
  border: 1px solid rgba(110, 86, 207, 0.45);
  background: rgba(22, 18, 36, 0.75);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  transition: border-color var(--duration-fast) var(--ease-standard),
              box-shadow var(--duration-fast) var(--ease-standard);
}

.adduser-searchbar:focus-within {
  border-color: var(--highlight);
  box-shadow: 0 0 0 3px rgba(156, 129, 245, 0.25), 0 8px 24px rgba(0, 0, 0, 0.35);
}

.adduser-searchbar svg { color: var(--highlight); flex-shrink: 0; }

.adduser-searchbar input {
  flex: 1;
  height: 100%;
  min-width: 0;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  font-size: var(--fs-md);
  color: var(--text-primary);
  -webkit-appearance: none;
}
.adduser-searchbar input::placeholder { color: var(--text-muted); }
.adduser-searchbar input:focus,
.adduser-searchbar input:focus-visible,
.adduser-searchbar input:active {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}

.adduser__results {
  margin-top: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.adduser-section {
  margin-top: var(--sp-4);
}

.adduser-section__title {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--highlight);
  margin: 0 0 var(--sp-3);
}

.adduser-section__list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.adduser-item {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  transition: background var(--duration-fast) var(--ease-standard),
              border-color var(--duration-fast) var(--ease-standard);
}

.adduser-item:hover {
  background: var(--bg-surface-raised);
  border-color: rgba(156, 129, 245, 0.3);
}

.adduser-item__action {
  margin-left: auto;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--highlight);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: rgba(110, 86, 207, 0.15);
  border: 1px solid rgba(156, 129, 245, 0.25);
}

.adduser__empty {
  padding: var(--sp-5) var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin: 0;
}

@media (max-width: 600px) {
  .adduser-searchbar { height: 56px; }
}

/* ==========================================================================
   Relay — Settings
   Extends styles.css tokens. Loaded after styles.css.
   ========================================================================== */

.settings-body {
  overflow-y: auto;
  height: auto;
  min-height: 100%;
}

.settings-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.settings-topbar {
  height: var(--header-h);
  min-height: var(--header-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-6);
  background: var(--bg-canvas);
  box-shadow: 0 1px 0 var(--border-hairline);
  position: relative;
  z-index: 1;
}

.settings-main {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 8vh var(--sp-6) calc(var(--sp-6) * 2);
  background:
    radial-gradient(ellipse 900px 650px at 25% 0%, rgba(110, 86, 207, 0.30), transparent 60%),
    radial-gradient(ellipse 700px 550px at 90% 25%, rgba(156, 129, 245, 0.14), transparent 55%),
    var(--bg-surface);
}

.settings-card {
  width: 100%;
  max-width: 760px;
  background: rgba(22, 18, 36, 0.6);
  border: 1px solid rgba(110, 86, 207, 0.5);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
}

.settings-card__title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 var(--sp-5);
}

.settings-section {
  padding: var(--sp-5) 0;
  border-top: 1px solid var(--border-hairline);
}
.settings-section:first-of-type {
  border-top: none;
  padding-top: 0;
}

.settings-section__title {
  font-size: var(--fs-md);
  font-weight: 700;
  margin: 0 0 var(--sp-1);
}

.settings-section__desc {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin: 0 0 var(--sp-4);
}

.settings-profile-row {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

.settings-link {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--highlight);
}
.settings-link:hover { text-decoration: underline; }

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}


.settings-section .field { margin-bottom: 0; }
.settings-section > .field + .field { margin-top: var(--sp-4); }

.form-success {
  font-size: var(--fs-sm);
  color: var(--online);
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: var(--radius-sm);
  padding: var(--sp-3);
  margin: var(--sp-5) 0 0;
}

.settings-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-4);
  margin-top: var(--sp-5);
}

.settings-save { flex: 0 0 auto; padding: 0 var(--sp-6); }

.btn-secondary {
  height: 46px;
  padding: 0 var(--sp-5);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-hairline);
  color: var(--text-primary);
  font-size: var(--fs-base);
  font-weight: 700;
  transition: background var(--duration-fast) var(--ease-standard);
}
.btn-secondary:hover { background: var(--bg-canvas); }

.settings-danger {
  margin-top: var(--sp-6);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}

.settings-danger__title {
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--danger);
  margin: 0 0 4px;
}

.settings-danger__desc {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin: 0;
  max-width: 40ch;
}

.btn-danger {
  flex-shrink: 0;
  height: 44px;
  padding: 0 var(--sp-5);
  border-radius: var(--radius-sm);
  background: rgba(229, 96, 107, 0.1);
  border: 1px solid rgba(229, 96, 107, 0.35);
  color: var(--danger);
  font-size: var(--fs-sm);
  font-weight: 700;
  transition: background var(--duration-fast) var(--ease-standard);
}
.btn-danger:hover { background: rgba(229, 96, 107, 0.2); }

@media (max-width: 640px) {
  .settings-main { padding-top: 6vh; }
  .settings-card { padding: var(--sp-5); }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-actions { flex-direction: column-reverse; align-items: stretch; }
  .settings-danger { flex-direction: column; align-items: flex-start; }
}

/* ========================================================================== */
/* Modals */
/* ========================================================================== */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--bg-surface); padding: var(--sp-6); border-radius: var(--radius-lg);
  width: 100%; max-width: 400px;
  border: 1px solid var(--border-hairline);
}
.modal__title { font-size: var(--fs-lg); font-weight: 700; margin-bottom: var(--sp-2); }
.modal__body { color: var(--text-secondary); font-size: var(--fs-sm); }

/* Custom Popup Dialog Window */
.custom-popup-overlay {
  z-index: 10000 !important;
  background: rgba(13, 11, 20, 0.85) !important;
  backdrop-filter: blur(10px);
}
.custom-popup-modal {
  max-width: 420px;
  width: 90%;
  border: 1px solid var(--border-hairline);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 24px rgba(110, 86, 207, 0.25);
  animation: popupIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.custom-popup__header {
  margin-bottom: var(--sp-2);
}
.custom-popup__title {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.custom-popup__body {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  line-height: 1.5;
  margin-bottom: var(--sp-4);
  white-space: pre-wrap;
}
.custom-popup__actions {
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
}
.custom-popup__actions .btn-primary {
  background: var(--accent);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 8px 18px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-size: var(--fs-sm);
}
.custom-popup__actions .btn-secondary {
  border-radius: var(--radius-md);
  padding: 8px 18px;
  cursor: pointer;
  font-size: var(--fs-sm);
}

@keyframes popupIn {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

/* ========================================================================== */
/* Welcome Empty States */
/* ========================================================================== */
.sidebar-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-6) var(--sp-5);
  flex: 1;
  min-height: 300px;
  text-align: center;
  position: relative;
}
.sidebar-empty[hidden] { display: none; }

.sidebar-empty__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: var(--sp-6);
}

.sidebar-empty__icon {
  width: 68px;
  height: 68px;
  border-radius: var(--radius-full);
  background: rgba(110, 86, 207, 0.15);
  border: 1px solid rgba(156, 129, 245, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--sp-4);
  box-shadow: 0 0 24px rgba(110, 86, 207, 0.25);
}

.sidebar-empty__title {
  font-size: var(--fs-lg);
  font-weight: 800;
  margin: 0 0 var(--sp-2);
  color: var(--text-primary);
}

.sidebar-empty__desc {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  max-width: 240px;
  margin: 0;
  line-height: 1.5;
}

.sidebar-empty__arrow-wrap {
  position: absolute;
  bottom: 78px;
  right: 28px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
  z-index: 5;
}

.sidebar-empty__hint {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--highlight);
  background: rgba(30, 24, 54, 0.92);
  border: 1px solid rgba(156, 129, 245, 0.4);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  margin-bottom: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
}

.sidebar-empty__arrow {
  width: 64px;
  height: 64px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}

.chat-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  text-align: center;
}
.chat-empty[hidden] { display: none; }

.chat-empty__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 380px;
}

.chat-empty__badge {
  width: 88px;
  height: 88px;
  border-radius: var(--radius-full);
  background: rgba(110, 86, 207, 0.12);
  border: 1px solid rgba(110, 86, 207, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--sp-5);
  box-shadow: 0 0 32px rgba(110, 86, 207, 0.2);
}

.chat-empty__content h2 {
  font-size: var(--fs-xl);
  font-weight: 800;
  margin: 0 0 var(--sp-2);
}

.chat-empty__content p {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0 0 var(--sp-4);
}

/* ==========================================================================
   Skeleton screens
   ========================================================================== */
@keyframes skeleton-shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}

/* Base shimmer surface — applied to every skeleton shape */
.skeleton-line,
.skeleton-circle,
.skeleton-bubble {
  background: linear-gradient(
    90deg,
    var(--bg-surface-raised) 25%,
    rgba(241, 238, 249, 0.07) 50%,
    var(--bg-surface-raised) 75%
  );
  background-size: 1200px 100%;
  animation: skeleton-shimmer 1.6s ease-in-out infinite;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

/* Circle avatar placeholder */
.skeleton-circle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
}
.skeleton-circle--md {
  width: 44px;
  height: 44px;
}

/* ── Sidebar skeleton ────────────────────────────────── */
.sidebar-skeleton {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--sp-2) var(--sp-3);
}
.sidebar-skeleton[hidden] { display: none !important; }

.skeleton-conv-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--radius-md);
}

.skeleton-conv-item__lines {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.skeleton-line {
  height: 12px;
  border-radius: var(--radius-full);
}

/* ── Chat panel skeleton ─────────────────────────────── */
.chat-skeleton {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.chat-skeleton[hidden] { display: none !important; }

.chat-skeleton__header {
  height: var(--header-h);
  min-height: var(--header-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--sp-5);
  background: var(--bg-surface-raised);
  border-bottom: 1px solid rgba(110, 86, 207, 0.25);
}

.chat-skeleton__lines {
  display: flex;
  flex-direction: column;
}

.chat-skeleton__thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-6);
  overflow: hidden;
}

/* Bubble-shaped skeleton rows */
.skeleton-bubble {
  height: 42px;
  border-radius: var(--radius-lg);
}
.skeleton-bubble--in {
  align-self: flex-start;
  border-bottom-left-radius: var(--radius-sm);
}
.skeleton-bubble--out {
  align-self: flex-end;
  border-bottom-right-radius: var(--radius-sm);
}

/* ==========================================================================
   Chat Request Banner (Accept / Decline) & Pills
   ========================================================================== */
.request-banner {
  padding: var(--sp-4) var(--sp-5);
  background: var(--bg-surface-raised);
  border-top: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
}

.request-banner[hidden] {
  display: none !important;
}

.request-banner__content {
  max-width: 460px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1);
}

.request-banner__text {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.request-banner__sub {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin: 0 0 var(--sp-3);
}

.request-banner__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  justify-content: center;
}

.request-btn {
  height: 38px;
  min-width: 110px;
  padding: 0 var(--sp-5);
  border-radius: var(--radius-full);
  font-size: var(--fs-sm);
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--duration-fast) var(--ease-standard),
              transform var(--duration-fast) var(--ease-standard),
              border-color var(--duration-fast) var(--ease-standard);
}

.request-btn--accept {
  background: var(--accent);
  color: var(--text-primary);
}
.request-btn--accept:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.request-btn--reject {
  background: rgba(224, 86, 86, 0.12);
  color: #ff6b6b;
  border-color: rgba(224, 86, 86, 0.25);
}
.request-btn--reject:hover {
  background: rgba(224, 86, 86, 0.25);
  border-color: rgba(224, 86, 86, 0.4);
  transform: translateY(-1px);
}

.request-pill {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(110, 86, 207, 0.25);
  color: var(--highlight);
  border: 1px solid rgba(156, 129, 245, 0.35);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.2;
}
.request-pill--muted {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  border-color: transparent;
}

/* Custom Context Menu Popup */
.context-menu {
  position: fixed;
  z-index: 10001;
  background: rgba(26, 20, 42, 0.96);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 6px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6), 0 0 20px rgba(110, 86, 207, 0.2);
  min-width: 190px;
  backdrop-filter: blur(12px);
  animation: contextMenuIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}
.context-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: var(--fs-sm);
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: background var(--duration-fast), color var(--duration-fast);
}
.context-menu__item:hover {
  background: var(--accent);
  color: var(--text-primary);
}
.context-menu__item--danger:hover {
  background: rgba(220, 38, 38, 0.9);
  color: #ffffff;
}

@keyframes contextMenuIn {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

/* Conversation Switch Transition Animation */
.thread.is-switching {
  animation: chatThreadSwitch 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.chat__header.is-switching {
  animation: chatHeaderSwitch 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes chatThreadSwitch {
  0% {
    opacity: 0.1;
    transform: translateY(8px) scale(0.995);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes chatHeaderSwitch {
  0% {
    opacity: 0.3;
    transform: translateY(-4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Pinned Conversation Styles */
.conv-item__pin {
  font-size: 0.75rem;
  line-height: 1;
  opacity: 0.85;
  flex-shrink: 0;
  margin-left: 2px;
}

.conv-item.is-pinned {
  background: rgba(110, 86, 207, 0.08);
}

/* Composer Message Editing Bar */
.composer {
  flex-wrap: wrap;
}

.editing-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(110, 86, 207, 0.16);
  border: 1px solid rgba(156, 129, 245, 0.3);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  margin-bottom: 6px;
}
.editing-bar[hidden] {
  display: none !important;
}
.editing-bar__left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.editing-bar__icon {
  font-size: 14px;
}
.editing-bar__info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.editing-bar__title {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--highlight);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.2;
}
.editing-bar__preview {
  font-size: 0.8125rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}
.editing-bar__cancel {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: color var(--duration-fast), background var(--duration-fast);
}
.editing-bar__cancel:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.12);
}

/* Message Bubble Edited Tag */
.bubble__edited {
  font-size: 0.625rem;
  font-style: italic;
  opacity: 0.75;
  margin-right: 3px;
}

/* In-Chat Thread Search Bar */
.thread-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-surface-raised);
  border-bottom: 1px solid var(--border-hairline);
  backdrop-filter: blur(12px);
  z-index: 10;
}
.thread-search-bar[hidden] {
  display: none !important;
}
.thread-search-bar__icon {
  color: var(--text-muted);
  flex-shrink: 0;
}
.thread-search-bar__input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: var(--fs-sm);
  outline: none;
}
.thread-search-bar__input::placeholder {
  color: var(--text-muted);
}
.thread-search-bar__count {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  white-space: nowrap;
  font-weight: 600;
}
.thread-search-bar__nav {
  display: flex;
  align-items: center;
  gap: 2px;
}
.thread-search-bar__btn,
.thread-search-bar__close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--duration-fast), background var(--duration-fast);
}
.thread-search-bar__btn:hover:not(:disabled),
.thread-search-bar__close:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}
.thread-search-bar__btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.search-highlight {
  background: rgba(255, 213, 0, 0.4);
  color: #ffffff;
  border-radius: 2px;
  padding: 0 2px;
}
.bubble.search-active-match {
  box-shadow: 0 0 0 2px var(--highlight), 0 0 16px rgba(110, 86, 207, 0.5);
  transition: box-shadow 0.2s ease;
}

/* ── Reply Bar (above composer input) ────────────────────────────── */
.reply-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(110, 86, 207, 0.12);
  border: 1px solid rgba(156, 129, 245, 0.25);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  margin-bottom: 6px;
}
.reply-bar[hidden] { display: none !important; }
.reply-bar__left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.reply-bar__icon { font-size: 14px; }
.reply-bar__info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.reply-bar__sender {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--highlight);
  line-height: 1.2;
}
.reply-bar__preview {
  font-size: 0.8125rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
  opacity: 0.85;
}

/* ── Quoted bubble inside message ─────────────────────────────────── */
.bubble__quote {
  display: block;
  border-left: 3px solid rgba(156, 129, 245, 0.6);
  background: rgba(0, 0, 0, 0.18);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 4px 8px;
  margin-bottom: 6px;
  cursor: pointer;
}
.bubble__quote-sender {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--highlight);
  display: block;
  margin-bottom: 2px;
}
.bubble__quote-text {
  font-size: 0.8125rem;
  opacity: 0.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  max-width: 260px;
}

/* ── Mute badge on conv-item ──────────────────────────────────────── */
.conv-item__mute {
  font-size: 0.75rem;
  opacity: 0.7;
  flex-shrink: 0;
}

/* ── Swipe-to-reply on touch ──────────────────────────────────────── */
.msg-row {
  transition: transform 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.msg-row.is-swiping {
  transition: none;
}
.reply-swipe-hint {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
}
.msg-row.is-out .reply-swipe-hint { right: 12px; }
.msg-row.is-in  .reply-swipe-hint { left: 12px; }
.msg-row.swipe-ready .reply-swipe-hint {
  opacity: 1;
  transform: translateY(-50%) scale(1.1);
}

/* ── Smart Replies Bar ────────────────────────────────────────────── */
.smart-replies-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 4px 6px 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.smart-replies-bar::-webkit-scrollbar { display: none; }
.smart-replies-label {
  font-size: 14px;
  flex-shrink: 0;
}
.smart-replies-list {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.smart-replies-list::-webkit-scrollbar { display: none; }
.smart-reply-chip {
  background: rgba(110, 86, 207, 0.16);
  border: 1px solid rgba(156, 129, 245, 0.35);
  color: var(--text-primary);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 5px 12px;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  flex-shrink: 0;
}
.smart-reply-chip:hover {
  background: rgba(110, 86, 207, 0.32);
  border-color: var(--highlight);
  transform: translateY(-1px);
}
.smart-reply-chip:active {
  transform: translateY(0);
}
.smart-replies-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: color 0.15s ease;
}
.smart-replies-close:hover {
  color: var(--text-primary);
}

/* ── In-Chat Translation Card ─────────────────────────────────────── */
.bubble__translation {
  margin-top: 6px;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.25);
  border-left: 2px solid var(--highlight);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
}
.bubble__translation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--highlight);
  margin-bottom: 2px;
}
.bubble__translation-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 0 2px;
}
.bubble__translation-close:hover {
  color: var(--text-primary);
}
.bubble__translation-text {
  margin: 0;
  line-height: 1.35;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Mute Modal ───────────────────────────────────────────────────── */
.mute-modal {
  max-width: 380px;
}
.mute-opt-btn {
  text-align: left;
  justify-content: flex-start;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: background var(--duration-fast), border-color var(--duration-fast);
}
.mute-opt-btn:hover {
  border-color: var(--accent);
  background: rgba(110, 86, 207, 0.18);
}

/* ── AI Assistant Modal & Tabs ────────────────────────────────────── */
.ai-assistant-modal {
  max-width: 520px;
  width: 92vw;
}
.ai-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border-hairline);
  padding-bottom: 10px;
  margin-bottom: 14px;
  overflow-x: auto;
}
.ai-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.ai-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}
.ai-tab-btn.is-active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.ai-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.ai-tone-chip {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-hairline);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.ai-tone-chip:hover {
  border-color: var(--highlight);
  background: rgba(110, 86, 207, 0.2);
}
.ai-result-box {
  background: var(--bg-canvas);
  border: 1px solid rgba(156, 129, 245, 0.3);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 10px;
}
.ai-result-title {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--highlight);
  margin-bottom: 6px;
}
.ai-result-text {
  margin: 0;
  font-size: var(--fs-sm);
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.ai-use-btn {
  margin-top: 10px;
  height: 36px;
  font-size: var(--fs-xs);
  padding: 0 16px;
}

/* ── Floating Reaction Bar on Messages ───────────────────────────── */
.msg-reaction-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-hairline);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  border-radius: var(--radius-full);
  padding: 3px 6px;
  position: absolute;
  top: -34px;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px) scale(0.92);
  transition: opacity 0.18s ease, transform 0.18s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.msg-row.is-out .msg-reaction-bar { right: 8px; }
.msg-row.is-in  .msg-reaction-bar { left: 8px; }

.msg-row:hover .msg-reaction-bar,
.msg-row.has-reaction-bar-open .msg-reaction-bar {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.reaction-btn {
  background: transparent;
  border: none;
  font-size: 1.15rem;
  line-height: 1;
  padding: 4px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  justify-content: center;
}
.reaction-btn:hover {
  transform: scale(1.35);
}
.reaction-btn:active {
  transform: scale(1.1);
}

/* ── Reaction Bar in Context Menu ────────────────────────────────── */
.context-menu__reactions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 4px 6px 8px;
  border-bottom: 1px solid var(--border-hairline);
  margin-bottom: 4px;
}
.ctx-reaction-btn {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 3px;
  border-radius: 50%;
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.ctx-reaction-btn:hover {
  transform: scale(1.3);
}

/* ── Reaction Badges under Bubble ─────────────────────────────────── */
.bubble__reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.bubble-reaction-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(22, 18, 36, 0.8);
  border: 1px solid rgba(156, 129, 245, 0.3);
  border-radius: var(--radius-full);
  padding: 2px 7px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.bubble-reaction-pill:hover {
  border-color: var(--highlight);
  background: rgba(110, 86, 207, 0.3);
  transform: translateY(-1px);
}
.bubble-reaction-pill.is-me {
  background: rgba(110, 86, 207, 0.35);
  border-color: var(--accent);
}

/* ── Forwarded Tag on Bubbles ─────────────────────────────────────── */
.bubble__forwarded {
  font-size: 0.6875rem;
  font-style: italic;
  opacity: 0.8;
  color: var(--highlight);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 2px;
}

/* ── Forward Modal ────────────────────────────────────────────────── */
.forward-modal {
  max-width: 420px;
  width: 90vw;
}
.forward-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.forward-preview {
  background: var(--bg-canvas);
  border-left: 3px solid var(--accent);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  margin-bottom: 12px;
  max-height: 80px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.forward-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
}
.forward-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.forward-item:hover {
  border-color: var(--highlight);
  background: rgba(110, 86, 207, 0.18);
}
.forward-item__info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.forward-item__name {
  font-size: var(--fs-sm);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.forward-item__send {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.forward-item__send:hover {
  opacity: 0.9;
}

/* ========================================================================== */
/* Profile View Page */
/* ========================================================================== */
.profileview-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.profileview-main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: var(--sp-6) var(--sp-4);
}

.profileview-card {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
}

.profileview-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--sp-4) 0 var(--sp-2);
}

.profileview-avatar-wrap {
  position: relative;
  cursor: pointer;
  margin-bottom: var(--sp-4);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.profileview-avatar-wrap:hover {
  transform: scale(1.05);
}

.profileview-avatar {
  width: 110px;
  height: 110px;
  border-radius: var(--radius-full);
  border: 3px solid var(--accent);
  box-shadow: 0 8px 32px rgba(110, 86, 207, 0.35);
  display: inline-block;
}

.profileview-avatar-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 3px solid var(--bg-surface);
  background: #22c55e;
}
.profileview-avatar-badge.is-ai {
  background: var(--highlight);
}

.profileview-name {
  font-size: var(--fs-xl);
  font-weight: 800;
  margin: 0 0 4px;
  color: var(--text-primary);
}

.profileview-username {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin: 0 0 10px;
}

.pv-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-hairline);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
}
.pv-status-pill.is-online {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.3);
  background: rgba(34, 197, 94, 0.1);
}

.profileview-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profileview-section__label {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.profileview-bio {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}
.profileview-bio.is-empty {
  color: var(--text-muted);
  font-style: italic;
}

.profileview-cta {
  display: flex;
}

.profileview-msg-btn {
  width: 100%;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: var(--fs-base);
  font-weight: 700;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px rgba(110, 86, 207, 0.4);
}

.profileview-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.profileview-action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}
.profileview-action-btn:hover {
  border-color: var(--highlight);
  background: rgba(110, 86, 207, 0.15);
  transform: translateY(-1px);
}
.profileview-action-btn--danger {
  color: var(--danger);
}
.profileview-action-btn--danger:hover {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.12);
}
.profileview-action-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.profileview-details-list {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.profileview-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-hairline);
  font-size: var(--fs-sm);
}
.profileview-detail-row:last-child {
  border-bottom: none;
}
.profileview-detail-title {
  color: var(--text-muted);
}
.profileview-detail-value {
  font-weight: 600;
  color: var(--text-primary);
}

/* ── Lightbox Modal ─────────────────────────────────────────────────── */
.pv-lightbox {
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}
.pv-lightbox[hidden] {
  display: none;
}
.pv-lightbox__content {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pv-lightbox__content img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.8);
  object-fit: contain;
}
.pv-lightbox__close {
  position: absolute;
  top: -44px;
  right: 0;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  font-size: 1.25rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.pv-lightbox__close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ========================================================================== */
/* Group Chats */
/* ========================================================================== */
.group-modal {
  max-width: 460px;
  width: 90vw;
}

.group-avatar-picker-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.group-avatar-preview {
  width: 58px;
  height: 58px;
  border-radius: var(--radius-full);
  background: rgba(110, 86, 207, 0.2);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(110, 86, 207, 0.25);
}

.group-selected-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
  max-height: 80px;
  overflow-y: auto;
}

.group-selected-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(110, 86, 207, 0.35);
  border: 1px solid var(--accent);
  border-radius: var(--radius-full);
  padding: 3px 8px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: #fff;
}
.group-selected-chip__remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0 2px;
  line-height: 1;
}
.group-selected-chip__remove:hover {
  color: var(--danger);
}

.group-member-checklist {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 6px;
  background: var(--bg-surface-raised);
}

.group-member-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease;
  user-select: none;
}
.group-member-item:hover {
  background: rgba(110, 86, 207, 0.15);
}
.group-member-item.is-selected {
  background: rgba(110, 86, 207, 0.25);
}
.group-member-item__left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.group-member-item__name {
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.group-member-item__handle {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-left: 4px;
}
.group-member-item__checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border-radius: 5px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-canvas);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: background var(--duration-fast) var(--ease-standard),
              border-color var(--duration-fast) var(--ease-standard);
  margin: 0;
}

.group-member-item__checkbox:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.group-member-item__checkbox:checked::after {
  content: "";
  width: 10px;
  height: 6px;
  border-left: 2px solid var(--text-primary);
  border-bottom: 2px solid var(--text-primary);
  transform: rotate(-45deg) translateY(-1px);
}

.group-member-item__checkbox:focus-visible {
  outline: 2px solid var(--highlight);
  outline-offset: 2px;
}

/* ── Group Pill Badge in Conversation List ────────────────────────── */
.group-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--highlight);
  background: rgba(156, 129, 245, 0.15);
  border: 1px solid rgba(156, 129, 245, 0.35);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  margin-left: 4px;
}

/* ── Sender name above group incoming bubbles ─────────────────────── */
.bubble__sender-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--highlight);
  margin-bottom: 2px;
  user-select: none;
}

/* ── Group Info Modal ─────────────────────────────────────────────── */
.group-info-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 14px;
}
.group-info-avatar {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  background: rgba(110, 86, 207, 0.25);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 8px;
  box-shadow: 0 4px 18px rgba(110, 86, 207, 0.3);
}
.group-info-name {
  font-size: var(--fs-lg);
  font-weight: 800;
  margin: 0 0 2px;
}
.group-info-sub {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin: 0;
}
.group-info-actions-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.group-info-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  font-size: var(--fs-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface-raised);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}
.group-info-action-btn:hover {
  border-color: var(--highlight);
  background: rgba(110, 86, 207, 0.15);
}
.group-info-action-btn--danger {
  color: var(--danger);
}
.group-info-action-btn--danger:hover {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.15);
}

.group-members-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.group-members-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 6px;
  background: var(--bg-surface-raised);
}
.group-member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}
.group-member-row__info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.group-member-row__name {
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.group-admin-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.4);
  padding: 1px 5px;
  border-radius: var(--radius-full);
  margin-left: 6px;
}
.group-member-remove-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease;
}
.group-member-remove-btn:hover {
  color: var(--danger);
}

/* ==========================================================================
   Chat Organization & Productivity Suite Styles
   ========================================================================== */

/* Chat Tabs Filter Bar */
.chat-tabs-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 10px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  border-bottom: 1px solid var(--border-hairline);
  background: var(--bg-surface);
}
.chat-tabs-bar::-webkit-scrollbar {
  display: none;
}

.chat-tab-pill {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-hairline);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 500;
  padding: 4px 11px;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--duration-fast) var(--ease-standard);
}
.chat-tab-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.15);
}
.chat-tab-pill.is-active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(110, 86, 207, 0.35);
}

/* Draft Badges in Sidebar */
.draft-pill {
  font-size: 0.6875rem;
  font-weight: 700;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  margin-left: 4px;
}
.conv-item__draft-text {
  color: #f59e0b !important;
  font-style: italic;
}

/* In-Chat Search Highlights */
mark.search-highlight {
  background: rgba(251, 191, 36, 0.35);
  color: #ffffff;
  border-radius: 2px;
  padding: 0 2px;
  border-bottom: 1.5px solid #fbbf24;
}
mark.search-highlight.is-current {
  background: #f59e0b;
  color: #0d0b14;
  font-weight: bold;
  /* Attachment Action Button */
.composer__action-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--duration-fast) var(--ease-standard),
              color var(--duration-fast) var(--ease-standard);
  cursor: pointer;
}
.composer__action-btn:hover {
  background: var(--bg-surface-raised);
  color: var(--highlight);
  border-color: rgba(156, 129, 245, 0.3);
}

/* Photo Attachment Preview Bar */
.photo-preview-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(110, 86, 207, 0.12);
  border: 1px solid rgba(156, 129, 245, 0.25);
  border-left: 3px solid var(--highlight);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  margin-bottom: 8px;
}
.photo-preview-bar[hidden] { display: none !important; }

.photo-preview-bar__left {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
}

.photo-preview-bar__img {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border-hairline);
  flex-shrink: 0;
}

.photo-preview-bar__info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.photo-preview-bar__title {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--highlight);
}

.photo-preview-bar__size {
  font-size: 0.6875rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Message Bubble Photo Card */
.bubble__image-wrap {
  margin-top: 4px;
  margin-bottom: 4px;
  border-radius: var(--radius-md);
  overflow: hidden;
  max-width: 300px;
  cursor: pointer !important;
  position: relative;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: transform var(--duration-fast) var(--ease-standard),
              opacity var(--duration-fast) var(--ease-standard);
}
.bubble__image-wrap:hover {
  opacity: 0.92;
  transform: scale(0.99);
}

.bubble__image {
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: cover;
  display: block;
  cursor: pointer !important;
  pointer-events: auto;
}








