Remove top and bottom paddings from Conditional Form

<script>
    window.addEventListener('block-loaded-form1', () => {
	    const formDiv = document.querySelector('div[data-testid="form"]');
	    if (formDiv) {
            formDiv.style.minHeight = 'unset';
        }

    });
</script>

Replace form1 with your own form block id/name and add the code to Page Settings>Custom Code>Header