.header-auth-wrap {
  position: relative;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top)) 1rem 1rem;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.auth-modal.open {
  opacity: 1;
  visibility: visible;
}

.auth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 25, 33, 0.65);
  backdrop-filter: blur(4px);
}

.auth-card {
  position: relative;
  width: min(420px, 100%);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  margin: auto 0;
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow-lg);
  animation: authSlideUp 0.3s ease;
}

@keyframes authSlideUp {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.auth-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
}

.auth-card h2 {
  font-size: 1.35rem;
  margin-bottom: 0.35rem;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.btn-google {
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-weight: 600;
}

.btn-google:hover {
  background: var(--bg);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.auth-tab {
  flex: 1;
  padding: 0.55rem;
  border: none;
  border-radius: var(--radius-md);
  background: var(--bg);
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
}

.auth-tab.active {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.auth-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.85rem;
  color: var(--text);
}

.auth-label input {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font: inherit;
}

.auth-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  margin-bottom: 1rem;
  cursor: pointer;
}

.auth-error {
  color: var(--danger);
  font-size: 0.88rem;
  margin-bottom: 0.75rem;
}

.auth-link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.88rem;
  margin-top: 0.75rem;
  cursor: pointer;
  width: 100%;
  text-align: center;
}

.hidden { display: none !important; }

.header-auth-wrap {
  position: relative;
}

.auth-trigger {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
}

.site-top-shell .auth-trigger {
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.06);
}

.site-top-shell .auth-trigger:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(12, 192, 223, 0.1);
}

.auth-avatar {
  display: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
}

.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 0.75rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: 0.2s;
  z-index: 1100;
}

.account-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.account-menu-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}

.account-newsletter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.5rem;
  font-size: 0.88rem;
  cursor: pointer;
}

.account-menu-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 0.5rem;
  border: none;
  background: none;
  text-decoration: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.account-menu-link:hover {
  background: var(--bg);
}

.account-logout {
  color: var(--danger);
}
