/* Workspace launcher */
#messenger-launcher {
  position: fixed;
  right: max(22px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 85;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 18px 0 15px;
  border: 1px solid #3b6095;
  border-radius: 24px;
  background: #203e67;
  color: white;
  box-shadow: 0 4px 14px #142b4938;
  font-size: 14px;
  line-height: 1;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
#messenger-launcher:hover { background: #2d5284; }
#messenger-launcher:focus-visible, .cw-content button:focus-visible { outline: 3px solid #4f8ced; outline-offset: 2px; }
#messenger-launcher svg { width: 21px; height: 21px; }
#messenger-launcher .launcher-unread, .cw-unread {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 12px;
  background: #c62e45;
  color: #fff;
  font: 700 11px/1 Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}
#messenger-launcher .launcher-unread { position: absolute; top: -6px; right: -6px; box-shadow: 0 0 0 2px #fff; }
#messenger-launcher .launcher-unread[hidden] { display: none; }
@media not all and (any-pointer: fine) { #messenger-launcher { display: none; } }

/* The independent messenger window stays single-column at any window size. */
html.chat-window, .chat-window body, .chat-window #app { height: 100%; margin: 0; overflow: hidden; background: white; }
.cw-content { height: 100%; height: 100dvh; display: flex; flex-direction: column; min-width: 0; }
.cw-heading, .cw-list-tools { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cw-heading { padding: 15px 16px 13px; background: #f1f5fa; border-bottom: 1px solid #dde5ee; }
.cw-brand { display: flex; align-items: center; gap: 9px; min-width: 0; color: #233f62; }
.cw-brand svg { width: 23px; height: 23px; }
.cw-heading h1 { margin: 0; font-size: 20px; line-height: 1.35; letter-spacing: -.035em; }
.cw-close { flex: none; width: 32px; height: 32px; padding: 0; border: 0; background: transparent; color: #4b5e73; font-size: 24px; font-weight: 400; line-height: 1; }
.cw-close:hover, .cw-close:focus-visible { background: #e1e9f3; }
.cw-list-tools { padding: 12px 16px; border-bottom: 1px solid #e6ecf2; }
.cw-list-tools h2 { margin: 0; font-size: 15px; line-height: 1.5; }
.cw-list-tools > div { display: flex; gap: 6px; }
.cw-list-tools button { padding: 5px 9px; min-height: 32px; border-color: #d7e1ee; color: #254c7d; font-size: 12px; }
.cw-content #chat-status { flex: none; padding: 7px 14px; margin: 0; background: #fff3dc; color: #6d4e1c; font-size: 12px; }
.cw-content #chat-status:empty { display: none; }
.cw-content:has(.chat-is-open) > .cw-heading, .cw-content:has(.chat-is-open) > .cw-list-tools { display: none; }
.cw-content .messenger, .cw-content .messenger.chat-is-open {
  display: flex; flex: 1 1 0; position: static; inset: auto; min-height: 0; height: auto;
  min-width: 0; width: 100%; max-width: none; max-height: none; margin: 0; padding: 0;
  border: 0; border-radius: 0; box-shadow: none; overflow: hidden; background: white;
}
.cw-content .messenger .chat-list { flex: 1; display: block; min-height: 0; overflow: auto; scrollbar-gutter: stable; padding: 4px; border: 0; }
.cw-content .messenger .chat-thread { display: none; }
.cw-content .messenger.chat-is-open .chat-list { display: none; }
.cw-content .messenger.chat-is-open .chat-thread { display: flex; width: 100%; height: 100%; }
.cw-content .messenger .chat-room-wrap { position: relative; display: block; border: 0; margin: 0; width: 100%; }
.cw-content .messenger .chat-room {
  display: flex; align-items: center; gap: 11px; min-height: 66px; height: auto; width: 100%;
  margin: 0; padding: 10px 34px 10px 12px; border: 0; border-radius: 7px;
}
.cw-content .chat-room:hover, .cw-content .chat-room:focus-visible { background: #edf3fa; }
.cw-content .cw-avatar {
  flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
  background: #e6eff9; color: #375d8e; font-size: 16px; font-style: normal; font-weight: 700;
}
.cw-content .cw-group { background: #e4f2ef; color: #336c62; }
.cw-avatar svg { width: 21px; height: 21px; }
.cw-content .messenger .chat-room .cw-room-info { display: grid; gap: 3px; flex: 1; min-width: 0; margin: 0; }
.cw-content .messenger .chat-room strong { display: flex; align-items: baseline; gap: 5px; margin: 0; min-width: 0; line-height: 1.35; }
.cw-content .messenger .chat-room .cw-room-name, .cw-content .messenger .chat-room .cw-preview { display: block; margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cw-content .messenger .chat-room .cw-room-name { font-size: 15px; color: #1d304a; }
.cw-content .messenger .chat-room strong small { color: #60738a; font-size: 12px; }
.cw-content .messenger .chat-room .cw-preview { color: #5c6b7e; font-size: 13px; font-weight: 400; line-height: 1.4; }
.cw-unread { flex: none; }
.cw-content .messenger .chat-pin { top: 50%; right: 2px; width: 30px; height: 30px; transform: translateY(-50%); }
.cw-content .chat-pin:not(.pinned) { opacity: 0; }
.cw-content .chat-room-wrap:is(:hover,:focus-within) .chat-pin { opacity: 1; }
.cw-empty { margin: 36px 16px; color: #60738a; text-align: center; font-size: 14px; }
.cw-content .chat-thread .chat-heading {
  display: grid; grid-template-columns: 32px minmax(0,1fr); align-items: center; gap: 6px;
  margin: 0; padding: 10px 9px; border-bottom: 1px solid #d5e1eb; background: white;
}
.cw-content .chat-heading .cw-back, .cw-content .chat-thread > .cw-back {
  display: inline-grid; place-items: center; align-self: center; margin: 0; width: 32px; height: 34px;
  padding: 0 0 3px; border: 0; border-radius: 8px; background: #edf3fa; color: #2d4d73; font: 26px/1 Arial, sans-serif;
}
.cw-content .chat-thread > .cw-back { align-self: flex-start; margin: 10px; }
.cw-content .chat-thread .chat-topbar { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; min-width: 0; }
.cw-content .chat-thread .chat-identity { flex: 1; min-width: 0; }
.cw-content .chat-identity h2 { font-size: 16px; }
.cw-content .chat-thread .chat-top-actions { display: flex; width: auto; flex: none; gap: 4px; }
.cw-content .chat-top-actions button { min-height: 30px; padding: 4px 6px; font-size: 11px; }
.cw-content .chat-heading .chat-search { grid-column: 1 / -1; margin: 3px 0 0; }
.cw-content .chat-history { flex: 1 1 0; min-height: 0; }
.cw-content .chat-thread .message-form { padding: 8px 10px; margin: 0; flex: none; }
.cw-content .chat-thread .message-form > label { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
.cw-content .message-form .schedule-mobile.hint { display: none; }
.cw-signed-out { padding: 28px 20px; }
.cw-signed-out h1 { margin-top: 0; font-size: 20px; }
@media(max-width:345px) {
  .cw-content .chat-thread .chat-topbar { flex-wrap: wrap; }
  .cw-content .chat-thread .chat-identity { flex-basis: 100%; }
}
@media print { #messenger-launcher { display: none !important; } }

@media (hover:hover) and (pointer:fine) {
  .cw-content #chat-messages .message-reply-button { opacity: 0; }
  .cw-content #chat-messages .message:hover .message-reply-button,
  .cw-content #chat-messages .message:focus-within .message-reply-button { opacity: 1; }
}
