.portal-chat-launcher{position:fixed;right:22px;bottom:22px;z-index:850;display:none;align-items:center;gap:10px;min-height:58px;border:1px solid rgba(255,255,255,.72);border-radius:18px;background:linear-gradient(135deg,#3157e5,#684ee8);color:#fff;padding:8px 13px 8px 8px;cursor:pointer;box-shadow:0 18px 45px rgba(38,68,170,.32);transition:transform .2s ease,box-shadow .2s ease;isolation:isolate;overflow:hidden}
.portal-chat-launcher::after{content:"";position:absolute;inset:-80% -30%;z-index:-1;background:linear-gradient(90deg,transparent,rgba(255,255,255,.2),transparent);transform:translateX(-75%) rotate(18deg);animation:portalChatSweep 5s ease-in-out infinite}
.portal-chat-launcher:hover{transform:translateY(-2px);box-shadow:0 22px 52px rgba(38,68,170,.4)}
.portal-chat-launcher.has-unread{animation:portalChatNudge 2.8s ease-in-out infinite}
.portal-chat-launcher-icon{width:42px;height:42px;border-radius:13px;background:rgba(255,255,255,.16);display:grid;place-items:center;border:1px solid rgba(255,255,255,.22)}.portal-chat-launcher-icon svg{width:21px;height:21px}
.portal-chat-launcher-copy{text-align:left}.portal-chat-launcher-copy strong{display:block;font-size:.76rem}.portal-chat-launcher-copy small{display:block;margin-top:2px;color:#dfe7ff;font-size:.58rem}
.portal-chat-launcher-badge{display:none;position:absolute;top:4px;right:5px;min-width:21px;height:21px;padding:0 5px;border:2px solid #fff;border-radius:999px;background:#ef4444;color:#fff;place-items:center;font-size:.58rem;font-weight:900}
.portal-chat-section{position:fixed;right:22px;bottom:92px;z-index:900;display:none;flex-direction:column;width:min(430px,calc(100vw - 30px));height:min(650px,calc(100vh - 118px));border:1px solid #d8e3f2;border-radius:22px;background:#fff;overflow:hidden;box-shadow:0 28px 85px rgba(17,35,78,.28);transform-origin:bottom right;animation:portalChatOpen .22s ease both}
.portal-chat-section.open{display:flex}
.portal-chat-header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:13px 14px;background:linear-gradient(135deg,#f6f9ff,#edf3ff);border-bottom:1px solid #dae5f2;flex:0 0 auto}
.portal-chat-heading{display:flex;align-items:center;gap:10px;min-width:0}.portal-chat-heading-icon{width:38px;height:38px;border-radius:12px;background:linear-gradient(135deg,#3157e5,#7657f6);color:#fff;display:grid;place-items:center;box-shadow:0 9px 20px rgba(49,87,229,.22)}.portal-chat-heading-icon svg{width:18px;height:18px}.portal-chat-heading strong{display:block;font-size:.8rem}.portal-chat-heading span{display:flex;align-items:center;gap:6px;margin-top:3px;color:#6f7d91;font-size:.61rem}.portal-chat-heading span::before{content:"";width:6px;height:6px;border-radius:50%;background:#18aa68;box-shadow:0 0 0 3px rgba(24,170,104,.11)}
.portal-chat-window-actions{display:flex;align-items:center;gap:6px}.portal-chat-window-actions button{width:29px;height:29px;border:1px solid #d7e1ee;border-radius:9px;background:#fff;color:#536177;cursor:pointer;font-size:1rem;line-height:1}.portal-chat-window-actions button:hover{background:#f4f7fc}.portal-chat-unread{display:none;min-width:22px;height:22px;border-radius:999px;background:#ef4444;color:#fff;place-items:center;font-size:.6rem;font-weight:850;padding:0 6px}
.portal-chat-layout{display:grid;grid-template-rows:auto minmax(0,1fr);min-height:0;flex:1}.portal-chat-sidebar{border-bottom:1px solid #e3eaf4;background:#f8faff;padding:8px;display:flex;align-items:stretch;gap:7px;overflow-x:auto;flex:0 0 auto}.portal-chat-new{min-width:112px;height:39px;border:0;border-radius:10px;background:#3157e5;color:#fff;font-size:.66rem;font-weight:800;cursor:pointer}.portal-chat-list{display:flex;gap:6px;min-width:0}.portal-chat-thread-btn{min-width:145px;max-width:170px;text-align:left;border:1px solid transparent;border-radius:10px;background:transparent;padding:7px 9px;cursor:pointer;color:#26364e}.portal-chat-thread-btn:hover{background:#fff;border-color:#dce6f4}.portal-chat-thread-btn.active{background:#fff;border-color:#bfcff5;box-shadow:0 5px 15px rgba(42,78,156,.07)}.portal-chat-thread-top{display:flex;align-items:center;justify-content:space-between;gap:7px;font-size:.63rem;font-weight:800}.portal-chat-thread-order{margin-top:3px;color:#6e7d92;font-size:.55rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.portal-chat-thread-preview{margin-top:4px;color:#8995a6;font-size:.53rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.portal-chat-thread-count{min-width:17px;height:17px;border-radius:999px;background:#ef4444;color:#fff;display:grid;place-items:center;font-size:.51rem}
.portal-chat-main{min-width:0;min-height:0;display:grid;grid-template-rows:auto minmax(0,1fr) auto}.portal-chat-context{padding:9px 12px;border-bottom:1px solid #e5ebf4;background:#fff;display:flex;align-items:center;justify-content:space-between;gap:8px}.portal-chat-context strong{font-size:.69rem}.portal-chat-context span{font-size:.56rem;color:#7b8799}.portal-chat-messages{min-height:0;overflow:auto;background:linear-gradient(#fbfdff,#f5f8fc);padding:13px;display:flex;flex-direction:column;gap:9px}.portal-chat-empty{margin:auto;text-align:center;color:#7f8da1;font-size:.68rem;max-width:280px;line-height:1.55}.portal-chat-message{max-width:83%;display:flex;flex-direction:column;gap:4px}.portal-chat-message.customer{align-self:flex-end;align-items:flex-end}.portal-chat-message.admin,.portal-chat-message.system{align-self:flex-start}.portal-chat-bubble{padding:9px 11px;border-radius:13px;line-height:1.48;font-size:.68rem;white-space:pre-wrap;overflow-wrap:anywhere}.portal-chat-message.customer .portal-chat-bubble{background:#3157e5;color:#fff;border-bottom-right-radius:5px}.portal-chat-message.admin .portal-chat-bubble{background:#fff;color:#1b293c;border:1px solid #dce6f4;border-bottom-left-radius:5px}.portal-chat-message.system .portal-chat-bubble{background:#edf4ff;color:#31547a;border:1px solid #d1e0f5}.portal-chat-meta{font-size:.51rem;color:#8b97a8}.portal-chat-files{display:flex;flex-direction:column;gap:4px}.portal-chat-file{border:1px solid #d9e5f3;border-radius:8px;background:#fff;padding:6px 8px;color:#2e5f9e;font-size:.56rem;font-weight:750;cursor:pointer;text-align:left}
.portal-chat-compose{border-top:1px solid #e2e9f2;background:#fff;padding:10px 11px}.portal-chat-order-select{width:100%;height:34px;border:1px solid #dce5f1;border-radius:9px;padding:0 9px;background:#f9fbff;color:#26364e;font-size:.61rem;margin-bottom:7px}.portal-chat-file-summary{display:none;margin-bottom:6px;padding:6px 8px;border-radius:8px;background:#edf4ff;color:#416085;font-size:.55rem}.portal-chat-file-summary.show{display:block}.portal-chat-compose-row{display:grid;grid-template-columns:auto 1fr auto;gap:6px;align-items:end}.portal-chat-attach{width:38px;height:38px;border:1px solid #dce5f1;border-radius:10px;background:#f5f8ff;color:#3157e5;cursor:pointer;font-size:1rem}.portal-chat-input{resize:none;min-height:38px;max-height:86px;border:1px solid #dce5f1;border-radius:10px;background:#fbfcff;padding:8px 9px;font:inherit;font-size:.66rem;outline:none}.portal-chat-input:focus{border-color:#3157e5;box-shadow:0 0 0 3px rgba(49,87,229,.08)}.portal-chat-send{height:38px;min-width:57px;border:0;border-radius:10px;background:#3157e5;color:#fff;font-size:.63rem;font-weight:800;cursor:pointer}.portal-chat-send:disabled{opacity:.65;cursor:wait}.portal-chat-helper{display:flex;justify-content:space-between;gap:10px;margin-top:6px;color:#8a96a7;font-size:.5rem}.portal-chat-error{display:none;margin-top:6px;padding:6px 8px;border-radius:8px;background:#fff0f2;border:1px solid #ffd2d9;color:#ad3343;font-size:.57rem}.portal-chat-error.show{display:block}
@keyframes portalChatOpen{from{opacity:0;transform:translateY(12px) scale(.97)}to{opacity:1;transform:translateY(0) scale(1)}}
@keyframes portalChatSweep{0%,55%{transform:translateX(-75%) rotate(18deg)}80%,100%{transform:translateX(75%) rotate(18deg)}}
@keyframes portalChatNudge{0%,82%,100%{transform:translateY(0)}88%{transform:translateY(-3px)}94%{transform:translateY(0)}}
@media(max-width:600px){.portal-chat-launcher{right:14px;bottom:14px;min-height:53px;border-radius:16px}.portal-chat-launcher-copy small{display:none}.portal-chat-section{right:8px;left:8px;bottom:8px;width:auto;height:min(680px,calc(100dvh - 16px));border-radius:20px;transform-origin:bottom center}.portal-chat-sidebar{padding:7px}.portal-chat-new{min-width:105px}.portal-chat-thread-btn{min-width:135px}.portal-chat-header{padding:12px}.portal-chat-messages{padding:11px}.portal-chat-compose{padding:9px}.portal-chat-helper span:last-child{display:none}}
@media(prefers-reduced-motion:reduce){.portal-chat-launcher,.portal-chat-launcher::after,.portal-chat-section{animation:none!important;transition:none!important}}

/* Read receipts and typing indicators */
.portal-chat-meta{display:flex;align-items:center;justify-content:flex-start;gap:6px;flex-wrap:wrap}
.portal-chat-message.customer .portal-chat-meta{justify-content:flex-end}
.portal-chat-message-status{font-weight:800;color:#8a96a8}
.portal-chat-message-status.delivered{color:#607da6}
.portal-chat-message-status.seen{color:#3157e5}
.portal-chat-typing{display:none;min-height:31px;align-items:center;gap:7px;padding:6px 12px;background:#f8faff;border-top:1px solid #e7edf5;color:#607089;font-size:.56rem;flex:0 0 auto}
.portal-chat-typing.show{display:flex}
.portal-chat-typing strong{font-size:.56rem;font-weight:750}
.portal-chat-typing-dots{display:inline-flex;align-items:center;gap:3px}
.portal-chat-typing-dots i{width:5px;height:5px;border-radius:50%;background:#657fd1;animation:dtcPortalTyping 1.1s infinite ease-in-out}
.portal-chat-typing-dots i:nth-child(2){animation-delay:.14s}.portal-chat-typing-dots i:nth-child(3){animation-delay:.28s}
@keyframes dtcPortalTyping{0%,60%,100%{transform:translateY(0);opacity:.45}30%{transform:translateY(-3px);opacity:1}}
@media(prefers-reduced-motion:reduce){.portal-chat-typing-dots i{animation:none}}
.portal-chat-main{grid-template-rows:auto minmax(0,1fr) auto auto}
