/* FLOW-style messenger panel and unified chat list */
.topbar-chat{position:relative;display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;margin-right:10px;border-radius:50%;color:#333;flex:none}
.topbar-chat:hover,.topbar-chat.active{background:#f1edfc;color:#6449fc}
.topbar-chat svg{width:23px;height:23px}
.topbar-chat-badge{position:absolute;top:-2px;right:-4px;min-width:17px;height:17px;padding:0 4px;border-radius:9px;background:#e5484d;color:#fff;font-size:10px;font-weight:700;line-height:17px;text-align:center}
.topbar{justify-content:flex-end}

.chat-panel{position:fixed;top:40px;right:0;bottom:0;z-index:40;display:flex;flex-direction:column;width:min(400px,100vw);background:#fff;border-left:1px solid #ddd;box-shadow:-8px 0 24px #0000000f;font-size:14px;color:#333}
.chat-panel[hidden]{display:none}
.chat-panel .cp-head{display:flex;align-items:center;justify-content:space-between;padding:18px 20px 6px}
.chat-panel .cp-head h2{display:flex;align-items:center;gap:6px;margin:0;font-size:18px;font-weight:700}
.chat-panel .cp-close{width:30px;height:30px;border:0;background:none;font-size:26px;line-height:1;color:#555;border-radius:4px}
.chat-panel .cp-close:hover{background:#f3f3f3}
.chat-panel .cp-back{display:inline-flex;width:26px;height:26px;align-items:center;justify-content:center;border:0;background:none;color:#555;transform:rotate(180deg)}
.chat-panel .cp-back svg{width:18px;height:18px}
.cp-tabs{display:flex;align-items:center;gap:4px;margin:0 20px;border-bottom:1px solid #eee}
.cp-tabs [role=tab]{height:44px;padding:0 14px;border:0;border-bottom:2px solid transparent;background:none;font-size:14px;font-weight:500;color:#888}
.cp-tabs [role=tab][aria-selected=true]{border-bottom-color:#333;color:#333;font-weight:700}
.cp-new{display:inline-flex;align-items:center;gap:5px;height:30px;margin-left:auto;padding:0 12px;border:1px solid #5b40f8;border-radius:4px;background:#5b40f8;color:#fff;font-size:13px;font-weight:500;white-space:nowrap}
.cp-new:hover{background:#4d33e6}
.cp-new svg{width:15px;height:15px}
.cp-search{display:flex;align-items:center;gap:8px;height:36px;margin:12px 20px 0;padding:0 12px;border:1px solid #ddd;border-radius:4px;background:#fff;font-weight:400}
.cp-search svg{width:16px;height:16px;color:#888;flex:none}
.cp-search input{flex:1;min-width:0;height:34px;padding:0;border:0;outline:none;background:none;font-size:13px}
.cp-search:focus-within{border-color:#6449fc}
.cp-chips{display:flex;gap:6px;margin:10px 20px 4px}
.cp-chips button{height:28px;padding:0 13px;border:1px solid #ddd;border-radius:14px;background:#fff;font-size:13px;color:#555}
.cp-chips button.active{border-color:#6c5ce7;background:#6c5ce7;color:#fff}
.chat-panel .cp-body{flex:1;min-height:0;overflow:auto;padding:4px 0 16px}
.cp-room{display:flex;align-items:center;gap:13px;width:100%;min-height:76px;padding:12px 20px;border:0;border-bottom:1px solid #f0f0f0;background:#fff;text-align:left;color:#333;cursor:pointer}
.cp-room:hover{background:#f8f7fd}
.cp-room.active{background:#f1edfc}
.cp-room .avatar,.cp-room-icon{width:40px;height:40px;flex:none;border-radius:50%;font-size:15px}
.cp-room .avatar img{border-radius:50%}
.cp-room-icon{display:inline-flex;align-items:center;justify-content:center;color:#fff;border-radius:13px}
.cp-room-icon svg{width:20px;height:20px}
.cp-room-main{flex:1;min-width:0;display:grid;gap:3px}
.cp-room-top{display:flex;align-items:baseline;gap:5px;min-width:0}
.cp-room-top strong{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:14px;font-weight:700;color:#333}
.cp-room-top em{font-style:normal;font-size:13px;color:#888;white-space:nowrap}
.cp-room-top time{margin-left:auto;padding-left:8px;font-size:12px;color:#999;white-space:nowrap}
.cp-room-bottom{display:flex;align-items:flex-start;gap:8px}
.cp-room-preview{flex:1;min-width:0;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;font-size:13px;line-height:1.45;color:#888;white-space:normal;word-break:break-all}
.cp-room.unread .cp-room-preview{color:#444}
.cp-badge{min-width:20px;height:20px;padding:0 6px;border-radius:10px;background:#e5484d;color:#fff;font-size:11px;font-weight:700;line-height:20px;text-align:center;flex:none}
.cp-group{margin:14px 20px 4px;font-size:13px;font-weight:700;color:#333}
.cp-picker-hint{margin:12px 20px 0;font-size:13px;color:#888}
.cp-empty{padding:48px 20px;text-align:center;color:#999;font-size:13px}
.cp-empty.small{padding:12px 20px;text-align:left}
.cp-contact{display:flex;align-items:center;gap:13px;min-height:68px;padding:10px 20px;border-bottom:1px solid #f0f0f0}
.cp-contact .avatar{width:40px;height:40px;flex:none;border-radius:13px;border:1px solid #e5e5e5;font-size:15px}
.cp-contact .avatar img{border-radius:12px}
.cp-contact-main{flex:1;min-width:0;display:grid;gap:2px}
.cp-contact-name{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.cp-contact-name strong{font-size:14px;font-weight:700;color:#333}
.cp-contact-name span{font-size:13px;color:#555}
.cp-contact-org{font-size:12.5px;color:#999;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.cp-contact-org b{margin-right:6px}
.cp-contact-chat{display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;flex:none;border:0;border-radius:50%;background:none;color:#777}
.cp-contact-chat:hover{background:#f1edfc;color:#6449fc}
.cp-contact-chat svg{width:21px;height:21px}

/* Chat page: same list on the left */
.chat-layout.cp-layout{grid-template-columns:320px minmax(0,1fr)}
.chat-projects.cp-side{display:flex;flex-direction:column;padding:0;border-right:1px solid #eee;background:#fff;min-height:0}
.cp-side .cp-side-head{display:flex;align-items:center;gap:8px;padding:14px 14px 0}
.cp-side .cp-side-head .cp-search{flex:1;margin:0}
.cp-side .cp-chips{margin:10px 14px 6px}
.cp-side .cp-body{flex:1;overflow:auto;max-height:calc(100vh - 260px)}
.cp-side .cp-room{padding:12px 14px}
.cp-side>button{display:none}
.chat-projects.cp-side button.cp-room{display:flex;width:100%;margin:0;padding:12px 14px;border-radius:0;font-size:14px;white-space:normal;text-align:left;align-items:center}
.chat-projects.cp-side button.cp-room.active{background:#f1edfc;color:#333}
.chat-projects.cp-side .cp-room .avatar{width:40px;height:40px;margin:0}
.chat-projects.cp-side .cp-side-head .cp-new{display:inline-flex;width:auto;margin:0 0 0 auto;padding:0 12px;border-radius:4px;font-size:13px;flex:none}
.chat-projects.cp-side .cp-chips button{display:inline-flex;align-items:center;width:auto;margin:0;padding:0 13px;border-radius:14px;font-size:13px;white-space:nowrap}
.chat-projects.cp-side .cp-chips button.active{background:#6c5ce7;color:#fff}
.chat-projects.cp-side .cp-search input{width:100%}
@media(max-width:800px){.chat-projects.cp-side{display:flex;max-height:none;padding:0;border-bottom:1px solid #eee}}

@media(max-width:800px){
  .chat-layout.cp-layout{grid-template-columns:1fr}
  .cp-side .cp-body{max-height:300px}
  .chat-panel{top:40px;width:100vw}
}
