/* Console team chat — sidebar + message pane, handheld-first.
   Uses the shared --o-* tokens from odoo.css. */
.o_chat_layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 12px;
  align-items: start;
}
.o_chat_sidebar {
  background: var(--o-sheet);
  border: 1px solid var(--o-border-light);
  border-radius: 6px;
  padding: 6px;
  max-height: calc(100vh - 210px);
  overflow-y: auto;
}
.o_chat_channel {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 5px;
  padding: 8px 10px;
  cursor: pointer;
  font: inherit;
  color: var(--o-text);
}
.o_chat_channel:hover { background: var(--o-brand-soft); }
.o_chat_channel.active { background: var(--o-brand-soft); box-shadow: inset 3px 0 0 var(--o-brand); }
.o_chat_channel_head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.o_chat_channel_preview {
  font-size: 12px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.o_chat_presence_dot {
  display: inline-block; flex: none; width: 8px; height: 8px;
  border-radius: 50%; background: #aeb7ae;
}
.o_chat_presence_dot.online { background: #55ad5f; box-shadow: 0 0 0 3px rgba(85,173,95,.12); }
.o_chat_presence_dot.offline { background: #aeb7ae; }
.o_chat_presence_line {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 600; line-height: 1.2;
}
.o_chat_pane {
  background: var(--o-sheet);
  border: 1px solid var(--o-border-light);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  min-height: 420px;
  max-height: calc(100vh - 210px);
}
.o_chat_pane_head {
  padding: 10px 14px;
  border-bottom: 1px solid var(--o-border-light);
}
.o_chat_messages {
  flex: 1; min-height: 0; overflow-y: auto; padding: 12px 14px;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
.o_chat_load_older {
  display: block; margin: 0 auto 12px; padding: 5px 10px;
  border: 1px solid var(--o-border); border-radius: 999px;
  background: var(--o-sheet); color: var(--o-brand-dark); font: inherit;
  font-size: 11px; font-weight: 700; cursor: pointer;
}
.o_chat_msg { position: relative; width: fit-content; margin-bottom: 10px; max-width: 78%; }
.o_chat_msg.mine { margin-left: auto; }
.o_chat_msg_meta { display: flex; align-items: center; gap: 6px; font-size: 12px; margin-bottom: 4px; min-width: 0; white-space: nowrap; }
.o_chat_msg_meta > .text-strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.o_chat_msg_meta > .text-muted { flex: none; font-size: 10px; }
.o_chat_msg_meta.mine { justify-content: flex-end; }
.o_chat_message_avatar { display: inline-grid; place-items: center; flex: none; width: 24px; height: 24px; overflow: hidden; border-radius: 50%; object-fit: cover; background: var(--o-brand-soft); color: var(--o-text); border: 1px solid var(--o-border); font-size: 10px; font-weight: 800; line-height: 1; box-sizing: border-box; }
.o_chat_avatar_fallback { display: grid; place-items: center; width: 100%; height: 100%; }
.o_chat_message_tools { display: flex; align-items: center; gap: 2px; position: absolute; z-index: 2; left: 7px; top: calc(100% + 2px); width: fit-content; padding: 3px; border: 1px solid var(--o-border-light); border-radius: 999px; background: var(--o-sheet); box-shadow: 0 4px 12px rgba(25,57,25,.12); opacity: 0; transform: translateY(-3px); transition: opacity .14s ease, transform .14s ease; }
.o_chat_msg.mine .o_chat_message_tools { right: 7px; left: auto; }
.o_chat_msg:hover .o_chat_message_tools, .o_chat_msg:focus-within .o_chat_message_tools { opacity: 1; transform: translateY(0); }
.o_chat_message_tool, .o_chat_inline_btn { width: 28px; height: 28px; display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--o-muted); cursor: pointer; }
.o_chat_message_tool:hover, .o_chat_inline_btn:hover { background: var(--o-brand-soft); color: var(--o-brand-dark); }
.o_chat_edited { display: block; margin-top: 2px; color: var(--o-muted); font-size: 10px; }
.o_chat_msg_body {
  background: var(--o-ground);
  border: 1px solid var(--o-border-light);
  border-radius: 10px;
  padding: 7px 11px;
  word-break: break-word;
}
.o_chat_msg.mine .o_chat_msg_body {
  background: var(--o-brand-soft);
  border-color: var(--o-brand-light);
}
.o_chat_deleted_body { color: var(--o-muted); font-style: italic; background: transparent !important; border-style: dashed; }
.o_chat_delete_confirm {
  position: absolute; z-index: 9; right: 6px; top: calc(100% + 4px);
  display: flex; align-items: center; gap: 7px; padding: 5px 7px 5px 10px;
  border: 1px solid var(--o-border-light); border-radius: 10px;
  background: var(--o-sheet); color: var(--o-text); box-shadow: 0 8px 20px rgba(25,57,25,.2);
  font-size: 11px; white-space: nowrap;
}
.o_chat_delete_confirm button { padding: 4px 7px; border: 0; border-radius: 6px; cursor: pointer; font: inherit; }
.o_chat_delete_cancel { background: transparent; color: var(--o-muted); }
.o_chat_delete_accept { background: var(--o-danger); color: #fff; }
.o_chat_reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.o_chat_reaction, .o_chat_react_add, .o_chat_reaction_choice {
  border: 1px solid var(--o-border-light); border-radius: 999px;
  background: var(--o-sheet); color: var(--o-text); cursor: pointer;
}
.o_chat_reaction { padding: 2px 7px; font-size: 13px; }
.o_chat_reaction.mine { border-color: var(--o-brand); background: var(--o-brand-soft); }
.o_chat_reaction small { margin-left: 4px; font-size: 10px; }
.o_chat_react_add {
  width: 24px; height: 24px; padding: 0; color: var(--o-muted);
  opacity: 0; pointer-events: none; transition: opacity .14s ease;
}
.o_chat_msg:hover .o_chat_react_add,
.o_chat_msg:focus-within .o_chat_react_add { opacity: 1; pointer-events: auto; }
.o_chat_reaction_picker { display: flex; justify-content: center; gap: 8px; }
.o_chat_reaction_choice { width: 42px; height: 42px; font-size: 21px; }
.o_chat_reaction_popover {
  position: absolute; z-index: 8; left: 0; bottom: calc(100% + 4px);
  max-width: calc(100vw - 32px); overflow-x: auto;
  display: flex; align-items: center; gap: 2px; padding: 4px 6px;
  border: 1px solid var(--o-border-light); border-radius: 999px;
  background: var(--o-sheet); box-shadow: 0 8px 20px rgba(25,57,25,.2);
}
.o_chat_msg.mine .o_chat_reaction_popover { right: 0; left: auto; }
.o_chat_msg:has(.o_chat_reaction_popover) .o_chat_message_tools { opacity: 1; transform: translateY(0); }
.o_chat_reaction_popover .o_chat_reaction_choice {
  width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; font-size: 17px; cursor: pointer;
}
.o_chat_reaction_popover .o_chat_reaction_choice:hover { background: var(--o-brand-soft); }
.o_chat_composer_row {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--o-border-light);
  align-items: flex-end;
}
.o_chat_composer {
  flex: 1 1 auto; width: auto; min-width: 0; min-height: 36px; resize: none;
  /* Grow with the text instead of scrolling a one-line slot (Martha, 2026-09-15:
     "we can only type 1 line then have to scroll down"). field-sizing is native
     auto-grow; where it is unsupported the rows/min-height floor above still
     gives a usable box, so this degrades to a taller textarea, never a worse one. */
  field-sizing: content;
  max-height: 168px; padding: 7px 72px 7px 12px; border: 0; background: transparent;
}
.o_chat_input_shell { position: relative; display: flex; align-items: flex-end; flex: 1 1 auto; min-width: 0; min-height: 42px; border: 1px solid var(--o-border-light); border-radius: 22px; background: var(--o-ground); }
.o_chat_input_shell:focus-within { border-color: var(--o-brand-light); box-shadow: 0 0 0 2px rgba(69,153,69,.12); }
.o_chat_input_shell .o_chat_inline_btn { position: absolute; bottom: 6px; }
.o_chat_input_shell .o_chat_inline_btn:nth-last-child(2) { right: 36px; }
.o_chat_input_shell .o_chat_inline_btn:last-child { right: 6px; }
.o_chat_add_btn, .o_chat_send_btn,
.o_chat_icon_btn.o_chat_add_btn, .o_chat_icon_btn.o_chat_send_btn {
  width: 38px; height: 38px; min-width: 38px; padding: 0; border-radius: 50%;
}
.o_chat_add_btn { color: var(--o-brand-dark); background: var(--o-brand-soft); }
.o_chat_send_btn { color: #fff; background: var(--o-brand); }
.o_chat_send_btn:hover { background: var(--o-brand-dark); }
.o_chat_attachment_menu, .o_chat_emoji_menu { position: absolute; z-index: 50; bottom: calc(100% - 2px); display: flex; gap: 4px; max-width: calc(100% - 20px); padding: 5px; border: 1px solid var(--o-border-light); border-radius: 12px; background: var(--o-sheet); box-shadow: 0 10px 24px rgba(25,57,25,.16); box-sizing: border-box; }
.o_chat_attachment_menu { left: 10px; flex-direction: column; }
.o_chat_attachment_menu.from-more { left: auto; right: 44px; }
.o_chat_emoji_menu { left: 10px; right: 10px; justify-content: center; flex-wrap: wrap; }
.o_chat_attachment_menu[hidden], .o_chat_emoji_menu[hidden] { display: none; }
.o_chat_menu_item { display: inline-flex; align-items: center; gap: 7px; min-width: 86px; padding: 7px 9px; border: 0; border-radius: 8px; background: transparent; color: var(--o-text); font: inherit; font-size: 11px; text-align: left; cursor: pointer; }
.o_chat_menu_item:hover { background: var(--o-brand-soft); }
.o_chat_emoji_choice { width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px; background: transparent; font-size: 19px; cursor: pointer; }
.o_chat_emoji_choice:hover { background: var(--o-brand-soft); }
.o_chat_edit_form { display: grid; gap: 6px; }
.o_chat_edit_input { width: 100%; min-height: 56px; resize: vertical; }
.o_chat_edit_actions { display: flex; align-items: center; gap: 6px; }
.o_chat_edit_actions .btn { min-height: 28px; padding: 4px 9px; font-size: 11px; }
.o_chat_edit_status { color: var(--o-muted); font-size: 10px; }
.o_chat_composer_row.is-drop-target {
  background: var(--o-brand-soft);
  outline: 2px dashed var(--o-brand);
  outline-offset: -4px;
}
.o_chat_composer_row > .o_chat_icon_btn { flex: 0 0 auto; }
.o_chat_typing {
  flex: none; min-height: 24px; padding: 5px 12px 4px;
  display: flex; align-items: center; gap: 7px;
  color: #6d756d; font-size: 11px; font-weight: 600;
}
.o_chat_typing[hidden] { display: none; }
.o_chat_join_requests {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex: none; width: auto; margin: 0 9px 5px; padding: 7px 9px;
  border: 1px solid #dfca84; border-radius: 7px; background: #fbf6e8; color: #66531f;
  font: 650 10px/1.2 var(--o-font); text-align: left; cursor: pointer;
}
.o_chat_join_requests[hidden] { display: none; }
.o_chat_join_requests b { color: #4c702f; font-size: 10px; }
.o_chat_join_review { display: grid; gap: 7px; }
.o_chat_join_review_row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--o-border-light); }
.o_chat_join_review_row > div:first-child { display: flex; flex-direction: column; min-width: 0; }
.o_chat_join_review_row > div:first-child span { color: var(--o-muted); font-size: 10px; }
.o_chat_join_review_row > div:last-child { display: flex; gap: 6px; }
.o_chat_join_review_row .btn { min-height: 30px; padding: 5px 9px; font-size: 10px; }
.o_chat_typing_dots { display: inline-flex; align-items: center; gap: 2px; }
.o_chat_typing_dots i {
  width: 4px; height: 4px; border-radius: 50%; background: #a78435;
  animation: o-chat-typing 1.15s ease-in-out infinite;
}
.o_chat_typing_dots i:nth-child(2) { animation-delay: .14s; }
.o_chat_typing_dots i:nth-child(3) { animation-delay: .28s; }
@keyframes o-chat-typing {
  0%, 60%, 100% { opacity: .35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

/* Handhelds and phones: one column, sidebar above the conversation. */
@media (max-width: 820px) {
  .o_chat_layout { grid-template-columns: 1fr; }
  .o_chat_sidebar { max-height: 190px; }
  .o_chat_pane { max-height: none; min-height: 320px; }
  .o_chat_msg { max-width: 92%; }
}

/* ---------------------------------------------------------------- mentions */
.o_chat_mention {
  padding: 0 3px;
  border-radius: 3px;
  background: rgba(69, 153, 69, .16);
  color: var(--o-brand-dark);
  font-weight: 700;
}
.o_chat_msg.mentions-me { box-shadow: inset 3px 0 0 var(--o-danger); }
.o_chat_msg.mentions-me .o_chat_mention { background: rgba(180, 67, 61, .16); color: var(--o-danger); }

/* Autocomplete sits above the composer, anchored to the row. */
.o_chat_composer_row { position: relative; }
.o_chat_suggest {
  position: absolute; z-index: 40; left: 10px; bottom: calc(100% + 4px);
  width: min(280px, calc(100% - 20px));
  background: #fff; border: 1px solid #cfd8cd; border-radius: 8px;
  box-shadow: 0 12px 28px rgba(25, 57, 25, .18); overflow: hidden;
}
.o_chat_suggest_row {
  display: flex; align-items: center; gap: 7px;
  width: 100%; padding: 8px 10px; text-align: left;
  background: transparent; border: 0; border-bottom: 1px solid var(--o-border-light);
  font: inherit; cursor: pointer;
}
.o_chat_suggest_presence { margin-left: auto; font-size: 10px; }
.o_chat_suggest_row:last-child { border-bottom: 0; }
.o_chat_suggest_row.active, .o_chat_suggest_row:hover { background: var(--o-brand-soft); }

/* ------------------------------------------------------------ attachments */
/* Big touch targets: gloved hands on a handheld, not a mouse. */
.o_chat_icon_btn { min-width: 42px; padding: 8px 10px; font-size: 16px; line-height: 1; }
.o_chat_composer_row .o_chat_icon_btn.o_chat_add_btn,
.o_chat_composer_row .o_chat_icon_btn.o_chat_send_btn {
  min-width: 38px; padding: 0;
}

/* Final composer contract: the message field is the visual anchor.  The
   dark-theme sheet rules are intentionally overridden here because they would
   turn the transparent textarea back into a second boxed control. */
.o_chat_composer_row .o_chat_input_shell {
  min-height: 42px;
  border: 0;
  border-radius: 22px;
  background: var(--o-brand-soft);
  box-shadow: none;
}
.o_chat_composer_row .o_chat_input_shell:focus-within {
  border: 0;
  box-shadow: 0 0 0 2px rgba(128, 190, 126, .32);
}
.o_chat_composer_row .o_chat_input_shell .o_chat_composer,
.o_chat_composer_row .o_chat_input_shell .o_chat_composer:focus {
  min-height: 42px;
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  color: var(--o-text) !important;
}
.o_chat_composer_row .o_chat_add_btn,
.o_chat_composer_row .o_chat_send_btn {
  display: inline-grid;
  place-items: center;
  align-content: center;
  flex: 0 0 38px;
  border: 0;
  box-shadow: none;
}
.o_chat_composer_row .o_chat_add_btn svg,
.o_chat_composer_row .o_chat_send_btn svg {
  display: block;
  width: 18px;
  height: 18px;
  margin: 0;
}
.o_chat_composer_row .o_chat_add_btn:focus,
.o_chat_composer_row .o_chat_send_btn:focus { outline: 0; }
.o_chat_composer_row .o_chat_add_btn:focus-visible,
.o_chat_composer_row .o_chat_send_btn:focus-visible {
  outline: 2px solid rgba(128, 190, 126, .75);
  outline-offset: 2px;
}
.o_chat_attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.o_chat_photo_wrap { padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.o_chat_photo {
  display: block; max-width: 240px; max-height: 240px;
  border: 1px solid var(--o-border-light); border-radius: 8px; object-fit: cover;
}
.o_chat_photo_full { display: block; width: 100%; height: auto; border-radius: 6px; }
.o_chat_file {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 10px; border: 1px solid var(--o-border-light);
  border-radius: 8px; background: rgba(255, 255, 255, .7); font-size: 12px;
}
.o_chat_uploading { padding: 8px 4px; font-size: 12px; font-style: italic; }

/* -------------------------------------------------- navbar chat indicator */
.o_chat_notice { position: relative; display: inline-flex; }
.o_chat_trigger {
  position: relative; display: inline-grid; place-items: center;
  width: 32px; height: 32px; padding: 0;
  border: 1px solid #d7e0d5; border-radius: 50%;
  background: rgba(255, 255, 255, .72); color: #536055; cursor: pointer;
}
.o_chat_trigger:hover,
.o_chat_trigger[aria-expanded="true"] { background: #fff; border-color: #b9cab6; }
.o_chat_trigger:focus-visible { outline: 3px solid rgba(69, 153, 69, .32); outline-offset: 2px; }
.o_chat_trigger_icon { font-size: 14px; line-height: 1; }
.o_chat_badge {
  position: absolute; top: -6px; right: -6px; min-width: 17px; height: 17px; padding: 0 4px;
  border: 2px solid #f8faf7; border-radius: 9px;
  background: #6b7a6c; color: #fff;
  font-size: 9px; font-weight: 800; line-height: 13px; text-align: center;
}
/* Being named is louder than being in the room. */
.o_chat_badge.mention { background: #b4433d; }
.o_chat_badge.inline { position: static; border: 0; background: #6b7a6c; }
.o_chat_notice_panel {
  position: fixed; z-index: 550; top: 62px; right: 12px;
  width: min(380px, calc(100vw - 24px)); max-height: calc(100vh - 74px); overflow: hidden;
  color: var(--o-text); background: #fff; border: 1px solid #cfd8cd;
  border-radius: 9px; box-shadow: 0 16px 36px rgba(25, 57, 25, .2);
}
.o_chat_notice_header {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 14px 10px; border-bottom: 1px solid var(--o-border-light);
}
.o_chat_notice_header strong { color: var(--o-text-strong); font-size: 13px; }
.o_chat_notice_body { max-height: calc(100vh - 118px); overflow-y: auto; }
.o_chat_notice_empty { padding: 22px 16px; color: var(--o-muted); font-size: 11px; text-align: center; }
.o_chat_notice_row {
  display: block; width: 100%; padding: 10px 14px; text-align: left;
  background: transparent; border: 0; border-bottom: 1px solid var(--o-border-light);
  font: inherit; cursor: pointer;
}
.o_chat_notice_row:hover { background: var(--o-brand-soft); }
.o_chat_notice_row.mention { box-shadow: inset 3px 0 0 var(--o-danger); }
.o_chat_notice_row_head { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.o_chat_notice_row_preview {
  margin-top: 3px; font-size: 11px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* =====================================================================
   Console chat: a bubble that opens into a panel down the left side.

   The header spans the full window and the panel starts BELOW it — chat is a
   companion to the console, not a column the console has to make room for.
   Only the content area is offset, never the navbar.
   ===================================================================== */
:root {
  --o-chat-strip-w: 56px; --o-chat-panel-w: 356px;
  --o-chat-top: calc(56px + var(--o-safe-top, 0px));
}

/* ---- expanded: icon strip + conversation -------------------------------- */
/* Three widths, not two: bubble -> just the bubbles -> bubbles + conversation.
   Closing a conversation should give the width back, not leave an empty
   column sitting next to the icons. */
.o_chat_panel {
  position: fixed; left: 0; top: var(--o-chat-top); bottom: 0; z-index: 205;
  width: var(--o-chat-strip-w);
  display: flex; flex-direction: row; overflow: hidden;
  background: var(--o-sheet); border-right: 1px solid #dbe4d9;
  box-shadow: 4px 0 18px rgba(25, 57, 25, .07);
}
.o_chat_panel[hidden] { display: none; }
body.o_chat_expanded .o_chat_panel { width: var(--o-chat-panel-w); }


/* The strip: one square per conversation, so every chat and channel is one
   click away without spending the width a list of names would cost. */
.o_chat_strip {
  flex: 0 0 var(--o-chat-strip-w); width: var(--o-chat-strip-w);
  min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 8px 0; border-right: 1px solid var(--o-border-light);
  background: linear-gradient(180deg, rgba(69,153,69,.08), rgba(251,252,250,.98) 26%);
}
.o_chat_strip_list {
  flex: 1; width: 100%; min-height: 0; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  /* Keep the first unread badge and last presence dot inside the scrollport. */
  padding: 6px 0;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  /* No scrollbar furniture in a 56px column — it would eat a third of it. */
  scrollbar-width: none;
}
.o_chat_strip_list::-webkit-scrollbar { width: 0; }
.o_chat_strip_btn {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center;
  border: 1px solid #d7e0d5; border-radius: 50%;
  background: rgba(255,255,255,.8); color: #536055;
  font-size: 15px; line-height: 1; cursor: pointer;
}
.o_chat_strip_btn:hover { background: #fff; border-color: #b9cab6; }
.o_chat_strip_btn.active {
  border-color: var(--o-brand); background: var(--o-brand-soft); color: var(--o-brand-dark);
  box-shadow: 0 0 0 2px rgba(69,153,69,.16);
}
.o_chat_strip_btn:focus-visible { outline: 3px solid rgba(69,153,69,.32); outline-offset: 2px; }
.o_companion_phone_btn { position: relative; }
.o_companion_voicemail_badge {
  position: absolute; top: -7px; right: -9px; min-width: 19px; height: 19px;
  padding: 0 4px; border-radius: 10px; background: #b3261e; color: #fff;
  font-size: 10px; font-weight: 750; line-height: 19px; text-align: center;
}

.o_chat_chip {
  position: relative; width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border: 1px solid #d7e0d5; border-radius: 12px;
  background: #fff; color: #445147; cursor: pointer;
  font: 600 12px/1 var(--o-font);
}
.o_chat_chip:hover { border-color: #b9cab6; }
.o_chat_chip:focus-visible { outline: 3px solid rgba(69,153,69,.32); outline-offset: 2px; }
.o_chat_chip.active { border-color: var(--o-brand); box-shadow: 0 0 0 2px rgba(69,153,69,.22); }
/* Unread is a FILL, not an outline: at 38px a border colour is far too quiet
   to notice from across a room, and being noticed is the chip's whole job. */
.o_chat_chip.unread { border-color: #9fb39f; background: #eaf3ea; color: var(--o-brand-dark); }
.o_chat_chip.mention { border-color: #b4433d; background: #fbe9e8; color: #8d332e; }
.o_chat_chip_glyph { pointer-events: none; }
.o_chat_chip.shared {
  border-color: #d6bf7b; background: #f4e7bb; color: #66501f;
}
.o_chat_chip.shared:hover { border-color: #b99a42; background: #f0dfa5; }
.o_chat_chip.shared.active {
  border-color: #9f8234; box-shadow: 0 0 0 2px rgba(183, 145, 42, .22);
}
.o_chat_shared_initials {
  flex: none; min-width: 25px; height: 25px; padding: 0 4px;
  display: inline-grid; place-items: center;
  border: 1px solid #d6bf7b; border-radius: 7px;
  background: #f4e7bb; color: #66501f;
  font-size: 9px; font-weight: 800; line-height: 1;
}
.o_chat_chip_presence {
  position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px;
  border: 2px solid #f8faf7; border-radius: 50%; background: #aeb7ae;
}
.o_chat_chip_presence.online { background: #55ad5f; }
.o_chat_chip_presence.offline { background: #aeb7ae; }
.o_chat_chip_count {
  position: absolute; top: -5px; right: -5px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border: 2px solid #f8faf7; border-radius: 9px;
  background: #6b7a6c; color: #fff;
  font-size: 9px; font-weight: 800; line-height: 13px; text-align: center;
}
.o_chat_chip.mention .o_chat_chip_count { background: #b4433d; }

.o_chat_panel_convo {
  flex: 1; min-width: 0; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column;
}
.o_companion_phone {
  flex: 1; min-width: 0; min-height: 0; overflow: hidden; background: #f7f9f6;
}
.o_companion_phone_frame { display: block; width: 100%; height: 100%; border: 0; }
.o_chat_convo_head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 6px 7px 12px; flex: none; min-height: 46px;
  border-bottom: 1px solid var(--o-border-light);
  background: var(--o-brand-soft);
}
.o_chat_convo_name {
  min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.o_chat_convo_identity {
  flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column;
  justify-content: center; gap: 1px;
}
.o_chat_panel_btn {
  width: 28px; height: 28px; flex: none; display: grid; place-items: center;
  border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--o-muted); cursor: pointer;
  font-size: 14px; line-height: 1;
}
.o_chat_panel_btn:hover { background: #fff; color: var(--o-text-strong); }
.o_chat_panel_btn:focus-visible { outline: 3px solid rgba(69,153,69,.32); outline-offset: 1px; }
.o_chat_head_actions { display: flex; align-items: center; gap: 2px; }
.o_chat_mobile_close, .o_chat_mobile_new, .o_chat_mobile_launcher { display: none; }

/* ---- "something just arrived" -------------------------------------------
   A standing unread count says there IS a message; this says one just LANDED.
   It stops on its own so nothing blinks forever. */
@keyframes o-chat-flash {
  0%, 100% { box-shadow: 0 0 0 0 rgba(69, 153, 69, 0); }
  35%      { box-shadow: 0 0 0 5px rgba(69, 153, 69, .30); }
}
@keyframes o-chat-flash-mention {
  0%, 100% { box-shadow: 0 0 0 0 rgba(180, 67, 61, 0); }
  35%      { box-shadow: 0 0 0 6px rgba(180, 67, 61, .34); }
}
.o_chat_chip.flash { animation: o-chat-flash 1.1s ease-in-out 4; }
.o_chat_chip.flash.mention { animation-name: o-chat-flash-mention; }
/* Motion is an accessibility choice: keep the colour, which carries the
   meaning, and drop the pulsing. */
@media (prefers-reduced-motion: reduce) {
  .o_chat_chip.flash { animation: none; }
  .o_chat_chip.flash { outline: 2px solid var(--o-brand); outline-offset: 1px; }
  .o_chat_chip.flash.mention { outline-color: #b4433d; }
  .o_chat_typing_dots i { animation: none; opacity: .72; }
}

.o_chat_pane.compact {
  flex: 1; min-height: 0; max-height: none;
  border: 0; border-radius: 0; background: transparent;
}
.o_chat_pane.compact .o_chat_messages { padding: 10px; }
.o_chat_pane.compact .o_chat_msg { max-width: 94%; }
.o_chat_pane.compact .o_chat_composer_row { padding: 8px; gap: 6px; }
.o_chat_pane.compact .o_chat_composer { min-height: 36px; max-height: 30vh; }
.o_chat_empty { padding: 22px 14px; text-align: center; font-size: 12px; }
.o_chat_pick_summary { margin: 8px 0 2px; font-size: 12px; }

/* Big touch targets: gloved hands on a handheld, not a mouse. */
.o_chat_icon_btn { min-width: 42px; padding: 8px 10px; font-size: 16px; line-height: 1; }

@media (min-width: 992px) {
  /* Offset ONLY the content area. The navbar keeps the full window width, so
     the header runs across the top and the panel sits under it. */
  body.o_has_chat_rail .o_action_manager {
    padding-left: var(--o-chat-strip-w);
  }
  body.o_has_chat_rail.o_chat_expanded .o_action_manager {
    padding-left: var(--o-chat-panel-w);
  }
  /* The panel already lists conversations; the navbar badge would be the
     same information twice. */
  body.o_has_chat_rail .o_chat_notice { display: none; }
  /* On the Chat page the panel stands down: the page IS the conversation. */
}

/* Handhelds: the panel takes the screen while it is open (there is no room to
   sit beside anything), and the bubble is how you get back out. */
@media (max-width: 991px) {
  .o_chat_notice { flex: none; }
  .o_chat_trigger { width: 40px; height: 40px; }
  .o_chat_notice_panel { top: calc(var(--o-safe-top, 0px) + 62px); }
  .o_chat_panel {
    display: none;
    inset: var(--o-chat-panel-top, 0px) 0 auto;
    width: 100vw;
    height: var(--o-chat-panel-height, 100dvh);
    padding: var(--o-safe-top) var(--o-safe-right) var(--o-safe-bottom) var(--o-safe-left);
    border: 0;
    background: var(--o-sheet);
    box-shadow: none;
  }
  /* The embedded native phone owns the whole handset. Its parent safe-area
     padding must continue the phone surface instead of showing Console green. */
  html[data-theme="dark"] body.o_companion_has_phone .o_chat_panel { background: #000; }
  html[data-theme="light"] body.o_companion_has_phone .o_chat_panel { background: #fff; }
  body.o_chat_expanded .o_chat_panel {
    display: flex;
    width: 100vw;
    box-shadow: none;
  }
  .o_chat_strip { display: none; }
  .o_chat_panel_list, .o_chat_panel_convo, .o_companion_phone { width: 100%; }
  .o_chat_list_head, .o_chat_convo_head {
    min-height: 52px;
    height: auto;
    padding: 8px 10px 8px 16px;
  }
  .o_chat_convo_head { justify-content: flex-start; gap: 2px; padding-left: 8px; }
  .o_chat_convo_name { padding-left: 2px; font-size: 15px; font-weight: 750; }
  .o_chat_panel_btn { width: 42px; height: 42px; }
  .o_chat_mobile_close, .o_chat_mobile_new { display: grid; }
  /* The header Messages button opens chat without covering work controls. */
  .o_chat_mobile_launcher { display: none; }
  body.o_chat_expanded .o_chat_mobile_launcher { display: none; }
  .o_chat_mobile_badge {
    position: absolute;
    top: -5px;
    right: -4px;
    min-width: 21px;
    height: 21px;
    padding: 0 5px;
    border: 2px solid #f8faf7;
    border-radius: 11px;
    background: #5f6f61;
    color: #fff;
    font-size: 10px;
    font-weight: 850;
    line-height: 17px;
    text-align: center;
  }
  .o_chat_mobile_badge[hidden] { display: none; }
  .o_chat_mobile_badge.mention { background: #b4433d; }
}

/* ---- icons ---------------------------------------------------------------
   Solid silhouettes rather than emoji or hairline outlines: emoji render
   differently (and in colour) on every device, and a 1px stroke greys out on
   a handheld screen in daylight. They inherit currentColor so they pick up
   each button's own state. */
.o_chat_icon_btn, .o_chat_strip_btn, .o_chat_panel_btn { line-height: 0; }
.o_chat_icon_btn svg, .o_chat_strip_btn svg, .o_chat_panel_btn svg,
.o_chat_file svg { display: block; }
.o_chat_file { align-items: center; }
.o_chat_file svg { flex: none; opacity: .75; }

/* =====================================================================
   Starting a conversation. The shape follows from who you pick, so the
   picker leads with people and tells you plainly what it is about to make.
   ===================================================================== */
.o_dialog:has(.o_chat_new) { height: min(720px, 86vh); }
.o_dialog:has(.o_chat_new) .o_dialog_body { display: flex; min-height: 0; overflow: hidden; }
.o_chat_new { display: flex; flex: 1 1 auto; min-height: 0; flex-direction: column; gap: 10px; }
.o_chat_new_intro {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 2px 0 4px;
}
.o_chat_new_intro > div { display: flex; flex-direction: column; min-width: 0; }
.o_chat_new_intro strong { font-size: 13px; }
.o_chat_new_intro span { margin-top: 2px; color: var(--o-muted); font-size: 11px; }
.o_chat_new_intro .btn { flex: none; }

.o_chat_tabs {
  display: inline-flex; gap: 2px; padding: 3px; align-self: flex-start;
  background: var(--o-ground); border: 1px solid var(--o-border-light);
  border-radius: 8px;
}
.o_chat_tab {
  padding: 5px 16px; border: 0; border-radius: 6px;
  background: transparent; color: var(--o-muted);
  font: 600 12px/1.4 var(--o-font); cursor: pointer;
}
.o_chat_tab:hover { color: var(--o-text-strong); }
.o_chat_tab.active { background: #fff; color: var(--o-brand-dark); box-shadow: 0 1px 2px rgba(25,57,25,.12); }

.o_chat_name_row:empty { display: none; }
.o_chat_field_label { display: block; font-size: 11px; font-weight: 700; margin-bottom: 4px; }
.o_chat_field_hint { margin-top: 4px; font-size: 11px; }

/* Who is picked, as removable chips — visible without scrolling back up. */
.o_chat_chosen {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  min-height: 30px;
}
.o_chat_chosen_hint { font-size: 12px; }
.o_chat_chosen_chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px 3px 3px;
  border: 1px solid var(--o-border-light); border-radius: 999px;
  background: #fff; color: var(--o-text); font: 500 12px/1 var(--o-font);
  cursor: pointer;
}
.o_chat_chosen_chip:hover { border-color: #b4433d; color: #8d332e; }
.o_chat_chosen_x { font-size: 14px; line-height: 1; opacity: .6; }

.o_chat_avatar {
  display: inline-grid; place-items: center; flex: none;
  border-radius: 50%; font-weight: 700; letter-spacing: .02em;
}
.o_chat_avatar_wrap { position: relative; display: inline-flex; flex: none; }
.o_chat_avatar_wrap > .o_chat_presence_dot {
  position: absolute; right: -1px; bottom: -1px;
  width: 9px; height: 9px; border: 2px solid #fff; box-sizing: content-box;
}

.o_chat_people, .o_chat_directory_results {
  flex: 1 1 auto; min-height: 90px; overflow-y: auto;
  border: 1px solid var(--o-border-light); border-radius: 8px;
}
.o_chat_directory_section {
  position: sticky; top: 0; z-index: 1; padding: 6px 10px;
  border-bottom: 1px solid var(--o-border-light); background: #f7f9f6;
  color: var(--o-muted); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
}
.o_chat_directory_section.groups { background: #fbf6e8; color: #77612c; }
.o_chat_person_row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; text-align: left;
  background: transparent; border: 0;
  border-bottom: 1px solid var(--o-border-light);
  font: inherit; color: var(--o-text); cursor: pointer;
}
.o_chat_person_row:last-child { border-bottom: 0; }
.o_chat_person_row:hover { background: var(--o-brand-soft); }
.o_chat_person_row.picked { background: #eaf3ea; }
.o_chat_person_row.direct:active { background: #e2efe2; }
.o_chat_person_row:disabled { cursor: wait; opacity: .65; }
.o_chat_person_text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.o_chat_person_name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o_chat_person_role { font-size: 11px; }
/* An empty box, not a blank space: the row has to read as tickable before
   anything is ticked. */
.o_chat_check {
  flex: none; width: 20px; height: 20px; display: grid; place-items: center;
  border: 1px solid #c6d2c4; border-radius: 6px; background: #fff; color: #fff;
}
.o_chat_check.on { background: var(--o-brand); border-color: var(--o-brand); }
.o_chat_person_open { flex: none; color: #88918a; font-size: 23px; font-weight: 300; }
.o_chat_group_join_row {
  display: flex; align-items: center; gap: 10px; min-height: 51px; padding: 8px 10px;
  border-bottom: 1px solid var(--o-border-light); background: #fff;
}
.o_chat_group_avatar {
  display: inline-grid; place-items: center; flex: none; width: 30px; height: 30px;
  border: 1px solid #dec982; border-radius: 8px; background: #f4e7bb; color: #735c21;
  font-size: 11px; font-weight: 800; letter-spacing: .03em;
}
.o_chat_join_btn { flex: none; min-height: 30px; padding: 5px 9px; font-size: 10px; }

.o_chat_new_foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-top: 4px;
}
.o_chat_new_foot[hidden] { display: none; }
.o_chat_summary { font-size: 12px; color: var(--o-muted); }
.o_chat_new_foot .btn[disabled] { opacity: .5; cursor: not-allowed; }

/* The directory is a phone workspace, not a desktop modal squeezed narrower.
   Keep the controls still, give the people list the remaining height, and
   follow visualViewport while the software keyboard is open. */
@media (max-width: 640px) {
  .o_dialog_backdrop:has(.o_chat_new) {
    inset: var(--o-chat-new-top, 0) 0 auto;
    align-items: stretch; overflow: hidden; width: 100vw;
    height: var(--o-chat-new-height, 100dvh); padding: 0;
  }
  .o_dialog:has(.o_chat_new) {
    width: 100vw; max-width: none;
    height: 100%; max-height: 100%;
    border-radius: 0; box-shadow: none;
  }
  .o_dialog:has(.o_chat_new) .o_dialog_header {
    flex: 0 0 auto; min-height: calc(54px + var(--o-safe-top));
    padding: calc(8px + var(--o-safe-top)) max(12px, var(--o-safe-right)) 8px max(16px, var(--o-safe-left));
    background: #fff; border-color: #e1e7df;
  }
  .o_dialog:has(.o_chat_new) .o_dialog_header h4 {
    font-size: 20px; font-weight: 750; letter-spacing: -.02em;
  }
  .o_dialog:has(.o_chat_new) .o_close {
    display: grid; place-items: center; width: 42px; height: 42px; padding: 0;
    border-radius: 50%; font-size: 25px;
  }
  .o_dialog:has(.o_chat_new) .o_dialog_body {
    display: flex; flex: 1 1 auto; min-height: 0; overflow: hidden;
    padding: 12px max(12px, var(--o-safe-right)) 0 max(12px, var(--o-safe-left));
  }
  .o_dialog:has(.o_chat_new) .o_dialog_footer { display: none; }
  .o_chat_new { flex: 1 1 auto; min-width: 0; min-height: 0; gap: 9px; }
  .o_chat_new_intro { gap: 8px; }
  .o_chat_new_intro span { font-size: 12px; line-height: 1.25; }
  .o_chat_new_intro .btn { min-height: 40px; padding: 7px 10px; }
  .o_chat_name_row, .o_chat_chosen, .o_chat_new > .o_input { flex: 0 0 auto; }
  .o_chat_chosen { min-height: 26px; max-height: 64px; overflow-y: auto; }
  .o_chat_chosen_hint { font-size: 13px; line-height: 1.3; }
  .o_chat_new > .o_input { width: 100%; min-height: 46px; font-size: 16px; }
  .o_chat_people, .o_chat_directory_results {
    flex: 1 1 auto; min-height: 92px; max-height: none; overflow-y: auto;
    border-color: #d8e1d6; border-radius: 13px;
    overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch;
  }
  .o_chat_person_row { min-height: 58px; gap: 11px; padding: 9px 11px; }
  .o_chat_person_name { font-size: 15px; font-weight: 700; }
  .o_chat_person_role { font-size: 12px; }
  .o_chat_check { width: 24px; height: 24px; border-radius: 7px; }
  .o_chat_group_join_row { min-height: 58px; gap: 11px; padding: 9px 11px; }
  .o_chat_group_avatar { width: 36px; height: 36px; font-size: 13px; }
  .o_chat_new_foot {
    flex: 0 0 auto; min-width: 0; padding: 2px 0 max(10px, var(--o-safe-bottom));
    background: #fff;
  }
  .o_chat_summary {
    min-width: 0; overflow: hidden; display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    font-size: 11px; line-height: 1.3;
  }
  .o_chat_new_foot .btn { flex: 0 0 auto; min-height: 44px; padding-inline: 16px; }
  .o_chat_new:focus-within .o_chat_chosen_hint { display: none; }
  .o_chat_new:focus-within .o_chat_chosen:has(.o_chat_chosen_hint) { min-height: 0; }
  .o_chat_name_row .o_input { min-height: 44px; font-size: 16px; }
  .o_chat_name_row .o_chat_field_hint { line-height: 1.3; }
}

/* The full Chat page IS chat, so neither the panel nor the bubble belongs
   there — a bubble that expands a hidden panel looks broken. Leaving is the
   "Collapse to panel" button in the control panel instead. */
.o_chat_backto_panel { display: inline-flex; align-items: center; gap: 6px; }

/* ---- the list view -------------------------------------------------------
   Between the icons and a conversation: who is talking and the start of what
   they said, so you can triage without opening anything. */
.o_chat_panel_list { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.o_chat_panel_list[hidden], .o_chat_panel_convo[hidden] { display: none; }
.o_chat_list_head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 6px 8px 12px; flex: none; height: 40px;
  border-bottom: 1px solid var(--o-border-light);
  background: var(--o-brand-soft);
}
.o_chat_list_body {
  flex: 1; min-height: 0; overflow-y: auto; padding: 4px;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
.o_chat_group_label {
  padding: 10px 8px 4px; font-size: 10px; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase; color: var(--o-muted);
}
.o_chat_row {
  display: block; width: 100%; text-align: left;
  background: transparent; border: 0; border-radius: 6px;
  padding: 7px 9px; cursor: pointer; font: inherit; color: var(--o-text);
}
.o_chat_row:hover { background: var(--o-brand-soft); }
.o_chat_row.active { background: var(--o-brand-soft); box-shadow: inset 3px 0 0 var(--o-brand); }
.o_chat_row.unread { background: #eaf3ea; }
.o_chat_row.mention { background: #fbe9e8; box-shadow: inset 3px 0 0 #b4433d; }
.o_chat_row_head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.o_chat_row_identity {
  min-width: 0; display: inline-flex; align-items: center; gap: 7px;
}
.o_chat_row_name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o_chat_row_preview {
  margin-top: 2px; font-size: 11px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.o_chat_row_presence { font-weight: 650; }
.o_chat_row_count {
  flex: none; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: #6b7a6c; color: #fff;
  font-size: 10px; font-weight: 800; line-height: 18px; text-align: center;
}
.o_chat_row_count.mention { background: #b4433d; }

/* The bar itself is clickable, so say so. */
.o_chat_strip { cursor: pointer; }
.o_chat_strip_list, .o_chat_strip_btn, .o_chat_chip { cursor: pointer; }
.o_chat_twirl { margin-bottom: 2px; }
