/* ==========================================================================
   Auth pages — login, signup, forgot-password, reset-password
   Layout: form pane on the left, photo + illustrated showcase on the right
   (large screens only). Markup lives in views/partials/auth/*.
   ========================================================================== */

:root {
  --auth-brand-50: #edf7f1;
  --auth-brand-100: #d4eedf;
  --auth-brand-200: #a9dcbf;
  --auth-brand-500: #198754;
  --auth-brand-600: #157347;
  --auth-brand-700: #115e3a;
  --auth-brand-900: #0b3b25;

  --auth-ink: #14201a;
  --auth-text: #3e4c45;
  --auth-muted: #66756d;
  --auth-line: #dde5e0;
  --auth-line-strong: #c4cfc9;
  --auth-field: #f7faf8;
  --auth-soft: #f1f5f3;
  --auth-surface: #ffffff;

  --auth-danger: #b42318;
  --auth-danger-bg: #fef3f2;
  --auth-danger-line: #fecdca;
  --auth-success: #0f6b3e;
  --auth-success-bg: #ecfdf3;
  --auth-success-line: #abefc6;
  --auth-info: #175cd3;
  --auth-info-bg: #eff8ff;
  --auth-info-line: #b2ddff;
  --auth-warn: #a15c07;
  --auth-warn-bg: #fffaeb;
  --auth-warn-line: #fedf89;
  --auth-amber: #f4b740;

  --auth-font-head: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --auth-font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --auth-radius: 12px;
  --auth-ring: 0 0 0 4px rgba(25, 135, 84, 0.14);

  /* Per-role accents (signup tiles + showcase perks card) */
  --role-landlord: #157347;
  --role-landlord-soft: #e6f4ec;
  --role-tenant: #1d64c4;
  --role-tenant-soft: #e8f0fc;
  --role-buyer: #9a5b00;
  --role-buyer-soft: #fdf2df;
  --role-seller: #b4304f;
  --role-seller-soft: #fceaee;
  --role-agent: #6a3db8;
  --role-agent-soft: #f0eafa;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body.auth-body {
  font-family: var(--auth-font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--auth-text);
  background: var(--auth-surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Shell ---------- */

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
}

.auth-pane {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  min-width: 0;
  padding: 0 0 20px;
  background: var(--auth-surface);
}

/* Small screens: branded photo header with the form sliding over it as a
   sheet. From 992px up this collapses to a plain back link (see below). */
.auth-topbar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: max(14px, env(safe-area-inset-top)) 16px 46px;
  color: #fff;
  background:
    radial-gradient(420px circle at 100% 0%, rgba(244, 183, 64, 0.28), transparent 60%),
    linear-gradient(180deg, rgba(6, 36, 22, 0.5) 0%, rgba(6, 36, 22, 0.9) 100%),
    url("/assets/images/auth/auth-showcase.jpg") 40% 60% / cover no-repeat,
    var(--auth-brand-900);
}

.auth-topbar-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.auth-topbar-tagline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.8rem;
  font-weight: 600;
}

.auth-topbar-tagline i {
  color: var(--auth-amber);
}

.auth-main {
  position: relative;
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  margin-top: -26px;
  padding: 28px 16px 32px;
  border-radius: 26px 26px 0 0;
  background: var(--auth-surface);
}

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

.auth-card--wide {
  max-width: 500px;
}

.auth-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 16px;
  padding: 0 16px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--auth-muted);
}

.auth-footer a {
  color: inherit;
  text-decoration: none;
}

.auth-footer a:hover {
  color: var(--auth-brand-700);
  text-decoration: underline;
}

@media (min-width: 576px) {
  .auth-topbar {
    gap: 22px;
    padding: 22px 32px 62px;
  }

  .auth-main {
    margin-top: -30px;
    padding: 40px 32px;
    border-radius: 30px 30px 0 0;
  }
}

@media (min-width: 992px) {
  .auth-shell {
    grid-template-columns: minmax(480px, 46%) 1fr;
  }

  .auth-pane {
    padding: 26px 40px;
    background:
      radial-gradient(520px circle at 0% 0%, rgba(25, 135, 84, 0.07), transparent 60%),
      var(--auth-surface);
  }

  .auth-topbar {
    padding: 0;
    color: inherit;
    background: none;
  }

  /* The showcase carries the logo and tagline on large screens */
  .auth-topbar .auth-brand,
  .auth-topbar-tagline {
    display: none;
  }

  .auth-main {
    align-items: center;
    margin-top: 0;
    padding: 28px 0 32px;
    border-radius: 0;
    background: none;
  }

  .auth-footer {
    justify-content: flex-start;
    padding: 0;
    text-align: left;
  }
}

@media (min-width: 1280px) {
  .auth-pane {
    padding: 30px 64px 28px;
  }
}

/* ---------- Brand + top bar ---------- */

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.auth-brand-tile {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.45);
}

.auth-brand-tile img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.auth-brand-name {
  font-family: var(--auth-font-head);
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  color: #fff;
}

/* Glass pill over the photo header on small screens */
.back-home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 14px 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.back-home i {
  font-size: 0.8rem;
  transition: transform 0.2s ease;
}

.back-home:hover {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.24);
}

.back-home:hover i {
  transform: translateX(-3px);
}

@media (min-width: 992px) {
  .back-home {
    border-color: var(--auth-line);
    background: var(--auth-surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    color: var(--auth-text);
  }

  .back-home:hover {
    border-color: var(--auth-brand-200);
    background: var(--auth-brand-50);
    color: var(--auth-brand-700);
  }
}

/* ---------- Headings ---------- */

.auth-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--auth-brand-50);
  color: var(--auth-brand-700);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.auth-heading {
  margin-bottom: 24px;
}

.auth-heading h1 {
  margin: 0 0 8px;
  font-family: var(--auth-font-head);
  font-size: clamp(1.5rem, 1.1rem + 1.8vw, 2.05rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--auth-ink);
}

.auth-heading p {
  margin: 0;
  color: var(--auth-muted);
}

/* ---------- Fields ---------- */

.field {
  margin-bottom: 16px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 12px;
}

@media (min-width: 360px) {
  .field-row--pair {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 480px) {
  .field-row {
    grid-template-columns: 1fr 1fr;
  }
}

.field-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--auth-ink);
}

.field-label a {
  font-size: 0.82rem;
}

.input-wrap {
  position: relative;
}

.input-wrap > .input-icon {
  position: absolute;
  top: 50%;
  left: 15px;
  transform: translateY(-50%);
  color: #8a988f;
  font-size: 0.92rem;
  pointer-events: none;
  transition: color 0.2s ease;
}

.input {
  width: 100%;
  height: 48px;
  padding: 0 14px 0 42px;
  border: 1.5px solid var(--auth-line);
  border-radius: var(--auth-radius);
  background: var(--auth-field);
  color: var(--auth-ink);
  font: inherit;
  font-size: 1rem; /* 16px+ stops iOS Safari zooming in on focus */
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.input::placeholder {
  color: #9aa79f;
}

.input:hover {
  border-color: var(--auth-line-strong);
}

.input:focus {
  outline: none;
  border-color: var(--auth-brand-500);
  background: var(--auth-surface);
  box-shadow: var(--auth-ring);
}

.input:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.input-wrap:focus-within > .input-icon {
  color: var(--auth-brand-600);
}

.input--toggle {
  padding-right: 50px;
}

.pw-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--auth-muted);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.pw-toggle:hover {
  background: rgba(20, 32, 26, 0.05);
  color: var(--auth-ink);
}

.pw-toggle:focus-visible {
  outline: 2px solid var(--auth-brand-500);
  outline-offset: 1px;
}

.field-error {
  display: none;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--auth-danger);
}

.field.has-error .input {
  border-color: var(--auth-danger);
  background: var(--auth-surface);
}

.field.has-error .input:focus {
  box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.12);
}

.field.has-error .input-icon {
  color: var(--auth-danger);
}

.field.has-error .field-error {
  display: flex;
}

/* ---------- Password strength ---------- */

.pw-meter {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.pw-meter span {
  height: 5px;
  border-radius: 999px;
  background: var(--auth-line);
  transition: background 0.25s ease;
}

.pw-meter[data-score="1"] span:nth-child(-n + 1) { background: #d92d20; }
.pw-meter[data-score="2"] span:nth-child(-n + 2) { background: #f79009; }
.pw-meter[data-score="3"] span:nth-child(-n + 3) { background: #3fa46a; }
.pw-meter[data-score="4"] span:nth-child(-n + 4) { background: var(--auth-brand-600); }

.pw-reqs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.78rem;
  color: var(--auth-muted);
}

.pw-reqs li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s ease;
}

.pw-reqs li i {
  font-size: 0.75rem;
  color: var(--auth-line-strong);
  transition: color 0.2s ease;
}

.pw-reqs li.is-met {
  color: var(--auth-success);
}

.pw-reqs li.is-met i {
  color: var(--auth-brand-500);
}

.pw-strength-label {
  margin-left: auto;
  font-weight: 700;
  color: var(--auth-ink);
}

/* ---------- Checkbox ---------- */

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.86rem;
  color: var(--auth-text);
  cursor: pointer;
}

.check input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  border: 1.5px solid var(--auth-line-strong);
  border-radius: 5px;
  background: var(--auth-surface);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.check input:checked {
  border-color: var(--auth-brand-600);
  background: var(--auth-brand-600) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M5 10.5l3.2 3.2L15 7'/%3e%3c/svg%3e") center / 13px no-repeat;
}

.check input:focus-visible {
  outline: 2px solid var(--auth-brand-500);
  outline-offset: 2px;
}

.field.has-error .check input {
  border-color: var(--auth-danger);
}

/* ---------- Buttons + links ---------- */

.btn-auth {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 50px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--auth-radius);
  background: var(--auth-brand-600);
  color: #fff;
  font-family: var(--auth-font-head);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 10px 22px -10px rgba(21, 115, 71, 0.65);
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-auth {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn-auth:hover {
  background: var(--auth-brand-700);
  box-shadow: 0 14px 26px -12px rgba(17, 94, 58, 0.7);
}

@media (hover: hover) {
  .btn-auth:hover {
    transform: translateY(-1px);
  }
}

.btn-auth:active {
  transform: translateY(0);
}

.btn-auth:focus-visible {
  outline: 3px solid var(--auth-brand-200);
  outline-offset: 2px;
}

.btn-auth:disabled {
  cursor: progress;
  opacity: 0.8;
  transform: none;
}

.btn-auth .btn-icon {
  font-size: 0.9rem;
  transition: transform 0.2s ease;
}

.btn-auth:hover .btn-icon {
  transform: translateX(3px);
}

.btn-auth .spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
}

.btn-auth.is-loading .spinner {
  display: inline-block;
}

.btn-auth.is-loading .btn-icon {
  display: none;
}

.btn-auth--ghost {
  background: var(--auth-surface);
  color: var(--auth-ink);
  border: 1.5px solid var(--auth-line);
  box-shadow: none;
}

.btn-auth--ghost:hover {
  background: var(--auth-soft);
  border-color: var(--auth-line-strong);
  box-shadow: none;
}

.btn-auth--ghost .spinner {
  border-color: rgba(20, 32, 26, 0.2);
  border-top-color: var(--auth-ink);
}

.btn-stack {
  display: grid;
  gap: 10px;
}

.link {
  color: var(--auth-brand-600);
  font-weight: 600;
  text-decoration: none;
}

.link:hover {
  color: var(--auth-brand-700);
  text-decoration: underline;
}

.auth-switch {
  margin: 24px 0 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--auth-muted);
}

.auth-switch .link {
  font-weight: 700;
  margin-left: 4px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 0;
  color: var(--auth-muted);
  font-size: 0.78rem;
}

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

/* ---------- Alerts ---------- */

.auth-alert {
  display: none;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid;
  border-radius: var(--auth-radius);
  font-size: 0.86rem;
  line-height: 1.45;
}

.auth-alert.is-visible {
  display: flex;
}

.auth-alert i {
  margin-top: 2px;
}

.auth-alert--error {
  background: var(--auth-danger-bg);
  border-color: var(--auth-danger-line);
  color: #912018;
}

.auth-alert--success {
  background: var(--auth-success-bg);
  border-color: var(--auth-success-line);
  color: var(--auth-success);
}

.auth-alert--info {
  background: var(--auth-info-bg);
  border-color: var(--auth-info-line);
  color: #1849a9;
}

.auth-alert--warning {
  background: var(--auth-warn-bg);
  border-color: var(--auth-warn-line);
  color: var(--auth-warn);
}

.is-shaking {
  animation: auth-shake 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

/* ---------- Result states (email sent, link invalid, password updated) ---------- */

.state-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
  border-radius: 20px;
  font-size: 1.6rem;
  background: var(--auth-brand-50);
  color: var(--auth-brand-600);
  box-shadow: inset 0 0 0 1px var(--auth-brand-100);
}

.state-icon--danger {
  background: var(--auth-danger-bg);
  color: var(--auth-danger);
  box-shadow: inset 0 0 0 1px var(--auth-danger-line);
}

.state-tips {
  display: grid;
  gap: 10px;
  margin: 0 0 24px;
  padding: 16px;
  list-style: none;
  border-radius: var(--auth-radius);
  background: var(--auth-soft);
  font-size: 0.86rem;
}

.state-tips li {
  display: flex;
  gap: 10px;
}

.state-tips i {
  margin-top: 3px;
  color: var(--auth-brand-600);
}

.state-email {
  color: var(--auth-ink);
  font-weight: 700;
  word-break: break-all;
}

.resend-note {
  margin: 14px 0 0;
  text-align: center;
  font-size: 0.82rem;
  color: var(--auth-muted);
}

/* Soft ring that keeps pulsing while the account is under review */
.state-icon--pulse::after {
  content: "";
  position: absolute;
  inset: -6px;
  border: 2px solid var(--auth-brand-200);
  border-radius: 24px;
  animation: auth-pulse 2s ease-out infinite;
}

.email-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  margin-top: 12px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--auth-brand-50);
  color: var(--auth-brand-700);
  font-size: 0.86rem;
  font-weight: 700;
}

.email-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--auth-brand-600);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.link-btn:hover {
  color: var(--auth-brand-700);
  text-decoration: underline;
}

.link-btn:disabled {
  color: var(--auth-muted);
  cursor: default;
  text-decoration: none;
}

.resend-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 6px;
  margin: 18px 0 0;
  font-size: 0.88rem;
  color: var(--auth-muted);
}

.status-meta {
  margin: 12px 0 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--auth-muted);
}

/* ---------- Onboarding steps (verify email, awaiting approval) ---------- */

.auth-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 26px;
  padding: 0;
  list-style: none;
}

.auth-steps li {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--auth-muted);
}

/* Connector from the previous dot to this one */
.auth-steps li + li::before {
  content: "";
  position: absolute;
  top: 13px;
  left: calc(-50% + 20px);
  right: calc(50% + 20px);
  height: 2px;
  border-radius: 2px;
  background: var(--auth-line);
  transition: background 0.3s ease;
}

.auth-steps li.is-done + li::before {
  background: var(--auth-brand-500);
}

.step-dot {
  position: relative;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid var(--auth-line);
  border-radius: 50%;
  background: var(--auth-soft);
  color: var(--auth-muted);
  font-size: 0.75rem;
  font-weight: 800;
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.auth-steps .is-done,
.auth-steps .is-current {
  color: var(--auth-ink);
}

.auth-steps .is-done .step-dot {
  border-color: var(--auth-brand-600);
  background: var(--auth-brand-600);
  color: #fff;
}

.auth-steps .is-current .step-dot {
  border-color: var(--auth-brand-500);
  background: var(--auth-surface);
  color: var(--auth-brand-700);
  box-shadow: 0 0 0 4px rgba(25, 135, 84, 0.14);
}

/* ---------- One-time code boxes ---------- */

.otp-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--auth-ink);
}

.otp-group {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 20px;
}

.otp-box {
  width: 100%;
  min-width: 0;
  height: clamp(48px, 13vw, 60px);
  padding: 0;
  border: 1.5px solid var(--auth-line);
  border-radius: 12px;
  background: var(--auth-field);
  color: var(--auth-ink);
  caret-color: var(--auth-brand-600);
  text-align: center;
  font-family: var(--auth-font-head);
  font-size: 1.5rem;
  font-weight: 800;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.otp-box:focus {
  outline: none;
  border-color: var(--auth-brand-500);
  background: var(--auth-surface);
  box-shadow: var(--auth-ring);
}

.otp-box.is-filled {
  border-color: var(--auth-brand-200);
  background: var(--auth-surface);
}

.otp-box:disabled {
  opacity: 0.75;
}

.otp-group.has-error .otp-box {
  border-color: var(--auth-danger);
  background: var(--auth-danger-bg);
}

.otp-group.is-success .otp-box {
  border-color: var(--auth-brand-500);
  background: var(--auth-brand-50);
  color: var(--auth-brand-700);
  opacity: 1;
}

@media (min-width: 400px) {
  .otp-group {
    gap: 10px;
  }
}

/* ---------- Signup role picker ---------- */

.role-picker {
  min-width: 0;
  margin: 0 0 22px;
  padding: 0;
  border: 0;
}

.role-picker legend {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 10px;
  padding: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--auth-ink);
}

.role-picker legend small {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--auth-muted);
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

/* On narrow phones: 3 on top, 2 centred below */
@media (max-width: 479px) {
  .role-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .role-option {
    grid-column: span 2;
  }

  .role-option:nth-child(4) {
    grid-column: 2 / span 2;
  }
}

.role-option {
  position: relative;
  min-width: 0;
}

.role-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  pointer-events: none;
}

.role-option[data-role="landlord"] { --role: var(--role-landlord); --role-soft: var(--role-landlord-soft); }
.role-option[data-role="tenant"]   { --role: var(--role-tenant);   --role-soft: var(--role-tenant-soft); }
.role-option[data-role="buyer"]    { --role: var(--role-buyer);    --role-soft: var(--role-buyer-soft); }
.role-option[data-role="seller"]   { --role: var(--role-seller);   --role-soft: var(--role-seller-soft); }
.role-option[data-role="agent"]    { --role: var(--role-agent);    --role-soft: var(--role-agent-soft); }

.role-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  height: 100%;
  padding: 14px 4px 11px;
  border: 1.5px solid var(--auth-line);
  border-radius: 14px;
  background: var(--auth-surface);
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.role-tile {
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
  .role-tile:hover {
    border-color: var(--role);
    transform: translateY(-2px);
    box-shadow: 0 10px 18px -14px rgba(20, 32, 26, 0.5);
  }
}

.role-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--role-soft);
  color: var(--role);
  font-size: 1rem;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.role-name {
  font-family: var(--auth-font-head);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--auth-ink);
}

.role-tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--auth-soft);
  color: var(--auth-muted);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}

.role-check {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--role);
  color: #fff;
  font-size: 0.6rem;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.role-option input:checked + .role-tile {
  border-color: var(--role);
  background: var(--role-soft);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--role) 16%, transparent);
}

.role-option input:checked + .role-tile .role-icon {
  background: var(--role);
  color: #fff;
  transform: scale(1.05);
}

.role-option input:checked + .role-tile .role-tag {
  background: var(--role);
  color: #fff;
}

.role-option input:checked + .role-tile .role-check {
  opacity: 1;
  transform: scale(1);
}

.role-option input:focus-visible + .role-tile {
  outline: 2px solid var(--role);
  outline-offset: 2px;
}

.role-hint {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--auth-soft);
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--auth-text);
}

.role-hint i {
  margin-top: 3px;
  color: var(--auth-muted);
}

.role-hint strong {
  color: var(--auth-ink);
}

.role-picker.has-error .role-tile {
  border-color: var(--auth-danger-line);
}

.role-picker.has-error .role-hint {
  background: var(--auth-danger-bg);
  color: var(--auth-danger);
}

.role-picker.has-error .role-hint i {
  color: var(--auth-danger);
}

@media (max-width: 379px) {
  .role-tag {
    display: none;
  }
}

/* ==========================================================================
   Showcase (right side, large screens)
   ========================================================================== */

.auth-showcase {
  display: none;
}

@media (min-width: 992px) {
  .auth-showcase {
    display: block;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 14px 14px 14px 0;
  }
}

.showcase-frame {
  container: showcase / size;
  position: relative;
  isolation: isolate;
  height: 100%;
  overflow: hidden;
  border-radius: 28px;
  color: #fff;
  background: var(--auth-brand-900);
}

.showcase-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background: url("/assets/images/auth/auth-showcase.jpg") 40% center / cover no-repeat;
  transform: scale(1.03);
}

.showcase-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(640px circle at 105% -5%, rgba(244, 183, 64, 0.22), transparent 55%),
    radial-gradient(520px circle at -10% 110%, rgba(25, 135, 84, 0.45), transparent 60%),
    linear-gradient(180deg, rgba(6, 36, 22, 0.62) 0%, rgba(6, 36, 22, 0.8) 42%, rgba(4, 24, 15, 0.95) 100%);
}

.showcase-inner {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  height: 100%;
  padding: 34px clamp(32px, 4vw, 56px) 32px;
}

.showcase-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  align-self: flex-start;
  color: #fff;
  text-decoration: none;
}

.showcase-brand-tile {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.5), 0 0 0 4px rgba(255, 255, 255, 0.12);
}

.showcase-brand-tile img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.showcase-brand-text strong {
  display: block;
  font-family: var(--auth-font-head);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.showcase-brand-text small {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.showcase-copy {
  max-width: 520px;
}

.showcase-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 7px 14px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 0.8rem;
  font-weight: 600;
}

.showcase-eyebrow i {
  color: var(--auth-amber);
}

.showcase-copy h2 {
  margin: 0 0 14px;
  font-family: var(--auth-font-head);
  font-size: clamp(2rem, 3.1vw, 2.85rem);
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -0.025em;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.25);
}

.showcase-copy h2 em {
  font-style: normal;
  color: var(--auth-amber);
}

.showcase-copy p {
  margin: 0;
  max-width: 460px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1rem;
  line-height: 1.6;
}

/* Illustrated cluster of floating UI cards */
.showcase-visual {
  position: relative;
  width: 100%;
  max-width: 540px;
  height: 270px;
  flex: none;
}

.auth-showcase[data-variant="signup"] .showcase-visual {
  height: 300px;
}

/* Sized against the panel itself (not the viewport) because a narrower panel
   wraps the headline and chips onto more lines: shrink the card cluster when
   space is tight, and drop it entirely before it can push content out. */
@container showcase (max-height: 820px) {
  .showcase-visual {
    zoom: 0.82;
  }
}

@container showcase (max-width: 640px) {
  .showcase-visual {
    zoom: 0.82;
  }
}

@container showcase (max-height: 740px) {
  .showcase-visual {
    display: none;
  }
}

@container showcase (max-width: 640px) and (max-height: 870px) {
  .showcase-visual {
    display: none;
  }
}

.sc-card {
  position: absolute;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.97);
  color: var(--auth-ink);
  box-shadow: 0 24px 48px -18px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.6);
  animation: sc-float 7s ease-in-out infinite;
}

.sc-card--glass {
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.sc-card--delay-1 { animation-delay: -2.3s; animation-duration: 8s; }
.sc-card--delay-2 { animation-delay: -4.6s; animation-duration: 9s; }

.sc-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sc-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 1rem;
  background: var(--auth-brand-50);
  color: var(--auth-brand-600);
}

.sc-card--glass .sc-icon {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.sc-title {
  display: block;
  font-family: var(--auth-font-head);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.25;
}

.sc-sub {
  display: block;
  font-size: 0.78rem;
  color: var(--auth-muted);
  line-height: 1.35;
}

.sc-card--glass .sc-sub {
  color: rgba(255, 255, 255, 0.75);
}

.sc-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--auth-brand-50);
  color: var(--auth-brand-700);
}

/* Login: listing card */
.sc-listing {
  top: 26px;
  left: 0;
  width: 290px;
  overflow: hidden;
}

.sc-listing-media {
  position: relative;
  height: 118px;
  background: url("/assets/images/auth/auth-showcase.jpg") 45% 52% / 260% no-repeat;
}

.sc-listing-media .sc-pill {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(255, 255, 255, 0.95);
}

.sc-listing-media .sc-fav {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: var(--role-seller);
  font-size: 0.8rem;
}

.sc-listing-body {
  padding: 14px 16px 16px;
}

.sc-price {
  display: block;
  margin-top: 6px;
  font-family: var(--auth-font-head);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--auth-brand-700);
}

.sc-price small {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--auth-muted);
}

.sc-meta {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--auth-line);
  font-size: 0.76rem;
  color: var(--auth-muted);
}

.sc-meta i {
  margin-right: 4px;
  color: #8a988f;
}

.sc-rent {
  top: 0;
  right: 0;
  width: 236px;
  padding: 14px 16px;
}

.sc-rent .sc-icon {
  background: var(--auth-brand-500);
  color: #fff;
}

.sc-viewing {
  right: 0;
  bottom: 14px;
  width: 248px;
  padding: 14px 16px;
}

.sc-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--auth-amber), #e07b39);
  color: #fff;
  font-family: var(--auth-font-head);
  font-size: 0.85rem;
  font-weight: 800;
}

/* Signup: role perks card (follows the selected role) */
.sc-perks {
  top: 0;
  left: 0;
  width: 340px;
  padding: 20px;
  display: none;
}

.auth-showcase[data-role=""] .sc-perks[data-role="all"],
.auth-showcase[data-role="landlord"] .sc-perks[data-role="landlord"],
.auth-showcase[data-role="tenant"] .sc-perks[data-role="tenant"],
.auth-showcase[data-role="buyer"] .sc-perks[data-role="buyer"],
.auth-showcase[data-role="seller"] .sc-perks[data-role="seller"],
.auth-showcase[data-role="agent"] .sc-perks[data-role="agent"] {
  display: block;
  animation: sc-pop 0.35s ease, sc-float 7s ease-in-out 0.35s infinite;
}

.sc-perks[data-role="landlord"] { --role: var(--role-landlord); --role-soft: var(--role-landlord-soft); }
.sc-perks[data-role="tenant"]   { --role: var(--role-tenant);   --role-soft: var(--role-tenant-soft); }
.sc-perks[data-role="buyer"]    { --role: var(--role-buyer);    --role-soft: var(--role-buyer-soft); }
.sc-perks[data-role="seller"]   { --role: var(--role-seller);   --role-soft: var(--role-seller-soft); }
.sc-perks[data-role="agent"]    { --role: var(--role-agent);    --role-soft: var(--role-agent-soft); }

.sc-perks .sc-icon {
  background: var(--role, var(--auth-brand-600));
  color: #fff;
}

.sc-perks .sc-pill {
  background: var(--role-soft, var(--auth-brand-50));
  color: var(--role, var(--auth-brand-700));
}

.sc-perk-list {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--auth-line);
  list-style: none;
  font-size: 0.86rem;
}

.sc-perk-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.sc-perk-list i {
  margin-top: 3px;
  color: var(--role, var(--auth-brand-600));
}

.sc-role-dots {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--auth-line);
}

.sc-role-dots span {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  font-size: 0.85rem;
}

.sc-verified {
  right: 0;
  bottom: 0;
  width: 240px;
  padding: 14px 16px;
}

/* Forgot: email preview */
.sc-mail {
  top: 0;
  left: 0;
  width: 320px;
  padding: 18px 18px 20px;
}

.sc-mail-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--auth-line);
}

.sc-mail-head img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 9px;
  background: var(--auth-soft);
  padding: 3px;
}

.sc-lines {
  display: grid;
  gap: 8px;
  margin: 12px 0 16px;
}

.sc-lines span {
  height: 8px;
  border-radius: 999px;
  background: var(--auth-soft);
}

.sc-lines span:nth-child(2) { width: 86%; }
.sc-lines span:nth-child(3) { width: 64%; }

.sc-mail-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 10px;
  background: var(--auth-brand-600);
  color: #fff;
  font-family: var(--auth-font-head);
  font-size: 0.82rem;
  font-weight: 700;
}

/* Verify: code boxes inside the email preview */
.sc-code-boxes {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin: 4px 0 12px;
}

.sc-code-boxes span {
  display: grid;
  place-items: center;
  height: 40px;
  border: 1.5px solid var(--auth-brand-200);
  border-radius: 9px;
  background: var(--auth-brand-50);
  color: var(--auth-brand-700);
  font-family: var(--auth-font-head);
  font-size: 1.1rem;
  font-weight: 800;
}

.sc-timer {
  top: 40px;
  right: 0;
  width: 220px;
  padding: 14px 16px;
}

.sc-safe {
  right: 40px;
  bottom: 0;
  width: 250px;
  padding: 14px 16px;
}

/* Reset: strength preview */
.sc-strength {
  top: 0;
  left: 0;
  width: 320px;
  padding: 20px;
}

.sc-strength .pw-meter {
  margin: 14px 0 4px;
}

.sc-strength .pw-meter span {
  background: var(--auth-brand-600);
}

.sc-strength .sc-perk-list {
  --role: var(--auth-brand-600);
}

.sc-lock {
  right: 0;
  bottom: 20px;
  width: 250px;
  padding: 14px 16px;
}

/* Approval: review checklist */
.sc-review {
  top: 0;
  left: 0;
  width: 320px;
  padding: 20px;
}

.sc-timeline {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--auth-line);
  list-style: none;
  font-size: 0.86rem;
  color: var(--auth-muted);
}

.sc-timeline li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sc-timeline i {
  width: 16px;
  text-align: center;
  color: var(--auth-line-strong);
}

.sc-timeline .is-done {
  color: var(--auth-ink);
}

.sc-timeline .is-done i {
  color: var(--auth-brand-600);
}

.sc-timeline .is-active {
  color: var(--auth-ink);
  font-weight: 700;
}

.sc-timeline .is-active i {
  color: var(--auth-amber);
}

/* Audience strip at the bottom of the showcase */
.showcase-roles-label {
  margin: 0 0 10px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.showcase-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.showcase-roles li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.showcase-roles li span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  font-size: 0.7rem;
}

.showcase-roles li.is-active {
  background: #fff;
  border-color: #fff;
  color: var(--auth-brand-900);
}

.showcase-roles li.is-active span {
  background: var(--auth-brand-600);
  color: #fff;
}

/* ---------- Animations ---------- */

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

@keyframes auth-shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

@keyframes auth-pulse {
  from { opacity: 0.9; transform: scale(0.92); }
  to { opacity: 0; transform: scale(1.18); }
}

@keyframes sc-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}

@keyframes sc-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-card > * {
  animation: auth-rise 0.5s ease both;
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
