/* =========================================================
   vAvtobyse 2.9.19 — STAGE 1D / DESKTOP CLEANUP
   Scope: desktop-only viewport safety, compact composer,
   clearer primary actions and existing account overflow menu.
   Mobile layout and business logic are intentionally untouched.
   ========================================================= */

@media (min-width:821px){
  html[data-theme],html[data-theme] body{
    width:100%!important;height:100%!important;min-height:0!important;overflow:hidden!important;
  }
  html[data-theme] body.vav-shell-mode{
    height:100vh!important;min-height:0!important;max-height:100vh!important;overflow:hidden!important;
  }
  html[data-theme] body.vav-shell-mode #appScreen.app{
    width:min(1500px,calc(100vw - 16px))!important;
    height:calc(100vh - 16px)!important;min-height:0!important;max-height:calc(100vh - 16px)!important;
    margin:8px auto!important;gap:8px!important;grid-template-columns:370px minmax(0,1fr)!important;overflow:hidden!important;
  }
  html[data-theme] body.vav-shell-mode .contacts-window,
  html[data-theme] body.vav-shell-mode .chat-window{
    height:100%!important;min-height:0!important;max-height:100%!important;overflow:hidden!important;
  }
  html[data-theme] body.vav-shell-mode .active-chat:not(.hidden){
    flex:1 1 0!important;min-height:0!important;max-height:100%!important;overflow:hidden!important;
  }
  html[data-theme] body.vav-shell-mode #messageList{
    flex:1 1 0!important;min-height:0!important;overflow:auto!important;overscroll-behavior:contain!important;
  }

  html[data-theme] body.vav-shell-mode .contacts-window>.app-titlebar{
    min-height:50px!important;height:50px!important;padding:6px 9px!important;
  }
  html[data-theme] body.vav-shell-mode .desktop-app-name{
    min-width:0!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;
  }

  /* Existing account button becomes desktop overflow menu. Its JS already
     opens the account panel containing profile/invite/update/logout. */
  html[data-theme] body.vav-shell-mode #mobileAccountBtn{
    display:grid!important;place-items:center!important;order:50!important;
    width:34px!important;min-width:34px!important;height:34px!important;margin-left:4px!important;padding:0!important;
    border:1px solid var(--th-border)!important;border-radius:10px!important;background:var(--th-input)!important;
    color:var(--th-text)!important;box-shadow:inset 0 1px rgba(255,255,255,.025)!important;
  }
  html[data-theme] body.vav-shell-mode #mobileAccountBtn:hover{
    border-color:color-mix(in srgb,var(--th-accent) 52%,var(--th-border))!important;background:var(--th-hover)!important;
  }
  html[data-theme] body.vav-shell-mode #mobileAccountBtn .avatar{display:none!important}
  html[data-theme] body.vav-shell-mode #mobileAccountBtn::before{
    content:"⋮";display:block;font:800 22px/1 Tahoma,Verdana,sans-serif;transform:translateY(-1px);
  }

  /* Keep only four daily actions visible. */
  html[data-theme] body.vav-shell-mode .action-toolbar{
    display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;align-items:stretch!important;
    height:58px!important;min-height:58px!important;padding:5px 6px!important;gap:5px!important;
  }
  html[data-theme] body.vav-shell-mode #newInviteBtn,
  html[data-theme] body.vav-shell-mode #editProfileBtn,
  html[data-theme] body.vav-shell-mode #refreshBtn,
  html[data-theme] body.vav-shell-mode #logoutBtn{display:none!important}
  html[data-theme] body.vav-shell-mode .action-toolbar .action-button{
    width:100%!important;min-width:0!important;height:47px!important;min-height:47px!important;padding:4px 3px!important;
    display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;gap:3px!important;
    border:1px solid transparent!important;border-radius:10px!important;line-height:1!important;overflow:visible!important;
  }
  html[data-theme] body.vav-shell-mode .action-toolbar .action-button:hover{
    border-color:color-mix(in srgb,var(--th-accent) 40%,var(--th-border))!important;
  }
  html[data-theme] body.vav-shell-mode .action-toolbar .button-icon{
    width:20px!important;height:20px!important;flex:0 0 20px!important;opacity:.96!important;
  }
  html[data-theme] body.vav-shell-mode .action-toolbar .button-label{
    display:block!important;max-width:100%!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;
    font-size:9.5px!important;line-height:11px!important;letter-spacing:0!important;
  }
  html[data-theme] body.vav-shell-mode #openSearchBtn .button-icon{content:url("ui-icons/desktop-r2/new-chat.svg")!important}
  html[data-theme] body.vav-shell-mode #newGroupBtn .button-icon{content:url("ui-icons/desktop-r2/group.svg")!important}
  html[data-theme] body.vav-shell-mode #notificationBtn .button-icon{content:url("ui-icons/desktop-r2/bell.svg")!important}
  html[data-theme] body.vav-shell-mode #themesToolbarBtn .button-icon{content:url("ui-icons/desktop-r2/palette.svg")!important}

  html[data-theme] body.vav-shell-mode #myAvatar{
    cursor:pointer!important;transition:transform .12s ease,border-color .12s ease!important;
  }
  html[data-theme] body.vav-shell-mode #myAvatar:hover{
    transform:translateY(-1px)!important;border-color:color-mix(in srgb,var(--th-accent) 58%,var(--th-border))!important;
  }

  /* Compact one-piece desktop composer. Recipient is already visible in
     chat header, so the duplicate recipient rail is removed. */
  html[data-theme] body.vav-shell-mode .composer{
    display:flex!important;flex-direction:column!important;flex:0 0 auto!important;min-height:0!important;max-height:116px!important;
    padding:0!important;overflow:visible!important;border-top:1px solid var(--th-border)!important;
  }
  html[data-theme] body.vav-shell-mode .composer-recipient{display:none!important}
  html[data-theme] body.vav-shell-mode .composer-toolbar{
    flex:0 0 36px!important;height:36px!important;min-height:36px!important;padding:3px 8px!important;gap:5px!important;overflow:hidden!important;
  }
  html[data-theme] body.vav-shell-mode .composer-toolbar .tool-button{
    width:29px!important;min-width:29px!important;height:29px!important;min-height:29px!important;padding:5px!important;border-radius:8px!important;
  }
  html[data-theme] body.vav-shell-mode .composer-toolbar .button-icon{width:17px!important;height:17px!important}
  html[data-theme] body.vav-shell-mode .composer-tip{display:none!important}
  html[data-theme] body.vav-shell-mode .composer-row{
    flex:0 0 auto!important;min-height:58px!important;grid-template-columns:minmax(0,1fr) 106px!important;gap:7px!important;
    padding:5px 7px 7px!important;align-items:end!important;overflow:visible!important;
  }
  html[data-theme] body.vav-shell-mode .composer-input-shell{
    min-width:0!important;min-height:44px!important;height:auto!important;overflow:hidden!important;border-radius:10px!important;
  }
  html[data-theme] body.vav-shell-mode #messageInput{
    box-sizing:border-box!important;min-height:44px!important;height:44px!important;max-height:74px!important;padding:10px 11px!important;
    line-height:18px!important;resize:none!important;overflow-y:auto!important;scrollbar-width:none!important;
  }
  html[data-theme] body.vav-shell-mode #messageInput::-webkit-scrollbar{display:none!important}
  html[data-theme] body.vav-shell-mode #sendMessageBtn{
    width:106px!important;min-width:106px!important;height:44px!important;min-height:44px!important;margin:0!important;align-self:end!important;border-radius:10px!important;
  }

  @media (max-width:1120px){
    html[data-theme] body.vav-shell-mode #appScreen.app{
      width:calc(100vw - 10px)!important;height:calc(100vh - 10px)!important;max-height:calc(100vh - 10px)!important;
      margin:5px auto!important;grid-template-columns:330px minmax(0,1fr)!important;gap:6px!important;
    }
    html[data-theme] body.vav-shell-mode .action-toolbar .button-label{font-size:9px!important}
  }

  @media (max-height:760px){
    html[data-theme] body.vav-shell-mode #appScreen.app{
      height:calc(100vh - 8px)!important;max-height:calc(100vh - 8px)!important;margin:4px auto!important;
    }
    html[data-theme] body.vav-shell-mode .contacts-window>.app-titlebar,
    html[data-theme] body.vav-shell-mode .chat-window>.app-titlebar{min-height:44px!important;height:44px!important}
    html[data-theme] body.vav-shell-mode .action-toolbar{height:52px!important;min-height:52px!important;padding-top:3px!important;padding-bottom:3px!important}
    html[data-theme] body.vav-shell-mode .action-toolbar .action-button{height:45px!important;min-height:45px!important}
    html[data-theme] body.vav-shell-mode .composer-toolbar{flex-basis:34px!important;height:34px!important;min-height:34px!important}
    html[data-theme] body.vav-shell-mode .composer-row{min-height:54px!important;padding-bottom:5px!important}
    html[data-theme] body.vav-shell-mode #messageInput,
    html[data-theme] body.vav-shell-mode #sendMessageBtn{height:42px!important;min-height:42px!important}
  }
}
