@import url("./chat-messenger.css");
.crm-chat-workspace{display:grid;grid-template-columns:300px minmax(0,1fr);height:calc(var(--workspace-viewport-height,100dvh) - var(--workspace-header-height) - 40px);min-height:420px;overflow:hidden;margin:-2px -16px -16px;background:var(--surface);border-top:1px solid var(--line)}
.crm-chat-sidebar{display:flex;flex-direction:column;min-height:0;border-right:1px solid var(--line);background:var(--surface)}
.crm-chat-search{display:flex;align-items:center;gap:6px;padding:15px 12px 8px}.crm-chat-search label{display:flex;gap:9px;align-items:center;min-width:0;flex:1;padding:9px 10px;border-radius:10px;background:var(--soft)}.crm-chat-search label>.icon{width:16px;flex:none;color:var(--muted)}.crm-chat-search input{border:0;background:none;outline:none;font:inherit;font-size:13px;width:100%;min-width:0;color:var(--ink)}.crm-chat-search label:focus-within{outline:2px solid var(--accent);outline-offset:2px}
.crm-chat-filters{display:flex;gap:6px;padding:5px 12px 12px}.crm-chat-filters select,.crm-chat-thread-tools select{background:transparent;color:var(--muted);border:0;font:inherit;font-size:12px;min-width:0;max-width:100%;padding:6px 3px}.crm-chat-filters select{width:100%}.crm-chat-list{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain}.crm-chat-row{position:relative;display:flex;gap:12px;padding:15px 13px;border-top:1px solid var(--line);text-decoration:none;color:var(--ink);transition:background var(--motion-menu) var(--ease)}.crm-chat-row:hover{background:var(--hover)}.crm-chat-row.is-selected{background:var(--soft)}.crm-chat-row.is-selected:before{content:'';position:absolute;left:0;top:12px;bottom:12px;width:3px;border-radius:3px;background:var(--ink)}
.crm-chat-avatar{display:flex;align-items:center;justify-content:center;width:37px;height:37px;border-radius:50%;background:var(--soft);border:1px solid var(--line);font-size:14px;flex:none;position:relative}.crm-chat-avatar>span{position:absolute;bottom:-3px;right:-3px}.crm-chat-avatar .integration-logo{--logo-size:17px;--logo-padding:2px;border-radius:50%;border:2px solid var(--surface)}.crm-chat-row-copy{display:flex;flex-direction:column;min-width:0;flex:1;gap:4px}.crm-chat-row-copy>span:first-child{display:flex;gap:8px;justify-content:space-between;align-items:center}.crm-chat-row-copy strong{font-size:13px;font-weight:600;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.crm-chat-row time{font-size:10px;white-space:nowrap;color:var(--muted);flex:none}.crm-chat-row-deal{font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.crm-chat-row-preview{font-size:12px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.crm-chat-row-copy small{font-size:10px;color:var(--muted)}.crm-chat-unread{position:absolute;right:12px;bottom:12px;font-size:10px;min-width:17px;height:17px;padding:0 4px;border-radius:20px;background:var(--ink);color:var(--surface);display:flex;align-items:center;justify-content:center}.crm-chat-more{padding:12px}.crm-chat-list-error{font-size:12px;color:var(--error);padding:0 12px}.crm-chat-list-error:not(:empty){padding-block:12px}
.crm-chat-content{display:flex;flex-direction:column;min-width:0;min-height:0;background:var(--bg)}.crm-chat-header{display:flex;gap:12px;align-items:center;min-height:77px;padding:14px 22px;border-bottom:1px solid var(--line);background:var(--surface)}.crm-chat-heading{min-width:0;flex:1;display:grid;gap:5px}.crm-chat-heading>a,.crm-chat-heading>strong{color:var(--ink);text-decoration:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.crm-chat-heading>a:hover{text-decoration:underline;text-decoration-style:dashed;text-decoration-color:var(--hover-underline,#d3d7db);text-decoration-thickness:1px;text-underline-offset:4px}.crm-chat-heading strong{font-size:15px;font-weight:600}.crm-chat-heading>span{display:flex;align-items:center;gap:5px;font-size:11px;color:var(--muted)}.crm-chat-heading .integration-logo{--logo-size:16px;--logo-padding:2px;border:0;border-radius:50%}.crm-chat-header-actions .btn{font-size:12px;max-width:230px;min-width:0;display:flex;gap:6px;align-items:center}.crm-chat-header-actions .btn>span{max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.crm-chat-header-actions .icon{width:15px;flex:none}.crm-chat-back{display:none}.crm-chat-welcome,.crm-chat-no-results{display:flex;flex-direction:column;gap:12px;align-items:center;justify-content:center;text-align:center;padding:32px;color:var(--muted)}.crm-chat-welcome{flex:1}.crm-chat-welcome>.icon{width:38px;height:38px;stroke-width:1.3}.crm-chat-welcome h2{font-size:17px;font-weight:500;color:var(--ink);margin:4px 0 0}.crm-chat-welcome p,.crm-chat-no-results p{font-size:13px;line-height:1.6;max-width:300px;margin:0}.crm-chat-no-results{padding:45px 20px;font-size:13px}.crm-chat-thread-host{min-height:0;flex:1}.crm-chat-thread-tools{display:flex;align-items:center;justify-content:space-between;flex:none;gap:10px;padding:8px 22px}.crm-chat-thread-tools .text-btn{font-size:11px;color:var(--muted)}.crm-chat-empty-messages{text-align:center;color:var(--muted);font-size:12px;padding:32px}.crm-chat-older{display:block;margin:0 auto 20px;font-size:12px}.crm-chat-thread-error{font-size:12px;color:var(--error);line-height:1.5;padding:0 22px}.crm-chat-thread-error:not(:empty){padding-block:9px}.crm-chat-closed{font-size:12px;color:var(--muted);padding:15px 22px;border-top:1px solid var(--line)}
.crm-chat-workspace.has-record{grid-template-columns:260px minmax(320px,1fr) 350px}.crm-chat-record{min-width:0;overflow:auto;background:var(--surface);border-left:1px solid var(--line)}.crm-chat-record-toolbar{display:flex;gap:8px;justify-content:space-between;align-items:center;padding:12px 15px;border-bottom:1px solid var(--line);font-size:13px;position:sticky;top:0;background:var(--surface);z-index:3}.crm-chat-record-toolbar a{display:flex;gap:6px;align-items:center;font-size:12px;color:var(--muted);text-decoration:none}.crm-chat-record-toolbar .icon{width:16px}.crm-chat-record #crm-detail{padding:0;min-height:0}.crm-chat-record .crm-record-layout{display:block!important;height:auto!important;min-height:0!important}.crm-chat-record .crm-record-fields{border:0;border-radius:0;width:100%;max-width:none;height:auto;max-height:none}.crm-chat-record .crm-record-activity{display:none}.crm-chat-record .crm-record-header>a{display:none}.crm-chat-record .crm-record-header{padding-inline:16px}.crm-chat-record .crm-record-panels{max-height:none;overflow:visible}.crm-chat-record .crm-record-tabbar{padding-inline:16px}.crm-chat-create-deal{padding:20px;display:grid;gap:20px}.crm-chat-create-deal .account-field input,.crm-chat-create-deal .account-field select{width:100%;padding:10px 12px;border:1px solid var(--line);border-radius:10px;color:var(--ink);background:var(--surface);font:inherit;font-size:13px}.crm-chat-create-deal .account-field>span{display:block;font-size:12px;color:var(--muted);margin-bottom:8px}
.crm-conversation{border:1px solid var(--line);border-radius:12px;background:var(--surface);margin:14px 0;overflow:hidden}.crm-conversation>summary{list-style:none;display:flex;align-items:center;gap:10px;padding:14px;cursor:pointer;min-width:0}.crm-conversation>summary:hover strong{color:var(--ink)}.crm-conversation>summary::-webkit-details-marker{display:none}.crm-conversation>summary .integration-logo{--logo-size:28px;--logo-padding:5px;border:0;border-radius:8px}.crm-conversation-copy{display:grid;gap:7px;min-width:0;flex:1}.crm-conversation-title{display:flex;align-items:baseline;justify-content:space-between;gap:8px;min-width:0}.crm-conversation-title strong{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.crm-conversation-title small{white-space:nowrap;flex:none}.crm-conversation>summary strong{font-size:12px;font-weight:600}.crm-conversation>summary small{font-size:10px;color:var(--muted)}.crm-conversation>summary>.icon{width:14px;height:14px;flex:none;color:var(--muted);transition:transform var(--motion-menu) var(--ease)}.crm-conversation[open]>summary>.icon{transform:rotate(180deg)}.crm-conversation-link{display:flex;align-items:center;gap:6px;justify-content:flex-end;padding:10px 14px;font-size:11px;color:var(--muted);border-top:1px solid var(--line);text-decoration:none}.crm-conversation-link>.icon{width:12px;height:12px}.is-embedded .crm-chat-thread-tools{justify-content:flex-end;padding:0 14px 8px}.crm-contact-chats{display:grid;gap:8px}.crm-contact-chat-link{display:flex;align-items:center;gap:12px;padding:14px 8px;color:var(--ink);text-decoration:none;border-bottom:1px solid var(--line)}.crm-contact-chat-link>span:not(.integration-logo){display:grid;gap:5px;min-width:0;flex:1}.crm-contact-chat-link strong{font-size:13px}.crm-contact-chat-link small{font-size:11px;color:var(--muted)}.crm-contact-chat-link>.icon{width:16px}.crm-contact-chat-link .integration-logo{--logo-size:34px;--logo-padding:6px}.crm-contact-chats-error{color:var(--error);font-size:12px}
@media(max-width:1200px){.crm-chat-workspace.has-record{grid-template-columns:240px minmax(0,1fr)}.crm-chat-record{position:absolute;right:0;top:0;bottom:0;width:min(390px,100%);z-index:10;box-shadow:-16px 0 30px #00000012}.crm-chat-workspace{position:relative}.crm-chat-header{padding:12px 16px}}
@media(max-width:760px){.crm-chat-workspace{grid-template-columns:250px minmax(0,1fr)}.crm-chat-header-actions .btn{max-width:135px}.crm-chat-thread-tools{padding:8px 12px}}
@media(max-width:600px){.crm-chat-workspace,.crm-chat-workspace.has-record{grid-template-columns:minmax(0,1fr);height:calc(var(--workspace-viewport-height,100dvh) - 100px);margin-inline:-12px;min-height:350px}.crm-chat-content{display:none}.crm-chat-workspace.has-selection .crm-chat-sidebar{display:none}.crm-chat-workspace.has-selection .crm-chat-content{display:flex}.crm-chat-back{display:flex;flex:none}.crm-chat-header{padding:10px 12px;gap:8px;min-height:72px}.crm-chat-heading strong{font-size:14px}.crm-chat-header-actions .btn{padding:7px 8px;font-size:11px;max-width:145px}.crm-chat-sidebar{border-right:0}.crm-chat-record{width:100%;border:0}.crm-chat-thread-tools select{font-size:11px}.crm-chat-thread-tools .text-btn{font-size:10px}}
@media(prefers-reduced-motion:reduce){}

.crm-chat-latest{padding:10px;text-align:center;font-size:12px;border-top:1px solid var(--line)}

.crm-chat-link-existing{padding:20px;border-bottom:1px solid var(--line)}.crm-chat-link-existing>strong{font-size:12px}.crm-chat-link-existing [data-chat-deal-options]{display:grid;gap:7px;margin-top:12px}.crm-chat-link-existing .btn{display:grid;gap:4px;text-align:left;justify-content:start;white-space:normal;padding:12px;font-size:12px}.crm-chat-link-existing small{font-size:10px;color:var(--muted)}

.crm-chat-thread [hidden]{display:none!important}
@media(max-width:600px){.crm-conversation-title{flex-wrap:wrap;gap:4px 8px}.crm-conversation>summary{padding:12px}}

/* CRM uses the same inbox shell as chatbot Contacts. Deal fields keep their editor. */
.crm-inbox.aud-inbox .aud-body{grid-template-columns:minmax(260px,280px) minmax(0,1fr)}
.crm-inbox.aud-inbox.has-record .aud-body{grid-template-columns:minmax(260px,280px) minmax(300px,1fr) 310px}
.crm-inbox .aud-person,.crm-inbox .aud-chat-title>a{color:var(--ink);text-decoration:none;min-width:0}
.crm-inbox .aud-chat-title>a{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.crm-inbox .aud-chat-title>a:hover{text-decoration:underline;text-decoration-style:dashed;text-decoration-color:var(--hover-underline,#d3d7db);text-decoration-thickness:1px;text-underline-offset:4px}
.crm-inbox .crm-chat-list-error{margin:0}
.crm-inbox .aud-top>.icon-btn:disabled,.crm-inbox .aud-bulk>.btn:disabled{opacity:.45;cursor:default;pointer-events:none}
.crm-inbox .crm-chat-record{display:flex;flex-direction:column;min-height:0;overflow:hidden;position:static;width:auto;box-shadow:none}
.crm-inbox .crm-chat-record[hidden]{display:none}
.crm-inbox .crm-chat-record-toolbar{position:static;flex:0 0 var(--aud-panel-head-height);height:var(--aud-panel-head-height);box-sizing:border-box;padding:12px 16px;gap:8px;justify-content:initial}
.crm-inbox .crm-chat-record-toolbar>strong{font-size:12px;min-width:0;flex:1}
.crm-inbox .crm-chat-record-scroll{overflow:auto;min-height:0;flex:1;overscroll-behavior:contain}
.crm-chat-mode{position:relative;display:flex;align-items:center;gap:4px;max-width:152px;min-width:0;color:var(--muted);border-radius:7px;padding:5px}
.crm-chat-mode:hover{background:var(--hover);color:var(--ink)}
.crm-chat-mode select{font:inherit;font-size:11px;appearance:none;border:0;outline:none;background:transparent;color:inherit;cursor:pointer;min-width:0;width:100%;padding:0 18px 0 0;text-overflow:ellipsis}
.crm-chat-mode>.icon:last-child{position:absolute;right:3px;width:12px;height:12px;pointer-events:none}
.crm-chat-mode:focus-within{outline:2px solid var(--accent);outline-offset:2px}
.crm-inbox .aud-chat-actions{gap:4px}
@media(max-width:1250px){.crm-inbox.aud-inbox.has-record .aud-body{grid-template-columns:minmax(260px,280px) minmax(0,1fr)}.crm-inbox.has-record .crm-chat-record{position:absolute;inset:0 0 0 auto;width:min(350px,100%);z-index:10;box-shadow:-8px 0 25px #0001}.crm-inbox .crm-chat-mode{width:28px;padding:6px}.crm-inbox .crm-chat-mode select{position:absolute;inset:0;opacity:0;cursor:pointer}.crm-inbox .crm-chat-mode>.icon:last-child{display:none}}
@media(max-width:800px){.crm-inbox .crm-chat-back{display:inline-flex}.crm-inbox.aud-inbox .aud-body,.crm-inbox.aud-inbox.has-record .aud-body{display:flex}.crm-inbox.has-record .crm-chat-record{width:100%}.crm-inbox .aud-chat-actions .icon-btn{width:28px;height:32px}.crm-inbox .aud-chat-header{padding:10px;gap:6px}.crm-inbox .aud-chat-title{min-width:0}.crm-inbox .aud-top>.aud-selection{width:auto;flex:1;flex-wrap:wrap;gap:5px}.crm-inbox .aud-selection .aud-bulk{margin-left:auto}}
/* The deal timeline uses the same messenger at the card's denser scale. */
.crm-conversation{margin:10px 0;border-radius:10px}
.crm-conversation>summary{min-height:42px;padding:8px 12px;gap:8px}
.crm-conversation>summary .integration-logo{--logo-size:22px;--logo-padding:4px;border-radius:6px}
.crm-conversation-actions{display:flex;gap:2px;align-items:center;flex:none}
.crm-conversation-actions .icon-btn{display:grid;place-items:center;width:27px;height:27px;padding:5px;color:var(--muted);text-decoration:none}
.crm-conversation-actions .icon{width:15px;height:15px}
.crm-conversation-title{justify-content:flex-start}
.crm-conversation:not([open]) .crm-conversation-actions{display:none}
.crm-conversation-title strong{min-width:0}
.crm-conversation:not([open]) .crm-conversation-title{flex-wrap:nowrap}
.crm-conversation .crm-chat-thread.is-embedded{height:clamp(300px,43dvh,440px);max-height:none}
.crm-conversation .is-embedded .crm-chat-messages{max-height:none;padding:10px 14px 14px;scroll-padding-block:34px 10px}
.crm-conversation .is-embedded .chat-message-wrap{max-width:min(86%,440px)}
.crm-conversation .is-embedded .crm-chat-bubble .chat-text{font-size:12px;line-height:1.5}
.crm-conversation .is-embedded .crm-chat-bubble{padding:6px 9px;border-radius:10px}
.crm-conversation .is-embedded .aud-message-buttons :is(a,span){min-height:29px;font-size:11px}
.crm-conversation .is-embedded .crm-chat-compose{margin:0 10px 10px}
.crm-conversation .is-embedded .chat-compose-row{gap:6px}
.crm-conversation .is-embedded .chat-compose-input{min-height:36px;padding:3px 5px 3px 12px;border-radius:20px}
body[data-workspace=true] .crm-conversation .is-embedded textarea{font-size:12px;line-height:20px;margin:3px 0}
.crm-conversation .is-embedded .crm-chat-compose :is(.chat-attach,.chat-emoji-trigger,.chat-send){width:30px;height:30px}
.crm-conversation .is-embedded .crm-chat-compose .chat-attach{width:38px;height:38px}
.crm-conversation .is-embedded .chat-attach svg{width:21px;height:21px}
.crm-conversation .is-embedded .chat-emoji-trigger svg{width:23px;height:23px}
.crm-conversation .is-embedded .crm-chat-compose .chat-send:not(.is-visible){width:0}
@media(max-width:600px){.crm-conversation .crm-chat-thread.is-embedded{height:350px}.crm-conversation .is-embedded .chat-message-wrap{max-width:95%}.crm-conversation>summary{padding:8px 10px}}

.crm-conversation .crm-chat-mode{max-width:170px;font-size:10px}.crm-conversation .crm-chat-mode select{font-size:10px;padding-block:4px}.crm-conversation .crm-chat-mode>.icon{width:13px;height:13px}
