.site-shell {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
}

.site-shell > main {
  min-height: calc(100dvh - 74px);
}

.site-header {
  position: sticky;
  z-index: 100;
  top: 0;
  min-height: calc(74px + var(--safe-top));
  padding-top: var(--safe-top);
  border-bottom: 1px solid var(--header-line);
  background:
    radial-gradient(circle at 16% -160%, rgba(85, 178, 218, 0.24), transparent 320px),
    radial-gradient(circle at 82% 220%, rgba(128, 94, 195, 0.2), transparent 360px),
    var(--header-bg);
  box-shadow: 0 12px 36px rgba(4, 7, 12, 0.18);
  backdrop-filter: blur(28px) saturate(145%);
  -webkit-backdrop-filter: blur(28px) saturate(145%);
  transition: transform 220ms ease, opacity 180ms ease;
}

.site-header.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(calc(-100% - var(--safe-top)));
}

.site-header::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(96, 183, 238, 0.58), rgba(133, 104, 216, 0.65), transparent);
  content: "";
  opacity: 0.62;
}

.site-header__inner {
  display: grid;
  min-height: 73px;
  grid-template-columns: minmax(165px, 1fr) auto minmax(165px, 1fr);
  align-items: center;
  gap: clamp(14px, 2vw, 28px);
}

.brand {
  position: relative;
  display: block;
  width: clamp(168px, 16vw, 220px);
  height: 62px;
  overflow: hidden;
  text-decoration: none;
}

.brand img {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: clamp(180px, 17vw, 228px);
  height: auto;
  filter: brightness(1.18) saturate(0.9) drop-shadow(0 7px 15px rgba(2, 4, 8, 0.3));
  transform: translate(-50%, -50%);
}

.desktop-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 2.25vw, 34px);
}

.desktop-nav__link {
  position: relative;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 5px;
  color: rgba(237, 240, 247, 0.68);
  font-size: clamp(0.68rem, 0.8vw, 0.76rem);
  font-weight: 720;
  white-space: nowrap;
  transition: color 160ms ease;
}

.desktop-nav__link small {
  color: #a9dfff;
  font-size: 0.48rem;
  letter-spacing: 0.08em;
}

.desktop-nav__link::after {
  position: absolute;
  right: 0;
  bottom: -15px;
  left: 0;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--sky), var(--sapphire), var(--violet));
  content: "";
  opacity: 0;
  transform: scaleX(0.55);
  transition: opacity 160ms ease, transform 160ms ease;
}

.desktop-nav__link:hover,
.desktop-nav__link.is-active {
  color: #fff;
}

.desktop-nav__link.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

:root[data-theme="light"] .desktop-nav__link,
:root[data-theme="light"] .language-menu summary,
:root[data-theme="light"] .theme-toggle,
:root[data-theme="light"] .workplace-menu__trigger { color: #294655; }
:root[data-theme="light"] .desktop-nav__link:hover,
:root[data-theme="light"] .desktop-nav__link.is-active { color: #102f40; }
:root[data-theme="light"] .site-header .header-login { color: #294655; }
:root[data-theme="light"] .brand img { filter: brightness(.3) saturate(.45) drop-shadow(0 5px 13px rgba(30, 88, 112, .12)); }

.site-header__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.language-menu,
.mobile-menu {
  position: relative;
}

.language-menu summary,
.theme-toggle {
  display: flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: rgba(240, 243, 249, 0.76);
  cursor: pointer;
  font-size: 0.71rem;
  font-weight: 750;
  list-style: none;
}

.workplace-menu {
  position: relative;
}

.workplace-menu__trigger {
  display: flex;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid rgba(90, 178, 211, 0.22);
  border-radius: 999px;
  background: rgba(210, 241, 252, 0.12);
  cursor: pointer;
  color: rgba(240, 243, 249, 0.76);
  font: inherit;
}

.workplace-menu.is-active .workplace-menu__trigger,
.workplace-menu.is-open .workplace-menu__trigger {
  border-color: rgba(88, 193, 228, 0.45);
  background: rgba(168, 226, 246, 0.2);
}

.workplace-menu__popover {
  position: absolute;
  z-index: 40;
  top: calc(100% + 10px);
  left: 50%;
  display: grid;
  width: 250px;
  gap: 5px;
  padding: 8px;
  border: 1px solid rgba(115, 194, 222, 0.28);
  border-radius: 18px;
  background: rgba(238, 250, 255, 0.88);
  box-shadow: 0 20px 55px rgba(10, 43, 62, 0.2);
  backdrop-filter: blur(22px) saturate(145%);
  transform: translateX(-50%);
}

.workplace-menu__popover a {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  color: #183c50;
  text-decoration: none;
}

.workplace-menu__popover a:hover { background: rgba(88, 184, 218, 0.14); }
.workplace-menu__popover strong { font-size: .76rem; }
.workplace-menu__popover small { color: #638392; font-size: .58rem; }
.mobile-menu__section { padding: 8px 12px 2px; color: var(--muted); font-size: .58rem; font-weight: 850; letter-spacing: .13em; }

:root[data-theme="dark"] .workplace-menu__popover {
  border-color: rgba(108, 195, 227, 0.24);
  background: rgba(9, 24, 36, 0.9);
}
:root[data-theme="dark"] .workplace-menu__popover a { color: #e7f7ff; }
:root[data-theme="dark"] .workplace-menu__popover small { color: #8db0c1; }

.language-menu summary:hover,
.theme-toggle:hover {
  border-color: rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.language-menu summary::-webkit-details-marker {
  display: none;
}

.language-menu .icon {
  width: 15px;
}

.chevron {
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-right: 1px solid currentcolor;
  border-bottom: 1px solid currentcolor;
  transform: rotate(45deg);
}

.language-menu[open] .chevron {
  margin-top: 3px;
  transform: rotate(225deg);
}

.language-menu__popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 210px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  box-shadow: var(--shadow);
  color: var(--text);
}

.language-option {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  color: var(--text);
  text-align: left;
}

.language-option + .language-option {
  margin-top: 3px;
}

.language-option:hover,
.language-option.is-active {
  background: linear-gradient(135deg, color-mix(in srgb, var(--violet) 12%, transparent), color-mix(in srgb, var(--sky) 12%, transparent));
}

.language-option strong,
.language-option small {
  display: block;
}

.language-option strong {
  color: var(--text);
  font-size: 0.74rem;
}

.language-option small {
  color: var(--muted);
  font-size: 0.62rem;
}

.language-option .icon {
  width: 16px;
  color: var(--turquoise);
  opacity: 0;
}

.language-option.is-active .icon {
  opacity: 1;
}

.theme-toggle {
  position: relative;
  width: 52px;
  min-width: 52px;
  min-height: 28px;
  padding: 0;
  overflow: hidden;
  border-color: rgba(164, 214, 242, 0.3);
  background: linear-gradient(120deg, rgba(123, 203, 239, .22), rgba(113, 91, 213, .2));
  box-shadow: inset 0 1px rgba(255,255,255,.2), inset 0 1px 5px rgba(3, 9, 22, 0.24);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
}

.theme-toggle::before {
  position: absolute;
  z-index: 0;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(255,255,255,.98), rgba(207,232,250,.92));
  box-shadow: 0 3px 9px rgba(3, 9, 22, 0.28);
  content: "";
  transition: transform 220ms cubic-bezier(.2,.8,.2,1), background 200ms ease;
}

.theme-toggle__sun,
.theme-toggle__moon {
  position: absolute;
  z-index: 1;
  width: 22px;
  height: 22px;
  line-height: 22px;
  font-size: 14px;
  font-variation-settings: "FILL" 1, "wght" 500;
  text-align: center;
  transition: color 180ms ease, opacity 180ms ease;
}

.theme-toggle__sun {
  left: 2px;
}

.theme-toggle__moon {
  right: 2px;
}

:root[data-theme="light"] .theme-toggle__sun {
  color: #b56c00;
  opacity: 1;
}

:root[data-theme="light"] .theme-toggle__moon,
:root[data-theme="dark"] .theme-toggle__sun {
  color: rgba(255, 255, 255, 0.46);
  opacity: 0.72;
}

:root[data-theme="dark"] .theme-toggle__moon {
  color: #dce8ff;
  opacity: 1;
}

:root[data-theme="dark"] .theme-toggle::before {
  background: linear-gradient(145deg, #556987, #25344c);
  transform: translateX(26px);
}

.site-header .header-login {
  color: rgba(245, 247, 252, 0.82);
}

.site-header .header-login:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.site-header .header-cta {
  border-color: rgba(255, 255, 255, 0.13);
  box-shadow: 0 10px 25px rgba(5, 8, 14, 0.24), inset 0 1px rgba(255, 255, 255, 0.2);
}

.header-account-avatar {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sky), var(--sapphire) 48%, var(--violet-deep));
  box-shadow: 0 9px 22px rgba(5, 8, 14, 0.28), inset 0 1px rgba(255, 255, 255, 0.38);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
}

.mobile-menu,
.mobile-tabs {
  display: none;
}

.site-footer {
  margin-top: 70px;
  padding-bottom: var(--safe-bottom);
  border-top: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--surface-strong) 78%, transparent);
  backdrop-filter: blur(16px) saturate(125%);
  -webkit-backdrop-filter: blur(16px) saturate(125%);
}

.site-footer__inner {
  display: grid;
  min-height: 112px;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 28px;
}

.site-footer__brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.site-footer__brand > span,
.site-footer__copyright,
.site-footer nav a {
  color: var(--muted);
  font-size: 0.68rem;
}

.site-footer nav {
  display: flex;
  gap: 24px;
}

.site-footer nav a:hover {
  color: var(--text);
}

.site-footer__copyright {
  justify-self: end;
}

@media (max-width: 1160px) {
  .desktop-nav {
    gap: 14px;
  }

  .site-header__inner {
    grid-template-columns: 175px auto 175px;
  }

  .language-menu summary > span:not(.chevron) {
    display: none;
  }
}

@media (max-width: 1080px) {
  .site-shell > main {
    min-height: calc(100dvh - 68px);
    padding-bottom: calc(70px + var(--safe-bottom));
  }

  .site-header {
    min-height: calc(66px + var(--safe-top));
  }

  .site-header__inner {
    display: flex;
    min-height: 65px;
    justify-content: space-between;
  }

  .brand {
    width: 164px;
    height: 58px;
  }

  .brand img {
    width: 176px;
  }

  .desktop-nav,
  .header-login,
  .header-cta,
  .header-account-avatar {
    display: none;
  }

  .site-header__actions {
    gap: 1px;
  }

  .language-menu summary {
    width: 44px;
    padding: 0;
  }

  .language-menu summary > span {
    display: none;
  }

  .mobile-menu {
    display: block;
  }

  .mobile-menu__trigger {
    display: grid;
    width: 44px;
    height: 44px;
    place-content: center;
    gap: 6px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.065);
    color: #fff;
    cursor: pointer;
  }

  .mobile-menu__trigger span {
    width: 18px;
    height: 1.5px;
    border-radius: 2px;
    background: currentcolor;
    transition: transform 160ms ease;
  }

  .mobile-menu.is-open .mobile-menu__trigger span:first-child {
    transform: translateY(3.75px) rotate(45deg);
  }

  .mobile-menu.is-open .mobile-menu__trigger span:last-child {
    transform: translateY(-3.75px) rotate(-45deg);
  }

  .mobile-menu__backdrop {
    position: fixed;
    z-index: -1;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgba(2, 4, 8, 0.42);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    cursor: default;
  }

  .mobile-menu__popover {
    position: fixed;
    z-index: 102;
    top: calc(76px + var(--safe-top));
    right: max(16px, var(--safe-right));
    display: grid;
    width: min(360px, calc(100vw - max(32px, var(--safe-left) + var(--safe-right))));
    max-height: calc(100dvh - 166px - var(--safe-top) - var(--safe-bottom));
    overflow-y: auto;
    gap: 3px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--surface-raised);
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.34);
    color: var(--text);
    animation: mobile-menu-in 170ms ease-out both;
  }

  .mobile-menu__popover > a:not(.button) {
    display: flex;
    min-height: 48px;
    align-items: center;
    padding: 0 14px;
    border-radius: 14px;
    color: var(--text-soft);
    font-size: 0.83rem;
    font-weight: 690;
  }

  .mobile-menu__popover > a:not(.button):hover {
    background: var(--surface-subtle);
    color: var(--text);
  }

  .mobile-menu__popover .button {
    min-height: 48px;
    margin-top: 4px;
  }

  .mobile-tabs {
    position: fixed;
    z-index: 95;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    min-height: calc(64px + var(--safe-bottom));
    grid-template-columns: repeat(var(--mobile-tab-count, 5), minmax(0, 1fr));
    padding: 6px max(8px, var(--safe-right)) var(--safe-bottom) max(8px, var(--safe-left));
    border-top: 1px solid var(--line);
    background: var(--mobile-nav-bg);
    box-shadow: 0 -12px 34px rgba(8, 10, 16, 0.1);
    backdrop-filter: blur(26px) saturate(150%);
    -webkit-backdrop-filter: blur(26px) saturate(150%);
  }

  .mobile-tabs--2 { --mobile-tab-count: 2; }
  .mobile-tabs--3 { --mobile-tab-count: 3; }
  .mobile-tabs--4 { --mobile-tab-count: 4; }
  .mobile-tabs--5 { --mobile-tab-count: 5; }

  .mobile-tabs__item {
    position: relative;
    display: grid;
    min-width: 0;
    min-height: 52px;
    place-content: center;
    justify-items: center;
    gap: 1px;
    border-radius: 14px;
    color: var(--muted);
  }

  .mobile-tabs__item::before {
    position: absolute;
    top: 2px;
    width: 24px;
    height: 2px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--sky), var(--violet));
    content: "";
    opacity: 0;
    transform: scaleX(0.45);
    transition: opacity 150ms ease, transform 150ms ease;
  }

  .mobile-tabs__item.is-active {
    background: color-mix(in srgb, var(--sapphire) 9%, transparent);
    color: var(--sapphire);
  }

  .mobile-tabs__item.is-active::before {
    opacity: 1;
    transform: scaleX(1);
  }

  .mobile-tabs .material-symbols-outlined {
    font-size: 21px;
    font-variation-settings: "FILL" 0, "wght" 360, "GRAD" 0, "opsz" 24;
  }

  .mobile-tabs small {
    max-width: 100%;
    overflow: hidden;
    font-size: 0.6rem;
    font-weight: 720;
    line-height: 1.2;
    text-overflow: ellipsis;
  }

  .site-footer {
    margin-top: 36px;
  }

  .site-footer__inner {
    min-height: 120px;
    grid-template-columns: 1fr auto;
  }

  .site-footer nav {
    display: none;
  }

  .site-footer__copyright {
    justify-self: end;
  }
}

@media (max-width: 520px) {
  .site-header .container {
    width: calc(100% - max(24px, var(--safe-left) + var(--safe-right)));
  }

  .brand {
    width: 144px;
  }

  .brand img {
    width: 157px;
  }

  .site-footer__inner {
    display: flex;
    min-height: 134px;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    text-align: center;
  }
}

@keyframes mobile-menu-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-menu__popover,
  .desktop-nav__link::after,
  .mobile-tabs__item::before,
  .theme-toggle__sun,
  .theme-toggle__moon {
    animation: none;
    transition: none;
  }
}
