layer-avatar {
  span, img {
    background-color: white;
    border: solid 1px rgba(0, 0, 0, 0.1);
  }
  &.layer-has-user {
    position: relative;
    overflow: hidden;
    text-align: center;
  }

  layer-presence {
    width: 16px;
    height: 16px;

    &:before {
      content: " ";
      border: solid 2px white;
      position: absolute;
      border-radius: 16px;
      top: -2px;
      bottom: -2px;
      left: -2px;
      right: -2px;
    }
    &.layer-presence-offline:before,
    &.layer-presence-invisible:before {
      content: " ";
      border: solid 2px white;
      position: absolute;
      top: -6px;
      bottom: -6px;
      left: -6px;
      right: -6px;
    }
  }

  span, img {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border-width: 1px;
  }

  &.layer-avatar-cluster > * {
      position: absolute;
  }

  &.layer-avatar-cluster > *:after {
    content: '';
    position: absolute;
  }

  &.layer-avatar-cluster > *:after {
    top: -3px;
    left: -3px;
    bottom: -3px;
    right: -3px;
    border: 2px white solid;
    border-radius: 50%;
  }
}

/* Larger Avatar */
layer-conversations-list, layer-identities-list, layer-membership-list {
  layer-avatar {
    height: 50px;
    width: 50px;
    min-width: 50px;
    line-height: 50px;
    font-size: 16px;

    span, img {
      height: 48px;
      width: 48px;
    }

  /* Clustered Avatars for Group Chats */
    &.layer-avatar-cluster > * {
      height: 70%;
      width: 70%;
      font-size: 0.7em;
    }

    &.layer-avatar-cluster > *:nth-child(2) {
      margin-left: 25%;
      margin-top: 25%;
      z-index: 2;
    }
  }
}

/* Smaller Avatar */
layer-messages-list {
  layer-avatar {
    height: 40px;
    width: 40px;
    min-width: 40px;
    line-height: 40px;
    font-size: 16px;

    span, img {
      height: 38px;
      width: 38px;
    }

  /* Clustered Avatars for Group Chats */
    &.layer-avatar-cluster > * {
      height: 66%;
      width: 66%;
      font-size: 0.7em;
    }

    &.layer-avatar-cluster > *:nth-child(2) {
      margin-left: 33%;
      margin-top: 33%;
      z-index: 2;
    }
  }
}