/* ============ Shared theme layer: auth overlay, theme toggle, dark mode ============ */

/* ---------- Login / signup overlay (v3 redesign) ---------- */
:root {
  --jm-brand: #1a6cf5;
  --jm-brand-dark: #0d4fc4;
  --jm-ink: #0f1b33;
  --jm-muted: #5b6b82;
  --jm-line: #d9e2ef;
  --jm-danger: #ef4444;
  --jm-radius: 14px;
  --jm-tc: #0087fe;
}
.jm-auth-overlay {
  position: fixed; inset: 0; z-index: 500;
  background:
    radial-gradient(80% 60% at 10% 0%, rgba(26, 108, 245, 0.35), transparent 55%),
    radial-gradient(70% 50% at 90% 100%, rgba(0, 135, 254, 0.22), transparent 50%),
    rgba(6, 14, 32, 0.72);
  backdrop-filter: blur(10px);
  display: grid; place-items: center; padding: 20px;
  opacity: 0; visibility: hidden; transition: opacity 0.22s ease, visibility 0.22s ease;
}
.jm-auth-overlay.open { opacity: 1; visibility: visible; }
.jm-auth-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), #fff 40%),
    radial-gradient(120% 80% at 0% 0%, rgba(26, 108, 245, 0.1), transparent 55%),
    radial-gradient(90% 70% at 100% 0%, rgba(14, 165, 233, 0.08), transparent 50%);
  border-radius: 24px; padding: 26px 24px 22px;
  width: 100%; max-width: 460px; position: relative;
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  transform: translateY(16px) scale(0.97); transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 32px 72px rgba(8, 18, 40, 0.32);
  max-height: 92vh; overflow-y: auto; overflow-x: hidden;
  border: 1px solid rgba(255, 255, 255, 0.65);
}
.jm-auth-overlay.open .jm-auth-card { transform: translateY(0) scale(1); }
.jm-auth-close {
  position: absolute; top: 14px; right: 14px; width: 36px; height: 36px;
  border-radius: 12px; background: #f1f5fb; color: #56637d; border: none; cursor: pointer;
  display: grid; place-items: center; transition: background 0.15s, color 0.15s, transform 0.15s;
}
.jm-auth-close:hover { background: #e6ecf6; color: var(--jm-ink); transform: rotate(90deg); }
.jm-auth-close:focus-visible { outline: 2px solid var(--jm-brand); outline-offset: 2px; }

/* Header */
.jm-auth-head { text-align: center; margin-bottom: 14px; }
.jm-auth-logo {
  width: 52px; height: 52px; border-radius: 16px; margin: 0 auto 10px;
  background: linear-gradient(135deg, #2f7bff, #1a6cf5); color: #fff;
  display: grid; place-items: center; font-size: 1rem;
  overflow: hidden; flex-shrink: 0; box-shadow: 0 10px 24px rgba(26, 108, 245, 0.3);
}
.brand-icon img, .jm-auth-logo img, .auth-brand > span:first-child img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.brand-icon:has(img), .jm-auth-logo:has(img) { background: none; padding: 0; overflow: hidden; }
.brand-icon:has(img)::after { display: none; }
.jm-auth-brand {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--jm-ink);
}
.jm-auth-brand span { color: var(--jm-brand); }
.jm-auth-head h2 {
  font-size: 1.42rem; font-weight: 800; color: var(--jm-ink); margin: 0 0 4px; letter-spacing: -0.03em;
}
.jm-auth-sub { font-size: 0.86rem; color: var(--jm-muted); margin: 0; line-height: 1.4; min-height: 1.2em; }

/* Mode tabs — always visible with Truecaller */
.jm-auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  margin: 0 0 14px;
  border-radius: 14px;
  background: #eef3fa;
  border: 1px solid #e2e8f0;
}
.jm-auth-tabs[hidden] { display: none !important; }
.jm-auth-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: #64748b;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.jm-auth-tab:hover { color: var(--jm-ink); }
.jm-auth-tab.active {
  background: #fff;
  color: var(--jm-brand);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

/* Truecaller — PERMANENT: never hide via .jm-signup / mode-login rules.
   Lives OUTSIDE #jmAuthForm so login-mode .jm-signup { display:none } cannot remove it. */
.jm-truecaller-block,
#jmAuthOverlay .jm-truecaller-block {
  display: flex !important;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 12px;
}
.jm-truecaller-block[hidden] { display: none !important; }
/* Hard guard also placed after .mode-login .jm-signup rules below */
.jm-truecaller-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1.5px solid #b9ddff;
  background: linear-gradient(135deg, #f3f9ff, #e8f4ff);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: transform 0.12s, box-shadow 0.15s, border-color 0.15s;
  box-shadow: 0 6px 16px rgba(0, 135, 254, 0.12);
}
.jm-truecaller-btn:hover {
  transform: translateY(-1px);
  border-color: #7ec4ff;
  box-shadow: 0 10px 22px rgba(0, 135, 254, 0.18);
}
.jm-truecaller-btn:disabled { opacity: 0.65; cursor: wait; transform: none; }
.jm-tc-mark {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; flex-shrink: 0;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(0, 135, 254, 0.15);
}
.jm-tc-icon { width: 28px; height: 28px; display: block; }
.jm-tc-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.jm-tc-copy strong {
  font-size: 0.92rem;
  font-weight: 800;
  color: #0b3a6e;
  letter-spacing: -0.01em;
}
.jm-tc-copy small {
  font-size: 0.72rem;
  font-weight: 600;
  color: #5b7a9a;
}
.jm-truecaller-hint {
  margin: 0;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: #7b8da3;
}
.jm-auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.jm-auth-divider[hidden] { display: none !important; }
.jm-auth-divider::before,
.jm-auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, #d5deea, transparent);
}
.jm-auth-divider span { white-space: nowrap; }

/* Progress (replaces crowded step circles) */
.jm-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 4px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.92);
  border: 1px solid #e8eef6;
}
.jm-progress-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.jm-progress-step {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--jm-brand);
}
.jm-progress-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: #0f172a;
  text-align: right;
}
.jm-progress-track {
  height: 6px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}
.jm-progress-fill {
  height: 100%;
  width: 20%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1a6cf5, #38bdf8);
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.jm-progress-dots {
  display: flex;
  gap: 5px;
  justify-content: center;
}
.jm-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: background 0.2s, transform 0.2s;
}
.jm-dot.active { background: var(--jm-brand); transform: scale(1.25); }
.jm-dot.done { background: #22c55e; }

/* Form + fields */
#jmAuthForm { display: flex; flex-direction: column; gap: 14px; }
#jmAuthForm[hidden] { display: none; }
.jm-step-panel { display: flex; flex-direction: column; gap: 14px; }
#jmAuthForm.mode-signup .jm-step-panel { animation: jmSlideIn 0.32s cubic-bezier(0.22, 1, 0.36, 1); }
#jmAuthForm.mode-login .jm-step-panel { display: contents; }
#jmAuthForm.mode-login .jm-signup { display: none !important; }
#jmAuthForm.mode-login .jm-progress { display: none; }
/* Truecaller must stay visible even if mistakenly given .jm-signup */
#jmAuthForm.mode-login .jm-truecaller-block,
#jmAuthForm.mode-signup .jm-truecaller-block,
#jmAuthOverlay .jm-truecaller-block:not([hidden]) {
  display: flex !important;
}
#jmAuthForm.mode-signup[data-step="1"] .jm-step-panel[data-panel="2"],
#jmAuthForm.mode-signup[data-step="1"] .jm-step-panel[data-panel="3"],
#jmAuthForm.mode-signup[data-step="1"] .jm-step-panel[data-panel="4"],
#jmAuthForm.mode-signup[data-step="1"] .jm-step-panel[data-panel="5"] { display: none; }
#jmAuthForm.mode-signup[data-step="2"] .jm-step-panel[data-panel="1"],
#jmAuthForm.mode-signup[data-step="2"] .jm-step-panel[data-panel="3"],
#jmAuthForm.mode-signup[data-step="2"] .jm-step-panel[data-panel="4"],
#jmAuthForm.mode-signup[data-step="2"] .jm-step-panel[data-panel="5"] { display: none; }
#jmAuthForm.mode-signup[data-step="3"] .jm-step-panel[data-panel="1"],
#jmAuthForm.mode-signup[data-step="3"] .jm-step-panel[data-panel="2"],
#jmAuthForm.mode-signup[data-step="3"] .jm-step-panel[data-panel="4"],
#jmAuthForm.mode-signup[data-step="3"] .jm-step-panel[data-panel="5"] { display: none; }
#jmAuthForm.mode-signup[data-step="4"] .jm-step-panel[data-panel="1"],
#jmAuthForm.mode-signup[data-step="4"] .jm-step-panel[data-panel="2"],
#jmAuthForm.mode-signup[data-step="4"] .jm-step-panel[data-panel="3"],
#jmAuthForm.mode-signup[data-step="4"] .jm-step-panel[data-panel="5"] { display: none; }
#jmAuthForm.mode-signup[data-step="5"] .jm-step-panel[data-panel="1"],
#jmAuthForm.mode-signup[data-step="5"] .jm-step-panel[data-panel="2"],
#jmAuthForm.mode-signup[data-step="5"] .jm-step-panel[data-panel="3"],
#jmAuthForm.mode-signup[data-step="5"] .jm-step-panel[data-panel="4"] { display: none; }
#jmAuthForm.mode-signup:not(.seeker-flow) .jm-seeker-step { display: none; }

.jm-field { display: flex; flex-direction: column; gap: 7px; }
.jm-field > label { font-size: 0.78rem; font-weight: 700; color: #334155; letter-spacing: 0.01em; }
.jm-field .req { color: var(--jm-danger); }

/* Preference chips */
.jm-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.jm-chip {
  appearance: none;
  border: 1.5px solid #dce3ef;
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.12s;
}
.jm-chip:hover { border-color: #b6c2d6; transform: translateY(-1px); }
.jm-chip.active {
  border-color: var(--jm-brand);
  background: linear-gradient(135deg, #eef5ff, #e0edff);
  color: #0d4fc4;
}
.jm-field.invalid .jm-chip { border-color: #fca5a5; }
.jm-seeker-prefs,
.jm-seeker-more {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.jm-readiness-for {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, #eef5ff, #f0f9ff);
  border: 1px solid #dbeafe;
  font-size: 0.78rem;
  color: #334155;
  line-height: 1.4;
}
.jm-readiness-for strong { color: #0d4fc4; font-weight: 700; }
.jm-readiness-source {
  margin: -6px 0 0;
  font-size: 0.7rem;
  font-weight: 700;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
}
.jm-readiness-source i { color: #1a6cf5; }
.jm-readiness-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 600;
}
.jm-readiness-loading[hidden] { display: none !important; }
.jm-field.jm-dim { opacity: 0.55; pointer-events: none; transition: opacity 0.2s; }
.jm-field > label em {
  font-style: normal;
  color: var(--jm-brand);
  font-weight: 800;
}
.jm-seeker-prefs[hidden],
.jm-terms-employer[hidden],
.jm-terms-seeker[hidden] { display: none !important; }
#jmAuthForm select:disabled { background: #f8fafc; color: #94a3b8; cursor: not-allowed; }

/* Toggle tags (+ / ×) */
.jm-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.jm-tag {
  appearance: none;
  border: 1.5px solid #dce3ef;
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}
.jm-tag i { font-size: 0.66rem; color: #64748b; }
.jm-tag:hover { border-color: #b6c2d6; transform: translateY(-1px); }
.jm-tag.active {
  border-color: #f0d7a8;
  background: linear-gradient(135deg, #fff8eb, #fff1d6);
  color: #0f172a;
}
.jm-tag.active i { color: #92400e; }
.jm-field.invalid .jm-tag { border-color: #fca5a5; }

/* Preferred roles + Gemini category images */
.jm-seeker-roles { display: flex; flex-direction: column; gap: 10px; }
.jm-role-search {
  position: relative;
  display: flex;
  align-items: center;
}
.jm-role-search input {
  width: 100%;
  height: 46px;
  border: 1.5px solid var(--jm-line);
  border-radius: 14px;
  padding: 0 42px 0 16px;
  font: inherit;
  font-size: 0.88rem;
  background: #fff;
  outline: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.jm-role-search input:focus {
  border-color: var(--jm-brand);
  box-shadow: 0 0 0 3px rgba(26, 108, 245, 0.12);
}
.jm-role-search i {
  position: absolute;
  right: 14px;
  color: #94a3b8;
  pointer-events: none;
}
.jm-role-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(44vh, 360px);
  overflow-y: auto;
  padding: 2px 4px 2px 0;
  scrollbar-width: thin;
}
.jm-role-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1.5px solid #e8eef6;
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s, box-shadow 0.15s;
  animation: jmRoleIn 0.35s ease both;
}
.jm-role-card:nth-child(1) { animation-delay: 0.02s; }
.jm-role-card:nth-child(2) { animation-delay: 0.05s; }
.jm-role-card:nth-child(3) { animation-delay: 0.08s; }
.jm-role-card:nth-child(4) { animation-delay: 0.11s; }
.jm-role-card:nth-child(5) { animation-delay: 0.14s; }
.jm-role-card:hover {
  border-color: #c7d5ea;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}
.jm-role-card.selected {
  border-color: var(--jm-brand);
  background: linear-gradient(135deg, #f5f9ff, #eef5ff);
  box-shadow: 0 0 0 3px rgba(26, 108, 245, 0.1);
}
.jm-role-thumb {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 1.05rem;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}
.jm-role-thumb.has-img i {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.jm-role-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.jm-role-meta { flex: 1; min-width: 0; }
.jm-role-meta strong {
  display: block;
  font-size: 0.9rem;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.jm-role-meta small {
  display: block;
  font-size: 0.7rem;
  color: #64748b;
  margin-top: 2px;
}
.jm-role-check {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  border: 1.5px solid #d7deea;
  display: grid;
  place-items: center;
  color: #94a3b8;
  flex-shrink: 0;
  font-size: 0.72rem;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.jm-role-card.selected .jm-role-check {
  background: var(--jm-brand);
  border-color: var(--jm-brand);
  color: #fff;
}
.jm-role-empty {
  padding: 28px 12px;
  text-align: center;
  color: #94a3b8;
  font-size: 0.84rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.jm-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #cbd5e1;
  border-top-color: var(--jm-brand);
  border-radius: 50%;
  animation: jmSpin 0.7s linear infinite;
}
.jm-role-hint {
  font-size: 0.72rem;
  color: #64748b;
  font-weight: 600;
}
.jm-field.invalid .jm-role-list { outline: 1px solid #fca5a5; border-radius: 12px; }

@keyframes jmRoleIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes jmSpin {
  to { transform: rotate(360deg); }
}

@media (max-width: 520px) {
  .jm-auth-card { padding: 22px 16px 18px; border-radius: 0; }
  .jm-role-list { max-height: min(50vh, 380px); }
  .jm-progress { padding: 10px 12px; }
}
.jm-pass-hint { color: var(--jm-muted); font-size: 0.72rem; font-weight: 500; margin-top: -2px; }

.jm-input-wrap { position: relative; display: flex; align-items: center; width: 100%; }
.jm-input-wrap > i {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 16px; text-align: center; color: #9aa7bd; font-size: 0.9rem; line-height: 1;
  pointer-events: none; transition: color 0.15s;
}
.jm-input-wrap:focus-within > i { color: var(--jm-brand); }

#jmAuthForm input, #jmAuthForm select {
  width: 100%; height: 46px; border: 1.5px solid var(--jm-line); border-radius: var(--jm-radius);
  padding: 0 14px; font-size: 0.9rem; outline: none; font-family: inherit; color: var(--jm-ink);
  background: #fff; transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}
/* Higher specificity than #jmAuthForm input so the icon never overlaps the text/placeholder */
#jmAuthForm .jm-input-wrap input { padding-left: 44px; }
#jmAuthForm input::placeholder { color: #aab4c5; }
#jmAuthForm input:hover, #jmAuthForm select:hover { border-color: #cdd6e6; }
#jmAuthForm input:focus, #jmAuthForm select:focus {
  border-color: var(--jm-brand); box-shadow: 0 0 0 3px rgba(26, 108, 245, 0.14);
}
#jmAuthForm input.invalid, #jmAuthForm select.invalid { border-color: var(--jm-danger); background: #fff7f7; }
#jmAuthForm input.invalid:focus, #jmAuthForm select.invalid:focus { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14); }

.jm-field-err {
  color: var(--jm-danger); font-size: 0.74rem; font-weight: 600;
  max-height: 0; opacity: 0; overflow: hidden; transition: max-height 0.2s ease, opacity 0.2s ease;
}
.jm-field.invalid .jm-field-err { max-height: 40px; opacity: 1; }

/* Phone row */
.jm-phone-row { display: flex; gap: 8px; }
.jm-phone-row select { width: auto; flex: 0 0 96px; padding: 0 6px 0 10px; font-weight: 600; }
.jm-phone-row .jm-input-wrap { flex: 1; min-width: 0; }

/* Terms + privacy */
.jm-terms { gap: 4px; }
.jm-terms .jm-check {
  display: flex; align-items: flex-start; gap: 10px; font-size: 0.82rem;
  color: #475569; font-weight: 500; cursor: pointer; line-height: 1.45;
  width: 100%; max-width: 100%;
}
.jm-terms .jm-check input {
  width: 18px; height: 18px; margin: 1px 0 0; flex: 0 0 18px; accent-color: var(--jm-brand); cursor: pointer;
}
.jm-terms .jm-check > span { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.jm-terms a { color: var(--jm-brand); font-weight: 600; text-decoration: none; }
.jm-terms a:hover { text-decoration: underline; }

/* Error banner */
.jm-auth-err { color: var(--jm-danger); font-size: 0.8rem; font-weight: 600; min-height: 2px; text-align: center; }

/* Actions */
.jm-auth-actions { display: flex; gap: 10px; align-items: stretch; width: 100%; }
.jm-auth-submit {
  flex: 1 1 auto; min-width: 0; background: var(--jm-brand); color: #fff; border: none; font-weight: 700; font-size: 0.95rem;
  height: 48px; border-radius: var(--jm-radius); cursor: pointer; font-family: inherit;
  transition: background 0.15s, transform 0.12s, box-shadow 0.15s;
  box-shadow: 0 8px 18px rgba(26, 108, 245, 0.26);
}
.jm-auth-submit:hover { background: var(--jm-brand-dark); transform: translateY(-1px); box-shadow: 0 10px 22px rgba(26, 108, 245, 0.32); }
.jm-auth-submit:active { transform: translateY(0); }
.jm-auth-submit:focus-visible { outline: 2px solid var(--jm-brand-dark); outline-offset: 2px; }
.jm-auth-submit:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; transform: none; background: var(--jm-brand); }
.jm-auth-back {
  flex: 0 0 auto; background: #f1f5fb; color: #475569; border: none; font-weight: 700; font-size: 0.9rem;
  height: 48px; padding: 0 20px; border-radius: var(--jm-radius); cursor: pointer; font-family: inherit;
  transition: background 0.15s;
}
.jm-auth-back:hover { background: #e6ecf6; }
.jm-auth-back:focus-visible { outline: 2px solid var(--jm-brand); outline-offset: 2px; }

/* Switch line */
.jm-auth-switch { text-align: center; font-size: 0.85rem; color: var(--jm-muted); margin: 4px 0 0; }
.jm-auth-switch a { color: var(--jm-brand); font-weight: 700; text-decoration: none; cursor: pointer; }
.jm-auth-switch a:hover { text-decoration: underline; }

/* Forgot password link (login mode only) */
.jm-forgot-row { text-align: right; margin: -6px 0 2px; }
.jm-forgot-row a { font-size: 0.82rem; font-weight: 600; color: var(--jm-brand); text-decoration: none; cursor: pointer; }
.jm-forgot-row a:hover { text-decoration: underline; }
#jmAuthForm.mode-signup .jm-forgot-row { display: none; }

/* Reset password panel */
.jm-reset-panel { display: flex; flex-direction: column; gap: 14px; }
.jm-reset-panel[hidden] { display: none; }
.jm-reset-panel .jm-auth-submit { width: 100%; }
.jm-reset-panel input {
  width: 100%; height: 46px; border: 1.5px solid var(--jm-line); border-radius: var(--jm-radius);
  padding: 0 14px 0 44px; font-size: 0.9rem; outline: none; font-family: inherit; color: var(--jm-ink);
  background: #fff; transition: border-color 0.16s, box-shadow 0.16s;
}
.jm-reset-panel input::placeholder { color: #aab4c5; }
.jm-reset-panel input:focus { border-color: var(--jm-brand); box-shadow: 0 0 0 3px rgba(26, 108, 245, 0.14); }
.jm-reset-panel label { font-size: 0.8rem; font-weight: 700; color: var(--jm-ink); }
.jm-reset-panel .jm-field-err { max-height: none; opacity: 1; }
.jm-reset-ok[hidden] { display: none; }
.jm-reset-ok {
  display: flex; align-items: flex-start; gap: 8px;
  background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46;
  border-radius: 10px; padding: 10px 12px; font-size: 0.85rem; line-height: 1.45;
}
.jm-reset-ok i { color: #10b981; margin-top: 2px; }

@keyframes jmSlideIn {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
  .jm-auth-card, #jmAuthForm.mode-signup .jm-step-panel, .jm-auth-close, .jm-auth-submit { transition: none; animation: none; }
}

/* Responsive */
@media (max-width: 520px) {
  .jm-auth-overlay { padding: 0; place-items: stretch; }
  .jm-auth-card {
    max-width: 100%; min-height: 100%; border-radius: 0; padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
    max-height: 100vh;
  }
  .jm-auth-head h2 { font-size: 1.3rem; }
  .jm-phone-row select { flex-basis: 88px; }
}

/* ---------- Theme toggle ---------- */
.jm-theme-toggle {
  position: fixed; bottom: 22px; left: 22px; z-index: 400;
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid #e6ebf4;
  background: #fff; color: #16243d; font-size: 1rem; cursor: pointer;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18); transition: transform 0.15s;
  display: grid; place-items: center;
}
.jm-theme-toggle:hover { transform: scale(1.08); }
/* Sit above mobile bottom nav so it doesn't overlap after logout / on guest home */
@media (max-width: 768px) {
  .jm-theme-toggle {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
}

/* ---------- Dark mode (filter-based, re-inverts media) ---------- */
html[data-theme="dark"] {
  background: #0d1117;
}
html[data-theme="dark"] body {
  filter: invert(0.93) hue-rotate(180deg);
  background: #0d1117;
}
html[data-theme="dark"] body img,
html[data-theme="dark"] body video,
html[data-theme="dark"] body .hero-person svg {
  filter: invert(1) hue-rotate(180deg);
}

/* ---------- Live badge ---------- */
.jm-live {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.66rem; font-weight: 800; color: #16a34a;
}
.jm-live::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: #16a34a;
  animation: jmpulse 1.6s infinite;
}
@keyframes jmpulse { 50% { box-shadow: 0 0 0 5px rgba(22, 163, 74, 0.15); } }
