.hd {
  position: sticky !important;
  top: 0;
  z-index: 1000;
  background: transparent !important;
  box-shadow: none !important;
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.hd .wrap { position: relative; }
body:not(.page-home) .hd,
.hd.is-solid,
.hd.is-scrolled {
  background: rgba(255, 255, 255, 0.92) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08) !important;
}

.hd-main {
  display: flex !important;
  align-items: center;
  gap: 16px;
  min-height: var(--nav-h);
  padding: 0 !important;
  flex-wrap: nowrap !important;
}

body.page-home .hd:not(.is-scrolled) .nav a,
body.page-home .hd:not(.is-scrolled) .hd-right > a:not(.hd-login),
body.page-home .hd:not(.is-scrolled) .lang-dd__btn,
body.page-home .hd:not(.is-scrolled) .hd-notify__btn,
body.page-home .hd:not(.is-scrolled) .user-dd__btn,
body.page-home .hd:not(.is-scrolled) .user-dd__name,
body.page-home .hd:not(.is-scrolled) .hd-menu {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
body.page-home .hd:not(.is-scrolled) .lang-dd__btn {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
}
body.page-home .hd:not(.is-scrolled) .hd-notify__btn {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
}
body.page-home .hd:not(.is-scrolled) .hd-notify__btn:hover,
body.page-home .hd:not(.is-scrolled) .hd-notify__btn[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
}
body.page-home .hd:not(.is-scrolled) .user-dd__avatar,
body.page-home .hd:not(.is-scrolled) .hd-login__avatar {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55);
}
body.page-home .hd:not(.is-scrolled) .nav a:hover,
body.page-home .hd:not(.is-scrolled) .nav a.on {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}
body.page-home .hd:not(.is-scrolled) .brand__logo {
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45));
}
body.page-home .hd:not(.is-scrolled) .sbox {
  background: rgba(255, 255, 255, 0.88) !important;
  border-color: transparent !important;
}
body.page-home .hd:not(.is-scrolled) .sbox:hover,
body.page-home .hd:not(.is-scrolled) .sbox:focus-within {
  background: #fff !important;
}

.brand {
  display: inline-flex !important;
  align-items: center;
  flex: 0 0 auto;
  max-width: 200px;
  line-height: 0;
}
.brand__logo {
  display: block;
  height: 40px !important;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}

.nav {
  display: flex;
  gap: 2px;
  flex: 1;
  min-width: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  flex: 0 0 auto;
  color: var(--c-text);
  font-size: 14px;
  font-weight: 500;
  padding: 0 12px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  white-space: nowrap;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.nav a:hover,
.nav a.on,
.nav a[aria-current="page"] {
  color: var(--c-accent) !important;
  background: var(--c-accent-soft);
}

.hd-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.sbox {
  display: flex !important;
  align-items: center;
  height: 40px;
  min-width: 180px;
  max-width: 320px;
  flex: 0 1 280px;
  padding: 0 4px 0 12px !important;
  border: 1px solid var(--c-border) !important;
  border-radius: 8px !important;
  background: var(--c-bg) !important;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.sbox:hover,
.sbox:focus-within {
  background: #fff !important;
  border-color: var(--c-link) !important;
}
.sbox input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0 !important;
  background: transparent !important;
  font-size: 14px;
  color: var(--c-text);
  outline: none;
}
.sbox button {
  width: 32px;
  height: 32px;
  margin-left: 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--c-text-muted);
  font-size: 0;
  position: relative;
  transition: background var(--dur) var(--ease);
}
.sbox button::before {
  content: "";
  position: absolute;
  inset: 7px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.sbox button:hover { background: #e3e5e7; color: var(--c-text); }

.hd-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 40px;
  padding: 2px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--c-text);
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  text-shadow: none !important;
  transition: background var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.hd-login:hover,
.hd-login:focus-visible {
  background: var(--c-accent-soft);
}
.hd-login:focus-visible {
  outline: 2px solid var(--c-link);
  outline-offset: 2px;
}
.hd-login__avatar {
  display: block;
  pointer-events: none;
}

@media (max-width: 960px) {
  .hd { overflow-x: clip; }
  .hd .wrap { overflow-x: clip; max-width: 100%; }
  .hd-main {
    gap: 8px;
    min-width: 0;
    max-width: 100%;
  }
  .brand {
    flex: 0 0 auto;
    max-width: 108px;
  }
  .brand__logo {
    height: 30px !important;
    max-width: 108px !important;
  }
  .hd-menu {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    flex: 0 0 40px;
    margin-left: 0;
  }
  .hd-menu__bar {
    width: 18px;
    margin-left: -9px;
  }
  .hd-right {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: 0;
    gap: 6px;
  }
  .hd-right .sbox,
  .sbox {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: none !important;
    width: auto;
    height: 36px;
  }
  .sbox input { font-size: 13px; }
  .lang-dd__cur,
  .lang-dd__caret { display: none; }
  .lang-dd__btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0 !important;
    justify-content: center;
  }
  .lang-dd__ico {
    width: 20px;
    height: 20px;
  }
  .hd-notify__btn,
  .mac-notify-bell__btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0 !important;
    justify-content: center;
  }
  .hd-notify__btn .hd-notify__ico,
  .hd-notify__btn .ts-icon,
  .mac-notify-bell__btn .hd-notify__ico,
  .mac-notify-bell__btn .ts-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
  }
  .user-dd__name,
  .user-dd__caret { display: none; }
  .user-dd__btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    justify-content: center;
  }
  .user-dd__avatar {
    width: 28px;
    height: 28px;
  }
  .hd-login {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
  }
  .hd-login__avatar,
  .hd-login .user-dd__avatar {
    width: 28px;
    height: 28px;
  }
}

.lang-dd { position: relative; flex: 0 0 auto; }
.lang-dd__btn {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  min-width: 44px;
  padding: 6px 10px !important;
  border: 1px solid var(--c-border) !important;
  border-radius: 8px !important;
  background: var(--c-bg) !important;
  color: var(--c-text) !important;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-shadow: none !important;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.lang-dd__btn:hover,
.lang-dd__btn[aria-expanded="true"] {
  border-color: var(--c-accent) !important;
  color: var(--c-accent) !important;
  background: var(--c-accent-soft) !important;
}
.lang-dd__btn:focus-visible {
  outline: 2px solid var(--c-link);
  outline-offset: 2px;
}
.lang-dd__ico { flex: 0 0 auto; opacity: 0.9; }
.lang-dd__caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.65;
  transition: transform var(--dur) var(--ease);
}
.lang-dd__btn[aria-expanded="true"] .lang-dd__caret { transform: rotate(180deg); }
.lang-dd__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 80;
  min-width: 132px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.lang-dd__menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--c-text);
  font-size: 13px;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.lang-dd__menu button:hover,
.lang-dd__menu button:focus-visible {
  background: var(--c-accent-soft);
  color: var(--c-accent);
}

.user-dd { position: relative; flex: 0 0 auto; }
.user-dd__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  min-width: 44px;
  padding: 2px 6px 2px 2px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--c-text);
  cursor: pointer;
  text-shadow: none !important;
  transition: background var(--dur) var(--ease);
}
.user-dd__btn:hover,
.user-dd__btn[aria-expanded="true"] {
  background: var(--c-accent-soft);
}
.user-dd__btn:focus-visible {
  outline: 2px solid var(--c-link);
  outline-offset: 2px;
}
.user-dd__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--c-surface-2);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
  flex: 0 0 auto;
}
.user-page__avatar {
  width: 96px !important;
  height: 96px !important;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: var(--c-accent-soft);
  box-shadow: 0 2px 8px rgba(251, 114, 153, 0.18);
}
.user-dd__name {
  max-width: 88px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-dd__caret {
  width: 0;
  height: 0;
  margin-right: 4px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.55;
  transition: transform var(--dur) var(--ease);
}
.user-dd__btn[aria-expanded="true"] .user-dd__caret { transform: rotate(180deg); }
.user-dd__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 80;
  min-width: 168px;
  padding: 4px;
  background: #fff;
  border: 0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
}
.user-dd__head {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 8px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--c-border);
}
.user-dd__head-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  background: var(--c-surface-2);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.user-dd__head-text {
  min-width: 0;
  flex: 1;
}
.user-dd__head-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-dd__head-meta {
  display: block;
  margin-top: 1px;
  font-size: 11px;
  color: var(--c-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-dd__menu-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.user-dd__menu-foot {
  margin-top: 2px;
  padding-top: 2px;
  border-top: 1px solid var(--c-border);
}
.user-dd__item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.user-dd__ico {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--c-text-muted);
  opacity: 0.88;
  transition: color var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.user-dd__label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-dd__item:hover .user-dd__ico,
.user-dd__item:focus-visible .user-dd__ico {
  color: var(--c-accent);
  opacity: 1;
}
.user-dd__item:hover,
.user-dd__item:focus-visible {
  background: var(--c-accent-soft);
  color: var(--c-accent);
}
.user-dd__item:focus {
  outline: none;
}
.user-dd__item--logout {
  color: var(--c-text-muted);
  font-weight: 400;
}
.user-dd__item--logout .user-dd__ico {
  color: var(--c-text-muted);
  opacity: 0.75;
}
.user-dd__item--logout:hover,
.user-dd__item--logout:focus-visible {
  color: #e44;
  background: #fff1f0;
}
.user-dd__item--logout:hover .user-dd__ico,
.user-dd__item--logout:focus-visible .user-dd__ico {
  color: #e44;
  opacity: 1;
}

.hd-sub { display: none !important; }
