.messenger-shell{display:grid;grid-template-columns:clamp(240px,19vw,310px) minmax(0,1fr);height:calc(100vh - 150px);min-height:590px;background:#fff;border:1px solid #dce3e8;border-radius:15px;overflow:hidden;box-shadow:0 6px 20px #2339480d;color:#344552}
.messenger-shell button,.messenger-dialog button{cursor:pointer}.msg-sidebar{display:flex;flex-direction:column;min-width:0;border-right:1px solid #e0e7e8;background:linear-gradient(150deg,#fcfdfb,#f1f6ef);padding:16px 12px;gap:13px}.msg-sidebar-title{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:34px}.msg-sidebar-title h1{font-size:20px;letter-spacing:-.4px;margin:0}.msg-sidebar-title button{white-space:nowrap;font-size:13px;padding:7px 10px;min-height:34px}.msg-sidebar .input{width:100%;min-width:0;font-size:14px}
.msg-chat-list{overflow-y:auto;flex:1;min-height:0;margin:0 -6px}.msg-chat{display:flex;align-items:center;gap:10px;width:100%;border:1px solid transparent;background:transparent;border-radius:10px;text-align:left;padding:12px 8px;color:#3c535d}.msg-chat:hover{background:#e8efdf}.msg-chat.is-active{background:linear-gradient(140deg,#e8f5db,#dceacb);border-color:#b9d59b}.msg-chat:disabled{cursor:default;opacity:.65}.msg-chat-avatar{display:flex;align-items:center;justify-content:center;flex:0 0 33px;height:33px;border-radius:11px;background:#dfe9e5;color:#4a7260;font-size:18px;font-weight:700}.msg-chat-info{flex:1;min-width:0;display:flex;flex-direction:column;gap:5px}.msg-chat-info strong{font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.msg-chat-info small{font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#70818b}.msg-chat-counts{display:flex;flex-direction:column;align-items:center;gap:5px;font-size:11px}.msg-unread-count,.msg-at-count{border-radius:12px;background:#6e963c;color:white;padding:2px 6px}.msg-at-count{background:#be8541}.msg-sidebar > .crm-browser-notifications{padding:8px;margin:0}.msg-sidebar > .crm-browser-notifications .button-row{gap:5px}.msg-sidebar > small[role=status]{color:#74858d;font-size:11px}
.msg-conversation{display:flex;flex-direction:column;position:relative;min-width:0;min-height:0;background:linear-gradient(120deg,#f6f9f8,#edf3f5)}.msg-chat-header{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:15px 20px;background:#ffffffda;border-bottom:1px solid #dfe7eb}.msg-chat-header h2{font-size:18px;margin:0 0 3px}.msg-chat-header small{font-size:12px;color:#768791}.msg-chat-header #msg-related{display:block;font-size:12px;margin-top:5px}.msg-chat-actions{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:5px 14px;max-width:60%}.msg-chat-actions .text-button{font-size:12px;padding:4px 0}.msg-chat-actions .button{font-size:12px;min-height:30px;padding:5px 9px}.msg-chat-note{margin:0;padding:0 20px;font-size:13px;color:#8c653c}.msg-chat-note:not(:empty){padding-top:12px;padding-bottom:12px}.msg-history{flex:1;overflow:auto;min-height:120px;padding:18px 22px;scrollbar-gutter:stable}.msg-bubble{position:relative;width:fit-content;max-width:min(86%,800px);min-width:170px;background:#fff;border:1px solid #dbe5e8;border-radius:12px 12px 12px 3px;padding:12px 14px;margin:0 auto 13px 0;box-shadow:0 2px 5px #203e4c06}.msg-bubble.is-own{margin-right:0;margin-left:auto;background:#ecf5e3;border-color:#d3e2c7;border-radius:12px 12px 3px 12px}.msg-bubble.is-mentioned{border-color:#d5b16e;box-shadow:0 0 0 1px #efd9a6}.msg-bubble-head{display:flex;align-items:center;gap:7px;flex-wrap:wrap;font-size:12px;color:#5d747c;margin-bottom:7px}.msg-bubble-head strong{font-size:13px}.msg-bubble-head time{margin-left:auto;font-size:11px;color:#819199}.msg-author-meta{font-size:11px;color:#819199}.msg-text{white-space:pre-wrap;overflow-wrap:anywhere;font-size:14px;line-height:1.55}.msg-forwarded{margin:0 0 7px;font-size:12px;color:#718e6e}.msg-mention{background:#e5d6a6;color:#655127;border-radius:4px;padding:1px 3px}.msg-receipt{display:block;margin:7px 0 0 auto;font-size:11px;color:#779160;background:none;border:0;padding:2px 0}.msg-receipt:hover{text-decoration:underline}.msg-select{display:none}.is-selecting .msg-select{display:block}.msg-new-marker{display:flex;justify-content:center;font-size:12px;color:#7a976b;margin:8px 0 18px;border-top:1px solid #cfdec9;padding-top:8px}
.msg-attachments{display:flex;flex-wrap:wrap;gap:9px;margin-top:10px}.msg-attachment{display:flex;flex-direction:column;align-items:flex-start;max-width:100%;min-width:130px;gap:5px;border:1px solid #dbe5df;border-radius:9px;padding:9px;background:#ffffff77}.msg-attachment a{font-size:13px;overflow-wrap:anywhere;max-width:330px}.msg-attachment small{font-size:11px;color:#81938e}.msg-image-open{display:block;background:none;border:0;padding:0}.msg-image{display:block;max-width:240px;max-height:180px;min-height:30px;object-fit:contain;border-radius:6px}.msg-attachment audio{width:min(330px,100%);height:40px;max-width:100%}.msg-file-icon{font-size:24px;color:#7b9287}.msg-composer{padding:12px 20px 15px;background:#fffffff0;border-top:1px solid #dce6e9}.msg-composer textarea{display:block;width:100%;min-height:74px;max-height:170px;resize:vertical;border:1px solid #ccd9dd;border-radius:9px;background:#fff;padding:10px 12px;font:14px/1.5 inherit;color:#344552}.msg-composer textarea:focus{outline:2px solid #b4d78c;border-color:#8db765}.msg-composer-bottom{display:flex;align-items:center;flex-wrap:wrap;gap:12px;min-width:0;margin-top:8px}.msg-composer-bottom>small{flex:1;font-size:11px;color:#80918f}.msg-composer-bottom .button{min-height:34px;padding:6px 13px;font-size:13px}#msg-send-error{margin:6px 0 0;color:#a35346;font-size:12px}.msg-mention-wrap{position:relative}#msg-mentions{position:absolute;bottom:calc(100% + 6px);left:0;width:300px;max-height:260px;overflow:auto;background:#fff;border:1px solid #d3dfd9;box-shadow:0 8px 20px #233e5020;border-radius:9px;z-index:8;padding:5px}#msg-mentions button{width:100%;display:flex;align-items:center;justify-content:space-between;background:none;border:0;padding:9px;text-align:left;border-radius:5px;font-size:13px}#msg-mentions button[aria-selected=true]{background:#edf5e3}#msg-mentions small{color:#819185}
.msg-upload-list{display:flex;flex-wrap:wrap;gap:8px}.msg-upload{display:flex;align-items:center;gap:9px;max-width:100%;background:#f4f7f1;border:1px solid #d9e3d2;border-radius:8px;padding:8px;margin-bottom:9px}.msg-upload img{width:38px;height:38px;object-fit:cover;border-radius:4px}.msg-upload>div{min-width:0}.msg-upload strong{font-size:12px;display:block;max-width:240px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.msg-upload small{font-size:11px;display:block;margin-top:3px}.msg-upload progress{height:5px;max-width:190px;width:100%}.msg-upload .text-button{font-size:11px}.msg-drop-hint{position:absolute;inset:8px;z-index:20;display:flex;align-items:center;justify-content:center;background:#eef8e8ee;border:3px dashed #9cbe72;border-radius:14px;font-size:22px;color:#668542;pointer-events:none}.msg-drop-hint[hidden]{display:none}
.messenger-dialog{width:min(610px,86vw);max-height:88vh;overflow:auto;padding:22px!important}.msg-dialog-header{display:flex;justify-content:space-between;align-items:center;gap:20px;margin-bottom:16px}.msg-dialog-header h2{font-size:21px;margin:0}.messenger-dialog form>label{display:flex;flex-direction:column;gap:6px;margin:12px 0;font-size:13px}.messenger-dialog .input{width:100%;font-size:14px;min-height:37px}.msg-person-list{max-height:300px;overflow:auto;margin:12px 0;background:#f5f8f5;border-radius:9px;padding:6px}.msg-person-list label{display:flex;align-items:center;gap:10px;padding:9px;font-size:14px}.msg-person-list label[hidden]{display:none}.msg-person-list input{width:17px;height:17px;margin:0}.msg-person-list small{font-size:12px;color:#81918a}.msg-dialog-error,#msg-create-error{color:#a35346;font-size:13px}.msg-receipt-list>div{display:flex;flex-direction:column;gap:6px;padding:12px 0;border-bottom:1px solid #dce4de;font-size:13px}.msg-receipt-list small{font-weight:400;color:#7c8c83}.msg-image-dialog{width:min(1100px,92vw)}.msg-image-large{display:block;max-width:100%;max-height:68vh;margin:0 auto 15px;object-fit:contain}#messenger-toast-region{position:fixed;right:22px;bottom:20px;z-index:95;display:flex;flex-direction:column;gap:10px;max-width:340px}.msg-notification{display:flex;flex-direction:column;gap:7px;text-align:left;max-width:100%;padding:13px 16px;border:1px solid #c9ddbc;border-left:4px solid #88b15a;background:#fff;border-radius:10px;box-shadow:0 5px 22px #304b5125;color:#3e595c;cursor:pointer}.msg-notification strong{font-size:13px}.msg-notification span{font-size:12px;overflow-wrap:anywhere}.msg-notification.is-mentioned{border-left-color:#c49c4c;background:#fffdf6}
.msg-composer-actions{
  display:flex;
  align-items:flex-start;
  justify-content:flex-end;
  flex-wrap:wrap;
  gap:8px;
  min-width:0;
  max-width:100%;
  margin-left:auto;
}
.msg-composer-actions [data-voice-status]:empty{position:absolute}
@media(max-width:700px){.msg-composer-bottom{gap:9px}}
@media(max-width:1250px){.msg-chat-header{padding:12px 14px;align-items:flex-start}.msg-chat-actions{max-width:260px}.msg-history{padding:14px}.msg-composer{padding:10px 14px}.msg-bubble{max-width:94%}.msg-attachment audio{width:260px}}
#messenger-toast-region{top:72px;bottom:auto;width:350px;max-width:calc(100vw - 115px);overflow:hidden}.msg-notification{position:relative;display:block;padding:0;overflow:hidden;border-left-width:3px;cursor:default}.msg-notification-open{display:flex;width:100%;gap:11px;padding:15px 34px 15px 14px;text-align:left;border:0;background:transparent;color:inherit;cursor:pointer}.msg-notification-open:hover{background:#f4f8ef}.msg-notification-open:focus-visible{outline:2px solid #9abb77;outline-offset:-3px}.msg-notification .msg-notification-avatar{display:flex;align-items:center;justify-content:center;flex:0 0 36px;height:36px;background:#dfecd3;color:#5b7f3f;border-radius:12px;font-size:13px;font-weight:700}.msg-notification-content{display:flex;flex:1;min-width:0;flex-direction:column;gap:5px}.msg-notification-content>strong{font-size:14px;line-height:1.35;color:#39514a}.msg-notification .msg-notification-chat{font-size:11px;color:#7e9185;line-height:1.3}.msg-notification .msg-notification-preview{font-size:13px;line-height:1.45;color:#536a61;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;line-clamp:3;overflow:hidden;overflow-wrap:anywhere}.msg-notification-mention{font-size:11px;color:#9c7533}.msg-notification-close{position:absolute;top:7px;right:6px;display:flex;align-items:center;justify-content:center;width:25px;height:25px;padding:0;border:0;border-radius:6px;background:transparent;color:#8e9e94;font-size:19px;cursor:pointer}.msg-notification-close:hover{background:#e7eee2;color:#4f6956}
.msg-rail-envelope svg{display:block;width:25px;height:25px;margin:auto}.msg-rail-badge{display:flex;align-items:center;justify-content:center;width:22px;height:22px;min-width:22px;padding:0;border-radius:50%;top:4px;right:5px;font-size:10px;line-height:1;box-shadow:0 0 0 2px #3b4853}.msg-rail-badge[hidden]{display:none}.msg-chat-avatar{width:37px;height:37px;flex-basis:37px;border-radius:50%;overflow:hidden;font-size:12px}.msg-chat-avatar svg{width:21px;height:21px}.msg-person-detail{font-size:10px;color:#8e9d9e;line-height:1}.msg-sidebar-title h1{font-size:18px}.msg-sidebar-title .button{font-size:12px;padding:7px 9px}.msg-tool-button{display:inline-flex;align-items:center;justify-content:center;width:35px;height:35px;flex:0 0 35px;padding:7px!important;border:1px solid #d6e2dd;border-radius:9px;background:linear-gradient(#fff,#f3f7f2);color:#748c88;box-shadow:0 1px 2px #344e4c08;transition:background .15s,color .15s}.msg-tool-button svg{width:20px;height:20px;display:block}.msg-tool-button:hover{color:#547444;background:#e9f2e0;border-color:#c0d5aa}.msg-tool-button:focus-visible{outline:2px solid #86ad5c;outline-offset:2px}.msg-tool-button[aria-pressed=true],.msg-tool-button[data-active=true]{background:#e7f2dc;color:#628d40;border-color:#c5dba9}.msg-tool-button:disabled{opacity:.4;cursor:default}.msg-chat-actions{gap:7px;min-width:0}.msg-header-person{display:flex;align-items:center;gap:11px;min-width:0}.msg-header-person>div{min-width:0}.msg-chat-header h2{overflow-wrap:anywhere;font-size:17px}.msg-chat-header h2 .employee-link{color:inherit;text-decoration-color:#6c8c7b55}.msg-avatar-button{display:flex;align-items:center;justify-content:center;flex:0 0 auto;border:0;padding:0;background:none;border-radius:50%;cursor:pointer}.msg-avatar-button:disabled{opacity:1;cursor:default}.msg-avatar-button:focus-visible{outline:2px solid #8ab35d;outline-offset:3px}.msg-header-avatar{width:40px;height:40px;font-size:13px}.msg-chat-avatar.msg-header-avatar{flex-basis:40px}.msg-bubble-head .msg-author-avatar{display:inline-flex;text-decoration:none;border-radius:50%}.msg-author-avatar .employee-avatar{width:26px;height:26px;font-size:10px}.msg-bubble-head .employee-link{font-size:13px;font-weight:600}.msg-notification-avatar .employee-avatar{width:36px;height:36px;font-size:12px}.msg-chat-header .msg-tool-button{padding:7px!important}

.rail-button[data-space=messenger]{position:relative}.msg-rail-badge{position:absolute;top:2px;right:4px;min-width:19px;padding:2px 4px;border-radius:12px;background:#c14e45;color:#fff;font-size:11px;font-weight:700}

.msg-bubble.is-own{margin-left:0;margin-right:auto;background:#f2edf8;border-color:#ddcdeb;border-radius:12px 12px 12px 3px}.msg-bubble.is-own .msg-receipt{color:#90779f}

.messenger-shell{grid-template-rows:minmax(0,1fr)}.msg-sidebar{min-height:0}.msg-chat-list{overscroll-behavior:contain}

.msg-chat-time{font-size:10px;line-height:1.3;color:#91a09c;font-weight:400;white-space:nowrap}.msg-chat-info{gap:6px}.msg-notification-person{font-size:10px;color:#8d9b94}

/* Group images belong to the chat; employee avatars keep their own renderer. */
.msg-group-image{object-fit:cover;display:block}
.msg-group-summary{display:flex;align-items:center;gap:12px;margin-bottom:14px}
.msg-group-summary .msg-chat-avatar{width:48px;height:48px;flex-basis:48px}
#msg-create-form>fieldset{min-width:0;margin:0;padding:0;border:0}
#msg-create-form>fieldset>label{display:flex;flex-direction:column;gap:6px;margin:12px 0;font-size:14px}
.msg-create-photo{display:flex;gap:14px;align-items:center;flex-wrap:wrap;margin:16px 0}
.msg-group-photo-preview{width:96px;height:96px;object-fit:cover;border:1px solid #d6e2dd;border-radius:12px}
.msg-group-photo-preview[hidden]{display:none}
.msg-create-photo>div{flex:1;min-width:180px}
.msg-create-photo .button{margin:0 8px 6px 0}
#msg-group-photo-error{font-size:14px;color:#a35346}
#msg-group-photo-error[hidden]{display:none}

@media screen {
  #msg-send-error, .msg-dialog-error, #msg-create-error { font-size:14px; }
}
.message-lifecycle{display:flex;gap:10px;align-items:center;justify-content:flex-end;flex-wrap:wrap;margin-top:5px;font-size:12px;color:var(--muted,#657080)}
.message-lifecycle details{position:relative}.message-lifecycle summary{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:28px;box-sizing:border-box;padding:5px 10px;border:1px solid #d4dfe7;border-radius:8px;background:#f8fafc;color:#5b7080;font:inherit;font-weight:600;line-height:1.3;list-style:none;cursor:pointer;user-select:none;box-shadow:0 1px 2px #20354b0a}.message-lifecycle summary::-webkit-details-marker{display:none}.message-lifecycle summary::after{content:'';width:5px;height:5px;border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:translateY(-2px) rotate(45deg)}.message-lifecycle summary:hover,.message-lifecycle details[open]>summary{background:#edf3f7;border-color:#b7cbd9;color:var(--accent,#547b93)}.message-lifecycle details[open]>summary::after{transform:translateY(1px) rotate(225deg)}.message-lifecycle summary:focus-visible,.message-lifecycle details button:focus-visible,.message-lifecycle-history:focus-visible{outline:2px solid var(--accent,#83ad56);outline-offset:2px}.message-lifecycle details>div{position:relative;z-index:10;display:grid;gap:4px;min-width:170px;margin-top:5px;padding:6px;background:var(--surface,#fff);border:1px solid #d4dfe7;border-radius:8px;box-shadow:0 3px 12px #0002}.message-lifecycle details button{text-align:left;white-space:nowrap;border:0;border-radius:5px;background:transparent;color:inherit;font:inherit;padding:7px 8px;cursor:pointer}.message-lifecycle details button:hover{background:#edf3f7;color:var(--accent,#547b93)}.message-lifecycle-history{border:0;background:transparent;padding:0;color:inherit;font:inherit;text-decoration:underline;text-underline-offset:3px;cursor:pointer}
.message-lifecycle-dialog{width:min(620px,calc(100vw - 40px));max-height:85vh;overflow:auto}.message-lifecycle-dialog textarea{box-sizing:border-box;width:100%;min-height:150px;padding:10px}.message-revision{padding:12px 0;border-bottom:1px solid #d7dfe3}.message-revision h3{font-size:15px;margin:0 0 5px}.message-revision p{font-size:12px;color:var(--muted,#657080)}.message-revision>a{display:block;margin-top:5px;overflow-wrap:anywhere}

/* Message content leads; delivery and actions share a compact wrapping footer. */
#crm-ui-root .msg-bubble {
  display:grid;
  grid-template-columns:minmax(0,1fr) auto auto;
  align-items:center;
  column-gap:10px;
  row-gap:0;
  padding:10px 12px;
  margin-bottom:10px;
}
#crm-ui-root .msg-bubble > .msg-bubble-head,
#crm-ui-root .msg-bubble > [data-external-sender],
#crm-ui-root .msg-bubble > .msg-text,
#crm-ui-root .msg-bubble > .msg-forwarded,
#crm-ui-root .msg-bubble > [data-external-forwarded],
#crm-ui-root .msg-bubble > .msg-attachments,
#crm-ui-root .msg-bubble > .external-message-select {
  grid-column:1 / -1;
  min-width:0;
  box-sizing:border-box;
}
#crm-ui-root .msg-bubble > .msg-bubble-head,
#crm-ui-root .msg-bubble > [data-external-sender] {
  order:0;
  margin:0;
  color:#61717e;
  font-size:12px;
  font-weight:600;
  line-height:1.4;
}
#crm-ui-root .msg-bubble-head .employee-link {
  color:inherit;
  font-size:12px;
  font-weight:600;
}
#crm-ui-root .msg-bubble > .msg-forwarded,
#crm-ui-root .msg-bubble > [data-external-forwarded] {
  order:1;
  margin:5px 0 0;
  font-size:11px;
  line-height:1.4;
}
#crm-ui-root .msg-bubble > .msg-text {
  order:2;
  margin:7px 0 0;
  padding:0;
  color:#253442;
  font-size:14.5px;
  line-height:1.5;
}
#crm-ui-root .msg-bubble > .msg-text:empty,
#crm-ui-root .msg-bubble > .msg-attachments:empty { display:none; }
#crm-ui-root .msg-bubble > .msg-attachments { order:3;margin:8px 0 0; }
#crm-ui-root .msg-bubble > .external-message-select { order:-1;margin:0 0 6px; }
#crm-ui-root .msg-bubble > .msg-receipt,
#crm-ui-root .msg-bubble > [data-external-meta],
#crm-ui-root .msg-bubble > .external-forward-message,
#crm-ui-root .msg-bubble > .message-lifecycle {
  min-width:0;
  max-width:100%;
  margin:7px 0 0;
  color:#687987;
  font-size:11px;
  line-height:1.4;
}
#crm-ui-root .msg-bubble > .msg-receipt,
#crm-ui-root .msg-bubble > [data-external-meta] { order:4; }
#crm-ui-root .msg-bubble > .external-forward-message {
  order:5;
  width:26px;
  height:26px;
  min-height:26px;
  padding:0;
  border:1px solid #d9dce3;
  border-radius:6px;
  background:#ffffff5c;
  color:#61717e;
}
#crm-ui-root .msg-bubble > .msg-receipt,
#crm-ui-root .msg-bubble > .external-forward-message,
#crm-ui-root .msg-bubble .message-lifecycle-history {
  display:inline-flex;
  align-items:center;
  justify-content:flex-start;
  min-height:24px;
  box-sizing:border-box;
}
#crm-ui-root .msg-bubble > .message-lifecycle { order:6;gap:4px 8px;justify-content:flex-start; }
#crm-ui-root .msg-bubble > .message-lifecycle:has([role="status"]),
#crm-ui-root .msg-bubble[data-external-message] > .message-lifecycle:has([data-message-edited]):has(details) {
  grid-column:1 / -1;
}
#crm-ui-root .msg-bubble > [data-external-meta] { min-width:min-content; }
#crm-ui-root .msg-bubble > .external-forward-message { justify-content:center; }
#crm-ui-root .msg-bubble > .external-forward-message svg {
  display:block;
  width:16px;
  height:16px;
  stroke:currentColor;
  stroke-width:1.6;
  fill:none;
}
#crm-ui-root .msg-bubble > .external-forward-message:hover {
  background:#fff;
  border-color:#b7cbd9;
  color:#38596d;
}
#crm-ui-root .msg-bubble > .external-forward-message:focus-visible {
  outline:2px solid var(--accent,#83ad56);
  outline-offset:2px;
}
#crm-ui-root .msg-bubble > .message-lifecycle > small { margin:0;font-size:11px;color:inherit; }
#crm-ui-root .msg-bubble .message-lifecycle summary {
  min-height:26px;
  padding:3px 7px;
  gap:6px;
  border-color:#d9dce3;
  background:#ffffff5c;
  color:#61717e;
  font-size:11px;
  font-weight:400;
  box-shadow:none;
}
#crm-ui-root .msg-bubble .message-lifecycle summary:hover,
#crm-ui-root .msg-bubble .message-lifecycle details[open] > summary {
  background:#fff;
  border-color:#b7cbd9;
  color:#38596d;
}
#crm-ui-root .msg-bubble .message-lifecycle details > div { font-size:12px; }

/* Retained deleted content stays readable in its original message card. */
#crm-ui-root .msg-bubble.is-deleted,
#crm-ui-root .msg-bubble.is-deleted .msg-attachment { background:transparent; }
#crm-ui-root .msg-bubble.is-deleted > .msg-text { color:#7b8790;text-decoration:line-through; }
#crm-ui-root .msg-bubble.is-deleted > .msg-text .msg-mention { color:inherit;background:none; }
#crm-ui-root .msg-bubble > .msg-deleted-mark { grid-column:1 / -1;order:2;margin:5px 0 0;color:#687987;font-size:11px;line-height:1.4; }

/* Clickable message URLs share the existing text flow in every chat. */
.msg-text .msg-text-link{overflow-wrap:anywhere;word-break:break-word;text-decoration:underline}
.msg-bubble.is-deleted .msg-text .msg-text-link{color:inherit;text-decoration:inherit}

/* r2: one intrinsic footer row; message text/attachments retain normal wrapping. */
#crm-ui-root .msg-bubble{display:flex;flex-direction:column;align-items:stretch;width:fit-content;min-width:0;max-width:min(100%,800px);box-sizing:border-box}
#crm-ui-root .msg-history{container-name:message-history;container-type:inline-size}
#crm-ui-root .msg-bubble>.msg-message-footer{order:4;display:flex;align-items:flex-start;flex-wrap:nowrap;gap:6px;min-width:0;max-width:100%;margin-top:7px;overflow-x:auto;scrollbar-width:thin;white-space:nowrap;color:#687987;font-size:12px;line-height:1.4}
#crm-ui-root .msg-bubble .msg-message-footer>.message-lifecycle{display:contents;margin:0;color:inherit;font:inherit}
#crm-ui-root .msg-bubble .msg-message-footer>time,
#crm-ui-root .msg-bubble .msg-message-footer>[data-external-meta],
#crm-ui-root .msg-bubble .msg-message-footer>.msg-receipt,
#crm-ui-root .msg-bubble .msg-message-footer .message-lifecycle>small,
#crm-ui-root .msg-bubble .msg-message-footer .message-lifecycle-history{display:inline-flex;align-items:center;flex:0 0 auto;min-height:26px;margin:0;padding:0;color:inherit;font:inherit;white-space:nowrap;box-sizing:border-box}
#crm-ui-root .msg-bubble .msg-message-footer>time,
#crm-ui-root .msg-bubble .msg-message-footer>[data-external-meta]{order:0}
#crm-ui-root .msg-bubble .msg-message-footer>.msg-receipt{order:1}
#crm-ui-root .msg-bubble .msg-message-footer .message-lifecycle>[data-message-edited],
#crm-ui-root .msg-bubble .msg-message-footer .message-lifecycle-history{order:2}
#crm-ui-root .msg-bubble .msg-message-footer>:is(.msg-forward-message,.external-forward-message){order:3;display:inline-flex;align-items:center;justify-content:center;flex:0 0 26px;width:26px;height:26px;min-height:26px;margin:0;padding:0;border:1px solid #d9dce3;border-radius:6px;background:#ffffff5c;color:#61717e;box-sizing:border-box}
#crm-ui-root .msg-bubble .msg-message-footer>:is(.msg-forward-message,.external-forward-message) svg{display:block;width:16px;height:16px;stroke:currentColor;stroke-width:1.6;fill:none}
#crm-ui-root .msg-bubble .msg-message-footer>:is(.msg-forward-message,.external-forward-message):hover{background:#fff;border-color:#b7cbd9;color:#38596d}
#crm-ui-root .msg-bubble .msg-message-footer>:is(.msg-forward-message,.external-forward-message):focus-visible{outline:2px solid var(--accent,#83ad56);outline-offset:2px}
#crm-ui-root .msg-bubble .msg-message-footer .message-lifecycle>details{order:4;flex:0 0 auto}
#crm-ui-root .msg-bubble .msg-message-footer .message-lifecycle>details>summary{min-height:26px;font-size:12px;white-space:nowrap;box-sizing:border-box}
#crm-ui-root .msg-bubble .msg-message-footer .message-lifecycle>[role="status"]{order:5}
@container message-history (max-width:430px){
 #crm-ui-root .msg-bubble .msg-message-footer .message-actions-label{display:none}
 #crm-ui-root .msg-bubble .msg-message-footer .message-lifecycle>details>summary{width:26px;min-width:26px;padding:0;gap:0}
 #crm-ui-root .msg-bubble .msg-message-footer .message-lifecycle>details>summary::before{content:'⋯';font-size:16px;line-height:1}
 #crm-ui-root .msg-bubble .msg-message-footer .message-lifecycle>details>summary::after{display:none}
}

/* Equal audio cards in both directions; keep text-only bubbles intrinsic. */
#crm-ui-root .msg-bubble:has(audio){width:360px;max-width:100%}
/* Both chat tabs use the same sidebar and header at narrow widths. */
@media(max-width:700px){
 .messenger-shell{grid-template-columns:minmax(150px,.8fr) minmax(0,1fr)}
 .msg-sidebar{padding:10px 7px}
 .msg-chat-header{flex-wrap:wrap;gap:8px}
 .msg-chat-actions{max-width:100%;justify-content:flex-start}
}

/* One shell and composer layout for both main chat tabs. */
@media(min-width:900px){
 #messenger-shell{grid-template-columns:clamp(360px,30vw,380px) minmax(0,1fr)}
}
#messenger-shell .msg-chat-header{align-items:flex-start}
#messenger-shell .msg-header-person{flex:1 1 0;align-items:flex-start;min-width:0}
#messenger-shell .msg-header-person>div{flex:1 1 auto;min-width:0;max-width:100%}
#messenger-shell .msg-chat-header h2{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;overflow-wrap:anywhere}
#messenger-shell .msg-chat-actions{flex:0 1 55%;max-width:55%;min-width:0;margin-left:auto}
#messenger-shell .msg-chat-actions>*{min-width:0;max-width:100%}
:is(#messenger-shell,.external-embedded) .msg-composer-bottom{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:8px;margin-top:8px}
:is(#messenger-shell,.external-embedded) .msg-composer-bottom>button{grid-column:1;grid-row:1;justify-self:start}
:is(#messenger-shell,.external-embedded) .msg-composer-bottom>:is(small,.external-attachment-limit){grid-column:1/-1;grid-row:2;min-width:0;max-width:100%;margin:0;overflow-wrap:anywhere}
:is(#messenger-shell,.external-embedded) .msg-composer-bottom>:is(small,.external-attachment-limit):empty{display:none}
:is(#messenger-shell,.external-embedded) .msg-composer-actions{grid-column:2;grid-row:1;justify-self:end;display:flex;align-items:center;justify-content:flex-end;flex-wrap:nowrap;gap:8px;min-width:0;max-width:100%;margin-left:0}
#crm-ui-root :is(#messenger-shell,.external-embedded) .msg-composer-bottom .button{box-sizing:border-box;min-height:42px;height:auto;padding:9px 14px;line-height:22px}
@media(max-width:1100px){
 #messenger-shell .msg-chat-header{flex-wrap:wrap;gap:8px}
 #messenger-shell .msg-header-person{flex-basis:100%}
 #messenger-shell .msg-chat-actions{flex-basis:100%;max-width:100%;justify-content:flex-end}
 :is(#messenger-shell,.external-embedded) .msg-composer-bottom{grid-template-columns:minmax(0,1fr)}
 :is(#messenger-shell,.external-embedded) .msg-composer-actions{grid-column:1;grid-row:2}
 :is(#messenger-shell,.external-embedded) .msg-composer-bottom>:is(small,.external-attachment-limit){grid-row:3}
}
@media(max-width:700px){
 #crm-ui-root :is(#messenger-shell,.external-embedded) [data-voice-record]{width:42px;min-width:42px;padding:11px}
 :is(#messenger-shell,.external-embedded) [data-voice-record] span{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
 :is(#messenger-shell,.external-embedded) .msg-composer-actions:has([data-voice-stop]:not([hidden]),[data-voice-actions]:not([hidden])){flex-wrap:wrap}
 :is(#messenger-shell,.external-embedded) .msg-composer-actions:has([data-voice-stop]:not([hidden]),[data-voice-actions]:not([hidden])) .chat-voice-recorder{flex-basis:100%;width:100%}
}


/* Keep the sidebar heading aligned when only one tab has a group button. */
#messenger-shell .msg-sidebar-title{min-height:42px}
/* A phone cannot fit a readable sidebar beside the conversation. */
@media(max-width:520px){
 #messenger-shell{grid-template-columns:minmax(0,1fr);grid-template-rows:240px auto;height:auto}
 #messenger-shell>.msg-sidebar{overflow:auto;border-right:0;border-bottom:1px solid #e0e7e8}
 #messenger-shell>.msg-sidebar .msg-chat-list{flex:0 0 auto;min-height:80px;max-height:160px}
 #messenger-shell>.msg-conversation{height:calc(100vh - 150px);min-height:590px;overflow:auto}
}


/* Long text actions must grow instead of clipping inside the compact header. */
#crm-ui-root #messenger-shell .msg-chat-actions :is(.button,.ui-button){height:auto;min-height:36px}

/* Reserve equal room when a long phone header needs an outer scrollbar. */
@media(max-width:520px){#messenger-shell>.msg-conversation{scrollbar-gutter:stable}}

/* Let phone history yield room to the header and composer instead of clipping buttons. */
@media(max-width:520px){#messenger-shell>.msg-conversation>.msg-history{min-height:0}}
