.auth-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.auth-modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.auth-modal {
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 16px;
  padding: 2rem;
  width: 100%;
  max-width: 400px;
  margin: 1rem;
  transform: translateY(12px);
  transition: transform 0.2s;
}

.auth-modal-overlay.open .auth-modal {
  transform: translateY(0);
}

.auth-modal-close {
  float: right;
  background: none;
  border: none;
  color: #71717a;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0;
}

.auth-modal-close:hover { color: #fff; }

.auth-tabs {
  display: flex;
  gap: 0;
  margin: 1rem 0 1.5rem;
  background: #27272a;
  border-radius: 8px;
  padding: 3px;
}

.auth-tab {
  flex: 1;
  background: none;
  border: none;
  color: #71717a;
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s;
}

.auth-tab.active {
  background: #3b82f6;
  color: #fff;
}

.auth-form { display: none; }
.auth-form.active { display: block; }

.auth-form h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.25rem;
}

.auth-form p {
  color: #71717a;
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}

.auth-field {
  margin-bottom: 1rem;
}

.auth-field label {
  display: block;
  font-size: 0.875rem;
  color: #a1a1aa;
  margin-bottom: 0.375rem;
}

.auth-field input {
  width: 100%;
  background: #27272a;
  border: 1px solid #3f3f46;
  border-radius: 8px;
  color: #fff;
  padding: 0.625rem 0.875rem;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.auth-field input:focus { border-color: #3b82f6; }

.auth-submit {
  width: 100%;
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.7rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: background 0.15s;
}

.auth-submit:hover { background: #2563eb; }
.auth-submit:disabled { background: #3f3f46; cursor: not-allowed; }

.auth-msg {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  display: none;
}

.auth-msg.error { background: #450a0a; color: #fca5a5; display: block; }
.auth-msg.success { background: #052e16; color: #86efac; display: block; }

.nav-auth-btn {
  background: none;
  border: 1px solid #3f3f46;
  color: #e4e4e7;
  padding: 0.4rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.15s;
}

.nav-auth-btn:hover { border-color: #3b82f6; color: #3b82f6; }

.nav-auth-btn.primary {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}

.nav-auth-btn.primary:hover { background: #2563eb; }

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Avatar wrapper + dropdown */
.nav-avatar-wrap {
  position: relative;
}

.nav-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  overflow: hidden;
  border: 2px solid #3f3f46;
  transition: border-color 0.15s, box-shadow 0.15s;
  user-select: none;
  flex-shrink: 0;
}

.nav-avatar:hover {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
}

.nav-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.nav-avatar-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: #1c1c1f;
  border: 1px solid #2e2e32;
  border-radius: 10px;
  min-width: 200px;
  padding: 0.5rem;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.15s, transform 0.15s;
  z-index: 200;
}

.nav-avatar-menu.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.nav-avatar-header {
  padding: 0.5rem 0.5rem 0.75rem;
}

.nav-avatar-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.15rem;
}

.nav-avatar-email {
  display: block;
  font-size: 0.78rem;
  color: #a1a1aa;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-avatar-divider {
  height: 1px;
  background: #2e2e32;
  margin: 0.25rem 0;
}

.nav-avatar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  background: none;
  border: none;
  color: #d4d4d8;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  font-family: inherit;
  text-align: left;
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
}

.nav-avatar-item:hover {
  background: #2a2a2e;
  color: #fff;
}

.nav-avatar-item svg {
  color: #a1a1aa;
}

.nav-avatar-item:hover svg {
  color: #fff;
}

.nav-avatar-badge {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 700;
  background: #3f3f46;
  color: #fff;
  padding: 0.1rem 0.4rem;
  border-radius: 12px;
}

.nav-logout {
  color: #a1a1aa;
}

.nav-logout:hover { background: #2e1515; color: #ef4444; }
.nav-logout:hover svg { color: #ef4444; }

.nav-token-count {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #6366f1 0%, #3b82f6 100%);
  padding: 0.3rem 0.8rem 0.3rem 0.6rem;
  border-radius: 20px;
  box-shadow: 0 1px 8px rgba(99,102,241,0.4);
  white-space: nowrap;
  cursor: default;
  letter-spacing: 0.01em;
  transition: box-shadow 0.2s;
}

.nav-token-count:hover {
  box-shadow: 0 2px 14px rgba(99,102,241,0.55);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
  color: #52525b;
  font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #27272a;
}

.auth-google-btn {
  width: 100%;
  background: #fff;
  color: #18181b;
  border: none;
  border-radius: 8px;
  padding: 0.65rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  transition: background 0.15s;
}

.auth-google-btn:hover { background: #e4e4e7; }

.token-error-banner {
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: #450a0a;
  color: #fca5a5;
  border: 1px solid #7f1d1d;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  flex-wrap: wrap;
}

.token-error-buy {
  background: #ef4444;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s;
}

.token-error-buy:hover { background: #dc2626; }

.token-error-close {
  background: none;
  border: none;
  color: #fca5a5;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.2rem;
}

.token-error-close:hover { color: #fff; }
