See the first paragraph in
https://www.qubes-os.org/doc/usb/ and the link
there.
If you want to try again once you get keyboard and mouse back, you can
manually create a sys-usb qube by carefully following the documentation on
that page under "Alternatively, you can create a USB qube manually as
follows:". It's for 3.2 but at first glance should work for 4.0 too.
Figure out which USB controller handles your keyboard and mouse and DO NOT
assign that one to sys-usb, but assign all the rest.
Blacklisting the controllers is an optional next step.