/**
 * ActivGate Auth Stylesheet
 * =========================
 * Shared styles for all authentication pages: login, register (customer &
 * partner), password reset, OTP verification, 2FA setup, etc.
 *
 * Depends on: design-tokens.css (loaded first in base template)
 *
 * Naming: BEM-ish  .auth-{component}  /  .auth-{component}__{element}
 *                  .auth-{component}--{modifier}
 */

/* ==========================================================================
   AUTH CUSTOM PROPERTIES (local overrides / aliases)
   ========================================================================== */
:root {
  --auth-card-width: min(440px, calc(100vw - 32px));
  --auth-card-width-wide: min(500px, calc(100vw - 32px));
  --auth-card-radius: 16px;
  --auth-card-shadow: 0 12px 40px rgba(11, 23, 54, 0.12);
  --auth-card-padding: 36px 32px 32px;

  --auth-gradient-header: linear-gradient(135deg, var(--ag-color-brand-secondary, #1E284A), var(--ag-color-brand-primary, #2E74B8));
  --auth-gradient-header-partner: linear-gradient(135deg, var(--ag-color-brand-secondary, #1E284A), var(--ag-color-brand-primary, #2E74B8), var(--ag-color-brand-accent, #F1C9AE));
  --auth-header-height: 220px;

  --auth-input-height: 44px;
  --auth-input-radius: 10px;
  --auth-input-border: 1.5px solid var(--ag-color-border-subtle, #E6EAF0);
  --auth-input-border-color: #E6EAF0;

  --auth-btn-height: 46px;
  --auth-btn-radius: 10px;

  --auth-stepper-size: 28px;
  --auth-stepper-font: 12px;

  --auth-label-size: 11px;
  --auth-label-weight: 600;
  --auth-label-spacing: 0.5px;

  --auth-transition: 200ms ease;
}


/* ==========================================================================
   PAGE SHELL  (.auth-page)
   ========================================================================== */
.auth-page {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  padding: 48px 16px 40px;
  background: var(--ag-color-bg-page, #F6F7FB);
  font-family: var(--ag-font-sans, "Poppins", system-ui, sans-serif);
}

/* Gradient header backdrop */
.auth-page::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--auth-header-height);
  background: var(--auth-gradient-header);
  border-radius: 0 0 24px 24px;
  z-index: 0;
}

/* Partner variant: extend gradient to include accent */
.auth-page--partner::before {
  background: var(--auth-gradient-header-partner);
}


/* ==========================================================================
   CARD  (.auth-card)
   ========================================================================== */
.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--auth-card-width);
  background: #fff;
  border-radius: var(--auth-card-radius);
  box-shadow: var(--auth-card-shadow);
  overflow: hidden;
}

.auth-card--wide {
  max-width: var(--auth-card-width-wide);
}

.auth-card__head {
  padding: 28px 32px 0;
}

.auth-card__body {
  padding: 0 32px 28px;
}


/* ==========================================================================
   LOGO  (.auth-logo)
   ========================================================================== */
.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.auth-logo__icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--ag-color-brand-secondary, #1E284A), var(--ag-color-brand-primary, #2E74B8));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.auth-logo__icon--partner {
  background: linear-gradient(135deg, var(--ag-color-brand-primary, #2E74B8), var(--ag-color-brand-accent, #F1C9AE));
}

.auth-logo__icon svg {
  width: 20px;
  height: 20px;
}

.auth-logo__text {
  font-size: 18px;
  font-weight: 800;
  color: var(--ag-color-text-heading, #1E284A);
  letter-spacing: -0.3px;
}

.auth-logo__badge {
  font-weight: 500;
  color: var(--ag-color-brand-primary, #2E74B8);
  font-size: 13px;
}


/* ==========================================================================
   STEPPER  (.auth-stepper)
   ========================================================================== */
.auth-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 28px;
}

/* Individual step wrapper (circle + optional line) */
.auth-step {
  display: flex;
  align-items: center;
}

/* Numbered circle */
.auth-step__circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--auth-stepper-size);
  height: var(--auth-stepper-size);
  border-radius: 50%;
  font-size: var(--auth-stepper-font);
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
  transition: background var(--auth-transition),
              color var(--auth-transition),
              box-shadow var(--auth-transition);
}

/* Connecting line between circles */
.auth-step__line {
  width: 28px;
  height: 2px;
  flex-shrink: 0;
  transition: background var(--auth-transition);
}

/* Step label text */
.auth-step__label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ag-color-text-muted, #6B7491);
  white-space: nowrap;
}
.auth-step--active .auth-step__label { color: var(--ag-color-brand-primary, #2E74B8); }
.auth-step--done .auth-step__label { color: var(--ag-color-success, #059669); }

/* --- Stepper states --- */

/* Pending (default) */
.auth-step--pending .auth-step__circle {
  background: #f3f4f6;
  color: var(--ag-color-text-muted, #6B7491);
}
.auth-step--pending .auth-step__line {
  background: #f3f4f6;
}

/* Active */
.auth-step--active .auth-step__circle {
  background: var(--ag-color-brand-primary, #2E74B8);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(46, 116, 184, 0.18);
}
.auth-step--active .auth-step__line {
  background: var(--ag-color-brand-primary, #2E74B8);
}

/* Done (completed) */
.auth-step--done .auth-step__circle {
  background: var(--ag-color-success, #059669);
  color: #fff;
}
.auth-step--done .auth-step__line {
  background: var(--ag-color-success, #059669);
}

/* Checkmark inside done circle (insert via content or <svg>) */
.auth-step--done .auth-step__circle::after {
  content: "\2713"; /* Unicode checkmark */
  font-size: 13px;
  font-weight: 700;
}
/* Hide the step number text when done — we show the checkmark instead */
.auth-step--done .auth-step__number {
  display: none;
}


/* ==========================================================================
   TYPOGRAPHY  (.auth-title, .auth-subtitle)
   ========================================================================== */
.auth-title {
  font-size: var(--ag-font-size-3xl, 22px);
  font-weight: var(--ag-font-weight-bold, 600);
  color: var(--ag-color-text-heading, #1E284A);
  line-height: var(--ag-line-height-tight, 1.15);
  margin: 0 0 8px;
  text-align: center;
}

.auth-subtitle {
  font-size: var(--ag-font-size-md, 14px);
  color: var(--ag-color-text-muted, #6B7491);
  line-height: var(--ag-line-height-normal, 1.5);
  margin: 0 0 24px;
  text-align: center;
}


/* ==========================================================================
   FORM FIELDS  (.auth-field)
   ========================================================================== */
.auth-field {
  margin-bottom: 18px;
}

/* Label */
.auth-field__label {
  display: block;
  font-size: var(--auth-label-size);
  font-weight: var(--auth-label-weight);
  letter-spacing: var(--auth-label-spacing);
  text-transform: uppercase;
  color: var(--ag-color-text-muted, #6B7491);
  margin-bottom: 6px;
}

/* Input / Select / Textarea */
.auth-field__input {
  display: block;
  width: 100%;
  height: var(--auth-input-height);
  padding: 0 14px;
  font-size: var(--ag-font-size-md, 14px);
  font-family: inherit;
  color: var(--ag-color-text-heading, #1E284A);
  background: #fff;
  border: var(--auth-input-border);
  border-radius: var(--auth-input-radius);
  outline: none;
  transition: border-color var(--auth-transition),
              box-shadow var(--auth-transition);
  box-sizing: border-box;
}

.auth-field__input::placeholder {
  color: var(--ag-color-text-muted, #6B7491);
  opacity: 0.6;
}

/* Focus state */
.auth-field__input:focus {
  border-color: var(--ag-color-brand-primary, #2E74B8);
  box-shadow: 0 0 0 3px rgba(46, 116, 184, 0.08);
}

/* Error state */
.auth-field__input--error,
.auth-field--error .auth-field__input {
  border-color: var(--ag-color-error, #dc2626);
}
.auth-field__input--error:focus,
.auth-field--error .auth-field__input:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
}

/* Success state */
.auth-field__input--success,
.auth-field--success .auth-field__input {
  border-color: var(--ag-color-success, #059669);
}
.auth-field__input--success:focus,
.auth-field--success .auth-field__input:focus {
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.08);
}

/* Inline hint / error text */
.auth-field__hint {
  display: block;
  font-size: var(--ag-font-size-xs, 10px);
  margin-top: 5px;
  color: var(--ag-color-text-muted, #6B7491);
}

.auth-field__error {
  display: block;
  font-size: var(--ag-font-size-xs, 10px);
  margin-top: 5px;
  color: var(--ag-color-error, #dc2626);
}

/* Textarea variant */
textarea.auth-field__input {
  height: auto;
  min-height: 80px;
  padding: 10px 14px;
  resize: vertical;
}

/* Select variant */
select.auth-field__input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%236B7491' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}


/* ==========================================================================
   PASSWORD METER  (.auth-pw-meter)
   ========================================================================== */
.auth-pw-meter {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}

.auth-pw-bar {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: #e5e7eb;
  transition: background var(--auth-transition);
}

/* Strength states — apply to .auth-pw-meter, colours cascade to bars */
.auth-pw-meter--weak   .auth-pw-bar:nth-child(1) { background: var(--ag-color-error, #dc2626); }

.auth-pw-meter--fair   .auth-pw-bar:nth-child(1),
.auth-pw-meter--fair   .auth-pw-bar:nth-child(2) { background: #eab308; }

.auth-pw-meter--good   .auth-pw-bar:nth-child(1),
.auth-pw-meter--good   .auth-pw-bar:nth-child(2),
.auth-pw-meter--good   .auth-pw-bar:nth-child(3) { background: var(--ag-color-success, #059669); }

.auth-pw-meter--strong .auth-pw-bar { background: var(--ag-color-success, #059669); }

.auth-pw-meter__label {
  font-size: var(--ag-font-size-xs, 10px);
  color: var(--ag-color-text-muted, #6B7491);
  margin-top: 4px;
}


/* ==========================================================================
   BUTTONS  (.auth-btn)
   ========================================================================== */
.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--auth-btn-height);
  padding: 0 24px;
  border-radius: var(--auth-btn-radius);
  font-size: var(--ag-font-size-md, 14px);
  font-weight: var(--ag-font-weight-semibold, 600);
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  border: none;
  outline: none;
  text-decoration: none;
  transition: background var(--auth-transition),
              box-shadow var(--auth-transition),
              opacity var(--auth-transition),
              transform var(--auth-transition);
  box-sizing: border-box;
  white-space: nowrap;
}

/* Full-width helper */
.auth-btn--block {
  display: flex;
  width: 100%;
}

/* Primary CTA */
.auth-btn--primary {
  background: var(--ag-gradient-button, linear-gradient(145deg, #2563eb, #4f46e5));
  color: #fff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}
.auth-btn--primary:hover {
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
  transform: translateY(-1px);
}
.auth-btn--primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(79, 70, 229, 0.2);
}

/* Secondary / Back */
.auth-btn--secondary {
  background: #fff;
  color: var(--ag-color-text-heading, #1E284A);
  border: 1.5px solid var(--auth-input-border-color);
}
.auth-btn--secondary:hover {
  background: var(--ag-color-bg-page, #F6F7FB);
  border-color: var(--ag-color-border-strong, #CBD5E1);
}

/* Ghost (text-only) */
.auth-btn--ghost {
  background: transparent;
  color: var(--ag-color-brand-primary, #2E74B8);
  padding: 0 12px;
  height: auto;
  min-height: 36px;
}
.auth-btn--ghost:hover {
  background: rgba(46, 116, 184, 0.06);
}

/* Disabled state (works on all variants) */
.auth-btn:disabled,
.auth-btn--disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* Loading spinner inside button */
.auth-btn .auth-btn__spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.6s linear infinite;
}
.auth-btn--secondary .auth-btn__spinner {
  border-color: rgba(30, 40, 74, 0.15);
  border-top-color: var(--ag-color-text-heading, #1E284A);
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}


/* ==========================================================================
   SOCIAL AUTH  (.auth-social)
   ========================================================================== */
.auth-social {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.auth-social__btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  background: #fff;
  border: 1.5px solid var(--auth-input-border-color);
  border-radius: var(--auth-input-radius);
  font-size: var(--ag-font-size-sm, 12px);
  font-weight: var(--ag-font-weight-medium, 500);
  font-family: inherit;
  color: var(--ag-color-text-heading, #1E284A);
  cursor: pointer;
  transition: background var(--auth-transition),
              border-color var(--auth-transition),
              box-shadow var(--auth-transition);
  text-decoration: none;
}

.auth-social__btn:hover {
  background: var(--ag-color-bg-page, #F6F7FB);
  border-color: var(--ag-color-border-strong, #CBD5E1);
}

.auth-social__btn img,
.auth-social__btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}


/* ==========================================================================
   DIVIDER  (.auth-divider)
   ========================================================================== */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  font-size: var(--ag-font-size-xs, 10px);
  font-weight: var(--ag-font-weight-medium, 500);
  color: var(--ag-color-text-muted, #6B7491);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--auth-input-border-color);
}


/* ==========================================================================
   TYPE TOGGLE  (.auth-toggle)
   ========================================================================== */
.auth-toggle {
  display: flex;
  background: var(--ag-color-bg-page, #F6F7FB);
  border-radius: var(--auth-input-radius);
  padding: 3px;
  margin-bottom: 24px;
}

.auth-toggle__btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  border-radius: 8px;
  border: none;
  background: transparent;
  font-size: var(--ag-font-size-sm, 12px);
  font-weight: var(--ag-font-weight-semibold, 600);
  font-family: inherit;
  color: var(--ag-color-text-muted, #6B7491);
  cursor: pointer;
  transition: background var(--auth-transition),
              color var(--auth-transition),
              box-shadow var(--auth-transition);
}

.auth-toggle__btn--active,
.auth-toggle__btn.active {
  background: #fff;
  color: var(--ag-color-text-heading, #1E284A);
  box-shadow: 0 1px 4px rgba(11, 23, 54, 0.08);
}


/* ==========================================================================
   CHECKBOXES  (.auth-check)
   ========================================================================== */
.auth-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
  cursor: pointer;
}

.auth-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  min-width: 18px;
  border: 1.5px solid var(--auth-input-border-color);
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  margin-top: 1px;
  transition: background var(--auth-transition),
              border-color var(--auth-transition);
  position: relative;
}

.auth-check input[type="checkbox"]:checked {
  background: var(--ag-color-brand-primary, #2E74B8);
  border-color: var(--ag-color-brand-primary, #2E74B8);
}

.auth-check input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 5px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.auth-check__label {
  font-size: var(--ag-font-size-sm, 12px);
  color: var(--ag-color-text-muted, #6B7491);
  line-height: 1.45;
}

.auth-check__label a {
  color: var(--ag-color-brand-primary, #2E74B8);
  text-decoration: none;
  font-weight: var(--ag-font-weight-medium, 500);
}
.auth-check__label a:hover {
  text-decoration: underline;
}


/* ==========================================================================
   ALERTS  (.auth-alert)
   ========================================================================== */
.auth-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: var(--ag-font-size-sm, 12px);
  line-height: 1.5;
  margin-bottom: 18px;
}

.auth-alert--error {
  background: var(--ag-color-error-softer, #fef2f2);
  color: var(--ag-color-error, #dc2626);
  border: 1px solid var(--ag-color-error-border, rgba(248, 113, 113, 0.7));
}

.auth-alert--warning {
  background: var(--ag-color-warning-softer, #fffbeb);
  color: var(--ag-color-warning, #ea580c);
  border: 1px solid var(--ag-color-warning-border, rgba(251, 146, 60, 0.7));
}

.auth-alert--info {
  background: var(--ag-color-info-soft, rgba(15, 118, 110, 0.08));
  color: var(--ag-color-info, #0f766e);
  border: 1px solid var(--ag-color-info-border, rgba(45, 212, 191, 0.7));
}

.auth-alert--success {
  background: var(--ag-color-success-softer, #f0fdf4);
  color: var(--ag-color-success, #059669);
  border: 1px solid var(--ag-color-success-border, rgba(52, 211, 153, 0.7));
}

.auth-alert__icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}


/* ==========================================================================
   SUMMARY BOX  (.auth-summary)
   ========================================================================== */
.auth-summary {
  background: var(--ag-color-bg-surface-alt, #F9FAFD);
  border: 1px solid var(--auth-input-border-color);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 20px;
}

.auth-summary__title {
  font-size: var(--ag-font-size-sm, 12px);
  font-weight: var(--ag-font-weight-semibold, 600);
  color: var(--ag-color-text-heading, #1E284A);
  margin: 0 0 10px;
}

.auth-summary__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--ag-font-size-sm, 12px);
  padding: 5px 0;
}

.auth-summary__label {
  color: var(--ag-color-text-muted, #6B7491);
}

.auth-summary__value {
  color: var(--ag-color-text-heading, #1E284A);
  font-weight: var(--ag-font-weight-medium, 500);
}


/* ==========================================================================
   OTP INPUT  (.auth-otp)
   ========================================================================== */
.auth-otp {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 24px;
}

.auth-otp__box {
  width: 48px;
  height: 54px;
  text-align: center;
  font-size: var(--ag-font-size-2xl, 19px);
  font-weight: var(--ag-font-weight-bold, 600);
  font-family: inherit;
  color: var(--ag-color-text-heading, #1E284A);
  border: 1.5px solid var(--auth-input-border-color);
  border-radius: var(--auth-input-radius);
  background: #fff;
  outline: none;
  transition: border-color var(--auth-transition),
              box-shadow var(--auth-transition);
}

.auth-otp__box:focus {
  border-color: var(--ag-color-brand-primary, #2E74B8);
  box-shadow: 0 0 0 3px rgba(46, 116, 184, 0.08);
}

.auth-otp__box--filled {
  border-color: var(--ag-color-brand-primary, #2E74B8);
  background: rgba(46, 116, 184, 0.03);
}


/* ==========================================================================
   SERVICE CHIPS  (.auth-chip)
   ========================================================================== */
.auth-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--ag-radius-full, 999px);
  border: 1.5px solid var(--auth-input-border-color);
  background: #fff;
  font-size: var(--ag-font-size-sm, 12px);
  font-weight: var(--ag-font-weight-medium, 500);
  color: var(--ag-color-text-heading, #1E284A);
  cursor: pointer;
  transition: background var(--auth-transition),
              border-color var(--auth-transition),
              box-shadow var(--auth-transition);
  user-select: none;
}

.auth-chip:hover {
  border-color: var(--ag-color-border-strong, #CBD5E1);
}

.auth-chip--selected,
.auth-chip.active {
  background: var(--ag-color-brand-primary-soft, #E3EDF9);
  border-color: var(--ag-color-brand-primary, #2E74B8);
  color: var(--ag-color-brand-primary, #2E74B8);
}

.auth-chip__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}


/* ==========================================================================
   UPLOAD AREA  (.auth-upload)
   ========================================================================== */
.auth-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  border: 2px dashed var(--auth-input-border-color);
  border-radius: 12px;
  background: var(--ag-color-bg-surface-alt, #F9FAFD);
  cursor: pointer;
  transition: border-color var(--auth-transition),
              background var(--auth-transition);
  margin-bottom: 18px;
  text-align: center;
}

.auth-upload:hover,
.auth-upload--dragover {
  border-color: var(--ag-color-brand-primary, #2E74B8);
  background: rgba(46, 116, 184, 0.03);
}

.auth-upload__icon {
  width: 36px;
  height: 36px;
  color: var(--ag-color-text-muted, #6B7491);
}

.auth-upload__text {
  font-size: var(--ag-font-size-sm, 12px);
  color: var(--ag-color-text-muted, #6B7491);
}

.auth-upload__text strong {
  color: var(--ag-color-brand-primary, #2E74B8);
  font-weight: var(--ag-font-weight-semibold, 600);
}

.auth-upload__preview {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--auth-input-border-color);
}


/* ==========================================================================
   TRUST BADGES  (.auth-trust)
   ========================================================================== */
.auth-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--auth-input-border-color);
}

.auth-trust__badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--ag-font-size-xs, 10px);
  color: var(--ag-color-text-muted, #6B7491);
}

.auth-trust__badge svg,
.auth-trust__badge img {
  width: 14px;
  height: 14px;
  opacity: 0.6;
}


/* ==========================================================================
   FOOTER  (.auth-footer)
   ========================================================================== */
.auth-footer {
  position: relative;
  z-index: 1;
  margin-top: 24px;
  text-align: center;
  font-size: var(--ag-font-size-sm, 12px);
  color: var(--ag-color-text-muted, #6B7491);
}

.auth-footer a {
  color: var(--ag-color-brand-primary, #2E74B8);
  text-decoration: none;
  font-weight: var(--ag-font-weight-medium, 500);
}
.auth-footer a:hover {
  text-decoration: underline;
}

.auth-footer__links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}


/* ==========================================================================
   SECTION DIVIDER  (.auth-section-divider)
   ========================================================================== */
.auth-section-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 24px 0 18px;
  font-size: var(--auth-label-size);
  font-weight: var(--auth-label-weight);
  letter-spacing: var(--auth-label-spacing);
  text-transform: uppercase;
  color: var(--ag-color-text-muted, #6B7491);
}

.auth-section-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--auth-input-border-color);
}


/* ==========================================================================
   SUCCESS ICON  (.auth-success-icon)
   ========================================================================== */
.auth-success-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--ag-color-success-softer, #f0fdf4);
  margin: 0 auto 20px;
}

.auth-success-icon svg,
.auth-success-icon img {
  width: 32px;
  height: 32px;
  color: var(--ag-color-success, #059669);
}

.auth-success-icon::after {
  content: "\2713";
  font-size: 28px;
  font-weight: 700;
  color: var(--ag-color-success, #059669);
  line-height: 1;
}

/* When using an actual svg/img inside, hide the pseudo-element */
.auth-success-icon:not(:empty)::after {
  display: none;
}


/* ==========================================================================
   BACKUP CODES GRID  (.auth-backup-grid)
   ========================================================================== */
.auth-backup-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.auth-backup-grid__code {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  background: var(--ag-color-bg-surface-alt, #F9FAFD);
  border: 1px solid var(--auth-input-border-color);
  border-radius: 8px;
  font-family: var(--ag-font-mono, monospace);
  font-size: var(--ag-font-size-md, 14px);
  font-weight: var(--ag-font-weight-medium, 500);
  color: var(--ag-color-text-heading, #1E284A);
  letter-spacing: 1px;
  user-select: all;
}


/* ==========================================================================
   STEP PANELS  (.auth-step-panel)
   ========================================================================== */
.auth-step-panel {
  display: none;
}

.auth-step-panel--active,
.auth-step-panel.active {
  display: block;
  animation: auth-fadeIn 0.25s ease;
}

@keyframes auth-fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ==========================================================================
   DJANGO ERRORLIST OVERRIDE
   ========================================================================== */
.auth-card .errorlist,
.auth-card ul.errorlist {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
}

.auth-card .errorlist li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--ag-color-error-softer, #fef2f2);
  color: var(--ag-color-error, #dc2626);
  border: 1px solid var(--ag-color-error-border, rgba(248, 113, 113, 0.7));
  border-radius: 8px;
  font-size: var(--ag-font-size-sm, 12px);
  line-height: 1.4;
  margin-bottom: 6px;
}

.auth-card .errorlist li:last-child {
  margin-bottom: 0;
}

/* Nested field-level errorlists */
.auth-field .errorlist {
  margin: 5px 0 0;
}

.auth-field .errorlist li {
  padding: 4px 0;
  background: none;
  border: none;
  border-radius: 0;
  color: var(--ag-color-error, #dc2626);
  font-size: var(--ag-font-size-xs, 10px);
}


/* ==========================================================================
   UTILITY HELPERS (auth-specific)
   ========================================================================== */
.auth-row {
  display: flex;
  gap: 12px;
}

.auth-row > * {
  flex: 1;
  min-width: 0;
}

.auth-text-center {
  text-align: center;
}

.auth-mt-0  { margin-top: 0; }
.auth-mb-0  { margin-bottom: 0; }
.auth-mb-sm { margin-bottom: 8px; }
.auth-mb-md { margin-bottom: 16px; }
.auth-mb-lg { margin-bottom: 24px; }


/* ==========================================================================
   BUTTON ROW  (.auth-btn-row)
   ========================================================================== */
.auth-btn-row {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.auth-btn-row > .auth-btn {
  flex: 1;
}

/* Outline variant (Back button) */
.auth-btn--outline {
  background: #fff;
  color: var(--ag-color-text-heading, #1E284A);
  border: 1.5px solid var(--auth-input-border-color);
}
.auth-btn--outline:hover {
  background: var(--ag-color-bg-page, #F6F7FB);
  border-color: var(--ag-color-border-strong, #CBD5E1);
}


/* ==========================================================================
   PHONE ROW  (.auth-phone-row)
   ========================================================================== */
.auth-phone-row {
  display: flex;
  gap: 12px;
  margin-bottom: 4px;
}

@media (max-width: 520px) {
  .auth-phone-row {
    /* Keep inline even on mobile — code + number always side-by-side */
  }
}


/* ==========================================================================
   LABEL OPTIONAL  (.auth-field__label-optional)
   ========================================================================== */
.auth-field__label-optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ag-color-text-muted, #6B7491);
  opacity: 0.7;
}


/* ==========================================================================
   CHIP CHECK ICON  (.auth-chip__check)
   ========================================================================== */
.auth-chip__check {
  display: none;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 2px;
  color: var(--ag-color-brand-primary, #2E74B8);
}

.auth-chip--selected .auth-chip__check {
  display: flex;
}


/* ==========================================================================
   SOCIAL ROW  (.auth-social__row)
   ========================================================================== */
.auth-social__row {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.auth-social__row .auth-social__btn {
  flex: 1;
}


/* ==========================================================================
   MOBILE BREAKPOINT  (max-width: 520px)
   ========================================================================== */
@media (max-width: 520px) {
  .auth-page {
    padding: 24px 12px 32px;
  }

  .auth-page::before {
    height: 180px;
    border-radius: 0 0 16px 16px;
  }

  .auth-card {
    border-radius: 14px;
  }

  .auth-card__head {
    padding: 20px 20px 0;
  }

  .auth-card__body {
    padding: 0 20px 20px;
  }

  .auth-card--wide {
    max-width: 100%;
  }

  .auth-title {
    font-size: var(--ag-font-size-2xl, 19px);
  }

  .auth-subtitle {
    font-size: var(--ag-font-size-sm, 12px);
  }

  .auth-stepper {
    margin-bottom: 22px;
  }

  .auth-step__line {
    width: 20px;
  }

  .auth-social {
    flex-direction: column;
  }

  .auth-social__btn {
    width: 100%;
  }

  .auth-otp {
    gap: 8px;
  }

  .auth-otp__box {
    width: 42px;
    height: 48px;
    font-size: var(--ag-font-size-xl, 17px);
  }

  .auth-backup-grid {
    grid-template-columns: 1fr;
  }

  .auth-row {
    flex-direction: column;
    gap: 0;
  }

  .auth-trust {
    flex-wrap: wrap;
    gap: 10px;
  }

  .auth-btn {
    height: 44px;
    font-size: var(--ag-font-size-sm, 12px);
  }

  .auth-logo {
    height: 32px;
  }

  .auth-footer__links {
    gap: 12px;
  }

  .auth-social__row {
    flex-direction: column;
  }

  .auth-social__row .auth-social__btn {
    width: 100%;
  }

  /* Phone code field responsive */
  .auth-phone-row select,
  .auth-phone-row .phone-code-select,
  [name="phone_code"] {
    width: clamp(70px, 22vw, 90px);
    flex-shrink: 0;
  }
}

@media (max-width: 767px) {
  .auth-card label,
  .auth-card .form-label {
    display: block;
    width: 100%;
    margin-bottom: 4px;
  }
  .auth-card input[type="text"],
  .auth-card input[type="email"],
  .auth-card input[type="password"],
  .auth-card input[type="search"],
  .auth-card .form-control {
    display: block;
    width: 100% !important;
  }
}
