/* Course home / portal: compact pill; desktop sits in the page header, not the sidebar. */
.unit-sidebar__head {
  align-items: center;
  justify-content: flex-end;
}

.unit-sidebar__nav-links {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0;
  min-width: 0;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(88, 168, 222, 0.22);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(88, 168, 222, 0.08);
}

.unit-sidebar__head .unit-sidebar__nav-links {
  flex: 1;
}

.unit-sidebar__home,
.unit-sidebar__portal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 0;
  white-space: nowrap;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  transform: none;
  font-size: 0.78rem;
  line-height: 1.2;
  padding: 0.4rem 0.75rem;
  text-decoration: none;
}

.unit-sidebar__head .unit-sidebar__home,
.unit-sidebar__head .unit-sidebar__portal {
  flex: 1 1 0;
  font-size: 0.72rem;
  padding: 0.42rem 0.4rem;
}

.unit-sidebar__home {
  font-weight: 700;
  color: #3d4a5c;
  border-right: 1px solid rgba(88, 168, 222, 0.18);
}

.unit-sidebar__portal {
  font-weight: 600;
  color: #6b6560;
}

.unit-sidebar__home:hover,
.unit-sidebar__portal:hover {
  transform: none;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.95);
}

.unit-sidebar__home:hover {
  color: #3d6a94;
}

.unit-sidebar__portal:hover {
  color: #c45c12;
  border-color: transparent;
}

.unit-sidebar__home.is-active {
  color: #2f5a44;
  background: color-mix(in srgb, var(--macaron-3, #d4f0e4) 70%, #fff);
  border-color: transparent;
  box-shadow: none;
}

.article-head__aside .unit-sidebar__nav-links,
.yuedu-page-toolbar .unit-sidebar__nav-links,
.unit-page-nav .unit-sidebar__nav-links {
  flex: 0 0 auto;
}

.unit-page-nav {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0.55rem 0.75rem;
  margin: 0 0 0.9rem;
}

.unit-page-nav .back,
.unit-page-nav .back--unit {
  margin-bottom: 0;
}

.unit-page-nav .unit-sidebar__page-toggle {
  margin-left: auto;
}

@media (max-width: 860px) {
  .unit-page-nav .unit-sidebar__nav-links {
    margin-left: 0;
  }

  .unit-sidebar__home,
  .unit-sidebar__portal {
    font-size: 0.78rem;
    padding: 0.4rem 0.5rem;
  }
}
