/* Khalid Networks v12.13 — final staff editor scroll + profile image consistency */

/* The staff profile dialog has a fixed header/footer and one independently scrolling body. */
#work-dialog.staff-profile-dialog{
  height:min(900px,92vh)!important;
  max-height:92vh!important;
}
#work-dialog.staff-profile-dialog #work-form{
  height:100%!important;
  max-height:none!important;
  display:grid!important;
  grid-template-rows:auto minmax(0,1fr) auto auto!important;
  overflow:hidden!important;
}
#work-dialog.staff-profile-dialog .work-dialog-titlebar{
  grid-row:1!important;
}
#work-dialog.staff-profile-dialog #work-fields{
  grid-row:2!important;
  min-height:0!important;
  height:auto!important;
  overflow:hidden!important;
}
#work-dialog.staff-profile-dialog #work-fields>.kn-staff-editor{
  height:100%!important;
  min-height:0!important;
  max-height:100%!important;
  overflow:hidden!important;
  align-items:stretch!important;
}
#work-dialog.staff-profile-dialog aside.kn-staff-tabs{
  position:sticky!important;
  top:0!important;
  height:100%!important;
  min-height:0!important;
  max-height:100%!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
}
#work-dialog.staff-profile-dialog .kn-staff-editor-main{
  height:100%!important;
  min-height:0!important;
  max-height:100%!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  overscroll-behavior:contain!important;
  scroll-behavior:smooth!important;
  scrollbar-gutter:stable!important;
}
#work-dialog.staff-profile-dialog #work-error{
  grid-row:3!important;
  margin:0!important;
  padding:0 16px!important;
}
#work-dialog.staff-profile-dialog #work-form>.toolbar{
  grid-row:4!important;
  margin:0!important;
  position:relative!important;
}
#work-dialog.staff-profile-dialog .kn-editor-card{
  scroll-margin-top:14px!important;
}

/* Small screens: tabs stay visible above the independently scrolling editor. */
@media (max-width:900px){
  #work-dialog.staff-profile-dialog #work-fields>.kn-staff-editor{
    display:grid!important;
    grid-template-columns:1fr!important;
    grid-template-rows:auto minmax(0,1fr)!important;
  }
  #work-dialog.staff-profile-dialog aside.kn-staff-tabs{
    height:auto!important;
    max-height:none!important;
    position:sticky!important;
    top:0!important;
    display:flex!important;
    flex-direction:row!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    white-space:nowrap!important;
    border-right:0!important;
    border-bottom:1px solid #e5eaf3!important;
    z-index:40!important;
  }
  #work-dialog.staff-profile-dialog aside.kn-staff-tabs button{
    flex:0 0 auto!important;
    width:auto!important;
    min-width:max-content!important;
  }
  #work-dialog.staff-profile-dialog .kn-staff-editor-main{
    height:100%!important;
    min-height:0!important;
    overflow-y:auto!important;
  }
}

/* Admin profile image must render consistently on every admin page/view, not only Dashboard. */
.admin-chip .avatar.has-photo,
#admin-avatar.has-photo{
  background-size:cover!important;
  background-position:center!important;
  background-repeat:no-repeat!important;
  color:transparent!important;
  overflow:hidden!important;
}
.admin-chip .avatar{
  flex:0 0 auto!important;
}

/* Uploaded staff photos use the same crop/fit everywhere. */
.staff-photo-img,
.person-avatar img,
.kn-staff-avatar img,
.staff-hero-avatar img,
.staff-profile-photo img{
  width:100%!important;
  height:100%!important;
  object-fit:cover!important;
  object-position:center!important;
  display:block!important;
}
