/* Chemistry supplies one contextual return at the bottom of each view. */
body:has(#nkchem) #mainContent > :is(.nk-site-return-row,.nk-backbar) {
  display: none !important;
}

body.nk-portal #nkchem {
  background: transparent;
}

/* Leave a 44px touch target beside the language switcher in the mobile toolbar. */
@media (max-width: 767px) {
  body.nk-portal:is(.nk-mobile-shell,.nk-shared-mobile-shell) .nk-header.nk-header-with-toolbar .nk-header-row > #nkNavigation ~ button.nk-mobile-toggle {
    flex: 0 0 44px !important;
    width: 44px !important;
    min-width: 44px !important;
  }
}

@media (min-width: 481px) and (max-width: 520px) {
  body.nk-portal:is(.nk-mobile-shell,.nk-shared-mobile-shell) .nk-header.nk-header-with-toolbar #nkNavigation ~ .nk-site-utilities > .nk-global-language-slider {
    width: 88px !important;
    min-width: 88px !important;
  }

  body.nk-portal:is(.nk-mobile-shell,.nk-shared-mobile-shell) .nk-header.nk-header-with-toolbar #nkNavigation ~ .nk-site-utilities > .nk-global-language-slider .nk-language-link {
    flex: 0 0 44px !important;
    width: 44px !important;
    min-width: 44px !important;
    box-sizing: border-box;
  }
}

/* The shared mobile shell uses important declarations in its inline CSS. */
@media (max-width: 480px) {
  body.nk-portal:is(.nk-mobile-shell,.nk-shared-mobile-shell) .nk-header.nk-header-with-toolbar .nk-header-row {
    grid-template-columns: minmax(0, 1fr) repeat(2, 44px) !important;
    grid-template-rows: auto auto !important;
    gap: 4px 8px !important;
    padding-block: 6px !important;
  }

  body.nk-portal:is(.nk-mobile-shell,.nk-shared-mobile-shell) .nk-header.nk-header-with-toolbar #nkNavigation ~ .nk-mobile-toggle {
    grid-area: 1 / 3 !important;
    width: 44px !important;
    min-width: 44px !important;
    justify-self: end;
  }

  body.nk-portal .nk-header.nk-header-with-toolbar .nk-header-row > #nkNavigation ~ .nk-site-utilities {
    display: contents !important;
  }

  body.nk-portal .nk-header.nk-header-with-toolbar #nkNavigation {
    grid-row: 3 !important;
  }

  .nk-header-with-toolbar .nk-site-utilities > .nk-header-actions {
    grid-area: 1 / 2;
    justify-self: end;
  }

  body.nk-portal .nk-header.nk-header-with-toolbar #nkNavigation ~ .nk-site-utilities > .nk-header-actions .nk-btn {
    width: 44px !important;
    min-width: 44px !important;
  }

  body.nk-portal .nk-header.nk-header-with-toolbar #nkNavigation ~ .nk-site-utilities .nk-header-account-actions {
    grid-area: 2 / 1;
    min-inline-size: 0;
    max-inline-size: 100%;
    justify-self: start;
    gap: 4px !important;
  }

  .nk-header-with-toolbar .nk-header-account-actions .nk-header-action {
    inline-size: 44px;
    min-inline-size: 44px;
  }

  body.nk-portal .nk-header.nk-header-with-toolbar #nkNavigation ~ .nk-site-utilities .nk-header-account-actions .nk-header-account {
    min-inline-size: 0;
    padding-inline: 4px !important;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
  }

  body.nk-portal .nk-header.nk-header-with-toolbar #nkNavigation ~ .nk-site-utilities > .nk-global-language-slider {
    grid-area: 2 / 2 / auto / -1;
    justify-self: end;
    width: 88px !important;
    min-width: 88px !important;
  }

  body.nk-portal .nk-header.nk-header-with-toolbar #nkNavigation ~ .nk-site-utilities > .nk-global-language-slider .nk-language-link {
    width: 44px !important;
    min-width: 44px !important;
    box-sizing: border-box;
  }
}

@media (max-width: 340px) {
  .nk-header-with-toolbar .nk-header-account-actions {
    flex-wrap: wrap;
  }

  .nk-header-with-toolbar .nk-header-account {
    overflow-wrap: anywhere;
  }
}


/* Replace the shared resume shortcut with the task report button in Chemistry. */
body.nk-portal:has(#nkchem .chem-task-report) #mainContent a.nk-resume-shortcut:is(.nk-resume-floating,.nk-resume-mobile-ux) {
  visibility: hidden !important;
  pointer-events: none !important;
  display: none !important;
}
