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

.public-page {
  min-height: 100vh;
  min-height: 100svh;
  background:
    radial-gradient(900px 560px at 6% -8%, rgba(59, 130, 246, 0.20), transparent 62%),
    radial-gradient(780px 520px at 102% 104%, rgba(14, 165, 233, 0.16), transparent 65%),
    linear-gradient(180deg, #0a0f1b 0%, #0b1120 55%, #0a1020 100%);
}

.public-page .public-hero {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 24px) 16px
           calc(env(safe-area-inset-bottom, 0px) + 24px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.public-page .public-card {
  width: 100%;
  max-width: 1140px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  text-align: left;
}

.auth-flash-stack {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  left: 50%;
  z-index: 120;
  width: min(100% - 24px, 620px);
  transform: translateX(-50%);
  pointer-events: none;
}

.auth-messages {
  display: grid;
  gap: 10px;
}

.auth-alert {
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.36);
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.32);
  text-align: center;
  pointer-events: auto;
}

.auth-alert-success {
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(7, 53, 28, 0.9);
}

.auth-alert-error,
.auth-alert-danger {
  border-color: rgba(239, 68, 68, 0.52);
  background: rgba(69, 17, 17, 0.9);
}

.auth-alert-warning,
.auth-alert-warn {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(80, 49, 10, 0.9);
}

.auth-alert-info {
  border-color: rgba(59, 130, 246, 0.52);
  background: rgba(16, 45, 94, 0.9);
}

.persona-auth {
  width: 100%;
}

.persona-auth-shell {
  width: 100%;
}

.persona-auth-stage {
  width: 100%;
}

.persona-auth-stage-auth {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: stretch;
  animation: authStageIn .42s ease both;
}

.persona-auth-stage-auth .persona-auth-branding {
  grid-template-rows: auto 1fr;
  align-content: stretch;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.persona-auth-stage-auth .persona-auth-panel {
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.persona-auth-stage-auth .persona-auth-logo {
  align-self: center;
}

.persona-auth--register .persona-auth-stage-auth .persona-auth-branding {
  display: flex;
  align-items: center;
  justify-content: center;
}

.persona-auth--login .persona-auth-stage-auth .persona-auth-branding {
  display: flex;
  align-items: center;
  justify-content: center;
}

.persona-auth--password-reset .persona-auth-stage-auth .persona-auth-branding {
  display: flex;
  align-items: center;
  justify-content: center;
}

.persona-auth--login .persona-auth-panel {
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.persona-auth--password-reset .persona-auth-panel {
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.persona-auth--login .persona-auth-box {
  border-radius: 20px;
}

.persona-auth--password-reset .persona-auth-box {
  border-radius: 20px;
}

.persona-auth-stage-welcome {
  display: flex;
  justify-content: center;
}

.persona-auth-branding,
.persona-auth-panel {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 28px;
  backdrop-filter: blur(8px);
  box-shadow:
    0 22px 60px rgba(2, 6, 23, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

.persona-auth-branding {
  display: grid;
  gap: 1rem;
  align-content: start;
  padding: 1.1rem;
  background:
    radial-gradient(120% 100% at 15% 0%, rgba(14, 165, 233, 0.24), transparent 60%),
    linear-gradient(145deg, rgba(15, 23, 42, 0.8), rgba(15, 23, 42, 0.55));
}

.persona-auth-panel {
  padding: 1rem;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.88), rgba(15, 23, 42, 0.72));
  position: relative;
}

.persona-auth-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 4% 0%, rgba(56, 189, 248, 0.16), transparent 62%),
    radial-gradient(120% 80% at 100% 100%, rgba(59, 130, 246, 0.12), transparent 62%);
  opacity: .9;
}

.persona-auth-panel::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(140deg, rgba(56, 189, 248, 0.10), transparent 42%, rgba(59, 130, 246, 0.10));
  mix-blend-mode: screen;
  opacity: .7;
}

.persona-auth-screen {
  padding-top: 0;
}

.persona-auth-intro {
  width: 100%;
  text-align: left;
  margin: 0;
}

.persona-auth-intro-left {
  text-align: left;
}

.persona-auth-eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 0.34rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.38);
  background: rgba(15, 23, 42, 0.62);
  color: rgba(226, 232, 240, 0.9);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.7rem;
}

.persona-auth-title {
  margin: 0;
  font-weight: 800;
  font-size: clamp(1.7rem, 3.2vw, 2.8rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.persona-auth-subtitle {
  margin: 8px 0 0;
  max-width: 42ch;
  font-size: clamp(0.95rem, 1.6vw, 1.05rem);
  line-height: 1.5;
  color: rgba(226, 232, 240, 0.82);
}

.persona-auth-logo {
  width: 100%;
  display: grid;
  place-items: center;
}

.persona-auth-logo img {
  width: min(100%, 410px);
  max-width: 410px;
  max-height: 300px;
  height: auto;
  object-fit: contain;
  display: block;
  border-radius: 20px;
  margin-inline: auto;
}

.persona-auth-logo-fallback {
  width: 100%;
  max-width: 400px;
  height: 220px;
  border-radius: 26px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: clamp(80px, 16vw, 126px);
  color: #fff;
  background:
    radial-gradient(circle at 20% 20%, rgba(56, 189, 248, 0.44), transparent 40%),
    linear-gradient(135deg, rgba(59, 130, 246, 0.28), rgba(14, 165, 233, 0.16));
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.persona-auth-lang {
  width: 100%;
  display: flex;
  justify-content: flex-start;
}

.persona-auth-lang .lang-switcher {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: auto;
  flex-wrap: wrap;
}

.persona-auth-lang .lang-switcher-select {
  width: auto;
  min-width: 150px;
  max-width: 240px;
  height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 16px;
}

.persona-auth-next {
  width: 100%;
  display: flex;
  justify-content: flex-start;
}

.persona-auth-panel-head {
  display: grid;
  gap: 0.25rem;
  margin-bottom: 0.45rem;
}

.persona-auth-panel-title {
  margin: 0;
  font-size: clamp(1.25rem, 2.2vw, 1.7rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.persona-auth-panel-copy {
  margin: 0;
  color: rgba(226, 232, 240, 0.76);
  font-size: 0.94rem;
}

.persona-auth-form {
  width: 100%;
}

.persona-auth-box {
  width: 100%;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  background: rgba(15, 23, 42, 0.64);
  transition: box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 10px 32px rgba(0, 0, 0, 0.34);
}

.persona-auth-box.is-focused {
  border-color: rgba(56, 189, 248, 0.58);
  box-shadow:
    0 0 0 1px rgba(56, 189, 248, 0.28) inset,
    0 0 20px rgba(56, 189, 248, 0.34),
    0 16px 42px rgba(0, 0, 0, 0.34);
}

.persona-auth-box.has-error {
  border-color: rgba(248, 113, 113, 0.58);
  box-shadow:
    0 0 0 1px rgba(248, 113, 113, 0.22) inset,
    0 0 18px rgba(248, 113, 113, 0.32),
    0 16px 42px rgba(0, 0, 0, 0.34);
}

.persona-auth .form-row {
  margin-top: 10px;
}

.persona-auth .form-row:first-child {
  margin-top: 0;
}

.persona-auth .form-row.has-icon {
  position: relative;
  isolation: isolate;
}

.persona-auth .form-row.has-icon .input-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  color: rgba(226, 232, 240, 0.64);
  pointer-events: none;
  z-index: 12;
}

.persona-auth .form-row.has-icon .form-control {
  width: 100%;
  padding-left: 42px;
  position: relative;
  z-index: 1;
  color-scheme: dark;
  background: rgba(15, 23, 42, 0.64);
  color: rgba(226, 232, 240, 0.96);
}

.persona-auth .form-row.has-toggle .form-control {
  padding-right: 42px;
}

/* Keep dark input styling when browser password manager autofills fields */
.persona-auth .form-row input.form-control:-webkit-autofill,
.persona-auth .form-row input.form-control:-webkit-autofill:hover,
.persona-auth .form-row input.form-control:-webkit-autofill:focus,
.persona-auth .form-row input.form-control:-webkit-autofill:active,
.persona-auth .form-row input.form-control:autofill,
.persona-auth .form-row input.form-control:autofill:hover,
.persona-auth .form-row input.form-control:autofill:focus {
  -webkit-text-fill-color: rgba(226, 232, 240, 0.96) !important;
  caret-color: rgba(226, 232, 240, 0.96) !important;
  background-color: rgba(15, 23, 42, 0.92) !important;
  -webkit-box-shadow: 0 0 0 1000px rgba(15, 23, 42, 0.92) inset !important;
  box-shadow: 0 0 0 1000px rgba(15, 23, 42, 0.92) inset !important;
  border-color: rgba(148, 163, 184, 0.34) !important;
  background-clip: padding-box !important;
  -webkit-background-clip: padding-box !important;
  filter: none !important;
  transition: background-color 999999s ease-out, color 999999s ease-out;
}

.persona-auth .form-row .form-control:-webkit-autofill::first-line {
  font-family: inherit;
  font-size: inherit;
  color: rgba(226, 232, 240, 0.96) !important;
}

.persona-auth .form-row input.form-control:-moz-autofill {
  box-shadow: 0 0 0 1000px rgba(15, 23, 42, 0.92) inset !important;
  -moz-text-fill-color: rgba(226, 232, 240, 0.96) !important;
  color: rgba(226, 232, 240, 0.96) !important;
  border-color: rgba(148, 163, 184, 0.34) !important;
}

.password-toggle {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  padding: 6px;
  line-height: 0;
  cursor: pointer;
  color: rgba(226, 232, 240, 0.56);
  z-index: 12;
}

.password-toggle:hover,
.password-toggle:focus {
  color: rgba(226, 232, 240, 0.94);
  outline: none;
}

.persona-auth-primary {
  width: 100%;
  max-width: 100%;
  position: relative;
  overflow: hidden;
  border-radius: var(--persona-radius-chip, 12px);
  border: 1px solid rgba(147, 197, 253, 0.42);
  background: var(--persona-accent-gradient, linear-gradient(140deg, rgba(56, 189, 248, 0.94), rgba(37, 99, 235, 0.92)));
  box-shadow:
    var(--persona-elev-soft, 0 10px 24px rgba(2, 132, 199, 0.3)),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}

.persona-auth-primary::after {
  content: "";
  position: absolute;
  top: 0;
  left: -130%;
  width: 55%;
  height: 100%;
  background: linear-gradient(95deg, transparent, rgba(255, 255, 255, 0.26), transparent);
  transition: left .34s ease;
}

a.btn.persona-auth-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.btn.persona-auth-primary,
a.btn.persona-auth-primary {
  color: #fff !important;
}

.btn.persona-auth-primary:hover,
.btn.persona-auth-primary:focus {
  transform: translateY(-1px);
  filter: brightness(1.03);
  box-shadow:
    0 16px 32px rgba(2, 132, 199, 0.36),
    0 0 0 1px rgba(255, 255, 255, 0.12) inset;
}

.btn.persona-auth-primary:hover::after,
.btn.persona-auth-primary:focus::after {
  left: 130%;
}

.persona-auth-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  color: rgba(226, 232, 240, 0.72);
  text-align: center;
}

.persona-auth-links a {
  text-decoration: none;
  color: rgba(226, 232, 240, 0.94);
  font-size: 15px;
}

.persona-auth-links a:hover,
.persona-auth-links a:focus {
  color: #fff;
  text-decoration: underline;
}

.persona-auth-links .dot {
  opacity: 0.55;
}

.persona-auth-checks {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.persona-auth-checks .check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  color: rgba(226, 232, 240, 0.9);
}

.persona-auth-checks .check input {
  margin-top: 3px;
}

@media (max-width: 600px) {
  .public-page .public-hero {
    padding-top: calc(env(safe-area-inset-top, 0px) + 16px);
  }

  .persona-auth-branding,
  .persona-auth-panel {
    border-radius: 20px;
    padding: 0.9rem;
  }

  .persona-auth-title {
    font-size: 1.55rem;
  }

  .persona-auth-subtitle {
    font-size: 0.9rem;
  }

  .persona-auth-logo img,
  .persona-auth-logo-fallback {
    max-width: 300px;
  }

  .persona-auth-logo-fallback {
    height: 180px;
  }

  .persona-auth-links {
    gap: 7px;
  }

  .persona-auth-links .dot {
    display: none;
  }
}

@media (max-width: 430px) {
  .public-page .public-hero {
    padding-left: 10px;
    padding-right: 10px;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  }

  .public-page .public-card {
    max-width: 100%;
  }

  .persona-auth-branding,
  .persona-auth-panel {
    border-radius: 16px;
    padding: 0.72rem;
  }

  .persona-auth-panel-head {
    gap: 0.2rem;
    margin-bottom: 0.36rem;
  }

  .persona-auth-panel-title {
    font-size: 1.18rem;
    line-height: 1.12;
  }

  .persona-auth-panel-copy {
    font-size: 0.84rem;
    line-height: 1.34;
  }

  .persona-auth-box {
    border-radius: 14px;
    padding: 10px;
  }

  .persona-auth .form-row {
    margin-top: 8px;
  }

  .persona-auth .form-row.has-icon .input-icon {
    left: 11px;
    width: 20px;
    height: 20px;
  }

  .persona-auth .form-row.has-icon .form-control {
    padding-left: 38px;
    min-height: 44px;
    font-size: 16px;
  }

  .persona-auth .form-row.has-toggle .form-control {
    padding-right: 38px;
  }

  .password-toggle {
    right: 7px;
    padding: 5px;
  }

  .persona-auth-primary {
    min-height: 44px;
    border-radius: 10px;
    font-size: 0.93rem;
  }

  .persona-auth-links {
    gap: 6px;
    font-size: 0.84rem;
  }

  .persona-auth-links a {
    font-size: 0.84rem;
  }

  .persona-auth-checks .check {
    font-size: 0.8rem;
    line-height: 1.3;
  }

  .persona-auth-logo img,
  .persona-auth-logo-fallback {
    max-width: 250px;
  }
}

@media (max-width: 360px) {
  .persona-auth-branding,
  .persona-auth-panel {
    padding: 0.62rem;
  }

  .persona-auth-panel-title {
    font-size: 1.08rem;
  }

  .persona-auth-panel-copy {
    font-size: 0.8rem;
  }

  .persona-auth-logo img,
  .persona-auth-logo-fallback {
    max-width: 220px;
  }
}

@media (min-width: 980px) {
  .public-page .public-hero {
    padding-left: 24px;
    padding-right: 24px;
  }

  .persona-auth-stage-auth {
    grid-template-columns: minmax(360px, 1.02fr) minmax(420px, 0.98fr);
    gap: 20px;
  }

  .persona-auth-branding {
    min-height: min(720px, 75vh);
    padding: 1.2rem;
  }

  .persona-auth--register .persona-auth-stage-auth .persona-auth-branding {
    min-height: min(720px, 75vh);
  }

  .persona-auth--login .persona-auth-stage-auth .persona-auth-branding {
    min-height: min(720px, 75vh);
  }

  .persona-auth--password-reset .persona-auth-stage-auth .persona-auth-branding {
    min-height: min(720px, 75vh);
  }

  .persona-auth-panel {
    align-self: center;
    padding: 1.1rem;
  }
}

@keyframes authStageIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
