/* MyEFB DEV — Graphite & Stone visual identity.
   Loaded after legacy CSS so the palette is centralised and reversible.
   Operational go/no-go, METAR freshness, alert, aircraft and procedure
   colours are intentionally not redefined. */
:root{
  /* User-selectable accent contract (picker will update these tokens). */
  --efb-theme-accent:#343a35;
  --efb-theme-accent-rgb:52,58,53;
  --efb-theme-accent-strong:#343a35;
  --efb-theme-accent-soft:#ebe9e3;
  --efb-theme-accent-contrast:#ffffff;
  --efb-page:#f2f0eb;
  --efb-surface:#ffffff;
  --efb-surface-raised:#ffffff;
  --efb-surface-subtle:#ebe9e3;
  --efb-surface-tonal:#d5d3cb;
  --efb-text:#292d29;
  --efb-muted:#626860;
  --efb-border:rgba(52,58,53,.17);
  --efb-hairline:rgba(52,58,53,.10);
  --efb-accent:var(--efb-theme-accent);
  --efb-action-primary:var(--efb-theme-accent-strong);
  --efb-home-hero:var(--efb-theme-accent-strong);
  --efb-focus-ring:var(--efb-theme-accent);
  --efb-focus:rgba(80,98,84,.32);
  --efb-glass:rgba(242,240,235,.88);
  --efb-glass-strong:rgba(255,255,255,.96);
  --efb-chrome-edge:rgba(52,58,53,.12);
  --efb-shadow-sm:0 1px 3px rgba(41,45,41,.06);
  --efb-shadow-md:0 4px 16px rgba(41,45,41,.08);
  --efb-shadow-float:0 12px 32px rgba(41,45,41,.16);
  --efb-chrome-shadow:0 2px 10px rgba(41,45,41,.06);
  --efb-footer-shadow:0 -2px 12px rgba(41,45,41,.06);
  --efb-button-primary-bg:var(--efb-action-primary);
  --efb-button-secondary-bg:var(--efb-surface-subtle);
  --efb-button-tertiary-fg:var(--efb-accent);
  --ui-page:var(--efb-page);
  --ui-surface:var(--efb-surface);
  --ui-surface-2:var(--efb-surface-subtle);
  --ui-border:var(--efb-border);
}
html[data-theme="light"]{background:#f2f0eb!important}
body.menuHeaderInstalled{
  --primary:#343a35;
  --primary-rgb:52,58,53;
  --secondary:#596258;
  --tertiary:#e5e4dd;
  --neutral:#626860;
  --neutral-bg:#ebe9e3;
  --page:var(--efb-page);
  --surface:var(--efb-surface);
  --surface-solid:var(--efb-surface-raised);
  --surface-2:var(--efb-surface-subtle);
  --text:var(--efb-text);
  --muted:var(--efb-muted);
  --border:var(--efb-border);
  --hairline:var(--efb-hairline);
  --efb-button-primary-bg:var(--efb-action-primary);
  --efb-button-secondary-bg:var(--efb-surface-subtle);
  --efb-button-tertiary-fg:var(--efb-accent);
}
/* Keep aircraft-specific accents when the aircraft identity is explicitly set. */
body.menuHeaderInstalled[data-aircraft="pa28"]{
  --primary:#765229;
  --primary-rgb:118,82,41;
}
body[data-theme="dark"]{
  --efb-theme-accent:#d3d9d0;
  --efb-theme-accent-rgb:211,217,208;
  --efb-theme-accent-strong:#626e63;
  --efb-theme-accent-soft:#323732;
  --efb-theme-accent-contrast:#ffffff;
  --efb-page:#171917;
  --efb-surface:#222522;
  --efb-surface-raised:#2a2e2a;
  --efb-surface-subtle:#323732;
  --efb-surface-tonal:#414741;
  --efb-text:#f0f0ec;
  --efb-muted:#b2b8b0;
  --efb-border:rgba(230,233,225,.17);
  --efb-hairline:rgba(230,233,225,.11);
  --efb-accent:var(--efb-theme-accent);
  --efb-action-primary:var(--efb-theme-accent-strong);
  --efb-home-hero:#343d35;
  --efb-focus-ring:#a7b6a8;
  --efb-focus:rgba(175,193,176,.36);
  --efb-glass:rgba(34,37,34,.9);
  --efb-glass-strong:rgba(42,46,42,.96);
  --efb-chrome-edge:rgba(230,233,225,.12);
  --efb-shadow-sm:0 1px 3px rgba(0,0,0,.25);
  --efb-shadow-md:0 4px 16px rgba(0,0,0,.3);
  --efb-shadow-float:0 12px 32px rgba(0,0,0,.4);
  --efb-chrome-shadow:0 2px 10px rgba(0,0,0,.22);
  --efb-footer-shadow:0 -2px 12px rgba(0,0,0,.22);
  --ui-page:var(--efb-page);
  --ui-surface:var(--efb-surface);
  --ui-surface-2:var(--efb-surface-subtle);
  --ui-border:var(--efb-border);
}
html[data-theme="dark"]{
  background:#171917!important;
  scrollbar-color:#70786f #171917!important;
}
html[data-theme="dark"]::-webkit-scrollbar-track{background:#171917!important}
html[data-theme="dark"]::-webkit-scrollbar-thumb{background:#70786f!important;border-color:#171917!important}
body.menuHeaderInstalled[data-theme="dark"]{
  --primary:#505e51;
  --primary-rgb:80,94,81;
  --secondary:#aeb8ad;
  --tertiary:#414741;
  --neutral:#b2b8b0;
  --neutral-bg:#323732;
}
body.menuHeaderInstalled[data-theme="dark"][data-aircraft="pa28"]{
  --primary:#c8a67b;
  --primary-rgb:200,166,123;
}
/* Primary actions use a dark-on-light, light-on-dark contrast pair.
   Scope excludes alert/decision actions with dedicated status styling. */
body.menuHeaderInstalled[data-theme="dark"]{
  --efb-button-primary-fg:#fff;
}
/* Non-operational accents formerly hard-coded blue in legacy layers. */
body.menuHeaderInstalled #calculatorView .phaseCard .phaseMeta .sourceBadge.forecast{
  background:color-mix(in srgb,var(--efb-accent) 9%,var(--efb-surface))!important;
  color:var(--efb-accent)!important;
}
body.menuHeaderInstalled #calculatorView .phaseCard .phaseIcon{
  background:color-mix(in srgb,var(--efb-accent) 8%,var(--efb-surface))!important;
  color:var(--efb-accent)!important;
}
body.menuHeaderInstalled[data-theme="dark"] #calculatorView .phaseCard .phaseIcon{
  background:color-mix(in srgb,var(--efb-accent) 13%,var(--efb-surface))!important;
  border-color:var(--efb-hairline)!important;
  color:var(--efb-accent)!important;
}
body.menuHeaderInstalled[data-theme="dark"][data-efb-app="settings"] #settingsView .settingsNav button,
body.menuHeaderInstalled[data-theme="dark"][data-efb-app="settings"] #settingsView :is(.choiceToggle,.timeModeToggle,.unitToggle,.routeModeToggle) > button:not(.active){
  color:var(--efb-text)!important;
  -webkit-text-fill-color:var(--efb-text)!important;
}
/* Explicitly preserve existing operational semantics:
   --good, --warn, --bad, --efb-status-*, --efb-metar-*,
   --efb-button-positive/warning/danger, data-decision, data-rag. */

/* DEV palette precedence fix: legacy design-system.css declares blue primary
   variables !important on all non-calculator screens. Override at equal priority. */
body.menuHeaderInstalled:not([data-efb-app="calculator"]){
  --primary:#343a35!important;
  --primary-rgb:52,58,53!important;
  --secondary:#596258!important;
  --tertiary:#e5e4dd!important;
}
body.menuHeaderInstalled[data-theme="dark"]:not([data-efb-app="calculator"]){
  --primary:#aeb8ad!important;
  --primary-rgb:174,184,173!important;
  --secondary:#89998a!important;
  --tertiary:#414741!important;
}
/* Neutralise the fixed blue dashboard icon, without changing decision states. */
body.menuHeaderInstalled .efbDashboardIcon{
  background:linear-gradient(145deg,#596258,#343a35)!important;
}

/* v163: explicitly set semantic palette on the actual body element.
   The earlier :root-only light palette lost to legacy body-scoped tokens. */
body[data-theme="light"]{
  --efb-page:#f2f0eb;
  --efb-surface:#ffffff;
  --efb-surface-raised:#ffffff;
  --efb-surface-subtle:#ebe9e3;
  --efb-surface-tonal:#d5d3cb;
  --efb-text:#292d29;
  --efb-muted:#626860;
  --efb-border:rgba(52,58,53,.17);
  --efb-hairline:rgba(52,58,53,.10);
  --efb-accent:#343a35;
  --efb-action-primary:#343a35;
  --efb-home-hero:#343a35;
  --efb-button-accent:#343a35;
  --ui-page:#f2f0eb;
  --ui-surface:#ffffff;
  --ui-surface-2:#ebe9e3;
  --ui-border:rgba(52,58,53,.17);
}
body[data-theme="dark"]{
  --efb-button-accent:#d3d9d0;
}
/* Dashboard and launcher graphics were assigned literal blue colours. */
body.menuHeaderInstalled .efbPerfCalcIcon{background:#596258!important}

/* v164 cross-screen audit: neutral selection, focus and authentication chrome.
   Keep checklist completed, deferred, abnormal and emergency status semantics. */
body.menuHeaderInstalled .checklistRunItem.current:not(.deferred){box-shadow:inset 3px 0 0 var(--efb-accent)!important}
body.menuHeaderInstalled .checklistRunItem.current .checklistItemStatus{background:var(--efb-accent)!important;border-color:var(--efb-accent)!important;color:var(--efb-surface)!important}
body.menuHeaderInstalled :is(.settingsNav button,.efbAppTile,.flightDashboardAction,.checklistNavAction):focus-visible{outline-color:var(--efb-focus-ring)!important}
body.menuHeaderInstalled :is(.efbSettingsStickyHeader,.efbDocumentsStickyHeader){border-color:var(--efb-hairline)!important}
/* Login and recovery views do not use menuHeaderInstalled. */
.authPage{
  --primary:#343a35!important;--secondary:#596258!important;--primary-rgb:52,58,53!important;
  --efb-page:#f2f0eb;--efb-surface-subtle:#ebe9e3;--efb-accent:#343a35;
}
.authPage :is(.authPrimary,.authBrandMark){background:#343a35!important;color:#fff!important}
.authPage :is(.authLink,.eyebrow,.authTabs button.active){color:#343a35!important}
.authPage .authForm input:focus{border-color:#596258!important;box-shadow:0 0 0 4px rgba(80,98,84,.16)!important}
@media(prefers-color-scheme:dark){
  .authPage{--primary:#aeb8ad!important;--secondary:#89998a!important;--primary-rgb:174,184,173!important;--efb-page:#171917;--efb-surface-subtle:#323732;--efb-accent:#d3d9d0}
  .authPage :is(.authLink,.eyebrow,.authTabs button.active){color:#d3d9d0!important}
  .authPage :is(.authPrimary,.authBrandMark){background:#626e63!important;color:#fff!important}
}

/* v165: second pass — remaining non-operational blue selection outlines.
   Exclude abnormal/emergency checklist rows to retain safety coding. */
body.menuHeaderInstalled .checklistRunItem.current:not(.deferred):not(.type-abnormal):not(.type-emergency){
  box-shadow:inset 3px 0 0 var(--efb-accent),0 0 0 1px var(--efb-accent)!important;
}
body.menuHeaderInstalled .checklistInfoRunDialog .checklistInfoSubitem.focused{
  box-shadow:inset 3px 0 0 var(--efb-accent),0 0 0 1px var(--efb-accent)!important;
}
/* Weather source forecast is informational, not an operational RAG decision. */
body.menuHeaderInstalled #calculatorView .phaseCard .phaseMeta .sourceBadge.forecast{
  background:color-mix(in srgb,var(--efb-accent) 10%,var(--efb-surface))!important;
  color:var(--efb-accent)!important;
}

/* v166: make the abnormal operational shortcut visually distinct from
   neutral Next Checklist navigation, in light and dark appearances. */
body.menuHeaderInstalled[data-efb-app="dashboard"] #dashboardView #dashboardAbnormalButton:not(:disabled){
  background:#9a620f!important;
  color:#fff!important;
  border:1px solid #9a620f!important;
  box-shadow:var(--efb-button-shadow-raised)!important;
}
body.menuHeaderInstalled[data-theme="dark"][data-efb-app="dashboard"] #dashboardView #dashboardAbnormalButton:not(:disabled){
  background:#c18a31!important;
  color:#171917!important;
  border-color:#c18a31!important;
}
body.menuHeaderInstalled[data-efb-app="dashboard"] #dashboardView #dashboardChecklistButton:not(:disabled){
  background:var(--efb-surface-subtle)!important;
  color:var(--efb-text)!important;
  border:1px solid var(--efb-hairline)!important;
  box-shadow:none!important;
}

/* v167: shared palette bridge for future picker, without user controls yet. */
body.menuHeaderInstalled:not([data-efb-app="calculator"]){
  --primary:var(--efb-theme-accent-strong)!important;
  --primary-rgb:var(--efb-theme-accent-rgb)!important;
}
body.menuHeaderInstalled .efbDashboardIcon{
  background:var(--efb-theme-accent-strong)!important;
  color:var(--efb-theme-accent-contrast)!important;
}
body.menuHeaderInstalled .efbPerfCalcIcon{background:var(--efb-theme-accent-strong)!important}

/* v168 Settings accent picker */
.efbThemePickerRow{align-items:flex-start!important;gap:14px!important}
.efbThemePickerControls{display:flex;flex-direction:column;align-items:flex-end;gap:10px;min-width:0}
.efbThemePresets{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:9px}
.efbThemePresets button{width:32px;height:32px;min-width:32px;border-radius:50%;border:2px solid var(--efb-surface);background:var(--efb-preset);box-shadow:0 0 0 1px var(--efb-border);cursor:pointer}
.efbThemePresets button[data-efb-accent="#343a35"]{--efb-preset:#343a35}
.efbThemePresets button[data-efb-accent="#245fa8"]{--efb-preset:#245fa8}
.efbThemePresets button[data-efb-accent="#287653"]{--efb-preset:#287653}
.efbThemePresets button[data-efb-accent="#7753a6"]{--efb-preset:#7753a6}
.efbThemePresets button[data-efb-accent="#a55d24"]{--efb-preset:#a55d24}
.efbThemePresets button[aria-pressed="true"]{outline:2px solid var(--efb-text);outline-offset:3px}
.efbCustomColourLabel{display:flex;align-items:center;gap:8px;color:var(--efb-text);font-size:13px}
.efbCustomColourLabel input{width:44px;height:34px;padding:2px;border:1px solid var(--efb-border);border-radius:9px;background:var(--efb-surface);cursor:pointer}
@media(max-width:600px){.efbThemePickerRow{flex-direction:column;align-items:stretch!important}.efbThemePickerControls{align-items:flex-start}.efbThemePresets{justify-content:flex-start}}

/* v169 — semantic accent application; keep status and alert colours fixed. */
body.menuHeaderInstalled{
  --efb-button-secondary-bg:var(--efb-theme-accent-soft);
  --efb-button-secondary-fg:var(--efb-theme-accent);
  --efb-home-icon-bg:var(--efb-theme-accent-soft);
}
body.menuHeaderInstalled :is(.efbDashboardIcon,.efbPerfCalcIcon){
  background:var(--efb-theme-accent-strong)!important;
  color:var(--efb-theme-accent-contrast)!important;
}
body.menuHeaderInstalled .flightDashboardAction.checklist:not(:disabled){
  background:var(--efb-theme-accent-soft)!important;
  color:var(--efb-theme-accent)!important;
}
body.menuHeaderInstalled[data-efb-app="dashboard"] #dashboardView #dashboardChecklistButton:not(:disabled){
  background:var(--efb-theme-accent-soft)!important;
  color:var(--efb-theme-accent)!important;
}
body.menuHeaderInstalled .checklistRunItem.current:not(.deferred):not(.type-abnormal):not(.type-emergency){
  box-shadow:inset 3px 0 0 var(--efb-theme-accent),0 0 0 1px var(--efb-theme-accent)!important;
}
body.menuHeaderInstalled .checklistInfoRunDialog .checklistInfoSubitem.focused{
  box-shadow:inset 3px 0 0 var(--efb-theme-accent),0 0 0 1px var(--efb-theme-accent)!important;
}

/* v170: accessible interactive states for both appearance modes. */
body.menuHeaderInstalled :is(.efbThemePresets button,.efbCustomColourLabel input,#efbResetAccent):focus-visible{
  outline:3px solid var(--efb-theme-accent)!important;
  outline-offset:4px!important;
}
body.menuHeaderInstalled .efbThemePresets button[aria-pressed="true"]{
  outline:2px solid var(--efb-text)!important;
  outline-offset:3px!important;
}
body.menuHeaderInstalled :is(.efbDashboardIcon,.efbPerfCalcIcon){
  color:var(--efb-theme-accent-contrast)!important;
}
body.menuHeaderInstalled[data-theme="dark"] .flightDashboardAction.checklist:not(:disabled),
body.menuHeaderInstalled[data-theme="dark"][data-efb-app="dashboard"] #dashboardView #dashboardChecklistButton:not(:disabled){
  border-color:var(--efb-border)!important;
}
@media(prefers-reduced-motion:reduce){
  .efbThemePresets button,.efbCustomColourLabel input{transition:none!important}
}

/* v172: reinforce semantic accent on ordinary navigation without overriding alerts. */
body.menuHeaderInstalled :is(.settingsNav button.active,.settingsNav button[aria-selected="true"],.efbAppTile[aria-current="page"]){
  border-color:var(--efb-theme-accent)!important;
}
body.menuHeaderInstalled :is(.settingsNav button.active,.settingsNav button[aria-selected="true"]){
  color:var(--efb-theme-accent)!important;
}
body.menuHeaderInstalled :is(input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),select,textarea):focus-visible{
  outline-color:var(--efb-theme-accent)!important;
}
