/* batch5-chats — Chat Notes, voice messages, pins, Chat Details, Search in conversation (22 Oct 2026).
   The web's Chats wear the app's light Chats palette in both site themes (css/chats.css #messagesPage), so these
   pop-ups do too, with their own colours (never inherited from the dark site chrome). Every pop-up is centred. */
.chat-b5-backdrop { --b5-ink:#17173a; --b5-soft:#4a4462; --b5-muted:#6b6584; --b5-card:#fbfafe; --b5-surface:#f1eff8; --b5-row:#ffffff; --b5-line:#e4e1f0; --b5-purple:var(--accent-primary,#7c5ce6); --b5-purple-ink:#5b3fc4; --b5-danger:#c8243e; }
.modal-backdrop.chat-b5-backdrop .modal-card.chat-b5-card { background:var(--b5-card); color:var(--b5-ink); border:1px solid var(--b5-line); box-shadow:0 16px 60px #21153b33; border-radius:22px; padding:18px 18px 16px; max-width:460px; width:100%; max-height:min(88vh,760px); overflow:auto; }
.modal-backdrop.chat-b5-backdrop .modal-card.chat-b5-card h2 { color:var(--b5-ink); font-size:19px; font-weight:800; margin:0; }
.chat-b5-card :is(p,small,span,strong):not(.chats-avatar) { color:inherit; }
.chat-b5-head { display:flex; align-items:center; gap:10px; margin-bottom:10px; }
.chat-b5-head h2 { flex:1; }
.chat-b5-sr { position:absolute !important; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }
.chat-b5-head > span:first-child:empty { flex:1; }
.chat-b5-count { color:var(--b5-muted); font-size:12px; }
.chat-b5-x { margin-left:auto; width:32px; height:32px; border-radius:50%; border:0; background:transparent; color:var(--b5-muted); font-size:16px; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; }
.chat-b5-x:hover { background:var(--b5-surface); color:var(--b5-ink); }
.chat-b5-sub { color:var(--b5-muted); font-size:13px; line-height:1.5; margin:6px 0 14px; }
.chat-b5-hint { color:var(--b5-muted); font-size:13px; text-align:center; padding:18px 6px; margin:0; }
.chat-b5-empty { text-align:center; padding:26px 8px; color:var(--b5-muted); font-size:13px; }
.chat-b5-empty strong { display:block; color:var(--b5-ink); font-size:15px; margin-bottom:4px; }
.chat-b5-empty p { margin:0; }
.chat-b5-more[hidden] { display:none; }
.chat-b5-more { display:block; margin:12px auto 0; border:1px solid var(--b5-line); background:var(--b5-row); color:var(--b5-purple-ink); border-radius:12px; padding:8px 16px; font-weight:700; cursor:pointer; }
.chat-b5-card .modal-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:14px; }
.modal-backdrop.chat-b5-backdrop .chat-b5-card .btn-ghost { background:transparent; color:var(--b5-soft); border:1px solid var(--b5-line); border-radius:12px; padding:9px 16px; cursor:pointer; }
.modal-backdrop.chat-b5-backdrop .chat-b5-card .btn-primary { background:var(--b5-purple); color:#fff; border:0; border-radius:12px; padding:9px 16px; font-weight:700; cursor:pointer; }
.chat-b5-card button:focus-visible, .chat-b5-card a:focus-visible, .chat-b5-card input:focus-visible, .chat-b5-card textarea:focus-visible { outline:2px solid var(--b5-purple); outline-offset:2px; }

/* ── Chat Details ── */
.chat-details-modal { padding-top:10px !important; }
.chat-details-modal .chat-b5-head { margin-bottom:0; }
.chat-details-hero { display:flex; flex-direction:column; align-items:center; gap:6px; padding:0 0 16px; text-align:center; }
.chat-details-hero h2 { font-size:21px !important; }
.chat-details-hero p { margin:0; color:var(--b5-muted); font-size:12.5px; }
.chat-details-group-stack { position:relative; display:inline-block; width:88px; height:88px; }
.chat-details-group-stack .chats-avatar { position:absolute; border:3px solid var(--b5-card); box-sizing:content-box; }
.chat-details-group-stack .chats-avatar:first-child { left:0; top:0; }
.chat-details-group-stack .chats-avatar:nth-child(2) { right:-6px; bottom:-6px; }
.chat-details-section { margin:0 0 14px; }
.chat-details-section h3 { margin:0 0 6px 6px; font-size:11.5px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; color:var(--b5-muted); }
.chat-details-rows { background:var(--b5-row); border:1px solid var(--b5-line); border-radius:16px; overflow:hidden; }
.chat-details-row { width:100%; display:flex; align-items:center; gap:10px; padding:13px 14px; border:0; border-bottom:1px solid var(--b5-line); background:transparent; color:var(--b5-ink); font:inherit; font-size:14.5px; text-align:left; cursor:pointer; }
.chat-details-row:last-child { border-bottom:0; }
.chat-details-row:hover { background:var(--b5-surface); }
.chat-details-label { flex:1; min-width:0; font-weight:600; }
.chat-details-right { color:var(--b5-muted); font-size:13px; white-space:nowrap; }
.chat-details-row > svg { color:#9a95b0; flex:none; }
.chat-details-row.is-danger, .chat-details-row.is-danger .chat-details-label { color:var(--b5-danger); }
.chat-details-toggle { width:40px; height:24px; border-radius:12px; background:#cfcbe0; padding:2px; display:inline-flex; flex:none; transition:background .15s; }
.chat-details-toggle i { width:20px; height:20px; border-radius:50%; background:#fff; box-shadow:0 1px 3px #17173a40; transition:transform .15s; }
.chat-details-toggle.is-on { background:var(--b5-purple); }
.chat-details-toggle.is-on i { transform:translateX(16px); }
.chat-details-note { margin:-8px 6px 14px; color:var(--b5-muted); font-size:11.5px; }
.chat-details-owner-note { margin:0; padding:13px 14px; color:var(--b5-muted); font-size:13.5px; border-bottom:1px solid var(--b5-line); }

/* Choice cards (Mute, Notify me) and the theme picker. */
.chat-choice-list { display:grid; gap:8px; }
.chat-choice { display:flex; flex-direction:column; align-items:flex-start; gap:3px; width:100%; text-align:left; padding:12px 14px; border-radius:14px; border:1px solid var(--b5-line); background:var(--b5-row); color:var(--b5-ink); font:inherit; cursor:pointer; }
.chat-choice:hover { border-color:var(--b5-purple); }
.chat-choice.is-current { border-color:var(--b5-purple); background:#f1ecff; }
.chat-choice span { display:flex; align-items:center; gap:8px; }
.chat-choice strong { font-size:14.5px; color:var(--b5-ink); }
.chat-choice em { font-style:normal; font-size:11px; font-weight:800; color:var(--b5-purple-ink); background:#ece6ff; padding:2px 7px; border-radius:999px; }
.chat-choice small { color:var(--b5-muted); font-size:12.5px; line-height:1.45; }
.chat-theme-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(88px,1fr)); gap:10px; }
.chat-theme-tile { display:flex; flex-direction:column; align-items:center; gap:6px; padding:10px 6px; border-radius:14px; border:2px solid transparent; background:var(--b5-row); color:var(--b5-ink); font:inherit; font-size:12.5px; font-weight:600; cursor:pointer; }
.chat-theme-tile i { width:44px; height:44px; border-radius:50%; background:var(--tile); box-shadow:inset 0 0 0 2px #ffffff80; }
.chat-theme-tile.is-current { border-color:var(--b5-purple); }

/* ── Search, Media, Links, Pins ── */
.chat-search-pill { display:flex; align-items:center; gap:8px; background:var(--b5-surface); border-radius:18px; padding:0 14px; color:var(--b5-muted); }
.chat-search-pill input { flex:1; height:40px; border:0; background:transparent; color:var(--b5-ink); font:inherit; font-size:14px; outline:none; }
.chat-search-pill input::placeholder { color:var(--b5-muted); }
.chat-search-results { margin-top:10px; display:grid; gap:4px; max-height:56vh; overflow:auto; }
.chat-search-row { display:grid; gap:3px; text-align:left; border:0; border-radius:12px; padding:10px 12px; background:transparent; color:var(--b5-ink); font:inherit; cursor:pointer; }
.chat-search-row:hover { background:var(--b5-surface); }
.chat-search-row small { color:var(--b5-muted); font-size:12px; }
.chat-search-row small strong { color:var(--b5-soft); }
.chat-search-row span { font-size:14px; line-height:1.4; overflow-wrap:anywhere; }
.chat-search-row mark { background:#e7defe; color:var(--b5-purple-ink); border-radius:3px; padding:0 1px; font-weight:700; }
.chat-media-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:4px; }
.chat-media-grid > .chat-b5-empty, .chat-media-grid > .chat-b5-hint { grid-column:1/-1; }
.chat-media-cell { position:relative; aspect-ratio:1; border:0; padding:0; border-radius:8px; overflow:hidden; background:var(--b5-surface); cursor:zoom-in; }
.chat-media-cell img { width:100%; height:100%; object-fit:cover; display:block; }
.chat-media-cell span { position:absolute; left:6px; bottom:6px; background:#000a; color:#fff; font-size:10px; font-weight:800; padding:1px 5px; border-radius:4px; }
.chat-links-list { display:grid; gap:6px; }
.chat-link-row { display:grid; gap:2px; padding:10px 12px; border-radius:12px; border:1px solid var(--b5-line); background:var(--b5-row); color:var(--b5-ink); text-decoration:none; }
.chat-link-row:hover { border-color:var(--b5-purple); }
.chat-link-row strong { font-size:14px; }
.chat-link-row span { color:var(--b5-purple-ink); font-size:12.5px; overflow-wrap:anywhere; }
.chat-pinned-list { display:grid; gap:8px; }
.chat-pinned-row { padding:12px 14px; border-radius:14px; border:1px solid var(--b5-line); background:var(--b5-row); }
.chat-pinned-text { margin:0; font-size:14px; line-height:1.45; color:var(--b5-ink); display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; overflow-wrap:anywhere; }
.chat-pinned-by { margin:4px 0 0; font-size:11.5px; color:var(--b5-muted); }
.chat-pinned-actions { display:flex; gap:4px; margin-top:6px; }
.chat-pinned-actions button { border:0; background:transparent; color:var(--b5-purple-ink); font:inherit; font-size:12.5px; font-weight:700; padding:5px 8px; border-radius:8px; cursor:pointer; }
.chat-pinned-actions button:hover { background:var(--b5-surface); }
.chat-pinned-actions .is-danger { color:var(--b5-danger); }

/* The pinned bar on top of the thread (follows a picture theme's bar like the header does). */
#messagesPage .chat-pinned-bar { display:flex; align-items:center; gap:8px; padding:8px 14px; background:var(--shared-bar,#f1eff8); color:var(--shared-bar-text,#17173a); border-bottom:1px solid var(--chat-border,#e4e1f0); flex:none; }
#messagesPage .chat-pinned-bar[hidden] { display:none !important; }
#messagesPage .chat-pinned-bar > svg { color:var(--shared-control,var(--accent-primary)); flex:none; }
#messagesPage .chat-pinned-jump { flex:1; min-width:0; border:0; background:transparent; padding:0; text-align:left; font:inherit; font-size:12.5px; color:inherit; cursor:pointer; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
#messagesPage .chat-pinned-jump strong { font-weight:700; }
#messagesPage .chat-pinned-jump span { opacity:.82; }
#messagesPage .chat-pinned-count { border:0; background:transparent; font:inherit; font-size:11.5px; font-weight:800; color:var(--shared-control,var(--accent-primary)); padding:2px 6px; border-radius:8px; cursor:pointer; flex:none; }
#messagesPage .chat-pinned-count:hover { background:#7c5ce61a; }

/* ── Voice messages ── */
.chat-voice { display:inline-flex; align-items:center; gap:9px; min-width:190px; max-width:260px; padding:2px 0; }
.chat-voice.is-compact { min-width:150px; }
.chat-voice-play { flex:none; width:32px; height:32px; border-radius:50%; border:0; display:inline-flex; align-items:center; justify-content:center; cursor:pointer; background:var(--accent-primary,#7c5ce6); color:#fff; }
.chat-voice-track { flex:1; height:4px; border-radius:2px; background:#7c5ce62e; overflow:hidden; }
.chat-voice-fill { display:block; height:100%; width:0; background:currentColor; border-radius:2px; transition:width .2s linear; }
.chat-voice-time { flex:none; font-size:12px; font-variant-numeric:tabular-nums; opacity:.9; }
.chat-voice.is-loading .chat-voice-play { opacity:.6; }
.chat-voice.is-unavailable .chat-voice-time { font-size:11px; }
:is(.dm-bubble.mine, .dm-mini-row.is-mine .dm-mini-bubble) .chat-voice-play { background:#fff; color:var(--accent-primary,#7c5ce6); }
:is(.dm-bubble.mine, .dm-mini-row.is-mine .dm-mini-bubble) .chat-voice-track { background:#ffffff59; }
#messagesPage .dm-bubble.is-voice { padding:8px 12px; }

/* A message that answered a note. */
.chat-note-reply .chat-note-reply-quote img { width:28px; height:28px; border-radius:6px; object-fit:cover; flex:none; }
.chat-note-reply .chat-note-reply-quote { display:flex; align-items:center; gap:6px; cursor:default; }

/* ── Notes strip ── */
#messagesPage .chats-contacts.has-notes { padding-top:6px; }
#messagesPage .chats-contacts.has-notes .chats-contact { position:relative; width:72px; padding-top:50px; }
#messagesPage .chats-contacts.has-notes .chats-contact > span:last-child { max-width:70px; }
.chat-note-bubble { position:absolute; top:0; left:50%; transform:translateX(-50%); width:max-content; max-width:76px; min-width:34px; max-height:44px; overflow:hidden; padding:5px 8px; border-radius:12px; background:#ffffff; color:#17173a; border:1px solid #e4e1f0; box-shadow:0 2px 6px #17173a14; font-size:11px; line-height:1.3; text-align:center; display:flex; flex-direction:column; align-items:center; gap:2px; pointer-events:none; }
.chat-note-bubble::after { content:''; position:absolute; bottom:-5px; left:calc(50% - 8px); width:6px; height:6px; border-radius:50%; background:inherit; border:1px solid #e4e1f0; }
.chat-note-bubble:has(.chat-note-book) > span { -webkit-line-clamp:1; }
.chat-note-bubble > span { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; overflow-wrap:anywhere; max-width:100%; }
.chat-note-bubble.is-placeholder { color:#6b6584; }
.chat-note-bubble.is-emoji > span { font-size:18px; line-height:1.15; }
.chat-note-bubble.is-music { background:#7c5ce6; color:#fff; border-color:#7c5ce6; }
.chat-note-bubble.is-music .chat-note-music { font-size:10.5px; font-weight:800; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:100%; }
.chat-note-bubble.is-gif { padding:3px; }
.chat-note-bubble.is-gif img { width:52px; height:30px; object-fit:cover; border-radius:9px; display:block; }
.chat-note-book { font-size:9.5px; color:#55547a; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:100%; }
.chat-note-bubble.is-music .chat-note-book { color:#f1ecff; }

/* Friend's note card. */
.chat-note-view-head { display:flex; flex-direction:column; align-items:center; gap:4px; text-align:center; }
.chat-note-view-head strong { font-size:16px; }
.chat-note-view-head small { color:var(--b5-muted); font-size:12px; }
.chat-note-view-body { margin:14px 0 10px; display:flex; flex-direction:column; align-items:center; gap:10px; text-align:center; }
.chat-note-view-body p { margin:0; font-size:18px; font-weight:600; line-height:1.4; overflow-wrap:anywhere; }
.chat-note-view-body.is-emoji p { font-size:42px; }
.chat-note-view-gif { max-width:220px; max-height:180px; border-radius:14px; }
.chat-note-view-music { display:flex; align-items:center; gap:10px; max-width:100%; padding:8px 14px 8px 8px; border-radius:14px; border:0; background:#7c5ce6; color:#fff; text-align:left; font:inherit; cursor:pointer; }
.chat-note-view-music > span:first-child { width:32px; height:32px; border-radius:50%; background:#fff3; display:inline-flex; align-items:center; justify-content:center; font-size:12px; flex:none; }
.chat-note-view-music strong, .chat-note-view-music small { display:block; color:#fff; }
.chat-note-view-music small { opacity:.85; font-size:12px; }
.chat-note-view-book { display:flex; align-items:center; gap:10px; padding:8px 14px 8px 8px; border-radius:14px; border:1px solid var(--b5-line); background:var(--b5-row); color:var(--b5-ink); font:inherit; text-align:left; cursor:pointer; max-width:100%; }
.chat-note-view-book img { width:34px; height:48px; object-fit:cover; border-radius:5px; flex:none; }
.chat-note-view-book strong { display:block; font-size:14px; }
.chat-note-view-book small { display:block; color:var(--b5-purple-ink); font-weight:700; font-size:12px; }
.chat-note-react { display:flex; justify-content:center; gap:8px; margin:6px 0 10px; }
.chat-note-react button { width:42px; height:42px; border-radius:50%; border:1px solid var(--b5-line); background:var(--b5-row); font-size:20px; cursor:pointer; }
.chat-note-react button:hover { border-color:var(--b5-purple); }
.chat-note-reply-form { display:flex; gap:8px; }
.chat-note-reply-form input { flex:1; min-width:0; height:42px; border-radius:21px; border:1.5px solid var(--b5-line); background:#fff; color:var(--b5-ink); padding:0 14px; font:inherit; font-size:14.5px; }
.chat-note-reply-form .btn-primary { border-radius:21px; }
.chat-note-status { min-height:18px; margin:8px 0 0; text-align:center; font-size:13.5px; font-weight:700; color:var(--b5-purple-ink); }
.chat-note-status.is-error { color:var(--b5-danger); }
.chat-note-view-foot { display:flex; justify-content:center; margin-top:6px; }
.chat-note-avatar { --avatar-color:#7c5ce6; }

/* Your note (composer). */
.chat-note-compose-head { display:flex; align-items:center; gap:8px; margin-bottom:12px; }
.chat-note-compose-head .chat-b5-x { margin-left:0; }
.chat-note-compose-head h2 { flex:1; text-align:center; font-size:17px !important; }
.chat-note-share { border:0; background:transparent; color:var(--b5-purple-ink); font:inherit; font-size:15px; font-weight:800; padding:6px 8px; border-radius:10px; cursor:pointer; }
.chat-note-share:disabled { color:#a29db8; cursor:default; }
.chat-note-compose-bubble { display:flex; flex-direction:column; align-items:center; gap:8px; padding:14px; border-radius:18px; background:#fff; border:1px solid var(--b5-line); }
.chat-note-compose-bubble textarea { width:100%; border:0; resize:none; background:transparent; color:var(--b5-ink); text-align:center; font:inherit; font-size:17px; line-height:1.4; outline:none; }
.chat-note-compose-bubble textarea::placeholder { color:#8b86a3; }
.chat-note-compose-gif { position:relative; }
.chat-note-compose-gif img { max-width:160px; max-height:120px; border-radius:12px; display:block; }
.chat-note-compose-gif button { position:absolute; top:4px; right:4px; width:24px; height:24px; border-radius:50%; border:0; background:#000a; color:#fff; cursor:pointer; }
.chat-note-count { text-align:center; margin:6px 0 10px; font-size:12px; color:var(--b5-muted); }
.chat-note-chip { display:flex; align-items:center; gap:8px; padding:6px 8px 6px 10px; margin:0 0 8px; border-radius:12px; background:var(--b5-surface); color:var(--b5-ink); font-size:13.5px; }
.chat-note-chip img { width:22px; height:30px; object-fit:cover; border-radius:4px; }
.chat-note-chip span { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chat-note-chip button { border:0; background:transparent; color:var(--b5-muted); cursor:pointer; font-size:14px; }
.chat-note-chip.is-music { background:#7c5ce6; color:#fff; }
.chat-note-chip.is-music button { color:#fff; }
.chat-note-tools { display:flex; justify-content:center; gap:10px; margin:4px 0 10px; }
.chat-note-tools button { width:42px; height:42px; border-radius:50%; border:1px solid var(--b5-line); background:#fff; color:var(--b5-purple-ink); font-size:18px; cursor:pointer; }
.chat-note-tools b { font-size:12px; font-weight:900; letter-spacing:.3px; }
.chat-note-picker { margin:0 0 10px; padding:10px; border-radius:14px; background:#fff; border:1px solid var(--b5-line); max-height:220px; overflow:auto; }
.chat-note-picker-title { margin:0 0 8px; font-weight:800; font-size:14px; }
.chat-note-emoji-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(36px,1fr)); gap:4px; }
.chat-note-emoji-grid button { height:36px; border:0; background:transparent; font-size:20px; border-radius:8px; cursor:pointer; }
.chat-note-emoji-grid button:hover { background:var(--b5-surface); }
.chat-note-books { display:grid; gap:6px; }
.chat-note-books button { display:flex; align-items:center; gap:10px; border:0; border-radius:10px; padding:6px; background:transparent; color:var(--b5-ink); font:inherit; text-align:left; cursor:pointer; }
.chat-note-books button:hover { background:var(--b5-surface); }
.chat-note-books img, .chat-note-books i { width:30px; height:42px; border-radius:4px; object-fit:cover; flex:none; font-style:normal; display:inline-flex; align-items:center; justify-content:center; background:var(--b5-surface); }
.chat-note-quick { display:flex; gap:8px; overflow-x:auto; padding-bottom:4px; scrollbar-width:none; }
.chat-note-quick button { flex:none; border:1px solid var(--b5-line); background:#fff; color:var(--b5-ink); border-radius:999px; padding:7px 12px; font:inherit; font-size:13px; cursor:pointer; }
.chat-note-error { min-height:0; margin:8px 0 0; text-align:center; color:var(--b5-danger); font-size:13px; }
.chat-note-error:empty { display:none; }
.chat-note-audience { text-align:center; color:var(--b5-muted); font-size:12.5px; line-height:1.45; margin:10px 0 0; }
.chat-note-remove-row { display:flex; justify-content:center; align-items:center; gap:6px; margin:6px 0 0; font-size:12.5px; color:var(--b5-muted); }
.chat-note-remove-row button { border:0; background:transparent; color:var(--b5-danger); font:inherit; font-weight:800; cursor:pointer; }

@media (max-width:600px) {
  .modal-backdrop.chat-b5-backdrop { padding:16px; }
  .modal-backdrop.chat-b5-backdrop .modal-card.chat-b5-card { max-height:86vh; padding:16px 14px 14px; }
  .chat-voice { min-width:160px; }
}
@media (prefers-reduced-motion:reduce) { .chat-voice-fill, .chat-details-toggle, .chat-details-toggle i { transition:none; } }

/* Dark site theme, light Chats page: the thread's small grey text and links used the dark-site colours on the light
   page (date stamps 2.8:1, reply labels 2.3:1, links in received bubbles 1.6:1). A picture theme keeps its own. */
body:not(.light) #dmThreadActive:not(.chat-scene-theme) .dm-date-sep { color:#6b6584; }
body:not(.light) #dmThreadActive:not(.chat-scene-theme) .chat-reply-label { color:#6b6584; }
body:not(.light) #dmThreadActive:not(.chat-scene-theme) .chat-reply-context .chat-reply-preview { background:#f0edf5; color:#5f5a70; }
body:not(.light) #dmThreadActive:not(.chat-scene-theme) .dm-bubble.theirs .dm-bubble-text a { color:#5b3fc4; }

/* Group info (batch 1): a wrapped "×" sat alone at the left under the name on desktop; wrapped controls now line up
   on the right, under the row's other buttons. */
.group-info-members-body .follow-list-row { justify-content:flex-end; }
