/* Floating staff messenger. Keep support workspace and client portal independent. */
#staffChat { --msg-text:#253339; --msg-muted:#607078; --msg-line:#dfe5e6; --msg-accent:#b54b0c; color:var(--msg-text); right:20px; bottom:20px; z-index:7100; }
#staffChat *, #staffChat *::before, #staffChat *::after { box-sizing:border-box; letter-spacing:0; }
#staffChat [hidden] { display:none!important; }
#staffChat :is(button,input,textarea) { font-family:inherit; }
#staffChat .chat-bubble { width:52px; height:52px; border-radius:8px; background:#253a35; box-shadow:0 5px 18px #12292126; color:#fff; font-size:24px; }
#staffChat .chat-bubble > * { pointer-events:none; }
#staffChat .chat-badge { background:#b53e32; border:2px solid #fff; min-width:21px; height:21px; font-size:10px; }
#staffChat .chat-panel { width:410px; max-width:calc(100vw - 40px); height:min(560px,calc(var(--messenger-height,100dvh) - 108px)); max-height:none; bottom:64px; right:0; background:#fff; border:1px solid var(--msg-line); border-radius:8px; box-shadow:0 14px 50px #1b303029; display:flex; flex-direction:column; overflow:hidden; font-size:13px; }
#staffChat.chat-expanded .chat-panel { width:min(1000px,calc(100vw - 40px)); height:min(740px,calc(var(--messenger-height,100dvh) - 108px)); max-height:none; }
#staffChat .chat-head { min-height:64px; padding:10px 14px; gap:10px; background:#fff; color:var(--msg-text); border-bottom:1px solid var(--msg-line); flex-shrink:0; }
#staffChat .messenger-brand { display:grid; place-items:center; width:34px; height:34px; flex:0 0 34px; background:#f6e9e0; color:var(--msg-accent); border-radius:6px; font-size:20px; }
#staffChat .messenger-heading { min-width:0; display:grid; gap:2px; }
#staffChat .messenger-heading strong { font-size:16px; font-weight:750; line-height:1.3; }
#staffChat .messenger-heading span { color:var(--msg-muted); font-size:11px; line-height:1.35; }
#staffChat .chat-head-tools { display:flex; gap:2px; margin-left:auto; flex-shrink:0; }
#staffChat .chat-x { display:inline-grid; place-items:center; width:32px; height:34px; flex:0 0 32px; padding:0; margin:0; border:0; background:transparent; border-radius:5px; color:var(--msg-muted); font-size:19px; cursor:pointer; }
#staffChat .chat-x:hover { color:var(--msg-text); background:#edf2f1; }
#staffChat .chat-tabs { display:flex; gap:20px; padding:0 16px; border-bottom:1px solid var(--msg-line); background:#fff; flex-shrink:0; }
#staffChat .chat-tab { position:relative; flex:0 0 auto; border:0; border-bottom:2px solid transparent; margin-bottom:-1px; border-radius:0; min-height:44px; padding:0 3px; background:transparent; color:var(--msg-muted); display:flex; align-items:center; gap:7px; font-size:13px; font-weight:650; }
#staffChat .chat-tab.on { color:var(--msg-text); border-bottom-color:var(--msg-accent); background:transparent; }
#staffChat .chat-tab .ti { font-size:18px; }
#staffChat .chat-tab-b { background:#f5e2d6; color:#8b3909; border-radius:4px; min-width:19px; height:19px; padding:0 4px; display:grid; place-items:center; font-size:10px; }
#staffChat :is(.chat-rail,.chat-main,.chat-clients,.chat-2pane) { min-width:0; min-height:0; overflow:hidden; flex:1; display:flex; flex-direction:column; background:#fff; }
#staffChat .chat-2pane { flex-direction:row; }
#staffChat .chat-2pane .chat-rail { flex:0 0 290px; border-right:1px solid var(--msg-line); }
#staffChat .chat-main { position:relative; }
#staffChat .chat-search-bar { padding:12px 14px 0; border:0; flex-shrink:0; background:#fff; }
#staffChat .chat-search-bar label { position:relative; display:block; margin:0; }
#staffChat .chat-search-bar label > .ti { position:absolute; left:11px; top:11px; font-size:17px; color:var(--msg-muted); pointer-events:none; }
#staffChat .chat-search { width:100%; min-width:0; min-height:38px; height:38px; padding:8px 10px; background:#f4f6f6; border:1px solid #e0e6e6; border-radius:6px; font-size:13px; color:var(--msg-text); box-shadow:none; }
#staffChat .chat-search-bar .chat-search { padding-left:34px; }
#staffChat .chat-search::placeholder { color:#738087; opacity:1; }
#staffChat .messenger-list-filter { display:flex; align-items:center; justify-content:space-between; min-height:42px; gap:12px; }
#staffChat .messenger-list-filter strong { color:var(--msg-muted); font-size:11px; font-weight:600; }
#staffChat .messenger-list-filter button { border:0; border-radius:4px; background:transparent; color:var(--msg-muted); font-size:11px; padding:7px 8px; cursor:pointer; }
#staffChat .messenger-list-filter button[aria-pressed="true"] { background:#e5eeea; color:#215b43; }
#staffChat .chat-list { overflow-y:auto; overflow-x:hidden; overscroll-behavior:contain; min-height:0; flex:1; padding:0 6px 8px; }
#staffChat .messenger-row { position:relative; border-bottom:1px solid #f0f3f2; }
#staffChat .chat-conv { width:100%; min-width:0; min-height:76px; gap:11px; margin:0; padding:12px 9px; display:flex; align-items:center; border:0; border-radius:5px; background:transparent; color:var(--msg-text); text-align:left; cursor:pointer; }
#staffChat .chat-conv:hover, #staffChat .messenger-row.active .chat-conv { background:#edf3f0; }
#staffChat .chat-avatar { width:36px; height:36px; flex:0 0 36px; border-radius:8px; color:#354b48; font-size:12px; font-weight:750; }
#staffChat .chat-dot { width:9px; height:9px; border:2px solid white; right:-2px; bottom:-2px; }
#staffChat .chat-conv-main { min-width:0; flex:1; display:flex; flex-direction:column; gap:3px; }
#staffChat .messenger-row-top { display:flex; align-items:baseline; gap:6px; min-width:0; }
#staffChat .chat-conv-title { font-size:13px; font-weight:700; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--msg-text); }
#staffChat .messenger-row-top .chat-conv-title { flex:1; }
#staffChat .messenger-row-top time { flex-shrink:0; color:var(--msg-muted); font-size:10px; font-weight:400; }
#staffChat .chat-conv-prev { color:var(--msg-muted); font-size:12px; line-height:1.4; display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#staffChat .chat-conv-prev b { color:#9c440e; font-weight:600; }
#staffChat :is(.messenger-group,.messenger-client-state) { font-size:10px; color:var(--msg-muted); line-height:1.5; }
#staffChat .messenger-client-state.waiting { color:#995019; }
#staffChat .messenger-open-arrow { color:#889590; font-size:16px; }
#staffChat .chat-badge.inline { flex-shrink:0; border:0; min-width:18px; height:18px; background:#dceae3; color:#245b44; border-radius:4px; margin:0; }
#staffChat .chat-empty { padding:28px 16px; margin:auto; display:flex; flex-direction:column; justify-content:center; align-items:center; gap:9px; text-align:center; color:var(--msg-muted); font-size:12px; width:100%; }
#staffChat .chat-empty > .ti { color:#7d9790; font-size:30px; margin-bottom:3px; }
#staffChat .chat-empty strong { font-size:14px; font-weight:650; color:var(--msg-text); }
#staffChat .messenger-result-label { padding:12px 10px 4px; color:var(--msg-muted); font-size:11px; }
#staffChat .messenger-search-result > .ti { font-size:22px; color:#708780; }
#staffChat :is(.chat-main-head,.messenger-subhead) { padding:9px 10px; gap:8px; min-height:60px; display:flex; align-items:center; flex-shrink:0; border-bottom:1px solid var(--msg-line); background:#fff; }
#staffChat .chat-main-head .chat-avatar { width:30px; height:30px; flex-basis:30px; border-radius:6px; font-size:10px; }
#staffChat .chat-main-head-info { flex:1; min-width:0; display:grid; gap:2px; }
#staffChat .chat-main-head-info strong { font-size:13px; line-height:1.35; white-space:nowrap; text-overflow:ellipsis; overflow:hidden; }
#staffChat .chat-main-head-info small { color:var(--msg-muted); font-size:10px; }
#staffChat .chat-thread { min-height:0; min-width:0; flex:1; padding:12px; gap:12px; background:#f4f7f6; overflow-x:hidden; overflow-y:auto; overscroll-behavior:contain; }
#staffChat .chat-day { margin:2px 0; }
#staffChat .chat-day span { background:transparent; color:#6c7e77; font-size:10px; padding:2px 6px; }
#staffChat .chat-msg { display:flex; position:relative; flex-wrap:wrap; align-items:flex-start; gap:6px; width:fit-content; max-width:90%; margin:0 0 9px; }
#staffChat .chat-msg > .chat-avatar { width:25px; height:25px; flex-basis:25px; font-size:9px; border-radius:6px; margin-top:2px; }
#staffChat .chat-msg-body { background:#fff; color:var(--msg-text); border:1px solid #e0e8e4; box-shadow:none; border-radius:8px; padding:9px 11px; min-width:0; max-width:calc(100% - 31px); }
#staffChat .chat-msg.mine { align-self:flex-end; }
#staffChat .chat-msg.mine .chat-msg-body { background:#e2eee7; color:#213d32; border-color:#d0e2d8; max-width:100%; }
#staffChat .chat-msg.grouped .chat-msg-body, #staffChat .chat-msg.deleted .chat-msg-body { max-width:100%; }
#staffChat .chat-msg-text { font-size:13px; line-height:1.55; overflow-wrap:anywhere; white-space:pre-wrap; }
#staffChat .chat-msg-author { font-size:10px; color:#466458; margin-bottom:4px; }
#staffChat .chat-msg :is(a,.chat-edited,.chat-msg-time) { color:#567565; }
#staffChat .chat-msg a { text-decoration:underline; overflow-wrap:anywhere; }
#staffChat .chat-msg .chat-msg-time { font-size:9px; }
#staffChat .chat-actions { position:static; display:flex; justify-content:flex-end; gap:0; opacity:1; flex:1 0 100%; margin-top:-5px; }
#staffChat .chat-actions .chat-x { width:28px; height:26px; flex-basis:28px; font-size:15px; color:#7a8982; border:0; background:transparent; }
#staffChat .chat-actions .chat-x:hover { background:#dfe9e3; color:#254636; }
#staffChat .chat-receipt { font-size:10px; color:#657e72; }
#staffChat .chat-quote { color:#567266; background:#f0f5f2; border-left:2px solid #87a593; font-size:11px; overflow-wrap:anywhere; }
#staffChat .chat-react-chip { background:#fff; color:#365344; border-color:#ccded1; border-radius:5px; }
#staffChat .chat-react-chip.on { background:#cee3d6; }
#staffChat .chat-msg-media :is(img,video) { max-width:100%; max-height:220px; border-radius:5px; }
#staffChat .chat-file { color:#345b48; background:#ffffff96; overflow-wrap:anywhere; white-space:normal; }
#staffChat .chat-composer { flex-shrink:0; padding:10px 12px 8px; display:flex; flex-direction:column; align-items:stretch; gap:4px; border-top:1px solid var(--msg-line); background:#fff; }
#staffChat .chat-composer textarea { display:block; width:100%; min-height:48px; max-height:104px; resize:vertical; padding:4px 2px; border:0; border-radius:0; background:#fff; color:var(--msg-text); font-size:13px; line-height:1.5; box-shadow:none; }
#staffChat .messenger-compose-tools { display:flex; gap:3px; align-items:center; min-width:0; }
#staffChat .chat-attach-btn { width:34px; height:34px; flex:0 0 34px; position:relative; display:grid; place-items:center; color:var(--msg-muted); font-size:20px; border:0; background:transparent; margin:0; cursor:pointer; border-radius:5px; overflow:hidden; }
#staffChat .chat-attach-btn input { position:absolute; inset:0; opacity:0; width:100%; height:100%; cursor:pointer; }
#staffChat .chat-attach-btn:focus-within { outline:2px solid #176fc1; outline-offset:1px; }
#staffChat #messengerSendState { font-size:10px; color:var(--msg-muted); min-width:0; flex:1; overflow-wrap:anywhere; padding:0 5px; }
#staffChat .messenger-send { flex:0 0 36px; width:36px; height:34px; padding:0; border:0; border-radius:6px; background:#285441; color:#fff; display:grid; place-items:center; font-size:19px; cursor:pointer; }
#staffChat .messenger-send:disabled { opacity:.55; cursor:wait; }
#staffChat .chat-typing { padding:5px 14px; font-size:10px; color:var(--msg-muted); }
#staffChat .chat-reply-preview { padding:6px 12px; }
#staffChat .chat-reply-card { background:#eef4f0; color:#466053; border-left:2px solid #769b83; border-radius:0; font-size:11px; overflow-wrap:anywhere; }
#staffChat .chat-reply-card button { color:var(--msg-text); }
#staffChat .chat-attach-chips { padding:0 12px; flex-shrink:0; max-height:90px; overflow:auto; }
#staffChat .chat-attach-chips:empty { display:none; }
#staffChat .chat-chip { border:1px solid var(--msg-line); color:var(--msg-text); background:#f4f7f5; max-width:100%; overflow-wrap:anywhere; border-radius:4px; font-size:11px; }
#staffChat .messenger-latest { position:absolute; bottom:130px; align-self:center; z-index:1; border:1px solid #a7c4b3; border-radius:6px; background:#fff; color:#29563f; padding:8px 12px; font-size:11px; box-shadow:0 2px 8px #28452f12; }
#staffChat .messenger-support-link { display:flex; align-items:center; justify-content:center; gap:8px; flex-shrink:0; min-height:47px; padding:10px; margin:0; border:0; border-top:1px solid var(--msg-line); background:#f6f8f7; color:#355b49; font-size:12px; font-weight:650; cursor:pointer; }
#staffChat .chat-clients .chat-search-bar { padding-bottom:10px; }
#staffChat :is(.chat-new,.chat-group-panel) { overflow-y:auto; padding:12px; min-width:0; }
#staffChat .chat-new-section { padding:8px 0 16px; border:0; border-bottom:1px solid var(--msg-line); }
#staffChat .chat-new-section > strong { display:block; font-size:12px; color:var(--msg-muted); padding:0 0 8px; }
#staffChat .chat-group-pick { display:flex; flex-direction:column; gap:4px; padding:8px 0; max-height:200px; overflow:auto; }
#staffChat .chat-pick { display:flex; align-items:center; gap:8px; padding:6px; font-size:12px; }
#staffChat .chat-pick input { width:16px; height:16px; flex:0 0 16px; accent-color:#285441; }
#staffChat .chat-grp-row { display:flex; gap:6px; min-width:0; }
#staffChat .chat-grp-row input { flex:1; }
#staffChat .chat-grp-member { gap:7px; font-size:12px; }
#staffChat .chat-grp-member span { min-width:0; overflow-wrap:anywhere; }
#staffChat .btn { border-radius:5px; font-size:12px; min-height:34px; box-shadow:none; }
#staffChat .btn.primary { background:#285441!important; color:#fff!important; border-color:#285441!important; }
.chat-menu-pop, .chat-react-pop { border:1px solid #dfe5e1; border-radius:6px; box-shadow:0 6px 24px #283e3226; color:#253339; background:#fff; max-width:calc(100vw - 16px); }
.chat-menu-pop button { color:#253339; font-size:12px; }
.chat-menu-pop button:hover, .chat-react-pop button:hover { background:#edf3ee; }
@media (max-width:700px) {
  #staffChat .chat-2pane .chat-rail { flex-basis:230px; }
  #staffChat .chat-actions .chat-x { width:34px; height:30px; flex-basis:34px; }
  #staffChat .chat-search, #staffChat .chat-composer textarea { font-size:16px; }
}
@media (max-width:600px) {
  #staffChat { right:14px!important; bottom:calc(88px + env(safe-area-inset-bottom,0px))!important; }
  #staffChat .chat-panel, #staffChat.chat-expanded .chat-panel { position:fixed; top:0; left:0; right:0!important; bottom:auto!important; width:100%; max-width:none!important; height:var(--messenger-height,100dvh)!important; max-height:none; border:0; border-radius:0; padding-top:env(safe-area-inset-top,0px); padding-bottom:env(safe-area-inset-bottom,0px); }
  #staffChat.messenger-open .chat-bubble { display:none; }
  #staffChat .chat-head { min-height:62px; padding:9px 12px; gap:8px; }
  #staffChat .chat-head-tools .chat-x { width:36px; height:40px; flex-basis:36px; }
  #staffChat .chat-head-tools button[onclick="chatToggleExpand()"] { display:none; }
  #staffChat .chat-composer { padding:9px 12px 8px; }
  #staffChat .chat-main-head .chat-x { width:36px; height:38px; }
  #staffChat .chat-msg { max-width:94%; }
  #staffChat .chat-conv { min-height:78px; }
  body:has(#staffChat.messenger-open) { overflow:hidden; }
}
