/* HTSPORT V127.43 - AFF Notification mobile/page fix */
.aff-notice-modal-v143.show{align-items:flex-end!important;padding:12px!important;padding-bottom:calc(88px + env(safe-area-inset-bottom,0px))!important;overflow:hidden!important}
.aff-notice-modal-v143 .modal-card{width:min(760px,96vw)!important;max-height:calc(100vh - 120px - env(safe-area-inset-bottom,0px))!important;display:flex!important;flex-direction:column!important;overflow:hidden!important;border-radius:24px!important}
.aff-notice-modal-v143 .modal-head{flex:0 0 auto!important;position:sticky!important;top:0!important;z-index:3!important;background:#fff!important;padding:16px 18px!important;border-bottom:1px solid #eef2f7!important}
.aff-notice-modal-v143 .notice-inbox-list,.aff-notice-modal-v143 .notice-thread-messages{overflow:auto!important;-webkit-overflow-scrolling:touch!important;padding:14px!important;padding-bottom:18px!important}
.aff-notice-modal-v143 .notice-thread-card{max-height:calc(100vh - 110px - env(safe-area-inset-bottom,0px))!important}
.aff-notice-modal-v143 .notice-thread-form{position:sticky!important;bottom:0!important;background:#fff!important;padding:12px!important;border-top:1px solid #eef2f7!important;display:flex!important;gap:8px!important}
.aff-notice-modal-v143 .notice-thread-form textarea{min-height:46px!important;max-height:92px!important;resize:vertical!important}
.notice-action-row{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
.notice-card-actions{display:flex;gap:8px;flex-wrap:wrap}
.notice-open-thread,.notice-mark-read-btn,.notice-page-open-btn,.notice-page-read-btn,#refreshAffNoticePageBtn{border:0;border-radius:12px;padding:9px 12px;font-weight:900;background:#2563eb;color:#fff}
.notice-mark-read-btn,.notice-page-read-btn{background:#10b981}
.aff-notice-page-panel{display:block}.aff-notice-page-panel.hidden{display:none!important}
.aff-notice-page-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}
.aff-notice-page-head h3{margin:0;font-size:22px}.aff-notice-page-head p{margin:4px 0 0;color:#64748b}
.aff-notice-page-list{display:grid;gap:12px}
.aff-notice-page-card{border:1px solid #e2e8f0;border-radius:18px;padding:14px;background:#fff;box-shadow:0 8px 26px rgba(15,23,42,.06)}
.aff-notice-page-card.unread{border-color:#60a5fa;background:#eff6ff}
.aff-notice-page-card h4{margin:0 0 8px;font-size:18px}
.aff-notice-page-card p{margin:0 0 12px;color:#334155;white-space:pre-line}
.aff-notice-page-meta{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap}
.notice-stat-box{display:grid;gap:6px;font-size:13px;line-height:1.35}
.notice-read-list,.notice-unread-list{display:block;max-width:260px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.notice-read-list{color:#059669}.notice-unread-list{color:#dc2626;font-weight:800}
.notice-stat-pill{display:inline-flex;align-items:center;gap:5px;border-radius:999px;padding:4px 8px;font-weight:900;font-size:12px}
.notice-stat-pill.read{background:#dcfce7;color:#047857}.notice-stat-pill.unread{background:#fee2e2;color:#b91c1c}
.aff-notice-popup-new-v143 .notice-inbox-card{border:2px solid #bfdbfe}.aff-notice-popup-new-v143 .modal-head h3:before{content:'🔔 '}
@media(max-width:768px){
  .aff-notice-modal-v143.show{padding:0!important;padding-bottom:calc(82px + env(safe-area-inset-bottom,0px))!important}
  .aff-notice-modal-v143 .modal-card{width:100vw!important;max-width:100vw!important;max-height:calc(100vh - 94px - env(safe-area-inset-bottom,0px))!important;border-radius:24px 24px 0 0!important}
  .aff-notice-modal-v143 .modal-head h3{font-size:22px!important}
  .notice-inbox-item{padding:14px!important}
  .notice-action-row button{width:100%}.aff-notice-page-head{align-items:flex-start;flex-direction:column}.aff-notice-page-card{padding:14px}
}


/* HTSPORT V127.44 - Fix triệt để thread thông báo AFF bị footer che trên mobile */
.aff-notice-modal-v143,
.aff-notice-modal-v143.show{
  z-index:2147483000!important;
}
#affNoticeThreadModal.show{
  align-items:center!important;
  justify-content:center!important;
  padding:10px!important;
  padding-bottom:calc(104px + env(safe-area-inset-bottom,0px))!important;
}
#affNoticeThreadModal .notice-thread-card{
  width:min(720px,94vw)!important;
  max-width:94vw!important;
  height:auto!important;
  max-height:calc(100vh - 150px - env(safe-area-inset-bottom,0px))!important;
  border-radius:22px!important;
  overflow:hidden!important;
  display:flex!important;
  flex-direction:column!important;
}
#affNoticeThreadModal .modal-head{
  padding:12px 14px!important;
  min-height:0!important;
}
#affNoticeThreadModal .modal-head h3{
  font-size:22px!important;
  line-height:1.18!important;
  margin:0!important;
}
#affNoticeThreadModal .modal-head button{
  width:44px!important;
  height:44px!important;
  min-width:44px!important;
  border-radius:999px!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
}
#affThreadMeta.notice-thread-meta{
  flex:0 0 auto!important;
  padding:10px 14px!important;
  font-size:14px!important;
  color:#64748b!important;
  border-bottom:1px solid #eef2f7!important;
}
#affThreadMessages.notice-thread-messages{
  flex:1 1 auto!important;
  min-height:0!important;
  max-height:calc(100vh - 310px - env(safe-area-inset-bottom,0px))!important;
  overflow:auto!important;
  padding:12px 12px 8px!important;
  background:#f8fafc!important;
}
#affThreadMessages .notice-thread-root,
#affThreadMessages .notice-thread-msg{
  min-height:0!important;
  height:auto!important;
  max-height:none!important;
  display:block!important;
  padding:12px!important;
  margin:0 0 10px!important;
  border-radius:16px!important;
  background:#fff!important;
  border:1px solid #dbeafe!important;
  box-shadow:0 4px 14px rgba(15,23,42,.05)!important;
}
#affThreadMessages .notice-thread-msg.admin{
  border-color:#bfdbfe!important;
  background:#eff6ff!important;
}
#affThreadMessages .notice-thread-msg.affiliate{
  border-color:#bbf7d0!important;
  background:#f0fdf4!important;
}
#affThreadMessages .notice-thread-root b,
#affThreadMessages .notice-thread-msg b{
  display:block!important;
  margin:0 0 8px!important;
  font-size:16px!important;
  line-height:1.25!important;
}
#affThreadMessages .notice-thread-root div,
#affThreadMessages .notice-thread-msg div{
  display:block!important;
  margin:0!important;
  font-size:15px!important;
  line-height:1.45!important;
  white-space:pre-line!important;
}
#affThreadMessages .notice-thread-root small,
#affThreadMessages .notice-thread-msg small{
  display:block!important;
  margin-top:10px!important;
  font-size:12px!important;
  color:#64748b!important;
}
#affNoticeThreadModal .notice-thread-form{
  flex:0 0 auto!important;
  position:relative!important;
  bottom:auto!important;
  left:auto!important;
  right:auto!important;
  width:100%!important;
  padding:10px 12px 12px!important;
  background:#fff!important;
  border-top:1px solid #e5e7eb!important;
  display:grid!important;
  grid-template-columns:1fr auto!important;
  gap:8px!important;
}
#affNoticeThreadModal .notice-thread-form textarea{
  width:100%!important;
  min-height:44px!important;
  max-height:78px!important;
  border-radius:12px!important;
  padding:10px!important;
  font-size:15px!important;
  line-height:1.35!important;
}
#affNoticeThreadModal .notice-thread-form button{
  min-width:88px!important;
  height:44px!important;
  border-radius:12px!important;
  font-size:15px!important;
  font-weight:900!important;
  background:#2563eb!important;
  color:#fff!important;
  border:0!important;
}
#affNoticeInboxModal.show,
#affReplyInboxModal.show{
  padding-bottom:calc(104px + env(safe-area-inset-bottom,0px))!important;
}
#affNoticeInboxModal .notice-inbox-card,
#affReplyInboxModal .notice-inbox-card{
  max-height:calc(100vh - 150px - env(safe-area-inset-bottom,0px))!important;
}

/* Trên màn rất thấp: card gọn hơn để luôn thấy nút gửi */
@media(max-height:760px){
  #affNoticeThreadModal.show{
    align-items:flex-end!important;
    padding-bottom:calc(92px + env(safe-area-inset-bottom,0px))!important;
  }
  #affNoticeThreadModal .notice-thread-card{
    max-height:calc(100vh - 118px - env(safe-area-inset-bottom,0px))!important;
  }
  #affThreadMessages.notice-thread-messages{
    max-height:calc(100vh - 270px - env(safe-area-inset-bottom,0px))!important;
  }
  #affNoticeThreadModal .modal-head h3{font-size:20px!important}
}

/* Mobile nhỏ: không cho footer trắng che nút thao tác */
@media(max-width:768px){
  #affNoticeThreadModal.show{
    padding-left:8px!important;
    padding-right:8px!important;
    padding-bottom:calc(98px + env(safe-area-inset-bottom,0px))!important;
  }
  #affNoticeThreadModal .notice-thread-card{
    width:calc(100vw - 16px)!important;
    max-width:calc(100vw - 16px)!important;
    border-radius:20px!important;
  }
  #affNoticeThreadModal .notice-thread-form{
    grid-template-columns:1fr!important;
  }
  #affNoticeThreadModal .notice-thread-form button{
    width:100%!important;
  }
  #affThreadMessages.notice-thread-messages{
    padding-bottom:10px!important;
  }
}
