"Who was here at night?"
Translation:Хто був тут уночі?
Yes. The grammatical gender depends on the word. «Кто» is a masculine word, so you use masculine verb forms with it. Likewise, in «Що за люди́на була́ тут уночі́?» 'What kind of person was here at night?', you use feminine verb forms, because люди̂на 'person' is feminine.
It doesn't matter if the person is actually male or female, it just depends on the gender of the word.
Also, neuter gender is not normally used about people. If you do so, it would mean comparing the person to a thing, and this would be pretty offensive in most cases.
Yes, «яка» works too.
«Що за» means roughly the same thing as «який». It was borrowed from German «was für», so it doesn't make much sense in Ukrainian: usually, «за» is used with Instrumental or Accusative case, but «що за» is used with all the cases. You can't break this expression into two words because it was borrowed from another language.