/* Mobile shell: drawer navigation on phones/small tablets. Desktop sidebar unchanged. */

.vh-sidebar-mobile-bar{
  display:none;
}
.vh-mobile-menu-btn{
  display:none;
}

@media (min-width:901px){
  body{
    position:relative;
  }
  main{
    position:relative;
    z-index:1;
    background:transparent!important;
    border:0;
    box-shadow:none;
    backdrop-filter:none!important;
    -webkit-backdrop-filter:none!important;
  }
}

html:not([data-theme="dark"]) body{
  background:#eef3f8!important;
}
html:not([data-theme="dark"]) .sidebar::after{
  background-image:none!important;
}

.vh-inbox-head-actions{
  display:flex;
  align-items:center;
  gap:6px;
}

.vh-inbox-close{
  min-width:36px;
  min-height:36px;
}

@media (max-width:900px){
  body{
    position:relative;
  }
  main,.app>main{
    position:relative;
    z-index:1;
    background:transparent!important;
    border:0;
    box-shadow:none;
    backdrop-filter:none!important;
    -webkit-backdrop-filter:none!important;
  }
  html,body{
    overflow-x:hidden;
    max-width:100%;
  }
  html.vh-nav-lock,html.vh-nav-lock body{
    overflow:hidden;
  }

  .app{
    display:block!important;
    max-width:100%;
    min-width:0;
  }
  main{
    padding:14px 12px 20px!important;
    max-width:100%;
    min-width:0;
    overflow-x:hidden;
  }
  .page,.card,.grid,.toolbar,.topbar,.table-wrap{
    max-width:100%;
    min-width:0;
  }
  img,svg,canvas,video{
    max-width:100%;
  }

  .topbar{
    display:grid!important;
    grid-template-columns:44px minmax(0,1fr);
    align-items:center!important;
    gap:10px 12px;
  }
  .vh-mobile-menu-btn{
    display:inline-flex!important;
    align-items:center;
    justify-content:center;
    width:44px;
    height:44px;
    min-width:44px;
    min-height:44px;
    margin:0;
    padding:0;
    border:1px solid rgba(255,255,255,.16);
    border-radius:12px;
    background:rgba(16,43,67,.88);
    color:#fff;
    font-size:22px;
    line-height:1;
    cursor:pointer;
    z-index:5;
  }
  html:not([data-theme="dark"]) .vh-mobile-menu-btn{
    background:#fff;
    color:#102b43;
    border-color:rgba(16,43,67,.18);
  }
  .topbar .title{
    min-width:0;
  }
  .topbar .title h2{
    overflow-wrap:anywhere;
  }
  .topbar-clean-actions,.topbar .actions{
    grid-column:1/-1;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    display:flex!important;
    flex-wrap:wrap!important;
    gap:8px!important;
  }

  .sidebar{
    display:flex!important;
    flex-direction:column;
    position:fixed!important;
    z-index:12050;
    top:0;
    left:0;
    bottom:0;
    width:min(300px,86vw)!important;
    height:100dvh!important;
    max-height:100dvh;
    padding:12px 12px 18px!important;
    margin:0;
    transform:translateX(-105%);
    transition:transform .2s ease;
    overflow:hidden;
    box-shadow:18px 0 40px rgba(4,16,28,.28);
  }
  body.vh-nav-open .sidebar{
    transform:none;
  }
  .vh-sidebar-mobile-bar{
    display:flex!important;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    position:relative;
    z-index:2;
    padding:2px 2px 10px;
    color:#e8f4fb!important;
    font-weight:700;
  }
  .vh-sidebar-close{
    display:inline-flex!important;
    align-items:center;
    justify-content:center;
    width:44px;
    height:44px;
    border:0;
    border-radius:12px;
    background:#ff9f1c!important;
    color:#102b43!important;
    font-size:28px;
    line-height:1;
    cursor:pointer;
  }
  html:not([data-theme="dark"]) .vh-sidebar-mobile-bar{
    color:#102b43!important;
  }
  .sidebar nav#desktopNav{
    flex:1 1 auto;
    min-height:0;
    overflow:auto;
    -webkit-overflow-scrolling:touch;
  }
  .sidebar .nav-btn span{
    display:block!important;
  }
  .sidebar nav#desktopNav .nav-btn{
    min-height:44px;
    padding:10px 12px;
    justify-content:flex-start!important;
    text-align:left!important;
  }
  .sidebar nav#desktopNav .nav-btn span{
    text-align:left!important;
  }
  .sidebar .vh-sidebar-mobile-bar,
  .sidebar .brand{
    justify-content:flex-start!important;
  }

  .vh-nav-backdrop{
    display:none;
    position:fixed;
    inset:0;
    z-index:12040;
    background:rgba(4,10,18,.55);
  }
  body.vh-nav-open .vh-nav-backdrop{
    display:block!important;
  }

  /* Нижнее меню скрыто: навигация только через ☰ / sidebar. */
  :root{--vh-mobile-nav-h:0px}
  main{
    padding-bottom:calc(20px + env(safe-area-inset-bottom,0px))!important;
  }
  .mobile-nav,
  #mobileNav{
    display:none!important;
    visibility:hidden!important;
    pointer-events:none!important;
    height:0!important;
    max-height:0!important;
    overflow:hidden!important;
    opacity:0!important;
  }

  .modal{
    padding:8px!important;
    align-items:center!important;
  }
  .modal.open{
    display:grid!important;
  }
  .modal-box,
  .user-editor-box,
  .project-editor-box,
  .client-editor-box,
  .project-detail-box,
  .client-detail-box{
    width:calc(100vw - 16px)!important;
    max-width:calc(100vw - 16px)!important;
    max-height:calc(100dvh - 16px)!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
  }
  .form-grid,.stats,.kpi-strip,.dash-kpi-bar{
    grid-template-columns:1fr 1fr!important;
  }
  .form-grid .field-wide{grid-column:1/-1}
  .table-wrap{
    width:100%!important;
    overflow-x:auto!important;
    -webkit-overflow-scrolling:touch;
  }
  input,select,textarea,button{
    max-width:100%;
  }
  .search{
    min-width:0!important;
    width:100%!important;
  }
  .span-3,.span-4,.span-5,.span-6,.span-7,.span-8,.span-12{
    grid-column:span 12;
  }

  .fr-screen{
    width:100vw!important;
    max-width:100vw!important;
    left:0!important;
    right:0!important;
  }

  .av4-dock,.av4-picker,.av4-ctx{
    max-width:calc(100vw - 12px)!important;
    left:6px!important;
    right:6px!important;
  }
  .project-detail-tabs,
  #projectDetailTabs{
    display:flex!important;
    flex-wrap:nowrap!important;
    overflow-x:auto!important;
    -webkit-overflow-scrolling:touch;
    max-width:100%!important;
  }
  .project-detail-tab{flex:0 0 auto}
  .project-filter-bar,
  .project-kanban-scroll{
    max-width:100%!important;
    overflow-x:auto!important;
  }
  .vh-sidebar-brand{display:none!important}
}

@media (max-width:520px){
  .form-grid,.stats,.kpi-strip,.dash-kpi-bar{
    grid-template-columns:1fr!important;
  }
  .title h2{font-size:18px!important}
  .title p{font-size:11px!important}
}

@media print{
  .vh-sidebar-mobile-bar,.mobile-nav{display:none!important}
}
/* Mobile PDF stays inside the app so closing preserves the current screen. */
.vh-mobile-pdf-viewer{
  position:fixed;
  inset:0;
  z-index:100000;
  display:grid;
  grid-template-rows:auto minmax(0,1fr);
  background:#202124;
  /* Иначе iOS/Android режут жест прокрутки внутри iframe PDF. */
  touch-action:manipulation;
}
.vh-mobile-pdf-viewer[hidden]{display:none!important}
.vh-mobile-pdf-head{
  min-height:56px;
  padding:calc(8px + env(safe-area-inset-top,0px)) 12px 8px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  background:#102b43;
  color:#fff;
  box-shadow:0 2px 10px rgba(0,0,0,.28);
}
.vh-mobile-pdf-head strong{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.vh-mobile-pdf-close{
  flex:0 0 auto;
  min-height:40px;
  padding:0 16px;
  border:0;
  border-radius:10px;
  background:#f7941d;
  color:#102b43;
  font:800 14px/1 Arial,sans-serif;
}
.vh-mobile-pdf-body{
  position:relative;
  min-height:0;
  height:100%;
  overflow:auto;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior:contain;
  touch-action:pan-x pan-y;
  background:#525659;
}
.vh-mobile-pdf-frame{
  display:block;
  width:100%;
  /* Оставляем большой непрерывный холст: мобильный PDF-плагин внутри iframe
     иначе рисует только первый лист, а ниже оставляет пустую область. */
  min-height:100%;
  height:max(100%, 3200vh);
  border:0;
  background:#525659;
}
.vh-mobile-pdf-open{
  position:absolute;
  left:16px;
  right:16px;
  top:16px;
  z-index:2;
  display:none;
  padding:14px 16px;
  border-radius:10px;
  background:#f7941d;
  color:#102b43;
  font:800 14px/1.2 Arial,sans-serif;
  text-align:center;
  text-decoration:none;
}
@media (max-width:900px){
  .vh-mobile-pdf-open{display:block}
  .vh-mobile-pdf-frame{display:none!important}
}
body.vh-pdf-viewer-open{
  overflow:hidden!important;
}
body.vh-pdf-viewer-open .mobile-nav,
body.vh-pdf-viewer-open #mobileNav{
  display:none!important;
}



/* vh-stickers-nav-icon-20261030 */
@media (max-width:900px){
  .sidebar .nav-btn[data-page="stickers"] b{
    background:rgba(255,255,255,.10)!important;
    font-size:0!important;
    color:transparent!important;
    position:relative;
    overflow:hidden;
  }
  /* Лист с цветными наклейками — читается на 28–31 px. */
  .sidebar .nav-btn[data-page="stickers"] b::before{
    content:"";
    position:absolute;
    inset:3px;
    background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect x='5' y='11' width='54' height='42' rx='7' fill='%23ffffff'/%3E%3Crect x='10' y='17' width='21' height='30' rx='4' fill='%23f7941d'/%3E%3Crect x='35' y='17' width='19' height='12' rx='3' fill='%232f9bff'/%3E%3Crect x='35' y='35' width='19' height='12' rx='3' fill='%2335c77a'/%3E%3C/svg%3E") center/88% no-repeat;
  }

  /* Файлы объекта: без пунктирной рамки вокруг кнопки выбора. */
  #projectTab-files .project-file-drop,
  .project-files-card .project-file-drop,
  .project-file-drop{
    border:0!important;
    background:transparent!important;
    padding:0!important;
    min-height:0!important;
    margin-bottom:10px!important;
  }

/* vh-file-btn-clean-mobile-20261030 */
.project-file-drop input[type="file"],
.compact-file-drop input[type="file"],
.file-drop input[type="file"]{
  border:0!important;
  background:transparent!important;
  box-shadow:none!important;
  outline:none!important;
  padding:0!important;
  min-height:0!important;
  height:auto!important;
}
.project-file-drop input[type="file"]::file-selector-button,
.project-file-drop input[type="file"]::-webkit-file-upload-button,
.compact-file-drop input[type="file"]::file-selector-button,
.compact-file-drop input[type="file"]::-webkit-file-upload-button,
.file-drop input[type="file"]::file-selector-button,
.file-drop input[type="file"]::-webkit-file-upload-button{
  height:36px!important;
  margin:0 10px 0 0!important;
  padding:0 14px!important;
  border:1px solid var(--vh-line)!important;
  border-radius:10px!important;
  background:var(--vh-surface)!important;
  color:var(--vh-text)!important;
  font-weight:700!important;
  cursor:pointer!important;
  vertical-align:middle!important;
}
