.with-subnav {
  flex-wrap: wrap;
}

.topbar.with-subnav,
.ratio-topbar.with-subnav,
.tool-topbar.with-subnav {
  height: auto;
  min-height: 64px;
}

.ba-subnav {
  --subnav-bg: rgba(255, 255, 255, 0.045);
  --subnav-border: rgba(240, 185, 11, 0.22);
  --subnav-text: #f5f7fa;
  --subnav-active-bg: linear-gradient(135deg, #f0b90b, #fcd535);
  --subnav-active-text: #0b0e11;
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-width: 260px;
}

.ba-subnav--light {
  --subnav-bg: rgba(255, 255, 255, 0.72);
  --subnav-border: rgba(24, 33, 43, 0.12);
  --subnav-text: #18212b;
  --subnav-active-bg: #18212b;
  --subnav-active-text: #ffffff;
}

.ba-subnav--yellow {
  --subnav-bg: rgba(255, 255, 255, 0.78);
  --subnav-border: rgba(24, 26, 32, 0.12);
  --subnav-text: #181a20;
  --subnav-active-bg: #fcd535;
  --subnav-active-text: #050505;
}

.ba-subnav--green {
  --subnav-bg: rgba(255, 255, 255, 0.76);
  --subnav-border: rgba(31, 122, 90, 0.18);
  --subnav-text: #18212b;
  --subnav-active-bg: #1f7a5a;
  --subnav-active-text: #ffffff;
}

.ba-subnav a {
  flex: 0 0 auto;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 11px;
  border: 1px solid var(--subnav-border);
  border-radius: 7px;
  background: var(--subnav-bg);
  color: var(--subnav-text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.ba-subnav a:hover,
.ba-subnav a.is-active {
  color: var(--subnav-active-text);
  border-color: transparent;
  background: var(--subnav-active-bg);
}

.ba-subnav a:hover {
  transform: translateY(-1px);
}

.tool-topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  padding: 9px 12px;
  border: 1px solid #ececec;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 48px rgba(24, 26, 32, 0.08);
}

.tool-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: max-content;
  color: #050505;
  text-decoration: none;
}

.tool-brand span {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: #fcd535;
  color: #050505;
  font-weight: 900;
}

.tool-brand strong {
  font-size: 16px;
}

@media (max-width: 1180px) {
  .ba-subnav {
    order: 3;
    flex-basis: 100%;
    min-width: 0;
    gap: 8px;
  }

  .ba-subnav a {
    min-height: 38px;
  }
}

@media (max-width: 720px) {
  .ba-subnav {
    flex: 0 0 100%;
    flex-basis: 100%;
    min-width: 0;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .ba-subnav::-webkit-scrollbar {
    display: none;
  }

  .ba-subnav a {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 0 10px;
    font-size: 12px;
  }

  .tool-topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .tool-brand {
    justify-content: center;
  }
}
