/* css/messages.css — VibeLab direct messages (rich 3-pane redesign) */

/* ── Page layout ─────────────────────────────────────────────────────── */
.messages-page {
  display: flex;
  height: calc(100vh - 64px);            /* subtract nav height */
  overflow: hidden;
  background: var(--bg);
}

/* ════════════════════════════════════════════════════════════════════════
   LEFT PANE — conversation list
   ════════════════════════════════════════════════════════════════════════ */
.msg-list-pane {
  width: 348px;
  min-width: 300px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
}

.msg-list-head {
  flex-shrink: 0;
  padding: 16px 16px 10px;
  border-bottom: 1px solid var(--border-light);
}

.msg-list-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.msg-list-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0;
}

.msg-compose-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--text);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  transition: background 0.15s, transform 0.1s;
  cursor: pointer;
}
.msg-compose-btn:hover { background: var(--accent-soft); border-color: var(--accent-dark); }
.msg-compose-btn:active { transform: scale(0.94); }

/* ── New Message compose modal ─────────────────────────────────────────────── */
.msg-compose-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.msg-compose-overlay[hidden] { display: none; }
.msg-compose-modal {
  position: relative;
  width: 100%; max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 32px 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  max-height: calc(100vh - 40px); overflow: auto;
}
.msg-compose-close {
  position: absolute; top: 14px; right: 16px;
  width: 32px; height: 32px;
  background: none; border: none; border-radius: 50%;
  font-size: 1.6rem; line-height: 1; color: var(--text-muted); cursor: pointer;
}
.msg-compose-close:hover { color: var(--text); background: var(--bg-alt); }
.msg-compose-title { text-align: center; font-size: 1.6rem; font-weight: 800; margin: 2px 0 8px; color: var(--text); }
.msg-compose-sub {
  text-align: center; font-size: 0.9rem; color: var(--text-muted);
  margin: 0 auto 22px; max-width: 380px; line-height: 1.45;
}
.msg-compose-label { display: block; font-size: 0.9rem; font-weight: 700; color: var(--text); margin: 0 0 8px; }
.msg-compose-to-wrap { position: relative; margin-bottom: 18px; }
.msg-compose-input, .msg-compose-textarea {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 12px;
  padding: 13px 14px; font-size: 0.95rem; font-family: inherit;
  background: var(--surface); color: var(--text);
}
.msg-compose-input:focus, .msg-compose-textarea:focus { outline: none; border-color: var(--accent-dark); }
.msg-compose-textarea { resize: vertical; min-height: 130px; margin-bottom: 14px; }
.msg-compose-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 5;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  overflow: hidden auto; max-height: 260px;
}
.msg-compose-results[hidden] { display: none; }
.msg-compose-result {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; background: none; border: none; cursor: pointer; text-align: left;
}
.msg-compose-result:hover { background: var(--bg-alt); }
.msg-compose-result-av {
  width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 50%; overflow: hidden;
  background: var(--bg-alt); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem; color: var(--text-secondary);
}
.msg-compose-result-av img { width: 100%; height: 100%; object-fit: cover; }
.msg-compose-result-meta { display: flex; flex-direction: column; min-width: 0; }
.msg-compose-result-name { font-size: 0.9rem; font-weight: 700; color: var(--text); }
.msg-compose-result-handle { font-size: 0.8rem; color: var(--text-muted); }
.msg-compose-error { color: #d33; font-size: 0.85rem; margin: 0 0 12px; }
.msg-compose-error[hidden] { display: none; }
.msg-compose-send {
  width: 100%; padding: 14px; border-radius: 999px; border: none;
  background: var(--accent); color: #000; font-size: 0.98rem; font-weight: 800; cursor: pointer;
  transition: filter 0.12s, opacity 0.12s;
}
.msg-compose-send:hover:not(:disabled) { filter: brightness(0.95); }
.msg-compose-send:disabled { opacity: 0.5; cursor: default; }

/* Search */
.msg-search {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}
.msg-search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}
.msg-search input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-alt);
  font-size: 0.85rem;
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.msg-search input::placeholder { color: var(--text-muted); }
.msg-search input:focus {
  outline: none;
  border-color: var(--text);
  background: var(--surface);
}

/* Filter pills */
.msg-filters {
  display: flex;
  gap: 6px;
}
.msg-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-alt);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.msg-filter:hover { color: var(--text); }
.msg-filter.active {
  background: var(--text);
  color: #fff;
}
.msg-filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--accent);
  color: #000;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1;
}
.msg-filter.active .msg-filter-count { background: var(--accent); color: #000; }

/* Conversation list scroll */
.msg-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
}
.msg-list::-webkit-scrollbar { width: 8px; }
.msg-list::-webkit-scrollbar-thumb { background: transparent; border-radius: 4px; }
.msg-list:hover::-webkit-scrollbar-thumb { background: var(--border); }

/* Empty state */
.msg-empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

/* ── Single conversation row ─────────────────────────────────────────── */
.msg-conv-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
  border-radius: 12px;
  transition: background 0.12s;
  position: relative;
}
.msg-conv-row:hover { background: var(--bg-alt); }
.msg-conv-row.active { background: var(--accent-soft); }
.msg-conv-row.active::before {
  content: "";
  position: absolute;
  left: 0; top: 14px; bottom: 14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent-dark);
}

/* Avatar */
.msg-conv-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
}
.msg-conv-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Body */
.msg-conv-body { flex: 1; min-width: 0; }
.msg-conv-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.msg-conv-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-conv-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
  font-weight: 500;
}
.msg-conv-preview {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.msg-conv-preview .you-prefix { color: var(--text-muted); }

/* Unread emphasis */
.msg-conv-row.unread .msg-conv-name { font-weight: 800; }
.msg-conv-row.unread .msg-conv-preview { color: var(--text); font-weight: 600; }
.msg-conv-row.unread .msg-conv-time { color: var(--accent-dark); font-weight: 700; }

/* Unread count badge (right side) */
.msg-conv-badge {
  flex-shrink: 0;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--accent);
  color: #000;
  font-size: 0.7rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Request chip on a row */
.msg-conv-reqchip {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--accent-dark);
  background: var(--accent-soft);
  padding: 2px 7px;
  border-radius: 5px;
}

/* ════════════════════════════════════════════════════════════════════════
   CENTER PANE — thread
   ════════════════════════════════════════════════════════════════════════ */
.msg-thread-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  min-width: 0;
}

/* Empty placeholder */
.msg-thread-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-muted);
  text-align: center;
  padding: 24px;
}
.msg-placeholder-icon {
  width: 84px; height: 84px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-alt);
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.msg-placeholder-title { font-size: 1.05rem; font-weight: 700; color: var(--text); margin: 0; }
.msg-placeholder-sub { font-size: 0.875rem; margin: 0; }

.msg-thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* Thread header */
.msg-thread-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface);
  position: relative;
}
.msg-thread-back { display: none; }   /* mobile-only back affordance */
.msg-thread-head-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--text-secondary); font-size: 0.95rem;
}
.msg-thread-head-avatar img { width: 100%; height: 100%; object-fit: cover; }
.msg-thread-head-meta { flex: 1; min-width: 0; }
.msg-thread-who {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  display: block;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.msg-thread-who:hover { text-decoration: underline; }
.msg-thread-sub { font-size: 0.74rem; color: var(--text-muted); margin-top: 1px; }

.msg-thread-actions { display: flex; align-items: center; gap: 2px; }
.msg-icon-btn {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  border: none; background: none; cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.12s, color 0.12s;
}
.msg-icon-btn:hover { background: var(--bg-alt); color: var(--text); }

/* Thread menu popover */
.msg-thread-menu-pop {
  position: absolute;
  top: 52px; right: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 6px;
  z-index: 30;
  min-width: 150px;
}
.msg-thread-menu-pop button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  background: none; border: none; border-radius: 8px;
  cursor: pointer;
}
.msg-thread-menu-pop button:hover { background: var(--bg-alt); }
.msg-thread-menu-pop button.danger { color: #d63b3b; }
.msg-thread-menu-pop button.danger:hover { background: rgba(214,59,59,0.08); }

/* Scroll area */
.msg-thread-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scroll-behavior: smooth;
}
.msg-thread-scroll::-webkit-scrollbar { width: 8px; }
.msg-thread-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Day separator */
.msg-day-sep {
  align-self: center;
  margin: 16px 0 10px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-alt);
  padding: 4px 12px;
  border-radius: 999px;
}

/* ── Message rows + bubbles ──────────────────────────────────────────── */
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 76%;
}
.msg-row.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-row.theirs { align-self: flex-start; }

/* group spacing: tighter within a run, looser between senders */
.msg-row + .msg-row { margin-top: 2px; }
.msg-row.group-start { margin-top: 12px; }

.msg-row-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; color: var(--text-secondary);
  align-self: flex-end;
}
.msg-row-avatar img { width: 100%; height: 100%; object-fit: cover; }
.msg-row-avatar.ghost { visibility: hidden; }  /* keeps alignment for stacked bubbles */

.msg-bubble-wrap { position: relative; display: flex; flex-direction: column; min-width: 0; }
.msg-row.mine .msg-bubble-wrap { align-items: flex-end; }

.msg-bubble {
  position: relative;
  padding: 9px 13px;
  font-size: 0.9rem;
  line-height: 1.4;
  border-radius: 18px;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  max-width: 100%;
}
.msg-bubble.theirs {
  background: var(--bg-alt);
  color: var(--text);
  border-bottom-left-radius: 6px;
}
.msg-bubble.mine {
  background: var(--text);
  color: #fff;
  border-bottom-right-radius: 6px;
}
/* group corner smoothing: only the last bubble in a run gets the small tail */
.msg-row.theirs:not(.group-end) .msg-bubble.theirs { border-bottom-left-radius: 18px; }
.msg-row.mine:not(.group-end) .msg-bubble.mine { border-bottom-right-radius: 18px; }

.msg-bubble.pending { opacity: 0.55; }
.msg-bubble.failed { background: rgba(214,59,59,0.12); color: #b22; }

/* time under a bubble (shown on group-end / hover) */
.msg-time {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin: 3px 4px 0;
}
.msg-row.mine .msg-time { text-align: right; }

/* Seen receipt — single, under the last read outgoing message */
.msg-seen {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin: 2px 4px 0;
  text-align: right;
  font-weight: 500;
}

/* ── Reactions ───────────────────────────────────────────────────────── */
.msg-react-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.8rem;
  display: none;
  align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  z-index: 4;
}
.msg-row.theirs .msg-react-btn { right: -32px; }
.msg-row.mine .msg-react-btn { left: -32px; }
.msg-bubble:hover .msg-react-btn { display: flex; }
.msg-react-btn:hover { background: var(--bg-alt); }

.msg-react-pop {
  position: absolute;
  bottom: calc(100% + 6px);
  display: flex;
  gap: 2px;
  padding: 5px 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  z-index: 6;
}
.msg-row.mine .msg-react-pop { right: 0; }
.msg-row.theirs .msg-react-pop { left: 0; }
.msg-react-pop button {
  border: none; background: none; cursor: pointer;
  font-size: 1.15rem; line-height: 1;
  padding: 3px;
  border-radius: 50%;
  transition: transform 0.1s, background 0.1s;
}
.msg-react-pop button:hover { transform: scale(1.25); background: var(--bg-alt); }

.msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 2px 0;
}
.msg-reaction {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-secondary);
  cursor: pointer;
}
.msg-reaction.active { background: var(--accent-soft); border-color: var(--accent-dark); color: var(--text); }

/* ── Request banner ──────────────────────────────────────────────────── */
.msg-request-banner {
  flex-shrink: 0;
  margin: 0 18px 8px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.msg-request-banner--incoming {
  background: var(--accent-soft);
  border: 1px solid var(--accent-dark);
  color: var(--text);
}
.msg-request-banner--sent {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.msg-banner-btn {
  border: none; cursor: pointer;
  font-size: 0.78rem; font-weight: 700;
  padding: 5px 11px; border-radius: 8px;
}
.msg-banner-btn--block { background: var(--text); color: #fff; }
.msg-banner-btn--block:hover { background: #000; }

/* ── Quick-reply chips ───────────────────────────────────────────────── */
.msg-quick-replies {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  padding: 4px 18px 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.msg-quick-replies::-webkit-scrollbar { display: none; }
.msg-quick-chip {
  flex-shrink: 0;
  padding: 7px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}
.msg-quick-chip:hover { background: var(--accent-soft); border-color: var(--accent-dark); }

/* ── Composer ────────────────────────────────────────────────────────── */
.msg-composer {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--border-light);
  background: var(--surface);
}
.msg-composer-tools { display: flex; gap: 2px; padding-bottom: 4px; }
.msg-composer-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 0 6px 0 14px;
  transition: border-color 0.15s, background 0.15s;
}
.msg-composer-input-wrap:focus-within { border-color: var(--text); background: var(--surface); }
.msg-composer-input-wrap input {
  flex: 1;
  border: none; background: none; outline: none;
  padding: 11px 0;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
}
.msg-composer-input-wrap input::placeholder { color: var(--text-muted); }
.msg-composer-emoji {
  border: none; background: none; cursor: pointer;
  font-size: 1.1rem; padding: 4px 6px; line-height: 1;
  color: var(--text-secondary);
}
.msg-send-btn {
  flex-shrink: 0;
  height: 40px;
  padding: 0 18px;
  border: none;
  border-radius: 20px;
  background: var(--accent);
  color: #000;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.12s, opacity 0.12s, transform 0.1s;
}
.msg-send-btn:hover { filter: brightness(0.94); }
.msg-send-btn:active { transform: scale(0.96); }
.msg-send-btn:disabled { opacity: 0.45; cursor: default; background: var(--border); color: var(--text-muted); }

/* ════════════════════════════════════════════════════════════════════════
   RIGHT PANE — info / context
   ════════════════════════════════════════════════════════════════════════ */
.msg-info-pane {
  width: 300px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--surface);
  overflow-y: auto;
  display: none;            /* shown when a thread opens */
}
.msg-info-pane.show { display: block; }

.msg-info-card {
  padding: 28px 20px 22px;
  text-align: center;
  border-bottom: 1px solid var(--border-light);
}
.msg-info-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto 12px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 700; color: var(--text-secondary);
}
.msg-info-avatar img { width: 100%; height: 100%; object-fit: cover; }
.msg-info-name { font-size: 1.1rem; font-weight: 800; color: var(--text); letter-spacing: -0.01em; }
.msg-info-username { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }
.msg-info-location {
  font-size: 0.78rem; color: var(--text-muted);
  margin-top: 6px;
  display: inline-flex; align-items: center; gap: 4px;
}
.msg-info-bio {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 12px;
}
.msg-info-actions { display: flex; gap: 8px; margin-top: 16px; }
.msg-info-btn {
  flex: 1;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: filter 0.12s, background 0.12s;
}
.msg-info-btn--follow { background: var(--accent); color: #000; border: 1px solid var(--accent); }
.msg-info-btn--follow:hover { filter: brightness(0.94); }
.msg-info-btn--follow.following { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.msg-info-btn--profile { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.msg-info-btn--profile:hover { background: var(--bg-alt); }

/* Job title / headline */
.msg-info-role {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-top: 8px;
  line-height: 1.4;
}
/* Stats row: vibes · hosted · followers · following */
.msg-info-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.msg-info-stat strong { color: var(--text); font-weight: 800; }
/* Social icons */
.msg-info-socials {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}
.msg-info-social {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  display: inline-flex; align-items: center; justify-content: center;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.msg-info-social:hover { color: var(--text); border-color: var(--text); background: var(--bg-alt); }

/* ── Loading skeletons (inbox rows + thread bubbles) ─────────────────── */
.msg-skeleton-list { display: flex; flex-direction: column; gap: 4px; padding: 6px 0; }
.msg-skeleton-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
}
.msg-skeleton-av {
  width: 46px; height: 46px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--bg-alt);
  animation: msg-shimmer 1.5s infinite linear;
}
.msg-skeleton-body { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.msg-skeleton-line {
  height: 11px; border-radius: 6px;
  background: var(--bg-alt);
  animation: msg-shimmer 1.5s infinite linear;
}
.msg-skeleton-line--name { width: 52%; }
.msg-skeleton-line--preview { width: 75%; opacity: 0.6; }
.msg-skeleton-bubble {
  height: 36px; border-radius: 18px;
  max-width: 56%;
  background: var(--bg-alt);
  animation: msg-shimmer 1.5s infinite linear;
}
.msg-skeleton-bubble--mine { align-self: flex-end; }
.msg-skeleton-bubble--theirs { align-self: flex-start; }
@keyframes msg-shimmer {
  0%   { opacity: 0.7; }
  50%  { opacity: 0.4; }
  100% { opacity: 0.7; }
}

/* ── Character counter ────────────────────────────────────────────────── */
.msg-char-counter {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: right;
  padding: 0 18px 6px;
  margin-top: -8px;
  flex-shrink: 0;
}

/* ── Per-message hover/⋯ menu ─────────────────────────────────────────── */
.msg-msg-menu {
  display: none;
  position: absolute;
  top: 50%; transform: translateY(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  padding: 4px;
  z-index: 10;
  white-space: nowrap;
}
.msg-row.mine  .msg-msg-menu { right: calc(100% + 8px); }
.msg-row.theirs .msg-msg-menu { left: calc(100% + 8px); }
.msg-bubble-wrap:hover .msg-msg-menu,
.msg-msg-menu.open { display: block; }
.msg-msg-menu button {
  display: block; width: 100%; text-align: left;
  padding: 7px 11px; border: none; background: none;
  border-radius: 7px; cursor: pointer;
  font-size: 0.82rem; font-weight: 500; color: var(--text);
}
.msg-msg-menu button:hover { background: var(--bg-alt); }
.msg-msg-menu button.danger { color: #d63b3b; }
.msg-msg-menu button.danger:hover { background: rgba(214,59,59,0.08); }

/* ── Unsent tombstone ─────────────────────────────────────────────────── */
.msg-bubble--tombstone {
  font-style: italic;
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

/* ── Failed/retry affordance ──────────────────────────────────────────── */
.msg-retry-btn {
  margin-top: 4px;
  padding: 4px 10px;
  font-size: 0.76rem; font-weight: 700;
  color: #b22; background: none;
  border: 1px solid #b22; border-radius: 7px;
  cursor: pointer;
  align-self: flex-end;
}
.msg-retry-btn:hover { background: rgba(178,34,34,0.07); }

/* ── Degraded/error banner ─────────────────────────────────────────────── */
.msg-error-banner {
  margin: 24px auto;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 0.85rem;
  text-align: center;
  color: var(--text-secondary);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  max-width: 480px;
}
.msg-error-banner button {
  margin-left: 8px;
  padding: 4px 10px;
  border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface); cursor: pointer;
  font-size: 0.82rem; color: var(--text);
}
.msg-error-banner button:hover { background: var(--bg-alt); }

/* ── Pagination "Load older" ─────────────────────────────────────────── */
.msg-load-older-wrap { text-align: center; padding: 8px 0 4px; }
.msg-load-older-btn {
  padding: 6px 16px;
  font-size: 0.8rem; font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.msg-load-older-btn:hover { background: var(--bg-alt); color: var(--text); }
.msg-load-older-btn:disabled { opacity: 0.5; cursor: default; }

/* ── Accept / Decline request buttons ────────────────────────────────── */
.msg-banner-btn--accept {
  background: var(--accent); color: #000;
}
.msg-banner-btn--accept:hover { filter: brightness(0.94); }
.msg-banner-btn--decline {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
}
.msg-banner-btn--decline:hover { background: var(--bg-alt); }
.msg-banner-text { flex: 1; }
.msg-banner-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── First-run empty state ───────────────────────────────────────────── */
.msg-firstrun {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; text-align: center;
  color: var(--text-muted);
}
.msg-firstrun svg { color: var(--text-secondary); }
.msg-firstrun-title { font-size: 0.98rem; font-weight: 700; color: var(--text); margin: 0; }
.msg-firstrun-body { font-size: 0.84rem; margin: 0; max-width: 260px; line-height: 1.5; }

/* ── Avatar initial span (inbox + thread) ────────────────────────────── */
.msg-avatar-initial {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  font-size: 0.9rem; font-weight: 700; text-transform: uppercase;
  color: var(--text-secondary);
}

/* ── Composer wrap (wraps form + char counter) ───────────────────────── */
.msg-composer-wrap {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

/* ── No-results label in compose search ─────────────────────────────── */
.msg-compose-no-results {
  padding: 12px 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ════════════════════════════════════════════════════════════════════════
   Responsive
   ════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1080px) {
  .msg-info-pane { display: none !important; }   /* drop the info pane first */
}
@media (max-width: 768px) {
  .messages-page { position: relative; }
  .msg-list-pane {
    width: 100%;
    min-width: unset;
    border-right: none;
  }
  /* When a thread is open, the page gets .thread-open and the list slides away */
  .messages-page.thread-open .msg-list-pane { display: none; }
  .msg-thread-pane {
    position: absolute;
    inset: 0;
    display: none;
  }
  .messages-page.thread-open .msg-thread-pane { display: flex; }
  .msg-row { max-width: 86%; }
  .msg-thread-back { display: inline-flex; }
}

/* ════════════════════════════════════════════════════════════════════════
   In-app dialogs (block confirm, report, blocked-list)
   — replaces native confirm/prompt so they match the app chrome.
   ════════════════════════════════════════════════════════════════════════ */
.msg-dialog-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.msg-dialog {
  background: var(--bg, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 1.5rem;
  min-width: 280px; max-width: 360px; width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  display: flex; flex-direction: column; gap: 1rem;
}
.msg-dialog-title {
  font-weight: 600; font-size: 1rem;
  color: var(--text, #111);
}
.msg-dialog-body {
  font-size: 0.9rem; color: var(--text-muted, #666);
  line-height: 1.5;
}
.msg-dialog-choices { display: flex; flex-direction: column; gap: 0.5rem; }
.msg-dialog-choice {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.9rem; color: var(--text, #111);
  cursor: pointer; padding: 0.4rem 0;
}
.msg-dialog-choice input[type="radio"] { accent-color: var(--accent, #6c63ff); }
.msg-dialog-btns {
  display: flex; gap: 0.5rem; justify-content: flex-end; flex-wrap: wrap;
}
.msg-dialog-cancel {
  padding: 0.45rem 1rem; border-radius: 7px; border: 1px solid var(--border, #e5e7eb);
  background: transparent; color: var(--text, #111); font-size: 0.9rem; cursor: pointer;
}
.msg-dialog-cancel:hover { background: var(--bg-alt, #f5f5f5); }
.msg-dialog-confirm {
  padding: 0.45rem 1rem; border-radius: 7px; border: none;
  background: var(--accent, #6c63ff); color: #fff;
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
}
.msg-dialog-confirm:hover { opacity: 0.88; }
.msg-dialog-confirm--danger { background: #e53935; }

/* Blocked-people list */
.msg-blocked-dialog { min-width: 300px; max-width: 420px; }
.msg-blocked-list { display: flex; flex-direction: column; gap: 0.5rem; max-height: 300px; overflow-y: auto; }
.msg-blocked-loading, .msg-blocked-empty, .msg-blocked-error {
  font-size: 0.9rem; color: var(--text-muted, #666); padding: 0.5rem 0;
}
.msg-blocked-error { color: #e53935; }
.msg-blocked-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.4rem 0; border-bottom: 1px solid var(--border, #e5e7eb);
}
.msg-blocked-row:last-child { border-bottom: none; }
.msg-blocked-name { font-size: 0.9rem; color: var(--text, #111); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-blocked-unblock-btn {
  padding: 0.3rem 0.75rem; border-radius: 6px;
  border: 1px solid var(--border, #e5e7eb); background: transparent;
  font-size: 0.82rem; cursor: pointer; color: var(--text, #111); white-space: nowrap;
}
.msg-blocked-unblock-btn:hover { background: var(--bg-alt, #f5f5f5); }
.msg-blocked-unblock-btn:disabled { opacity: 0.5; cursor: not-allowed; }
