/*
 * Page shell: how wide the page runs, and the top bar with the page menus.
 *
 * The logo asset is white ink on transparency (1092x470 RGBA), so it is invisible
 * without something dark behind it. --app-logo-plate is that backing, set to the
 * same navy the report emails put behind the same file. To make the whole bar a
 * navy band instead of just the logo, set --app-bar-bg to that navy as well.
 */

:root {
  /* A MacBook 16 is 1728pt wide, so this fills one edge to edge. Wider screens
     stop here instead of stretching a bar chart past comfortable reading width. */
  --app-max-width: 1920px;
  --app-gutter: 1.5rem;

  --app-bar-bg: #fff;
  --app-bar-border: #dde3ea;
  --app-bar-height: 4.5rem;
  --app-logo-plate: #081d2f;
  /* Breathing room inside the navy plate. The asset is cropped tight to the
     wordmark, so without this the letters sit against the plate's edges. */
  --app-logo-pad-inline: 1.5rem;
  --app-logo-pad-block: 0.625rem;

  /* The menu holding the current page gets a navy underline (docs/design.md). */
  --app-tab-fg: #45566a;
  --app-tab-hover-bg: #f6f8fa;
  --app-tab-active-bg: #0a2236;
  --app-ring: 0 0 0 0.25rem rgba(0, 99, 132, 0.3);
}

/* Replaces Bootstrap's .container, which caps at 1320px and so leaves gutters
   down both sides of a 16 inch screen. */
.app-container {
  margin-inline: auto;
  max-width: var(--app-max-width);
  padding-block-end: 4rem;
  padding-inline: var(--app-gutter);
  width: 100%;
}

.app-bar {
  background-color: var(--app-bar-bg);
  border-bottom: 1px solid var(--app-bar-border);
  position: relative;
  z-index: 1030;
}

/* Deliberately not inside .app-container: the plate runs into the window's corner
   rather than floating a gutter's width away from it, which read as a stray margin.
   Only the page body below is capped and centred. */
.app-bar__inner {
  align-items: stretch;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  min-height: var(--app-bar-height);
  padding-inline-end: var(--app-gutter);
  width: 100%;
}

/* The plate fills the bar's full height and sits flush in its corner. The logo is
   inset within it, so the navy frames the wordmark the way the supplied artwork
   does. */
.app-bar__brand {
  align-items: center;
  background-color: var(--app-logo-plate);
  display: inline-flex;
  padding-block: var(--app-logo-pad-block);
  padding-inline: var(--app-logo-pad-inline);
}

.app-bar__logo {
  display: block;
  height: calc(var(--app-bar-height) - 2 * var(--app-logo-pad-block));
  width: auto;
}


.app-bar__brand-text {
  align-self: center;
  color: var(--app-logo-plate);
  font-weight: 600;
  padding-inline-start: var(--app-gutter);
  text-decoration: none;
}

.app-bar__user {
  align-items: center;
  display: flex;
  gap: 0.625rem;
  margin-inline-start: auto;
}

.app-bar__user-button {
  align-items: center;
  background: none;
  border: 0;
  border-radius: 0.625rem;
  color: inherit;
  display: inline-flex;
  font-weight: 600;
  gap: 0.625rem;
  min-height: 2.75rem;
  padding: 0 0.375rem 0 0.25rem;
}

.app-bar__user-button:hover {
  color: var(--ui-ink);
}

.app-bar__avatar {
  background: var(--app-tab-active-bg);
  border-radius: 50%;
  color: #fff;
  display: inline-grid;
  flex: none;
  font-size: 0.75rem;
  font-weight: 700;
  height: 2rem;
  place-items: center;
  width: 2rem;
}

/* Page menus, beside the logo. */
.app-nav {
  align-items: center;
  display: flex;
  gap: 0.375rem;
}

.app-nav__menu {
  align-items: center;
  background: none;
  border: 0;
  border-radius: 0.625rem;
  color: var(--app-tab-fg);
  display: inline-flex;
  font-size: 0.9375rem;
  font-weight: 600;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0 0.875rem;
  position: relative;
  text-decoration: none;
}

/* No background in any state: a line on the bar's bottom edge marks the menu.
   Navy for the section you are in, light grey on hover or while open. The menu's
   data-bs-offset (base.html) drops its list just below that edge. */
.app-nav__menu::after {
  background: transparent;
  border-radius: 3px 3px 0 0;
  bottom: calc((2.75rem - var(--app-bar-height)) / 2);
  content: "";
  height: 3px;
  inset-inline: 0.875rem;
  position: absolute;
}

.app-nav__menu:hover,
.app-nav__menu[aria-expanded="true"],
.app-nav__menu.is-active {
  color: var(--ui-ink);
}

.app-nav__menu:hover::after,
.app-nav__menu[aria-expanded="true"]::after {
  background: var(--ui-line-2);
}

.app-nav__menu.is-active::after {
  background: var(--app-tab-active-bg);
}

.app-nav__menu:focus-visible,
.app-bar__user-button:focus-visible,
.app-bar__sheet-button:focus-visible {
  box-shadow: var(--app-ring);
  outline: none;
}

.app-nav__chevron,
.app-nav__tick,
.app-bar__sheet-icon {
  fill: none;
  flex: none;
  height: 0.875rem;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 0.875rem;
}

.app-nav__list {
  --bs-dropdown-link-active-bg: var(--ui-teal-tint);
  --bs-dropdown-link-active-color: var(--ui-ink);
  --bs-dropdown-link-hover-bg: var(--app-tab-hover-bg);
  border-color: var(--app-bar-border);
  border-radius: 0.875rem;
  box-shadow: 0 14px 36px rgba(10, 34, 54, 0.16);
  padding: 0.375rem;
  width: 28rem;
}

.app-nav__item {
  align-items: flex-start;
  border-radius: 0.625rem;
  display: flex;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  white-space: normal;
}

.app-nav__item .app-nav__tick {
  color: transparent;
  height: 1rem;
  margin-top: 0.125rem;
  width: 1rem;
}

.app-nav__item.is-active {
  background-color: #edf3f7;
}

.app-nav__item.is-active .app-nav__tick {
  color: var(--app-tab-active-bg);
}

.app-nav__label {
  display: block;
  font-weight: 600;
}

.app-nav__hint {
  color: var(--ui-ink-3);
  display: block;
  font-size: 0.8125rem;
}

/* Phone: one Menu button opens the list of every page under the bar. */
.app-bar__sheet-button {
  align-items: center;
  background: var(--ui-surface);
  border: 1px solid var(--ui-line-2);
  border-radius: 0.625rem;
  color: var(--ui-ink);
  display: none;
  font-weight: 600;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0 0.875rem;
}

.app-bar__sheet-button .app-bar__sheet-icon {
  height: 1.125rem;
  width: 1.125rem;
}

.app-bar__sheet-button[aria-expanded="true"] {
  background: var(--app-tab-active-bg);
  border-color: var(--app-tab-active-bg);
  color: #fff;
}

.app-bar__sheet-button .is-close,
.app-bar__sheet-button[aria-expanded="true"] .is-menu {
  display: none;
}

.app-bar__sheet-button[aria-expanded="true"] .is-close {
  display: inline;
}

.app-sheet {
  background: var(--ui-surface);
  border-bottom: 1px solid var(--app-bar-border);
  box-shadow: 0 14px 36px rgba(10, 34, 54, 0.16);
  inset-inline: 0;
  max-height: calc(100vh - var(--app-bar-height));
  overflow-y: auto;
  position: absolute;
  top: 100%;
}

.app-sheet__inner {
  padding: 0.5rem 0.75rem 1rem;
}

.app-sheet__group {
  color: var(--ui-ink-3);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin: 0;
  padding: 0.75rem 0.75rem 0.25rem;
  text-transform: uppercase;
}

.app-sheet__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* The tick sits in the padding, so items with and without one line up. */
.app-sheet__item {
  align-items: center;
  border-radius: 0.625rem;
  color: var(--ui-ink);
  display: flex;
  font-weight: 600;
  min-height: 3rem;
  padding: 0 0.75rem 0 2.25rem;
  position: relative;
  text-decoration: none;
}

.app-sheet__item .app-nav__tick {
  color: transparent;
  height: 1rem;
  left: 0.75rem;
  position: absolute;
  width: 1rem;
}

.app-sheet__item.is-active {
  background-color: #edf3f7;
}

.app-sheet__item.is-active .app-nav__tick {
  color: var(--app-tab-active-bg);
}

.app-sheet__rule {
  border-top: 1px solid var(--app-bar-border);
  margin: 0.625rem 0.25rem;
}

.app-sheet__who {
  align-items: center;
  display: flex;
  font-weight: 600;
  gap: 0.625rem;
  margin: 0;
  padding: 0.5rem 0.75rem;
}

.app-sheet__email {
  color: var(--ui-ink-3);
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
}

/* Wide enough for the menus, Admin and the name: the bar shows them.
   Narrower: the Menu button and its list take over. */
@media (min-width: 768px) {
  .app-sheet {
    display: none !important;
  }
}

@media (max-width: 767.98px) {
  /* .app-bar first: ui.css loads later and its .btn sets a display. */
  .app-bar .app-nav,
  .app-bar .app-bar__admin,
  .app-bar .app-bar__account {
    display: none;
  }

  .app-bar__sheet-button {
    display: inline-flex;
  }
}

@media (max-width: 575.98px) {
  :root {
    --app-bar-height: 3.25rem;
    --app-gutter: 1rem;
  }
}
