/* AOIT messages — the Mendip App's messenger, its new ("v2") look
   (messages-v2.css over app.css), with the App's class names so these rules
   can follow the App's line for line (David 2026-10-08: "take the lead from
   the App … look and feel, css etc"). The App scopes them html.mmv2; here
   they are the only look, so they are not scoped.
   Shared by the staff side (aoit.css) and the trainee app (me.css).
   What AOIT has and the App doesn't — held messages, the "AOIT team" marker,
   the course sections, report/block — is drawn in the same quiet style. */

:root {
  --mm-brand: #005e85;
  --mm-ink: #143c50;
  --mm-muted: #5e7480;
  --mm-ground: #f3f6f7;
  --mm-paper: #fff;
  --mm-chat: #f7f9fa;
  --mm-line: #e2eaee;
  --mm-wash: #e7f1f6;
  --mm-out: #dceef5;
  --mm-out-ink: #123e54;
  --mm-font: "Poppins", -apple-system, "Segoe UI", system-ui, sans-serif;
}

/* Messenger pages: white like the App's, Poppins throughout */
body.msg-body { background: var(--mm-paper); }
.msg-page, .msg-main, .msg-new, body.msg-body .msg-head, body.msg-body .msg-search, body.msg-body .msg-list,
body.msg-body .msg-foot-link, body.msg-body .msg-foot-note { font-family: var(--mm-font); color: var(--mm-ink); }
.msg-page button, .msg-page input, .msg-page textarea, .msg-main button, .msg-main textarea,
.msg-new button, .msg-new input, .msg-sheet button, .msg-sheet textarea { font-family: inherit; }
body.msg-body .beta-pill { display: none; }   /* it would sit on Send */
body.msg-body main { padding-bottom: 24px; }

/* ── Inbox ─────────────────────────────────────────────────────────────── */
.msg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: .9rem .4rem 1rem; }
.msg-head h1 { margin: 0; font-weight: 900; font-size: 1.6rem; letter-spacing: -.02em; color: var(--mm-ink); text-transform: none; }
.msg-head__btn {
  display: inline-flex; align-items: center; gap: .4rem; text-decoration: none; cursor: pointer;
  background: var(--mm-brand); color: #fff; border: 2px solid var(--mm-brand); border-radius: 10px;
  font-weight: 600; font-size: .85rem; padding: .45rem .8rem;
}
.msg-head__btn--outline { background: transparent; color: var(--mm-brand); border-color: var(--mm-line); }

.msg-search { margin: 0 .4rem .8rem; }
.msg-search__q {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 16px;   /* 16px: no iOS zoom */
  padding: .55rem .9rem .55rem 2.2rem; border: 1px solid var(--mm-line); border-radius: 11px; color: var(--mm-ink);
  background: var(--mm-ground) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a98a6' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") .8rem center no-repeat;
}
.msg-search__q::placeholder { color: var(--mm-muted); opacity: 1; }
.msg-search__q:focus { outline: none; border-color: var(--mm-brand); box-shadow: 0 0 0 3px rgba(0,94,133,.12); }
.msg-search__q::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

.msg-list { display: flex; flex-direction: column; gap: 0; }
.msg-list__h { font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--mm-muted); margin: 1rem .65rem .3rem; }
.msg-list__h:first-child { margin-top: .2rem; }
.msg-list--searching .msg-list__h { display: none; }
.msg-tabs__empty { font-size: .88rem; color: var(--mm-muted); text-align: center; margin: .8rem 0; }
.msg-tabs__empty[hidden] { display: none; }

.msg-item {
  display: flex; align-items: center; gap: .7rem; background: transparent; border-radius: 11px;
  padding: .8rem .65rem; text-decoration: none; color: var(--mm-ink); -webkit-tap-highlight-color: transparent;
}
.msg-item[hidden] { display: none; }
.msg-item:hover { background: var(--mm-ground); text-decoration: none; }
.msg-item:active { background: var(--mm-wash); }
.msg-item--active { background: var(--mm-wash); }
.msg-item .msg-ava { width: 44px; height: 44px; flex-basis: 44px; }
.msg-item__body { flex: 1; min-width: 0; }
.msg-item__top { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.msg-item__name { font-size: .9rem; font-weight: 600; color: var(--mm-ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-item__who { font-weight: 400; font-size: .75rem; color: var(--mm-muted); margin-left: .25rem; letter-spacing: .02em; }
.msg-item__time { font-size: .72rem; color: var(--mm-muted); white-space: nowrap; }
.msg-item__bottom { display: flex; align-items: center; gap: .4rem; margin-top: .15rem; }
.msg-item__preview { flex: 1; min-width: 0; font-size: .82rem; color: var(--mm-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-item__mute { font-size: .75rem; opacity: .6; }
.msg-item__badge {
  background: var(--mm-brand); color: #fff; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
  font-size: .68rem; font-weight: 600; line-height: 20px; text-align: center;
}
.msg-item--unread .msg-item__name { font-weight: 600; color: var(--mm-ink); }
.msg-item--unread .msg-item__preview { font-weight: 500; color: var(--mm-ink); }
.msg-item--unread .msg-item__time { color: var(--mm-brand); font-weight: 600; }

/* Quiet links at the foot (the App's .msg-foot-link) */
.msg-foot-link {
  display: flex; align-items: center; gap: .55rem; margin: .6rem .3rem 0; padding: .55rem .6rem;
  border-top: 1px solid var(--mm-line); color: var(--mm-muted); font-size: .82rem; text-decoration: none;
}
.msg-foot-link + .msg-foot-link { margin-top: 0; }
.msg-foot-link:hover { color: var(--mm-brand); text-decoration: none; }
.msg-foot-link svg { flex: none; }
.msg-foot-note { margin: .6rem .9rem 0; font-size: .76rem; color: var(--mm-muted); }

/* ── Avatars: people round, groups a soft rounded square (the App's) ─── */
.msg-ava {
  flex: 0 0 46px; width: 46px; height: 46px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 1rem; background: #34495e; overflow: hidden;
}
.msg-ava--sm { flex-basis: 34px; width: 34px; height: 34px; font-size: .8rem; }
.msg-ava--xs { flex-basis: 26px; width: 26px; height: 26px; font-size: .62rem; }
.msg-ava--lg { flex-basis: 64px; width: 64px; height: 64px; font-size: 1.3rem; }
.msg-ava > svg { width: 52%; height: 52%; }
.msg-ava--photo { background: #dfe7ef; }
.msg-ava--photo img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.msg-ava--group { border-radius: 13px; }
.msg-ava--notices { background: var(--mm-brand); }
.msg-ava--oversight { background: #6b4f00; }
.msg-ava--team-a { background: #2f6fdb; font-weight: 900; }
.msg-ava--team-b { background: #1f9a62; font-weight: 900; }
.msg-ava--team-c { background: #d9822b; font-weight: 900; }
.msg-ava--team-d { background: #8a4fc7; font-weight: 900; }

/* ── A conversation ────────────────────────────────────────────────────── */
.msg-main { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; min-width: 0; background: var(--mm-paper); }
.msg-bar {
  flex: none; display: flex; align-items: center; gap: .5rem; min-height: 60px;
  background: var(--mm-paper); border-bottom: 1px solid var(--mm-line); padding: .55rem .7rem .55rem .35rem;
}
.msg-bar .msg-ava { width: 38px; height: 38px; flex-basis: 38px; font-size: .85rem; }
.msg-bar__back {
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
  min-width: 36px; height: 40px; padding: 0; color: var(--mm-brand); flex: none;
}
.msg-bar__back svg { width: 24px; height: 24px; }
.msg-bar__who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.msg-bar__who strong { font-size: .95rem; font-weight: 600; color: var(--mm-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-bar__who small { font-size: .72rem; color: var(--mm-muted); margin-top: .05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-bar__muted[hidden] { display: none; }
.msg-bar__cog {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent;
  color: var(--mm-muted); cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.msg-bar__cog:hover, .msg-bar__cog:focus-visible { background: var(--mm-wash); color: var(--mm-brand); }

/* Notice strips under the bar (the App's .msg-avail) */
.msg-avail {
  flex: none; display: flex; align-items: flex-start; gap: .45rem; background: var(--mm-wash); color: var(--mm-brand);
  border-bottom: 1px solid var(--mm-line); padding: .6rem 1.1rem; font-size: .78rem; line-height: 1.4;
}
.msg-avail__icon { display: inline-flex; flex: none; margin-top: 1px; }
.msg-avail--warn, .msg-avail--held { background: #fff6e0; color: #6b4f00; border-bottom-color: #f0d9a0; }

/* The thread */
.msg-scroll {
  flex: 1 1 0; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  position: relative; display: flex; flex-direction: column; gap: 4px;
  background: var(--mm-chat); padding: .8rem .85rem 1rem;
}
/* "Loading earlier messages…" at the top of what has been loaded (the next page comes as you scroll up) */
.msg-older { text-align: center; font-size: .76rem; color: var(--mm-muted); padding: .35rem 0 .5rem; }
.msg-older[hidden] { display: none !important; }
.msg-day { text-align: center; margin: .9rem 0; }
.msg-day span { font-size: .72rem; font-weight: 500; color: var(--mm-muted); }
.msg-day__date { font-style: normal; }
.msg-sys { text-align: center; margin: .3rem 0; }
.msg-sys span { font-size: .72rem; color: var(--mm-muted); }
.msg-empty { text-align: center; color: var(--mm-muted); margin-top: 3rem; font-size: .95rem; }
.msg-empty--pane { margin: 3rem 1rem; line-height: 1.8; }

.msg-row { display: flex; flex-wrap: wrap; }
.msg-row--me   { justify-content: flex-end; }
.msg-row--them { justify-content: flex-start; }
.msg-row--first { margin-top: 14px; }
.msg-bubble {
  position: relative; max-width: 86%; padding: .6rem .8rem .45rem; border-radius: 16px;
  box-shadow: 0 1px 2px rgba(0, 54, 76, .04); display: flex; flex-direction: column;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.msg-bubble:focus { outline: 0; }
.msg-bubble:focus-visible { box-shadow: 0 0 0 2px var(--mm-brand); }
.msg-row--them .msg-bubble { background: var(--mm-paper); border: 1px solid var(--mm-line); color: var(--mm-ink); border-radius: 16px 16px 16px 4px; }
.msg-row--me .msg-bubble { background: var(--mm-out); color: var(--mm-out-ink); border: 1px solid transparent; border-radius: 16px 16px 4px 16px; }
/* Inside a run from one person the corners soften, so the run reads as one */
.msg-row--them:not(.msg-row--first) .msg-bubble { border-top-left-radius: 6px; }
.msg-row--me:not(.msg-row--first) .msg-bubble { border-top-right-radius: 6px; }
.msg-bubble__text { font-size: .95rem; line-height: 1.55; word-wrap: break-word; overflow-wrap: anywhere; -webkit-user-select: text; user-select: text; }
.msg-bubble__text--deleted { color: var(--mm-muted); font-style: italic; }
/* The sender's name sits ABOVE the first bubble of their run, not inside it */
.msg-row--them.msg-row--first:has(.msg-bubble__sender) { margin-top: 30px; }
.msg-bubble__sender {
  position: absolute; bottom: 100%; left: 4px; margin-bottom: 4px; white-space: nowrap;
  font-size: .72rem; font-weight: 600;
}
.msg-bubble__sender em {
  font-style: normal; font-size: .62rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--mm-brand); background: var(--mm-wash); border-radius: 99px; padding: 1px 6px; margin-left: 4px;
}
.msg-bubble__time { font-size: .66rem; color: var(--mm-muted); align-self: flex-end; margin-top: .2rem; }
.msg-row--me .msg-bubble__time { color: rgba(18, 62, 84, .72); }
.msg-link { color: var(--mm-brand); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.msg-row__held { flex-basis: 100%; text-align: right; font-size: .7rem; font-weight: 500; color: #8a5a00; margin: 3px 4px 0; }
.msg-row--picked .msg-bubble { box-shadow: 0 0 0 2px rgba(0, 94, 133, .45), 0 4px 14px rgba(0, 54, 76, .12); }
.msg-row.is-new .msg-bubble { animation: msgIn .2s ease-out; }
@keyframes msgIn { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

.msg-closed { flex: none; text-align: center; font-size: .82rem; color: var(--mm-muted); background: var(--mm-paper); border-top: 1px solid var(--mm-line); padding: .9rem 1rem; }

/* Composer */
.msg-composer {
  flex: none; position: relative; display: flex; align-items: flex-end; gap: .55rem;
  background: var(--mm-paper); border-top: 1px solid var(--mm-line); padding: .65rem .7rem;
}
.msg-composer textarea {
  flex: 1; min-width: 0; resize: none; max-height: 120px; min-height: 46px; box-sizing: border-box;
  font: inherit; font-size: 16px; line-height: 1.45; color: var(--mm-ink);   /* 16px: no iOS zoom */
  background: var(--mm-ground); border: 1px solid var(--mm-line); border-radius: 14px; padding: .65rem .8rem;
}
.msg-composer textarea::placeholder { color: var(--mm-muted); opacity: 1; }
.msg-composer textarea:focus { outline: 0; border-color: var(--mm-brand); box-shadow: 0 0 0 3px rgba(0, 94, 133, .12); background: var(--mm-paper); }
.msg-composer__send {
  flex: 0 0 46px; width: 46px; height: 46px; border: 0; border-radius: 13px; background: var(--mm-brand); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.msg-composer__send:active { filter: brightness(1.15); }
.msg-composer__send svg { width: 20px; height: 20px; }
.msg-composer.is-sending .msg-composer__send { opacity: .55; pointer-events: none; }
.msg-composer__hint { flex: none; background: var(--mm-paper); color: var(--mm-muted); font-size: .66rem; text-align: center; padding: 0 1rem .55rem; margin-top: -.25rem; }
@media (hover: none), (pointer: coarse) { .msg-composer__hint { display: none; } }

/* ── The action sheet (the App's phone picker: a bottom sheet over a dimmed thread) ─ */
.msg-sheet {
  position: fixed; inset: auto 10px calc(10px + env(safe-area-inset-bottom, 0px)) 10px; margin: 0 auto;
  width: auto; height: auto; max-width: min(440px, calc(100% - 20px)); max-height: 80dvh;
  border: 0; padding: 0; background: transparent; overflow: visible; color: var(--mm-ink); font-family: var(--mm-font);
}
.msg-sheet::backdrop { background: rgba(10, 32, 44, .32); }
.msg-picker__menu {
  display: flex; flex-direction: column; padding: 6px 0; max-height: 62vh; overflow-y: auto;
  background: var(--mm-paper); border: 1px solid var(--mm-line); border-radius: 18px; box-shadow: 0 10px 30px rgba(0, 54, 76, .16);
}
.msg-picker__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .3rem .4rem .45rem 1rem; border-bottom: 1px solid var(--mm-line); margin-bottom: 4px;
  font-size: .8rem; font-weight: 600; color: var(--mm-muted);
}
.msg-picker__close {
  width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--mm-muted);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.msg-picker__close:hover { background: var(--mm-ground); }
.msg-picker__grp { display: flex; flex-direction: column; padding: 2px 0; }
.msg-picker__grp + .msg-picker__grp { border-top: 1px solid var(--mm-line); margin-top: 4px; padding-top: 6px; }
.msg-picker__row {
  display: flex; align-items: center; gap: .8rem; width: 100%; min-height: 50px; border: 0; background: none;
  font: inherit; font-size: .95rem; color: var(--mm-ink); padding: .55rem 1rem; text-align: left; cursor: pointer;
}
.msg-picker__row:hover, .msg-picker__row:focus-visible { background: var(--mm-ground); outline: 0; }
.msg-picker__ic { width: 22px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; color: var(--mm-muted); }
.msg-picker__lbl { display: flex; flex-direction: column; line-height: 1.3; }
.msg-picker__lbl small { font-size: .72rem; color: inherit; opacity: .78; margin-top: 1px; }
.msg-picker__row--danger, .msg-picker__row--danger .msg-picker__ic { color: #b42318; }
.msg-picker__row--go { color: var(--mm-brand); font-weight: 600; }
.msg-sheet__p { margin: .4rem 1rem .6rem; font-size: .85rem; color: var(--mm-muted); line-height: 1.45; }
.msg-sheet__ta {
  display: block; box-sizing: border-box; width: calc(100% - 2rem); margin: 0 1rem .4rem; min-height: 76px; resize: vertical;
  font: inherit; font-size: 16px; color: var(--mm-ink); background: var(--mm-ground); border: 1px solid var(--mm-line); border-radius: 12px; padding: .55rem .7rem;
}

/* ── New message (the App's messages-new.php) ─────────────────────────── */
.msg-new { max-width: 680px; margin: 0 auto; }
.msg-newtabs { display: flex; gap: .5rem; margin: 0 0 .7rem; }
.msg-newtab {
  flex: 1; padding: .5rem; border: 1px solid var(--mm-line); border-radius: 10px; background: #fff;
  font: inherit; font-size: .9rem; font-weight: 600; color: var(--mm-ink); cursor: pointer;
}
.msg-newtab--on { background: var(--mm-brand); color: #fff; border-color: var(--mm-brand); }
.msg-new-search, .msg-group-name {
  width: 100%; box-sizing: border-box; padding: .6rem .8rem; border: 1px solid var(--mm-line); border-radius: 11px;
  font: inherit; font-size: 16px; color: var(--mm-ink); background: var(--mm-ground); margin-bottom: .7rem;
}
.msg-new-search:focus, .msg-group-name:focus { outline: none; border-color: var(--mm-brand); box-shadow: 0 0 0 3px rgba(0,94,133,.12); background: #fff; }
.msg-new [data-panel][hidden] { display: none; }
.msg-new .msg-list__h { margin-left: .2rem; }
.msg-person { margin: 0 0 .4rem; }
.msg-person[hidden] { display: none; }
.msg-person__btn {
  display: flex; align-items: center; gap: .6rem; width: 100%; box-sizing: border-box; background: #fff;
  border: 1px solid var(--mm-line); border-radius: 12px; padding: .5rem .7rem; font: inherit; color: var(--mm-ink);
  text-align: left; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.msg-person__btn:hover { background: var(--mm-ground); text-decoration: none; }
.msg-person__btn:active { background: var(--mm-wash); }
.msg-person__btn input { width: 18px; height: 18px; accent-color: var(--mm-brand); flex: none; }
.msg-person__name { flex: 1; min-width: 0; font-size: .92rem; font-weight: 600; }
.msg-person__sub { display: block; font-weight: 400; font-size: .76rem; color: var(--mm-muted); }
.msg-person__go { color: var(--mm-muted); font-size: 1.3rem; }

/* Who's in this group (2026-11-02): the bar's title block is a button in a group,
   and the list opens in the sheet — the App's cog panel members list, in our sheet. */
.msg-bar__who--btn { background: none; border: 0; padding: 0; margin: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; border-radius: 8px; }
.msg-bar__who--btn:hover strong, .msg-bar__who--btn:focus-visible strong { color: var(--mm-brand); }
.msg-bar__who--btn:focus-visible { outline: 2px solid var(--mm-brand); outline-offset: 2px; }
.msg-people { display: flex; flex-direction: column; padding: 2px 0 6px; }
.msg-people__row {
  display: flex; align-items: center; gap: .7rem; padding: .45rem 1rem; color: var(--mm-ink); text-decoration: none;
}
a.msg-people__row:hover, a.msg-people__row:focus-visible { background: var(--mm-ground); outline: 0; text-decoration: none; }
.msg-people__ava { width: 34px; height: 34px; flex: none; font-size: .8rem; }
.msg-people__name { flex: 1; min-width: 0; font-size: .92rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-people__sub { display: block; font-weight: 400; font-size: .76rem; color: var(--mm-muted); }
.msg-people__go { color: var(--mm-muted); font-size: 1.3rem; }
.msg-people__link { display: flex; align-items: center; gap: .7rem; flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.msg-people__link:hover .msg-people__name, .msg-people__link:focus-visible .msg-people__name { color: var(--mm-brand); }
/* Add people / Remove / Add (task 1635) */
.msg-people__add {
  display: flex; align-items: center; gap: .7rem; margin: 2px .6rem 6px; padding: .55rem .6rem; border: 0; border-radius: 12px;
  background: var(--mm-wash); color: var(--mm-brand); font: inherit; font-weight: 600; cursor: pointer; text-align: left;
}
.msg-people__add:hover, .msg-people__add:focus-visible { background: var(--mm-brand); color: #fff; outline: 0; }
.msg-people__plus { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #fff; color: var(--mm-brand); }
.msg-people__add:hover .msg-people__plus { color: var(--mm-brand); }
.msg-people__x, .msg-people__do {
  flex: none; border: 1px solid var(--mm-line); border-radius: 999px; padding: .3rem .7rem; background: #fff; color: var(--mm-muted);
  font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer;
}
.msg-people__x:hover, .msg-people__x:focus-visible { border-color: #b42318; color: #b42318; outline: 0; }
.msg-people__do { color: var(--mm-brand); border-color: var(--mm-brand); }
.msg-people__do:hover, .msg-people__do:focus-visible { background: var(--mm-brand); color: #fff; outline: 0; }
.msg-people__do:disabled, .msg-people__x:disabled { opacity: .6; cursor: progress; }
.msg-people__search {
  display: block; width: calc(100% - 2rem); margin: .2rem 1rem .4rem; padding: .5rem .8rem; border: 1px solid var(--mm-line); border-radius: 999px;
  font: inherit; font-size: .95rem; color: var(--mm-ink); background: var(--mm-ground);
}
.msg-people__search:focus { outline: 0; border-color: var(--mm-brand); background: #fff; }
.msg-hint { font-size: .78rem; color: var(--mm-muted); margin: .4rem .3rem .8rem; }
.msg-group-err { color: #842029; background: #f8d7da; border-radius: 10px; font-size: .88rem; font-weight: 600; padding: .55rem .8rem; margin: 0 0 .8rem; }
.msg-kind-pick { margin: 0 0 .4rem; }
.msg-kind__opt { display: flex; gap: .5rem; align-items: flex-start; padding: .3rem 0; cursor: pointer; }
.msg-kind__opt input { accent-color: var(--mm-brand); margin-top: .2rem; }
.msg-kind__opt span { display: flex; flex-direction: column; }
.msg-kind__opt strong { font-size: .9rem; font-weight: 600; }
.msg-kind__opt small { font-size: .76rem; color: var(--mm-muted); }
.msg-group-list { padding-bottom: 1rem; }
.msg-group-bar { position: sticky; bottom: 0; padding: .6rem 0 calc(.6rem + env(safe-area-inset-bottom, 0px)); background: var(--mm-paper); }
.msg-btn { width: 100%; font: inherit; font-weight: 600; border: 0; border-radius: 12px; padding: .8rem; cursor: pointer; background: var(--mm-brand); color: #fff; }

/* ── Page frames ───────────────────────────────────────────────────────── */
/* Phone (and the trainee app everywhere): a conversation pins the page to the
   screen and the thread scrolls inside it, as the App does (app.css
   body.msg-conv); the header and tabs go — the bar is the only header. */
html:not(.desktop) body.msg-conv {
  position: fixed; inset: 0; width: 100%; height: auto; box-sizing: border-box; min-height: 0;
  overflow: hidden; overscroll-behavior: none; display: flex; flex-direction: column;
}
html:not(.desktop) body.msg-conv > main, body.me.msg-conv > .me-main {
  flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; width: 100%; max-width: none; margin: 0; padding: 0;
}
html:not(.desktop) body.msg-conv .app-header, body.me.msg-conv .me-top, body.me.msg-conv .me-preview { display: none; }
body.me.msg-conv > .me-main { max-width: 640px; margin: 0 auto; }
@media (min-width: 660px) { body.me.msg-conv > .me-main { border-left: 1px solid var(--mm-line); border-right: 1px solid var(--mm-line); } }

/* Staff page: list + pane. A phone shows one at a time. */
.msg-page { display: flex; flex-direction: column; min-height: 0; }
.dk-msg-pane--empty, .msg-page--conv .dk-msg-side { display: none; }
.dk-msg-pane:not(.dk-msg-pane--empty) { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; min-width: 0; }
html:not(.desktop) .msg-page--conv { flex: 1 1 0; }

/* Desktop (html.desktop): the App's two panes, joined into one card */
html.desktop body.msg-body main { max-width: 1400px; padding-top: 16px; padding-bottom: 16px; }
html.desktop .msg-page {
  display: grid; grid-template-columns: 340px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 0;
  height: calc(100vh - var(--header-h) - 32px); height: calc(100dvh - var(--header-h) - 32px);
}
html.desktop .msg-page--conv .dk-msg-side, html.desktop .dk-msg-side {
  display: flex; flex-direction: column; min-height: 0; overflow: auto;
  background: var(--mm-paper); border: 1px solid var(--mm-line); border-right: 0; border-radius: 16px 0 0 16px; padding: .6rem .6rem 1rem;
}
html.desktop .dk-msg-pane, html.desktop .dk-msg-pane--empty {
  display: flex; flex-direction: column; min-height: 0; background: var(--mm-chat);
  border: 1px solid var(--mm-line); border-radius: 0 16px 16px 0; overflow: hidden;
}
html.desktop .dk-msg-pane--empty { align-items: center; justify-content: center; color: var(--mm-muted); }
.dk-msg-empty { text-align: center; font-size: 14px; }
.dk-msg-empty svg { display: block; margin: 0 auto 8px; opacity: .4; }
html.desktop .msg-bar { padding: .7rem 1.1rem; gap: .7rem; min-height: 68px; }
html.desktop .msg-bar .msg-ava { width: 40px; height: 40px; flex-basis: 40px; }
html.desktop .msg-bar__back { display: none; }   /* the list is right there */
html.desktop .msg-scroll { padding: 1.1rem max(1.6rem, calc((100% - 760px) / 2)) 1.3rem; }
html.desktop .msg-bubble { max-width: 72%; }
html.desktop .msg-bubble__text { font-size: .9rem; }
html.desktop .msg-composer { padding: .75rem 1.1rem .8rem; }
html.desktop .msg-head { margin-top: .4rem; }
/* Inside the App's frame on a desktop there's less height to spare */
html.desktop body.embedded .msg-page { height: calc(100vh - var(--header-h) - 24px); height: calc(100dvh - var(--header-h) - 24px); }
html.desktop body.embedded.msg-body main { padding-top: 12px; padding-bottom: 12px; }

/* ── Photos and files (2026-11-04) — the App's attachment rules (app.css
   "Messenger attachments", messages-v2.css composer) on our tokens. Class
   names are the App's: keep these in step with it. ────────────────────── */
/* The paperclip sits INSIDE the field, as the App's v2 design draws it */
.msg-composer:has(.msg-composer__attach) textarea { padding-left: 2.9rem; }
.msg-composer__attach {
  position: absolute; z-index: 1; left: calc(.7rem + 5px); bottom: calc(.65rem + 5px);
  width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent;
  color: var(--mm-muted); font-size: 1.25rem; line-height: 1; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
html.desktop .msg-composer__attach { left: calc(1.1rem + 5px); bottom: calc(.8rem + 5px); }
.msg-composer__attach:hover, .msg-composer__attach:focus-visible { background: var(--mm-wash); color: var(--mm-brand); outline: 0; }
.msg-composer__attach[disabled] { opacity: .4; cursor: default; }
.msg-composer__send[disabled] { opacity: .45; cursor: default; }
.msg-composer.msg-drop--over { outline: 2px dashed var(--mm-brand); outline-offset: -6px; }

/* Pending uploads: chips above the composer until Send */
.msg-attach-strip { flex: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: .45rem .75rem 0; background: var(--mm-paper); border-top: 1px solid var(--mm-line); }
.msg-attach-strip:not([hidden]) + .msg-composer { border-top: 0; }
.msg-attach-strip[hidden] { display: none !important; }   /* the [hidden] trap — flex beats the UA rule */
.msg-attach-chip {
  display: inline-flex; align-items: center; gap: .35rem; max-width: 100%;
  padding: .25rem .35rem .25rem .5rem; background: var(--mm-ground); border: 1px solid var(--mm-line);
  border-radius: 999px; font-size: .8rem; color: var(--mm-ink);
}
.msg-attach-chip img { width: 28px; height: 28px; object-fit: cover; border-radius: 6px; }
.msg-attach-chip__name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-attach-chip__x { border: 0; background: transparent; color: var(--mm-muted); font-size: 1rem; line-height: 1; padding: 0 .2rem; cursor: pointer; }
.msg-attach-chip--busy { opacity: .6; }
.msg-attach-chip--busy .msg-attach-chip__name::after { content: ' …'; }
.msg-attach-chip--err { background: #fbe6e6; border-color: #e8b4b4; color: #a02020; }

/* In the bubble */
.msg-att { display: block; text-decoration: none; color: inherit; margin: .15rem 0 .3rem; -webkit-user-select: none; user-select: none; }
.msg-att--img { -webkit-touch-callout: none; }   /* no iOS "Save Image" sheet over our viewer */
.msg-att--img img { display: block; width: auto; height: auto; max-width: min(100%, 320px); max-height: 320px; border-radius: 10px; background: var(--mm-wash); }
.msg-att--file {
  display: flex; align-items: center; gap: .5rem; padding: .45rem .6rem;
  background: rgba(0, 0, 0, .06); border-radius: 9px; font-size: .85rem;
}
.msg-row--me .msg-att--file { background: rgba(255, 255, 255, .45); }
.msg-att__icon { font-size: 1.25rem; line-height: 1; }
.msg-att__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.msg-att__size { font-size: .72rem; opacity: .75; white-space: nowrap; }
.msg-atts + .msg-bubble__text, .msg-doc + .msg-bubble__text, .msg-att--video + .msg-bubble__text { margin-top: .35rem; }

/* Album grid: one photo keeps a fixed square frame (so a thread pinned to the
   bottom never jumps as pictures land); two to four tile up; past four the
   fourth wears "+N" and the rest stay in the DOM hidden for the viewer. */
.msg-atts { display: grid; gap: 3px; max-width: min(100%, 320px); margin: .15rem 0 .3rem; }
.msg-atts--1 { display: block; }
.msg-atts--1 .msg-att--img img { width: min(100%, 240px); height: auto; max-height: none; aspect-ratio: 1 / 1; object-fit: cover; }
.msg-atts--2, .msg-atts--3, .msg-atts--4 { grid-template-columns: 1fr 1fr; }
.msg-atts--3 .msg-att:first-child { grid-column: 1 / -1; }
.msg-atts .msg-att { margin: 0; position: relative; }
.msg-atts .msg-att[hidden] { display: none !important; }
.msg-atts:not(.msg-atts--1) .msg-att--img img { width: 100%; height: 100%; max-width: none; max-height: none; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 8px; }
.msg-atts--3 .msg-att:first-child img { aspect-ratio: 2 / 1; }
.msg-att[data-more]::after {
  content: attr(data-more); position: absolute; inset: 0; border-radius: 8px; background: rgba(12, 18, 24, .55);
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em;
}

/* Video in a bubble: the box takes the clip's shape before a byte loads */
.msg-video { position: relative; width: 320px; max-width: 100%; aspect-ratio: 16 / 9; background: #111; border-radius: 10px; overflow: hidden; margin: .15rem 0 .2rem; }
.msg-video__player { display: block; width: 100%; height: 100%; object-fit: contain; background: #111; }
.msg-video--bad .msg-video__player { opacity: .35; }
.msg-video__note { position: absolute; left: .5rem; right: .5rem; bottom: .5rem; color: #fff; font-size: .78rem; line-height: 1.3; text-align: center; background: rgba(0, 0, 0, .65); border-radius: 6px; padding: .35rem .5rem; pointer-events: none; }
.msg-att--video { max-width: 320px; }

/* The document card: badge, name and "PDF · size", then Open / Save */
.msg-doc { display: flex; flex-direction: column; min-width: 220px; max-width: 320px; border-radius: 10px; overflow: hidden; background: rgba(0, 0, 0, .05); margin: .15rem 0 .3rem; }
.msg-row--me .msg-doc { background: rgba(255, 255, 255, .55); }
.msg-doc + .msg-doc { margin-top: .4rem; }
.msg-doc .msg-doc__main { background: transparent; border-radius: 0; padding: .6rem .7rem; gap: .65rem; margin: 0; text-decoration: none; color: inherit; }
.msg-doc .msg-doc__main:hover { background: rgba(0, 0, 0, .04); }
.msg-doc__badge { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; min-width: 2.6rem; height: 2.2rem; padding: 0 .35rem; border-radius: 6px;
                  font-size: .66rem; font-weight: 800; letter-spacing: .03em; color: #fff; background: #6b7280; }
.msg-doc--pdf .msg-doc__badge    { background: #d93025; }
.msg-doc--doc .msg-doc__badge    { background: #2b579a; }
.msg-doc--sheet .msg-doc__badge  { background: #1e7145; }
.msg-doc--slides .msg-doc__badge { background: #c43e1c; }
.msg-doc--zip .msg-doc__badge    { background: #8a5a00; }
.msg-doc--audio .msg-doc__badge  { background: #7c3aed; }
.msg-doc__tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.msg-doc__tx .msg-att__name { white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.msg-doc__preview { display: block; height: 150px; overflow: hidden; background: #fff; border-bottom: 1px solid rgba(0, 0, 0, .08); }
.msg-doc__preview img { display: block; width: 100%; height: auto; min-height: 100%; object-fit: cover; object-position: top; }
.msg-doc__acts { display: flex; border-top: 1px solid rgba(0, 0, 0, .08); }
.msg-doc__btn { flex: 1; text-align: center; padding: .5rem .4rem; font-size: .85rem; font-weight: 600; color: var(--mm-brand); text-decoration: none; }
.msg-doc__btn + .msg-doc__btn { border-left: 1px solid rgba(0, 0, 0, .08); }
.msg-doc__btn:hover { background: rgba(0, 0, 0, .04); }

/* The image viewer: the original, full screen, with Download / Open / Copy / Close and prev/next */
.msg-lb { position: fixed; inset: 0; z-index: 500; background: rgba(10, 14, 18, .94); display: flex; flex-direction: column; color: #fff; font-family: var(--mm-font); }
.msg-lb[hidden] { display: none !important; }
body.msg-lb-open { overflow: hidden; }
.msg-lb__bar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .6rem .9rem; padding-top: max(.6rem, env(safe-area-inset-top)); background: rgba(0, 0, 0, .35); }
.msg-lb__title { min-width: 0; display: flex; flex-direction: column; }
.msg-lb__name { font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-lb__meta { font-size: .75rem; opacity: .7; }
.msg-lb__acts { display: flex; gap: .4rem; flex-shrink: 0; }
.msg-lb__btn {
  display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .8rem; border-radius: 999px;
  background: rgba(255, 255, 255, .14); color: #fff; text-decoration: none; font: inherit; font-size: .85rem; font-weight: 600;
  border: 0; cursor: pointer; min-height: 40px;
}
.msg-lb__btn:hover, .msg-lb__btn:focus-visible { background: rgba(255, 255, 255, .26); outline: none; }
.msg-lb__btn--dl { background: var(--mm-brand); }
.msg-lb__btn--dl:hover { background: #0b7bb0; }
.msg-lb__btn--x { padding: .45rem .7rem; font-size: 1rem; }
.msg-lb__btn--copy[hidden] { display: none; }
.msg-lb__btn--copy.is-done { background: #1b7f5a; }
.msg-lb__btn--copy.is-fail { background: #b3261e; }
.msg-lb__btn--copy.is-busy { opacity: .75; }
.msg-lb__stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; padding: .5rem; touch-action: none; overflow: hidden; }
.msg-lb__img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); transform-origin: center center; user-select: none; -webkit-user-drag: none; }
.msg-lb.is-zoomed .msg-lb__stage { cursor: grab; }
.msg-lb.is-zoomed .msg-lb__nav { display: none; }
.msg-lb__spin { position: absolute; right: 14px; bottom: 14px; width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: msglb-spin .8s linear infinite; }
.msg-lb__spin[hidden] { display: none; }
@keyframes msglb-spin { to { transform: rotate(360deg); } }
.msg-lb__nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 64px; border: 0; border-radius: 10px;
  background: rgba(255, 255, 255, .12); color: #fff; font-size: 2rem; line-height: 1; cursor: pointer;
}
.msg-lb__nav[hidden] { display: none; }
.msg-lb__nav:hover { background: rgba(255, 255, 255, .24); }
.msg-lb__nav--prev { left: 10px; }
.msg-lb__nav--next { right: 10px; }
@media (max-width: 600px) { .msg-lb__nav { display: none; } }     /* swipe instead; arrows crowd a phone */
/* A phone has room for the photo's name OR the buttons, not both: the name gets
   its own line, and Open (Download covers it) goes. */
@media (max-width: 520px) {
  .msg-lb__bar { flex-wrap: wrap; row-gap: .4rem; }
  .msg-lb__title { flex: 1 1 100%; }
  .msg-lb__acts { flex: 1 1 100%; justify-content: flex-end; }
  .msg-lb__btn[data-open] { display: none; }
}
@media (prefers-reduced-motion: reduce) { .msg-lb__spin { animation: none; } }

/* ── The messenger review (2026-11-04): reply quotes, read ticks, New messages,
   Jump to latest, the reply bar, Seen by — the App's rules on our tokens. ── */
.msg-quote {
  display: block; max-width: 100%; margin: 0 0 .4rem; padding: .35rem .55rem; cursor: pointer;
  border-left: 3px solid var(--mm-brand); border-radius: 6px; background: rgba(0, 94, 133, .06);
}
.msg-row--me .msg-quote { background: rgba(255, 255, 255, .55); }
.msg-quote--gone { cursor: default; font-style: italic; }
.msg-quote__name { display: block; font-size: .7rem; font-weight: 600; color: var(--mm-brand); }
.msg-quote__body { display: block; font-size: .78rem; color: var(--mm-ink); opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* jump-to-original flash */
.msg-row--flash .msg-bubble { animation: msgflash 1.6s ease; }
@keyframes msgflash { 0%, 40% { box-shadow: 0 0 0 3px rgba(0, 94, 133, .45); } 100% { box-shadow: 0 1px 2px rgba(0, 54, 76, .04); } }
@media (prefers-reduced-motion: reduce) { .msg-row--flash .msg-bubble { animation: none; outline: 2px solid var(--mm-brand); } }
/* Read receipts: ✓ sent, ✓✓ read — a 1:1 when they have, a group when everyone has */
.msg-row--me .msg-bubble__time::after { content: " \2713"; color: rgba(18, 62, 84, .45); letter-spacing: -.12em; }
.msg-row--me.msg-row--read .msg-bubble__time::after { content: " \2713\2713"; color: var(--mm-brand); }
.msg-row--deleted .msg-bubble__time::after { content: none; }
/* "New messages": a line before the first message unread when the page opened */
.msg-newline { display: flex; align-items: center; gap: .7rem; margin: 1rem 0 .4rem; }
.msg-newline::before, .msg-newline::after { content: ""; flex: 1; height: 1px; background: rgba(0, 94, 133, .28); }
.msg-newline span { font-size: .7rem; font-weight: 600; letter-spacing: .04em; color: var(--mm-brand); text-transform: uppercase; }
/* Jump to latest: at the foot of the conversation, only when you are well up; counts what arrived meanwhile */
.msg-main { position: relative; }
.msg-jump {
  position: absolute; right: 18px; z-index: 25; display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem .85rem; border-radius: 999px; border: 1px solid var(--mm-line); background: var(--mm-paper);
  color: var(--mm-brand); font: inherit; font-family: var(--mm-font); font-size: .78rem; font-weight: 600;
  box-shadow: 0 6px 18px rgba(0, 54, 76, .16); cursor: pointer;
}
.msg-jump[hidden] { display: none; }
.msg-jump--new { background: var(--mm-brand); color: #fff; border-color: var(--mm-brand); }
/* "Replying to …" above the composer (the App's .msg-editing bar) */
.msg-editing {
  flex: none; display: flex; align-items: center; gap: .5rem; font-size: .8rem; color: var(--mm-brand);
  padding: .45rem 1rem .15rem; background: var(--mm-paper); border-top: 1px solid var(--mm-line);
}
.msg-editing[hidden] { display: none !important; }
.msg-editing:not([hidden]) + .msg-attach-strip, .msg-editing:not([hidden]) + .msg-composer { border-top: 0; }
.msg-editing button { margin-left: auto; border: 0; background: none; color: var(--mm-muted); font-size: .9rem; cursor: pointer; padding: .2rem .4rem; }
.msg-replying__who { font-weight: 700; white-space: nowrap; }
.msg-replying__snip { color: var(--mm-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
/* Seen by: the people list, with a dimmer "Not yet" */
.msg-people__h { font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--mm-muted); margin: .5rem 1rem .2rem; }
.msg-people__row--dim { opacity: .6; }
/* Search inside messages (item 5): "People and groups" over the filtered list, then the hits */
.msg-search__head { font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--mm-muted); margin: .2rem .2rem .35rem; font-family: var(--mm-font); }
.msg-search__head[hidden] { display: none; }
.msg-search__hits { margin-top: .6rem; display: flex; flex-direction: column; gap: .35rem; font-family: var(--mm-font); }
.msg-search__hits[hidden] { display: none !important; }
.msg-hit {
  display: flex; flex-direction: column; gap: .15rem; text-decoration: none; color: var(--mm-ink);
  background: var(--mm-paper); border: 1px solid var(--mm-line); border-radius: 12px; padding: .5rem .75rem;
}
.msg-hit:hover, .msg-hit:focus-visible { border-color: var(--mm-brand); outline: none; }
.msg-hit__top { display: flex; justify-content: space-between; gap: .5rem; font-size: .8rem; }
.msg-hit__thread { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-hit__when { color: var(--mm-muted); white-space: nowrap; }
.msg-hit__snip { font-size: .86rem; color: #4a5560; line-height: 1.3; }
.msg-hit__snip b { color: var(--mm-ink); font-weight: 600; }
.msg-hit mark { background: #ffe58a; color: inherit; border-radius: 3px; padding: 0 1px; }
/* @mentions (item 10): lit in the bubble; the picker rises from the composer */
.msg-mention { color: var(--mm-brand); font-weight: 600; background: var(--mm-wash); border-radius: 4px; padding: 0 .15em; }
.msg-row--me .msg-mention { background: rgba(0, 94, 133, .12); }
.msg-mention-pick {
  position: absolute; left: .7rem; right: .7rem; bottom: 100%; z-index: 20; margin-bottom: .25rem; overflow: hidden;
  background: var(--mm-paper); border: 1px solid var(--mm-line); border-radius: 12px; box-shadow: 0 -4px 18px rgba(0, 54, 76, .14);
}
.msg-mention-pick[hidden] { display: none; }
.msg-mention-pick__row {
  display: flex; align-items: center; gap: .55rem; width: 100%; text-align: left; padding: .5rem .8rem;
  background: none; border: 0; border-bottom: 1px solid var(--mm-line); font: inherit; font-weight: 600; color: var(--mm-ink); cursor: pointer;
}
.msg-mention-pick__row:last-child { border-bottom: 0; }
.msg-mention-pick__row.is-sel, .msg-mention-pick__row:hover { background: var(--mm-wash); }
.msg-mention-pick__row .msg-ava { width: 28px; height: 28px; flex-basis: 28px; font-size: .7rem; }
.msg-mention-pick__row small { font-weight: 400; color: var(--mm-muted); margin-left: auto; font-size: .72rem; }
/* Forward (item 9): what is being sent on, a note, a tick list, a sticky button */
.msg-fwd__src, .msg-fwd__note { background: var(--mm-paper); border: 1px solid var(--mm-line); border-radius: 12px; padding: .7rem .9rem; margin: 0 0 .7rem; }
.msg-fwd__lbl { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--mm-muted); margin-bottom: .25rem; }
.msg-fwd__body { font-size: .9rem; color: var(--mm-ink); }
.msg-fwd__note textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: 16px; padding: .5rem .7rem; border: 1px solid var(--mm-line); border-radius: 12px; resize: none; background: var(--mm-ground); color: var(--mm-ink); }
.msg-fwd__list { background: var(--mm-paper); border: 1px solid var(--mm-line); border-radius: 12px; overflow: hidden; margin-top: .6rem; }
.msg-fwd__row { display: flex; align-items: center; gap: .6rem; margin: 0; padding: .5rem .8rem; border-top: 1px solid var(--mm-line); cursor: pointer; }
.msg-fwd__row:first-child { border-top: 0; }
.msg-fwd__row[hidden] { display: none !important; }
.msg-fwd__row:has(.msg-fwd__tick:checked) { background: var(--mm-wash); }
.msg-fwd__tick { width: 1.15rem; height: 1.15rem; flex: 0 0 auto; accent-color: var(--mm-brand); margin: 0; }
.msg-fwd__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: .92rem; }
.msg-fwd__name small { font-weight: 400; color: var(--mm-muted); margin-left: .3rem; }
.msg-fwd__bar { position: sticky; bottom: 0; z-index: 5; padding: .6rem 0 .5rem; margin-top: .6rem; background: var(--mm-paper); border-top: 1px solid var(--mm-line); }
.msg-fwd__send { width: 100%; border: 0; border-radius: 12px; background: var(--mm-brand); color: #fff; font: inherit; font-weight: 600; font-size: .95rem; padding: .7rem 1rem; cursor: pointer; }
.msg-fwd__send:disabled { opacity: .5; cursor: default; }
/* Archived (item 11): folded under the list unless opened, or while searching */
.msg-list:not(.msg-list--searching):not(.msg-list--show-archived) .msg-item--archived { display: none; }
.msg-item--archived { opacity: .7; }
.msg-archived-btn {
  display: inline-flex; align-items: center; gap: .4rem; margin: .4rem auto 0; font: inherit; font-family: var(--mm-font); font-size: .85rem; font-weight: 600;
  color: var(--mm-muted); background: transparent; border: 0; padding: .4rem .6rem; cursor: pointer; border-radius: 8px;
}
.msg-archived-btn:hover { background: var(--mm-wash); }
.msg-archived-btn[aria-expanded="true"] { color: var(--mm-brand); }
.msg-people__adm { margin-right: .35rem; }
/* The rename sheet (item 8) */
.msg-sheet__in { display: block; box-sizing: border-box; width: calc(100% - 2rem); margin: 0 1rem .4rem; font: inherit; font-size: 16px; color: var(--mm-ink); background: var(--mm-ground); border: 1px solid var(--mm-line); border-radius: 12px; padding: .55rem .7rem; }
/* What happened to a send that did not go (item 6): a line above the box, never a pop-up */
.msg-send-hint { flex: none; background: var(--mm-paper); color: #8a3b12; font-size: .78rem; font-weight: 500; padding: .45rem 1.1rem 0; }
.msg-send-hint[hidden] { display: none !important; }

/* ── Reactions (item 12) — the App's messages-v2.css rule for rule: the emoji
   row floats above the sheet's menu (a pill bar, the + opening a palette), the
   pills sit under the bubble on its side, a tap on a pill shows who. ───────── */
.msg-sheet[open] { display: flex; flex-direction: column; gap: 8px; }
.msg-picker__emoji {
  display: flex; gap: 2px; justify-content: space-between; align-items: center; flex: none;
  background: var(--mm-paper); border: 1px solid var(--mm-line); border-radius: 999px;
  padding: 8px 10px; box-shadow: 0 8px 24px rgba(0, 54, 76, .14);
}
.msg-picker__btn { border: 0; background: none; font-size: 1.45rem; line-height: 1; padding: 6px; border-radius: 50%; cursor: pointer; color: inherit; }
.msg-picker__btn:hover, .msg-picker__btn:focus-visible { background: var(--mm-ground); outline: 0; }
.msg-picker__btn:active { transform: scale(1.15); }
.msg-picker__more {
  border: 0; background: var(--mm-ground); color: var(--mm-brand); width: 34px; height: 34px; flex: 0 0 auto;
  font: inherit; font-size: 1.15rem; line-height: 1; border-radius: 50%; cursor: pointer;
}
.msg-picker__more:hover { background: var(--mm-line); }
.msg-picker__palette {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: .1rem; flex: none;
  background: var(--mm-paper); border: 1px solid var(--mm-line); border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 54, 76, .14); padding: 8px;
}
.msg-picker__palette[hidden] { display: none !important; }   /* grid — the usual trap */
.msg-picker__pal { border: 0; background: none; font-size: 1.25rem; line-height: 1; padding: .3rem 0; border-radius: 8px; cursor: pointer; color: inherit; }
.msg-picker__pal:hover, .msg-picker__pal:focus-visible { background: var(--mm-ground); outline: 0; }
.msg-reacts { display: flex; flex-wrap: wrap; gap: .25rem; flex-basis: 100%; margin: 4px 0 0; padding: 0 4px; align-items: flex-end; }
.msg-reacts[hidden] { display: none !important; }   /* flex — the usual trap */
.msg-row--me .msg-reacts { justify-content: flex-end; }
.msg-react {
  background: var(--mm-paper); border: 1px solid var(--mm-line); border-radius: 20px;
  padding: 2px 9px; font-size: .8rem; line-height: 1.45; color: var(--mm-ink); cursor: pointer;
}
.msg-react--mine { border-color: var(--mm-brand); background: var(--mm-wash); }
.msg-react:focus-visible { outline: 2px solid var(--mm-brand); outline-offset: 1px; }
.msg-react-who {
  flex-basis: 100%; background: var(--mm-paper); border: 1px solid var(--mm-line); border-radius: 10px;
  padding: .35rem .55rem; font-size: .8rem; color: var(--mm-ink); box-shadow: 0 4px 14px rgba(0, 54, 76, .12); margin-top: .15rem;
}
.msg-react-who__line { display: flex; gap: .4rem; align-items: baseline; padding: .1rem 0; }
.msg-react-who__em { flex: none; }

/* ── Edit, pins, typing, link previews (the review's last items) — the App's
   app.css / messages-v2.css rule for rule ──────────────────────────────── */
.msg-edited { font-size: .65rem; opacity: .8; font-style: italic; margin-right: .2rem; }
/* The two bars under the header: the group's note (amber) and the pinned message (blue) */
.msg-pin {
  display: flex; align-items: flex-start; gap: .6rem; flex: none; margin: 0; padding: .7rem 1.1rem;
  background: #fff8e6; border: 1px solid #f1dfae; border-width: 0 0 1px; font-family: var(--mm-font);
}
.msg-pin[hidden] { display: none !important; }
.msg-pin__ic { flex: 0 0 auto; color: #a8730a; display: inline-flex; margin-top: .1rem; }
.msg-pin__tx { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: .84rem; line-height: 1.4; color: var(--mm-ink); overflow-wrap: anywhere; }
.msg-pin__tx strong { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: #8a5a00; margin-bottom: .1rem; }
.msg-pin__ok {
  flex: 0 0 auto; align-self: center; display: inline-flex; align-items: center; gap: .3rem;
  border: 1px solid #e5c97a; background: #fff; color: #6b4600; border-radius: 999px; padding: .35rem .7rem;
  font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer;
}
.msg-pin__ok:hover { background: #fff1c9; }
.msg-pinmsg { background: #eef5fa; border-color: #cfe2ee; cursor: pointer; }
.msg-pinmsg .msg-pin__ic { color: #2c6e95; }
.msg-pinmsg .msg-pin__tx strong { color: #24597a; }
.msg-pinmsg:focus-visible { outline: 2px solid #2c6e95; outline-offset: -2px; }
.msg-pinmsg__short[hidden], .msg-pinmsg__full[hidden] { display: none; }
.msg-pinmsg__more { align-self: flex-start; margin-top: .2rem; padding: 0; border: 0; background: none; color: #2c6e95; font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; text-decoration: underline; }
/* the admins' note box in the sheet */
.msg-pin-keep { display: flex; gap: .55rem; align-items: flex-start; margin: .2rem 1rem .5rem; font-size: .88rem; cursor: pointer; color: var(--mm-ink); }
.msg-pin-keep input { margin-top: .2rem; width: 18px; height: 18px; flex: 0 0 auto; }
.msg-pin-keep span { display: flex; flex-direction: column; }
.msg-pin-keep small { color: var(--mm-muted); font-size: .76rem; }
.msg-sheet__p--count { margin-top: -.2rem; font-size: .76rem; }
/* The link's card under the words */
.msg-pv {
  display: block; margin: .35rem 0 .2rem; max-width: min(100%, 320px);
  border-radius: 10px; overflow: hidden; text-decoration: none; color: inherit;
  background: rgba(0, 0, 0, .06); border: 1px solid var(--mm-line);
}
.msg-row--me .msg-pv { background: rgba(0, 94, 133, .07); }
.msg-pv__img { display: block; }
.msg-pv__img[hidden] { display: none !important; }
.msg-pv__img img { display: block; width: 100%; max-height: 170px; object-fit: cover; }
.msg-pv__text { display: flex; flex-direction: column; gap: .1rem; padding: .45rem .6rem .5rem; }
.msg-pv__title { font-weight: 700; font-size: .86rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.msg-pv__desc { font-size: .78rem; line-height: 1.3; opacity: .85; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.msg-pv__host { font-size: .7rem; opacity: .65; margin-top: .1rem; }
/* Typing: the grey "them" bubble with three pulsing dots and the little trailing circles */
.msg-typing[hidden] { display: none !important; }
.msg-typing { animation: msgtype-in .18s ease-out; }
.msg-row--them .msg-bubble--typing {
  position: relative; background: #e5e5ea; color: #8e8e93; border-color: transparent;
  padding: .55rem .8rem; margin-left: .35rem; margin-bottom: .35rem; border-bottom-left-radius: 16px; min-width: 0;
}
.msg-bubble--typing::before, .msg-bubble--typing::after { content: ""; position: absolute; background: #e5e5ea; border-radius: 50%; }
.msg-bubble--typing::before { width: 10px; height: 10px; left: -3px; bottom: -2px; }
.msg-bubble--typing::after  { width: 5px;  height: 5px;  left: -9px; bottom: -7px; }
.msg-bubble--typing .msg-bubble__sender { color: #6b7a86; margin-bottom: .2rem; }
.msg-typing__dots { display: inline-flex; gap: 5px; align-items: center; height: 12px; }
.msg-typing__dots i { width: 8px; height: 8px; border-radius: 50%; background: #9a9aa0; animation: msgtype 1.4s ease-in-out infinite; }
.msg-typing__dots i:nth-child(2) { animation-delay: .18s; }
.msg-typing__dots i:nth-child(3) { animation-delay: .36s; }
.msg-typing__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@keyframes msgtype    { 0%, 55%, 100% { opacity: .35; transform: scale(.85); } 25% { opacity: 1; transform: scale(1.1); } }
@keyframes msgtype-in { from { opacity: 0; transform: translateY(6px) scale(.9); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .msg-typing__dots i { animation: none; opacity: .7; } .msg-typing { animation: none; } }
