.staff-chat { --chat-text-size:17px; margin:0; background:var(--bmsr-bg); color:var(--bmsr-navy-950); font-family:var(--app-font); }
.staff-chat #messages.chat-text-large { --chat-text-size:21px; }
.staff-chat * { box-sizing:border-box; }
.staff-chat [hidden] { display:none !important; }
.staff-chat button,.staff-chat input,.staff-chat textarea,.staff-chat select { font:inherit; }
.staff-chat button { cursor:pointer; color:var(--bmsr-navy-700); border:1px solid var(--bmsr-navy-100); background:var(--bmsr-card); }
.staff-chat button:disabled { opacity:.55; cursor:wait; }
.staff-chat :focus-visible { outline:3px solid var(--bmsr-navy-500); outline-offset:3px; }
.chat-screen { max-width:720px; margin:20px auto 0; border:1px solid var(--bmsr-navy-100); border-radius:18px; overflow:hidden; height:calc(100dvh - 152px); min-height:460px; display:flex; flex-direction:column; background:var(--bmsr-bg); box-shadow:var(--bmsr-shadow-mid); }
.list-tools { display:grid; grid-template-columns:max-content minmax(0,1fr) max-content 44px; align-items:center; gap:6px; padding:10px 20px; }
.staff-chat .list-tools h1 { font-size:20px; }
.staff-chat .list-tools .orange { padding:10px; white-space:nowrap; }
.staff-chat #alerts-status { min-width:44px; min-height:44px; padding:6px 8px; line-height:15px; justify-self:end; }
.staff-chat #title-groups { min-height:44px; order:1; grid-column:1 / -1; }
.staff-chat h1 { margin:0; font-size:24px; font-weight:800; }
.staff-chat .orange { background:var(--bmsr-orange-500); color:var(--bmsr-navy-950); border:0; border-radius:99px; font-size:13px; font-weight:800; padding:12px 18px; min-height:44px; }
.chat-scroll { flex:1; min-height:0; overflow:auto; overscroll-behavior:contain; }
#conversation { position:relative; display:flex; flex-direction:column; overflow:hidden; }
#status { color:var(--bmsr-navy-500); font-size:13px; margin:0; padding:0 20px; }
#status:empty { display:none; }
#status.error { color:var(--bmsr-navy-950); background:var(--bmsr-orange-100); padding:10px 20px; }
.staff-chat .section-label { font-size:11px; font-weight:800; letter-spacing:.09em; text-transform:uppercase; color:var(--bmsr-navy-500); margin:0; padding:16px 20px 8px; }
.staff-chat .space-row { width:100%; display:flex; gap:10px; align-items:center; text-align:left; padding:10px 20px; border-width:0 0 1px; border-color:var(--bmsr-navy-50); min-height:44px; background:var(--bmsr-card); }
@media (hover:hover) and (pointer:fine) {
  .staff-chat .space-row:hover { background:var(--bmsr-navy-50); }
}
.staff-chat .space-row:active { background:var(--bmsr-navy-50); }
.avatar { flex:none; width:32px; height:32px; border-radius:50%; background:var(--bmsr-navy-100); color:var(--bmsr-navy-700); display:grid; place-items:center; font-size:12px; font-weight:800; }
.avatar.group { border-radius:10px; }
.avatar.sop { background:var(--bmsr-orange-100); color:var(--bmsr-orange-600); }
.row-copy { flex:1; min-width:0; }
.row-name { display:flex; justify-content:space-between; align-items:baseline; gap:8px; font-size:15px; line-height:18px; font-weight:800; color:var(--bmsr-navy-950); }
.row-name time { color:var(--bmsr-navy-500); font-size:11px; font-weight:600; white-space:nowrap; }
.preview { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--bmsr-navy-500); font-size:13px; line-height:16px; margin-top:1px; }
.unread .preview { color:var(--bmsr-navy-950); font-weight:700; }
.badge { background:var(--bmsr-orange-500); color:var(--bmsr-navy-950); border-radius:99px; min-width:24px; height:24px; display:grid; place-items:center; padding:0 7px; font-size:12px; font-weight:800; }
.staff-chat p.empty { margin:8px 20px 18px; color:var(--bmsr-navy-500); font-size:13px; }
.record-footer { flex:none; background:var(--bmsr-orange-100); color:var(--bmsr-navy-950); border-top:1px solid var(--bmsr-orange-200); font-size:12.5px; line-height:1.5; font-weight:600; margin:0; padding:10px 16px; }
.record-footer::before { content:""; display:inline-block; width:7px; height:7px; border-radius:50%; background:var(--bmsr-orange-500); margin-right:8px; }
/* Query the strip itself, including dialog strips with negative margins. Older
   engines keep the wrapping 12.5px fallback above. The copy is at most 19.0em
   wide in Manrope 600 or Arial; reserve another 15px for the unchanged dot and gap. */
@supports (container-type:inline-size) and (font-size:1cqw) {
  .record-footer { container-type:inline-size; white-space:nowrap; -webkit-text-size-adjust:100%; text-size-adjust:100%; }
  .record-footer-copy { font-family:Manrope,Arial,sans-serif; font-size:min(12.5px, calc((100cqw - 15px) / 19.0)); }
}
.conversation-title { display:flex; align-items:center; gap:12px; padding:14px 16px; background:var(--bmsr-navy-700); color:white; }
.staff-chat .conversation-title h1 { font-size:18px; color:white; overflow-wrap:anywhere; }
.conversation-title p { margin:3px 0 0; color:var(--bmsr-navy-100); font-size:12px; }
.conversation-title > div { flex:1; min-width:0; }
.staff-chat #group-alerts { flex:none; border-radius:99px; padding:8px 12px; min-height:44px; font-size:12px; font-weight:800; }
.staff-chat #group-alerts.snoozed { background:var(--bmsr-orange-500); color:var(--bmsr-navy-950); border-color:var(--bmsr-orange-500); }
.staff-chat #group-alerts-dialog { margin:auto auto 0; width:100%; max-width:480px; border-radius:18px 18px 0 0; padding:16px 18px calc(16px + env(safe-area-inset-bottom)); }
.staff-chat #group-alerts-dialog h2 { font-size:18px; overflow-wrap:anywhere; min-width:0; margin:0; }
.staff-chat #group-alerts-dialog .dialog-head { margin-bottom:8px; }
.staff-chat .alert-option { display:flex; align-items:center; gap:10px; width:100%; min-height:44px; padding:5px 0; text-align:left; border-width:0 0 1px; background:transparent; }
.alert-check { flex:none; width:20px; text-align:center; visibility:hidden; color:var(--bmsr-orange-600); }
.alert-option[aria-pressed=true] .alert-check { visibility:visible; }
.alert-copy { min-width:0; font-size:14px; line-height:18px; font-weight:800; }
.alert-note { display:block; font-size:11px; line-height:14px; font-weight:500; color:var(--bmsr-navy-500); }
#group-alerts-status:empty { display:none; }
@media(prefers-color-scheme:dark) {
  .staff-chat #group-alerts-dialog { background:var(--bmsr-navy-950); color:var(--bmsr-navy-50); border-color:var(--bmsr-navy-700); }
  .staff-chat #group-alerts-dialog h2,.staff-chat #group-alerts-dialog .dialog-head button { color:var(--bmsr-navy-50); }
  .staff-chat #group-alerts-dialog .alert-option { color:var(--bmsr-navy-50); border-color:var(--bmsr-navy-700); }
  #group-alerts-dialog .alert-note { color:var(--bmsr-navy-200); }
  #group-alerts-dialog .alert-check { color:var(--bmsr-orange-400); }
  .staff-chat #group-alerts-dialog :focus-visible { outline-color:var(--bmsr-orange-400); }
}
.staff-chat .back { background:transparent; color:white; border:0; width:36px; min-height:44px; display:grid; place-items:center; padding:0; }
.back svg { width:24px; height:24px; }
.conversation-tools { flex:none; display:flex; flex-direction:column; align-items:center; gap:10px; padding:14px 16px 4px; }
.staff-chat .pill { border-radius:99px; padding:9px 14px; font-size:12px; font-weight:700; min-height:36px; }
.staff-chat .pill::before { content:none; }
.staff-chat .icon-button { flex:none; width:44px; height:44px; border-radius:50%; padding:0; display:grid; place-items:center; }
.icon-button svg,#pull-cue svg { width:22px; height:22px; }
.staff-chat .icon-button[aria-busy="true"] svg { animation:chat-spin .8s linear infinite; }
#pull-cue { flex:none; height:0; overflow:hidden; display:grid; place-items:center; color:var(--bmsr-navy-500); }
#pull-cue.ready { color:var(--bmsr-orange-600); }
#history-loading { position:absolute; top:4px; left:calc(50% - 16px); width:32px; height:32px; border-radius:50%; display:grid; place-items:center; background:var(--bmsr-card); box-shadow:var(--bmsr-shadow-mid); z-index:1; }
#history-loading .spinner { display:none; }
#history-loading[aria-busy="true"] .spinner { display:block; }
#history-loading[aria-busy="true"] .history-arrow { display:none; }
.staff-chat #messages:focus-visible { outline-offset:-3px; }
.spinner { width:18px; height:18px; border:2px solid var(--bmsr-navy-100); border-top-color:var(--bmsr-navy-700); border-radius:50%; animation:chat-spin .8s linear infinite; }
@keyframes chat-spin { to { transform:rotate(360deg); } }
@media(prefers-reduced-motion:reduce) { .spinner,.staff-chat .icon-button[aria-busy="true"] svg { animation:none; } }
@media(max-width:760px) { .staff-chat .list-tools,.conversation-title { padding-right:10px; } }
.topic-chip { align-self:flex-start; background:var(--bmsr-navy-100); color:var(--bmsr-navy-700); border-radius:99px; padding:8px 12px; font-size:12px; font-weight:800; display:flex; align-items:center; max-width:100%; }
.staff-chat .topic-chip select { border:0; background-color:transparent; color:inherit; font-weight:700; width:auto; max-width:240px; min-width:0; min-height:28px; padding:2px 26px 2px 4px; background-position:right 4px center; }
#messages { overflow-anchor:none; flex:1; min-height:0; overflow:auto; overscroll-behavior:contain; display:flex; flex-direction:column; gap:14px; padding:10px 16px 20px; }
.day { align-self:center; color:var(--bmsr-navy-500); font-size:11px; font-weight:800; letter-spacing:.04em; margin:8px 0 2px; }
.message { flex:none; max-width:85%; align-self:flex-start; min-width:0; }
.message.own { align-self:flex-end; }
.who { display:block; font-size:calc(var(--chat-text-size) * .7647059); color:var(--bmsr-navy-500); font-weight:700; margin-bottom:4px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.own .who { text-align:right; }
.bubble { background:var(--bmsr-card); border:1px solid var(--bmsr-navy-100); border-radius:4px 16px 16px 16px; padding:8px 12px; font-size:var(--chat-text-size); line-height:1.35; white-space:pre-wrap; overflow-wrap:anywhere; }
.own .bubble { background:var(--bmsr-navy-700); color:white; border-color:var(--bmsr-navy-700); border-radius:16px 4px 16px 16px; }
.bubble a { color:inherit; text-decoration:underline; overflow-wrap:anywhere; }
.message.deleted .bubble { background:transparent; border:1px dashed var(--bmsr-navy-300); color:var(--bmsr-navy-500); font-style:italic; }
.thumbs { display:flex; gap:7px; margin-top:6px; }
.thumbs button { border-radius:99px; font-size:11px; padding:8px 10px; font-weight:700; }
.rated { margin:6px 0 0; font-size:11px; font-weight:700; color:var(--navy-5, #2D6291); }
#compose { display:flex; gap:8px; align-items:flex-end; padding:10px 12px; background:white; border-top:1px solid var(--bmsr-navy-100); }
#message { flex:1; min-width:0; border:1px solid var(--bmsr-navy-200); border-radius:22px; padding:12px; resize:vertical; height:48px; min-height:48px; max-height:150px; font-size:16px; }
.staff-chat dialog { border:1px solid var(--bmsr-navy-100); border-radius:18px; padding:22px; color:var(--bmsr-navy-950); background:white; width:calc(100% - 32px); max-width:430px; max-height:85dvh; box-shadow:var(--bmsr-shadow-mid); }
.staff-chat dialog::backdrop { background:rgba(13,31,56,.55); backdrop-filter:blur(3px); }
.staff-chat dialog h2 { font-size:20px; margin:0 0 12px; }
.staff-chat dialog p,.staff-chat dialog li { font-size:14px; line-height:1.55; }
.staff-chat dialog p { margin:10px 0; }
.staff-chat dialog ul { padding-left:20px; }
.staff-chat dialog li { margin-bottom:8px; }
.staff-chat dialog .fine { font-size:11px; color:var(--bmsr-navy-500); }
#agree { width:100%; margin-top:4px; }
.dialog-head,.dialog-actions { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.dialog-head button { border:0; background:transparent; font-size:26px; min-width:44px; min-height:44px; }
.staff-chat dialog label { display:block; font-weight:700; font-size:13px; margin:16px 0 6px; }
.staff-chat dialog input:not([type=checkbox]),.staff-chat dialog textarea { width:100%; border:1px solid var(--bmsr-navy-200); border-radius:8px; padding:10px; }
.staff-chat dialog textarea { min-height:90px; margin-bottom:10px; }
.people-list { max-height:260px; overflow:auto; margin:10px 0; }
.people-list button { width:100%; border-width:0 0 1px; padding:14px 8px; text-align:left; }
.staff-chat .person-check { display:flex; gap:10px; align-items:center; padding:10px 0; margin:0; }
.person-check input { width:18px; height:18px; }
.staff-chat dialog .record-footer { margin:16px -22px -22px; padding:10px 16px; font-size:12.5px; }
.skeleton { padding:0 20px; filter:blur(2px); opacity:.5; }
.skeleton-row { height:70px; margin:12px 0; background:var(--bmsr-navy-100); border-radius:8px; }
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
@media(max-width:600px) {
  .chat-screen { margin:0; width:100%; border:0; border-radius:0; box-shadow:none; height:calc(100dvh - 70px); min-height:380px; }
  .list-tools { padding:10px; }
  .staff-chat .space-row { padding:10px 16px; }
  .row-name { font-size:14px; }
  .chat-screen + bmsr-footer { display:none; }
}
@media(max-width:360px) { .staff-chat .list-tools h1 { font-size:18px; } }
/* Quiet optional step, after the existing agreement. */
.staff-chat .alerts-card button { min-height:44px; }
.alerts-card { flex:0 1 auto; overflow:auto; max-height:60dvh; padding:16px; margin:8px 16px 16px; border:1px solid var(--bmsr-navy-200); border-radius:12px; font-size:14px; line-height:1.5; }
.alerts-card p { margin: 8px 0 12px; }
.alerts-card ol { padding-left:24px; margin:8px 0 12px; }
.alerts-card li { margin:8px 0; }
.share-icon { width:22px; height:22px; vertical-align:middle; }
.media-tools { position:relative; flex:none; }
.attachment-menu { position:absolute; left:0; bottom:calc(100% + 8px); z-index:2; width:176px; padding:4px; border:1px solid var(--bmsr-navy-100); border-radius:14px; background:var(--bmsr-card); box-shadow:var(--bmsr-shadow-modal); }
.staff-chat .attachment-menu button { display:flex; align-items:center; gap:12px; width:100%; height:44px; padding:0 12px; border:0; border-radius:10px; background:transparent; font-size:13px; font-weight:700; text-align:left; }
.attachment-menu button:hover,.attachment-menu button:focus-visible { background:var(--bmsr-navy-50); }
.attachment-menu svg { flex:none; width:20px; height:20px; }
.staff-chat .chat-media { display:block; max-width:100%; min-height:0; padding:0; border:0; border-radius:10px; overflow:hidden; background:transparent; }
.chat-media img { display:block; width:100%; height:100%; object-fit:contain; }
.staff-chat .pdf-card { display:block; width:100%; padding:14px; border-radius:10px; font-weight:700; font-size:14px; text-align:left; overflow-wrap:anywhere; white-space:normal; min-height:52px; }
.giphy-credit { display:block; font-size:10px; opacity:.8; margin-top:4px; }
#media-preview-content img { display:block; margin:auto; max-width:100%; max-height:38dvh; border-radius:10px; object-fit:contain; }
.staff-chat .upload-reminder { background:var(--bmsr-orange-100); color:var(--bmsr-navy-950); padding:12px; border-radius:10px; font-weight:800; }
.staff-chat .media-confirm { display:flex; align-items:center; gap:10px; margin:16px 0; min-height:44px; }
.media-confirm input { width:22px; height:22px; flex:none; }
.gif-tabs { display:flex; gap:8px; }
.gif-tabs button { flex:1; padding:12px; border-radius:12px; font-weight:700; }
.gif-tabs [aria-selected=true] { background:var(--bmsr-navy-700); color:white; }
.gif-search-row { display:flex; gap:8px; }
.gif-search-row input { min-width:0; }
.staff-chat #media-preview .pill,.staff-chat #gif-more,.gif-search-row .pill { min-height:44px; }
.gif-results { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; max-height:40dvh; overflow:auto; }
.gif-results button { border-radius:10px; min-height:100px; padding:4px; background:var(--bmsr-bg); }
.gif-results img { display:block; width:100%; height:120px; object-fit:contain; }
.staff-chat #media-viewer { max-width:900px; }
#media-viewer-content img { display:block; margin:auto; max-width:100%; max-height:70dvh; object-fit:contain; }
#media-viewer-content { max-height:70dvh; overflow:auto; }
#media-viewer-content canvas { display:block; background:white; }
.pdf-tools { display:flex; justify-content:space-between; align-items:center; gap:8px; margin:10px 0; font-size:13px; }
.pdf-tools button { padding:8px; border-radius:8px; min-height:44px; }
.reactions { position:relative; display:flex; flex-wrap:wrap; gap:0; margin-top:-16px; }
.own .reactions { justify-content:flex-end; }
/* Keep the overlapping hit area below the bubble text, including last-line links. */
.message-content:has(> .reactions) > .bubble { padding-bottom:20px; }
.reaction-chip { position:relative; display:inline-flex; }
/* The visible pill is 26px tall; each independent control retains a 44px hit area. */
.reaction-chip::before { content:""; position:absolute; inset:9px 8px; border:1px solid var(--bmsr-navy-200); border-radius:24px; background:var(--bmsr-card); pointer-events:none; }
.reaction-chip.mine::before { border-color:var(--bmsr-orange-500); background:var(--bmsr-orange-100); }
.staff-chat .reaction-chip button { position:relative; border:0; background:transparent; min-width:44px; min-height:44px; padding:0; }
.staff-chat .reaction-emoji { font-size:16px; font-family:'Apple Color Emoji','Segoe UI Emoji','Noto Color Emoji',sans-serif; }
.staff-chat .reaction-chip .reaction-count { font-size:12px; font-weight:800; }
.reaction-quick { display:grid; grid-template-columns:repeat(6,1fr); gap:2px; margin:8px 0 14px; }
.reaction-grid { display:grid; grid-template-columns:repeat(6,1fr); gap:4px; margin:14px 0; }
.staff-chat #reaction-all { max-height:48dvh; overflow-y:auto; overscroll-behavior:contain; }
.staff-chat #reaction-all label { margin-top:8px; }
.staff-chat .emoji-category h3 { font-size:14px; margin:16px 0 6px; }
.staff-chat .emoji-choice { min-width:0; min-height:44px; padding:4px; border-radius:12px; font-size:24px; font-family:'Apple Color Emoji','Segoe UI Emoji','Noto Color Emoji',sans-serif; }
.staff-chat .emoji-choice[aria-pressed=true] { border-color:var(--bmsr-orange-500); background:var(--bmsr-orange-100); }
.staff-chat #reaction-picker { padding:16px; max-width:430px; }
.staff-chat #reaction-delete { margin-left:8px; }
#reaction-names { padding-left:22px; }
#reaction-names li { overflow-wrap:anywhere; }

/* Group changes share the existing conversation and receive refresh. */
.staff-chat #group-details { background:transparent; color:inherit; border:0; padding:8px 0; min-height:44px; font-size:12px; text-decoration:underline; }
.staff-chat .group-member { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:8px 0; border-bottom:1px solid var(--bmsr-navy-50); }
.group-member span { min-width:0; overflow-wrap:anywhere; }
.staff-chat .group-member button { flex:none; min-width:44px; min-height:44px; padding:8px 10px; }
.staff-chat #group-details-dialog h2 { overflow-wrap:anywhere; min-width:0; margin:0; }
.staff-chat #group-details-dialog { background:var(--bmsr-card); }
.staff-chat #group-details-dialog .dialog-head { align-items:flex-start; margin-bottom:12px; }
.staff-chat #group-details-title { flex:1; padding-top:8px; }
/* Native dialog autofocus lands on the title, leaving touch opens quiet. */
.staff-chat dialog .dialog-head h2:focus { outline:none; }
.staff-chat #group-details-close { border:0; background:transparent; font-size:26px; font-weight:400; line-height:1; }
.staff-chat dialog .dialog-head button:focus:not(:focus-visible) { outline:none; }
.staff-chat dialog .dialog-head button:focus-visible { outline:2px solid currentColor; outline-offset:-3px; }
.staff-chat #group-details-dialog .dialog-actions { justify-content:flex-start; margin-bottom:16px; }
.staff-chat #group-details-dialog .dialog-actions > button { min-width:44px; min-height:44px; }
.staff-chat #group-rename,.staff-chat .group-member button { border-color:var(--bmsr-navy-700); color:var(--bmsr-navy-700); }
.staff-chat #group-rename-form .orange { margin-top:12px; }
.message.group-event { align-self:center; max-width:100%; color:var(--bmsr-navy-500); font-size:12px; text-align:center; overflow-wrap:anywhere; }
.group-event time { display:block; font-size:10px; margin-top:3px; }
