-- Migration 055: Enforce tab theme contract — override_theme_color requires a non-empty button_color_hex.
-- Clears invalid overrides so get_tab_config / Layer 2 / Layer 6 stay consistent (including older PHP without runtime normalization).
-- Safe to re-run.

UPDATE app_tabs
SET override_theme_color = 0
WHERE override_theme_color = 1
  AND (button_color_hex IS NULL OR TRIM(button_color_hex) = '');

UPDATE ftt_app_tabs
SET override_theme_color = 0
WHERE override_theme_color = 1
  AND (button_color_hex IS NULL OR TRIM(button_color_hex) = '');
