# Phase 3 Productivity Calculation Flow

1. Timer sessions are stored in `time_logs` with running/paused/stopped states.
2. On pause/stop, elapsed seconds are accumulated into `time_logs.total_seconds`.
3. Idle periods are recorded into `idle_logs` and linked to a time log.
4. Recalculation runs per user per day:
   - `tracked_seconds` = sum(`time_logs.total_seconds`)
   - `idle_seconds` = sum(`idle_logs.idle_seconds`)
   - `productive_seconds` = tracked - idle
   - `estimated_seconds` = estimated baseline from tracked tasks (current implementation: 1 hour per tracked task)
   - `actual_seconds` = tracked_seconds
   - `productivity_score` = (productive_seconds / actual_seconds) * 100
5. Daily summary persists in `daily_work_logs`.
6. Reporting snapshot persists in `productivity_logs`.
