.analysis-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.top-nav-toggle {
  display: none;
  align-items: center;
  gap: 10px;
  min-height: var(--tap-target, 44px);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.top-nav-toggle:hover {
  background: #eef2f7;
}

.top-nav-toggle-icon {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
}

.top-nav-toggle-icon span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.analysis-header-brand {
  display: flex;
  justify-content: flex-end;
  margin-left: auto;
  flex: 0 0 auto;
}

.analysis-header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  padding: 0px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.analysis-header-icon:hover {
  background: #eef2f7;
}

.analysis-header-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.top-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin: 0;
  padding-bottom: 0;
  border-bottom: 0;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.top-nav a {
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 3px 8px;
  background: #fff;
  font-weight: 600;
  min-height: var(--tap-target, 44px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.top-nav a:hover {
  background: #eef2f7;
}

.top-nav a.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

@media (max-width: 640px) {
  .analysis-header-icon {
    width: 46px;
    height: 46px;
  }

  .top-nav a {
    flex: 0 0 auto;
  }
}

@media (max-width: 760px) {
  .analysis-page-header.nav-ready {
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
  }

  .analysis-page-header.nav-ready .top-nav-toggle {
    display: inline-flex;
    order: 1;
  }

  .analysis-page-header.nav-ready .analysis-header-brand {
    order: 2;
    margin-left: auto;
  }

  .analysis-page-header.nav-ready .top-nav {
    order: 3;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f5f8fb 100%);
    overflow: visible;
    box-shadow: 0 10px 24px rgba(31, 41, 51, 0.08);
  }

  .analysis-page-header.nav-ready .top-nav:not(.is-open) {
    display: none;
  }

  .analysis-page-header.nav-ready .top-nav a {
    width: 100%;
    justify-content: flex-start;
    padding: 10px 12px;
    border-radius: 10px;
  }
}
