/* ============ Messages page ============ */
.ap-msg-shell{
  display:flex; height:calc(100vh - var(--ap-topbar-h) - 3rem);
  background:var(--ap-surface); border:1px solid var(--ap-border); border-radius:var(--ap-radius); overflow:hidden; box-shadow:var(--ap-shadow);
}
.ap-conv-list{width:320px; flex-shrink:0; border-right:1px solid var(--ap-border); display:flex; flex-direction:column;}
.ap-conv-head{padding:1.1rem 1.1rem .8rem; border-bottom:1px solid var(--ap-border);}
.ap-conv-search{position:relative;}
.ap-conv-search input{width:100%; background:var(--ap-bg); border:1px solid var(--ap-border); border-radius:20px; padding:.5rem .8rem .5rem 2.1rem; font-size:.83rem; color:var(--ap-text-strong);}
.ap-conv-search i{position:absolute; left:.75rem; top:50%; transform:translateY(-50%); color:var(--ap-secondary); font-size:.85rem;}
.ap-conv-tabs{display:flex; gap:.4rem; padding:.7rem 1.1rem 0;}
.ap-conv-tab{font-size:.75rem; font-weight:600; padding:.3rem .7rem; border-radius:20px; color:var(--ap-secondary); cursor:pointer;}
.ap-conv-tab.active{background:var(--ap-primary-100); color:var(--ap-primary);}
.ap-conv-items{flex:1; overflow-y:auto;}
.ap-conv-item{display:flex; gap:.7rem; padding:.85rem 1.1rem; border-bottom:1px solid var(--ap-border); cursor:pointer; position:relative;}
.ap-conv-item:hover{background:var(--ap-bg);}
.ap-conv-item.active{background:var(--ap-primary-100);}
.ap-conv-avatar-wrap{position:relative; flex-shrink:0;}
.ap-conv-avatar{width:44px; height:44px; border-radius:50%; object-fit:cover;}
.ap-online-dot{position:absolute; bottom:0; right:0; width:11px; height:11px; border-radius:50%; background:var(--ap-success); border:2px solid var(--ap-surface);}
.ap-conv-body{flex:1; min-width:0;}
.ap-conv-top-row{display:flex; justify-content:space-between; align-items:baseline;}
.ap-conv-name{font-size:.87rem; font-weight:700; color:var(--ap-text-strong);}
.ap-conv-time{font-size:.68rem; color:var(--ap-secondary); flex-shrink:0;}
.ap-conv-preview{font-size:.78rem; color:var(--ap-secondary); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:.1rem;}
.ap-conv-unread{background:var(--ap-primary); color:#fff; font-size:.65rem; font-weight:700; width:18px; height:18px; border-radius:50%; display:flex; align-items:center; justify-content:center; margin-top:.2rem; margin-left:auto;}

.ap-chat-window{flex:1; display:flex; flex-direction:column; min-width:0;}
.ap-chat-head{padding:.85rem 1.2rem; border-bottom:1px solid var(--ap-border); display:flex; align-items:center; justify-content:space-between;}
.ap-chat-head-user{display:flex; align-items:center; gap:.7rem;}
.ap-chat-head-name{font-size:.9rem; font-weight:700; color:var(--ap-text-strong);}
.ap-chat-head-status{font-size:.74rem; color:var(--ap-success); display:flex; align-items:center; gap:.3rem;}
.ap-chat-body{flex:1; overflow-y:auto; padding:1.3rem; display:flex; flex-direction:column; gap:.4rem; background:var(--ap-bg);}
.ap-msg-date-sep{text-align:center; font-size:.7rem; color:var(--ap-secondary); font-weight:600; margin:.6rem 0;}
.ap-msg-row{display:flex; gap:.6rem; max-width:66%;}
.ap-msg-row.mine{align-self:flex-end; flex-direction:row-reverse;}
.ap-msg-avatar{width:30px; height:30px; border-radius:50%; object-fit:cover; flex-shrink:0;}
.ap-msg-bubble{background:var(--ap-surface); border:1px solid var(--ap-border); border-radius:14px 14px 14px 4px; padding:.6rem .9rem; font-size:.85rem; color:var(--ap-text-strong);}
.ap-msg-row.mine .ap-msg-bubble{background:var(--ap-primary); color:#fff; border-color:var(--ap-primary); border-radius:14px 14px 4px 14px;}
.ap-msg-time{font-size:.65rem; color:var(--ap-secondary); margin-top:.25rem; display:block;}
.ap-msg-row.mine .ap-msg-time{text-align:right;}
.ap-chat-footer{padding:.9rem 1.2rem; border-top:1px solid var(--ap-border); display:flex; align-items:center; gap:.6rem;}
.ap-chat-input{flex:1; background:var(--ap-bg); border:1px solid var(--ap-border); border-radius:20px; padding:.6rem 1rem; font-size:.85rem; color:var(--ap-text-strong);}
.ap-chat-input:focus{outline:none; border-color:var(--ap-primary);}
.ap-send-btn{width:40px; height:40px; border-radius:50%; background:var(--ap-primary); color:#fff; border:0; display:flex; align-items:center; justify-content:center; flex-shrink:0;}
.ap-send-btn:hover{background:var(--ap-primary-600);}
.ap-attach-btn{width:38px; height:38px; border-radius:50%; background:var(--ap-bg); border:1px solid var(--ap-border); color:var(--ap-secondary); display:flex; align-items:center; justify-content:center; flex-shrink:0;}

.ap-info-panel{width:260px; flex-shrink:0; border-left:1px solid var(--ap-border); padding:1.3rem; overflow-y:auto;}
.ap-info-panel img.profile{width:80px; height:80px; border-radius:50%; object-fit:cover; display:block; margin:0 auto .8rem;}
.ap-info-row{display:flex; justify-content:space-between; padding:.55rem 0; border-bottom:1px solid var(--ap-border); font-size:.82rem;}
.ap-info-row:last-child{border-bottom:none;}
.ap-info-row .label{color:var(--ap-secondary);}
.ap-info-row .value{color:var(--ap-text-strong); font-weight:600; text-align:right;}
.ap-shared-file{display:flex; align-items:center; gap:.5rem; padding:.5rem 0; font-size:.78rem; color:var(--ap-text-strong);}

@media (max-width: 1199.98px){ .ap-info-panel{display:none;} }
@media (max-width: 767.98px){
  .ap-conv-list{position:absolute; inset:0; z-index:5; background:var(--ap-surface); width:100%;}
  .ap-conv-list.hide-mobile{display:none;}
  .ap-msg-shell{position:relative;}
}
