I am attaching an ASP.NET Core solution, where you can find a simple PanelBar implementation. With it, the PanelBar is rendered correctly and there is no white space in the head of the panels.
I assume that the issue in your case is related to custom styling of the page. Therefore, I would suggest you to strip down additional stylesheets in order to be able to locate the origins of the issue.