/* The sidebar shell is independent of article tabs and dialog layouts. */
.app-shell.has-sidebar {
  --sidebar-width: 280px;
}

.has-sidebar .sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 0;
  width: var(--sidebar-width);
  height: 100vh;
  height: 100dvh;
  padding: 18px 14px max(12px, env(safe-area-inset-bottom));
  overflow: hidden;
  background: var(--navy);
  border-right: 1px solid #243857;
}

.has-sidebar .sidebar[hidden],
.has-sidebar .sidebar-backdrop[hidden] {
  display: none !important;
}

.has-sidebar .sidebar-header {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  padding: 0 2px 18px;
}

.has-sidebar .sidebar-header .brand {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  margin: 0;
}

.has-sidebar .sidebar-header .brand-heading {
  gap: 9px;
  font-size: 28px;
  line-height: 1.2;
}

.has-sidebar .sidebar-header .brand img {
  width: 48px;
  height: 48px;
}

.has-sidebar .sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  padding: 6px 6px 16px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #657b9e transparent;
  scroll-padding-block: 6px;
}

.has-sidebar .workspace-label {
  display: block;
  margin: 0 10px 7px;
}

.has-sidebar .workspace-control {
  width: 100%;
  max-width: none;
  margin: 0 0 16px;
  justify-self: auto;
}

.has-sidebar .workspace-control select {
  min-height: 42px;
  padding: 9px 10px;
  font-size: 14px;
}

.has-sidebar .sidebar nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-column: auto;
  justify-content: stretch;
  gap: 4px;
  margin: 0;
  padding: 0;
  overflow: visible;
}

.has-sidebar .nav-button {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  gap: 10px;
  font-size: 14px;
  line-height: 1.35;
  white-space: normal;
}

.has-sidebar .nav-button > span:not(.count) {
  min-width: 0;
  overflow-wrap: anywhere;
}

.has-sidebar .nav-button .icon {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
}

.has-sidebar .nav-button .count {
  display: inline-flex;
  justify-content: center;
  flex-shrink: 0;
  margin-left: auto;
}

.has-sidebar .workspace-management-tools {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px solid #2c4163;
}

.has-sidebar .sidebar-section-label {
  margin: 18px 0 6px;
  padding: 14px 10px 0;
  border-top: 1px solid #2c4163;
  color: #a6b9d5;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.has-sidebar .sidebar-section-label + .workspace-management-tools {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.has-sidebar .workspace-tool {
  display: block;
  width: 100%;
  min-height: 38px;
  padding: 9px 10px;
  font-size: 13px;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
}

.has-sidebar .sidebar-footer {
  flex: 0 0 auto;
  min-width: 0;
  padding: 8px 2px 0;
  border-top: 1px solid #2c4163;
}

.has-sidebar .sidebar-note {
  display: block;
  margin: 0;
  padding: 3px 8px 9px;
  font-size: 12px;
  line-height: 1.4;
}

.has-sidebar .sidebar-note strong {
  margin: 0;
  font-size: 13px;
}

.has-sidebar .sidebar-footer .profile {
  display: flex;
  width: 100%;
  min-height: 52px;
  padding: 10px 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #d7e1f6;
  text-align: left;
  cursor: pointer;
}

.has-sidebar .sidebar-footer .profile:hover {
  background: #ffffff12;
}

.has-sidebar .profile .avatar,
.has-sidebar .profile-avatar {
  flex-shrink: 0;
}

.has-sidebar .sidebar-footer .profile > :last-child {
  flex: 1 1 auto;
  min-width: 0;
}

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

.has-sidebar .profile .email {
  white-space: nowrap;
}

.has-sidebar .main-shell {
  min-width: 0;
  margin-left: var(--sidebar-width);
}

.has-sidebar.sidebar-collapsed .main-shell {
  margin-left: 0;
}

.has-sidebar .topbar-start {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.has-sidebar .sidebar-toggle,
.has-sidebar .sidebar-home {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid #dce4f0;
  border-radius: 9px;
  background: #fff;
  color: #344b6b;
  line-height: 1.4;
  cursor: pointer;
}

.has-sidebar .sidebar-toggle {
  width: 44px;
  padding: 9px;
}

.has-sidebar .sidebar-home {
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.has-sidebar .sidebar-toggle .icon,
.has-sidebar .sidebar-home .icon {
  width: 20px;
  height: 20px;
}

.has-sidebar .sidebar-toggle:hover,
.has-sidebar .sidebar-home:hover {
  background: #f0f5fc;
  color: var(--blue-dark);
}

.has-sidebar .sidebar-header .sidebar-toggle {
  border-color: #3a4e6f;
  background: transparent;
  color: #d7e1f6;
}

.has-sidebar .sidebar-header .sidebar-toggle:hover {
  background: #ffffff15;
  color: #fff;
}

.has-sidebar .sidebar-toggle:focus-visible,
.has-sidebar .sidebar-home:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.has-sidebar .sidebar :is(button, select):focus-visible {
  outline: 3px solid #a8c7ff;
  outline-offset: 2px;
}

.has-sidebar .topbar-start .breadcrumb {
  flex: 1 1 auto;
  min-width: 0;
  margin-left: 3px;
}

.has-sidebar .breadcrumb > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.has-sidebar .sidebar-backdrop {
  display: none;
}

@media (max-width: 1000px) {
  body:has(.app-shell.has-sidebar.sidebar-mobile-open) {
    overflow: hidden;
  }

  .has-sidebar .sidebar {
    width: min(300px, calc(100vw - 24px));
    padding: 18px 14px max(12px, env(safe-area-inset-bottom));
    box-shadow: 12px 0 38px #11234540;
  }

  .has-sidebar .main-shell {
    margin-left: 0;
  }

  .has-sidebar .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: #0b193a66;
    cursor: pointer;
    touch-action: none;
  }
}

@media (max-width: 540px) {
  .has-sidebar .topbar-start {
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }

  .has-sidebar .topbar-start .breadcrumb {
    flex-basis: 100%;
    margin: 2px 0 0;
  }
}

@media (max-height: 620px) {
  .has-sidebar .sidebar-header {
    padding-bottom: 12px;
  }

  .has-sidebar .sidebar-footer .sidebar-note {
    display: none;
  }
}
