/* Chats feature (CHATS_PLAN.md) - chats.php (landing) + chats_room.php.
   Loads alongside css/home.css + css/groups.css (tabs/section/card look
   reused as-is from there) - this file only adds what's genuinely new:
   the city/subcategory grids, category expand/collapse, and the room
   header. chats_room.php also loads css/vibe-content.css for the
   .vibez-chat-* message log/bubble/composer classes, unchanged. */

/* Same bug/fix as .group-page (css/groups.css) and .profile-page
   (css/profile.css) - home.css's .container is a 2-column grid by
   default (built for home.php's tile layout), so a page with just ONE
   .section as .container's only child ends up occupying just the first
   grid track, visibly pinned to the left half of the page instead of
   centered. Both chats.php and chats_room.php hit this since neither is
   a real 2-column layout (unlike chat_rooms.php's .groups-layout, which
   genuinely has a main list + sidebar). */
.chats-page {
  display: block;
}

.chats-subtitle {
  font-size: 0.95em;
  margin-top: 0.25rem;
}

/* 5 per row (spec §1) - a fixed column count, not auto-fill, so the grid
   always reads as "5 cities, 4 rows" rather than reflowing to a variable
   column count at odd widths; the mobile breakpoint below is what handles
   narrow screens instead. */
.chats-city-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.chats-subcategory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 0.7rem 0 1.1rem;
}

.chats-room-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-brd);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.85em;
  transition: border-color 0.2s ease;
}
a.chats-room-link:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}
.chats-room-link.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chats-room-count {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--ink-dim);
  white-space: nowrap;
}

/* ---------- Interests: always-visible section headers ---------- */
.chats-category-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chats-category-heading {
  margin: 1.1rem 0 0;
  font-size: 0.95em;
  font-weight: 600;
  color: var(--ink);
}
.chats-category:first-child .chats-category-heading {
  margin-top: 0;
}

/* ---------- Load More (Local / 18+ Local state expansion) ---------- */
.chats-loadmore-btn {
  display: block;
  margin: 1rem auto 0;
  padding: 0.6rem 1.4rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-brd);
  color: var(--cyan);
  font-family: inherit;
  font-size: 0.85em;
  font-weight: 600;
  cursor: pointer;
}
.chats-loadmore-btn:hover {
  border-color: var(--cyan);
  background: rgba(255, 255, 255, 0.06);
}

.chats-state-groups {
  margin-top: 0.5rem;
}

/* ---------- Room page header ---------- */
.chats-room-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.4rem 0 1.1rem;
}

.chats-room-title {
  margin: 0;
}

.chats-room-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chats-room-live-count {
  font-family: var(--font-mono);
  font-size: 0.8em;
  color: var(--mint, #3dffb0);
  white-space: nowrap;
}

.chats-filter-note {
  margin-top: 0.6rem;
}

.chats-typing-indicator {
  margin: 0.4rem 0 0;
  font-size: 0.78em;
  font-style: italic;
  color: var(--ink-dim);
  min-height: 1.1em;
}

@media (max-width: 820px) {
  .chats-city-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .chats-subcategory-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Flying emoji field - lives INSIDE the actual chat window, not the page
   background. .vibez-chat-log-wrap is a plain relative-positioned shell
   around .vibez-chat-log (css/vibe-content.css); .chats-emoji-bg is
   absolutely positioned to fill that exact box, sitting BEHIND the log
   (z-index:0 vs the log's z-index:1) and clipped to the log's own rounded
   corners. The log's own background is already only rgba(255,255,255,0.03)
   (near-transparent), so the emojis show straight through behind the
   message bubbles instead of being covered up. js/chats-emoji-bg.js sizes
   itself off this wrapper's own bounding box, not the viewport - the
   emojis fly around within the chat window's bounds only, independent of
   the log's own scroll position (this layer never scrolls). */
.vibez-chat-log-wrap {
  position: relative;
}

.vibez-chat-log {
  position: relative;
  z-index: 1;
}

.chats-emoji-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  border-radius: 12px;
  pointer-events: none;
}

.chats-emoji-particle {
  position: absolute;
  top: 0;
  left: 0;
  line-height: 1;
  opacity: 0.5;
  user-select: none;
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  .chats-emoji-bg {
    display: none;
  }
}

/* Active Now menu's "Add" failure text (e.g. recipient doesn't accept
   friend requests) - rendered inline inside the still-open dropdown by
   js/chats.js, not a site-wide alert box, and only ever visible to the
   person who clicked Add. */
.vibez-chats-inline-error {
  display: block;
  padding: 0.3rem 0.9rem 0.5rem;
  color: var(--danger, #ff4d4d);
  font-size: 0.78em;
  font-family: var(--font-mono);
}

/* ---------- Direct Messages (CHATS_PLAN.md addendum) ---------- */

/* Messages tab (chats.php) and its Inbox/Requests list are gone - DMs live
   in the global widget everywhere now (2026-08-24). The .chats-dm-badge/
   -conversation-list/-conversation-row/-conversation-name rules that only
   ever styled that tab's markup (renderDmConversationRowHtml(), includes/
   dms.php) were removed with it. .chats-dm-pending-tag and
   .chats-dm-request-actions survive below - still used by the widget's
   renderDmMiniListHtml() and dm_thread.php's own Accept/Decline banner
   respectively. */

.chats-dm-pending-tag {
  font-size: 0.72em;
  font-family: var(--font-mono);
  color: var(--ink-dim);
  white-space: nowrap;
}

/* dm_thread.php's own pending-request Accept/Decline banner (the request
   itself may have arrived via renderDmConversationRowHtml() previously,
   but this markup is dm_thread.php's own, hardcoded there directly - not
   generated by that function). */
.chats-dm-request-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}
.chats-dm-request-actions .button {
  padding: 0.35rem 0.8rem;
  font-size: 0.78em;
}

/* dm_thread.php's own "X wants to send you a message" banner - same card
   language as .vibez-chat-active-panel, just full-width above the (hidden,
   until accepted) composer instead of a sidebar. */
.chats-dm-request-banner {
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-brd);
}
.chats-dm-request-banner p {
  margin: 0 0 0.6rem;
  font-size: 0.9em;
}

.chats-dm-waiting-note {
  margin-bottom: 1rem;
}

.chats-dm-thread-username {
  color: var(--ink);
  text-decoration: none;
}
.chats-dm-thread-username:hover {
  color: var(--cyan);
}

.chats-room-title img.vibez-chat-active-avatar {
  margin-right: 0.4rem;
  vertical-align: middle;
}

/* No Active Now sidebar on a 1:1 thread - .vibez-chat-layout's flex:1 main
   column would otherwise stretch edge-to-edge the way a room's sidebar
   normally prevents, so this caps it to a comfortable reading width
   instead. */
.vibez-chat-layout-dm .vibez-chat-main {
  max-width: 640px;
}

/* ---------- Global DM widget internals, shared across every page that
   carries the widget (renderDmMiniListHtml()/renderDmMiniMessageHtml(),
   includes/dms.php) ----------
   chats_room.php used to split .vibez-chat-active-panel (css/vibe-
   content.css, a flex column) 3:1 between Active Now and its own separate
   .vibez-chat-dm-panel mini messages section - that section is gone
   (2026-08-24, replaced by the real global widget in this page's header
   banner, same as every other Phase 4 page), so Active Now is the sole
   flex child again - flex-grow simplified from 3 (its old ratio partner
   for the removed DM section) down to 1, no functional change either way
   with nothing left to share space with. */
.vibez-chat-active-section {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 0.85rem;
}

.vibez-chat-dm-mini-empty {
  font-size: 0.75em;
}

.vibez-chat-dm-mini-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* Shared row look for both the plain <div> (pending request, has its own
   Accept/Decline buttons instead of being clickable) and the <button>
   (everything else - js/dm-widget.js expands this into the mini thread
   widget below, wherever the global widget itself is rendered). The
   `all: unset` reset only applies to the button variant - a plain <div>
   has no browser button chrome to strip in the first place. */
.vibez-chat-dm-mini-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  padding: 0.3rem 0.45rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-brd);
}
button.vibez-chat-dm-mini-row {
  all: unset;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  padding: 0.3rem 0.45rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-brd);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease;
}
button.vibez-chat-dm-mini-row:hover {
  border-color: var(--cyan);
}

.vibez-chat-dm-mini-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.vibez-chat-dm-mini-name {
  font-size: 0.78em;
  font-weight: 600;
  color: var(--ink);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vibez-chat-dm-mini-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}
.vibez-chat-dm-mini-accept,
.vibez-chat-dm-mini-decline {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid var(--glass-brd);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 0.75em;
  line-height: 1;
  cursor: pointer;
}
.vibez-chat-dm-mini-accept:hover {
  border-color: var(--mint, #3dffb0);
  color: var(--mint, #3dffb0);
}
.vibez-chat-dm-mini-decline:hover {
  border-color: var(--danger, #ff4d4d);
  color: var(--danger, #ff4d4d);
}

/* Inner "open this conversation" button for a normal inbox row - the row
   itself is a <div> now (not one big <button>) so the hide x below can sit
   beside it as its own real, non-nested button. Same visual result as the
   old button.vibez-chat-dm-mini-row rule (still used as-is by search
   results' toggle/friend rows, which stay single full-row buttons - see
   renderDmSearchResultsHtml(), includes/dms.php) - just scoped to the
   inner element instead of the row. */
button.vibez-chat-dm-mini-toggle {
  all: unset;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1 1 auto;
  min-width: 0;
  cursor: pointer;
}

/* Small x to quietly remove a conversation from this viewer's own list
   (includes/dms.php's dmHideConversation() - never a delete, see its own
   comment). Dimmed until hovered so it doesn't visually compete with the
   accept/decline buttons on a pending row - this one is a much lower-
   stakes, easily-reversible action (the thread just comes back on the next
   message), not a destructive confirmation-worthy one. */
.vibez-chat-dm-mini-hide {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid var(--glass-brd);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 0.85em;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.55;
  transition: opacity 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.vibez-chat-dm-mini-row:hover .vibez-chat-dm-mini-hide {
  opacity: 1;
}
.vibez-chat-dm-mini-hide:hover {
  opacity: 1;
  border-color: var(--danger, #ff4d4d);
  color: var(--danger, #ff4d4d);
}

/* ---- Expanded mini thread (replaces the list in place while open) ---- */
.vibez-chat-dm-mini-thread {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.vibez-chat-dm-mini-thread-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}

.vibez-chat-dm-mini-thread-name {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78em;
  font-weight: 600;
  color: var(--ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vibez-chat-dm-mini-close {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid var(--glass-brd);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-dim);
  font-size: 0.85em;
  line-height: 1;
  cursor: pointer;
}
.vibez-chat-dm-mini-close:hover {
  border-color: var(--danger, #ff4d4d);
  color: var(--danger, #ff4d4d);
}

/* overscroll-behavior-y:contain + touch momentum - same pair vibe-content.
   css's .vibez-chat-log already carries (that file's own comment explains
   the rubber-banding/scroll-chaining problem in full: without this, hitting
   the top/bottom of a scrollable box that floats over the page chains
   straight into scrolling the page behind it instead of just stopping).
   That fix never made it to either of the global widget's own scroll
   regions - this bubble log, and css/dm-widget.css's #vibezDmWidgetList
   (the conversation list) which gets the same fix in this same pass. */
.vibez-chat-dm-mini-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.4rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-brd);
}

.vibez-chat-dm-mini-message {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
}
.vibez-chat-dm-mini-message-own {
  align-items: flex-end;
}

.vibez-chat-dm-mini-bubble {
  max-width: 88%;
  padding: 0.3rem 0.5rem;
  border-radius: 8px;
  font-size: 0.75em;
  line-height: 1.35;
  word-break: break-word;
}

/* Full date + time, tiny, directly under its own bubble - see
   renderDmMiniMessageHtml()'s comment (includes/dms.php) for why the date
   is included here (unlike dm_thread.php's short time-only stamp). */
.vibez-chat-dm-mini-time {
  font-size: 0.62em;
  color: var(--ink-dim);
  padding: 0 0.2rem;
}

.vibez-chat-dm-mini-form {
  display: flex;
  align-items: flex-end;
  gap: 0.3rem;
  margin-top: 0.4rem;
}
.vibez-chat-dm-mini-form textarea {
  flex: 1;
  resize: none;
  min-height: 1.9em;
  max-height: 70px;
  padding: 0.3rem 0.4rem;
  border-radius: 8px;
  border: 1px solid var(--glass-brd);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.75em;
  line-height: 1.3;
}
.vibez-chat-dm-mini-form textarea:focus {
  outline: none;
  border-color: var(--cyan, #2be3ff);
}
.vibez-chat-dm-mini-form button {
  padding: 0.3rem 0.55rem;
  font-size: 0.72em;
  flex-shrink: 0;
}

/* Media addendum (js/dm-widget.js's openConversation() thread template) -
   attach button + preview strip for the mini widget's own compact composer.
   Deliberately smaller than the full-thread versions below (.vibez-chat-dm-
   attach-*) - this whole panel is a 320px flyout, not a full page. */
.vibez-chat-dm-mini-attach-btn {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid var(--glass-brd);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-dim);
  font-size: 0.8em;
  line-height: 1;
  cursor: pointer;
}
.vibez-chat-dm-mini-attach-btn:hover {
  border-color: var(--cyan, #2be3ff);
  color: var(--cyan, #2be3ff);
}

.vibez-chat-dm-mini-attach-preview {
  position: relative;
  display: inline-block;
  margin-top: 0.3rem;
}
.vibez-chat-dm-mini-attach-preview[hidden] {
  display: none;
}
.vibez-chat-dm-mini-attach-thumb {
  max-width: 80px;
  max-height: 64px;
  border-radius: 7px;
  object-fit: cover;
  display: block;
  border: 1px solid var(--glass-brd);
}
.vibez-chat-dm-mini-attach-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 1px solid var(--glass-brd);
  background: rgba(var(--void-rgb), 0.9);
  color: var(--ink);
  font-size: 0.62em;
  line-height: 1;
  cursor: pointer;
}
.vibez-chat-dm-mini-attach-remove:hover {
  border-color: var(--danger, #ff4d4d);
  color: var(--danger, #ff4d4d);
}

/* Media rendered inside a SENT mini bubble (renderDmMediaHtml() via
   renderDmMiniMessageHtml(), includes/dms.php) - a much smaller thumbnail
   than the full-thread .vibez-post-image/-video sizing, this panel is only
   320px wide. */
.vibez-chat-dm-mini-media {
  display: block;
  max-width: 150px;
  max-height: 150px;
  border-radius: 8px;
  object-fit: cover;
  margin-top: 0.3rem;
}
.vibez-chat-dm-mini-media-video {
  max-width: 190px;
}

/* ---- Media addendum (full-page dm_thread.php composer, js/dms.js's
   dmThreadForm block) - image/video attachment button + preview strip.
   Sibling elements next to #dmThreadForm's own textarea/send button -
   .vibez-chat-form's existing flex row (css/vibe-content.css) lays out the
   new button for free, this only needs to style the new pieces
   themselves. Deliberately scoped to these new classes rather than
   touching .vibez-chat-form itself - that class is shared by chat rooms/
   group chat (chatroom.php, chats_room.php, group.php), which stay
   text-only by design (CHAT_PLAN.md §2) and never render these elements
   at all. ---- */
.vibez-chat-dm-attach-btn {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--glass-brd);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-dim);
  font-size: 1.1em;
  line-height: 1;
  cursor: pointer;
}
.vibez-chat-dm-attach-btn:hover {
  border-color: var(--cyan, #2be3ff);
  color: var(--cyan, #2be3ff);
}

.vibez-chat-dm-attach-preview {
  position: relative;
  display: inline-block;
  margin-bottom: 0.5rem;
}
.vibez-chat-dm-attach-preview[hidden] {
  display: none;
}
.vibez-chat-dm-attach-thumb {
  max-width: 140px;
  max-height: 110px;
  border-radius: 10px;
  object-fit: cover;
  display: block;
  border: 1px solid var(--glass-brd);
}
.vibez-chat-dm-attach-remove {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--glass-brd);
  background: rgba(var(--void-rgb), 0.9);
  color: var(--ink);
  font-size: 0.7em;
  line-height: 1;
  cursor: pointer;
}
.vibez-chat-dm-attach-remove:hover {
  border-color: var(--danger, #ff4d4d);
  color: var(--danger, #ff4d4d);
}

/* Media rendered inside a SENT full-thread bubble - reuses vibe-content.
   css's own .vibez-post-image/-video sizing (max-height:420px, object-fit
   contain/cover) via the second class renderDmMediaHtml() always pairs
   this with; this one just adds the small top margin a Vibe's own media
   grid gets for free from .vibez-post-media-grid's own margin-top, which a
   chat bubble's single inline attachment has no equivalent wrapper for. */
.vibez-chat-dm-media {
  margin-top: 0.4rem;
  display: block;
}

/* Click-to-enlarge affordance - only on the <img> variant of either media
   class (element+class selector), never the shared base class alone, which
   a <video> attachment also carries - a video keeps its default cursor,
   its own native `controls` already handle fullscreen. js/dms.js's and
   js/dm-widget.js's own lightbox click handlers are what actually open it. */
img.vibez-chat-dm-media,
img.vibez-chat-dm-mini-media {
  cursor: zoom-in;
}

/* ---- DM media lightbox (media addendum) - full-size image viewer, opened
   by js/dms.js (full thread) / js/dm-widget.js (mini widget) on click.
   Deliberately its own class names, NOT profile.css's existing .lightbox/
   .lightbox-close/.lightbox-trigger (collection.php's own static photo
   grid, own separate binding) - this file is the one stylesheet guaranteed
   loaded on every page DM media can render on; profile.css isn't (home.php,
   friends_feed.php, groups_feed.php, chats_room.php don't load it). z-index
   300 - above every modal overlay in vibe-content.css (up to 270) and the
   widget's own panel (150, css/dm-widget.css) - a full-size image view
   should sit on top of literally everything else on the page, including an
   open report modal or an open widget thread. ---- */
.vibez-dm-media-lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 3, 10, 0.92);
  cursor: zoom-out;
}
.vibez-dm-media-lightbox[hidden] {
  display: none;
}
.vibez-dm-media-lightbox-img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 8px;
  box-shadow: 0 20px 60px -10px rgba(0, 0, 0, 0.8);
}
.vibez-dm-media-lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--glass-brd);
  background: rgba(var(--void-rgb), 0.85);
  color: var(--ink);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.vibez-dm-media-lightbox-close:hover {
  border-color: var(--danger, #ff4d4d);
  color: var(--danger, #ff4d4d);
}

/* ---- Full-viewport app shell (chats_room.php / dm_thread.php ONLY) ----
   "the whole chat app container based off 100vh so the page don't need to
   scroll at all." Deliberately scoped to body.chats-shell (set on <body> in
   those two pages only, not .chats-page alone) rather than any change to
   the shared .vibez-chat-log/.vibez-chat-layout/etc. defaults in
   vibe-content.css - group.php's Live Chat tab uses those same classes but
   lives inside a normal scrolling multi-tab page (About/Members/Wall/Chat),
   where pinning the WHOLE page to the viewport doesn't apply the same way,
   so it deliberately keeps its existing fixed-700px behavior untouched.
   Chain: body (100dvh, no scroll) -> header (natural height) ->
   .container.chats-page (flex:1, fills the rest) -> .section (flex:1) ->
   .vibez-chat-layout (flex:1) -> .vibez-chat-main (flex column) ->
   .vibez-chat-log-wrap (flex:1) -> .vibez-chat-log (flex:1, THE only thing
   that actually scrolls). Every flex:1 link in that chain also needs
   min-height:0 - a flex item's default min-height is auto (= its content
   size), which without this override would make each link grow to fit its
   content instead of shrinking to the space actually available, defeating
   the whole point (same min-height:0 gotcha noted throughout this file's
   .vibez-chat-active-section rule already). */
body.chats-shell {
  height: 100vh;
  height: 100dvh; /* accounts for mobile browser chrome show/hide; falls back to 100vh where dvh isn't supported */
  min-height: 0; /* overrides home.css's body{min-height:100vh}, which would otherwise let the page grow taller than the viewport and bring page scroll back */
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.chats-shell header {
  flex-shrink: 0;
}

body.chats-shell .container.chats-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  padding-bottom: 1rem;
  overflow: hidden;
  width: 100%;
}

body.chats-shell .section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Nav row / room-or-thread header / notice banners above the log keep
   their natural height - only .vibez-chat-layout and below is asked to
   absorb whatever vertical space is left. */
body.chats-shell .chats-room-nav,
body.chats-shell .chats-room-header,
body.chats-shell .message,
body.chats-shell .chats-dm-request-banner,
body.chats-shell .chats-dm-waiting-note {
  flex-shrink: 0;
}

body.chats-shell .vibez-chat-layout {
  flex: 1;
  min-height: 0;
  /* was align-items:flex-start (vibe-content.css) - stretch so the Active
     Now/DM sidebar matches the log's real, dynamic height instead of both
     independently hardcoding the same 700px. */
  align-items: stretch;
}

body.chats-shell .vibez-chat-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.chats-shell .vibez-chat-log-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.chats-shell .vibez-chat-log {
  flex: 1;
  min-height: 0;
  height: auto; /* overrides vibe-content.css's fixed 700px */
}

body.chats-shell .vibez-chat-form,
body.chats-shell .chats-filter-note,
body.chats-shell .chats-typing-indicator {
  flex-shrink: 0;
}

body.chats-shell .vibez-chat-active-panel {
  height: auto; /* overrides vibe-content.css's fixed 700px - align-items:stretch above sizes it to match instead */
}

/* Same 820px collapse point .vibez-chat-layout already uses site-wide
   (vibe-content.css) - sidebar drops below the log and gets a fixed height
   again here since there's no second column left to stretch it against. */
@media (max-width: 820px) {
  body.chats-shell .vibez-chat-layout {
    flex-direction: column;
  }
  body.chats-shell .vibez-chat-active-panel {
    width: 100%;
    height: 220px;
    flex-shrink: 0;
  }
}
