Write a SQL query to analyze production performance by line, shift, and day, including output, waste, and downtime metrics at Stouffers. Use completed production runs and the provided line and shift reference data.
Output
- One row per line, shift, and production day with valid reference matches.
- Columns:
line_name, shift_name, production_day, output_units, waste_units, downtime_minutes, and waste_percentage.
- Include totals for each combination, calculate waste as a percentage of output plus waste, and sort by line, shift, and day.