.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.header-profile {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border: 1px solid #ffffff60;
  border-radius: 50%;
  padding: 0;
  background: #ffffff16;
  color: #fff;
  cursor: pointer;
}

.header-profile[hidden] { display: none; }
.header-profile svg { width: 23px; height: 23px; }
.header-profile:is(:hover, [aria-expanded="true"]) { background: #ffffff30; }
.header-profile:focus-visible { outline: 2px solid #ffda3c; outline-offset: 2px; }

.profile-menu {
  position: fixed;
  inset: auto;
  margin: 0;
  width: min(220px, calc(100% - 24px));
  padding: 6px;
  border: 1px solid #d8e5dd;
  border-radius: 13px;
  background: #fff;
  color: #164737;
  box-shadow: 0 12px 32px #133f3333;
  overflow: auto;
  z-index: 50;
}

.profile-menu[hidden] { display: none; }
.profile-menu a,
.profile-menu button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.profile-menu :is(a, button):is(:hover, :focus-visible, [aria-current="page"]) { background: #edf6ef; }
.profile-menu [data-logout] { border-top: 1px solid #e5eee8; color: #9a382d; }
#logout-error { margin: 12px 0 0; color: #9a382d; }
.account-section { max-width: 650px; }

@media (min-width: 861px) and (max-width: 960px) {
  .pokemon-header.admin-header .header-inner { flex-wrap: wrap; justify-content: space-between; gap: 0; }
  .pokemon-header.admin-header nav { order: 3; flex: 0 0 100%; margin: 0; justify-content: space-between; }
  .pokemon-header.admin-header nav .nav-link { min-height: 44px; }
}

@media (max-width: 760px) {
  .pokemon-header:not(.admin-header) nav { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .pokemon-header:not(.admin-header) nav .nav-link { font-size: clamp(11px, 3.4vw, 13px); }
}

@media (max-width: 359px) {
  .header-actions .header-add[data-add] { min-width: 44px; justify-content: center; }
  .header-actions .header-add[data-add] > span { display: none; }
}

.pokemon-header .brand {
  flex: none;
}

.pokemon-header .header-logo {
  display: block;
  width: clamp(135px, 19vw, 195px);
  height: auto;
}

.pokemon-header.public-header .header-inner {
  min-height: 0;
  justify-content: center;
  padding: 10px 16px;
}

.pokemon-header.public-header .header-logo {
  width: clamp(175px, 26vw, 235px);
}

.site-footer {
  display: block;
  margin: 20px 0 0;
  padding: 20px 0;
  border-top: 1px solid #e0e8e2;
  color: #526a5d;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.toolbar:has(#export) {
  flex-wrap: wrap;
  gap: 8px 16px;
}

#export {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
}

@media (min-width: 961px) and (max-width: 1050px) {
  .pokemon-header.admin-header .header-logo { width: 150px; }
}

.header-profile.has-avatar {
  width: 76px;
  height: 76px;
  margin-block: 4px;
  border: 2px solid #f7d46a;
  background: radial-gradient(circle, #d9f3d8, #6fb69b);
  box-shadow: 0 3px 10px #082e2466;
}

.header-profile.has-avatar:is(:hover, [aria-expanded="true"]) {
  background: radial-gradient(circle, #f3ffe9, #8acead);
  border-color: #ffea9a;
}

.header-profile .header-avatar {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@media (max-width: 960px) {
  .header-profile.has-avatar {
    width: 66px;
    height: 66px;
    margin-block: 0;
  }
}

@media (max-width: 420px) {
  .header-profile.has-avatar {
    width: 60px;
    height: 60px;
  }
}

.profile-avatar-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.profile-avatar-summary img {
  object-fit: contain;
  border-radius: 50%;
  background: #edf6ef;
}

.avatar-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(85px, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.avatar-option {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 4px;
  padding: 8px 4px;
  border: 1px solid #dce9df;
  border-radius: 10px;
  background: #fff;
  color: #164737;
  font: inherit;
  font-size: 12px;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.avatar-option[aria-pressed="true"] {
  border-color: #247553;
  background: #e5f4e9;
  box-shadow: inset 0 0 0 1px #247553;
}

.avatar-option img { object-fit: contain; }

@media (max-width: 380px) {
  .pokemon-header:not(.admin-header) nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

html {
  scrollbar-gutter: stable;
}

.pokemon-header:not(.admin-header) nav .nav-link {
  font-weight: 800;
}

@media (min-width: 381px) and (max-width: 480px) and (orientation: portrait) {
  .pokemon-header:not(.admin-header) nav {
    grid-template-columns: repeat(5, minmax(max-content, 1fr));
    column-gap: 8px;
  }

  .pokemon-header:not(.admin-header) nav .nav-link {
    padding-inline: 2px;
  }
}
