/* PureWager EMS branding overrides — loaded after Backoffice theme */

:root {
  --ems-navy: #00274c;
  --ems-gold: #ffcb05;
  --ems-nav-text: #f5f8fc;
  --ems-nav-text-muted: #d4deea;
  --ems-nav-icon: #e2eaf3;
}

/* App body / main viewport */
.x-viewport,
.x-panel-body-default,
.x-border-layout-ct,
#mainView,
#mainContainerWrap,
.x-tab-panel-body,
.x-grid-body {
  background-color: #f4f6f8 !important;
}

/* Left navigation tree — beat .main-menu-wrap theme rules (#404040 on dark navy) */
.x-treelist-navigation,
.x-treelist-navigation .x-treelist-root-container,
.x-treelist-navigation .x-panel-body,
.mainmenu,
.main-menu-wrap,
.main-menu-wrap .x-treelist-navigation,
.nav-tree-animating .x-treelist-root-container,
.x-treelist-navigation .x-treelist-container {
  background: var(--ems-navy) !important;
}

.main-menu-wrap .x-treelist-navigation .x-treelist-item-expanded,
.main-menu-wrap .x-treelist-navigation .x-treelist-item-expanded > .x-treelist-row {
  background-color: rgba(255, 255, 255, 0.06) !important;
}

.main-menu-wrap .x-treelist-navigation .x-treelist-item-text,
.main-menu-wrap .x-treelist-navigation .x-treelist-item-expander,
.main-menu-wrap .x-treelist-navigation .x-treelist-item-icon,
.main-menu-wrap .x-treelist-navigation .x-treelist-item-tool,
.x-treelist-navigation .x-treelist-item-text,
.x-treelist-navigation .x-treelist-item-expander,
.x-treelist-navigation .x-treelist-item-icon,
.x-treelist-navigation .x-treelist-item-tool,
.treelist-level-1 .x-treelist-item-text,
.treelist-level-2 .x-treelist-item-text,
.treelist-level-3 .x-treelist-item-text,
.main-menu-wrap .x-treelist-navigation .x-treelist-item-leaf .x-treelist-item-icon,
.main-menu-wrap .x-treelist-navigation .x-treelist-item-leaf .x-treelist-item-tool {
  color: var(--ems-nav-text) !important;
  -webkit-text-fill-color: var(--ems-nav-text) !important;
  opacity: 1 !important;
}

.main-menu-wrap .x-treelist-navigation .x-treelist-item-icon,
.main-menu-wrap .x-treelist-navigation .x-treelist-item-tool {
  color: var(--ems-nav-icon) !important;
}

.x-treelist-navigation .x-treelist-row-over .x-treelist-item-text,
.x-treelist-navigation .x-treelist-row-over .x-treelist-item-expander,
.x-treelist-navigation .x-treelist-row-over .x-treelist-item-icon,
.main-menu-wrap .x-treelist-navigation .x-treelist-row-over .x-treelist-item-text {
  color: #ffffff !important;
}

.x-treelist-navigation .x-treelist-row-over {
  background-color: rgba(255, 203, 5, 0.18) !important;
}

.x-treelist-navigation .x-treelist-item-selected > .x-treelist-row,
.x-treelist-item-selected > .x-treelist-row {
  background-color: var(--ems-gold) !important;
}

.x-treelist-navigation .x-treelist-item-selected .x-treelist-item-text,
.x-treelist-navigation .x-treelist-item-selected .x-treelist-item-icon,
.x-treelist-navigation .x-treelist-item-selected .x-treelist-item-expander {
  color: var(--ems-navy) !important;
}

/* App header / top toolbar */
.x-toolbar.app-header,
#app-header,
.x-toolbar[dock="top"] {
  background: var(--ems-navy) !important;
  border-color: var(--ems-navy) !important;
}

.x-toolbar.app-header .x-btn-inner,
.x-toolbar.app-header .x-form-display-field,
#app-header .x-btn-inner {
  color: var(--ems-nav-text) !important;
}

/* Panel / grid headers */
.fsb-panel-header,
.x-grid-header-ct,
.x-panel-header-default,
.x-panel-header-default-horizontal,
.x-column-header,
.x-column-header-inner {
  background-color: var(--ems-navy) !important;
  border-color: var(--ems-navy) !important;
  color: var(--ems-nav-text) !important;
}

.x-column-header-text-inner,
.x-panel-header-text-container-default {
  color: var(--ems-nav-text) !important;
}

/* Status bar */
.x-toolbar-footer,
.x-toolbar.x-docked-bottom,
.x-statusbar {
  background: #fff !important;
  border-top: 3px solid var(--ems-gold) !important;
}

/* Primary buttons */
.x-btn-default-small,
.x-btn-default-toolbar-small,
button[type="submit"] {
  background-color: var(--ems-navy) !important;
  border-color: var(--ems-navy) !important;
  color: #fff !important;
}

.x-btn-default-small:hover,
.x-btn-default-toolbar-small:hover,
button[type="submit"]:hover {
  background-color: #003d73 !important;
  border-color: var(--ems-gold) !important;
}

/* Active / live tab highlight */
.x-tab.x-tab-active .x-tab-inner-default,
.x-tab-bar-top .x-tab.x-tab-active,
.fsb-border-color-orange,
.fsb-border-color-orange .x-grid-cell {
  border-color: var(--ems-gold) !important;
  background-color: var(--ems-gold) !important;
  color: var(--ems-navy) !important;
}

.fsb-border-color-blue {
  border-color: var(--ems-navy) !important;
}

/* Breadcrumb */
.x-breadcrumb-btn .x-btn-inner {
  color: var(--ems-navy) !important;
}

/* Header logo */
.app-header img,
.x-component.header-logo img,
#app-header img,
.x-toolbar img[src*="ems_logo"] {
  max-height: 42px;
  width: auto;
}

/* Tab strip accent */
.x-tab-bar-default-top {
  background: #fff !important;
}

.x-tab.x-tab-active {
  border-bottom: 2px solid var(--ems-gold) !important;
}

/* Grid row selection */
.x-grid-item-selected {
  background-color: rgba(0, 39, 76, 0.08) !important;
}

/* Override legacy blue nav items in treelist level 3 */
.treelist-level-3,
.treelist-level-3.horses-in_play,
.treelist-level-3.horses-scheduled {
  background-color: var(--ems-navy) !important;
}

.treelist-level-2.level2-horses {
  background-color: #003d73 !important;
}

/* Dashboard toolbar dropdown on navy panels */
.x-panel-body .x-form-display-field,
.x-panel-body .x-form-text-default,
.x-panel-body .x-form-trigger-wrap-default .x-form-text,
.x-panel-body .x-form-item-label-text,
.x-panel-body .x-form-item-label-inner {
  color: #333 !important;
}

.dark-theme .x-panel-body .x-form-display-field,
.dark-theme .x-panel-body .x-form-text-default {
  color: #fff !important;
}

.dark-theme .x-btn-default-toolbar-small {
  background-color: var(--ems-navy) !important;
}
