/* Shared responsive application shell. Loaded last so it can safely correct
   the legacy theme's fixed desktop offsets and <=1024px sidebar removal. */
:root {
  --bde-header-height: 58px;
  --bde-compact-sidebar-width: 72px;
  --bde-mobile-rail-width: 56px;
}

.quick-actions-dropdown,
.bde-sidebar-toggle {
  display: none;
}

.quick-actions-toggle {
  appearance: none;
  cursor: pointer;
}

.quick-actions-menu {
  width: 250px;
  padding: 8px !important;
  border: 1px solid #c6d8e8 !important;
  border-radius: 12px !important;
  background: #fff !important;
  box-shadow: 0 16px 32px -18px rgba(19, 42, 64, 0.78) !important;
}

.quick-actions-title {
  padding: 7px 10px 9px;
  color: #587089;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.quick-actions-menu .dropdown-item {
  display: flex;
  align-items: center;
  min-height: 40px;
  gap: 10px;
  padding: 8px 10px !important;
  border-radius: 8px;
  color: #16324b !important;
  font-size: 14px;
  font-weight: 750;
}

.quick-actions-menu .dropdown-item i {
  width: 18px;
  margin: 0 !important;
  color: #0f81d1;
  text-align: center;
}

.quick-actions-menu .dropdown-item:hover,
.quick-actions-menu .dropdown-item:focus {
  background: #d8effd !important;
  color: #0a6fb5 !important;
}

@media (max-width: 1380px) {
  #navbar.main-navbar {
    display: flex !important;
    align-items: center;
    min-width: 0;
    height: var(--bde-header-height);
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }

  #navbar .form-inline.me-auto {
    min-width: 8px;
    flex: 1 1 auto;
  }

  #navbar .navbar-nav.navbar-right {
    position: static !important;
    display: flex !important;
    width: auto !important;
    margin: 0 !important;
    flex: 0 0 auto;
  }

  #navbar .permissions-nav-item {
    display: none !important;
  }

  #navbar .quick-actions-dropdown {
    display: flex !important;
    align-items: center;
    margin-right: 10px;
  }

  #navbar .quick-actions-toggle {
    max-width: none;
  }

  #navbar-logo-container .navbar-logo-image,
  #navbar-no-sidebar-logo-container .navbar-logo-image {
    width: 158px !important;
    max-width: 158px !important;
  }

  .user-menu-new-styles {
    top: calc(var(--bde-header-height) + 1px) !important;
    right: 8px !important;
  }
}

/* Tablet shell: a permanent slim navigation rail replaces the theme's
   disappearing sidebar. The rail expands into a full overlay drawer. */
@media (max-width: 1199px) {
  html body.bde-responsive-shell .sidebar-brand {
    left: 0 !important;
    top: 0 !important;
    z-index: 1103 !important;
    width: var(--bde-compact-sidebar-width) !important;
    border-right: 1px solid #c6d8e8;
    transition: width 180ms ease;
  }

  body.bde-responsive-shell .sidebar-brand .header-link {
    display: none !important;
  }

  body.bde-responsive-shell .bde-sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    width: 100%;
    height: var(--bde-header-height);
    gap: 5px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #0f81d1;
    cursor: pointer;
  }

  .bde-sidebar-toggle-bars,
  .bde-sidebar-toggle-bars::before,
  .bde-sidebar-toggle-bars::after {
    display: block;
    width: 24px;
    height: 2px;
    border-radius: 99px;
    background: currentColor;
    content: "";
  }

  .bde-sidebar-toggle-bars {
    position: relative;
  }

  .bde-sidebar-toggle-bars::before {
    position: absolute;
    top: -7px;
  }

  .bde-sidebar-toggle-bars::after {
    position: absolute;
    top: 7px;
  }

  .bde-sidebar-toggle-label {
    margin-top: 7px;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  html body.bde-responsive-shell .main-sidebar {
    left: 0 !important;
    top: var(--bde-header-height) !important;
    z-index: 1102 !important;
    width: var(--bde-compact-sidebar-width) !important;
    height: calc(100vh - var(--bde-header-height)) !important;
    margin-top: 0 !important;
    transform: none !important;
    transition: width 180ms ease, box-shadow 180ms ease !important;
    overflow: hidden !important;
  }

  body.bde-responsive-shell .main-sidebar #sidebar-wrapper {
    visibility: hidden;
    width: 286px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease;
  }

  html body.bde-responsive-shell.bde-sidebar-open .sidebar-brand,
  html body.bde-responsive-shell.bde-sidebar-open .main-sidebar {
    width: 286px !important;
  }

  body.bde-responsive-shell.bde-sidebar-open .sidebar-brand {
    background-image: url("../assets/img/logo.png") !important;
    background-position: right 22px center !important;
    background-repeat: no-repeat !important;
    background-size: 156px auto !important;
  }

  body.bde-responsive-shell.bde-sidebar-open .bde-sidebar-toggle {
    width: var(--bde-compact-sidebar-width);
  }

  body.bde-responsive-shell.bde-sidebar-open .main-sidebar {
    box-shadow: 12px 0 30px rgba(19, 42, 64, 0.22) !important;
  }

  body.bde-responsive-shell.bde-sidebar-open .main-sidebar #sidebar-wrapper {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
  }

  body.bde-responsive-shell.bde-sidebar-open::before {
    position: fixed;
    z-index: 1099;
    inset: 0;
    background: rgba(20, 43, 64, 0.22);
    content: "";
  }

  body.bde-responsive-shell #navbar.main-navbar:not(.navbar-no-sidebar),
  body.bde-responsive-shell .navbar-bg {
    left: var(--bde-compact-sidebar-width) !important;
    width: calc(100% - var(--bde-compact-sidebar-width)) !important;
    margin-left: 0 !important;
  }

  body.bde-responsive-shell .main-wrapper .main-content,
  body.bde-responsive-shell .main-wrapper.bde-shell-with-navbar .main-content,
  body.bde-responsive-shell div.main-content,
  body.bde-responsive-shell.sidebar-gone div.main-content,
  body.bde-responsive-shell.sidebar-mini div.main-content,
  html body.bde-responsive-shell #app .main-wrapper #main-content.main-content {
    padding-left: var(--bde-compact-sidebar-width) !important;
  }
}

@media (max-width: 640px) {
  :root {
    --bde-header-height: 56px;
  }

  html body.bde-responsive-shell .sidebar-brand,
  html body.bde-responsive-shell .main-sidebar {
    width: var(--bde-mobile-rail-width) !important;
  }

  html body.bde-responsive-shell.bde-sidebar-open .sidebar-brand,
  html body.bde-responsive-shell.bde-sidebar-open .main-sidebar {
    width: min(286px, calc(100vw - 32px)) !important;
  }

  body.bde-responsive-shell.bde-sidebar-open .bde-sidebar-toggle {
    width: var(--bde-mobile-rail-width);
  }

  body.bde-responsive-shell #navbar.main-navbar:not(.navbar-no-sidebar),
  body.bde-responsive-shell .navbar-bg {
    left: var(--bde-mobile-rail-width) !important;
    width: calc(100% - var(--bde-mobile-rail-width)) !important;
  }

  body.bde-responsive-shell .main-wrapper .main-content,
  body.bde-responsive-shell .main-wrapper.bde-shell-with-navbar .main-content,
  body.bde-responsive-shell div.main-content,
  body.bde-responsive-shell.sidebar-gone div.main-content,
  body.bde-responsive-shell.sidebar-mini div.main-content,
  html body.bde-responsive-shell #app .main-wrapper #main-content.main-content {
    padding-top: var(--bde-header-height) !important;
    padding-left: var(--bde-mobile-rail-width) !important;
  }

  #navbar.main-navbar {
    flex-wrap: nowrap !important;
    padding-right: 7px !important;
    padding-left: 9px !important;
  }

  #navbar-logo-container,
  #navbar-no-sidebar-logo-container {
    width: 126px !important;
    min-width: 0;
    margin-right: 6px;
    flex: 0 1 126px !important;
  }

  #navbar-logo-container .navbar-logo-image,
  #navbar-no-sidebar-logo-container .navbar-logo-image {
    width: 126px !important;
    max-width: 126px !important;
  }

  #navbar .quick-actions-dropdown {
    margin-right: 4px;
  }

  #navbar .quick-actions-toggle {
    width: 38px;
    height: 38px;
    justify-content: center;
    padding: 0;
    border-radius: 9px;
  }

  #navbar .quick-actions-toggle .permissions-nav-label {
    display: none;
  }

  #navbar .nav-link-user {
    height: 44px !important;
    padding: 3px !important;
  }

  #navbar .nav-link-user .user-avatar-image,
  #navbar .user-avatar-fallback {
    width: 36px !important;
    height: 36px !important;
  }

  .quick-actions-menu {
    position: fixed !important;
    top: calc(var(--bde-header-height) + 4px) !important;
    right: 8px !important;
    left: auto !important;
    width: min(280px, calc(100vw - 72px));
    transform: none !important;
  }

  .user-menu-new-styles {
    position: fixed !important;
    top: calc(var(--bde-header-height) + 4px) !important;
    right: 8px !important;
    left: auto !important;
    width: min(250px, calc(100vw - 72px));
    transform: none !important;
  }

  .main-wrapper-no-sidebar #navbar.main-navbar,
  .main-wrapper-no-sidebar .navbar-bg {
    left: 0 !important;
    width: 100% !important;
  }
}

@media (max-width: 360px) {
  #navbar-logo-container,
  #navbar-no-sidebar-logo-container {
    width: 112px !important;
    flex-basis: 112px !important;
  }

  #navbar-logo-container .navbar-logo-image,
  #navbar-no-sidebar-logo-container .navbar-logo-image {
    width: 112px !important;
    max-width: 112px !important;
  }
}
