/* Midnight CRM — right filter / table-settings sheets
   Visual rails from SaaS settings submenu (nx-saas-section-nav__chrome). */
:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) {
  --nx-rs-pt: #c5cdd8;
  top: 0.75rem !important;
  bottom: 0.75rem !important;
  height: auto !important;
  max-height: calc(100vh - 1.5rem) !important;
  border-radius: 1.05rem !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.055) 0%, rgba(255, 255, 255, 0.018) 42%, rgba(0, 0, 0, 0.28) 100%),
    rgba(20, 20, 20, 0.58) !important;
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  backdrop-filter: blur(24px) saturate(150%);
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
  overflow: hidden;
  isolation: isolate;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar.shw-rside:not(#sidepanel-notifications) {
  right: 0.75rem !important;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .slimscrollright,
:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .r-panel-body {
  background: transparent !important;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .rpanel-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 1.1rem 1.1rem 0.9rem !important;
  margin: 0;
  color: rgba(255, 255, 255, 0.92) !important;
  font-size: 1.02rem !important;
  font-weight: 600 !important;
  letter-spacing: -0.02em;
  text-transform: none !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .rpanel-title > i:not(.ti-close) {
  color: var(--nx-rs-pt);
  opacity: 0.82;
  font-size: 1.05rem !important;
  padding-right: 0 !important;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .rpanel-title span {
  margin-left: auto;
  float: none;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .rpanel-title .ti-close,
:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .js-close-side-panels {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.72) !important;
  font-size: 0.78rem !important;
  padding: 0 !important;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .rpanel-title .ti-close:hover,
:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .js-close-side-panels:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  color: #fff !important;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .filter-block {
  margin-bottom: 1.05rem;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .filter-block .title {
  font-size: 0.65rem !important;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.38) !important;
  font-weight: 600 !important;
  margin-bottom: 0.4rem;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .form-control,
:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .form-control-sm,
:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) select.form-control {
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: rgba(245, 248, 255, 0.9) !important;
  border-radius: 10px !important;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .form-control:focus,
:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .form-control-sm:focus {
  border-color: rgba(197, 205, 216, 0.85) !important;
  box-shadow: 0 0 0 0.15rem rgba(197, 205, 216, 0.22) !important;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .select2-container--default .select2-selection--single,
:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .select2-container--bootstrap .select2-selection--single {
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 10px !important;
  min-height: 40px !important;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .modal-selector,
:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .nx-filter-remember-card {
  margin: 0.15rem 0 1rem !important;
  padding: 0.85rem 0.95rem !important;
  border-radius: 0.85rem !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.02) 55%, rgba(0, 0, 0, 0.14) 100%),
    rgba(255, 255, 255, 0.03) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .nx-filter-remember-card .form-group-checkbox,
:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .modal-selector .form-group-checkbox {
  margin: 0 !important;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .form-group-checkbox {
  display: flex;
  align-items: center;
  margin-bottom: 0;
  min-height: 31px;
}

/* Filter switches: real track + knob (Materialize filled-in ::before/::after hides the ON thumb). */
:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .nx-filter-switch__label {
  display: flex !important;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 31px;
  margin: 0 !important;
  padding: 0 !important;
  position: relative !important;
  color: rgba(245, 248, 255, 0.88) !important;
  font-size: 0.86rem !important;
  font-weight: 500;
  line-height: 1.35;
  cursor: pointer;
  height: auto !important;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .nx-filter-switch__label::before,
:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .nx-filter-switch__label::after {
  content: none !important;
  display: none !important;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .nx-filter-switch__text {
  flex: 1 1 auto;
  min-width: 0;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .nx-filter-switch input[type="checkbox"] {
  position: absolute !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  pointer-events: none;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .nx-filter-switch__track {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  box-sizing: border-box;
  flex: 0 0 51px;
  width: 51px;
  height: 31px;
  padding: 0 2px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: none;
  pointer-events: none;
  transition: background 150ms ease, box-shadow 150ms ease, justify-content 150ms ease;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .nx-filter-switch__knob {
  flex: 0 0 27px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .nx-filter-switch input[type="checkbox"]:checked + .nx-filter-switch__track {
  justify-content: flex-end;
  background: linear-gradient(135deg, #c5cdd8 0%, #9aa5b4 100%);
  box-shadow: 0 0 0 1px rgba(197, 205, 216, 0.35);
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .buttons-block {
  padding: 0.9rem 0 0.2rem;
  margin-top: 0.35rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .buttons-block .btn-secondary {
  background: rgba(197, 205, 216, 0.12) !important;
  border: 1px solid rgba(197, 205, 216, 0.22) !important;
  color: #e8edf3 !important;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .buttons-block .btn-secondary:hover {
  background: rgba(197, 205, 216, 0.2) !important;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) label,
:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .custom-control-description {
  color: rgba(245, 248, 255, 0.82) !important;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .text-muted {
  color: rgba(255, 255, 255, 0.42) !important;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .slimScrollRail,
:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .ps__rail-x,
:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .ps__rail-y,
:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .ps__thumb-x,
:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .ps__thumb-y {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar:not(#sidepanel-notifications) .slimScrollBar {
  background: rgba(197, 205, 216, 0.28) !important;
  width: 5px !important;
  right: 4px !important;
  border-radius: 999px !important;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar[id^="table-config-"] .p-b-5,
:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar .table-config-ajax .p-b-5,
:is(html.midnight, html[data-bs-theme="midnight"]) #sidepanel-tickets-column-order li {
  margin: 0 0 0.2rem !important;
  padding: 0.5rem 0.7rem !important;
  border-radius: 0.65rem;
  border: 1px solid transparent;
  transition: background 0.18s ease, border-color 0.18s ease;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar[id^="table-config-"] .p-b-5:hover,
:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar .table-config-ajax .p-b-5:hover,
:is(html.midnight, html[data-bs-theme="midnight"]) #sidepanel-tickets-column-order li:hover {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.04);
}

:is(html.midnight, html[data-bs-theme="midnight"]) #sidepanel-tickets-column-order li {
  cursor: grab;
  color: rgba(245, 248, 255, 0.86);
}

/* Table settings: SaaS general-settings nexora switch, platinum on */
:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar .table-config-checkbox-container {
  display: flex !important;
  align-items: center;
  width: 100%;
  margin: 0 !important;
  padding: 0 !important;
  min-height: 31px;
  cursor: pointer;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar .table-config-checkbox-container .custom-control-input {
  position: absolute !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  pointer-events: none;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar .table-config-checkbox-container .custom-control-description {
  order: 1;
  flex: 1 1 auto;
  padding: 0 !important;
  margin: 0 !important;
  color: rgba(245, 248, 255, 0.88) !important;
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.35;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar .table-config-checkbox-container .custom-control-indicator {
  order: 2;
  position: relative !important;
  flex: 0 0 51px;
  width: 51px !important;
  height: 31px !important;
  margin: 0 0 0 auto !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 9999px !important;
  background: rgba(255, 255, 255, 0.14) !important;
  background-image: none !important;
  box-shadow: none !important;
  pointer-events: none;
  transition: background 150ms ease, box-shadow 150ms ease;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar .table-config-checkbox-container .custom-control-indicator::before {
  content: none !important;
  display: none !important;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar .table-config-checkbox-container .custom-control-indicator::after {
  content: "";
  position: absolute;
  width: 27px;
  height: 27px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  z-index: 2;
  transition: transform 150ms ease;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar .table-config-checkbox-container .custom-control-input:checked ~ .custom-control-indicator {
  background-color: #c5cdd8 !important;
  background-image: linear-gradient(135deg, #c5cdd8 0%, #9aa5b4 100%) !important;
  box-shadow: 0 0 0 1px rgba(197, 205, 216, 0.35) !important;
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar .table-config-checkbox-container .custom-control-input:checked ~ .custom-control-indicator::after {
  transform: translateX(20px);
}

:is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar .table-config-checkbox-container .custom-control-input:focus-visible ~ .custom-control-indicator {
  box-shadow: 0 0 0 2px rgba(197, 205, 216, 0.55) !important;
}

@media (max-width: 767.98px) {
  :is(html.midnight, html[data-bs-theme="midnight"]) .right-sidebar.shw-rside:not(#sidepanel-notifications) {
    width: calc(100vw - 1rem) !important;
    max-width: 400px;
    right: 0.5rem !important;
    top: 0.5rem !important;
    bottom: 0.5rem !important;
    max-height: calc(100vh - 1rem) !important;
  }
}

/* =============================================================================
   Notifications panel — opaque midnight (search-modal parity), mobile-safe width
   marker: nx-notify-midnight-20260913a
   ============================================================================= */
:is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
  :is(#sidepanel-notifications, .dashboard-events) {
  --nx-notify-fg: rgba(245, 248, 255, 0.96);
  --nx-notify-muted: rgba(198, 206, 220, 0.72);
  --nx-notify-card-bg: #1a1a1a;
  --nx-notify-card-bg-hover: #222222;
  --nx-notify-card-border: rgba(255, 255, 255, 0.12);
  --nx-notify-card-shadow:
    0 10px 28px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --nx-notify-icon-bg: #1a1a1a;
  --nx-notify-shell-bg: #121212;
  --nx-notify-shell-blur: none;
  --nx-notify-card-glass: none;
}

:is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
  #sidepanel-notifications.right-sidebar {
  background: #121212 !important;
  background-color: #121212 !important;
  background-image: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 16px !important;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(197, 205, 216, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
  top: 16px !important;
  bottom: 16px !important;
  height: auto !important;
  max-height: calc(100vh - 32px) !important;
  overflow: hidden !important;
  isolation: isolate !important;
  z-index: 1050 !important;
}

:is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
  #sidepanel-notifications.right-sidebar.shw-rside,
:is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
  #sidepanel-notifications.right-sidebar.shw-rside.sidebar-md {
  /* never wider than viewport (sidebar-md is 480px and overflows phones) */
  right: 16px !important;
  width: min(400px, calc(100vw - 32px)) !important;
  max-width: calc(100vw - 32px) !important;
  box-sizing: border-box !important;
}

:is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
  #sidepanel-notifications .slimscrollright,
:is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
  #sidepanel-notifications .r-panel-body,
:is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
  #sidepanel-notifications .topevent {
  background: #121212 !important;
  background-color: #121212 !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

:is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
  #sidepanel-notifications .rpanel-title {
  background: #121212 !important;
  background-color: #121212 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: rgba(245, 248, 255, 0.96) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  padding: 16px 16px 12px !important;
  box-sizing: border-box !important;
}

:is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
  #sidepanel-notifications .rpanel-title .x-top {
  color: rgba(245, 248, 255, 0.96) !important;
}

:is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
  #sidepanel-notifications .rpanel-title .ti-close,
:is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
  #sidepanel-notifications .js-close-side-panels {
  color: rgba(245, 248, 255, 0.72) !important;
}

:is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
  #sidepanel-notifications .rpanel-title .x-top-nav .right-sidepanel-menu {
  color: rgba(198, 206, 220, 0.72) !important;
}

:is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
  #sidepanel-notifications .rpanel-title .x-top-nav .right-sidepanel-menu.active {
  color: #c5cdd8 !important;
  border-bottom-color: #c5cdd8 !important;
}

:is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
  #sidepanel-notifications .r-panel-body {
  padding-left: 16px !important;
  padding-right: 16px !important;
  box-sizing: border-box !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
}

:is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
  #sidepanel-notifications img,
:is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
  #sidepanel-notifications .page-notification {
  max-width: 100% !important;
  height: auto !important;
}

@media (max-width: 767.98px) {
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    #sidepanel-notifications.right-sidebar.shw-rside,
  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    #sidepanel-notifications.right-sidebar.shw-rside.sidebar-md {
    top: 16px !important;
    bottom: 16px !important;
    right: 16px !important;
    left: auto !important;
    width: calc(100vw - 32px) !important;
    max-width: calc(100vw - 32px) !important;
    max-height: calc(100vh - 32px) !important;
    border-radius: 14px !important;
  }

  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    #sidepanel-notifications .rpanel-title {
    padding: 14px 14px 10px !important;
  }

  :is(html[data-bs-theme="midnight"], html.midnight:not(.AUR):not(.aur))
    #sidepanel-notifications .r-panel-body {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }
}
