/* Nonmodal chat: the workspace remains mounted and usable behind it. */
.qps-chat-popup,.qps-chat-launcher{--chat-surface:#fff;--chat-ink:#24242a;--chat-muted:#74747d;--chat-border:#e5e5eb;--chat-header:#f8f8fa;--chat-accent:#5365f6;box-sizing:border-box}
[data-qps-theme="dark"] .qps-chat-popup,[data-qps-theme="dark"] .qps-chat-launcher,
[data-qps-theme="black"] .qps-chat-popup,[data-qps-theme="black"] .qps-chat-launcher{--chat-surface:#17171a;--chat-ink:#f4f4f7;--chat-muted:#a2a2ae;--chat-border:#34343c;--chat-header:#202024;--chat-accent:#b1b9ff}
[data-qps-theme="black"] .qps-chat-popup,[data-qps-theme="black"] .qps-chat-launcher{--chat-surface:#050507;--chat-border:#2a2a32;--chat-header:#101014}
@media(prefers-color-scheme:dark){:root:not([data-qps-theme]) .qps-chat-popup,:root:not([data-qps-theme]) .qps-chat-launcher{--chat-surface:#17171a;--chat-ink:#f4f4f7;--chat-muted:#a2a2ae;--chat-border:#34343c;--chat-header:#202024;--chat-accent:#b1b9ff}}
.qps-chat-launcher{position:fixed;right:max(20px,env(safe-area-inset-right));bottom:max(18px,env(safe-area-inset-bottom));z-index:19500;display:flex;align-items:center;gap:9px;min-height:48px;padding:12px 17px;border:1px solid var(--chat-border);border-radius:24px;background:var(--chat-surface);color:var(--chat-ink);box-shadow:0 6px 25px #25254726;cursor:pointer;font-family:inherit;font-size:13px;font-weight:600}
.qps-chat-launcher>svg{width:23px;height:23px;color:var(--chat-accent)}
.qps-chat-launcher .qps-chat-unread{margin:0;flex:none}
/* One launcher follows the visible workspace header across screen sizes. */
[data-qps-header-chat]{display:flex;flex:none;align-items:center}
[data-qps-header-chat] .qps-chat-launcher.qps-chat-docked{position:relative;inset:auto;z-index:auto;min-height:42px;padding:10px 13px;border-radius:12px;box-shadow:none;font-size:12px}
.qps-chat-docked[aria-expanded="true"]{background:var(--blue-soft,#eeebf8);color:var(--ink,#222838)}
@media(max-width:760px){
  :root .sidebar .brand .qps-mobile-actions [data-qps-header-chat]{display:flex;margin:0;color:var(--ink,#e7f0fa)}
  .qps-mobile-actions [data-qps-header-chat] .qps-chat-launcher{width:44px;height:44px;min-height:44px;padding:10px;border:0;background:transparent;color:inherit}
  .qps-mobile-actions .qps-chat-launcher>svg{width:22px;height:22px;color:inherit}
  .qps-mobile-actions .qps-chat-launcher>span:not(.qps-chat-unread){display:none}
  .sidebar .brand .qps-mobile-actions .qps-chat-launcher .qps-chat-unread{display:inline-flex;margin:0;position:absolute;right:0;top:0;min-width:18px;min-height:18px;padding:1px 4px;border:2px solid var(--panel,#0b1727);border-radius:10px;background:#b52e46;color:#fff;font-size:10px;line-height:14px}
  .sidebar .brand .qps-mobile-actions .qps-chat-launcher .qps-chat-unread[hidden]{display:none}
}
.qps-chat-popup{position:fixed;z-index:19510;display:flex;flex-direction:column;width:min(920px,calc(var(--chat-viewport-width,100vw) - 32px));height:min(720px,calc(var(--chat-viewport-height,100dvh) - 88px));min-width:0;min-height:0;overflow:hidden;background:var(--chat-surface);color:var(--chat-ink);border:1px solid var(--chat-border);border-radius:24px;box-shadow:0 20px 70px #22224030;isolation:isolate}
.qps-chat-popup[hidden],.qps-chat-launcher[hidden]{display:none!important}
.qps-chat-popup.is-expanded{width:calc(var(--chat-viewport-width,100vw) - 32px);height:calc(var(--chat-viewport-height,100dvh) - 32px)}
.qps-chat-popup-bar{display:flex;flex:none;align-items:center;justify-content:space-between;gap:12px;min-height:56px;padding:8px 12px 8px 18px;border-bottom:1px solid var(--chat-border);background:var(--chat-header);cursor:grab;touch-action:none;user-select:none}
.qps-chat-popup.is-dragging .qps-chat-popup-bar{cursor:grabbing}
.qps-chat-popup-title{display:flex;align-items:center;gap:10px;min-width:0}
.qps-chat-popup-title>svg{width:23px;height:23px;color:var(--chat-accent);flex:none}
.qps-chat-popup-title strong{display:block;font-size:14px;line-height:1.5;color:var(--chat-ink)}
.qps-chat-popup-title small{display:block;font-size:11px;line-height:1.5;color:var(--chat-muted)}
.qps-chat-popup-actions{display:flex;gap:4px;flex:none}
.qps-chat-popup-actions button{display:grid;place-items:center;width:36px;height:36px;border:1px solid transparent;border-radius:50%;padding:8px;background:transparent;color:var(--chat-ink);cursor:pointer}
.qps-chat-popup-actions button:hover{background:var(--chat-surface);border-color:var(--chat-border)}
.qps-chat-popup-actions svg{width:19px;height:19px}
.qps-chat-popup-actions button:focus-visible,.qps-chat-launcher:focus-visible{outline:2px solid var(--chat-accent);outline-offset:2px}
.qps-chat-popup-host.qps-messenger{flex:1;min-height:0;height:100%;max-height:none;width:100%;border:0;border-radius:0;grid-template-columns:285px minmax(0,1fr);grid-template-rows:minmax(0,1fr);box-shadow:none;overflow:hidden}
.qps-chat-popup .msg-sidebar-head{padding:20px 17px 15px;min-height:80px}
.qps-chat-popup .msg-sidebar-head h2{font-size:26px}
.qps-chat-popup .msg-search{margin:0 15px}
.qps-chat-popup .msg-quick{padding:12px 15px 10px;flex-wrap:wrap}
.qps-chat-popup .msg-filters{padding-left:15px;padding-right:15px}
.qps-chat-popup .msg-thread{padding-left:9px;gap:8px}
.qps-chat-popup .msg-thread .msg-avatar{width:41px;height:41px;font-size:13px}
.qps-chat-popup .msg-conversation-head{padding:13px 15px;gap:8px;min-height:77px}
.qps-chat-popup .msg-header-copy h3{font-size:15px}
.qps-chat-popup .msg-conversation-head>.msg-avatar{width:39px;height:39px;font-size:13px;flex:none}
.qps-chat-popup .msg-conversation-head .msg-icon{padding:7px;min-width:33px;min-height:35px}
.qps-chat-popup .msg-messages{padding:23px 20px 18px;overscroll-behavior:contain}
.qps-chat-popup .msg-compose-bottom small{display:none}
.qps-chat-popup .msg-compose-bottom label{max-width:100%}
.qps-chat-popup .msg-composer{padding:12px 15px 9px}
.qps-chat-popup .msg-compose-row{gap:8px}
.qps-chat-popup .msg-compose-row textarea{font-size:15px;max-height:clamp(44px,calc(var(--chat-viewport-height,100dvh)*.2),150px)}
.qps-chat-popup .msg-thread-list{overscroll-behavior:contain}
.qps-chat-popup .msg-bubble{max-width:90%}
@media(max-width:700px){
  .qps-chat-popup,.qps-chat-popup.is-expanded{width:calc(var(--chat-viewport-width,100vw) - 16px);height:calc(var(--chat-viewport-height,100dvh) - 32px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));border-radius:20px}
  .qps-chat-popup-bar{min-height:56px;padding:7px 8px 7px 12px;cursor:default}
  .qps-chat-popup-title small{font-size:10px}
  .qps-chat-popup-actions{gap:1px}
  .qps-chat-popup-actions button{width:34px;height:36px}
  .qps-chat-popup [data-chat-popup-action="expand"]{display:none}
  .qps-chat-popup-host.qps-messenger{grid-template-columns:minmax(0,1fr)}
  .qps-chat-popup .msg-thread{padding:15px 36px 15px 12px;gap:12px}
  .qps-chat-popup .msg-thread .msg-avatar{width:47px;height:47px;font-size:15px}
  .qps-chat-popup .msg-compose-row textarea,.qps-chat-popup .msg-search input{font-size:16px}
  .qps-chat-popup .msg-sidebar-head{padding:20px 18px 15px}
  .qps-chat-popup .msg-sidebar-head h2{font-size:28px}
  .qps-chat-popup .msg-messages{padding:20px 13px 17px}
  .qps-chat-popup .msg-conversation-head{padding:9px;column-gap:5px}
  .qps-chat-popup .msg-composer{padding-left:10px;padding-right:10px}
  .qps-chat-popup .msg-composer{padding-bottom:max(6px,env(safe-area-inset-bottom,0px))}
  .qps-chat-launcher{right:max(12px,env(safe-area-inset-right));bottom:max(12px,env(safe-area-inset-bottom));min-height:44px;padding:10px 14px}
}
@media print{.qps-chat-popup,.qps-chat-launcher{display:none!important}}

body:has(.iso-workspace) .qps-chat-launcher{bottom:calc(64px + env(safe-area-inset-bottom,0px))}

/* Keep the movable window controls small; the conversation supplies its identity. */
.qps-chat-popup-bar{min-height:40px;padding:3px 9px 3px 14px}
.qps-chat-popup-title strong{font-size:12px}
.qps-chat-popup-title>svg{width:18px;height:18px}
.qps-chat-popup-actions button{width:32px;height:32px;padding:7px}
.qps-chat-popup .msg-sidebar-head{min-height:52px;padding:9px 14px 7px}
.qps-chat-popup .msg-sidebar-head h2{font-size:23px}
.qps-chat-popup .msg-conversation-head{min-height:66px;padding:8px 12px}
.qps-chat-popup .msg-conversation-head>.msg-avatar{display:grid;flex:none;width:38px;height:38px}
@media(max-width:700px){
  .qps-chat-popup-bar{min-height:36px;padding:2px 7px 2px 12px}
  .qps-chat-popup-actions button{width:32px;height:32px}
  .qps-chat-popup .msg-sidebar-head{min-height:52px;padding:7px 14px 6px}
  .qps-chat-popup .msg-sidebar-head h2{font-size:23px}
  .qps-chat-popup .msg-conversation-head{min-height:64px;padding:7px 8px;column-gap:5px}
  .qps-chat-popup .msg-conversation-head>.msg-avatar{display:grid;width:34px;height:34px}
  .qps-chat-popup .msg-header-copy h3{font-size:14px}
}
