/* Shared app navigation. Loaded after each page's existing theme. */
body .app-shell.has-top-navigation {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow: visible;
}

.topnav {
  position: sticky;
  top: 0;
  z-index: 40;
  width: 100%;
  font-family: "Segoe UI", Arial, sans-serif;
  border-bottom: 1px solid rgba(131, 175, 202, .17);
  background: rgba(9, 22, 33, .93);
  backdrop-filter: blur(22px);
}

.topnav-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 28px;
  width: 100%;
  max-width: 1680px;
  min-height: 56px;
  margin: 0 auto;
  padding: 0 clamp(20px, 3.125vw, 50px);
}

.topnav a {
  text-decoration: none;
}

.topnav-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  white-space: nowrap;
  color: #f4f7fc;
  font-size: clamp(1.1rem, 1.83vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -.035em;
}

.topnav-mark {
  display: inline-grid;
  place-items: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #fff8e8;
  color: #0a1823;
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: -.06em;
}

.topnav-links {
  display: flex;
  align-self: stretch;
  align-items: stretch;
  justify-content: flex-start;
  gap: 28px;
  min-width: 0;
}

.topnav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  color: #b9cbea;
  font-size: 1rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color 150ms ease, background 150ms ease;
}

.topnav-link:hover {
  background: rgba(255, 255, 255, .035);
  color: #fff;
}

.topnav-link.is-active {
  color: #fff;
  font-weight: 650;
}

.topnav-link.is-active::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 4px;
  background: #20c8e5;
  content: "";
}

.topnav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topnav-import,
.topnav-settings,
.topnav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid rgba(139, 182, 221, .36);
  border-radius: 7px;
  background: rgba(68, 115, 160, .12);
  color: #f4f7fc;
  font: inherit;
  font-size: .88rem;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: none;
}

.topnav-import {
  gap: 9px;
  white-space: nowrap;
}

.topnav-settings {
  width: 36px;
  padding: 6px;
  border-color: transparent;
  background: transparent;
}

.topnav svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.topnav-settings svg {
  width: 24px;
  height: 24px;
}

.topnav-import:hover,
.topnav-settings:hover,
.topnav-toggle:hover,
.topnav-import.is-active,
.topnav-settings.is-active {
  border-color: rgba(32, 200, 229, .6);
  background: rgba(32, 200, 229, .1);
  color: #8be6f5;
}

.topnav-toggle {
  display: none;
  width: 36px;
  padding: 7px;
}

.topnav :focus-visible,
.topnav-skip:focus-visible {
  outline: 2px solid #20c8e5;
  outline-offset: 4px;
}

.topnav-skip {
  position: fixed;
  top: -80px;
  left: 20px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 6px;
  background: #fff8e8;
  color: #0a1823;
}

.topnav-skip:focus {
  top: 8px;
}

body .app-shell.has-top-navigation > .main,
body .app-shell.has-top-navigation > .app-page > .wrap {
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: 26px clamp(20px, 3.3vw, 50px) 32px;
}

body .app-shell.has-top-navigation > .app-page {
  flex: 1;
  width: 100%;
  min-width: 0;
}

body.is-embedded .topnav,
body.is-embedded .topnav-skip {
  display: none;
}

body.is-embedded .app-shell.has-top-navigation {
  display: block;
  min-height: 0;
}

body.is-embedded .app-shell.has-top-navigation > .app-page > .wrap {
  max-width: none;
  padding: 0;
}

@media (min-width: 1181px) and (max-width: 1260px) {
  .topnav-links { gap: 24px; }
}

@media (max-width: 1180px) {
  .topnav-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0 16px;
    min-height: 66px;
  }

  .topnav-brand,
  .topnav-actions {
    min-height: 66px;
  }

  .topnav-links {
    display: none;
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 4px 0 14px;
  }

  .topnav.is-open .topnav-links {
    display: grid;
  }

  .topnav-link {
    min-height: 46px;
    border-radius: 6px;
  }

  .topnav-link.is-active {
    background: rgba(32, 200, 229, .08);
  }

  .topnav-toggle {
    display: inline-flex;
  }
}

@media (max-width: 540px) {
  .topnav-inner {
    gap: 0 8px;
    min-height: 62px;
    padding: 0 16px;
  }

  .topnav-brand,
  .topnav-actions {
    min-height: 62px;
  }

  .topnav-brand {
    gap: 8px;
    font-size: 1.05rem;
  }

  .topnav-mark {
    flex-basis: 31px;
    width: 31px;
    height: 33px;
    font-size: 1rem;
  }

  .topnav-actions {
    gap: 4px;
  }

  .topnav-import {
    width: 34px;
    padding: 6px;
  }

  .topnav-import span {
    display: none;
  }

  .topnav-settings,
  .topnav-toggle {
    width: 32px;
    min-height: 34px;
    padding: 5px;
  }

  .topnav-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body .app-shell.has-top-navigation > .main,
  body .app-shell.has-top-navigation > .app-page > .wrap {
    padding: 20px 16px 28px;
  }

  body.is-embedded .app-shell.has-top-navigation > .app-page > .wrap {
    padding: 0;
  }
}
