/* ============================================================
   Morgan Auth Modal — scoped under #morgan-auth-modal
   Overrides nothing outside the modal.
   ============================================================ */

/* ---- Modal shell ---- */
#morgan-auth-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999999;
  font-family: 'Sora', system-ui, -apple-system, sans-serif;
  color: #00003C;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;

  /* Brand tokens — available to all children */
  --mac-brand:        #0F33C7;
  --mac-brand-hover:  #0929A3;
  --mac-brand-active: #071EA8;
  --mac-navy:         #00003C;
  --mac-white:        #FFFFFF;
  --mac-border:       #DDDDDD;
  --mac-field-bg:     #F9FAFB;
  --mac-text-muted:   #6B7280;
  --mac-text-faint:   #767C88; /* WCAG AA (≥4.5:1 on white) */
  --mac-disabled-bg:  #D1D5DB;
  --mac-success:      #10B981;
  --mac-success-text: #047857; /* AA-compliant success text on white */
  --mac-error:        #EF4444; /* borders/icons only (3:1 non-text) */
  --mac-error-text:   #DC2626; /* AA-compliant error text on white */
  --mac-s-weak:       #EF4444;
  --mac-s-fair:       #F59E0B;
  --mac-s-good:       #FACC15;
  --mac-s-strong:     #10B981;
  --mac-r-input:      6px;
  --mac-r-pill:       30px;
  --mac-ease:         cubic-bezier(.4,0,.2,1);
}
#morgan-auth-modal.open {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(2, 6, 23, 0.55);   /* dim the page behind */
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
#morgan-auth-modal *,
#morgan-auth-modal *::before,
#morgan-auth-modal *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
#morgan-auth-modal a { color: inherit; }
#morgan-auth-modal button { font-family: inherit; }

/* ============================================================
   SPLIT-SCREEN LAYOUT
   ============================================================ */
#morgan-auth-modal .mac-auth {
  display: grid;
  grid-template-columns: 1fr;   /* form-only popup (left marketing panel removed) */
  width: min(480px, 100%);
  height: auto;
  max-height: 92vh;
  background: var(--mac-white);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 30px 90px rgba(2, 6, 23, 0.40);
}

/* ============================================================
   PAGE MODE — on the dedicated /sign-in/ and /sign-up/ pages the modal
   IS the page (added via .mac-page in JS). Show the full two-panel design,
   make the backdrop opaque so the old theme form can't bleed through, and
   drop the close button so it reads as a real page rather than a popup.
   ============================================================ */
#morgan-auth-modal.mac-page.open {
  background: #00003C;                 /* opaque — hides any theme content behind */
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
#morgan-auth-modal.mac-page .mac-auth {
  grid-template-columns: 1.05fr 1fr;   /* two-panel split (marketing + form) */
  width: min(1040px, 100%);
  height: min(660px, 100%);
  max-height: 96vh;
}
#morgan-auth-modal.mac-page .mac-panel-left { display: flex; }
#morgan-auth-modal.mac-page .mac-close-btn { display: none; }
@media (max-width: 880px) {
  #morgan-auth-modal.mac-page .mac-auth { grid-template-columns: 1fr; height: auto; }
  #morgan-auth-modal.mac-page .mac-panel-left { display: none; }  /* form-only on phones */
}

/* ---- LEFT PANEL (removed — form-only popup) ---- */
#morgan-auth-modal .mac-panel-left {
  position: relative;
  overflow: hidden;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px 56px;
  isolation: isolate;
  color: var(--mac-white);
}
#morgan-auth-modal .mac-panel-left::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background: linear-gradient(135deg, #0a1a6e 0%, #050529 60%, #00003C 100%);
}
#morgan-auth-modal .mac-panel-left::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(0,0,60,.55) 0%, rgba(0,0,60,.78) 100%);
  pointer-events: none;
}
#morgan-auth-modal .mac-panel-left > * { position: relative; }

#morgan-auth-modal .mac-brand-white {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--mac-white);
}
#morgan-auth-modal .mac-left-center { max-width: 460px; margin: auto 0; }
#morgan-auth-modal .mac-left-headline {
  font-size: 38px;
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -.02em;
  margin-bottom: 18px;
  color: var(--mac-white) !important;   /* theme h1 color must not override on the dark panel */
}
#morgan-auth-modal .mac-panel-left,
#morgan-auth-modal .mac-panel-left h1,
#morgan-auth-modal .mac-panel-left p { color: var(--mac-white); }
#morgan-auth-modal .mac-left-subline {
  font-size: 18px;
  line-height: 1.5;
  color: rgba(255,255,255,.7);
}
#morgan-auth-modal .mac-left-divider {
  height: 1px;
  background: rgba(255,255,255,.18);
  margin: 36px 0;
}
#morgan-auth-modal .mac-stats { display: flex; gap: 36px; }
#morgan-auth-modal .mac-stat .mac-stat-num {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
}
#morgan-auth-modal .mac-stat .mac-stat-num svg { width: 20px; height: 20px; opacity: .85; }
#morgan-auth-modal .mac-stat .mac-stat-label { margin-top: 6px; font-size: 13px; color: rgba(255,255,255,.6); }
#morgan-auth-modal .mac-benefits { list-style: none; display: grid; gap: 16px; }
#morgan-auth-modal .mac-benefits li {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 16px;
  color: rgba(255,255,255,.9);
}
#morgan-auth-modal .mac-benefits .mac-tick {
  flex: 0 0 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--mac-brand);
}
#morgan-auth-modal .mac-benefits .mac-tick svg { width: 14px; height: 14px; }
#morgan-auth-modal .mac-left-footnote { font-size: 13px; color: rgba(255,255,255,.5); }

/* Left-panel variant content */
#morgan-auth-modal .mac-left-signup { display: none; }
#morgan-auth-modal .mac-left-signin { display: contents; }
#morgan-auth-modal.mac-mode-signup .mac-left-signin { display: none; }
#morgan-auth-modal.mac-mode-signup .mac-left-signup { display: contents; }

/* ---- RIGHT PANEL ---- */
#morgan-auth-modal .mac-panel-right {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: var(--mac-white);
  padding: 80px 48px 40px;   /* top padding clears the close button (× ends at 64px) */
  overflow-y: auto;
  max-height: 100vh;
  max-height: 100dvh;
}
#morgan-auth-modal .mac-form-wrap {
  width: 100%;
  max-width: 440px;
  animation: mac-fadeIn .4s var(--mac-ease) both;
}
@keyframes mac-fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* Top bar: brand + close button */
#morgan-auth-modal .mac-panel-head {
  position: absolute;
  top: 20px;
  left: 48px;
  right: 48px;
  display: flex;
  align-items: center;
  justify-content: flex-end;   /* only the close button remains */
}
/* Form-only popup: brand logo + language switcher are not needed
   (the popup already opens in the current language/country). */
#morgan-auth-modal .mac-brand,
#morgan-auth-modal .mac-lang-wrap { display: none; }
#morgan-auth-modal .mac-brand {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--mac-brand);
}
#morgan-auth-modal .mac-brand a { text-decoration: none; display: block; line-height: 1; }
#morgan-auth-modal .mac-brand-img { height: 36px; width: auto; display: block; object-fit: contain; }
#morgan-auth-modal .mac-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--mac-field-bg);
  border: 1px solid var(--mac-border);
  border-radius: 50%;
  cursor: pointer;
  color: var(--mac-text-muted);
  transition: background .15s, color .15s;
}
#morgan-auth-modal .mac-close-btn:hover { background: #eee; color: var(--mac-navy); }
#morgan-auth-modal .mac-close-btn svg { width: 16px; height: 16px; }

#morgan-auth-modal .mac-form-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--mac-navy);
  margin-bottom: 6px;
}
#morgan-auth-modal .mac-form-sub { font-size: 15px; color: var(--mac-text-muted); margin-bottom: 26px; }

/* ---- Social buttons ---- */
#morgan-auth-modal .mac-social-stack { display: grid; gap: 8px; margin-bottom: 22px; }
#morgan-auth-modal .mac-btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 48px;
  background: var(--mac-white);
  border: 1px solid var(--mac-border);
  border-radius: var(--mac-r-pill);
  color: var(--mac-navy);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .2s var(--mac-ease), background .2s var(--mac-ease);
}
#morgan-auth-modal .mac-btn-social:hover { border-color: #c4c4c4; background: #fcfcfd; }
#morgan-auth-modal .mac-btn-social svg { width: 19px; height: 19px; flex: 0 0 auto; }

/* ---- OR divider ---- */
#morgan-auth-modal .mac-or {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 4px 0 22px;
}
#morgan-auth-modal .mac-or::before,
#morgan-auth-modal .mac-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--mac-border);
}
#morgan-auth-modal .mac-or span { font-size: 13px; color: var(--mac-text-faint); white-space: nowrap; }

/* ============================================================
   FLOATING-LABEL FIELDS
   ============================================================ */
#morgan-auth-modal .mac-field { position: relative; margin-bottom: 18px; }
#morgan-auth-modal .mac-field-row { display: flex; gap: 14px; }
#morgan-auth-modal .mac-field-row .mac-field { flex: 1; margin-bottom: 18px; }
#morgan-auth-modal .mac-input-wrap { position: relative; }

#morgan-auth-modal .mac-field input {
  width: 100%;
  height: 56px;
  padding: 22px 44px 6px 16px;
  font-family: inherit;
  font-size: 15px;
  color: var(--mac-navy);
  background: var(--mac-field-bg);
  border: 1px solid var(--mac-border);
  border-radius: var(--mac-r-input);
  outline: none;
  transition: border-color .2s var(--mac-ease), box-shadow .2s var(--mac-ease), background .2s var(--mac-ease);
  -webkit-appearance: none;
  appearance: none;
}
#morgan-auth-modal .mac-field input::placeholder { color: transparent; }
#morgan-auth-modal .mac-field label {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  color: var(--mac-text-faint);
  pointer-events: none;
  transition: all .18s var(--mac-ease);
}
#morgan-auth-modal .mac-field input:focus,
#morgan-auth-modal .mac-field input:not(:placeholder-shown) {
  background: var(--mac-white);
}
#morgan-auth-modal .mac-field input:focus {
  border-color: var(--mac-brand);
  box-shadow: 0 0 0 3px rgba(15,51,199,.12);
}
#morgan-auth-modal .mac-field input:focus ~ label,
#morgan-auth-modal .mac-field input:not(:placeholder-shown) ~ label {
  top: 9px;
  transform: translateY(0);
  font-size: 11px;
  font-weight: 600;
  color: var(--mac-brand);
}
/* Right icon (eye / status) */
#morgan-auth-modal .mac-field-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--mac-text-faint);
}
#morgan-auth-modal .mac-field-icon svg { width: 20px; height: 20px; }
#morgan-auth-modal .mac-field-icon.mac-static { cursor: default; }

/* Validation states */
#morgan-auth-modal .mac-field.valid input   { border-color: var(--mac-success); }
#morgan-auth-modal .mac-field.valid input:focus { box-shadow: 0 0 0 3px rgba(16,185,129,.14); }
#morgan-auth-modal .mac-field.invalid input { border-color: var(--mac-error); }
#morgan-auth-modal .mac-field.invalid input:focus { box-shadow: 0 0 0 3px rgba(239,68,68,.14); }
#morgan-auth-modal .mac-field.valid   .mac-status-ok  { display: grid; color: var(--mac-success); }
#morgan-auth-modal .mac-field.invalid .mac-status-bad { display: grid; color: var(--mac-error); }
#morgan-auth-modal .mac-status-ok,
#morgan-auth-modal .mac-status-bad { display: none; }
#morgan-auth-modal .mac-field-msg {
  display: none;
  font-size: 12.5px;
  color: var(--mac-error-text);
  margin: 6px 4px 0;
}
#morgan-auth-modal .mac-field.invalid .mac-field-msg { display: block; }
#morgan-auth-modal .mac-field-hint { font-size: 12.5px; color: var(--mac-text-faint); margin: 7px 4px 0; }

/* Password strength */
#morgan-auth-modal .mac-strength { margin: 10px 2px 0; }
#morgan-auth-modal .mac-strength-bar { display: flex; gap: 6px; }
#morgan-auth-modal .mac-strength-bar span {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: #E5E7EB;
  transition: background .25s var(--mac-ease);
}
#morgan-auth-modal .mac-strength-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 7px;
}
#morgan-auth-modal .mac-strength-label { font-size: 12.5px; font-weight: 600; }
#morgan-auth-modal .mac-strength-hint  { font-size: 11.5px; color: var(--mac-text-faint); }

/* Username availability */
#morgan-auth-modal .mac-avail {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  margin: 7px 4px 0;
  font-weight: 500;
}
#morgan-auth-modal .mac-avail.show     { display: flex; }
#morgan-auth-modal .mac-avail.checking { color: var(--mac-text-faint); }
#morgan-auth-modal .mac-avail.free     { color: var(--mac-success); }
#morgan-auth-modal .mac-avail.taken    { color: var(--mac-error-text); }
#morgan-auth-modal .mac-avail svg { width: 14px; height: 14px; }
#morgan-auth-modal .mac-spin-sm {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid #e0e0e0;
  border-top-color: var(--mac-text-muted);
  animation: mac-spin .7s linear infinite;
}

/* Remember / forgot */
#morgan-auth-modal .mac-row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0 22px;
}
#morgan-auth-modal .mac-forgot {
  font-size: 14px;
  color: var(--mac-brand);
  text-decoration: none;
  font-weight: 500;
}
#morgan-auth-modal .mac-forgot:hover { text-decoration: underline; }

/* Custom checkbox */
#morgan-auth-modal .mac-check {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  color: var(--mac-text-muted);
  cursor: pointer;
  user-select: none;
}
#morgan-auth-modal .mac-check input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
#morgan-auth-modal .mac-check .mac-box {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--mac-border);
  border-radius: 5px;
  display: grid;
  place-items: center;
  transition: all .15s var(--mac-ease);
  background: var(--mac-white);
}
#morgan-auth-modal .mac-check .mac-box svg {
  width: 12px;
  height: 12px;
  color: #fff;
  opacity: 0;
  transform: scale(.6);
  transition: all .15s var(--mac-ease);
}
#morgan-auth-modal .mac-check input:checked + .mac-box { background: var(--mac-brand); border-color: var(--mac-brand); }
#morgan-auth-modal .mac-check input:checked + .mac-box svg { opacity: 1; transform: scale(1); }
#morgan-auth-modal .mac-check a { color: var(--mac-brand); text-decoration: none; font-weight: 500; }
#morgan-auth-modal .mac-check a:hover { text-decoration: underline; }

/* native [hidden] must win over .mac-field's display rule (employer-only field) */
#morgan-auth-modal [hidden] { display: none !important; }

/* terms row (replaces former inline styles) */
#morgan-auth-modal .mac-terms-check { align-items: flex-start; margin: 6px 0 24px; }
#morgan-auth-modal .mac-terms-check .mac-box { margin-top: 2px; }

/* Already-signed-in panel */
#morgan-auth-modal .mac-loggedin-wrap {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 55%;
}
#morgan-auth-modal .mac-loggedin-badge {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(16,185,129,.12);
  color: var(--mac-success-text);
  display: grid; place-items: center;
  margin-bottom: 20px;
}
#morgan-auth-modal .mac-loggedin-badge svg { width: 30px; height: 30px; }
#morgan-auth-modal .mac-loggedin-wrap .mac-form-title { margin-bottom: 6px; }
#morgan-auth-modal .mac-loggedin-wrap .mac-form-sub { margin-bottom: 24px; }
#morgan-auth-modal .mac-btn-anchor {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 280px;
}
#morgan-auth-modal .mac-loggedin-wrap .mac-bottom-link { margin-top: 18px; }

/* Primary pill button */
#morgan-auth-modal .mac-btn-primary {
  position: relative;
  width: 100%;
  height: 50px;
  border: 0;
  border-radius: var(--mac-r-pill);
  background: var(--mac-brand);
  color: var(--mac-white);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background .18s var(--mac-ease), transform .06s var(--mac-ease);
}
#morgan-auth-modal .mac-btn-primary:hover   { background: var(--mac-brand-hover); }
#morgan-auth-modal .mac-btn-primary:active  { background: var(--mac-brand-active); transform: translateY(1px); }
#morgan-auth-modal .mac-btn-primary:disabled { background: var(--mac-disabled-bg); color: var(--mac-text-faint); cursor: not-allowed; transform: none; }
#morgan-auth-modal .mac-btn-primary.success { background: var(--mac-success); }
#morgan-auth-modal .mac-btn-primary .mac-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.45);
  border-top-color: #fff;
  animation: mac-spin .7s linear infinite;
}
@keyframes mac-spin { to { transform: rotate(360deg); } }

/* Focus rings */
#morgan-auth-modal .mac-btn-primary:focus-visible,
#morgan-auth-modal .mac-btn-social:focus-visible,
#morgan-auth-modal .mac-role-tab:focus-visible,
#morgan-auth-modal .mac-forgot:focus-visible,
#morgan-auth-modal .mac-link-strong:focus-visible {
  outline: 2px solid var(--mac-brand);
  outline-offset: 2px;
}

/* Bottom link */
#morgan-auth-modal .mac-bottom-link {
  text-align: center;
  font-size: 14px;
  color: var(--mac-text-muted);
  margin: 24px 0 0;
}
#morgan-auth-modal .mac-link-strong { color: var(--mac-brand); font-weight: 700; text-decoration: none; }
#morgan-auth-modal .mac-link-strong:hover { text-decoration: underline; }

/* Feedback message bar */
#morgan-auth-modal .mac-msg {
  display: none;
  padding: 12px 14px;
  border-radius: var(--mac-r-input);
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 16px;
}
#morgan-auth-modal .mac-msg.mac-error {
  display: block;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: var(--mac-error-text);
}
#morgan-auth-modal .mac-msg.mac-error .mac-error-action {
  color: var(--mac-error-text);
  font-weight: 700;
  text-decoration: underline;
  white-space: nowrap;
}
#morgan-auth-modal .mac-msg.mac-success {
  display: block;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  color: var(--mac-success-text);
}

/* ============================================================
   SIGN-UP — role tabs, progress, steps
   ============================================================ */
#morgan-auth-modal .mac-role-tabs { display: flex; gap: 12px; margin-bottom: 22px; }
#morgan-auth-modal .mac-role-tab {
  flex: 1;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--mac-white);
  border: 1px solid var(--mac-border);
  border-radius: var(--mac-r-pill);
  color: var(--mac-text-muted);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s var(--mac-ease);
}
#morgan-auth-modal .mac-role-tab svg { width: 19px; height: 19px; }
#morgan-auth-modal .mac-role-tab[aria-pressed="true"] {
  background: var(--mac-brand);
  border-color: var(--mac-brand);
  color: #fff;
  box-shadow: 0 6px 16px rgba(15,51,199,.28);
}

/* Progress bar */
#morgan-auth-modal .mac-progress { margin-bottom: 28px; }
#morgan-auth-modal .mac-progress-track { display: flex; gap: 6px; }
#morgan-auth-modal .mac-progress-track span {
  flex: 1;
  height: 4px;
  border-radius: 3px;
  background: #E5E7EB;
  transition: background .3s var(--mac-ease);
}
#morgan-auth-modal .mac-progress-track span.done { background: var(--mac-brand); }
#morgan-auth-modal .mac-progress-meta { margin-top: 9px; font-size: 12px; color: var(--mac-text-faint); }

/* Step machine */
#morgan-auth-modal .mac-steps { position: relative; }
#morgan-auth-modal .mac-step  { display: none; }
#morgan-auth-modal .mac-step.active       { display: block; animation: mac-stepIn     .3s var(--mac-ease) both; }
#morgan-auth-modal .mac-step.active.back  { animation-name: mac-stepInBack; }
@keyframes mac-stepIn     { from { opacity: 0; transform: translateX(36px);  } to { opacity: 1; transform: none; } }
@keyframes mac-stepInBack { from { opacity: 0; transform: translateX(-36px); } to { opacity: 1; transform: none; } }

#morgan-auth-modal .mac-step-title { font-size: 22px; font-weight: 600; color: var(--mac-navy); margin-bottom: 4px; }
#morgan-auth-modal .mac-step-sub   { font-size: 14px; color: var(--mac-text-muted); margin-bottom: 22px; }
#morgan-auth-modal .mac-back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-size: 14px;
  color: var(--mac-text-faint);
  font-family: inherit;
  margin-bottom: 16px;
}
#morgan-auth-modal .mac-back-link:hover { color: var(--mac-text-muted); }

/* Phone: country code + number */
#morgan-auth-modal .mac-phone { display: flex; gap: 10px; }
#morgan-auth-modal .mac-cc-select { position: relative; flex: 0 0 118px; }
#morgan-auth-modal .mac-cc-btn {
  width: 100%;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: var(--mac-field-bg);
  border: 1px solid var(--mac-border);
  border-radius: var(--mac-r-input);
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  color: var(--mac-navy);
}
#morgan-auth-modal .mac-cc-btn .mac-flag { font-size: 18px; line-height: 1; }
#morgan-auth-modal .mac-cc-btn .mac-dial { font-weight: 500; }
#morgan-auth-modal .mac-cc-btn .mac-chev { margin-left: auto; width: 14px; height: 14px; color: var(--mac-text-faint); }
#morgan-auth-modal .mac-cc-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 240px;
  max-height: 240px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--mac-border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,60,.14);
  padding: 6px;
  z-index: 10;
  display: none;
}
#morgan-auth-modal .mac-cc-menu.open { display: block; }
#morgan-auth-modal .mac-cc-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 14px;
  color: var(--mac-navy);
  cursor: pointer;
  border-radius: 7px;
  text-align: left;
}
#morgan-auth-modal .mac-cc-opt:hover { background: var(--mac-field-bg); }
#morgan-auth-modal .mac-cc-opt .mac-opt-dial { margin-left: auto; color: var(--mac-text-faint); }
#morgan-auth-modal .mac-phone .mac-field { flex: 1; margin-bottom: 0; }

/* Panel visibility toggle */
#morgan-auth-modal .mac-panel-signup { display: none; }
#morgan-auth-modal .mac-panel-signup.active { display: flex; }

/* ============================================================
   PANEL HEAD ACTIONS (language + close grouped)
   ============================================================ */
#morgan-auth-modal .mac-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============================================================
   LANGUAGE SWITCHER
   ============================================================ */
#morgan-auth-modal .mac-lang-wrap {
  position: relative;
}
#morgan-auth-modal .mac-lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 44px;
  padding: 0 14px;
  background: var(--mac-field-bg);
  border: 1px solid var(--mac-border);
  border-radius: 22px;
  cursor: pointer;
  color: var(--mac-text-muted);
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
#morgan-auth-modal .mac-lang-btn:hover { background: #eee; color: var(--mac-navy); }
#morgan-auth-modal .mac-lang-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
#morgan-auth-modal .mac-lang-btn .mac-chev { width: 12px; height: 12px; transition: transform .2s; }
#morgan-auth-modal .mac-lang-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid var(--mac-border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,60,.10);
  padding: 6px;
  list-style: none;
  margin: 0;
  z-index: 10;
}
#morgan-auth-modal .mac-lang-menu.open { display: block; }
#morgan-auth-modal .mac-lang-opt {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--mac-navy);
  text-decoration: none;
  transition: background .12s;
}
#morgan-auth-modal .mac-lang-opt:hover  { background: #F3F4F6; }
#morgan-auth-modal .mac-lang-opt.mac-lang-active { color: var(--mac-brand); font-weight: 600; }

/* ============================================================
   TURNSTILE WIDGET
   ============================================================ */
#morgan-auth-modal .mac-turnstile-wrap {
  margin: 4px 0 16px;
  min-height: 65px;
}

/* ============================================================
   PAGE LOADING INDICATOR
   Thin progress bar at the very top of the viewport.
   ============================================================ */
#mac-page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 3px;
  background: #0F33C7;
  z-index: 9999998;
  transition: width .4s ease, opacity .3s ease;
  pointer-events: none;
}
#mac-page-loader.mac-loader-done {
  width: 100% !important;
  opacity: 0;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  /* Full-screen on phones (no floating card / backdrop padding) */
  #morgan-auth-modal.open { padding: 0; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  #morgan-auth-modal .mac-auth {
    grid-template-columns: 1fr;
    width: 100%;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    box-shadow: none;
  }
  #morgan-auth-modal .mac-panel-left { display: none; }
  #morgan-auth-modal .mac-panel-right {
    padding: 86px 24px 48px;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-y: auto;
    justify-content: flex-start;
    max-height: none;
  }
  #morgan-auth-modal .mac-panel-right .mac-form-wrap { margin-block: auto; max-width: 460px; }
  #morgan-auth-modal .mac-panel-head { top: 18px; left: 24px; right: 24px; }
  #morgan-auth-modal .mac-field-row { flex-direction: column; gap: 0; }
}
@media (max-width: 380px) {
  #morgan-auth-modal .mac-panel-right { padding: 80px 18px 36px; }
}
@media (prefers-reduced-motion: reduce) {
  #morgan-auth-modal * {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
