For the 14 SPST toggle switches (OFF-ON), 3 SPDT (ON-OFF-ON) toggle switches, rocker switch (OFF-ON), and push button (OFF-(ON), i.e. momentary), I'd use a 4×6 matrix with diodes, using 10 pins, and 12 BAT54C Schottky diodes in SOT23-3 (a common cathode pair of diodes in each package).
For the...