/* === Unified user chip + modal styles === */

/* Avatar block */
.user-avatar {
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
  font-size: 16px;
  line-height: 1;
}
.user-avatar.guest {
  background: #9ca3af;
  font-size: 18px;
}

/* Chip */
.user-chip,
.user-chip-loggedin,
.user-chip-guest {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1.5px solid #e5e7eb;
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  text-decoration: none;
}
.user-chip:hover,
.user-chip-loggedin:hover,
.user-chip-guest:hover {
  border-color: #2c6cf6;
  color: #1e40af;
}
.user-chip-guest {
  border-style: dashed;
  border-color: #d1d5db;
  background: #f9fafb;
  color: #6b7280;
}
.user-chip-guest .user-avatar { width: 28px; height: 28px; }
.user-name {
  white-space: nowrap;
}
.user-caret {
  color: #9ca3af;
  font-size: 10px;
  margin-left: 2px;
}

/* Dropdown */
.user-dropdown {
  position: absolute;
  background: #ffffff;
  border-radius: 12px;
  padding: 14px;
  min-width: 260px;
  box-shadow: 0 16px 40px -8px rgba(15, 23, 42, 0.25);
  border: 1px solid #e5e7eb;
  z-index: 1500;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.ud-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 4px 12px;
}
.ud-name { font-size: 15px; font-weight: 700; color: #111827; }
.ud-meta { font-size: 11.5px; color: #6b7280; margin-top: 2px; }
.ud-sep {
  height: 1px;
  background: #f3f4f6;
  margin: 4px 0;
}
.ud-sub {
  font-size: 10.5px;
  font-weight: 800;
  color: #9ca3af;
  letter-spacing: 0.8px;
  padding: 8px 8px 4px;
}
.ud-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 13.5px;
  color: #374151;
  padding: 8px 10px;
  text-align: left;
  border-radius: 7px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
}
.ud-item:hover { background: #f3f4f6; color: #1e40af; }
.ud-item.ud-danger { color: #b91c1c; }
.ud-item.ud-danger:hover { background: #fee2e2; }
.ud-switch .user-avatar { width: 22px; height: 22px; font-size: 12px; }

/* ===== Modal ===== */
.user-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  opacity: 0;
  transition: opacity .18s;
}
.user-modal-overlay.open { opacity: 1; }
.user-modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px -10px rgba(15, 23, 42, 0.4);
  transform: translateY(8px) scale(.98);
  transition: transform .18s;
  position: relative;
}
.user-modal-overlay.open .user-modal { transform: translateY(0) scale(1); }
.user-modal-close {
  position: absolute;
  top: 12px; right: 14px;
  background: rgba(0,0,0,0.06);
  border: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  color: #6b7280;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.user-modal-close:hover { background: rgba(0,0,0,0.12); color: #111827; }

.um-tabs {
  display: flex;
  border-bottom: 1px solid #e5e7eb;
  background: #fafafa;
  padding: 0 60px 0 8px;
}
.um-tab {
  flex: 1;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: #6b7280;
  padding: 14px 10px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}
.um-tab:hover { color: #2c6cf6; }
.um-tab.active {
  color: #2c6cf6;
  border-bottom-color: #2c6cf6;
  background: #fff;
}

.um-body {
  padding: 22px 26px;
  overflow-y: auto;
}
.um-body h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 16px;
  color: #111827;
}

.um-field {
  display: block;
  margin-bottom: 14px;
}
.um-field > span {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: #374151;
  margin-bottom: 6px;
}
.um-field > span small { color: #9ca3af; font-weight: 500; }
.um-field input {
  width: 100%;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
.um-field input:focus {
  border-color: #2c6cf6;
  box-shadow: 0 0 0 3px rgba(44, 108, 246, 0.12);
}
.um-password-wrap {
  position: relative;
}
.um-password-wrap input {
  padding-right: 44px;
}
.um-eye-btn {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.um-eye-btn:hover,
.um-eye-btn.active {
  background: #f3f4f6;
  color: #1d4ed8;
}

.um-avatar-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.um-avatar-opt {
  font-size: 22px;
  background: #f9fafb;
  border: 2px solid transparent;
  border-radius: 8px;
  width: 100%;
  aspect-ratio: 1;
  cursor: pointer;
  transition: all .12s;
}
.um-avatar-opt:hover { background: #eff6ff; }
.um-avatar-opt.selected { border-color: #2c6cf6; background: #eff6ff; transform: scale(1.05); }

.um-color-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.um-color-opt {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform .12s;
}
.um-color-opt:hover { transform: scale(1.1); }
.um-color-opt.selected {
  border-color: #fff;
  box-shadow: 0 0 0 2px #111827;
}

.um-submit {
  width: 100%;
  background: linear-gradient(135deg, #2c6cf6 0%, #6f5af6 100%);
  color: #fff;
  border: none;
  padding: 11px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 6px;
  transition: opacity .15s;
}
.um-submit:hover { opacity: 0.92; }

.um-error {
  margin-top: 10px;
  color: #b91c1c;
  font-size: 13px;
  text-align: center;
  min-height: 18px;
}
.um-note {
  margin-top: 14px;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 7px;
  padding: 8px 12px;
  font-size: 11.5px;
  color: #92400e;
  line-height: 1.55;
}

.um-users-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.um-user-quick {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f9fafb;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 14px;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: all .12s;
}
.um-user-quick:hover {
  border-color: #2c6cf6;
  background: #eff6ff;
}
.um-user-name { font-size: 14px; font-weight: 700; color: #111827; }
.um-user-meta { font-size: 11.5px; color: #6b7280; margin-top: 1px; }

.um-divider {
  display: flex;
  align-items: center;
  margin: 12px 0;
  color: #9ca3af;
  font-size: 11px;
  gap: 8px;
}
.um-divider::before, .um-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}

/* ===== Email registration extras ===== */
.um-secondary {
  width: 100%;
  background: #fff;
  border: 1.5px solid #e5e7eb;
  padding: 10px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #2c6cf6;
  cursor: pointer;
  transition: all .12s;
}
.um-secondary:hover { border-color: #2c6cf6; background: #eff6ff; }

.um-link-btn {
  display: block;
  margin: -6px 0 10px auto;
  padding: 0;
  border: none;
  background: transparent;
  color: #2563eb;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.um-link-btn:hover { text-decoration: underline; }

.um-reset-hint {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  color: #1e40af;
  font-size: 12.5px;
  line-height: 1.55;
}

.um-trial-promo {
  background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 100%);
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #92400e;
  text-align: center;
  line-height: 1.55;
}
.um-trial-promo strong { color: #7c2d12; }

.um-code-row {
  display: flex;
  gap: 8px;
}
.um-code-row input {
  flex: 1;
  font-size: 16px !important;
  letter-spacing: 3px;
  text-align: center;
  font-weight: 700;
  color: #1e40af;
}
.um-code-btn {
  background: linear-gradient(135deg, #2c6cf6 0%, #6f5af6 100%);
  color: #fff;
  border: none;
  padding: 0 16px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  min-width: 110px;
  transition: opacity .15s;
}
.um-code-btn:hover:not(:disabled) { opacity: 0.9; }
.um-code-btn:disabled { background: #9ca3af; cursor: not-allowed; }

/* Code notification (simulated email) */
.um-code-toast {
  position: fixed;
  top: 80px;
  right: 24px;
  background: linear-gradient(135deg, #1e3a8a 0%, #6d28d9 100%);
  color: #fff;
  border-radius: 14px;
  padding: 16px 20px;
  z-index: 3000;
  box-shadow: 0 20px 50px -8px rgba(15, 23, 42, 0.4);
  min-width: 280px;
  cursor: pointer;
  animation: slideInRight .35s ease-out;
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(60px); }
  to { opacity: 1; transform: translateX(0); }
}
.um-code-display {
  background: rgba(255,255,255,0.18);
  border: 2px dashed rgba(255,255,255,0.4);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 8px;
  font-family: "Menlo", monospace;
}

/* Trial welcome card */
.um-trial-welcome {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  z-index: 3500;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .3s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.um-tw-card {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 50%, #fed7aa 100%);
  border-radius: 22px;
  padding: 36px 40px;
  max-width: 440px;
  width: 90%;
  text-align: center;
  box-shadow: 0 30px 80px -10px rgba(245, 158, 11, 0.4);
}
.um-tw-emoji {
  font-size: 80px;
  margin-bottom: 12px;
  animation: bounce 1.2s ease-in-out infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
.um-tw-title {
  font-size: 22px;
  font-weight: 800;
  color: #7c2d12;
  margin-bottom: 10px;
}
.um-tw-sub {
  font-size: 14px;
  color: #92400e;
  line-height: 1.7;
  margin-bottom: 22px;
}
.um-tw-close {
  background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
  color: #fff;
  border: none;
  padding: 12px 32px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s;
}
.um-tw-close:hover { transform: scale(1.05); }

/* Access gate */
.access-locked body {
  overflow: hidden;
}
.access-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 20% 20%, rgba(44, 108, 246, 0.18), transparent 30%),
    rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(10px);
}
.access-gate-card {
  width: min(440px, 100%);
  background: #ffffff;
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 30px 90px -16px rgba(15, 23, 42, 0.55);
  text-align: left;
}
.access-gate-kicker {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 14px;
}
.access-gate-card h2 {
  margin: 0 0 10px;
  color: #111827;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: 0;
}
.access-gate-card p {
  margin: 0;
  color: #4b5563;
  font-size: 14.5px;
  line-height: 1.7;
}
.access-gate-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  flex-wrap: wrap;
}
.access-gate-primary,
.access-gate-secondary {
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  padding: 11px 16px;
}
.access-gate-primary {
  flex: 1 1 190px;
  background: #2563eb;
  color: #fff;
}
.access-gate-secondary {
  background: #f3f4f6;
  color: #374151;
}
