Re Madrid: Assuming you take a nap or 2 in flight, would not need a hotel.
With 12 hours to spare, you can indeed go visit Madrid central. Budget 4.5 hours for transit to/from city center & check-in for your MAD-VCE flight. 7.5 hours in town should be plenty. As suggested up-post, take a tourist bus and cruise over the highlights. See an example:
http://www.madridvision.es/en/index.php
If you are adventurous, skip the taxi and take the metro from T4 (I think that's where BI might land) to Sol (just an example). Hop on the bus there.