/*!
 * UI5 bridge — re-skins OpenUI5's sap_horizon(_dark) theme with Proven tokens.
 *
 * Horizon is built on CSS custom properties (--sapButton_Background, --sapField_BorderColor …),
 * and every control's CSS reads them through var(). Overriding those properties here changes
 * every UI5 control at once, without compiling a custom theme.
 *
 * Selector is `html:root` (specificity 0,1,1) so it beats the theme's own `:root` declarations
 * (0,1,0) regardless of load order — UI5 injects its theme <link>s after ours at runtime.
 *
 * Only map to --pv-* tokens here. If a value can't be expressed with a token, add a token.
 */

html:root {
  /* ---- Foundation ------------------------------------------------------------ */
  --sapBrandColor: var(--pv-accent);
  --sapHighlightColor: var(--pv-accent);
  --sapBaseColor: var(--pv-surface);
  --sapShellColor: var(--pv-surface);
  --sapBackgroundColor: var(--pv-bg);
  --sapTextColor: var(--pv-text);
  --sapTitleColor: var(--pv-text);
  --sapLinkColor: var(--pv-accent);
  --sapLink_Hover_Color: var(--pv-accent-hover);
  --sapLink_Active_Color: var(--pv-accent-active);
  --sapSelectedColor: var(--pv-accent);
  --sapActiveColor: var(--pv-accent-active);
  --sapHoverColor: var(--pv-surface-2);

  /* The "72" typeface is the most recognisable part of Fiori — replace it. */
  --sapFontFamily: var(--pv-font);
  --sapFontBoldFamily: var(--pv-font);
  --sapFontSemiboldFamily: var(--pv-font);
  --sapFontSemiboldDuplexFamily: var(--pv-font);
  --sapFontLightFamily: var(--pv-font);
  --sapFontHeaderFamily: var(--pv-font);
  --sapFontSize: var(--pv-fs-base);
  --sapFontSmallSize: var(--pv-fs-sm);
  --sapFontLargeSize: var(--pv-fs-lg);
  --sapFontHeader1Size: var(--pv-fs-3xl);
  --sapFontHeader2Size: var(--pv-fs-2xl);
  --sapFontHeader3Size: var(--pv-fs-xl);
  --sapFontHeader4Size: var(--pv-fs-lg);
  --sapFontHeader5Size: var(--pv-fs-base);
  --sapFontHeader6Size: var(--pv-fs-md);
  --sapButton_FontFamily: var(--pv-font);
  --sapButton_Emphasized_FontFamily: var(--pv-font);
  --sapField_FontFamily: var(--pv-font);

  /* ---- Content -------------------------------------------------------------- */
  --sapContent_LabelColor: var(--pv-text-muted);
  --sapContent_IconColor: var(--pv-text-muted);
  --sapContent_NonInteractiveIconColor: var(--pv-text-faint);
  --sapContent_FocusColor: var(--pv-accent);
  --sapContent_FocusWidth: 2px;
  --sapContent_ForegroundBorderColor: var(--pv-border-strong);
  --sapContent_ImagePlaceholderBackground: var(--pv-surface-3);
  --sapContent_ImagePlaceholderForegroundColor: var(--pv-text-muted);
  --sapContent_HeaderShadow: inset 0 -1px 0 0 var(--pv-border);
  --sapContent_Shadow0: var(--pv-shadow-1);
  --sapContent_Shadow1: var(--pv-shadow-2);
  --sapContent_Shadow2: var(--pv-shadow-pop);
  --sapContent_Shadow3: var(--pv-shadow-pop);
  --sapContent_ContrastTextColor: var(--pv-text-on-accent);

  /* ---- Semantic colours ------------------------------------------------------- */
  --sapPositiveColor: var(--pv-ok);
  --sapPositiveTextColor: var(--pv-ok);
  --sapPositiveElementColor: var(--pv-ok);
  --sapSuccessColor: var(--pv-ok);
  --sapSuccessBackground: var(--pv-ok-soft);
  --sapNegativeColor: var(--pv-danger);
  --sapNegativeTextColor: var(--pv-danger);
  --sapNegativeElementColor: var(--pv-danger);
  --sapErrorColor: var(--pv-danger);
  --sapErrorBackground: var(--pv-danger-soft);
  --sapCriticalColor: var(--pv-warn);
  --sapCriticalTextColor: var(--pv-warn);
  --sapCriticalElementColor: var(--pv-warn);
  --sapWarningColor: var(--pv-warn);
  --sapWarningBackground: var(--pv-warn-soft);
  --sapSuccessBorderColor: var(--pv-ok);
  --sapErrorBorderColor: var(--pv-danger);
  --sapWarningBorderColor: var(--pv-warn);
  --sapNeutralColor: var(--pv-text-muted);
  --sapNeutralBackground: var(--pv-surface-2);
  --sapNeutralBorderColor: var(--pv-border-strong);
  --sapInformationColor: var(--pv-info);
  --sapInformationBackground: var(--pv-info-soft);
  --sapInformationBorderColor: var(--pv-info);

  /* ---- Shape: Proven is squarer and flatter than Horizon ------------------------- */
  --sapElement_BorderCornerRadius: var(--pv-radius);
  --sapElement_Height: var(--pv-control-h);
  /* Desktop runs in UI5's compact density (shared/boot.js) — the tool-like feel of the reference. */
  --sapElement_Compact_Height: var(--pv-control-h-compact);
  --sapElement_Compact_LineHeight: var(--pv-control-h);
  --sapButton_BorderCornerRadius: var(--pv-radius);
  --sapField_BorderCornerRadius: var(--pv-radius);
  --sapPopover_BorderCornerRadius: var(--pv-radius-lg);
  --sapTile_BorderCornerRadius: var(--pv-radius-lg);
  --sapGroup_BorderCornerRadius: var(--pv-radius-lg);

  /* ---- Shell / header ----------------------------------------------------------- */
  --sapShell_Background: var(--pv-surface);
  --sapShell_BackgroundImage: none;
  --sapShell_BorderColor: var(--pv-border);
  --sapShell_TextColor: var(--pv-text);
  --sapShell_InteractiveBackground: var(--pv-surface);
  --sapShell_InteractiveTextColor: var(--pv-text);
  --sapShell_Hover_Background: var(--pv-surface-2);
  --sapShell_Active_Background: var(--pv-surface-3);
  --sapShell_Active_TextColor: var(--pv-accent);
  --sapShell_Selected_Background: var(--pv-accent-soft);
  --sapShell_Selected_TextColor: var(--pv-accent);
  --sapShell_Shadow: inset 0 -1px 0 0 var(--pv-border);
  --sapShell_Navigation_Background: var(--pv-surface);
  --sapShell_Navigation_SelectedColor: var(--pv-accent);
  --sapShell_Navigation_Selected_TextColor: var(--pv-accent);
  --sapShell_Navigation_TextColor: var(--pv-text);
  --sapPageHeader_Background: var(--pv-surface);
  --sapPageHeader_BorderColor: var(--pv-border);
  --sapPageHeader_TextColor: var(--pv-text);
  --sapPageFooter_Background: var(--pv-surface);
  --sapPageFooter_BorderColor: var(--pv-border);
  --sapPageFooter_TextColor: var(--pv-text);
  --sapObjectHeader_Background: var(--pv-surface);
  --sapObjectHeader_BorderColor: var(--pv-border);
  --sapToolbar_Background: var(--pv-surface);
  --sapToolbar_SeparatorColor: var(--pv-border);
  --sapInfobar_Background: var(--pv-accent-soft);
  --sapInfobar_TextColor: var(--pv-text);

  /* ---- Buttons ---------------------------------------------------------------------- */
  --sapButton_Background: var(--pv-surface);
  --sapButton_BorderColor: var(--pv-border-strong);
  --sapButton_BorderWidth: 1px;
  --sapButton_TextColor: var(--pv-text);
  --sapButton_IconColor: var(--pv-text-muted);
  --sapButton_Hover_Background: var(--pv-surface-2);
  --sapButton_Hover_BorderColor: var(--pv-border-strong);
  --sapButton_Hover_TextColor: var(--pv-text);
  --sapButton_Active_Background: var(--pv-surface-3);
  --sapButton_Active_BorderColor: var(--pv-border-strong);
  --sapButton_Active_TextColor: var(--pv-text);
  --sapButton_Emphasized_Background: var(--pv-accent);
  --sapButton_Emphasized_BorderColor: var(--pv-accent);
  --sapButton_Emphasized_TextColor: var(--pv-text-on-accent);
  --sapButton_Emphasized_Hover_Background: var(--pv-accent-hover);
  --sapButton_Emphasized_Hover_BorderColor: var(--pv-accent-hover);
  --sapButton_Emphasized_Hover_TextColor: var(--pv-text-on-accent);
  --sapButton_Emphasized_Active_Background: var(--pv-accent-active);
  --sapButton_Emphasized_Active_BorderColor: var(--pv-accent-active);
  --sapButton_Emphasized_Active_TextColor: var(--pv-text-on-accent);
  --sapButton_Lite_Background: transparent;
  --sapButton_Lite_BorderColor: transparent;
  --sapButton_Lite_TextColor: var(--pv-text);
  --sapButton_Lite_Hover_Background: var(--pv-surface-2);
  --sapButton_Lite_Hover_BorderColor: transparent;
  --sapButton_Lite_Hover_TextColor: var(--pv-text);
  --sapButton_Lite_Active_Background: var(--pv-surface-3);
  --sapButton_Lite_Active_BorderColor: transparent;
  --sapButton_Selected_Background: var(--pv-accent-soft);
  --sapButton_Selected_BorderColor: var(--pv-accent);
  --sapButton_Selected_TextColor: var(--pv-accent);
  --sapButton_Selected_Hover_Background: var(--pv-accent-soft-2);
  --sapButton_Selected_Hover_BorderColor: var(--pv-accent);
  --sapButton_Reject_Background: var(--pv-surface);
  --sapButton_Reject_BorderColor: var(--pv-danger);
  --sapButton_Reject_TextColor: var(--pv-danger);
  --sapButton_Reject_Hover_Background: var(--pv-danger-soft);
  --sapButton_Reject_Hover_BorderColor: var(--pv-danger);
  --sapButton_Reject_Hover_TextColor: var(--pv-danger);
  --sapButton_Accept_Background: var(--pv-surface);
  --sapButton_Accept_BorderColor: var(--pv-ok);
  --sapButton_Accept_TextColor: var(--pv-ok);
  --sapButton_Accept_Hover_Background: var(--pv-ok-soft);
  --sapButton_Accept_Hover_BorderColor: var(--pv-ok);
  --sapButton_Accept_Hover_TextColor: var(--pv-ok);
  --sapButton_Attention_Background: var(--pv-surface);
  --sapButton_Attention_BorderColor: var(--pv-warn);
  --sapButton_Attention_TextColor: var(--pv-warn);

  /* ---- Fields: full 1px box (Horizon uses an underline style) ------------------------- */
  --sapField_Background: var(--pv-surface);
  --sapField_BackgroundStyle: none;
  --sapField_TextColor: var(--pv-text);
  --sapField_PlaceholderTextColor: var(--pv-text-faint);
  --sapField_BorderColor: var(--pv-border-strong);
  --sapField_BorderWidth: 1px;
  --sapField_BorderStyle: solid;
  --sapField_Shadow: none;
  --sapField_HelpBackground: var(--pv-surface);
  --sapField_Hover_Background: var(--pv-surface);
  --sapField_Hover_BackgroundStyle: none;
  --sapField_Hover_BorderColor: var(--pv-text-faint);
  --sapField_Hover_Shadow: none;
  --sapField_Hover_HelpBackground: var(--pv-surface);
  --sapField_Focus_Background: var(--pv-surface);
  --sapField_Focus_BorderColor: var(--pv-accent);
  --sapField_Active_BorderColor: var(--pv-accent); /* the focused field's ring (UI5 draws it from this) */
  --sapField_Focus_HelpBackground: var(--pv-surface);
  --sapField_ReadOnly_Background: var(--pv-surface-2);
  --sapField_ReadOnly_BackgroundStyle: none;
  --sapField_ReadOnly_BorderColor: var(--pv-border);
  --sapField_ReadOnly_BorderStyle: solid;
  --sapField_ReadOnly_HelpBackground: var(--pv-surface-2);
  --sapField_RequiredColor: var(--pv-danger);
  --sapField_InvalidColor: var(--pv-danger);
  --sapField_InvalidBackground: var(--pv-surface);
  --sapField_InvalidBackgroundStyle: none;
  --sapField_InvalidBorderWidth: 1px;
  --sapField_InvalidBorderStyle: solid;
  --sapField_InvalidShadow: 0 0 0 3px var(--pv-danger-soft);
  --sapField_WarningColor: var(--pv-warn);
  --sapField_WarningBackground: var(--pv-surface);
  --sapField_WarningBackgroundStyle: none;
  --sapField_WarningBorderWidth: 1px;
  --sapField_WarningBorderStyle: solid;
  --sapField_WarningShadow: 0 0 0 3px var(--pv-warn-soft);
  --sapField_SuccessColor: var(--pv-ok);
  --sapField_SuccessBackground: var(--pv-surface);
  --sapField_SuccessBackgroundStyle: none;
  --sapField_SuccessBorderStyle: solid;
  --sapField_SuccessShadow: none;
  --sapField_InformationColor: var(--pv-info);
  --sapField_InformationBackground: var(--pv-surface);
  --sapField_InformationBackgroundStyle: none;
  --sapField_InformationBorderWidth: 1px;
  --sapField_InformationBorderStyle: solid;
  --sapField_InformationShadow: none;
  --sapField_Picker_BorderColor: var(--pv-border-strong);
  --sapField_Selector_BorderStyle: solid;

  /* ---- Lists, tables, groups -------------------------------------------------------------- */
  --sapList_Background: var(--pv-surface);
  --sapList_HeaderBackground: var(--pv-surface-2);
  --sapList_HeaderBorderColor: var(--pv-border);
  --sapList_HeaderTextColor: var(--pv-text-muted);
  --sapList_BorderColor: var(--pv-border);
  --sapList_TextColor: var(--pv-text);
  --sapList_Hover_Background: var(--pv-surface-2);
  --sapList_Active_Background: var(--pv-surface-3);
  --sapList_Active_TextColor: var(--pv-text);
  --sapList_SelectionBackgroundColor: var(--pv-accent-soft);
  --sapList_SelectionBorderColor: var(--pv-accent);
  --sapList_Hover_SelectionBackground: var(--pv-accent-soft-2);
  --sapList_AlternatingBackground: var(--pv-surface-2);
  --sapList_GroupHeaderBackground: var(--pv-surface-2);
  --sapList_GroupHeaderBorderColor: var(--pv-border);
  --sapList_GroupHeaderTextColor: var(--pv-text-muted);
  --sapList_TableGroupHeaderBackground: var(--pv-surface-2);
  --sapList_TableGroupHeaderBorderColor: var(--pv-border);
  --sapList_TableGroupHeaderTextColor: var(--pv-text-muted);
  --sapList_FooterBackground: var(--pv-surface-2);
  --sapList_FooterTextColor: var(--pv-text-muted);
  --sapGroup_TitleBackground: var(--pv-surface);
  --sapGroup_TitleBorderColor: var(--pv-border);
  --sapGroup_TitleTextColor: var(--pv-text);
  --sapGroup_ContentBackground: var(--pv-surface);
  --sapGroup_ContentBorderColor: var(--pv-border);
  --sapGroup_ContentAlternatingBackground: var(--pv-surface-2);
  --sapTile_Background: var(--pv-surface);
  --sapTile_BorderColor: var(--pv-border);
  --sapTile_Hover_Background: var(--pv-surface-2);

  /* ---- Scrollbars -------------------------------------------------------------------------- */
  --sapScrollBar_FaceColor: var(--pv-border-strong);
  --sapScrollBar_TrackColor: transparent;
  --sapScrollBar_Hover_FaceColor: var(--pv-text-faint);
}
