/* NOXER V40: remove duplicate call buttons; retain the actions in the three-dot menu. */
#nx35CallPhone, #nx35CallVideo,
body.messenger-page #activeChat .conversation-actions > #nx35CallPhone,
body.messenger-page #activeChat .conversation-actions > #nx35CallVideo {
  display:none!important;
  visibility:hidden!important;
  width:0!important;height:0!important;
  margin:0!important;padding:0!important;
  border:0!important;pointer-events:none!important;
}
/* Last-resort clock/timer cleanup: V39 stays effective even if V37 is cached. */
#nx32ClockDock,#nx32TimerPanel,#nx37ClockDate,.nx37-time-float,
.nx32-clock-dock,.nx32-timer-panel{display:none!important;}

/* Repair accumulated fullscreen/mobile overrides from V17, V18, V20 and V33. */
@media (max-width:760px) {
  html,body.messenger-page{width:100%!important;max-width:100%!important;height:100%!important;overflow:hidden!important;}
  body.messenger-page *{box-sizing:border-box;}
  body.messenger-page .app-topbar{
    height:54px!important;min-height:54px!important;max-height:54px!important;
    display:flex!important;align-items:center!important;justify-content:space-between!important;
    gap:9px!important;padding:0 14px!important;
    position:relative!important;z-index:20!important;
    background:rgba(11,12,18,.95)!important;
    border-bottom:1px solid rgba(255,255,255,.075)!important;
  }
  body.messenger-page .app-topbar .brand{flex:0 0 auto!important;min-width:0!important;max-width:135px!important;}
  body.messenger-page .app-topbar .app-toplinks{display:none!important;}
  body.messenger-page .app-topbar .topbar-controls{display:flex!important;flex:0 0 auto!important;align-items:center!important;gap:7px!important;min-width:0!important;}
  body.messenger-page .app-topbar #appLanguage{font-size:10px!important;max-width:60px!important;min-width:0!important;white-space:nowrap!important;padding:4px 6px!important;}
  body.messenger-page .app-topbar #topSettings{width:35px!important;height:35px!important;flex:0 0 35px!important;}
  body.messenger-page .app-topbar #profileTrigger{max-width:44px!important;min-width:35px!important;max-height:40px!important;flex:0 0 auto!important;padding:3px!important;}

  body.messenger-page #messengerShell{
    display:block!important;position:relative!important;
    margin:0!important;border:0!important;border-radius:0!important;
    width:100%!important;min-width:0!important;max-width:100%!important;
    height:calc(100dvh - 54px)!important;min-height:0!important;
    overflow:hidden!important;background:#0c0c11!important;
  }
  body.messenger-page #messengerShell > .app-rail{display:none!important;}
  body.messenger-page #messengerShell > #chatListPanel{
    display:flex!important;flex-direction:column!important;
    position:absolute!important;inset:0 0 64px 0!important;
    margin:0!important;padding:0!important;
    width:100%!important;min-width:0!important;max-width:100%!important;
    height:auto!important;min-height:0!important;max-height:none!important;
    border:0!important;border-radius:0!important;
    overflow:hidden!important;
    transform:none!important;box-shadow:none!important;
  }
  body.messenger-page #chatListPanel .list-panel-header{
    flex:0 0 auto!important;padding:14px 16px 10px!important;min-width:0!important;
  }
  body.messenger-page #chatListPanel .search-field{
    width:auto!important;max-width:calc(100% - 28px)!important;margin:0 14px 9px!important;
    flex:0 0 auto!important;
  }
  body.messenger-page #chatListPanel .list-tabs{
    display:flex!important;gap:4px!important;align-items:center!important;
    min-width:0!important;max-width:100%!important;
    overflow-x:auto!important;overflow-y:hidden!important;
    scrollbar-width:none;-webkit-overflow-scrolling:touch;
  }
  body.messenger-page #chatListPanel .list-tabs::-webkit-scrollbar{display:none;}
  body.messenger-page #chatListPanel .list-tabs button{white-space:nowrap!important;flex-shrink:0!important;}
  body.messenger-page #chatListPanel #chatList{
    flex:1 1 0!important;min-height:0!important;overflow-y:auto!important;
    overscroll-behavior:contain;scrollbar-width:thin;
  }
  body.messenger-page #chatListPanel .chat-row{max-width:100%!important;min-width:0!important;}
  body.messenger-page #chatListPanel .chat-row-info,
  body.messenger-page #chatListPanel .chat-row-content{min-width:0!important;}

  body.messenger-page #messengerShell > .mobile-bottom-nav,
  body.messenger-page .mobile-bottom-nav{
    display:flex!important;position:absolute!important;left:0!important;right:0!important;bottom:0!important;
    z-index:25!important;width:100%!important;
    height:calc(64px + env(safe-area-inset-bottom,0px))!important;
    margin:0!important;padding:4px 5px env(safe-area-inset-bottom,0px)!important;
    gap:2px!important;align-items:center!important;justify-content:space-between!important;
    background:rgba(17,18,25,.97)!important;
    backdrop-filter:blur(22px)!important;-webkit-backdrop-filter:blur(22px)!important;
    border-top:1px solid rgba(255,255,255,.10)!important;
  }
  body.messenger-page .mobile-bottom-nav button{
    display:flex!important;flex:1 1 0!important;min-width:0!important;max-width:none!important;
    flex-direction:column!important;align-items:center!important;justify-content:center!important;
    gap:4px!important;min-height:48px!important;padding:5px 1px!important;
    border:0!important;border-radius:11px!important;
    font:600 9px/1.2 system-ui,sans-serif!important;white-space:nowrap!important;
    color:#9c9cac!important;background:transparent!important;
  }
  body.messenger-page .mobile-bottom-nav button.active{
    background:rgba(130,102,212,.16)!important;color:#e9ddff!important;
  }
  body.messenger-page .mobile-bottom-nav button svg{width:19px!important;height:19px!important;flex-shrink:0!important;}

  body.messenger-page #messengerShell > #conversationPanel{
    position:absolute!important;inset:0!important;
    width:100%!important;min-width:0!important;max-width:100%!important;
    height:100%!important;min-height:0!important;margin:0!important;
    z-index:35!important;overflow:hidden!important;
    transform:translate3d(105%,0,0)!important;
    transition:transform .23s ease!important;pointer-events:none!important;
    background:#101016!important;
  }
  body.messenger-page #messengerShell.chat-open > #conversationPanel,
  body.messenger-page #messengerShell.nx21-chat-selected > #conversationPanel,
  body.messenger-page #messengerShell:has(#activeChat:not(.hidden)) > #conversationPanel {
    transform:translate3d(0,0,0)!important;pointer-events:auto!important;
  }
  body.messenger-page #messengerShell.chat-open > .mobile-bottom-nav,
  body.messenger-page #messengerShell:has(#activeChat:not(.hidden)) > .mobile-bottom-nav{
    display:none!important;
  }
  body.messenger-page #conversationPanel #activeChat:not(.hidden){
    display:flex!important;flex-direction:column!important;
    width:100%!important;height:100%!important;min-height:0!important;
  }
  body.messenger-page #conversationPanel .conversation-header{
    display:flex!important;align-items:center!important;flex:0 0 60px!important;
    height:60px!important;min-height:60px!important;max-height:60px!important;
    gap:7px!important;padding:7px 11px!important;min-width:0!important;
  }
  body.messenger-page #conversationPanel .mobile-back{
    display:grid!important;place-items:center!important;flex:0 0 34px!important;
    width:34px!important;height:34px!important;margin:0!important;
  }
  body.messenger-page #conversationPanel .conversation-header > .avatar{
    width:36px!important;height:36px!important;flex:0 0 36px!important;
  }
  body.messenger-page #conversationPanel .conversation-heading{
    min-width:0!important;flex:1 1 0!important;overflow:hidden!important;
  }
  body.messenger-page #conversationPanel .conversation-heading b,
  body.messenger-page #conversationPanel .conversation-heading small{
    display:block!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;
  }
  body.messenger-page #conversationPanel .conversation-actions{
    display:flex!important;align-items:center!important;
    gap:4px!important;flex:0 0 auto!important;min-width:0!important;
  }
  body.messenger-page #conversationPanel .conversation-actions > button:not(#nx35CallPhone):not(#nx35CallVideo){
    width:36px!important;height:36px!important;min-width:0!important;
    padding:7px!important;border-radius:12px!important;
  }
  body.messenger-page #conversationPanel #messageScroller{
    flex:1 1 0!important;min-height:0!important;overflow-y:auto!important;
    overscroll-behavior:contain;
  }
  body.messenger-page #conversationPanel #messageList{
    min-width:0!important;max-width:100%!important;padding:15px 12px!important;
  }
  body.messenger-page #conversationPanel .message-compose{
    flex:0 0 auto!important;margin:0!important;
    padding:8px 10px calc(10px + env(safe-area-inset-bottom,0px))!important;
    background:rgba(13,14,21,.97)!important;
  }
  body.messenger-page #conversationPanel .compose-inner{max-width:100%!important;min-width:0!important;}
  body.messenger-page #conversationPanel #messageText{
    min-width:0!important;max-width:100%!important;flex:1 1 0!important;
    font-size:16px!important; /* prevent iOS keyboard autozoom */
  }
  body.messenger-page #nx18Info:not(.nx18-hidden){
    width:100%!important;max-width:100%!important;height:100dvh!important;
    inset:0!important;overflow-y:auto!important;
  }
  body.messenger-page #nx22ChatActions{max-width:calc(100vw - 24px)!important;}
  body.messenger-page #nx12 .nx12-profile-page,
  body.messenger-page #nx12 .nx12-settings-page{max-width:100vw!important;overflow-x:hidden!important;}
  #nx36YoutubePanel,#nx36YTPanel{max-width:100vw!important;}
}
@media(max-width:380px){
  body.messenger-page .mobile-bottom-nav button{font-size:8px!important;}
  body.messenger-page #conversationPanel .conversation-header{gap:5px!important;padding-inline:8px!important;}
  body.messenger-page #conversationPanel .conversation-header > .avatar{width:32px!important;height:32px!important;flex-basis:32px!important;}
}
@media(prefers-reduced-motion:reduce){body.messenger-page #conversationPanel{transition:none!important;}}
