There are two files which will need to be modified, one for the Header section and another for the Footer section.
You may want to “View Source” of a page you are trying to match, and also have the header.jsp files open in a text editor. Or "View Source" on http://basemap.nationalmap.gov/arcgis/rest/services while also viewing the header.jsp file.
Header:
File: C:\Program Files\ArcGIS\Server\framework\runtime\tomcat\webapps\arcgis#rest\www\app\common\header.jsp
This is where you would reference any external stylesheets.
Example:
(After the esri <%page import=...... lines)
<link rel=”stylesheet” type=”text/css” href=”yourdomain.com/styelsheets/main.css”>
You may need to add a DIV tag from the CSS file for your PAGE element. This should be inserted just after the above external style sheet references. <DIV id=”page_style”> ( or whatever it is named in the stylesheet file.)
Footer:
File: C:\Program Files\ArcGIS\Server\framework\runtime\tomcat\webapps\arcgis#rest\www\client\services\catalog.jsp
Again, a stare and compare to your target webpage should reveal any additional CSS tags or images which will need to be inserted.