/* Zakupki v1.9.31 — compact mobile chat + centered read-receipt popup.
   This stylesheet intentionally works with the existing v1.9.30 detail.html markup. */

@media (max-width:760px), (orientation:landscape) and (max-height:600px) and (max-width:1280px){
  /* More useful room for the conversation, without making the section sticky. */
  #discussion.v1916-chat-section{
    padding:10px 9px 11px!important;
    overflow:visible!important;
  }

  /* Compact existing chat header. No template rewrite required. */
  .v1916-chat-header{
    margin-bottom:4px!important;
  }
  .v1916-chat-header>div{
    display:flex!important;
    align-items:center!important;
    gap:7px!important;
    flex-wrap:nowrap!important;
    min-width:0!important;
    width:100%!important;
  }
  .v1916-chat-header h2{
    margin:0!important;
    font-size:18px!important;
    line-height:1.08!important;
    white-space:nowrap!important;
    flex:0 0 auto!important;
  }
  .v1916-chat-header h2 .count{
    margin-left:4px!important;
    padding:3px 7px!important;
    font-size:11px!important;
    line-height:1!important;
    vertical-align:middle!important;
  }
  .v1916-chat-header p{
    margin:0!important;
    min-width:0!important;
    flex:1 1 auto!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
    font-size:11px!important;
    line-height:1.1!important;
  }

  .v1916-chat-feed{
    min-height:315px!important;
    max-height:min(59dvh,550px)!important;
    padding:6px!important;
    gap:5px!important;
    border-radius:10px!important;
    scroll-padding-top:6px;
    scroll-padding-bottom:6px;
  }
  .v1916-chat-row{
    gap:4px!important;
    align-items:flex-end!important;
  }
  .v1916-message-wrap{max-width:min(90%,660px)!important}
  .v1916-chat-avatar,
  .v1916-chat-row .v1920-avatar-preview.v1916-chat-avatar{
    width:27px!important;
    height:27px!important;
    min-width:27px!important;
    min-height:27px!important;
    flex-basis:27px!important;
    font-size:11px!important;
  }
  .v1916-message-bubble{
    padding:5px 7px 4px!important;
    border-radius:10px 10px 10px 4px!important;
  }
  .v1916-chat-row.is-own .v1916-message-bubble{border-radius:10px 10px 4px 10px!important}
  .v1916-message-top{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto auto!important;
    align-items:center!important;
    column-gap:5px!important;
    row-gap:1px!important;
    margin-bottom:2px!important;
    font-size:9px!important;
    line-height:1.1!important;
  }
  .v1916-message-top strong{
    min-width:0!important;
    font-size:10.5px!important;
    line-height:1.15!important;
    overflow-wrap:anywhere!important;
  }
  .v1916-message-top span{
    font-size:9px!important;
    white-space:nowrap!important;
  }
  .v1916-reply-button,
  .v1916-file-reply,
  .v1919-photo-reply{
    margin-left:0!important;
    padding:1px 3px!important;
    font-size:16px!important;
    line-height:1!important;
  }
  .v1916-message-text{
    font-size:12px!important;
    line-height:1.3!important;
  }
  .v1916-reply-reference{
    margin:0 0 4px!important;
    padding:4px 6px!important;
    border-left-width:2px!important;
    border-radius:6px!important;
  }
  .v1916-reply-reference strong{font-size:10px!important}
  .v1916-reply-reference span{font-size:10px!important}
  .v1916-file-card{
    gap:6px!important;
    margin-top:4px!important;
    padding:5px 6px!important;
    border-radius:7px!important;
  }
  .v1916-file-icon{
    width:25px!important;
    height:25px!important;
    font-size:14px!important;
  }
  .v1916-file-meta strong{font-size:10.5px!important}
  .v1916-file-meta small,.v1916-open-file{font-size:9px!important}
  .v1916-read-state,.v1920-read-state{
    min-height:14px!important;
    margin-top:1px!important;
    font-size:9px!important;
    line-height:1!important;
  }
  #chatFeed .chat-system-event{
    margin:5px 0 5px auto!important;
    padding:5px 7px!important;
    font-size:10px!important;
    line-height:1.25!important;
  }
  #chatFeed .chat-system-text{font-size:10px!important}
  #chatFeed .chat-system-meta{font-size:9px!important}

  /* Mobile viewers list: fixed in the center of the visible viewport. */
  .v1920-read-popover{
    position:fixed!important;
    left:50%!important;
    right:auto!important;
    top:50%!important;
    bottom:auto!important;
    width:min(300px,calc(100vw - 28px))!important;
    min-width:0!important;
    max-width:calc(100vw - 28px)!important;
    max-height:min(56dvh,340px)!important;
    overflow:auto!important;
    padding:11px 12px!important;
    border-radius:12px!important;
    box-sizing:border-box!important;
    transform:translate(-50%,-50%)!important;
    z-index:5000!important;
    box-shadow:0 16px 42px rgba(8,20,38,.34)!important;
    text-align:left!important;
  }
  .v1920-read-popover>strong{font-size:12px!important}
  .v1920-read-popover>span{
    gap:2px!important;
    padding-top:6px!important;
    overflow-wrap:anywhere!important;
    word-break:break-word!important;
  }
  .v1920-read-popover small{font-size:9px!important}
}

@media (orientation:portrait) and (max-width:430px){
  .v1916-chat-feed{max-height:min(61dvh,570px)!important}
  .v1916-message-wrap{max-width:91%!important}
}
