Write a SQL query using window functions to calculate monthly throughput trends and rank manufacturing lines by error rate.