/* Kovcheg adaptive system: shared mobile geometry, theme tokens and navigation.
   All new mobile behaviour belongs here, rather than patching multiple page CSS files. */
body.shelter-light {
 --km-surface:#fff;--km-panel:#f6f8fb;--km-text:#293d54;
 --km-muted:#697f96;--km-line:#dae3ec;--km-selected:#e9f2fb;--km-accent:#367cb6;
}
body.shelter-dark {
 --km-surface:#222;--km-panel:#292929;--km-text:#e9e9e9;
 --km-muted:#b4b4b4;--km-line:#404040;--km-selected:#363636;--km-accent:#a4caef;
}
@media(max-width:780px){
 html,body{max-width:100%;overflow-x:clip}
 *,*::before,*::after{box-sizing:border-box}
 .site-header .header-inner{min-width:0}
 .site-header .brand{min-width:0}
 .site-header .brand>span{min-width:0}
 .site-header .brand strong{overflow-wrap:anywhere}
 .site-main,.crm-main,.kv-vk-main,.kv-vk-app,.kv-classic-content{min-width:0}
 .site-main img,.crm-main img,.kv-vk-main img{max-width:100%;height:auto}
 .kv-mobile-bottom{
  min-height:60px!important;
  padding:3px 4px max(4px,env(safe-area-inset-bottom,0px))!important;
  background:var(--km-surface)!important;
  border-color:var(--km-line)!important;
  box-shadow:0 -4px 16px #0a172018!important;
 }
 .kv-mobile-bottom>a,.kv-mobile-bottom>.kv-mobile-more>summary{
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:2px;min-width:0;min-height:52px;padding:3px 1px;
  color:var(--km-muted)!important;text-decoration:none!important;border:0;border-radius:9px;
  cursor:pointer;list-style:none;
 }
 .kv-mobile-bottom .kv-mobile-more>summary::-webkit-details-marker{display:none}
 .kv-mobile-bottom>a svg,.kv-mobile-bottom>.kv-mobile-more>summary svg{
  display:block;width:23px;height:23px;flex:0 0 23px;
 }
 .kv-mobile-bottom>a small,.kv-mobile-bottom>.kv-mobile-more>summary small{
  color:inherit!important;font-size:10px!important;line-height:14px!important;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
 }
 .kv-mobile-bottom>a.is-active,.kv-mobile-bottom>.kv-mobile-more[open]>summary{
  background:var(--km-selected)!important;color:var(--km-accent)!important;
 }
 .kv-mobile-more{min-width:0}
 .kv-mobile-more-sheet{
  position:fixed;z-index:102;
  left:max(10px,env(safe-area-inset-left,0px));
  right:max(10px,env(safe-area-inset-right,0px));
  bottom:calc(67px + env(safe-area-inset-bottom,0px));
  max-width:520px;max-height:min(72dvh,590px);margin:0 auto;
  overflow-y:auto;overscroll-behavior:contain;
  background:var(--km-surface);color:var(--km-text);
  border:1px solid var(--km-line);border-radius:15px;
  box-shadow:0 9px 36px #0004;
 }
 .kv-mobile-more:not([open]) .kv-mobile-more-sheet{display:none!important}
 .kv-mobile-more-header{position:sticky;top:0;z-index:1;display:flex;align-items:center;
  justify-content:space-between;min-height:49px;padding:10px 15px;
  background:var(--km-surface);border-bottom:1px solid var(--km-line)}
 .kv-mobile-more-header strong{font-size:14px;color:var(--km-text)!important}
 .kv-mobile-more-header button{width:34px;height:34px;padding:0;border:0;
  font-size:26px;line-height:1;background:transparent;color:var(--km-text);cursor:pointer}
 .kv-mobile-more-links{display:grid;grid-template-columns:1fr 1fr;gap:5px;padding:10px}
 .kv-mobile-more-links a{display:flex;align-items:center;min-height:43px;padding:9px 10px;
  color:var(--km-text)!important;text-decoration:none!important;border-radius:8px;
  font-size:12px;font-weight:550;line-height:1.35;overflow-wrap:anywhere}
 .kv-mobile-more-links a:hover,.kv-mobile-more-links a[aria-current=page]{
  background:var(--km-selected);color:var(--km-accent)!important}
 .site-header .kv-notice-panel{max-width:min(380px,calc(100vw - 18px))}
 .site-main :is(input,select,textarea),.crm-main :is(input,select,textarea){
  max-width:100%;min-width:0
 }
 .kv-photo-dialog{max-width:100vw!important}
 .kv-photo-dialog-content,.kv-lightbox-side,.kv-lightbox-chat,.kv-comments-tree{
  min-width:0;max-width:100%;
 }
 .kv-comments-tree,.kv-comment-main{overflow-wrap:anywhere}
 .kv-comment .kv-comment{margin-left:5px!important;padding-left:6px!important}
 .kv-msg-bubble,.kv-msg-body,.kv-msg-file{overflow-wrap:anywhere;word-break:break-word}
}
@media(max-width:620px){
 body.is-community .kv-classic-columns{display:flex!important;flex-direction:column!important;gap:10px!important}
 body.is-community .kv-classic-left{display:flex!important;flex-direction:column!important;
  width:100%;min-width:0;gap:10px!important;align-items:stretch!important}
 body.is-community .kv-classic-avatar-card{width:100%;max-width:340px;margin-inline:auto}
 body.is-community .kv-classic-avatar-frame{max-width:320px;margin-inline:auto}
 body.is-community .kv-classic-content{width:100%;min-width:0}
 body.is-community .kv-classic-info-card{margin:0!important;width:100%}
 body.is-community .kv-vk-right{display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr));gap:8px!important}
 body.is-community .kv-classic-info-body dl{grid-template-columns:minmax(92px,37%) minmax(0,1fr);gap:7px 9px}
 body.is-community .kv-vk-wall,.kv-feed-stack,.kv-stage51-main{width:100%;min-width:0}
 .kv-settings-vk-grid,.kv-settings-pair,.crm-form .form-grid{
  grid-template-columns:minmax(0,1fr)!important}
 .kv-settings-vk-grid input,.kv-settings-vk-grid select,.kv-settings-vk-grid textarea{
  width:100%;max-width:100%}
 .kv-mobile-more-links{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
}
@media(max-width:390px){
 body.is-community .kv-vk-right{grid-template-columns:minmax(0,1fr)}
 .kv-mobile-more-links{grid-template-columns:1fr}
 .kv-mobile-bottom>a small,.kv-mobile-bottom>.kv-mobile-more>summary small{font-size:9px!important}
}
@media(hover:none){
 .kv-mobile-bottom a,.kv-mobile-more summary,.kv-mobile-more-links a{touch-action:manipulation}
}


/* Mobile messages: a dialog list OR a conversation, never squeezed side by side.
   Visual viewport units keep the composer within the screen while typing. */
@media(max-width:780px){
 body.is-community .kv-vk-messages-layout{display:block!important;width:100%;min-width:0}
 body.is-community .kv-vk-messages-layout .kv-vk-sidebar{display:none!important}
 body.is-community .kv-vk-messages-layout .kv-vk-main,
 body.is-community .kv-vk-messages-layout .kv-social{width:100%;min-width:0;margin:0!important}
 body.is-community .kv-vk-messages-layout .kv-msg-shell{
  display:flex!important;flex-direction:column!important;
  grid-template-columns:none!important;grid-template-rows:none!important;
  height:calc(100vh - 143px)!important;
  height:calc(100dvh - 143px)!important;
  min-height:0!important;max-height:none!important;
  overflow:hidden!important;border-radius:10px;
  background:var(--km-surface);border-color:var(--km-line);
 }
 body.is-community .kv-vk-messages-layout .kv-msg-shell.is-dialog-list .kv-msg-list{
  display:flex!important;flex-direction:column!important;
  flex:1 1 auto!important;min-height:0!important;max-height:none!important;
  overflow-x:hidden!important;overflow-y:auto!important;
  border:0!important;border-radius:0!important;
 }
 body.is-community .kv-vk-messages-layout .kv-msg-shell.is-dialog-list .kv-msg-conversation{
  display:none!important;
 }
 body.is-community .kv-vk-messages-layout .kv-msg-shell.is-chat-open .kv-msg-list{
  display:none!important;
 }
 body.is-community .kv-vk-messages-layout .kv-msg-shell.is-chat-open .kv-msg-conversation{
  display:flex!important;flex:1 1 auto!important;flex-direction:column!important;
  min-width:0!important;min-height:0!important;max-height:100%!important;
  overflow:hidden!important;
 }
 body.is-community .kv-vk-messages-layout .kv-msg-list-header{
  flex:0 0 auto;min-height:48px;padding:11px 14px;border-bottom:1px solid var(--km-line)
 }
 body.is-community .kv-vk-messages-layout .kv-msg-peer{
  display:flex;align-items:center;min-height:63px;max-width:100%;gap:11px;
  padding:10px 12px!important;border-bottom:1px solid var(--km-line);
 }
 body.is-community .kv-vk-messages-layout .kv-msg-peer img{
  flex:0 0 43px;width:43px;height:43px;
 }
 body.is-community .kv-vk-messages-layout .kv-msg-peer-text{min-width:0;flex:1}
 body.is-community .kv-vk-messages-layout .kv-msg-person{
  flex:0 0 auto!important;min-height:54px!important;max-width:100%;
  padding:6px 10px!important;gap:9px;
 }
 body.is-community .kv-vk-messages-layout .kv-msg-back{
  display:inline-flex!important;align-items:center;justify-content:center;
  flex:0 0 36px;min-width:36px;height:38px;
  color:var(--km-accent)!important;font-size:24px;
  text-decoration:none!important;border-radius:7px;
 }
 body.is-community .kv-vk-messages-layout .kv-msg-person img{
  width:36px;height:36px;flex:0 0 36px
 }
 body.is-community .kv-vk-messages-layout .kv-msg-person h2{
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
  font-size:14px;max-width:100%;
 }
 body.is-community .kv-vk-messages-layout .kv-msg-thread{
  display:flex;flex:1 1 auto!important;min-height:0!important;max-height:none!important;
  width:100%;padding:12px 9px!important;overflow-y:auto!important;
  overflow-x:hidden!important;overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
 }
 body.is-community .kv-vk-messages-layout .kv-msg-row{
  max-width:100%;min-width:0;
 }
 body.is-community .kv-vk-messages-layout .kv-msg-row .kv-msg-unit{
  max-width:min(82%,410px)!important;min-width:0;
 }
 body.is-community .kv-vk-messages-layout .kv-msg-row .kv-msg-unit .kv-msg-bubble{
  max-width:100%!important;min-width:0;
 }
 body.is-community .kv-vk-messages-layout .kv-msg-compose{
  position:relative;flex:0 0 auto!important;width:auto;max-width:100%;
  margin:7px!important;padding:4px 6px!important;gap:4px!important;
  min-height:38px;z-index:2;
 }
 body.is-community .kv-vk-messages-layout .kv-msg-compose textarea{
  min-width:0!important;width:auto;flex:1 1 auto;
  max-height:min(33dvh,190px)!important;font-size:16px!important;
 }
 body.is-community .kv-vk-messages-layout .kv-msg-reply-strip,
 body.is-community .kv-vk-messages-layout .kv-msg-selection-bar{
  flex:0 0 auto;max-width:100%;min-width:0;
 }
 body.is-community .kv-vk-messages-layout .kv-msg-emoji-picker{
  right:-36px;max-width:calc(100vw - 28px)
 }
 body.kv-mobile-keyboard .kv-mobile-bottom{display:none!important}
 body.kv-mobile-keyboard.is-community .kv-vk-messages-layout .kv-msg-shell{
  height:calc(var(--km-visible-height,100dvh) - 68px)!important;
 }
}
@media(max-width:365px){
 body.is-community .kv-vk-messages-layout .kv-msg-row .kv-msg-unit{
  max-width:82%!important
 }
 body.is-community .kv-vk-messages-layout .kv-msg-voice-player{
  min-width:0!important;max-width:100%!important;width:100%!important;
 }
 body.is-community .kv-vk-messages-layout .kv-record-wave-area{
  min-width:10px!important;
 }
}

/* Stage64: mobile photo viewer, public editorial sections and working cabinets. */
@media(max-width:780px){
 .crm-table-wrap{display:block;width:100%;max-width:100%;overflow-x:auto!important;
  overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch}
 .crm-table-wrap .crm-table{width:max-content;min-width:640px}
 body.is-crm .crm-shell,body.is-crm .crm-main{min-width:0;max-width:100%}
 body.is-crm .crm-panel,body.is-crm .crm-head{min-width:0;max-width:100%}
 body.is-crm .crm-panel :is(.stack-form,.form-grid){min-width:0;max-width:100%}
 body.is-crm .crm-panel :is(input:not([type=checkbox]),select,textarea){
  width:100%;max-width:100%;min-width:0
 }
 .event-list,.event-item{min-width:0;max-width:100%}
 .event-item :is(p,strong,small){overflow-wrap:anywhere}
 .v4-editorial,.v4-hero,.v4-guardian-hero,.v4-catalog-empty,
 .v4-help-row,.v4-animal-pair{min-width:0;max-width:100%}
 .v4-editorial-image img,.v4-hero-gallery img,.v4-guardian-gallery img{
  max-width:100%;object-fit:cover}
 .kv-album-grid,.kv-stage52-photo-grid{min-width:0;max-width:100%}
 .kv-photo-dialog{height:calc(100vh - env(safe-area-inset-top,0px))!important;
  height:calc(100dvh - env(safe-area-inset-top,0px))!important;
  max-height:100dvh!important;
  width:100vw!important;max-width:100vw!important;
  margin:0!important;border-radius:0!important}
 .kv-photo-dialog-content{height:100%!important;max-width:100%;
  display:flex!important;flex-direction:column!important}
 .kv-lightbox-photo-pane{
  flex:0 0 40vh!important;flex-basis:40dvh!important;
  min-height:0!important;max-height:45dvh!important;
  overflow:hidden!important;
 }
 .kv-lightbox-photo-pane img{width:auto!important;height:auto!important;
  max-width:100%!important;max-height:100%!important;object-fit:contain!important}
 .kv-lightbox-side{flex:1 1 auto!important;min-height:0!important;max-height:none;
  overflow:hidden!important}
 .kv-lightbox-chat{flex:1 1 auto;min-width:0;min-height:0;overflow:hidden!important}
 .kv-lightbox-chat .kv-post-comments{flex:1 1 auto;min-height:0}
 .kv-lightbox-chat .kv-comments-tree{
  flex:1 1 auto;min-height:0;max-width:100%;overflow-x:hidden!important;
  overflow-y:auto!important;overscroll-behavior:contain;-webkit-overflow-scrolling:touch
 }
 .kv-lightbox-chat :is(.kv-comment,.kv-comment-main,.kv-comment-compose){
  min-width:0;max-width:100%;
 }
 .kv-album-dialog{width:100vw!important;max-width:100vw!important;
  max-height:calc(100dvh - 10px)!important}
 .kv-album-dialog-stage img{object-fit:contain!important;max-width:100%;
  max-height:calc(100dvh - 95px)!important}
}
@media(max-width:620px){
 body.is-crm .crm-head{display:flex;flex-wrap:wrap;align-items:flex-start;gap:9px}
 body.is-crm .crm-head>.button{max-width:100%}
 body.is-crm .crm-search{display:flex;flex-wrap:wrap;gap:7px}
 body.is-crm .crm-search input{flex:1 1 200px;min-width:0}
 .kv-photo-dialog .kv-lightbox-photo-pane{flex-basis:35dvh!important;max-height:40dvh!important}
 .kv-lightbox-chat :is(textarea,input,select){max-width:100%;font-size:16px!important}
 .kv-lightbox-toolbar{flex-wrap:wrap;max-width:100%;gap:6px}
 .kv-lightbox-head,.kv-lightbox-author{min-width:0;overflow-wrap:anywhere}
 .kv-stage52-photo-grid,.kv-album-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
 .v4-hero-gallery,.v4-guardian-gallery{max-width:100%;overflow:hidden}
 .v4-empty-news,.v4-about-strip{min-width:0;max-width:100%}
 body.is-community .kv-settings-card :is(.kv-settings-form,.kv-settings-vk-form){min-width:0;max-width:100%}
 body.is-community .kv-stage51-main .event-item{
  padding:12px!important;overflow-wrap:anywhere;
 }
}
@media(max-width:360px){
 .kv-stage52-photo-grid,.kv-album-grid{gap:5px!important}
 .kv-lightbox-toolbar{padding:6px 8px!important}
 .v4-hero-copy h1,.v4-guardian-copy h1{font-size:23px!important}
}
