/* ── Mobile menu redesign ── */
.mobile-menu {
  display: flex;
  flex-direction: column;
  top: var(--nav-h, 64px);
  height: calc(100dvh - var(--nav-h, 64px));
  max-height: 100dvh;
  max-height: calc(100dvh - var(--nav-h, 64px));
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-top: 8px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 999;
}

.nav { overflow: visible; }

.mobile-menu:not(.is-open) {
  display: none;
}

/* The real sticky nav is the drawer header on mobile. */
.mobile-menu-close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #6b7d99;
  cursor: pointer;
  z-index: 1;
  transition: background 0.15s, color 0.15s;
}
.mobile-menu-close:hover { background: rgba(39,62,87,0.08); color: #273e57; }
.mobile-menu-close svg { width: 18px; height: 18px; }

/* Remove old header when it accidentally remains */
.mobile-menu .mobile-menu-header { display: none; }

.mobile-menu-links {
  flex: 1;
  padding: 0 20px 16px;
  display: flex;
  flex-direction: column;
  border-bottom: none;
}

.mobile-menu-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 4px;
  font-size: 1.05rem;
  font-weight: 600;
  color: #1a2c42;
  border-bottom: 1px solid rgba(39,62,87,0.07);
  transition: color 0.15s, padding-left 0.15s;
  letter-spacing: -.01em;
}

.mobile-menu-links a:last-child { border-bottom: none; }
.mobile-menu-links a:hover { color: #c6a354; padding-left: 8px; }
.mobile-menu-links a.is-active { color: #c6a354; font-weight: 700; }

.mobile-menu-footer {
  padding: 16px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid rgba(39,62,87,0.08);
}

.mobile-menu-login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 700;
  color: #3f526d;
  border: 1px solid rgba(39,62,87,0.10);
  background: rgba(39,62,87,0.03);
  border-radius: 10px;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s;
}
.mobile-menu-login svg { flex-shrink: 0; }
.mobile-menu-login:hover {
  background: rgba(39,62,87,0.06);
  color: #273e57;
  border-color: rgba(39,62,87,0.16);
  transform: translateY(-1px);
}

.mobile-menu-login.is-logout {
  color: #8f2d2d;
  background: rgba(185, 54, 54, 0.07);
  border-color: rgba(185, 54, 54, 0.16);
}

.mobile-menu-login.is-logout:hover {
  color: #7c1f1f;
  background: rgba(185, 54, 54, 0.10);
  border-color: rgba(185, 54, 54, 0.24);
}

/* ── Mobile locale bar ── */
.mobile-locale-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0 6px;
}

.mobile-locale-opt {
  flex: 1;
  padding: 8px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #4b5873;
  background: rgba(39,62,87,0.04);
  border: 1px solid rgba(39,62,87,0.10);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  line-height: 1;
}

.mobile-locale-opt:hover {
  background: rgba(39,62,87,0.08);
  color: #273e57;
  border-color: rgba(39,62,87,0.18);
}

.mobile-locale-opt.is-active {
  background: #1a2940;
  color: #fff;
  border-color: #1a2940;
}

/* Hide mobile nav fix */
@media (max-width: 768px) {
  .nav-inner { gap: 8px; }
  .nav-locale-wrap { display: none; }
  .nav {
    overflow: visible;
    z-index: 1001;
  }

  body.mobile-menu-open .nav {
    position: fixed;
    inset: 0 0 auto;
  }

  .mobile-menu-backdrop {
    top: var(--nav-h, 64px);
    z-index: 998;
  }
}

@media (max-width: 640px) {
  .nav-inner,
  .brand {
    min-width: 0;
  }

  .nav-inner {
    gap: 8px;
  }

  .brand {
    flex: 0 0 auto;
    max-width: none;
    gap: 8px;
  }

  .brand span {
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
  }

  .nav-actions {
    flex: 0 0 auto;
    gap: 4px;
    max-width: calc(100vw - 144px);
  }

  .nav-actions > .btn.btn-primary[href*="simulator"] {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex: 0 1 auto;
    width: auto;
    min-width: 96px;
    max-width: 112px;
    height: 36px;
    padding: 0 9px;
    border-radius: 8px;
    font-size: 11.5px;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    overflow-wrap: normal;
    overflow: hidden;
  }

  .nav-actions > a.nav-user-btn.nav-user-btn-mobile,
  .nav-burger {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 460px) {
  .nav-actions {
    max-width: calc(100vw - 124px);
  }

  .nav-actions > .btn.btn-primary[href*="simulator"] {
    max-width: 104px;
    padding: 0 8px;
    font-size: 11px;
  }
}

@media (max-width: 360px) {
  .nav-actions > .btn.btn-primary[href*="simulator"] {
    min-width: 94px;
    max-width: 94px;
    padding: 0 6px;
    font-size: 10px;
  }

  .nav-actions > a.nav-user-btn.nav-user-btn-mobile,
  .nav-burger {
    width: 34px;
    height: 34px;
  }
}

/* Mobile-only user icon — hidden on desktop, shown on mobile */
.nav-user-btn-mobile { display: none; }

@media (max-width: 960px) {
  /* Show dedicated mobile user icon (higher specificity beats the extracted CSS hide rule) */
  .nav-actions > a.nav-user-btn.nav-user-btn-mobile { display: inline-flex !important; }
  /* Always hide desktop dropdown on mobile */
  .nav-user-dropdown { display: none !important; }
}

@media (max-width: 1180px) {
  .nav-links { display: none; }
  .nav-burger { display: inline-flex; }
  .nav-actions .nav-sep,
  .hide-mobile { display: none !important; }
}

/* Mobile footer fix */
@media (max-width: 640px) {
  .footer-grid { grid-template-columns: 1fr 1fr !important; gap: 24px !important; }
  .footer-grid > div:first-child { grid-column: 1 / -1; }
  .footer-cta h2 { font-size: clamp(1.4rem, 5vw, 2rem) !important; }
}
@media (max-width: 400px) {
  .footer-grid { grid-template-columns: 1fr !important; }
}
