Three-dimensional quantum-optical input-output relations for arbitrary planar dielectrics