.cp__header {
  @apply z-10;
  -webkit-app-region: drag;

  padding-top: var(--ls-headbar-inner-top-padding);
  height: calc(var(--ls-headbar-height) + var(--ls-headbar-inner-top-padding));
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  user-select: none;
  line-height: 1;
  white-space: nowrap;

  > .l {
    @apply pl-4;
    width: var(--ls-left-sidebar-width);
    height: 100%;
    align-items: center;
    transition: padding-left .2s;
  }

  > .r {
    @apply pr-4;
    align-items: center;
    flex: 1;
    justify-content: flex-end;
  }

  /* To prevent header glitch on Safari */

  > .l, > .r {
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
  }

  .it svg {
    transform: scale(0.8);
  }

  .button {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: .5;

    .ti {
      font-size: 20px;
    }
  }

  .ui-items-container .button {
    width: auto;
    padding: 0 8px;
  }

  svg.warning {
    transform: scale(0.6);
    color: red;
  }

  &-tips {
    position: absolute;
    padding: 13px 0;
    text-align: center;
    font-weight: 500;
    background: transparent;
    margin-top: 0;
    line-height: 0;
    top: 0;
    left: 40%;
    transform: translateX(-50%);
    z-index: 1000;

    > p {
      color: var(--ls-primary-text-color);
      margin: 0;
      display: inline-flex;
      align-items: center;
      font-size: 14px;
    }

    a {
      color: var(--ls-link-text-color, #045591) !important;
    }

    a.restart {
      position: relative;
      cursor: pointer !important;
      display: flex;
      align-items: center;

      svg {
        color: currentColor !important;
        margin-right: 2px;
      }

      > strong {
        display: inline-block;
        padding-left: 2px;
      }
    }
  }

  .dropdown-wrapper {
    .ti {
      opacity: .9;
    }
  }

  .add-graph-btn {
    border: 1px dashed var(--ls-border-color);
    padding: 0 8px;

    strong {
      padding: 0 10px;
      position: relative;
      top: 1px;
    }
  }
}

.is-electron.is-mac .cp__header {
  > .l {
    padding-left: 78px;
  }
}

.cp__header .navigation svg {
  transform: scale(0.7);
}

.is-electron.is-mac.is-fullscreen .cp__header > .l {
  padding-left: 1rem;
}

.cp__header a, .cp__header svg {
  -webkit-app-region: no-drag;
}

.cp__header-logo {
  @apply p-2;
}

.cp__header-logo {
  display: none;
}

.cp__header-logo:hover {
  opacity: 1;
}

.cp__header-logo-img {
  width: 24px;
  height: 24px;
}

@screen sm {
  .cp__header {
    @apply shadow-none;
  }

  .cp__header-logo {
    display: block;
  }
}

.cp__header-logo svg {
  transform: scale(0.9);
}

#repo-name {
  display: table-cell;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 15ch;
  height: 14px;
}

.button {
  @apply h-8 px-2.5 py-1 rounded-md opacity-60;
  display: block;
  user-select: none;

  &:hover, &.active {
    opacity: 1;
    background: none;

    @screen md {
      background: var(--ls-tertiary-background-color);
    }
  }

  &:active {
    opacity: .7;
  }
}

.button.icon {
  @apply w-8 h-8 p-1;
}

.button.icon.add-graph-btn {
    width: unset;
    margin: 0 6px;
}

.is-mac.is-electron :is(.cp__header, .cp__right-sidebar-topbar) :is(button, .button, a) {
  cursor: default !important;
}

html.is-ios.is-safari {

  .cp__header {
    background-color: var(--ls-primary-background-color);
  }

  .is-vw-pending {
    display: none !important;
  }
}

html.is-native-iphone,
html.is-native-iphone-without-notch,
html.is-native-ipad {

  #main-container {
    padding-top: 0px;
    display: flex;
    flex-direction: column;
  }

  #main-content-container {
    padding-left: 22px;
    padding-right: 14px;
    padding-top: 0px;
    height: calc(100vh - var(--ls-headbar-inner-top-padding) - var(--ls-headbar-height));

    @screen sm {
      padding-left: 2rem;
    }

    .page {
      margin-top: 24px;
    }
  }

  .cp__header {
    > .r {
      display: flex;
    }

    .button {
      opacity: 1;
    }
  }
}

html.is-native-ipad {
  --ls-headbar-inner-top-padding: 0px;
  --ls-headbar-height: 4rem;

  .cp__header {
    background-color: transparent !important;
    display: flex;

    > .l {
      /* background-color: var(--ls-primary-background-color); */
      padding-top: 20px;
    }

    > .r {
      flex: 1;
      background-color: var(--ls-primary-background-color);
      height: 100%;
      padding-top: 20px;
      justify-content: flex-end;
      align-items: center;
    }
  }

  .left-sidebar-inner  {
    > .wrap {
      padding-top: 20px;
    }
  }

  .cp__right-sidebar {
    &-settings {
      margin-top: -4px;
    }

    &-topbar {
      padding-top: 37px;
    }

    &-inner {
      .resizer {
        top: 30vh;
        width: 12px;
        height: 40vh;
      }

      .resizer:hover {
        background-color: var(--ls-guideline-color, #ddd);
      }
    }
  }
}

html.is-native-iphone {
  --ls-headbar-inner-top-padding: 36px;

  .left-sidebar-inner {
    > .wrap {
      padding-top: 12px;
    }

    .new-page {
      padding-bottom: 12px;
    }
  }

  .ui__notifications {
    top: calc(var(--ls-headbar-height) + var(--ls-headbar-inner-top-padding) - 0.3rem);
  }

  @media (orientation: landscape) {
    --ls-headbar-inner-top-padding: 8px;
    --ls-headbar-height: 2.5rem;
  }
}

html.is-native-iphone-without-notch {

  --ls-headbar-inner-top-padding: 15px;
  --ls-headbar-height: 2.5rem;

  @media (orientation: landscape) {

    --ls-headbar-inner-top-padding: 0px;
    --ls-headbar-height: 2.5rem;
  }
}

html.is-zoomed-native-ios {
  --ls-headbar-inner-top-padding: 30px;

  @media (orientation: landscape) {
    --ls-headbar-inner-top-padding: 8px;
    --ls-headbar-height: 2.5rem;
  }
}
