I think this could perhaps require lot more editing or rather some neat trick, because you can not apply border styles directly to thead nor tbody tags, nor cannot interleave table components with div's (that could be styled instead) What we still can do here is rounding these lines on top to not look that sharp at least.
<table name="{$sidebox['name']}" id="{$sidebox['id']}" style="table-layout: fixed; word-wrap: break-word; border-top: 0; border-radius: 3px;" cellspacing="0" cellpadding="{$theme['tablespace']}" class="border-nopadding tborder {$sidebox['class']}">