/* Midnight mobile left drawer — 2026 premium sheet
   marker: nx-mobdrawer-ui-20260913j
   - Off-canvas via transform (no closed-state peek)
   - Full-width sticky brand overlay + short fade (clears active pill at rest)
   - Submenu chevrons restored
   - Scroll locked to drawer only when open
   - Close X phone-only (hidden tablet/desktop) */

@media (max-width: 767.98px) {
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin .left-sidebar,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.mini-sidebar .left-sidebar {
    --nx-drawer-w: min(300px, calc(100vw - 56px));
    --nx-drawer-brand-h: 4.5rem;
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    width: var(--nx-drawer-w) !important;
    min-width: 0 !important;
    max-width: var(--nx-drawer-w) !important;
    height: 100% !important;
    max-height: 100dvh !important;
    padding: 0 !important;
    padding-top: 0 !important;
    margin: 0 !important;
    z-index: 1001 !important;
    background: #0c0c0c !important;
    background-image: none !important;
    border: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
    border-radius: 0 20px 20px 0 !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    overflow: hidden !important;
    overscroll-behavior: contain !important;
    /* fully off-canvas when closed — never peek */
    transform: translate3d(calc(-100% - 20px), 0, 0) !important;
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1) !important;
    will-change: transform;
    pointer-events: none !important;
    visibility: visible !important;
  }

  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.mini-sidebar.show-sidebar .left-sidebar {
    transform: translate3d(0, 0, 0) !important;
    pointer-events: auto !important;
    /* soft depth only — no inset hairlines */
    box-shadow: 24px 0 64px rgba(0, 0, 0, 0.55) !important;
  }

  /* Lock page scroll while drawer is open */
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    html:has(body.loggedin.show-sidebar) {
    overflow: hidden !important;
    overscroll-behavior: none !important;
    touch-action: none !important;
  }

  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .nx-midnight-right-panel,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .page-wrapper {
    touch-action: none !important;
    overflow: hidden !important;
    pointer-events: none !important;
  }

  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .nx-midnight-right-panel::before {
    pointer-events: auto !important;
  }

  /* Full-width brand plate — menu scrolls underneath; close stays above */
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin .left-sidebar .nx-sidebar-brand,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.mini-sidebar .left-sidebar .nx-sidebar-brand,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .nx-sidebar-brand {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    flex: none !important;
    width: 100% !important;
    max-width: 100% !important;
    height: var(--nx-drawer-brand-h) !important;
    min-height: var(--nx-drawer-brand-h) !important;
    max-height: var(--nx-drawer-brand-h) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    padding: 0 14px 0 16px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: none !important;
    background: #0c0c0c !important;
    z-index: 6 !important;
    overflow: visible !important;
    pointer-events: auto !important;
  }

  /* Tiny dissolve under full-width hairline — stays in the gap, clears active pill at rest */
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .nx-sidebar-brand::after {
    content: "" !important;
    display: block !important;
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    top: 100% !important;
    height: 8px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    pointer-events: none !important;
    z-index: 5 !important;
    background: linear-gradient(
      to bottom,
      rgba(12, 12, 12, 0.9) 0%,
      rgba(12, 12, 12, 0.35) 55%,
      rgba(12, 12, 12, 0) 100%
    ) !important;
  }

  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .nx-sidebar-brand .logo-large {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    max-height: 40px !important;
    max-width: 176px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    object-position: left center !important;
  }

  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .nx-sidebar-brand .logo-small {
    display: none !important;
  }

  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .nx-sidebar-brand .sidenav-menu-item.logo,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .nx-sidebar-brand .navbar-brand {
    display: inline-flex !important;
    align-items: center !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: calc(100% - 3rem) !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-bottom: 0 !important;
    box-shadow: none !important;
  }

  /* Close stays on the plate, above scrolling items */
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .nx-mobile-sidebar-close {
    position: relative !important;
    z-index: 7 !important;
    flex: 0 0 2.25rem !important;
    align-self: center !important;
    pointer-events: auto !important;
  }

  /* Scroll fills panel; top pad = brand height so first items sit under the plate */
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .scroll-sidebar,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar #main-scroll-sidebar,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.mini-sidebar.show-sidebar .left-sidebar .scroll-sidebar,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.mini-sidebar.show-sidebar .left-sidebar #main-scroll-sidebar {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    flex: none !important;
    width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    padding-top: var(--nx-drawer-brand-h) !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    background: #0c0c0c !important;
    z-index: 1 !important;
  }

  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .sidebar-nav {
    padding: 14px 12px 40px !important;
    background: transparent !important;
    touch-action: pan-y !important;
  }

  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .sidebar-nav > ul,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .sidebar-nav #sidebarnav {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .sidebar-nav > ul > li,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .sidebar-nav #sidebarnav > li {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    list-style: none !important;
  }

  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .sidebar-nav ul li.nav-devider {
    display: none !important;
  }

  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .sidebar-nav > ul > li > a,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .sidebar-nav #sidebarnav > li > a {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    min-height: 44px !important;
    margin: 0 !important;
    padding: 10px 36px 10px 12px !important;
    border: 0 !important;
    border-left: 0 !important;
    border-radius: 12px !important;
    background: transparent !important;
    box-shadow: none !important;
    color: rgba(245, 248, 255, 0.78) !important;
    font-size: 0.9375rem !important;
    font-weight: 500 !important;
    letter-spacing: 0.01em !important;
  }

  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .sidebar-nav > ul > li.active > a,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .sidebar-nav > ul > li > a.active,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .sidebar-nav #sidebarnav > li.active > a {
    background: rgba(197, 205, 216, 0.12) !important;
    color: #c5cdd8 !important;
  }

  /* Kill only left accent ::before — keep submenu chevron ::after */
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .sidebar-nav > ul > li > a::before,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .sidebar-nav #sidebarnav > li > a::before {
    content: none !important;
    display: none !important;
  }

  /* Premium chevron for subgroups (beats mini-sidebar hide) */
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .sidebar-nav .has-arrow::after,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar.mini-sidebar .left-sidebar .sidebar-nav #sidebarnav > li > a.has-arrow::after {
    content: "" !important;
    display: block !important;
    position: absolute !important;
    right: 14px !important;
    top: 50% !important;
    width: 7px !important;
    height: 7px !important;
    margin: 0 !important;
    border-width: 1.5px 1.5px 0 0 !important;
    border-style: solid !important;
    border-color: rgba(197, 205, 216, 0.55) !important;
    background: transparent !important;
    box-shadow: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(-50%) rotate(45deg) !important;
    transform-origin: center !important;
    transition: transform 0.2s ease, border-color 0.15s ease !important;
    pointer-events: none !important;
  }

  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .sidebar-nav .has-arrow[aria-expanded="true"]::after,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .sidebar-nav li.active > .has-arrow::after,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .sidebar-nav .active > .has-arrow::after {
    border-color: #c5cdd8 !important;
    transform: translateY(-35%) rotate(135deg) !important;
  }

  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .sidebar-nav > ul > li > a > i,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .sidebar-nav #sidebarnav > li > a > i {
    width: 1.25rem !important;
    min-width: 1.25rem !important;
    font-size: 1.125rem !important;
    color: inherit !important;
    opacity: 0.9 !important;
  }

  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .sidebar-nav #sidebarnav > li > ul {
    margin: 2px 0 6px !important;
    padding: 0 0 0 8px !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .sidebar-nav #sidebarnav > li > ul > li > a {
    min-height: 40px !important;
    padding: 8px 12px !important;
    border: 0 !important;
    border-radius: 10px !important;
    color: rgba(245, 248, 255, 0.62) !important;
  }

  /* Hide PerfectScrollbar chrome (extra rails look like stripes) */
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .ps__rail-x,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .ps__rail-y {
    display: none !important;
    opacity: 0 !important;
    width: 0 !important;
    background: transparent !important;
  }

  /* Scrim */
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .nx-midnight-right-panel::before {
    content: "" !important;
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0, 0, 0, 0.58) !important;
    z-index: 1000 !important;
    pointer-events: auto !important;
    touch-action: none !important;
  }
}

/* Settings phone drawer parity + desktop brand chrome (exit + hide close) */
@media (min-width: 768px) {
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.settings .left-sidebar.settings-menu .nx-settings-drawer-brand {
    display: block !important;
    position: relative !important;
    flex: none !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.settings .left-sidebar.settings-menu .nx-settings-drawer-brand .nx-mobile-sidebar-close {
    display: none !important;
  }
}

@media (max-width: 767.98px) {
  /* Beat custom.css 230px / display:none / toggle-left-menu on phone */
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.settings .left-sidebar.settings-menu,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.settings.nx-midnight-premium-shell .left-sidebar.settings-menu,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.settings .left-sidebar.settings-menu.toggle-left-menu,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.settings.nx-midnight-premium-shell .left-sidebar.settings-menu.toggle-left-menu {
    display: flex !important;
    width: var(--nx-drawer-w, min(300px, calc(100vw - 56px))) !important;
    min-width: 0 !important;
    max-width: var(--nx-drawer-w, min(300px, calc(100vw - 56px))) !important;
    padding-top: 0 !important;
  }

  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.settings.show-sidebar .left-sidebar.settings-menu .nx-settings-drawer-brand .exit-panel,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.settings.show-sidebar .left-sidebar.settings-menu .nx-settings-drawer-brand .nx-settings-exit-panel {
    display: flex !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: calc(100% - 3rem) !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
  }

  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.settings.show-sidebar .left-sidebar.settings-menu .nx-settings-exit-link {
    display: inline-flex !important;
    align-items: center !important;
    gap: 10px !important;
    max-width: 100% !important;
    min-height: 2.5rem !important;
    padding: 6px 10px !important;
    margin: 0 !important;
    border-radius: 12px !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    background: rgba(255, 255, 255, 0.04) !important;
    color: rgba(245, 248, 255, 0.92) !important;
    text-decoration: none !important;
  }

  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.settings.show-sidebar .left-sidebar.settings-menu .nx-settings-exit-icon {
    font-size: 1.25rem !important;
    color: inherit !important;
  }

  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.settings.show-sidebar .nx-midnight-right-panel.nx-settings-right-panel::before {
    content: "" !important;
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0, 0, 0, 0.58) !important;
    z-index: 1000 !important;
    pointer-events: auto !important;
    touch-action: none !important;
  }

  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.settings.show-sidebar .left-sidebar.settings-menu,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.settings.show-sidebar .nx-midnight-right-panel.nx-settings-right-panel::before {
    pointer-events: auto !important;
  }
}
/* Settings phone: close button chrome (parity with CRM custom.css) */
@media (max-width: 767.98px) {
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.settings .left-sidebar.settings-menu .nx-mobile-sidebar-close {
    display: none !important;
  }
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.settings.show-sidebar .left-sidebar.settings-menu .nx-mobile-sidebar-close {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 2.25rem !important;
    width: 2.25rem !important;
    height: 2.25rem !important;
    margin: 0 0 0 auto !important;
    padding: 0 !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.06) !important;
    color: rgba(245, 248, 255, 0.88) !important;
    cursor: pointer !important;
    line-height: 1 !important;
    box-shadow: none !important;
    position: relative !important;
    z-index: 7 !important;
    pointer-events: auto !important;
  }
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.settings.show-sidebar .left-sidebar.settings-menu .nx-mobile-sidebar-close .ti-close {
    font-size: 0.95rem !important;
    padding: 0 !important;
    line-height: 1 !important;
  }
}
/* Tablet + desktop: never show drawer close X (phone keeps it) */
@media (min-width: 768px) {
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin .left-sidebar .nx-mobile-sidebar-close,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.loggedin.show-sidebar .left-sidebar .nx-mobile-sidebar-close,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.settings .left-sidebar.settings-menu .nx-mobile-sidebar-close,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.settings.show-sidebar .left-sidebar.settings-menu .nx-mobile-sidebar-close {
    display: none !important;
  }
}

/* Tablet + desktop Settings: brand outside scroll — keep rail flex so menu scrolls */
@media (min-width: 768px) {
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.settings.nx-midnight-premium-shell .left-sidebar.settings-menu {
    display: flex !important;
    flex-direction: column !important;
  }
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.settings.nx-midnight-premium-shell .left-sidebar.settings-menu .scroll-sidebar,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.settings.nx-midnight-premium-shell .left-sidebar.settings-menu #settings-scroll-sidebar {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    body.settings.nx-midnight-premium-shell .left-sidebar.settings-menu .nx-settings-exit-panel {
    margin-bottom: 10px !important;
  }
}