## ADDED Requirements ### Requirement: User can switch between light and dark themes The system SHALL allow the user to toggle between light and dark themes with a persistent preference. #### Scenario: User toggles dark mode on - **WHEN** the user activates the theme toggle while the app is in light mode - **THEN** the system applies the dark theme and saves the preference for future visits #### Scenario: User toggles dark mode off - **WHEN** the user activates the theme toggle while the app is in dark mode - **THEN** the system applies the light theme and saves the preference for future visits ### Requirement: Theme preference respects system defaults on first visit The system SHALL use the user's system color scheme preference when no saved preference exists. #### Scenario: No stored preference uses system theme - **WHEN** the user opens the app for the first time without a saved theme preference - **THEN** the system applies dark mode when the operating system prefers dark color schemes and light mode otherwise ### Requirement: Theme selection loads without a flash of the wrong theme The system SHALL initialize the theme before the first visible paint so the page does not briefly render in the wrong theme. #### Scenario: Initial paint matches saved theme - **WHEN** the app loads and a saved theme preference exists - **THEN** the document theme is applied before the page content is visibly rendered