:root {
  --sidebar-expanded-width: 300px;
  --sidebar-collapsed-width: 80px;
}

.sidebar-wrapper {
  transition: left 0.3s ease, width 0.25s ease;
}

.sidebar-topbar {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  min-height: 40px;
}

.sidebar-brand {
  min-width: 0;
}

.sidebar-brand img {
  max-width: 150px;
  object-fit: contain;
}

.sidebar-controls {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 0.375rem;
}

.sidebar-control-button {
  align-items: center;
  background: #f1f3f9;
  border: 1px solid #dce2f1;
  border-radius: 6px;
  color: #25396f;
  cursor: pointer;
  display: inline-flex;
  height: 32px;
  justify-content: center;
  padding: 0;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  width: 32px;
}

.sidebar-control-button:hover {
  background: #e6e9f4;
  border-color: #c7cee1;
}

.sidebar-control-button:focus-visible,
.sidebar-profile-link:focus-visible,
.sidebar-notification-link:focus-visible,
.sidebar-wrapper .sidebar-link:focus-visible,
.sidebar-menu-group-toggle:focus-visible,
.sidebar-wrapper .btn-organizations:focus-visible {
  box-shadow: 0 0 0 3px rgba(67, 94, 190, 0.3);
  outline: 2px solid #435ebe;
  outline-offset: 2px;
}

.sidebar-control-button i {
  font-size: 1rem;
  line-height: 1;
}

body.theme-dark .sidebar-control-button {
  background: #252538;
  border-color: #3b3b52;
  color: #f2f4ff;
}

body.theme-dark .sidebar-control-button:hover {
  background: #303048;
  border-color: #51516b;
}

.box-profile {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  min-height: 76px;
  position: relative;
}

.sidebar-master-badge {
  left: 1rem;
  position: absolute;
  top: -10px;
}

.sidebar-profile-link {
  align-items: center;
  color: inherit;
  display: flex;
  flex: 1 1 auto;
  gap: 0.625rem;
  min-width: 0;
  text-decoration: none;
}

.sidebar-profile-link:hover {
  color: inherit;
}

.box-profile .sidebar-profile-avatar {
  align-items: center;
  background: #435ebe;
  border: 1px solid #d7ddec;
  border-radius: 50%;
  display: inline-flex;
  flex: 0 0 42px;
  height: 42px;
  justify-content: center;
  margin: 0;
  overflow: hidden;
  position: relative;
  width: 42px;
}

.sidebar-profile-image {
  height: 100%;
  inset: 0;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  position: absolute;
  transition: opacity 0.15s ease;
  width: 100%;
}

.sidebar-profile-image--loaded {
  opacity: 1;
}

.sidebar-profile-fallback {
  align-items: center;
  color: #fff;
  display: flex;
  font-size: 0.78rem;
  font-weight: 700;
  height: 100%;
  justify-content: center;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
  width: 100%;
}

.sidebar-profile-fallback i {
  font-size: 1.15rem;
  line-height: 1;
}

body.theme-dark .box-profile .sidebar-profile-avatar {
  background: #526ed1;
  border-color: #777d9c;
}

.box-info-user-logged {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
}

.sidebar-profile-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-profile-badges {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.25rem;
  min-width: 0;
}

.sidebar-profile-badges .badge:first-child {
  max-width: 125px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-notification-link {
  align-items: center;
  color: #25396f;
  display: inline-flex;
  flex: 0 0 32px;
  height: 32px;
  justify-content: center;
  position: relative;
  text-decoration: none;
  width: 32px;
}

body.theme-dark .sidebar-notification-link {
  color: #c8cbe2;
}

.sidebar-notification-link .icon-notification {
  font-size: 1.25rem;
}

.sidebar-notification-link .badge-notification {
  border: 1px solid #fff;
  border-radius: 999px;
  font-size: 0.625rem;
  line-height: 1;
  min-width: 17px;
  padding: 0.2rem 0.3rem;
  position: absolute;
  right: -3px;
  top: -3px;
  z-index: 1;
}

.sidebar-item-organization .dropdown,
.sidebar-item-organization .btn-organizations {
  width: 100%;
}

.sidebar-item-organization .btn-organizations {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  justify-content: flex-start;
  min-height: 40px;
  overflow: hidden;
  text-align: left;
}

body.theme-dark .sidebar-organization-toggle {
  background-color: #252538;
  border-color: #7f86a6;
  color: #f2f4ff;
}

body.theme-dark .sidebar-organization-toggle:hover,
body.theme-dark .sidebar-organization-toggle:focus,
body.theme-dark .sidebar-organization-toggle[aria-expanded="true"] {
  background-color: #303048;
  border-color: #a2a8c4;
  color: #fff;
}

.sidebar-organization-icon {
  align-items: center;
  display: inline-flex;
  flex: 0 0 24px;
  height: 24px;
  justify-content: center;
  margin: 0;
  width: 24px;
}

.sidebar-organization-icon img {
  max-height: 22px;
  max-width: 24px;
  object-fit: contain;
}

.sidebar-organization-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-item-counter {
  margin: 0 !important;
  position: absolute;
  right: 10px;
}

.sidebar-menu-group {
  list-style: none;
  margin-top: 0.5rem;
}

.sidebar-menu-group-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 0.5rem;
  color: #25396f;
  cursor: pointer;
  display: flex;
  font-size: 1rem;
  font-weight: 600;
  gap: 1rem;
  justify-content: flex-start;
  letter-spacing: 0;
  min-height: 44px;
  padding: 0.7rem 1rem;
  text-align: left;
  transition: background-color 0.15s ease, color 0.15s ease;
  width: 100%;
}

.sidebar-menu-group-toggle:hover,
.sidebar-menu-group--active > .sidebar-menu-group-content > .sidebar-menu-group-toggle {
  background-color: #f0f1f5;
}

.sidebar-menu-group-toggle > i:first-child {
  color: #7c8db5;
  flex: 0 0 auto;
  font-size: 1rem;
  line-height: 1;
}

.sidebar-menu-group-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-menu-group-indicator {
  flex: 0 0 auto;
  font-size: 0.75rem;
  margin-left: auto;
  transition: transform 0.2s ease;
}

.sidebar-menu-group-indicator.is-expanded {
  transform: rotate(180deg);
}

.sidebar-menu-group-modules {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-menu-group-modules .sidebar-item:first-child {
  margin-top: 0.25rem;
}

.sidebar-menu-group-modules .sidebar-link {
  font-size: 0.92rem !important;
  padding-left: 2rem !important;
}

body.theme-dark .sidebar-menu-group-toggle {
  color: #c8cbe2;
}

body.theme-dark .sidebar-menu-group-toggle:hover,
body.theme-dark .sidebar-menu-group--active > .sidebar-menu-group-content > .sidebar-menu-group-toggle {
  background-color: #252538;
}

#main,
#main .page-heading.fixed-top {
  transition: margin-left 0.25s ease;
}

@media screen and (min-width: 1200px) {
  body.sidebar-collapsed #sidebar.active .sidebar-wrapper {
    width: var(--sidebar-collapsed-width);
  }

  body.sidebar-collapsed #sidebar.active ~ #main:not(.embedded) {
    margin-left: var(--sidebar-collapsed-width);
  }

  body.sidebar-collapsed #sidebar.active ~ #main:not(.embedded) .page-heading.fixed-top {
    margin-left: var(--sidebar-collapsed-width);
  }

  body.sidebar-collapsed .sidebar-wrapper .sidebar-header {
    padding: 1rem 0.5rem !important;
  }

  body.sidebar-collapsed .sidebar-topbar {
    justify-content: center;
  }

  body.sidebar-collapsed .sidebar-brand,
  body.sidebar-collapsed .sidebar-title,
  body.sidebar-collapsed .sidebar-menu-group-name,
  body.sidebar-collapsed .sidebar-menu-group-indicator,
  body.sidebar-collapsed .sidebar-link-label,
  body.sidebar-collapsed .box-info-user-logged,
  body.sidebar-collapsed .sidebar-master-badge,
  body.sidebar-collapsed .sidebar-organization-name,
  body.sidebar-collapsed .alert-trial {
    display: none !important;
  }

  body.sidebar-collapsed .sidebar-wrapper .menu {
    margin-top: 0.75rem !important;
    padding: 0 0.625rem !important;
  }

  body.sidebar-collapsed .sidebar-wrapper .menu .sidebar-item {
    margin-top: 0.375rem;
  }

  body.sidebar-collapsed .sidebar-menu-group {
    border-top: 1px solid #e3e6ef;
    margin-top: 0.75rem;
    padding-top: 0.375rem;
  }

  body.theme-dark.sidebar-collapsed .sidebar-menu-group {
    border-top-color: #303044;
  }

  body.sidebar-collapsed .sidebar-wrapper .menu .sidebar-link {
    align-items: center;
    height: 48px;
    justify-content: center;
    padding: 0;
    width: 100%;
  }

  body.sidebar-collapsed .sidebar-menu-group-toggle {
    height: 48px;
    justify-content: center;
    padding: 0;
  }

  body.sidebar-collapsed .sidebar-menu-group-toggle > i:first-child {
    font-size: 1.25rem;
  }

  body.sidebar-collapsed .sidebar-menu-group-modules .sidebar-link {
    padding: 0 !important;
  }

  body.sidebar-collapsed .sidebar-wrapper .menu .sidebar-link i {
    font-size: 1.25rem;
    line-height: 1;
  }

  body.sidebar-collapsed .sidebar-wrapper .menu .sidebar-link i::before {
    vertical-align: middle;
  }

  body.sidebar-collapsed .box-profile {
    flex-direction: column;
    gap: 0.375rem;
    min-height: 112px;
    padding: 0.75rem 0.625rem;
  }

  body.sidebar-collapsed .sidebar-profile-link {
    flex: 0 0 44px;
    justify-content: center;
    width: 44px;
  }

  body.sidebar-collapsed .sidebar-notification-link {
    flex-basis: 36px;
    height: 36px;
    width: 36px;
  }

  body.sidebar-collapsed .sidebar-organization-menu {
    border-bottom: 1px solid #ebebeb;
    padding-bottom: 0.75rem !important;
  }

  body.theme-dark.sidebar-collapsed .sidebar-organization-menu {
    border-bottom-color: #303044;
  }

  body.sidebar-collapsed .sidebar-item-organization .btn-organizations {
    height: 46px;
    justify-content: center;
    min-height: 46px;
    padding: 0;
  }

  body.sidebar-collapsed .sidebar-item-organization .dropdown-toggle::after {
    bottom: 3px;
    margin: 0;
    position: absolute;
    right: 4px;
  }

  body.sidebar-collapsed .sidebar-item-organization .dropdown-menu {
    min-width: 230px;
  }

  body.sidebar-collapsed .sidebar-item-counter {
    font-size: 0.55rem;
    line-height: 1;
    min-width: 17px;
    padding: 0.2rem 0.3rem;
    right: -4px;
    top: -4px;
  }
}

@media screen and (max-width: 1199px) {
  .sidebar-collapse-control {
    display: none;
  }

  .sidebar-topbar {
    padding-right: 48px;
  }

  .sidebar-wrapper .sidebar-toggler.x {
    top: 16px !important;
  }
}

#main.embedded,
#main.embedded .page-heading.fixed-top,
body.theme-dark #main.embedded,
body.theme-dark #main.embedded .page-heading.fixed-top {
  margin-left: 0;
}

@media print {
  .sidebar-controls {
    display: none !important;
  }

  body.theme-dark #main,
  body.theme-dark #main.embedded,
  body.theme-dark #main .page-heading.fixed-top {
    margin-left: 0 !important;
  }

  body.theme-dark #main {
    padding: 0 !important;
  }
}
