/* =========================================================
   Helpy Chat — cleaned, consolidated CSS
   Purpose:
   - stable mobile chat layout
   - no right cut / no horizontal overflow
   - sticky composer
   - popup/action menu not clipped
   - compact chat list
   - cleaner back bar
   - safe desktop bubble styling
   ========================================================= */

/* =========================
   Base bubble styling
   ========================= */
#rtcl-user-chat-wrap,
#rtcl-user-chat-wrap *{
  box-sizing: border-box;
}

#rtcl-user-chat-wrap .rtcl-message-content{
  border-radius: 16px !important;
  padding: 10px 14px !important;
  max-width: 75% !important;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}

#rtcl-user-chat-wrap li.rtcl-message-wrap.own-message .rtcl-message-text{
  background: #F4EEFF !important;
  color: #2c2140 !important;
  border-radius: 14px !important;
  padding: 10px 14px !important;
  border: 1px solid #E5DAFF !important;
}

#rtcl-user-chat-wrap li.rtcl-message-wrap:not(.own-message) .rtcl-message-text,
#rtcl-user-chat-wrap li.rtcl-message-wrap:not(.own-message) .rtcl-message-content{
  background: #fff !important;
  color: #222 !important;
  border-radius: 14px !important;
  border: 1px solid rgba(0,0,0,.06) !important;
}

#rtcl-user-chat-wrap li.rtcl-message-wrap:not(.own-message) .rtcl-message-content{
  margin-right: auto !important;
}

/* =========================
   Mobile chat system
   ========================= */
@media (max-width: 991px){

  /* My Account shell */
  .content-area.classima-myaccount{
    padding-top: 0 !important;
  }

  .rtcl-MyAccount-content{
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  a.scrollToTop{
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  /* ---------- overall chat width / overflow ---------- */
  #rtcl-user-chat-wrap,
  #rtcl-user-chat-wrap .rtcl-chat-content-wrapper,
  #rtcl-user-chat-wrap .rtcl-chat-container,
  #rtcl-user-chat-wrap .rtcl-conversations-container,
  #rtcl-user-chat-wrap .rtcl-conversation-container,
  #rtcl-user-chat-wrap .rtcl-message-container,
  #rtcl-user-chat-wrap .rtcl-messages-container,
  #rtcl-user-chat-wrap .rtcl-messages-list,
  #rtcl-user-chat-wrap .rtcl-message-wrap,
  #rtcl-user-chat-wrap .rtcl-message,
  #rtcl-user-chat-wrap .rtcl-message-content,
  #rtcl-user-chat-wrap .rtcl-message-text,
  #rtcl-user-chat-wrap .item-detail-container{
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  #rtcl-user-chat-wrap,
  #rtcl-user-chat-wrap .rtcl-chat-content-wrapper,
  #rtcl-user-chat-wrap .rtcl-chat-container,
  #rtcl-user-chat-wrap .rtcl-conversation-container,
  #rtcl-user-chat-wrap .rtcl-messages-container,
  #rtcl-user-chat-wrap .rtcl-messages-list{
    overflow-x: hidden !important;
  }

  #rtcl-user-chat-wrap .rtcl-message-content,
  #rtcl-user-chat-wrap .rtcl-message-text{
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    white-space: normal !important;
  }

  /* media inside bubbles */
  #rtcl-user-chat-wrap .rtcl-message-content{
    max-width: 90% !important;
    overflow: hidden !important;
  }

  #rtcl-user-chat-wrap .rtcl-message-attach-wrap{
    max-width: 100% !important;
    overflow: hidden !important;
    border-radius: 14px !important;
  }

  #rtcl-user-chat-wrap .rtcl-message-text img,
  #rtcl-user-chat-wrap .rtcl-message-attach-wrap img,
  #rtcl-user-chat-wrap .rtcl-message-attach-wrap video,
  #rtcl-user-chat-wrap .rtcl-message-attach-wrap iframe,
  #rtcl-user-chat-wrap .rtcl-message-content img{
    display: block !important;
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
  }

  #rtcl-user-chat-wrap .rtcl-messages-list{
    padding-right: 0 !important;
    margin-right: 0 !important;
  }

  /* ---------- list/chat modes ---------- */
  body.rtcl-account.lh-chat-mode-list .rtcl-conversation-container{
    display: none !important;
  }

  body.rtcl-account.lh-chat-mode-chat .rtcl-conversations-container{
    display: none !important;
  }

  body.rtcl-account.lh-chat-mode-chat .rtcl-conversation-container{
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* ---------- compact conversation list ---------- */
  #rtcl-user-chat-wrap ul.rtcl-conversation-item-list,
  #rtcl-user-chat-wrap ul.rtcl-conversation-item-lists{
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    align-items: stretch !important;
  }

  #rtcl-user-chat-wrap ul.rtcl-conversation-item-list > li.rtcl-conversation-item,
  #rtcl-user-chat-wrap ul.rtcl-conversation-item-lists > li.rtcl-conversation-item,
  #rtcl-user-chat-wrap li.rtcl-conversation-item{
    flex: 0 0 auto !important;
    flex-basis: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    align-self: stretch !important;
  }

  #rtcl-user-chat-wrap li.rtcl-conversation-item > button{
    position: relative !important;
    width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
    padding: 10px 44px 10px 12px !important;
    align-items: center !important;
  }

  #rtcl-user-chat-wrap .rtcl-chat-listing-img-wrap{
    width: 44px !important;
    height: 44px !important;
    flex: 0 0 44px !important;
  }

  #rtcl-user-chat-wrap .rtcl-chat-listing-img-wrap img{
    width: 44px !important;
    height: 44px !important;
    object-fit: cover !important;
    border-radius: 999px !important;
  }

  #rtcl-user-chat-wrap .rtcl-con-user-name{
    font-size: 15px !important;
    line-height: 18px !important;
    margin: 0 0 2px !important;
  }

  #rtcl-user-chat-wrap .rtcl-con-item-title{
    font-size: 14px !important;
    line-height: 16px !important;
    margin: 0 !important;
  }

  #rtcl-user-chat-wrap .rtcl-con-last-message{
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    min-width: 0 !important;
    margin-top: 2px !important;
    position: static !important;
    padding-right: 0 !important;
  }

  #rtcl-user-chat-wrap .rtcl-con-last-message .last-message,
  #rtcl-user-chat-wrap .rtcl-con-last-message .last-message.active{
    flex: 0 1 auto !important;
    min-width: 0 !important;
    max-width: 10ch !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: 13px !important;
    line-height: 16px !important;
    font-style: italic !important;
    color: rgba(0,0,0,.55) !important;
  }

  #rtcl-user-chat-wrap .rtcl-con-last-message .last-message.active{
    font-weight: 700 !important;
    color: rgba(0,0,0,.85) !important;
  }

  #rtcl-user-chat-wrap .rtcl-con-last-message .last-message-time{
    flex: 0 0 auto !important;
    margin-left: auto !important;
    position: static !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    white-space: nowrap !important;
    font-size: 11px !important;
    line-height: 16px !important;
    color: rgba(0,0,0,.42) !important;
  }

  #rtcl-user-chat-wrap li.rtcl-conversation-item:has(.last-message.active){
    background: rgba(124,58,237,.06) !important;
  }

  #rtcl-user-chat-wrap li.rtcl-conversation-item:has(.last-message.active) .rtcl-con-user-name{
    font-weight: 700 !important;
  }

  /* ---------- conversations header ---------- */
  #rtcl-user-chat-wrap .rtcl-conversations-header{
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    padding: 10px 12px !important;
  }

  #rtcl-user-chat-wrap .rtcl-conversations-recipient{
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    flex: 0 0 auto !important;
    width: 64px !important;
    min-width: 64px !important;
  }

  #rtcl-user-chat-wrap .rtcl-conversations-recipient .img-wrap,
  #rtcl-user-chat-wrap .rtcl-conversations-recipient .img-wrap img{
    width: 36px !important;
    height: 36px !important;
  }

  #rtcl-user-chat-wrap .rtcl-conversations-recipient .img-wrap img{
    border-radius: 999px !important;
    object-fit: cover !important;
    display: block !important;
  }

  #rtcl-user-chat-wrap .rtcl-conversations-recipient h4{
    margin: 0 !important;
    padding: 0 !important;
    font-size: 12px !important;
    line-height: 14px !important;
    font-weight: 600 !important;
    text-align: center !important;
    max-width: 64px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  #rtcl-user-chat-wrap .rtcl-conversations-header .search-box{
    flex: 1 1 auto !important;
    min-width: 0 !important;
    margin: 0 !important;
  }

  #rtcl-user-chat-wrap .rtcl-conversations-header .search-box input,
  #rtcl-user-chat-wrap .rtcl-conversations-header .search-box .rtcl-form-control{
    width: 100% !important;
    height: 38px !important;
    padding: 8px 12px !important;
    border-radius: 999px !important;
  }

  /* ---------- hide bulk actions ---------- */
  #rtcl-user-chat-wrap .rtcl-conversation-action-checkbox,
  #rtcl-user-chat-wrap .rtcl-con-actions{
    display: none !important;
  }

  /* ---------- mobile bottom sheet / kebab ---------- */
  #rtcl-user-chat-wrap .lh-chat-kebab{
    position: absolute !important;
    right: 10px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 32px !important;
    height: 32px !important;
    border: 0 !important;
    background: transparent !important;
    border-radius: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent;
  }

  #rtcl-user-chat-wrap .lh-chat-kebab:active{
    background: rgba(0,0,0,.06) !important;
  }

  #rtcl-user-chat-wrap .lh-chat-kebab .lh-dots{
    display: inline-block !important;
    font-size: 20px !important;
    line-height: 1 !important;
    color: rgba(0,0,0,.55) !important;
    transform: translateY(-1px);
  }

  .lh-chat-sheet-backdrop{
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0,0,0,.35);
    z-index: 999999;
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
  }

  .lh-chat-sheet{
    position: fixed !important;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000000;
    background: #fff;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: 0 -12px 30px rgba(0,0,0,.18);
    transform: translateY(110%);
    transition: transform .22s ease;
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  }

  .lh-chat-sheet.is-open{
    transform: translateY(0);
  }

  .lh-chat-sheet-backdrop.is-open{
    opacity: 1;
    pointer-events: auto;
  }

  .lh-chat-sheet-title{
    font-size: 13px;
    color: rgba(0,0,0,.55);
    margin: 4px 6px 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .lh-chat-sheet-btn{
    width: 100%;
    border: 1px solid rgba(0,0,0,.08);
    background: #fff;
    padding: 12px;
    border-radius: 12px;
    font-size: 15px;
    line-height: 18px;
    text-align: center;
    margin: 8px 0;
  }

  .lh-chat-sheet-btn:active{
    background: rgba(0,0,0,.04);
  }

  .lh-chat-sheet-btn.is-danger{
    border-color: rgba(220,38,38,.25);
    color: rgb(185,28,28);
    background: rgba(220,38,38,.06);
  }

  /* ---------- chat mode full height ---------- */
  body.rtcl-account.lh-chat-mode-chat #rtcl-user-chat-wrap .rtcl-chat-container{
    display: flex !important;
    flex-direction: column !important;
    height: calc(100vh - env(safe-area-inset-bottom)) !important;
    overflow: hidden !important;
  }

  body.rtcl-account.lh-chat-mode-chat #rtcl-user-chat-wrap .rtcl-message-container{
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    display: flex !important;
    flex-direction: column !important;
  }

  body.rtcl-account.lh-chat-mode-chat #rtcl-user-chat-wrap .rtcl-messages-container{
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
  }

  /* ---------- composer / action menu ---------- */
  body.rtcl-account.lh-chat-mode-chat #rtcl-user-chat-wrap .rtcl-chat-send-wrapper{
    flex: 0 0 auto !important;
    position: sticky !important;
    bottom: 0 !important;
    z-index: 20 !important;
    background: #fff !important;
    padding-bottom: env(safe-area-inset-bottom) !important;
    border-top: 1px solid rgba(0,0,0,.06);
    height: auto !important;
    overflow: visible !important;
  }

  #rtcl-user-chat-wrap .rtcl-chat-send-wrap,
  #rtcl-user-chat-wrap .rtcl-action-menu-wrap{
    overflow: visible !important;
    position: relative !important;
  }

  #rtcl-user-chat-wrap .rtcl-chat-send-wrap{
    display: flex !important;
    align-items: flex-end !important;
    gap: 8px !important;
    height: auto !important;
  }

  #rtcl-user-chat-wrap .rtcl-chat-send-wrap textarea{
    flex: 1 1 auto !important;
    min-width: 0 !important;
    min-height: 40px !important;
    max-height: 120px !important;
    height: auto !important;
    line-height: 20px !important;
    overflow-y: hidden !important;
    resize: none !important;
  }

  #rtcl-user-chat-wrap .rtcl-chat-send-wrap .rtcl-chat-send{
    flex: 0 0 auto !important;
    align-self: flex-end !important;
  }

  /* popup / dropdown near composer should not be cut */
  #rtcl-user-chat-wrap .rtcl-action-menu-wrap .rtcl-dropdown,
  #rtcl-user-chat-wrap .rtcl-action-menu-wrap .dropdown-menu,
  #rtcl-user-chat-wrap .rtcl-action-menu-wrap .rtcl-action-menu{
    position: absolute !important;
    left: 0 !important;
    right: auto !important;
    bottom: calc(100% + 8px) !important;
    z-index: 99999 !important;
    max-width: min(260px, calc(100vw - 24px)) !important;
  }

  /* ---------- custom backbar ---------- */
  body.rtcl-account .lh-chat-backbar{
    display: none;
  }

  body.rtcl-account.lh-chat-mode-chat .lh-chat-backbar{
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    padding: 10px 12px !important;
    background: #fff;
    border-bottom: 1px solid rgba(0,0,0,.08);
    position: relative;
  }

  body.rtcl-account .lh-chat-backbtn,
  .lh-chat-backbar .lh-chat-back{
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 12px !important;
    border: 1px solid rgba(0,0,0,.10);
    background: #fff;
    font-size: 22px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
  }

  body.rtcl-account.lh-chat-mode-chat .lh-chat-backbar .lh-chat-backtitle{
    display: none !important;
  }

  body.rtcl-account.lh-chat-mode-chat .lh-chat-backbar .lh-chat-head{
    flex: 1 1 auto !important;
    min-width: 0 !important;
    line-height: 1.15 !important;
  }

  body.rtcl-account.lh-chat-mode-chat .lh-chat-backbar .lh-chat-listing{
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
    letter-spacing: -.1px !important;
    max-height: calc(1.4em * 2) !important;
    padding-right: 20px !important;
  }

  body.rtcl-account.lh-chat-mode-chat .lh-chat-backbar .lh-chat-meta{
    margin-top: 2px !important;
    font-size: 14px !important;
    display: flex !important;
    gap: 8px !important;
    min-width: 0 !important;
  }

  body.rtcl-account.lh-chat-mode-chat .lh-chat-backbar .lh-chat-sender,
  body.rtcl-account.lh-chat-mode-chat .lh-chat-backbar .lh-chat-time,
  body.rtcl-account .lh-chat-backsub{
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    min-width: 0 !important;
    font-size: 12px !important;
    opacity: .65;
  }

  body.rtcl-account.lh-chat-mode-chat .lh-chat-backbar::after{
    content: "⋮";
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    line-height: 1;
    font-weight: 600;
    padding: 8px 10px;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
  }

  /* hide search field only in opened chat mode */
  body.rtcl-account.lh-chat-mode-chat input[placeholder="Search listings ..."],
  body.rtcl-account.lh-chat-mode-chat input[placeholder="Search listings..."]{
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
  }
}
/* =========================================
   Helpy chat attach menu — visual only
   ========================================= */
@media (max-width: 991px){

  /* опорный контейнер */
  #rtcl-user-chat-wrap .rtcl-action-menu-wrap{
    position: relative !important;
  }

  /* кнопка + */
  #rtcl-user-chat-wrap button.rtcl-action-menu{
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: #fff !important;
    box-shadow: none !important;
    position: relative !important;
    z-index: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* сама иконка + */
  #rtcl-user-chat-wrap button.rtcl-action-menu > i.rtcl-icon-plus-circled{
    display: block !important;
    width: 20px !important;
    height: 20px !important;
    line-height: 20px !important;
    text-align: center !important;
    font-size: 20px !important;
    font-style: normal !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #7a3db8 !important;
  }

  #rtcl-user-chat-wrap button.rtcl-action-menu > i.rtcl-icon-plus-circled::before{
    background: transparent !important;
    box-shadow: none !important;
    color: #7a3db8 !important;
  }

  /* всплывающее меню — выше кнопки и чуть правее, чтобы не налезать на + */
  #rtcl-user-chat-wrap .rtcl-action-submenu{
    position: absolute !important;
    left: 12px !important;
    bottom: calc(100% + 8px) !important;
    z-index: 20 !important;
    min-width: 112px !important;
    padding: 6px !important;
    border: 1px solid rgba(0,0,0,.08) !important;
    border-radius: 12px !important;
    background: #fff !important;
    box-shadow: 0 10px 24px rgba(0,0,0,.12) !important;
    overflow: hidden !important;
  }

  /* пункты меню */
  #rtcl-user-chat-wrap .rtcl-action-submenu a{
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    min-height: 36px !important;
    padding: 8px 10px !important;
    border-radius: 8px !important;
    background: transparent !important;
    color: #6f38b1 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    white-space: nowrap !important;
  }

  #rtcl-user-chat-wrap .rtcl-action-submenu a:hover,
  #rtcl-user-chat-wrap .rtcl-action-submenu a:active{
    background: #f6f1fc !important;
  }

  /* иконки пунктов меню */
  #rtcl-user-chat-wrap .rtcl-action-submenu a i,
  #rtcl-user-chat-wrap .rtcl-action-submenu a svg{
    width: 16px !important;
    height: 16px !important;
    font-size: 16px !important;
    line-height: 16px !important;
    color: #7a3db8 !important;
    background: transparent !important;
    box-shadow: none !important;
  }
}
#rtcl-user-chat-wrap textarea{
  padding-left: 20px !important;
}
@media (max-width: 991px){
  body.rtcl-account.lh-chat-mode-chat #rtcl-user-chat-wrap .rtcl-message-card-container{
    display: none !important;
  }
}
@media (max-width: 991px){
  body.rtcl-account.lh-chat-mode-chat #rtcl-user-chat-wrap .rtcl-chat-container{
    display:flex !important;
    flex-direction:column !important;
    height:calc(100vh - env(safe-area-inset-bottom)) !important;
    overflow:hidden !important;
  }

  body.rtcl-account.lh-chat-mode-chat #rtcl-user-chat-wrap .rtcl-message-container{
    flex:1 1 auto !important;
    min-height:0 !important;
    overflow:visible !important;
    display:flex !important;
    flex-direction:column !important;
  }

  body.rtcl-account.lh-chat-mode-chat #rtcl-user-chat-wrap .rtcl-messages-container{
    flex:1 1 auto !important;
    min-height:0 !important;
    overflow-y:auto !important;
    overflow-x:hidden !important;
    -webkit-overflow-scrolling:touch;
  }

  body.rtcl-account.lh-chat-mode-chat #rtcl-user-chat-wrap .rtcl-chat-send-wrapper{
    flex:0 0 auto !important;
    position:sticky !important;
    bottom:0 !important;
    z-index:20 !important;
    background:#fff !important;
    padding-bottom:env(safe-area-inset-bottom) !important;
    border-top:1px solid rgba(0,0,0,.06) !important;
    height:auto !important;
    overflow:visible !important;
  }
}
@media (max-width: 991px){

  /* при открытом чате блокируем внешний скролл страницы */


  /* my-account оболочка тоже не должна прокручиваться */
  body.rtcl-account.lh-chat-mode-chat .content-area.classima-myaccount,
  body.rtcl-account.lh-chat-mode-chat .rtcl-MyAccount-content,
  body.rtcl-account.lh-chat-mode-chat #primary,
  body.rtcl-account.lh-chat-mode-chat #main,
  body.rtcl-account.lh-chat-mode-chat #rtcl-user-chat-wrap,
  body.rtcl-account.lh-chat-mode-chat #rtcl-user-chat-wrap .rtcl-chat-content-wrapper,
  body.rtcl-account.lh-chat-mode-chat #rtcl-user-chat-wrap .rtcl-conversation-container{
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  /* сам открытый чат занимает весь экран */
  body.rtcl-account.lh-chat-mode-chat #rtcl-user-chat-wrap .rtcl-chat-container{
    display: flex !important;
    flex-direction: column !important;
    height: 100dvh !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  /* шапка сверху, сообщения по центру, инпут снизу */
  body.rtcl-account.lh-chat-mode-chat #rtcl-user-chat-wrap .rtcl-message-container{
    flex: 1 1 auto !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  /* единственный вертикальный скролл */
  body.rtcl-account.lh-chat-mode-chat #rtcl-user-chat-wrap .rtcl-messages-container{
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
  }

  /* инпут приклеен к низу поверх чата */
  body.rtcl-account.lh-chat-mode-chat #rtcl-user-chat-wrap .rtcl-chat-send-wrapper{
    flex: 0 0 auto !important;
    position: sticky !important;
    bottom: 0 !important;
    z-index: 30 !important;
    background: #fff !important;
    padding-bottom: env(safe-area-inset-bottom) !important;
    border-top: 1px solid rgba(0,0,0,.06) !important;
    overflow: visible !important;
  }
}
/* Desktop chat: only base 2 columns!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
@media (min-width: 992px){
        #rtcl-user-chat-wrap .rtcl-chat-send-wrap textarea{
      flex: 1 1 auto !important;
      min-width: 0 !important;
      min-height: 44px !important;
      max-height: 112px !important;
      height: auto !important;
      line-height: 20px !important;
      padding-top: 10px !important;
      padding-bottom: 10px !important;
      overflow-y: auto !important;
      resize: none !important;
      box-sizing: border-box !important;
    }
 
}

@media (min-width: 992px) {
  html {
    scrollbar-gutter: stable;
  }

  body.lh-chat-popup-desktop-open,
  body.lh-chat-popup-desktop-open.rtcl-overflow-hidden {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-right: 0 !important;
  }
}
/* =========================================================
   Popup chat topbar close button
   ========================================================= */

#rtcl-chat-modal .rtcl-chat-modal-handle.lh-chat-topbar-ready {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 10px 14px;
}

#rtcl-chat-modal .rtcl-chat-modal-handle.lh-chat-topbar-ready .lh-chat-topbar-close {
  appearance: none;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  width: 30px;
  height: 30px;
  min-width: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border-radius: 999px;
  font-size: 22px;
  line-height: 1;
  box-shadow: none;
  position: relative;
  z-index: 3;
}

#rtcl-chat-modal .rtcl-chat-modal-handle.lh-chat-topbar-ready .lh-chat-topbar-close:hover,
#rtcl-chat-modal .rtcl-chat-modal-handle.lh-chat-topbar-ready .lh-chat-topbar-close:focus {
  background: rgba(255, 255, 255, 0.14);
  outline: none;
  box-shadow: none;
}

#rtcl-chat-modal .rtcl-chat-modal-handle.lh-chat-topbar-ready .lh-chat-topbar-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0;
  max-width: calc(100% - 110px);
  white-space: nowrap;
  text-align: center;
  font-weight: 700;
  pointer-events: none;
}

#rtcl-chat-modal .rtcl-chat-modal-handle.lh-chat-topbar-ready .lh-chat-topbar-toggle {
  margin-left: auto;
  position: relative;
  z-index: 3;
}

@media (max-width: 991px) {
  #rtcl-chat-modal .rtcl-chat-modal-handle.lh-chat-topbar-ready {
    min-height: 48px;
    padding: 10px 12px;
  }

  #rtcl-chat-modal .rtcl-chat-modal-handle.lh-chat-topbar-ready .lh-chat-topbar-close {
    width: 28px;
    height: 28px;
    min-width: 28px;
    font-size: 20px;
  }

  #rtcl-chat-modal .rtcl-chat-modal-handle.lh-chat-topbar-ready .lh-chat-topbar-title {
    max-width: calc(100% - 92px);
    font-size: 15px;
  }
}