/* ==========================================================================
   IRONITT v2 — Communication (first slice: the conversation frame)
   --------------------------------------------------------------------------
   Owns the frame every conversation shares — the channel / whisper header,
   the chat column and the composer — and, on desktop, hands navigation to
   the shell's chats column (css/v2/shell.css, js/shell.js).

   Flat, like the v3 design: the header is a bar with a hairline under it,
   not a card floating over the messages, and the composer is one round
   field. Messages, voice, friends and posts keep their legacy styling for
   now (later slices).
   ========================================================================== */

/* ---- Desktop: the chats column is the navigator ----------------------- */
/* While the chats column is open it lists every whisper, Notes and the
   nest's channels, and the rail lists the nests; the view's own strips
   would only repeat them. Collapsed (or too narrow for the column) they
   come back, and so does the section bar. */
@media (min-width: 1001px) {
  #app:not(.chats-collapsed) :is(.server-diamond-strip, .channel-sidebar, .dm-avatar-strip) { display: none; }
}

/* ---- Conversation column ---------------------------------------------- */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-header,
.dm-thread-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
  min-height: 64px;
  padding: 0 var(--space-lg);
  border-bottom: 1px solid var(--border-color);
}
.chat-header { justify-content: space-between; }
.dm-thread-header.dm-thread-header--mobile-only { display: none; }

/* ---- Composer: one round field ---------------------------------------- */
.chat-input-area {
  position: relative;
  flex-shrink: 0;
  padding: var(--space-sm) var(--space-lg) var(--space-lg);
}
.chat-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: var(--field-h);
  padding: 0 7px;
  border-radius: var(--radius-pill);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  transition: border-color var(--transition-fast);
}
.chat-input-wrapper:focus-within { border-color: var(--accent-color); }
.chat-input-wrapper input {
  flex: 1;
  min-width: 0;
  padding: var(--space-xs) var(--space-sm);
  background: none;
  border: none;
  font-size: var(--font-size-md);
}
.chat-input-wrapper input:focus { border: none; }
.chat-input-wrapper button {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-round);
  color: var(--text-muted);
  font-size: 18px;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}
.chat-input-wrapper button:hover { color: var(--text-primary); background: var(--bg-hover); }
.thread-input-area .chat-input-wrapper { width: 100%; }

/* Send: there once there is something to send (js: .has-text). */
.chat-input-wrapper .composer-send { display: none; }
.chat-input-wrapper.has-text .composer-send {
  display: grid;
  margin-left: 2px;
  background: var(--accent-color);
  color: var(--accent-text);
  font-size: 15px;
  animation: composer-send-in 160ms var(--island-ease) both;
}
.chat-input-wrapper.has-text .composer-send:hover { background: var(--accent-color); color: var(--accent-text); filter: brightness(1.08); }
@keyframes composer-send-in { from { opacity: 0; transform: scale(0.6); } }
@media (prefers-reduced-motion: reduce) { .chat-input-wrapper.has-text .composer-send { animation: none; } }
/* Phones: while typing, send takes the place of the poll and GIF buttons. */
@media (max-width: 768px) {
  .chat-input-wrapper.has-text :is(#create-poll-btn, #dm-create-poll-btn, #server-gif-btn, #dm-gif-btn) { display: none; }
}

/* ---- Phones ------------------------------------------------------------ */
@media (max-width: 768px) {
  .dm-thread-header.dm-thread-header--mobile-only { display: flex; }
}
@media (max-width: 640px) {
  .chat-header,
  .dm-thread-header { min-height: 56px; padding: 0 var(--space-md); }
  .chat-input-area { padding: var(--space-xs) var(--space-md) var(--space-md); }
}
@media (max-width: 380px) {
  .chat-input-area { padding: var(--space-xs) var(--space-sm) var(--space-sm); }
}

/* ==========================================================================
   Friends — one list of people, like Home's feed rows
   ========================================================================== */
.friends-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
  padding: var(--space-lg) var(--space-lg) var(--space-md);
}
.friends-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-stretch: 125%;
  font-size: var(--font-size-title);
  line-height: 30px;
}

.friends-sub-tabs {
  position: relative;
  display: flex;
  gap: 2px;
  padding: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
}
.friends-sub-indicator {
  position: absolute;
  top: 4px;
  left: 0;
  height: calc(100% - 8px);
  border-radius: var(--radius-pill);
  background: var(--bg-hover);
  pointer-events: none;
  /* Slides and resizes together; it is one small pill, so the width step
     costs next to nothing. */
  transition: transform var(--transition-normal), width var(--transition-normal);
}
.friends-sub-tab {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  transition: color var(--transition-fast);
}
.friends-sub-tab:not(.active):hover { color: var(--text-primary); }
.friends-sub-tab.active {
  color: var(--text-primary);
  font-weight: var(--font-weight-semibold);
  cursor: default;
  pointer-events: none;
}
.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--accent-light);
  color: var(--accent-color);
  font-size: var(--font-size-2xs);
  font-weight: var(--font-weight-bold);
}
.light-mode .tab-count { color: var(--accent-solid); }

.add-friend-island {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  max-width: 560px;
  min-height: var(--field-h);
  margin: 0 var(--space-lg) var(--space-md);
  padding: 0 7px 0 18px;
  border-radius: var(--radius-pill);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  transition: border-color var(--transition-fast);
}
/* One ring: the island shows focus; the bare input inside it never does (it had the
   global input border and focus ring too, a second green frame inside the pill). */
.add-friend-island:focus-within { border-color: var(--accent-color); }
.add-friend-island input,
.add-friend-island input:hover,
.add-friend-island input:focus,
.add-friend-island input:focus-visible {
  flex: 1;
  min-width: 0;
  height: auto;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  outline: 0;
  box-shadow: none;
  font-size: var(--font-size-md);
}
.btn-add-friend {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-round);
  background: var(--accent-color);
  color: var(--accent-text);
  transition: background-color var(--transition-fast);
}
.btn-add-friend:hover { background: var(--accent-hover); }

.friends-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 var(--space-lg) var(--space-lg);
}
.friends-grid-inner,
.pending-list { display: flex; flex-direction: column; max-width: 720px; }

.friend-card,
.pending-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "avatar name actions" "avatar status actions";
  column-gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}
.friend-card:last-child,
.pending-card:last-child { border-bottom: 0; }
.friend-card-avatar,
.friend-avatar { grid-area: avatar; position: relative; width: 44px; height: 44px; }
.friend-card-avatar.offline-desaturated { opacity: 0.55; }
.friend-card-name {
  grid-area: name;
  align-self: end;
  font-weight: var(--font-weight-semibold);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.friend-card-status {
  grid-area: status;
  align-self: start;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}
.friend-card-status .status-emoji { font-size: 14px; line-height: 1; }
.friend-card-status .status-text { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }
/* The presence word is drawn from a data-* attribute the renderer already
   localised (CSS cannot reach I18n). Presence.apply() keeps this element's
   status class live (it matches [data-presence-dot]), so the word and its
   colour follow a status change without the store touching the text. */
.friend-card-presence.online::after { content: attr(data-online); }
.friend-card-presence.idle::after { content: attr(data-idle); }
.friend-card-presence.dnd::after { content: attr(data-dnd); }
.friend-card-presence.offline::after { content: attr(data-offline); }
.friend-card-presence.online { color: var(--color-online); }
.friend-card-presence.idle { color: var(--color-idle); }
.friend-card-presence.dnd { color: var(--color-dnd); }
.friend-card-presence.offline { color: var(--text-muted); }
.friend-card-presence + .status-text:not(:empty)::before { content: ' · '; }
.friend-card-divider { display: none; }

.pending-card .friend-info { grid-area: name / name / status / status; min-width: 0; }
.pending-card .friend-name { font-weight: var(--font-weight-semibold); }
.friend-status-text { font-size: var(--font-size-xs); color: var(--text-muted); }

.friend-card-actions,
.friend-actions { grid-area: actions; display: flex; gap: 4px; }
.friend-action-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-round);
  color: var(--text-muted);
  transition: color var(--transition-fast), background-color var(--transition-fast);
}
.friend-action-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.friend-action-btn.accept { background: var(--accent-color); color: var(--accent-text); }
.friend-action-btn.accept:hover { background: var(--accent-hover); }
.friend-action-btn.decline:hover { color: var(--color-danger); }

.pending-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 4px;
  font-family: var(--font-display);
  font-stretch: 125%;
  font-size: var(--font-size-2xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.pending-section-header:first-child { margin-top: 0; }

/* Quiet empty state: an icon and a sentence. */
.friends-empty {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--space-md) 0;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}
.friends-empty p { margin: 0; }

@media (max-width: 640px) {
  .friends-header { padding: var(--space-md) var(--space-md) var(--space-sm); }
  .add-friend-island { margin: 0 var(--space-md) var(--space-md); }
  .friends-grid { padding: 0 var(--space-md) var(--space-md); }
  .friend-card-actions .friend-action-btn { width: 32px; height: 32px; }
}

/* ==========================================================================
   Phones — the section menu Communication opens on: a short list, not four
   screen-filling cards
   ========================================================================== */
.comm-mobile-menu { display: none; }
@media (max-width: 768px) {
  .communication-view.comm-menu-open .comm-mobile-menu {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    height: 100%;
    min-height: 0;
    padding: var(--space-sm) var(--space-xs) var(--space-md);
    overflow-y: auto;
    animation: v2-view-fade-in var(--view-fade) ease;
  }
  .comm-menu-title {
    margin: 0;
    font-family: var(--font-display);
    font-stretch: 125%;
    font-size: var(--font-size-title);
    line-height: 30px;
    letter-spacing: -0.02em;
  }
  .comm-menu-sub { margin: 6px 0 0; color: var(--text-secondary); font-size: var(--font-size-sub); }
  .comm-menu-grid { display: flex; flex-direction: column; }
  .comm-menu-btn {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "ico label chev" "ico desc chev";
    column-gap: 16px;
    row-gap: 2px;
    align-items: center;
    min-height: 84px;
    padding: 18px 6px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    text-align: left;
    transition: background-color var(--transition-fast);
  }
  .comm-menu-btn:last-child { border-bottom: 0; }
  .comm-menu-btn:active { background: var(--bg-secondary); }
  .comm-menu-btn::after {
    grid-area: chev;
    content: '\f054';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 14px;
    color: var(--text-muted);
  }
  .comm-menu-ico {
    grid-area: ico;
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: var(--radius-lg);
    background: var(--accent-light);
    color: var(--accent-color);
    font-size: 22px;
  }
  .light-mode .comm-menu-ico { color: var(--accent-solid); }
  .comm-menu-label { grid-area: label; align-self: end; font-size: var(--font-size-lg); font-weight: var(--font-weight-semibold); }
  .comm-menu-desc { grid-area: desc; align-self: start; font-size: var(--font-size-sm); color: var(--text-muted); }
}

/* ==========================================================================
   Posts — a reading column of flat posts (rows with a hairline between
   them, like Home's feed), not a stack of floating cards
   ========================================================================== */
.posts-toolbar {
  display: flex;
  justify-content: center;
  flex-shrink: 0;
  padding: var(--space-md) 0 var(--space-sm);
}
.posts-filter-pills {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  padding: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
}
.posts-filter-pills::-webkit-scrollbar { display: none; }
.posts-filter-indicator {
  position: absolute;
  top: 4px;
  left: 0;
  height: calc(100% - 8px);
  border-radius: var(--radius-pill);
  background: var(--bg-hover);
  pointer-events: none;
  opacity: 0;
}
.posts-filter-indicator.visible { opacity: 1; }
.posts-filter-btn {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  white-space: nowrap;
  transition: color var(--transition-fast);
}
.posts-filter-btn i { font-size: 13px; }
.posts-filter-btn:not(.active):hover { color: var(--text-primary); }
.posts-filter-btn.active {
  color: var(--text-primary);
  font-weight: var(--font-weight-semibold);
  cursor: default;
  pointer-events: none;
}
.posts-filter-btn.active i { color: var(--accent-color); }

.posts-main {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.posts-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 var(--space-md) var(--space-2xl);
}
.posts-masonry {
  display: flex;
  flex-direction: column;
  max-width: 640px;
  margin: 0 auto;
}

.post-card {
  border-bottom: 1px solid var(--border-color);
  /* No entrance of its own (.animate-card-enter starts at opacity 0): the
     feed is redrawn when posts load, and a per-card fade blinked the whole
     feed each time. The section's own transition brings it in. */
  opacity: 1;
  animation: none;
}
.post-card:last-child { border-bottom: 0; }
.post-card.post-card-highlight {
  border-radius: var(--radius-md);
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
  animation: post-card-highlight-pulse 1.2s ease-out 2;
}
.post-card-body { padding: 20px 0 14px; }

.post-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-sm);
}
.post-action-group { display: flex; align-items: center; gap: var(--space-md); }
.post-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  transition: color var(--transition-fast);
}
.post-action-btn i { font-size: 16px; }
.post-action-btn:hover { color: var(--text-primary); }
.post-action-btn.liked,
.post-action-btn[data-action="like"]:hover { color: var(--color-danger); }
.post-action-btn.liked i { animation: heartBounce 400ms ease; }

@media (max-width: 640px) {
  .posts-toolbar { padding: var(--space-sm) 0; }
  .posts-filter-btn { padding: 0 12px; font-size: var(--font-size-xs); }
  .posts-container { padding: 0 var(--space-xs) var(--space-xl); }
}

/* ==========================================================================
   Channel messages — one alignment for everyone. Your own groups were
   marked with a green rule and an indent, which pushed them off the column
   every other group sits on; your name is already green, that is enough.
   ========================================================================== */
/* Only a message that just arrived slides in (.is-new, set where it is
   appended). A re-render of the list, or the end of a nest switch, must not
   replay it: that blanked every message for a frame. */
.message-group {
  padding: 0;
}
.message-group.is-new { animation: messageIn 200ms ease both; }
.servers-body.server-switching .chat-messages .message-group {
  opacity: 0;
  animation: slideUp 250ms ease forwards;
}
[data-message-display="compact"] .message-group { padding: 2px 0; margin-bottom: 2px; }

/* ---- Voice: the join button is the house button ----------------------- */
.voice-join-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 20px;
  border-radius: var(--radius-pill);
  background: var(--accent-color);
  color: var(--accent-text);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  transition: background-color var(--transition-fast), transform var(--transition-fast);
}
.voice-join-btn:hover { background: var(--accent-hover); }
.voice-join-btn:active { transform: scale(0.97); }

@keyframes post-card-highlight-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-color) 55%, transparent); }
  60%  { box-shadow: 0 0 0 10px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@keyframes heartBounce {
  0% { transform: scale(1); }
  25% { transform: scale(1.3); }
  50% { transform: scale(0.9); }
  75% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* GIF picker search: the whole row is the field (icon inside it); the
   input itself is bare, or the base input style boxed it apart from its
   icon. */
.gif-picker-panel .gif-picker-search {
  margin: var(--space-sm);
  padding: 0 12px;
  height: 38px;
  gap: var(--space-sm);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  background: var(--bg-input);
  transition: border-color var(--transition-fast);
}
.gif-picker-panel .gif-picker-search:focus-within { border-color: var(--accent-color); }
.gif-picker-panel .gif-picker-search input,
.gif-picker-panel .gif-picker-search input:hover,
.gif-picker-panel .gif-picker-search input:focus,
.gif-picker-panel .gif-picker-search input:focus-visible { height: 100%; padding: 0; border: 0; border-radius: 0; background: transparent; outline: 0; box-shadow: none; }

/* Emoji / icon picker search: same as the GIF picker, one field with its
   icon inside. */
.ep-picker .ep-search-wrap {
  margin: 10px 10px 6px;
  padding: 0 12px;
  height: 36px;
  gap: var(--space-sm);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  background: var(--bg-input);
  transition: border-color var(--transition-fast);
}
.ep-picker .ep-search-wrap:focus-within { border-color: var(--accent-color); }
.ep-picker .ep-search,
.ep-picker .ep-search:hover,
.ep-picker .ep-search:focus,
.ep-picker .ep-search:focus-visible { height: 100%; padding: 0; border: 0; border-radius: 0; background: transparent; outline: 0; box-shadow: none; }

/* The IronAI trigger is the same small pill in a channel header as in a
   whisper header (a legacy header rule had blown it up to body size). */
.chat-header .iron-ai-trigger {
  height: 34px;
  padding: 0 12px;
  font-size: var(--font-size-xs);
  line-height: 1;
}

/* IronAI is off in the interface for now (App.IRON_AI_ENABLED). */
html.iron-ai-off :is(.iron-ai-trigger, [data-iron-ai-toggle], #iron-ai-chat-root) { display: none !important; }

/* ---- A short conversation sits at the bottom, by the composer ---------- */
/* Like every chat: with only a few messages they gather at the foot of the
   column instead of hanging from the top. The auto margin collapses to 0 as
   soon as the messages overflow, so scrolling is untouched. Empty states
   keep their place. */
:is(#server-messages, #dm-messages) > :first-child:not([class*="empty"]) { margin-top: auto; }

/* ---- Post composer: a large centred sheet ------------------------------- */
/* Writing a post gets room: the composer opens in the middle of the screen
   over a scrim, wide enough for a real paragraph, its editor tall. It floats,
   so it carries the shadow. Phones: nearly the whole screen. */
.post-composer-scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: color-mix(in srgb, var(--scrim) 100%, #000 15%);
}
.post-composer-scrim.active { display: block; animation: v2-scrim-in var(--surface-glide) var(--surface-ease-in) both; }
.post-fab-composer {
  position: fixed;
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  z-index: calc(var(--z-modal) + 1);
  width: min(720px, calc(100vw - 2 * var(--space-md)));
  max-width: none;
  max-height: calc(100dvh - 2 * var(--space-md));
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-lg);
  border-radius: var(--radius-xl);
  transform: translate(-50%, -50%);
  overflow: auto;
}
.post-fab-composer.active {
  display: flex;
  animation: post-composer-in var(--surface-glide) var(--surface-ease-in) both;
}
@keyframes post-composer-in {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 12px)) scale(0.98); }
}
.post-composer-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); }
.post-composer-title {
  margin: 0;
  font-family: var(--font-display);
  font-stretch: 125%;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
}
.post-fab-composer .post-composer-editor {
  min-height: min(320px, 40dvh);
  max-height: 60dvh;
  font-size: var(--font-size-md);
  line-height: var(--leading-normal);
}
.post-fab-composer .post-fab-composer-actions { margin-top: 0; }
@media (prefers-reduced-motion: reduce) {
  .post-fab-composer.active, .post-composer-scrim.active { animation: none; }
}

/* ---- Nest members: a column beside the conversation ------------------- */
/* The Members button opens a list on the right of the chat (the channel
   title stays in the header): Online and Offline groups, a row per person
   with their avatar, name and role. Phones: it covers the conversation
   under the header until the button closes it. */
.chat-area.has-members {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 248px;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
}
.chat-area.has-members > .chat-header { grid-column: 1 / -1; }
.chat-area.has-members > :not(.chat-header):not(.nest-members) { grid-column: 1; }
.chat-area.has-members > .chat-messages { grid-row: 2; }
.nest-members {
  grid-column: 2;
  grid-row: 2 / -1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-md) var(--space-sm);
  border-left: 1px solid var(--border-color);
  animation: nest-members-in 200ms var(--island-ease);
}
@keyframes nest-members-in { from { opacity: 0; transform: translateX(12px); } }
.nest-members-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: var(--space-md) 8px 6px;
  color: var(--text-muted);
  font-size: var(--font-size-2xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nest-members-title:first-child { margin-top: 0; }
.nest-members-title span { font-variant-numeric: tabular-nums; }
.nest-member {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 6px 8px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}
.nest-member:hover { background: var(--bg-hover); }
.nest-member:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
.nest-member-avatar {
  position: relative;
  flex: none;
  width: 32px;
  height: 32px;
  font-size: var(--font-size-xs);
}
.nest-member-avatar .status-dot { position: absolute; right: -2px; bottom: -2px; }
.nest-member-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--font-size-sm); }
.nest-member-role { flex: none; color: var(--text-muted); font-size: var(--font-size-2xs); }
.nest-members-loading, .nest-members-empty { padding: var(--space-lg) 8px; color: var(--text-muted); text-align: center; }
#toggle-members-btn.active { color: var(--accent-color); }

@media (max-width: 768px) {
  .chat-area.has-members { grid-template-columns: minmax(0, 1fr); }
  .nest-members {
    grid-column: 1;
    grid-row: 2 / -1;
    z-index: 4;
    background: var(--bg-primary);
    border-left: 0;
  }
}
@media (prefers-reduced-motion: reduce) { .nest-members { animation: none; } }

/* Phones: a friend's row keeps Message and Call; Send IRON and Remove live
   in their profile card (tap the row), so four unlabelled icons and a
   destructive one under the thumb do not crowd the row. */
@media (max-width: 768px) {
  .friend-card-actions .friend-gift-btn,
  .friend-card-actions .friend-action-btn[data-action="remove"] { display: none; }
}

/* GIF picker opens and closes like the emoji picker (same 180ms scale + fade). */
.gif-picker-panel {
  transform: scale(0.94) translateY(6px);
  transform-origin: bottom right;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.gif-picker-panel.active { transform: scale(1) translateY(0); }
@media (prefers-reduced-motion: reduce) { .gif-picker-panel { transition: none; } }

/* Friends use the whole width beside the chats column; no empty band on the right. */
@media (min-width: 1001px) {
  .friends-grid-inner,
  .pending-list { max-width: none; }
  .add-friend-island { max-width: none; }
}
