/* The chat (TW #4376): a group text in the members' area, Steve's pick (option A, marker 3). */
.member-card.chat-page { max-width: 44rem; padding-bottom: 0; }
.member-page:has(.chat-page) { overflow-x: clip; } /* the band runs edge to edge */
.chat-people { margin-top: -.5rem; }
.chat-thread { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.chat-day { align-self: center; color: var(--m-muted); font-size: .9rem; font-weight: 700; margin: 1rem 0 .4rem; }
.chat-message { display: flex; flex-direction: column; align-items: flex-start; max-width: 85%; margin-bottom: 6px; }
.chat-message.is-mine { align-self: flex-end; align-items: flex-end; }
.chat-message.is-mine .chat-head { display: none; }
/* The name has a row of its own: room for a small photo beside it later (TW #4384). */
.member-page .chat-head { display: flex; align-items: center; gap: 8px; margin: 0 0 2px 14px; }
.chat-who { font-size: .85rem; font-weight: 700; color: var(--m-muted); }
.chat-bubble { background: var(--m-card); border: 2px solid var(--m-line); border-radius: 20px 20px 20px 6px; padding: 10px 16px;
  font-size: 1.1rem; line-height: 1.4; white-space: pre-line; overflow-wrap: anywhere; }
.is-mine .chat-bubble { background: var(--m-accent); color: var(--m-on-accent); border-color: var(--m-accent); border-radius: 20px 20px 6px 20px; }
.is-mine .chat-bubble a { color: inherit; }
.is-important .chat-bubble { border: 3px solid #f6b62b; }
.chat-flag { display: block; font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #8a5a00; }
.chat-time { font-size: .8rem; color: var(--m-muted); margin: 2px 14px 0; }
.chat-new-tag { color: #c62828; font-weight: 800; }
.chat-mention { font-weight: 700; }
.chat-mention.is-me { background: #fde9b0; color: #121726; border-radius: 6px; padding: 0 4px; }
/* A task's card under its message (TW #5453): the title, the due date and a button to open it. */
.chat-task-card { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 6px 0 0 14px; padding: 10px 14px;
  background: var(--m-card); border: 2px solid var(--m-line); border-radius: 12px; }
.is-mine .chat-task-card { margin: 6px 14px 0 0; }
.chat-task-title { font-weight: 700; }
.chat-task-due { color: var(--m-muted); font-size: .9rem; }
.chat-task-open { margin-left: auto; }
/* What you'd already seen, a touch quieter; the new ones at full strength. */
.chat-thread .is-seen { opacity: .62; }
.chat-new { list-style: none; align-self: stretch; display: flex; flex-direction: column; gap: 2px; text-align: center;
  margin: 1.25rem calc(50% - (100vw - var(--scrollbar-w, 0px) - var(--menu-w, 0px)) / 2) .5rem; /* edge to edge beside the menu (TW #4399); 100vw counts a scrollbar that takes room, chat#measureScrollbar */ padding: 18px 20px; background: #c62828; color: #fff; font-weight: 700; line-height: 1.3; }
.chat-new-count { font-size: 2rem; font-weight: 900; line-height: 1.1; }
.chat-empty { text-align: center; margin: 2rem 0; }
.chat-compose { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end;
  margin: 1rem -20px 0 !important; padding: 12px 20px 20px; background: var(--m-bg); border-top: 2px solid var(--m-line); }
.chat-compose textarea { flex: 1; min-width: 0; min-height: 52px; max-height: 40vh; field-sizing: content; box-sizing: border-box; font: inherit;
  font-size: 1.1rem; padding: 12px 14px; border: 2px solid var(--m-line); border-radius: 12px; background: var(--m-card); color: var(--m-fg); resize: none; }
.chat-compose textarea:focus { outline: 3px solid var(--m-accent); outline-offset: 1px; border-color: var(--m-accent); }
.chat-send { font: inherit; font-size: 1.1rem; font-weight: 800; border: 0; border-radius: 12px; background: var(--m-accent);
  color: var(--m-on-accent); min-height: 52px; padding: 0 20px; cursor: pointer; }
.chat-important input { width: 1.2rem; height: 1.2rem; }
/* New messages below while you read further up (TW #4584, Steve's pick A): red like the band and the New tags, just
   above the write box. An @mention of you gets a gold ring, the colour your name is marked with. */
.chat-pill { position: absolute; bottom: calc(100% + 12px); left: 50%; transform: translateX(-50%); display: inline-flex; align-items: center;
  gap: 8px; max-width: calc(100% - 32px); min-height: 44px; padding: 10px 20px; border: 0; border-radius: 999px; background: #c62828; color: #fff;
  font: inherit; font-size: 1.05rem; font-weight: 800; white-space: nowrap; cursor: pointer; box-shadow: 0 6px 18px rgb(0 0 0 / .28); }
.chat-pill[hidden] { display: none; }
.chat-pill.is-me { outline: 3px solid #fde9b0; outline-offset: 0; }
.chat-pill:focus-visible { outline: 3px solid var(--m-accent); outline-offset: 2px; }
.chat-pill-words { overflow: hidden; text-overflow: ellipsis; }
.chat-pill-arrow { font-size: 1.2rem; line-height: 1; }
.chat-thread > li { scroll-margin-top: calc(var(--mm-top, 0px) + var(--cbm-h) + 60px); } /* clear of the top band and the chat bar */
.chat-error { flex-basis: 100%; margin: 0 !important; color: #b3261e; font-weight: 700; font-size: 1rem; }
@media (prefers-color-scheme: dark) {
  .chat-flag { color: #f6c75a; }
  .chat-new-tag { color: #ff8a80; }
}

/* "Seen by Pat and 4 others ›" (TW #4392): a small button that slides its list open, everyone who has seen the
   message, newest first (TW #4589). No slide under reduced motion. Steve's pick B (TW #4589): the line shows
   under the newest message and under your own; any other shows when you tap its bubble (chat#tapBubble), which
   gets a blue ring. A slot nobody has seen yet is empty and takes no room (TW #4583); tapped, it says so. */
.chat-seen { list-style: none; align-self: flex-end; display: none; flex-direction: column; align-items: flex-end; margin: 0 6px 8px; max-width: 85%; }
.chat-message.is-mine + .chat-seen:not(:empty), .chat-message.is-tapped + .chat-seen,
.chat-seen:not(:empty):not(:has(~ .chat-seen)) { display: flex; }
.chat-message.is-tapped + .chat-seen:empty::before { content: "No one else has seen it yet"; padding: 4px 8px; font-size: .85rem; color: var(--m-muted); }
.chat-message.is-tapped .chat-bubble { outline: 3px solid var(--m-accent); outline-offset: 2px; }
.chat-not-checked:empty { display: none; }
.chat-seen-toggle { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 4px 8px; border: 0; border-radius: 8px;
  background: transparent; color: var(--m-muted); font: inherit; font-size: .85rem; cursor: pointer; }
.chat-seen-toggle:hover, .chat-seen-toggle:focus-visible { background: var(--m-card); }
.chat-seen-toggle:focus-visible { outline: 3px solid var(--m-accent); outline-offset: 1px; }
.chat-seen-arrow { transition: transform .2s ease; }
.chat-seen-toggle[aria-expanded="true"] .chat-seen-arrow { transform: rotate(90deg); }
.chat-seen-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .25s ease; }
.chat-seen-toggle[aria-expanded="true"] + .chat-seen-panel { grid-template-rows: 1fr; }
.chat-seen-list { overflow: hidden; min-height: 0; list-style: none; margin: 0; padding: 0 8px; text-align: right; font-size: .9rem; color: var(--m-muted); }
.chat-seen-list li { padding: 2px 0; }
.chat-seen-who { color: var(--m-fg); font-weight: 700; }
.member-page .chat-not-checked { text-align: center; font-size: .85rem; font-style: italic; color: var(--m-muted); margin: .5rem 0 0; }
@media (prefers-reduced-motion: reduce) { .chat-seen-arrow, .chat-seen-panel { transition: none; } }

/* TW #4409: in more than one room, /members/chat is a big button per room with what's new in it. */
.chat-room-links { display: flex; flex-direction: column; gap: 14px; margin: 1rem 0 2rem; }
a.member-button.chat-room-link { flex-direction: column; gap: 4px; min-height: 96px; padding: 14px 20px; color: var(--m-on-accent); }
.chat-room-name { font-size: 1.4rem; }
.chat-room-new { font-size: 1rem; font-weight: 700; opacity: .85; }
.chat-room-new.has-new { opacity: 1; background: #c62828; color: #fff; border-radius: 999px; padding: 2px 12px; }

/* Files (TW #4420): chips in the write box before Send; in the thread, pictures as a small
   preview and other files as a card with Download. */
.chat-compose.is-dropping { outline: 3px dashed var(--m-accent); outline-offset: -6px; }
.chat-chips { order: -1; flex-basis: 100%; list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chat-chips:empty { display: none; }
.chat-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 4px 4px 12px; border: 2px solid var(--m-line);
  border-radius: 999px; background: var(--m-card); font-size: .9rem; }
.chat-chip-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 14rem; }
.chat-chip-size { color: var(--m-muted); }
.chat-chip-remove { width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--m-muted); font: inherit; font-size: 1.2rem; cursor: pointer; }
.chat-chip-remove:hover, .chat-chip-remove:focus-visible { background: var(--m-line); color: var(--m-fg); }
.chat-chip-refused { flex-basis: 100%; color: #b3261e; font-weight: 700; font-size: .95rem; }
.chat-attach { width: 52px; min-height: 52px; border: 2px solid var(--m-line); border-radius: 12px; background: var(--m-card); font-size: 1.3rem; cursor: pointer; }
.chat-attach:focus-visible { outline: 3px solid var(--m-accent); outline-offset: 1px; }
.chat-files { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.is-mine .chat-files { align-items: flex-end; }
.chat-file-image img { display: block; max-width: min(220px, 55vw); max-height: 160px; object-fit: cover; border-radius: 14px; border: 2px solid var(--m-line); background: var(--m-card); }
.chat-file-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 2px solid var(--m-line); border-radius: 14px; background: var(--m-card); max-width: 22rem; }
.chat-file-icon { font-size: 1.6rem; }
.chat-file-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.chat-file-name { font-weight: 700; font-size: 1rem; overflow-wrap: break-word; word-break: normal; }
.chat-file-size { color: var(--m-muted); font-size: .85rem; }
.member-page a.chat-file-download { font-weight: 800; font-size: 1rem; white-space: nowrap; }

/* Which chat you're in (TW #4916, Steve's pick A): one slim line under the top band once the heading has scrolled
   away (chat_bar_controller), edge to edge like the write box. It takes no room of its own (the margin under it) and,
   hidden, it's out of the tab order. */
.chat-bar { position: sticky; top: calc(var(--mm-top, 0px) + var(--cbm-h)); z-index: 20; display: flex; align-items: center; gap: 8px;
  height: 48px; box-sizing: border-box; margin: 0 -20px -48px; padding: 0 6px 0 20px; background: var(--m-bg); border-bottom: 2px solid var(--m-line);
  visibility: hidden; opacity: 0; transition: opacity .15s, visibility 0s linear .15s; }
.chat-bar.is-shown { visibility: visible; opacity: 1; transition: opacity .15s; }
.chat-bar-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; font-size: 1.05rem; }
.member-page a.chat-bar-gear { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: var(--m-muted); }
.member-page a.chat-bar-gear:focus-visible { outline: 3px solid var(--m-accent); outline-offset: -2px; }
@media (prefers-reduced-motion: reduce) { .chat-bar, .chat-bar.is-shown { transition: none; } }

/* TW #4427: each room's Notifications link, beside its name. */
.chat-room-header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 1rem; }
.chat-room-header h1 { margin-bottom: 0; }
/* A button with a gear since TW #4578; Add people (TW #4611) is the same pill. */
.member-page a.chat-room-settings, .member-page a.chat-add-people { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 14px 6px 12px; box-sizing: border-box;
  border: 2px solid var(--m-line); border-radius: 999px; background: var(--m-card); color: var(--m-fg); font-size: 1rem; font-weight: 700; text-decoration: none; }
.member-page a.chat-room-settings:focus-visible, .member-page a.chat-add-people:focus-visible { outline: 3px solid var(--m-accent); outline-offset: 2px; }

/* What Mark as important does (TW #4429): a ? beside it, and a plain dialog in the site's own look. */
.member-page .chat-important { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.member-page .chat-important > label { white-space: nowrap; }
.member-page .chat-important > label { display: flex; gap: .5rem; align-items: center; font-weight: 600; font-size: 1rem; margin: 0; }
.chat-important-why { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--m-line); background: var(--m-card); color: var(--m-fg);
  font: inherit; font-weight: 800; font-size: .95rem; cursor: pointer; }
.chat-important-why:focus-visible { outline: 3px solid var(--m-accent); outline-offset: 1px; }
.important-help { width: min(26rem, calc(100vw - 32px)); box-sizing: border-box; padding: 22px 22px 18px; border: 2px solid var(--m-line); border-radius: 16px;
  background: var(--m-card); color: var(--m-fg); box-shadow: 0 12px 40px rgb(0 0 0 / .25); }
.important-help::backdrop { background: rgb(0 0 0 / .45); }
.member-page .important-help h2 { margin: 0 0 .5rem; font-size: 1.3rem; }
.member-page .important-help p { margin: 0 0 1rem; font-size: 1.05rem; line-height: 1.45; }
.member-page .important-help-again { display: flex; gap: .5rem; align-items: center; font-weight: 500; font-size: 1rem; margin: 0 0 1rem; min-height: 44px; }
.important-help-buttons { display: flex; justify-content: flex-end; gap: 8px; }
.important-help-buttons button { font: inherit; font-size: 1.05rem; font-weight: 800; min-height: 48px; padding: 0 20px; border-radius: 12px; cursor: pointer; }
.important-help-ok { border: 0; background: var(--m-accent); color: var(--m-on-accent); }
.important-help-cancel { border: 2px solid var(--m-line); background: transparent; color: var(--m-fg); }

/* Rename in place (TW #8154, Steve's pick A on #8153): a quiet link after the name; open, the box takes the row. */
.chat-room-title { min-width: 0; }
.chat-room-title.is-renaming { flex: 1 1 100%; }
.chat-room-name-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.chat-room-name-line[hidden], .chat-rename-inline[hidden] { display: none; }
.member-page a.chat-rename-link { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 4px; box-sizing: border-box;
  color: var(--m-accent); font-size: 1rem; font-weight: 700; text-underline-offset: 3px; }
.member-page a.chat-rename-link svg { align-self: center; }
.member-page a.chat-rename-link:focus-visible { outline: 3px solid var(--m-accent); outline-offset: 2px; border-radius: 4px; }
.member-page .chat-rename-inline { display: flex; flex-direction: column; gap: 8px; margin: 0 0 .5rem; }
.member-page .chat-rename-inline input[type=text] { width: 100%; box-sizing: border-box; min-height: 48px; padding: 8px 12px; font: inherit; font-size: 1.3rem; font-weight: 700;
  border: 2px solid var(--m-accent); border-radius: 10px; background: var(--m-card); color: var(--m-fg); }
.member-page .chat-rename-inline input[type=text]:focus-visible { outline: 3px solid var(--m-accent); outline-offset: 2px; }
.chat-rename-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.member-page .chat-rename-buttons .member-button { width: auto; flex: 1 1 0; max-width: 12rem; min-height: 48px; padding: 0 20px; font-size: 1.1rem; }
.member-page .chat-rename-inline .member-hint { margin: 0; }

/* TW #4442: each chat's tools beside its name (Notifications). */
.chat-room-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }

/* The line under Send (TW #4641, Steve's pick B): Mark as important, and the room's Sound button at its right end;
   on a phone the button wraps under it. Green on, red off, gold while the browser won't play yet; words as well as
   colour, for anyone who can't tell red from green. */
.member-page { --snd-on: #1f7a45; --snd-on-fg: #fff; --snd-off: #b3261e; --snd-off-fg: #fff; --snd-blocked: #f2b51c; --snd-blocked-fg: #1d1d1b; }
@media (prefers-color-scheme: dark) { .member-page { --snd-on: #6cc28f; --snd-on-fg: #0b1f13; --snd-off: #ff8a80; --snd-off-fg: #2a0b08; } }
.chat-under-send { order: 3; flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.chat-sound { display: inline-flex; flex: none; align-items: center; gap: 8px; margin-left: auto; min-height: 44px; padding: 0 16px 0 12px;
  border: 0; border-radius: 12px; font: inherit; font-size: 1rem; font-weight: 800; white-space: nowrap; cursor: pointer; }
.chat-sound svg { flex: none; }
.chat-sound.is-on { background: var(--snd-on); color: var(--snd-on-fg); }
.chat-sound.is-off { background: var(--snd-off); color: var(--snd-off-fg); }
.chat-sound.is-blocked { background: var(--snd-blocked); color: var(--snd-blocked-fg); }
.chat-sound:not(.is-on) .chat-sound-waves, .chat-sound:not(.is-off) .chat-sound-x, .chat-sound:not(.is-blocked) .chat-sound-bang { display: none; }
.chat-sound:focus-visible { outline: 3px solid var(--m-accent); outline-offset: 2px; }
.chat-sound-allow { white-space: nowrap; }
/* On a phone (TW #4979, Steve's pick B): the box runs up to 📎, and Send goes down to the bottom line beside the sound
   button. The line under the box stops being a box of its own so Send can join it; there "Sound is blocked: tap to
   allow" takes two lines, as tall as Send. Without Mark as high or urgent priority (someone acting as a member) the
   ::after starts the bottom line. */
@media (max-width: 600px) {
  .chat-compose textarea { order: 1; }
  .chat-attach { order: 2; }
  .chat-under-send { display: contents; }
  .member-page .chat-important { order: 3; flex-basis: 100%; }
  .chat-compose:not(:has(.chat-important))::after { content: ""; order: 3; flex-basis: 100%; }
  .chat-sound { order: 4; flex: 1 1 0; max-width: max-content; min-width: 0; min-height: 52px; white-space: normal; text-align: left; line-height: 1.2; }
  .chat-send { order: 5; }
}
/* @mentions while typing (TW #5056, Steve's pick A; chat_mention_controller). The box's own words go see-through and a
   copy laid exactly over it draws them, each name Send will mention blue and bold: a stroke round the letters rather
   than a heavier font, so nothing widens and the cursor stays with the words. A near-miss gets a wavy orange line.
   The list of people, and "Did you mean George?", float just above the box, over the last messages. */
.chat-compose textarea.is-mirrored { color: transparent; caret-color: var(--m-fg); }
.chat-compose textarea.is-mirrored::placeholder { color: var(--m-muted); }
.chat-mirror { position: absolute; box-sizing: border-box; margin: 0; overflow: hidden; border-style: solid; border-color: transparent;
  white-space: pre-wrap; overflow-wrap: break-word; pointer-events: none; color: var(--m-fg); }
.chat-mirror-name { color: var(--m-accent); -webkit-text-stroke: .07em currentColor; }
.chat-mirror-near { text-decoration: underline wavy #d9822b; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.chat-picks, .chat-near { position: absolute; left: 20px; right: 20px; z-index: 30; box-sizing: border-box; margin: 0; padding: 6px;
  overflow-y: auto; background: var(--m-card); color: var(--m-fg); border: 2px solid var(--m-line); border-radius: 14px;
  box-shadow: 0 8px 24px rgb(0 0 0 / .22); }
.chat-picks { list-style: none; }
.chat-picks-head { padding: 6px 10px 4px; font-size: .95rem; font-weight: 700; color: var(--m-muted); }
.chat-mention-pick { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 10px; border-radius: 10px; font-size: 1.1rem; cursor: pointer; }
.chat-mention-pick::before { content: attr(data-initial); flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--m-accent); color: var(--m-on-accent); font-weight: 800; }
.chat-mention-pick.is-on { background: color-mix(in srgb, var(--m-accent) 14%, transparent); }
.chat-mention-pick b { font-weight: 800; }
.chat-near { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 10px 12px; font-size: 1.1rem; }
.chat-near[hidden], .chat-picks[hidden], .chat-mirror[hidden] { display: none; }
.chat-near-words { flex: 1; min-width: 12rem; }
.chat-near-choices { display: flex; flex-wrap: wrap; gap: 8px; } /* Yes, or AnneK and AnneP (TW #5062) */
/* With two or three names to choose from, the buttons stack full width, the names first; a name never breaks. */
.chat-mention-ask .important-help-buttons:has(> :nth-child(3)) { flex-direction: column; align-items: stretch; }
.chat-mention-ask .important-help-buttons:has(> :nth-child(3)) > :first-child { order: 1; }
.chat-mention-ask h2 span, .chat-near-words b { white-space: nowrap; }
.chat-near button { font: inherit; font-size: 1.05rem; font-weight: 800; min-height: 44px; padding: 0 16px; border-radius: 12px; cursor: pointer; }
.chat-near-yes { border: 0; background: var(--m-accent); color: var(--m-on-accent); }
.chat-near-no { width: 44px; border: 2px solid var(--m-line); background: transparent; color: var(--m-fg); padding: 0 !important; }

/* TW #4611: chats members start. The list: Start a chat, then your chats as cards (name, when, the last word, what's new). */
.member-page a.member-button.chat-start { display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; margin: 0 0 1.25rem; }
.member-page .chat-list-head { font-size: 1.3rem; margin: 1.5rem 0 .6rem; border: 0; padding: 0; }
.chat-convos { list-style: none; margin: 0 0 2rem; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.member-page a.chat-convo { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; border: 2px solid var(--m-line); border-radius: 14px;
  background: var(--m-card); color: var(--m-fg); text-decoration: none; }
.member-page a.chat-convo:focus-visible { outline: 3px solid var(--m-accent); outline-offset: 1px; }
.chat-convo-top, .chat-convo-last { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.chat-convo-name { font-weight: 800; font-size: 1.15rem; overflow-wrap: anywhere; }
.chat-convo-when { color: var(--m-muted); font-size: .85rem; white-space: nowrap; }
.chat-convo-last { color: var(--m-muted); font-size: 1rem; align-items: center; }
.chat-convo-said { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-convo-new { background: #c62828; color: #fff; border-radius: 999px; padding: 0 10px; font-weight: 800; font-size: .9rem; white-space: nowrap; }
.chat-convo-tag { color: var(--m-accent); font-weight: 700; font-size: .9rem; white-space: nowrap; }
.member-page .chat-all-link { font-weight: 700; }
.member-page .chat-back { margin: 0 0 .5rem; font-weight: 700; font-size: 1rem; }
.member-page .chat-back a { text-decoration: none; }
/* Picking a person, or someone to add: search as you type, one row each. */
.member-page input.chat-pick-search { box-sizing: border-box; width: 100%; font: inherit; font-size: 1.2rem; padding: 14px 16px; margin: 0 0 12px;
  border: 2px solid var(--m-line); border-radius: 12px; background: var(--m-card); color: var(--m-fg); }
.member-page input.chat-pick-search:focus { outline: 3px solid var(--m-accent); outline-offset: 1px; border-color: var(--m-accent); }
.chat-pick-list { list-style: none; margin: 0 0 1rem; padding: 0; border-top: 1px solid var(--m-line); }
.chat-pick-list li { border-bottom: 1px solid var(--m-line); }
.member-page .chat-pick-list form { margin: 0; }
.member-page .chat-pick { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 56px; padding: 8px 4px;
  border: 0; background: transparent; color: var(--m-fg); font: inherit; font-size: 1.15rem; font-weight: 700; text-align: left; text-decoration: none; cursor: pointer; }
.member-page .chat-pick:focus-visible { outline: 3px solid var(--m-accent); outline-offset: -2px; }
.chat-pick-go { color: var(--m-accent); font-weight: 800; font-size: 1rem; white-space: nowrap; }
.member-page .chat-pick-none { color: var(--m-muted); font-size: 1rem; }
/* The note on a new chat, before its first message: plain centred text between two thin rules. */
.chat-notice { text-align: center; max-width: 28rem; margin: 1.25rem auto; padding: 1.1rem 0 .4rem; border-top: 2px solid var(--m-line); border-bottom: 2px solid var(--m-line); }
.member-page .chat-notice h2 { font-size: 1.35rem; margin: 0 0 .5rem; border: 0; padding: 0; }
.member-page .chat-notice p { font-size: 1.05rem; line-height: 1.45; margin: 0 0 .7rem; text-wrap: pretty; }
.member-page .chat-notice .chat-notice-hello { color: var(--m-muted); font-size: 1rem; }
/* "Kim added Pat": a plain line in the thread, like the day. */
.chat-event { list-style: none; align-self: center; text-align: center; color: var(--m-muted); font-size: .9rem; font-weight: 700; margin: .6rem 0; }
/* An admin in a chat they're not in: they read; Join to write. */
.member-page .chat-looking-in { font-size: 1rem; font-weight: 700; margin: -.25rem 0 1rem; text-wrap: pretty; }
.chat-compose.chat-join { flex-direction: column; align-items: stretch; }
.member-page .chat-join-form { margin: 0; }
.chat-join .chat-send { width: 100%; }
.member-page .chat-join p { margin: 0; font-size: .95rem; text-align: center; }
a.chat-add-people { text-decoration: none; }
.member-page a.chat-add-people { color: var(--m-fg); }
/* Who's in a chat: the list, rename, leave. */
.chat-people-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.chat-people-list li { padding: 8px 0; border-bottom: 1px solid var(--m-line); font-weight: 700; font-size: 1.05rem; }
.chat-people-list .member-muted { font-weight: 500; font-size: .95rem; }
.member-page .chat-rename { display: flex; flex-direction: column; gap: 4px; margin: 0 0 .5rem; }
.member-page .chat-leave-form { margin: 2rem 0 1rem; }
.chat-leave { font: inherit; font-size: 1.05rem; font-weight: 800; min-height: 48px; padding: 0 20px; border: 2px solid #b3261e; border-radius: 12px;
  background: transparent; color: #b3261e; cursor: pointer; }
@media (prefers-color-scheme: dark) { .chat-leave { border-color: #ff8a80; color: #ff8a80; } }

/* TW #4639: a chat of your own from a group chat. The people line opens who's in it, a Chat button beside each. */
.member-page a.chat-people { display: block; width: fit-content; margin: -.5rem 0 1rem; color: var(--m-muted);
  text-decoration: underline; text-underline-offset: 3px; }
.chat-people-list li:has(.chat-people-chat) { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; }
.member-page a.chat-people-chat { display: inline-flex; align-items: center; flex: none; min-height: 40px; padding: 0 18px; border: 2px solid var(--m-accent);
  border-radius: 999px; font-size: .95rem; font-weight: 800; text-decoration: none; }
.member-page a.chat-people-chat:focus-visible { outline: 3px solid var(--m-accent); outline-offset: 2px; }
/* The name above someone's message opens a small menu, "Chat with Pat": tappable, without shouting. */
.chat-who-menu { position: relative; }
.chat-who-menu summary { list-style: none; cursor: pointer; border-radius: 6px; padding: 2px 6px; margin: -2px -6px; }
.chat-who-menu summary::-webkit-details-marker { display: none; }
.chat-who-menu summary:hover, .chat-who-menu summary:focus-visible, .chat-who-menu[open] summary { text-decoration: underline; text-underline-offset: 3px; }
.chat-who-menu summary:focus-visible { outline: 3px solid var(--m-accent); outline-offset: 1px; }
.chat-who-pop { position: absolute; top: calc(100% + 4px); left: -8px; z-index: 5; min-width: 13rem; padding: 6px; border: 2px solid var(--m-line);
  border-radius: 14px; background: var(--m-card); box-shadow: 0 8px 24px rgb(0 0 0 / .2); }
.member-page a.chat-who-chat { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 12px; border-radius: 10px;
  color: var(--m-fg); font-size: 1.05rem; font-weight: 800; text-decoration: none; white-space: nowrap; }
.member-page a.chat-who-chat:hover { background: var(--m-bg); }
.chat-who-chat svg { color: var(--m-accent); flex: none; }

/* Replying (TW #4588, Steve's pick A). "↩ Reply" beside each message's time; while you write, a strip above the box
   (blue edge, the start of what you're answering, ✕) and a blue outline on that message; the reply's bubble starts
   with a quote of it, and tapping the quote gives the original a gold glow for a moment. */
.chat-time { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.chat-reply { min-height: 36px; padding: 4px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--m-accent);
  font: inherit; font-size: .9rem; font-weight: 800; cursor: pointer; }
.chat-reply:hover, .chat-reply:focus-visible { background: var(--m-card); }
.chat-reply:focus-visible { outline: 3px solid var(--m-accent); outline-offset: 1px; }
.chat-replying { order: -2; flex-basis: 100%; display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px 6px 8px 12px;
  border: 2px solid var(--m-line); border-left: 5px solid var(--m-accent); border-radius: 12px; background: var(--m-card); box-sizing: border-box; }
.chat-replying[hidden] { display: none; }
.chat-replying-what { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 1rem; line-height: 1.3; }
.chat-replying-who strong { color: var(--m-accent); }
.chat-replying-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--m-muted); }
.chat-replying-cancel { flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--m-muted);
  font: inherit; font-size: 1.3rem; cursor: pointer; }
.chat-replying-cancel:hover, .chat-replying-cancel:focus-visible { background: var(--m-bg); color: var(--m-fg); }
.chat-quote-thumb { flex: none; width: 40px; height: 40px; object-fit: cover; border-radius: 8px; }
.chat-quote-thumb[hidden] { display: none; }
.chat-message.is-replying-to .chat-bubble, .chat-message.is-replying-to .chat-file-image img { outline: 3px solid var(--m-accent); outline-offset: 2px; }
.member-page .chat-bubble a.chat-quote { display: flex; align-items: center; gap: 8px; margin: -2px -6px 8px; padding: 6px 10px;
  border-left: 4px solid var(--m-accent); border-radius: 10px; background: color-mix(in srgb, var(--m-fg) 7%, transparent);
  color: inherit; text-decoration: none; font-size: .95rem; line-height: 1.3; white-space: normal; }
.member-page .is-mine .chat-bubble a.chat-quote { background: rgb(255 255 255 / .18); border-left-color: rgb(255 255 255 / .85); }
.chat-quote-words { min-width: 0; }
.chat-quote-who { display: block; font-weight: 800; font-size: .85rem; }
.chat-quote-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; opacity: .85; overflow-wrap: anywhere; }
.chat-message .chat-bubble, .chat-message .chat-file-image img { transition: box-shadow .6s ease; }
.chat-message.is-glowing .chat-bubble, .chat-message.is-glowing .chat-file-image img { box-shadow: 0 0 0 4px #f6b62b, 0 0 18px 4px rgb(246 182 43 / .55); }
@media (prefers-reduced-motion: reduce) { .chat-message .chat-bubble, .chat-message .chat-file-image img { transition: none; } }

/* Emoji under a message (TW #4983, Steve's pick A): a chip per kind, "👍 3", yours outlined; the 🙂+ by Reply opens the
   six under the message's line. Hold a chip (hover, on a laptop) and a line names who. */
.chat-reactions { position: relative; display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 6px 0; }
.chat-reactions[hidden] { display: none; }
.is-mine .chat-reactions { justify-content: flex-end; }
.chat-reaction { min-height: 36px; padding: 5px 11px; border: 2px solid var(--m-line);
  border-radius: 999px; background: var(--m-card); color: var(--m-fg); font: inherit; font-size: .95rem; font-weight: 700; cursor: pointer;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.chat-reaction span { font-size: 1.1rem; line-height: 1; vertical-align: -1px; }
.chat-reaction.is-yours { border-color: var(--m-accent); background: color-mix(in srgb, var(--m-accent) 16%, var(--m-card)); color: var(--m-accent); }
.chat-reaction:focus-visible { outline: 3px solid var(--m-accent); outline-offset: 2px; }
/* Over the line below, not in the flow: it never makes the page taller, so a chat keeping to the bottom doesn't scroll
   the chip out from under the mouse (and the line away with it). */
.chat-reactions-who { position: absolute; top: calc(100% + 4px); left: 0; z-index: 5; width: max-content; max-width: min(300px, 80vw);
  padding: 6px 12px; border: 2px solid var(--m-line); border-radius: 12px; background: var(--m-card); color: var(--m-fg); font-size: .95rem;
  box-shadow: 0 8px 28px rgb(0 0 0 / .22); }
.is-mine .chat-reactions-who { left: auto; right: 0; }
.chat-room:not(.can-react) .chat-react { display: none; }
.chat-room:not(.can-react) .chat-reaction { cursor: default; }
.chat-react[aria-expanded="true"] { background: var(--m-card); }
.chat-react-picker { display: flex; gap: 2px; width: max-content; margin: 6px 4px 4px; padding: 5px; border: 2px solid var(--m-line);
  border-radius: 999px; background: var(--m-card); box-shadow: 0 8px 28px rgb(0 0 0 / .22); }
.chat-react-picker[hidden] { display: none; }
.chat-react-picker button { width: 46px; height: 46px; padding: 0; border: 0; border-radius: 50%; background: transparent; font-size: 1.65rem; line-height: 1; cursor: pointer; }
.chat-react-picker button.is-yours { background: color-mix(in srgb, var(--m-accent) 20%, transparent); }
.chat-react-picker button:focus-visible { outline: 3px solid var(--m-accent); outline-offset: -2px; }
