body.top-page-body {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
}

.top-page {
  width: min(100%, 1080px);
  margin: 0 auto;
  padding: clamp(24px, 5vh, 52px) 24px 32px;
}

.top-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.top-brand {
  display: flex;
  align-items: center;
  gap: 24px;
  min-width: 0;
}

.top-brand-logo {
  display: block;
  width: min(192px, 25vw);
  height: auto;
  flex: 0 1 auto;
}

.top-brand-copy {
  min-width: 0;
}

.top-brand-copy h1 {
  margin: 0;
  color: var(--primary-dark);
  font-size: clamp(25px, 2.7vw, 31px);
  font-weight: 900;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.top-brand-copy p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
}

.top-session-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-session {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding-right: 12px;
  border-right: 1px solid var(--line);
}

.top-session > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.top-session strong {
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
}

.top-logout-button {
  min-height: 46px;
  white-space: nowrap;
}

.top-menu-panel {
  margin: 0;
  padding: 28px;
  border-color: var(--line-strong);
  box-shadow: 0 12px 28px rgba(16, 36, 63, 0.08);
}

.top-menu-heading {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.top-menu-heading h2 {
  margin: 0;
  color: var(--text);
  font-size: 25px;
}

.top-menu-heading p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.top-menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.top-menu:has(.top-menu-link:not([hidden])):not(:has(.top-menu-link:not([hidden]) ~ .top-menu-link:not([hidden]))) {
  grid-template-columns: minmax(280px, 520px);
}

.top-menu-link {
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 128px;
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--primary-dark);
  text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.top-menu-link > span {
  font-size: 20px;
  font-weight: 900;
}

.top-menu-link small {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.top-menu-link[hidden] {
  display: none;
}

.top-menu-link:hover,
.top-menu-link:focus-visible {
  border-color: var(--primary);
  background: #eaf3ff;
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.top-menu-link:focus-visible {
  outline: 0;
}

.top-auth-loading,
.top-message {
  align-self: center;
  justify-self: center;
  width: min(100% - 48px, 520px);
}

.top-auth-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
}

.top-auth-loading[hidden],
.top-message[hidden] {
  display: none;
}

.top-loading-indicator {
  width: 14px;
  height: 14px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: top-loading-spin 0.8s linear infinite;
}

.top-message {
  min-height: 0;
  margin: 0;
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.55;
}

.top-app-message {
  width: 100%;
  margin: 0 0 20px;
}

.top-footer {
  padding: 0 24px 20px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

@keyframes top-loading-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 760px) {
  .top-page {
    padding: 28px 16px;
  }

  .top-header {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 18px;
  }

  .top-session-actions {
    justify-content: space-between;
  }

  .top-menu-panel {
    padding: 24px 20px;
  }

  .top-menu,
  .top-menu:has(.top-menu-link:not([hidden])):not(:has(.top-menu-link:not([hidden]) ~ .top-menu-link:not([hidden]))) {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .top-brand {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .top-brand-logo {
    width: min(192px, 72vw);
  }

  .top-brand-copy h1 {
    font-size: 27px;
    white-space: normal;
  }

  .top-session-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .top-session {
    padding: 0 0 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .top-logout-button {
    width: 100%;
  }

  .top-menu-link {
    min-height: 112px;
    padding: 20px;
  }

  .top-footer {
    padding: 0 16px 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .top-loading-indicator {
    animation: none;
  }

  .top-menu-link {
    transition: none;
  }
}
