/* Shared UI palette. Saved artwork, pitch markings and export palettes are independent. */
html[data-mfe-theme="light"],html[data-mfe-theme="light"] body{
 --bg:#dce2e7!important;--bg2:#e5e9ed!important;--panel:#e9edf0!important;
 --text:#182630!important;--muted:#485967!important;--line:rgba(24,38,48,.16)!important;
 --accent:#08733a!important;--accent-dark:#065c2e!important;
 --mfe-surface-plain:#e4e9ed!important;--mfe-surface-soft:#edf0f3!important;
 --mfe-card-bg:linear-gradient(180deg,#edf0f3,#e4e9ed)!important;
 --mfe-card-bg-strong:linear-gradient(180deg,#f0f2f4,#e3e8ec)!important;
 --mfe-input-bg:#f0f2f4!important;--mfe-input-border:rgba(24,38,48,.22)!important;
 --mfe-accent-rgb:8,115,58!important;--mfe-accent-text:#064c29!important;
 --mfe-accent-bg:rgba(8,115,58,.10)!important;--mfe-accent-bg-strong:rgba(8,115,58,.16)!important;
 --mfe-accent-border:rgba(8,115,58,.38)!important;
 --mf-shell-surface-start:#e9edf0!important;--mf-shell-surface-end:#dfe5ea!important;
 --mf-shell-item-bg:#e4e9ed!important;--mf-shell-action-bg:#e4e9ed!important;
 --mf-shell-text:#182630!important;--mf-shell-muted:#485967!important;
 --mf-shell-accent:#08733a!important;--mf-shell-accent-dark:#065c2e!important;--mf-shell-accent-rgb:8,115,58!important;
 --mfa-dialog-bg:linear-gradient(180deg,#edf0f3,#e4e9ed)!important;
 --mfa-dialog-input:linear-gradient(180deg,#f0f2f4,#e9edf0)!important;
 --mfa-dialog-text:#182630!important;--mfa-dialog-title:#182630!important;--mfa-dialog-muted:#485967!important;
 --mfa-dialog-accent:#08733a!important;--mfa-dialog-dark:#065c2e!important;--mfa-dialog-rgb:8,115,58!important;
 --surface:#e4e9ed!important;--surface-strong:#edf0f3!important;
}
html[data-mfe-theme="light"] body{background:linear-gradient(145deg,var(--bg),var(--bg2))!important;}
html[data-mfe-theme="light"] body :is(.app-loading-overlay,.mfa-space-loading){background:rgba(220,226,231,.96)!important;}
html[data-mfe-theme="light"] body :is(.player-auth-card,.player-hero,.player-panel){background:var(--mfe-card-bg)!important;}
html[data-mfe-theme="light"] body .theme-swatch.light{background:linear-gradient(135deg,#dce2e7 0%,#edf0f3 55%,#08733a 56%,#cfe1d5 100%)!important;}
/* Loading headings previously retained a fixed white text colour in light mode. */
html[data-mfe-theme="gray"] body :is(.app-loading-card,.gps-page-loader-card){background:var(--panel)!important;}
html[data-mfe-theme] body :is(.app-loading-card,.gps-page-loader-card) :is(.app-loading-title,.app-loading-subtitle,.loading-title,.gps-page-loader-title){color:var(--text,#eef3f9)!important;}
html[data-mfe-theme] body :is(.app-loading-card,.gps-page-loader-card) :is(.app-loading-copy,.app-loading-foot,.loading-subtitle,.gps-page-loader-copy){color:var(--muted,#9cb0c7)!important;}
html[data-mfe-theme] body :is(.app-loading-card,.gps-page-loader-card) :is(.app-loading-status,.app-loading-progress-label,.app-loading-percent,.app-loading-badge,.loading-percent){color:var(--text,#eef3f9)!important;}
html[data-mfe-theme="light"] body :is(.app-loading-card,.gps-page-loader-card) :is(.app-loading-status,.app-loading-percent,.app-loading-badge,.loading-percent){color:var(--accent)!important;}

/* R73: Dark is the existing saved `gray` theme. UI only; artwork/export colours stay independent. */
html[data-mfe-theme="gray"],html[data-mfe-theme="gray"] body{
 color-scheme:dark!important;
 --bg:var(--mfe-ui-bg,#111315)!important;--bg2:var(--mfe-ui-bg2,#1d2024)!important;--bg3:var(--mfe-ui-bg3,#0c0e10)!important;--bg-soft:var(--mfe-ui-surface,#20242a)!important;
 --panel:var(--mfe-ui-panel,#171a1f)!important;--panel2:var(--mfe-ui-surface,#20242a)!important;--panel-soft:var(--mfe-ui-surface,#20242a)!important;--panel-strong:var(--mfe-ui-surface2,#24282e)!important;
 --text:var(--mfe-ui-text,#f3f4f6)!important;--muted:var(--mfe-ui-muted,#c1c6ce)!important;--muted-strong:var(--mfe-ui-primary,#d1d5db)!important;
 --line:rgba(var(--mfe-ui-text-rgb,229,231,235),.15)!important;--border:rgba(var(--mfe-ui-text-rgb,229,231,235),.20)!important;--border-soft:rgba(var(--mfe-ui-text-rgb,229,231,235),.12)!important;
 --accent:var(--mfe-ui-primary,#d1d5db)!important;--accent-dark:var(--mfe-ui-primary-dark,#9ca3af)!important;--accent-blue:var(--mfe-ui-primary,#d1d5db)!important;--accent-rgb:var(--mfe-ui-primary-rgb,209,213,219)!important;--accent-soft:rgba(var(--mfe-ui-primary-rgb,209,213,219),.12)!important;
 --accent-copy:var(--mfe-ui-text,#e5e7eb)!important;--accent-copy-strong:var(--mfe-ui-title,#f8fafc)!important;--shadow:0 18px 42px rgba(0,0,0,.38)!important;
 --surface:var(--mfe-ui-surface,#20242a)!important;--surface-strong:var(--mfe-ui-surface2,#24282e)!important;--surface-1:rgba(var(--mfe-ui-text-rgb,255,255,255),.04)!important;--surface-2:rgba(var(--mfe-ui-text-rgb,255,255,255),.03)!important;--surface-3:rgba(var(--mfe-ui-text-rgb,255,255,255),.025)!important;--surface-metric:rgba(var(--mfe-ui-text-rgb,255,255,255),.035)!important;--surface-hover:rgba(var(--mfe-ui-text-rgb,255,255,255),.075)!important;
 --border-strong:rgba(var(--mfe-ui-text-rgb,229,231,235),.24)!important;--border-mid:rgba(var(--mfe-ui-text-rgb,229,231,235),.16)!important;--border-faint:rgba(var(--mfe-ui-text-rgb,229,231,235),.09)!important;--border-subtle:rgba(var(--mfe-ui-text-rgb,229,231,235),.13)!important;
 --copy:var(--mfe-ui-text,#e2e5e9)!important;--copy-soft:var(--mfe-ui-primary,#d1d5db)!important;--heading-text:var(--mfe-ui-text,#f3f4f6)!important;--day-number:var(--mfe-ui-text,#e5e7eb)!important;--list-text:var(--mfe-ui-text,#e2e5e9)!important;--observation-text:var(--mfe-ui-primary,#d1d5db)!important;
 --modal-surface:linear-gradient(180deg,var(--mfe-ui-surface,#20242a),var(--mfe-ui-panel,#171a1f))!important;--option-surface:var(--mfe-ui-input,#262b32)!important;--overlay:rgba(0,0,0,.72)!important;
 --mfe-surface-plain:var(--mfe-ui-surface,#20242a)!important;--mfe-surface-soft:var(--mfe-ui-surface2,#24282e)!important;--mfe-card-bg:linear-gradient(180deg,var(--mfe-ui-surface2,#24282e),var(--mfe-ui-panel,#1b1e23))!important;--mfe-card-bg-strong:linear-gradient(180deg,var(--mfe-ui-button,#2a2f36),var(--mfe-ui-surface,#20242a))!important;
 --mfe-input-bg:var(--mfe-ui-input,#262b32)!important;--mfe-input-border:rgba(var(--mfe-ui-text-rgb,229,231,235),.25)!important;
 --mfe-accent-rgb:var(--mfe-ui-primary-rgb,209,213,219)!important;--mfe-accent-bg:rgba(var(--mfe-ui-primary-rgb,209,213,219),.12)!important;--mfe-accent-bg-strong:rgba(var(--mfe-ui-primary-rgb,209,213,219),.22)!important;--mfe-accent-border:rgba(var(--mfe-ui-primary-rgb,209,213,219),.40)!important;--mfe-accent-text:var(--mfe-ui-text,#f3f4f6)!important;
 --mfe-accent-fill:linear-gradient(180deg,rgba(var(--mfe-ui-primary-rgb,209,213,219),.22),rgba(156,163,175,.14))!important;--mfe-accent-fill-strong:linear-gradient(180deg,rgba(var(--mfe-ui-primary-rgb,209,213,219),.29),rgba(156,163,175,.20))!important;--mfe-accent-glow-soft:rgba(var(--mfe-ui-primary-rgb,209,213,219),.08)!important;--mfe-accent-glow:rgba(var(--mfe-ui-primary-rgb,209,213,219),.14)!important;
 --mfe-scroll-track:rgba(var(--mfe-ui-text-rgb,255,255,255),.04)!important;--mfe-scroll-thumb:rgba(var(--mfe-ui-primary-rgb,209,213,219),.40)!important;--mfe-scroll-thumb-hover:rgba(var(--mfe-ui-primary-rgb,209,213,219),.60)!important;
 --accent2:var(--mfe-ui-primary-dark,#9ca3af)!important;--mfa-accent:var(--mfe-ui-primary,#d1d5db)!important;--mfa-accent-dark:var(--mfe-ui-primary-dark,#9ca3af)!important;--mfa-accent-rgb:var(--mfe-ui-primary-rgb,209,213,219)!important;--mfa-accent-text:var(--mfe-ui-text,#e5e7eb)!important;--mfa-border:rgba(var(--mfe-ui-primary-rgb,209,213,219),.30)!important;--mfa-soft:rgba(var(--mfe-ui-primary-rgb,209,213,219),.11)!important;--mfa-soft-2:rgba(var(--mfe-ui-primary-rgb,209,213,219),.23)!important;
 --mf-shell-surface-start:var(--mfe-ui-surface,#20242a)!important;--mf-shell-surface-end:var(--mfe-ui-panel,#171a1f)!important;--mf-shell-line:rgba(var(--mfe-ui-text-rgb,229,231,235),.15)!important;--mf-shell-item-bg:rgba(var(--mfe-ui-text-rgb,255,255,255),.04)!important;--mf-shell-item-border:rgba(var(--mfe-ui-text-rgb,229,231,235),.12)!important;--mf-shell-item-hover:rgba(var(--mfe-ui-text-rgb,255,255,255),.085)!important;--mf-shell-action-bg:rgba(var(--mfe-ui-text-rgb,255,255,255),.055)!important;--mf-shell-action-border:rgba(var(--mfe-ui-text-rgb,229,231,235),.18)!important;--mf-shell-shadow:0 18px 42px rgba(0,0,0,.38)!important;
 --mf-shell-text:var(--mfe-ui-text,#f3f4f6)!important;--mf-shell-muted:var(--mfe-ui-muted,#c1c6ce)!important;--mf-shell-accent:var(--mfe-ui-primary,#d1d5db)!important;--mf-shell-accent-dark:var(--mfe-ui-primary-dark,#9ca3af)!important;--mf-shell-accent-rgb:var(--mfe-ui-primary-rgb,209,213,219)!important;--mf-shell-scroll-thumb:rgba(var(--mfe-ui-primary-rgb,209,213,219),.4)!important;--mf-shell-scroll-thumb-hover:rgba(var(--mfe-ui-primary-rgb,209,213,219),.6)!important;
 --mfa-dialog-bg:linear-gradient(180deg,var(--mfe-ui-surface,#20242a),var(--mfe-ui-panel,#171a1f))!important;--mfa-dialog-input:linear-gradient(180deg,var(--mfe-ui-button,#2a2f36),var(--mfe-ui-surface2,#24282e))!important;--mfa-dialog-text:var(--mfe-ui-text,#f3f4f6)!important;--mfa-dialog-title:var(--mfe-ui-title,#f8fafc)!important;--mfa-dialog-muted:var(--mfe-ui-muted,#c1c6ce)!important;--mfa-dialog-accent:var(--mfe-ui-primary,#d1d5db)!important;--mfa-dialog-dark:var(--mfe-ui-primary-dark,#9ca3af)!important;--mfa-dialog-rgb:var(--mfe-ui-primary-rgb,209,213,219)!important;--mfa-dialog-border:rgba(var(--mfe-ui-text-rgb,229,231,235),.25)!important;--mfa-dialog-soft:rgba(var(--mfe-ui-text-rgb,229,231,235),.12)!important;--mfa-dialog-contrast:var(--mfe-ui-bg,#111315)!important;--mfa-dialog-shadow:0 24px 60px rgba(0,0,0,.45)!important;
 --ga-bg:var(--mfe-ui-bg,#111315)!important;--ga-bg-2:var(--mfe-ui-bg2,#1d2024)!important;--ga-panel:var(--mfe-ui-surface,#20242a)!important;--ga-panel-soft:var(--mfe-ui-surface2,#24282e)!important;--ga-input-bg:var(--mfe-ui-input,#262b32)!important;--ga-option-bg:var(--mfe-ui-input,#262b32)!important;--ga-text:var(--mfe-ui-text,#f3f4f6)!important;--ga-muted:var(--mfe-ui-muted,#c1c6ce)!important;--ga-border:rgba(var(--mfe-ui-text-rgb,229,231,235),.16)!important;--ga-border-strong:rgba(var(--mfe-ui-text-rgb,229,231,235),.25)!important;--ga-accent:var(--mfe-ui-primary,#d1d5db)!important;--ga-accent-dark:var(--mfe-ui-primary-dark,#9ca3af)!important;--ga-accent-rgb:var(--mfe-ui-primary-rgb,209,213,219)!important;--ga-scroll-track:rgba(var(--mfe-ui-text-rgb,255,255,255),.04)!important;--ga-scroll-thumb:rgba(var(--mfe-ui-primary-rgb,209,213,219),.40)!important;
 --workspace-accent:var(--mfe-ui-primary,#d1d5db)!important;--workspace-accent-dark:var(--mfe-ui-primary-dark,#9ca3af)!important;--workspace-accent-rgb:var(--mfe-ui-primary-rgb,209,213,219)!important;--workspace-accent-contrast:var(--mfe-ui-bg,#111315)!important;--workspace-accent-surface:rgba(var(--mfe-ui-primary-rgb,209,213,219),.14)!important;--workspace-accent-text:var(--mfe-ui-text,#f3f4f6)!important;--workspace-line:rgba(var(--mfe-ui-text-rgb,229,231,235),.18)!important;--workspace-text:var(--mfe-ui-text,#f3f4f6)!important;
 --workspace-modal-card-bg:linear-gradient(180deg,var(--mfe-ui-surface,#20242a),var(--mfe-ui-panel,#171a1f))!important;--workspace-modal-panel-bg:var(--mfe-ui-surface,#20242a)!important;--workspace-modal-input-bg:var(--mfe-ui-input,#262b32)!important;--workspace-modal-option-bg:var(--mfe-ui-input,#262b32)!important;--workspace-modal-preview-bg:var(--mfe-ui-panel,#171a1f)!important;--workspace-modal-hover-bg:var(--mfe-ui-hover,#30353d)!important;--workspace-modal-track-bg:rgba(var(--mfe-ui-text-rgb,255,255,255),.08)!important;--workspace-modal-text:var(--mfe-ui-text,#f3f4f6)!important;--workspace-modal-title:var(--mfe-ui-title,#f8fafc)!important;--workspace-modal-muted:var(--mfe-ui-muted,#c1c6ce)!important;--workspace-modal-placeholder:var(--mfe-ui-placeholder,#b9c0c9)!important;--workspace-modal-subtle:var(--mfe-ui-placeholder,#b9c0c9)!important;--workspace-modal-border:rgba(var(--mfe-ui-text-rgb,229,231,235),.20)!important;--workspace-modal-border-strong:rgba(var(--mfe-ui-text-rgb,229,231,235),.32)!important;--workspace-modal-soft-border:rgba(var(--mfe-ui-text-rgb,229,231,235),.12)!important;--workspace-modal-backdrop:rgba(0,0,0,.72)!important;--workspace-modal-shadow:0 24px 60px rgba(0,0,0,.45)!important;
}
html[data-mfe-theme="gray"] body{color:var(--text)!important;background:radial-gradient(circle at 15% 12%,rgba(var(--mfe-ui-primary-rgb,209,213,219),.05),transparent 24%),linear-gradient(145deg,var(--bg),var(--bg2) 58%,var(--bg3))!important;}
html[data-mfe-theme="gray"] body :is(.player-auth-card,.shell>.top){background:var(--mfe-card-bg)!important;border-color:var(--line)!important;}
html[data-mfe-theme="gray"] body :is(input,textarea)::placeholder{color:var(--mfe-ui-placeholder,#b9c0c9)!important;opacity:1!important;}
html[data-mfe-theme] body .theme-swatch.gray{background:linear-gradient(135deg,var(--mfe-ui-bg,#111315) 0%,#272c33 55%,var(--mfe-ui-text,#e5e7eb) 56%,var(--mfe-ui-placeholder,#b9c0c9) 100%)!important;}
html[data-mfe-theme="gray"] body :is(.app-loading-overlay,.mfa-space-loading,.editor-page-loading-overlay){background:rgba(var(--mfe-ui-bg-rgb,17,19,21),.97)!important;}
html[data-mfe-theme="gray"] body :is(.app-loading-card,.loading-card,.sync-card,.export-card,.export-file-card,.editor-page-loading-card,.gps-page-loader-card,.matchday-export-progress-card){background:var(--mfa-dialog-bg)!important;border-color:var(--mfa-dialog-border)!important;color:var(--text)!important;}
html[data-mfe-theme="gray"] body :is(.app-loading-card,.loading-card,.sync-card,.export-card,.export-file-card,.editor-page-loading-card,.matchday-export-progress-card) *:not(img):not(svg):not(path){color:var(--text)!important;}
html[data-mfe-theme="gray"] body :is(.app-loading-copy,.app-loading-foot,.loading-subtitle,.loading-copy,.sync-copy,.export-copy,.editor-page-loading-copy,.editor-page-loading-foot){color:var(--muted)!important;}
html[data-mfe-theme="gray"] body :is(.app-loading-bar,.loading-bar,.sync-bar,.export-progress-bar,.editor-page-loading-bar){background:rgba(var(--mfe-ui-text-rgb,255,255,255),.08)!important;border-color:var(--line)!important;}
html[data-mfe-theme="gray"] body :is(.app-loading-bar-fill,.loading-bar-fill,.sync-bar-fill,.export-progress-fill,.editor-page-loading-bar-fill){background:linear-gradient(90deg,var(--mfe-ui-primary,#d1d5db),var(--mfe-ui-primary-dark,#9ca3af))!important;box-shadow:none!important;}
html[data-mfe-theme="gray"] body :is(.matchday-export-progress-badge,.daily-report-chip.ok,.daily-report-global.ok,.daily-count-card.ok,.daily-player-pill.ok,.daily-item.ok,.daily-empty){color:var(--text)!important;background:var(--mfe-accent-bg)!important;border-color:var(--mfe-accent-border)!important;}
html[data-mfe-theme="gray"] body :is(.daily-report-chip.ok,.daily-report-global.ok,.daily-count-card.ok,.daily-player-pill.ok,.daily-item.ok,.daily-empty) *{color:var(--text)!important;}
html[data-mfe-theme="gray"] body :is(.daily-report-chip.severe,.daily-report-global.severe,.daily-count-card.severe,.daily-player-pill.severe,.daily-item.severe),html[data-mfe-theme="gray"] body :is(.daily-report-chip.severe,.daily-report-global.severe,.daily-count-card.severe,.daily-player-pill.severe,.daily-item.severe) *{color:#fecaca!important;}
/* The selection preview is a UI panel, while the pitch and saved kits keep their own colours. */
html[data-mfe-theme="base"] body #playersLineupModal .matchday-lineup-role-switch button.is-active.is-starter{background:#08733a!important;color:#fff!important;}
html[data-mfe-theme="custom"] body #playersLineupModal .matchday-lineup-role-switch button.is-active:not(.is-out){background:var(--mfe-accent-fill)!important;color:var(--mfe-accent-text)!important;border-color:var(--mfe-accent-border)!important;}
html[data-mfe-theme="light"] body #playersLineupModal :is(.matchday-lineup-left,.matchday-lineup-right,.matchday-lineup-player-row,.matchday-lineup-bench-item){background:var(--mfe-card-bg)!important;border-color:var(--line)!important;color:var(--text)!important;}
html[data-mfe-theme="gray"] body #playersLineupModal :is(.matchday-lineup-left,.matchday-lineup-right,.matchday-lineup-player-row,.matchday-lineup-bench-item){background:var(--mfe-card-bg)!important;border-color:var(--line)!important;color:var(--text)!important;}
html[data-mfe-theme="light"] body #playersLineupModal :is(.matchday-lineup-preview-head,.matchday-lineup-bench-head,.matchday-lineup-counters,.matchday-lineup-bench),html[data-mfe-theme="gray"] body #playersLineupModal :is(.matchday-lineup-preview-head,.matchday-lineup-bench-head,.matchday-lineup-counters,.matchday-lineup-bench){color:var(--text)!important;}
html[data-mfe-theme="light"] body #playersLineupModal :is(.matchday-lineup-preview-head,.matchday-lineup-bench-head,.matchday-lineup-counters) :is(strong,span),html[data-mfe-theme="gray"] body #playersLineupModal :is(.matchday-lineup-preview-head,.matchday-lineup-bench-head,.matchday-lineup-counters) :is(strong,span){color:var(--text)!important;}
html[data-mfe-theme="light"] body #playersLineupModal .matchday-lineup-role-switch,html[data-mfe-theme="gray"] body #playersLineupModal .matchday-lineup-role-switch{background:var(--mfe-input-bg)!important;border-color:var(--mfe-input-border)!important;}
html[data-mfe-theme="light"] body #playersLineupModal .matchday-lineup-role-switch button,html[data-mfe-theme="gray"] body #playersLineupModal .matchday-lineup-role-switch button{color:var(--mfa-dialog-muted)!important;}
html[data-mfe-theme="light"] body #playersLineupModal .matchday-lineup-role-switch button.is-active{background:#08733a!important;color:#fff!important;border-color:#08733a!important;}
html[data-mfe-theme="light"] body #playersLineupModal .matchday-lineup-role-switch button.is-active.is-out{background:#d0d7df!important;color:#182630!important;border-color:#aeb9c5!important;}
html[data-mfe-theme="gray"] body #playersLineupModal .matchday-lineup-role-switch button.is-active{background:var(--mfe-ui-primary,#d1d5db)!important;color:var(--mfe-ui-bg,#111315)!important;border-color:var(--mfe-ui-primary,#d1d5db)!important;}
html[data-mfe-theme="gray"] body #playersLineupModal .matchday-lineup-format button.is-active{background:var(--mfe-ui-primary,#d1d5db)!important;color:var(--mfe-ui-bg,#111315)!important;}
html[data-mfe-theme="light"] body #playersLineupModal :is(.matchday-lineup-search input,.matchday-lineup-manual-inputs input),html[data-mfe-theme="gray"] body #playersLineupModal :is(.matchday-lineup-search input,.matchday-lineup-manual-inputs input){background:var(--mfe-input-bg)!important;color:var(--text)!important;border-color:var(--mfe-input-border)!important;}
html[data-mfe-theme="gray"] body #playersLineupModal .matchday-lineup-gk-toggle input:checked{background:var(--mfe-ui-primary,#d1d5db)!important;border-color:var(--mfe-ui-primary,#d1d5db)!important;}
html[data-mfe-theme="gray"] body #playersLineupModal .matchday-lineup-gk-toggle input:checked::after{background:var(--mfe-ui-bg,#111315)!important;}
html[data-mfe-theme="light"] body #playersLineupModal .status-available{color:#08733a!important;}
html[data-mfe-theme="light"] body #playersLineupModal .status-managed{color:#8a4b00!important;}
html[data-mfe-theme="light"] body #playersLineupModal .status-injured{color:#ad263d!important;}
html[data-mfe-theme="light"] body #playersLineupModal .status-suspended{color:#485967!important;}
html[data-mfe-theme="light"] body #playersLineupModal input::placeholder{color:var(--mfa-dialog-muted)!important;opacity:1!important;}

/* R75: neutral Dark chrome, including legacy/runtime-injected dialogs.
   Important declarations in this layer outrank old unlayered ID selectors.
   Artwork, colour swatches, video frames and saved document palettes are excluded. */
@layer mfe-dark-ui {
 html[data-mfe-theme="gray"] body{
  --button-bg:linear-gradient(180deg,var(--mfe-ui-button,#2a2f36),var(--mfe-ui-surface2,#24282e))!important;
  --topbar-bg:linear-gradient(180deg,var(--mfe-ui-surface,#20242a),var(--mfe-ui-panel,#171a1f))!important;
  --panel-glass:rgba(var(--mfe-ui-surface-rgb,32,36,42),.98)!important;
  --container-bg:linear-gradient(180deg,var(--mfe-ui-bg2,#1d2024),var(--mfe-ui-bg,#111315))!important;
 }
 html[data-mfe-theme="gray"] body :is(.app-loading-card,.editor-page-loading-card,.gps-page-loader-card,.loading-card){background:var(--mfa-dialog-bg)!important;color:var(--text)!important;border-color:var(--line)!important;}
 html[data-mfe-theme="gray"] body :is(.app-loading-card,.editor-page-loading-card,.gps-page-loader-card,.loading-card) :is(h1,h2,h3,[class*="title"],[class*="status"],[class*="percent"],[class*="badge"],[class*="progress-label"]){color:var(--text)!important;-webkit-text-fill-color:currentColor!important;opacity:1!important;text-shadow:none!important;}
 html[data-mfe-theme="gray"] body :is(.app-loading-card,.editor-page-loading-card,.gps-page-loader-card,.loading-card) :is(p,[class*="copy"],[class*="subtitle"],[class*="foot"]){color:var(--muted)!important;-webkit-text-fill-color:currentColor!important;opacity:1!important;}
 html[data-mfe-theme="gray"] body :is(.app-loading-overlay,.editor-page-loading-overlay,.mfa-space-loading){background:rgba(var(--mfe-ui-bg-rgb,17,19,21),.98)!important;}
 html[data-mfe-theme="gray"] body :is(.app-loading-bar,.editor-page-loading-bar,.loading-bar){background:rgba(var(--mfe-ui-text-rgb,255,255,255),.08)!important;border-color:var(--line)!important;}
 html[data-mfe-theme="gray"] body :is(.app-loading-bar-fill,.editor-page-loading-bar-fill,.loading-bar-fill){background:linear-gradient(90deg,var(--mfe-ui-primary,#d1d5db),var(--mfe-ui-primary-dark,#9ca3af))!important;box-shadow:none!important;}
 html[data-mfe-theme="gray"] body :is(.modal,.game-model-overlay,.editor-overlay,.mfa-export-modal){background:rgba(0,0,0,.72)!important;}
 html[data-mfe-theme="gray"] body :is(.game-model-overlay-card,.game-model-overlay-head,.game-model-overlay-body,.field-popover,.mfe-exercise-card,.mfe-library-card,.mfe-plan-picker-card,.mfe-training-plan-card,.mfe-training-plan-meta-panel,.mfe-training-plan-exercises-panel,.mfe-training-plan-available-dialog,.mfe-training-plan-player-changes-dialog,.mfe-training-plan-available-panel,.mfe-training-plan-available-toolbar,.mfe-training-plan-selected-card,.mfe-training-plan-global-color-card,.mfe-training-plan-color-popover-panel){background:var(--mfe-card-bg)!important;color:var(--text)!important;border-color:var(--line)!important;}
 html[data-mfe-theme="gray"] body .game-model-overlay :is(.surface-card,.game-model-modal-surface,.note-card,.position-card,.principle-card,.lane-card,.scheme-card,.scheme-area,.image-surface){background:var(--mfe-card-bg)!important;color:var(--text)!important;border-color:var(--line)!important;}
 html[data-mfe-theme="gray"] body :is(.game-model-overlay,.field-popover) :is(h1,h2,h3,.game-model-overlay-title,.note-title,.surface-title,.scheme-title,.field-popover-title,label){color:var(--text)!important;}
 html[data-mfe-theme="gray"] body :is(.game-model-overlay,.field-popover) :is(p,.game-model-overlay-copy,.surface-copy,.helper,.field-popover-hint,.field-popover-mini){color:var(--muted)!important;}
 html[data-mfe-theme="gray"] body.workspace-redesign :is(.workspace-rail-btn,.workspace-nav-btn,.workspace-field-option,.workspace-sidebar-reopen,.workspace-sidebar-collapse,.workspace-menu-action){color:var(--text)!important;border-color:var(--line)!important;}
 html[data-mfe-theme="gray"] body.workspace-redesign :is(.workspace-rail-btn,.workspace-sidebar-reopen,.workspace-sidebar-collapse){background:var(--mfe-input-bg)!important;}
 html[data-mfe-theme="gray"] body.workspace-redesign :is(.workspace-header-actions button,.workspace-dashboard-btn,.workspace-sidebar-collapse,.workspace-more-trigger):not(.danger){background:var(--button-bg)!important;color:var(--text)!important;border-color:var(--line)!important;}
 html[data-mfe-theme="gray"] body.workspace-redesign :is(.workspace-rail-btn,.workspace-nav-btn,.workspace-field-option):is(:hover,.active){background:var(--mfe-accent-bg-strong)!important;border-color:var(--mfe-accent-border)!important;color:var(--text)!important;}
 html[data-mfe-theme="gray"] body.workspace-redesign :is(.workspace-header-actions,.workspace-rail,.workspace-sidebar-head) :is(i,svg,span){color:inherit!important;}
 html[data-mfe-theme="gray"] body :is(.mfe-training-plan-available-dialog,.mfe-training-plan-player-changes-dialog,.game-model-overlay,.field-popover) :is(button:not(.danger):not(.mfe-training-plan-position-node):not(.mfe-training-plan-color-preview),select,input:not([type="color"]):not([type="range"]):not([type="checkbox"]):not([type="radio"]),textarea){background:var(--mfe-input-bg)!important;color:var(--text)!important;border-color:var(--mfe-input-border)!important;}
 /* Telestrator UI only: never target the SVG/canvas or its drawing colours. */
 html[data-mfe-theme="gray"] body .mfa-tel-v32{background:var(--mfe-ui-bg,#111315)!important;color:var(--text)!important;--mfa-tel-text:var(--mfe-ui-text,#f3f4f6)!important;--mfa-tel-panel:var(--mfe-ui-surface,#20242a)!important;}
 html[data-mfe-theme="gray"] body .mfa-tel-v32 :is(.mfa-tel-top,.mfa-tel-panel,.mfa-tel-tools-bar,.mfa-tel-stylebar,.mfa-style-popover,.mfa-tel-toast,.mfa-tel-no-timeline-card,.mfa-export-card,.mfa-defaults-tool,.mfa-defaults-group,.mfa-defaults-tool-card,.mfa-visual-palette){background:var(--mfe-card-bg)!important;color:var(--text)!important;border-color:var(--line)!important;}
 html[data-mfe-theme="gray"] body .mfa-tel-v32 :is(.mfa-tel-stage-shell,.mfa-tel-stage,.mfa-tel-no-timeline){background:var(--mfe-ui-bg,#111315)!important;color:var(--text)!important;}
 html[data-mfe-theme="gray"] body .mfa-tel-v32 :is(.mfa-tel-title,.mfa-tel-panel-head,.mfa-stylebar-selected,.mfa-tool,.mfa-tool-icon,.mfa-style-action-btn,.mfa-style-pop-btn,.mfa-style-field-toggle,.mfa-time-readout,.mfa-tel-status,.mfa-export-card h2,.mfa-defaults-tool h3,.mfa-default-label,.mfa-defaults-tool-title,.mfa-default-compact>span b){color:var(--text)!important;}
 html[data-mfe-theme="gray"] body .mfa-tel-v32 :is(.mfa-tel-title>span,.mfa-tel-hint,.mfa-stylebar-kicker,.mfa-style-popover-title,.mfa-tel-field label,.mfa-tel-no-timeline-card p,.mfa-export-copy,.mfa-defaults-copy,.mfa-default-compact>span,.mfa-tel-field>span){color:var(--muted)!important;}
 html[data-mfe-theme="gray"] body .mfa-tel-v32 :is(.mfa-tel-btn,.mfa-tel-select,.mfa-tel-input,.mfa-style-pop-btn,.mfa-style-action-btn,.mfa-style-field-toggle,.mfa-tool,.mfa-palette-tab){background:var(--mfe-input-bg)!important;color:var(--text)!important;border-color:var(--mfe-input-border)!important;}
 html[data-mfe-theme="gray"] body .mfa-tel-v32 :is(.mfa-tel-btn.primary,.mfa-tool.active,.mfa-style-pop-btn.active,.mfa-palette-tab[aria-selected="true"],.mfa-palette-card.is-selected){background:var(--mfe-accent-bg-strong)!important;border-color:var(--mfe-accent-border)!important;color:var(--text)!important;}
 html[data-mfe-theme="gray"] body .mfa-tel-v32 :is(.mfa-style-field-toggle-ui,.mfa-player-tag-toggle-ui){background:var(--mfe-ui-input,#42464c)!important;border-color:var(--mfe-ui-line,#6b7077)!important;}
 html[data-mfe-theme="gray"] body .mfa-tel-v32 :is(.mfa-style-field-toggle,.mfa-player-tag-toggle) input:checked+span{background:var(--mfe-ui-primary,#d1d5db)!important;border-color:var(--mfe-ui-primary,#d1d5db)!important;}
 html[data-mfe-theme="gray"] body .mfa-tel-v32 :is(.mfa-style-field-toggle,.mfa-player-tag-toggle) input:checked+span::after{background:var(--mfe-ui-bg,#111315)!important;}
 html[data-mfe-theme="gray"] body .mfa-tel-v32 .mfa-style-field-toggle-ui i{background:var(--mfe-ui-text,#e5e7eb)!important;}
 html[data-mfe-theme="gray"] body .mfa-tel-v32 .mfa-style-field-toggle input:checked+.mfa-style-field-toggle-ui i{background:var(--mfe-ui-bg,#111315)!important;}
 html[data-mfe-theme="gray"] body .mfa-tel-v32 .mfa-style-field-toggle input:focus-visible+.mfa-style-field-toggle-ui{outline-color:var(--mfe-ui-primary,#d1d5db)!important;}
 html[data-mfe-theme="gray"] body .mfa-tel-v32 .mfa-tel-watermark{z-index:8!important;background:rgba(var(--mfe-ui-bg-rgb,17,19,21),.92)!important;color:var(--text)!important;border-color:var(--line)!important;}
 html[data-mfe-theme="gray"] body .visual-range-head output{color:var(--text)!important;}
}

/* R77: actual plan sidebar and both headers; surfaces omitted from R75. */
@layer mfe-dark-ui {
 html[data-mfe-theme="gray"] body #trainingPlanModal :is(.mfe-training-plan-sidebar,.mfe-training-plan-hero,.mfe-training-plan-main-header){background:var(--mfe-card-bg)!important;color:var(--text)!important;border-color:var(--line)!important;}
}

/* R78: fifth-theme controls and exact chosen page background. */
.theme-grid{grid-template-columns:repeat(5,minmax(0,1fr))!important;}
.theme-swatch.full{background:linear-gradient(135deg,var(--mfe-ui-bg,#20242a) 0% 55%,var(--mfe-custom-primary,#22c55e) 55% 100%)!important;}
#themeCustomControls{grid-template-columns:repeat(2,minmax(130px,1fr));align-items:end;}
#themeCustomControls .helper{grid-column:1/-1;}
#themeCustomControls [hidden]{display:none!important;}
@media(max-width:900px){.theme-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;}}
@media(max-width:520px){.theme-grid,#themeCustomControls{grid-template-columns:1fr!important;}}
@layer mfe-dark-ui {
 html[data-mfe-theme-full],html[data-mfe-theme-full] body{color-scheme:var(--mfe-ui-color-scheme)!important;--workspace-accent-contrast:var(--mfe-ui-on-accent)!important;--mfa-dialog-contrast:var(--mfe-ui-on-accent)!important;--mfe-accent-text:var(--mfe-ui-accent-text)!important;--workspace-accent-text:var(--mfe-ui-accent-text)!important;--mf-shell-text:var(--mfe-ui-text)!important;--line:var(--mfe-ui-line)!important;--mfe-input-border:var(--mfe-ui-line)!important;--border:var(--mfe-ui-line)!important;}
 html[data-mfe-theme-full] body{background:var(--mfe-ui-bg)!important;}
 html[data-mfe-theme-full] body :is(.btn.primary,.mfa-tel-btn.active,.mfa-tel-tab.active,.workspace-rail-btn.active,.matchday-lineup-role-switch button.is-active){background:var(--mfe-custom-primary)!important;color:var(--mfe-ui-on-accent)!important;border-color:var(--mfe-ui-line)!important;}
 html[data-mfe-theme-full] body input[type=datetime-local]::-webkit-calendar-picker-indicator{filter:none!important;}
}

@layer mfe-dark-ui {
 html[data-mfe-theme-full],html[data-mfe-theme-full] body{--workspace-muted:var(--mfe-ui-muted)!important;--muted-strong:var(--mfe-ui-muted)!important;--copy-soft:var(--mfe-ui-muted)!important;--observation-text:var(--mfe-ui-text)!important;}
 html[data-mfe-theme="gray"][data-mfe-theme-full] body :is(.workspace-dashboard-btn,.workspace-sidebar-collapse,.workspace-rail-btn){background:var(--mfe-ui-button)!important;color:var(--text)!important;border-color:var(--line)!important;}
 html[data-mfe-theme-full],html[data-mfe-theme-full] body{--mfe-accent-bg:var(--mfe-ui-input)!important;--mfe-accent-bg-strong:var(--mfe-ui-hover)!important;--mfe-accent-fill:var(--mfe-ui-hover)!important;--mfe-accent-fill-strong:var(--mfe-ui-hover)!important;--workspace-accent-surface:var(--mfe-ui-hover)!important;}
 html[data-mfe-theme="gray"][data-mfe-theme-full] body.workspace-redesign .workspace-header-nav{background:var(--mfe-ui-surface)!important;}
 html[data-mfe-theme="gray"][data-mfe-theme-full] body.workspace-redesign .workspace-nav-btn{background:var(--mfe-ui-button)!important;color:var(--text)!important;}
 html[data-mfe-theme="gray"][data-mfe-theme-full] body.workspace-redesign :is(.workspace-nav-btn,.workspace-rail-btn,.workspace-field-option):is(:hover,.active){background:var(--mfe-ui-primary)!important;color:var(--mfe-ui-on-accent)!important;}
 html[data-mfe-theme="gray"] body .account-modal{background:rgba(0,0,0,.7)!important;}
 html[data-mfe-theme-full] body .mfa-default-compact{color:var(--muted)!important;}
 html[data-mfe-theme-full] body .theme-swatch.gray{background:linear-gradient(135deg,#111315 0%,#272c33 55%,#e5e7eb 56%,#b9c0c9 100%)!important;}
 html[data-mfe-theme-full] body #mfaTelAutoDynamic:checked+.mfa-style-field-toggle-ui i{background:var(--mfe-ui-on-accent)!important;}
}

.theme-grid .theme-option{min-width:0!important;}
.theme-grid .theme-name,.theme-grid .theme-desc{overflow-wrap:anywhere!important;}

.theme-grid .theme-option{position:relative;}
.theme-grid .theme-option input{width:1px!important;height:1px!important;left:0;top:0;}
@media(max-width:900px){#themeCustomControls{grid-template-columns:1fr!important;}}

/* R80: full-theme editor surfaces and readable accent labels. Artwork is excluded. */
@layer mfe-dark-ui {
 html[data-mfe-theme="gray"][data-mfe-theme-full] body.workspace-redesign :is(#topbar,.workspace-rail,#leftbar,#rightbar,.workspace-sidebar-head,.workspace-inspector-card,.workspace-more-section,.workspace-more-dropdown,.view-dropdown,.project-dropdown,.export-dropdown,.editor-color-group,.editor-overlay-card,.workspace-default-colors-card){background:var(--mfe-ui-panel)!important;color:var(--text)!important;border-color:var(--line)!important;}
 html[data-mfe-theme="gray"][data-mfe-theme-full] body.workspace-redesign #container{background:var(--mfe-ui-bg)!important;}
 html[data-mfe-theme="gray"][data-mfe-theme-full] body.workspace-redesign #leftbar .panel-group{background:var(--mfe-ui-surface2)!important;border-color:var(--line)!important;color:var(--text)!important;}
 html[data-mfe-theme="gray"][data-mfe-theme-full] body.workspace-redesign :is(.workspace-sidebar-title,.workspace-header-title,.workspace-inspector-title){color:var(--text)!important;}
 html[data-mfe-theme="gray"][data-mfe-theme-full] body.workspace-redesign :is(.workspace-header-status,.workspace-sidebar-kicker,.panel-title,.workspace-text-label){color:var(--mfe-ui-accent-text)!important;}
 html[data-mfe-theme="gray"][data-mfe-theme-full] body.workspace-redesign :is(.drag-item,.workspace-slider-value,.editor-range-output,.workspace-default-colors-actions button,.workspace-default-colors-close,.workspace-default-colors-grid label,.workspace-default-colors-grid input[type="color"]){background:var(--mfe-ui-button)!important;color:var(--text)!important;border-color:var(--line)!important;}
 html[data-mfe-theme="gray"][data-mfe-theme-full] body.workspace-redesign #leftbar .workspace-field-option{background:var(--mfe-ui-button)!important;color:var(--text)!important;border-color:var(--line)!important;}
 html[data-mfe-theme="gray"][data-mfe-theme-full] body.workspace-redesign #leftbar .workspace-field-option:is(.active,:hover){background:var(--mfe-ui-primary)!important;color:var(--mfe-ui-on-accent)!important;}
 html[data-mfe-theme="gray"][data-mfe-theme-full] body.workspace-redesign .workspace-field-option :is(svg,span){color:inherit!important;}
}
#themeCustomControls[hidden],#themeBackgroundControl[hidden]{display:none!important;}
/* A single clipped paint surface avoids translucent border seams at fractional zoom. */
.theme-grid .theme-swatch{border:0!important;box-shadow:inset 0 0 0 1px var(--mfe-input-border)!important;clip-path:inset(0 round 14px);background-clip:border-box!important;}

/* R87: action confirmations use the active UI theme, including legacy module toasts. */
html[data-mfe-theme] body :is(.mfa-feedback-toast,.squad-save-toast,.live-save-toast,.video-editor-save-toast,.workspace-feedback-toast,.toast-region .toast,#mfaTelToast){background:var(--panel)!important;background-image:none!important;color:var(--text)!important;border-color:var(--accent)!important;}
html[data-mfe-theme] body .mfa-feedback-toast:is(.is-info,.is-success){--feedback-accent:var(--accent)!important;}
html[data-mfe-theme] body :is(.mfa-feedback-toast.is-error,.live-save-toast.is-error,.toast-region .toast.error){border-color:var(--feedback-accent,#ef4444)!important;}
html[data-mfe-theme] body :is(.mfa-feedback-toast.is-warning,.toast-region .toast.warning){border-color:var(--feedback-accent,#f59e0b)!important;}
