:root {
  /* Shared across the service SPA and standalone Library page. */
  --brand-emerald: #10B981;
  --brand-emerald-hover: #059669;
  --brand-emerald-strong: #047857;
  --brand-emerald-pressed: #065F46;
  --brand-emerald-active: #064E3B;
  --brand-emerald-soft: #ECFDF5;
  --brand-emerald-soft-hover: #D1FAE5;
  --brand-emerald-line: #34D399;
  --brand-emerald-focus: #047857;
  --service-nav-ink: #20343e;
  --service-nav-muted: #60747b;
  --service-nav-line: #dce5e6;
  --service-nav-accent: var(--brand-emerald-strong);
  --service-nav-hover: var(--brand-emerald-soft);
}

body .shell {
  margin-top: 16px;
}

.shell > .app-header.intro {
  width: 100%;
  margin-left: 0;
  border: 1px solid var(--service-nav-line);
  border-radius: 12px;
  padding: 12px 16px;
  background: #fff;
  box-shadow: none;
}

.shell > .app-header.intro #profileArea {
  width: 100%;
  margin: 0;
}

.site-header:has(> .header-inner > .service-nav) {
  width: min(1160px, calc(100% - 48px));
  margin: 16px auto 0;
  border: 1px solid var(--service-nav-line);
  border-radius: 12px;
  background: #fff;
}

.site-header .header-inner {
  display: block;
  width: auto;
  margin: 0;
  padding: 12px 16px;
}

.profile-menu,
.service-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 4px;
  width: 100%;
}

.profile-menu-item,
.service-nav-item {
  display: inline-flex;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 11px;
  background: #fff;
  color: var(--service-nav-ink);
  font: 700 13px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.profile-menu-item svg,
.service-nav-item svg {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  color: var(--service-nav-muted);
}

.profile-menu-item .profile-menu-label,
.service-nav-item span {
  display: inline;
  width: auto;
  height: auto;
  color: inherit;
  font: inherit;
}

.profile-menu-item:hover,
.service-nav-item:hover {
  background: var(--service-nav-hover);
}

.profile-menu-item.active,
.service-nav-item.active {
  border-color: var(--service-nav-accent);
  background: var(--service-nav-accent);
  color: #fff;
}

.profile-menu-item.active svg,
.service-nav-item.active svg {
  color: #fff;
}

.profile-menu-item:focus-visible,
.service-nav-item:focus-visible {
  outline: 3px solid var(--brand-emerald-focus);
  outline-offset: 2px;
}

#logoutButton,
.logout-item {
  margin-left: auto;
}

@media (min-width: 1021px) and (max-width: 1100px) {
  .profile-menu-item,
  .service-nav-item {
    gap: 7px;
    padding-inline: 8px;
    font-size: 12px;
  }

  .profile-menu-item svg,
  .service-nav-item svg {
    width: 17px;
    height: 17px;
    flex-basis: 17px;
  }
}

@media (max-width: 1020px) {
  .profile-menu,
  .service-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #logoutButton,
  .logout-item {
    margin-left: 0;
  }
}

@media (max-width: 620px) {
  .site-header:has(> .header-inner > .service-nav) {
    width: min(1160px, calc(100% - 28px));
  }

  .shell > .app-header.intro,
  .site-header .header-inner {
    padding: 8px;
  }

  .profile-menu,
  .service-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-menu-item,
  .service-nav-item {
    font-size: 12px;
  }

  .profile-menu-item svg,
  .service-nav-item svg {
    width: 17px;
    height: 17px;
    flex-basis: 17px;
  }
}

/* Approved service logo with tagline; shared by the workspace and Library. */
.shell > .app-header.brand-header,
.site-header .header-inner.brand-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}
.service-brand {
  display: inline-flex;
  flex: 0 0 144px;
  align-items: center;
  min-height: 44px;
  border-radius: 6px;
  text-decoration: none;
}
.service-brand img { display: block; width: 144px; height: auto; }
.service-brand:focus-visible { outline: 3px solid var(--brand-emerald-focus); outline-offset: 3px; }
.shell > .app-header.brand-header #profileArea,
.brand-header > .service-nav { flex: 1 1 auto; width: auto; min-width: 0; }
.brand-header #profileArea .profile-menu,
.brand-header > .service-nav { flex-wrap: nowrap; }
.brand-header :is(.profile-menu-item, .service-nav-item) { white-space: nowrap; }
.service-menu-toggle { display: none; }
.brand-header .nav-error { flex-basis: 100%; }
@media (max-width: 1150px) {
  .shell > .app-header.brand-header,
  .site-header .header-inner.brand-header { flex-wrap: wrap; gap: 8px 12px; padding: 8px 12px; }
  .service-brand { flex-basis: 148px; }
  .service-brand img { width: 148px; }
  .brand-header.menu-ready > .service-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    margin-left: auto;
    padding: 9px 12px;
    color: var(--service-nav-ink);
    border: 1px solid var(--service-nav-line);
    border-radius: 8px;
    background: #fff;
    font: 600 13px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    cursor: pointer;
  }
  .service-menu-toggle svg { width: 19px; height: 19px; }
  .service-menu-toggle:focus-visible { outline: 3px solid var(--brand-emerald-focus); outline-offset: 2px; }
  .shell > .app-header.brand-header #profileArea,
  .brand-header > .service-nav { flex-basis: 100%; width: 100%; padding-top: 8px; border-top: 1px solid #e5e7eb; }
  .brand-header.menu-ready[data-menu-open="false"] > :is(#profileArea, .service-nav) { display: none; }
  .brand-header #profileArea .profile-menu,
  .brand-header > .service-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .brand-header :is(#logoutButton, .logout-item) { margin-left: 0; }
}
@media (max-width: 620px) {
  .brand-header #profileArea .profile-menu,
  .brand-header > .service-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand-header :is(.profile-menu-item, .service-nav-item) { gap: 7px; padding-inline: 8px; white-space: normal; }
}
@media (min-width: 1151px) and (max-width: 1240px) {
  .brand-header :is(.profile-menu-item, .service-nav-item) { padding-inline: 7px; gap: 7px; }
}
