/* ==========================================================================
   Sign in, create account and password pages
   Two halves: a photo on the left in a rounded frame, with nothing written on it,
   and the form on white on the right. On Create account the live registration
   slip sits under the photo. On a phone the photo shrinks to a strip above the form.
   ========================================================================== */

.page-auth {
  background: #fff;
}
.authx {
  display: grid;
  grid-template-columns: minmax(0, 46%) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---------- The photo side ------------------------------------------------ */

.authx__side {
  order: -1;
  padding: 14px 0 14px 14px;
  background: #fff;
}
.authx__stick {
  position: sticky;
  top: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: calc(100vh - 28px);
  height: calc(100dvh - 28px);
}
.authx__photo {
  position: relative;
  flex: 1;
  min-height: 300px;
  margin: 0;
  overflow: hidden;
  border-radius: 28px;
  background: linear-gradient(160deg, #ecedff 0%, #f6f1ff 50%, #ffeee6 100%);
  box-shadow: var(--shadow-real);
  isolation: isolate;
}
.authx__photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  animation: auth-photo-in 1.1s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes auth-photo-in {
  from { opacity: 0; transform: scale(1.04); }
  to { opacity: 1; transform: none; }
}
.authx__mobilepic {
  display: none;
}

/* ---------- The form side ------------------------------------------------- */

.authx__main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-inline: clamp(24px, 6vw, 96px);
}
.authx__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 88px;
}
.authx__top .brand img {
  width: auto;
  height: 46px;
  max-width: min(240px, 50vw);
  object-fit: contain;
  object-position: left center;
}
.authx__toplink {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.92rem;
}
.authx__body {
  display: grid;
  flex: 1;
  place-items: center;
  padding: 16px 0 40px;
}
.authx__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 24px;
  padding: 20px 0 24px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.86rem;
}

.auth {
  width: 100%;
  max-width: 440px;
}
/* a short brand line above the heading is all the ornament the form has */
.auth__card {
  position: relative;
  padding-top: 22px;
}
.auth__card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 52px;
  height: 5px;
  border-radius: 99px;
  background: linear-gradient(90deg, #3d3ae8, #7b5cff 50%, #ff6a2b);
}
.auth h1 {
  font-size: clamp(1.9rem, 2.9vw, 2.35rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.auth__lede {
  margin: 12px 0 30px;
  color: var(--text-secondary);
  font-size: 1.02rem;
  line-height: 1.55;
}
.page-auth .field label,
.auth__labelrow label {
  font-size: 0.9rem;
  font-weight: 600;
}
.page-auth .input {
  height: 52px;
  border-radius: 13px;
  font-size: 1rem;
}
.page-auth .input:focus {
  border-color: var(--primary);
  box-shadow: var(--ring);
}
.page-auth .btn-lg {
  height: 54px;
  border-radius: 14px;
  font-size: 1.02rem;
}
.auth__labelrow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.auth__labelrow a {
  font-size: 0.87rem;
  font-weight: 600;
  text-decoration: none;
}
.auth__labelrow a:hover {
  text-decoration: underline;
}
.auth__check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 24px;
  color: var(--text-secondary);
  font-size: 0.93rem;
}
.auth__check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
}
.auth__foot {
  margin-top: 28px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  text-align: center;
}
.auth__foot a {
  font-weight: 600;
}
.auth__foot:has(form) {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.auth__inline {
  display: inline;
}
.auth__meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
  padding: 14px 16px;
  background: var(--surface-secondary);
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.auth__meta span {
  color: var(--text-muted);
  font-size: 0.82rem;
}
.pwrules {
  margin: -8px 0 18px;
  color: var(--text-muted);
  font-size: 0.84rem;
}

/* ---------- Create account: the form is wider, and the slip sits under the photo ---------- */

.authx--register .reg {
  max-width: 600px;
}
.authx--register .authx__body {
  place-items: start center;
  padding-top: 20px;
  padding-bottom: 48px;
}
.authx--register .reg > .panel {
  position: relative;
  padding-top: 22px;
}
.authx--register .reg > .panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 52px;
  height: 5px;
  border-radius: 99px;
  background: linear-gradient(90deg, #3d3ae8, #7b5cff 50%, #ff6a2b);
}
.authx--register .authx__photo {
  min-height: 240px;
}
.authx__stick .slip {
  flex: none;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-real);
}

.testlink { margin-top: 10px; }
.testmode-note { margin-bottom: 16px; }

/* ---------- Smaller screens ---------- */

@media (max-width: 1024px) {
  .authx {
    grid-template-columns: minmax(0, 1fr);
  }
  .authx__side {
    display: none;
  }
  .authx__body {
    display: block;
    padding-top: 8px;
  }
  .authx__body > .auth,
  .authx__body > .reg {
    margin-inline: auto;
  }
  .authx__mobilepic {
    display: block;
    width: 100%;
    max-width: 440px;
    height: 170px;
    margin: 0 auto 22px;
    object-fit: cover;
    border-radius: 20px;
    box-shadow: var(--shadow-real);
  }
  .authx--register .authx__mobilepic {
    max-width: 600px;
  }
  /* on Create account the slip follows the form (before the footer) instead of disappearing */
  .authx--register {
    display: flex;
    flex-direction: column;
  }
  .authx--register .authx__main {
    display: contents;
  }
  .authx--register .authx__top,
  .authx--register .authx__body,
  .authx--register .authx__foot {
    padding-inline: clamp(24px, 6vw, 96px);
  }
  .authx--register .authx__top { order: 1; }
  .authx--register .authx__body { order: 2; flex: none; padding-bottom: 8px; }
  .authx--register .authx__side {
    display: block;
    order: 3;
    padding: 0 clamp(24px, 6vw, 96px) 36px;
  }
  .authx--register .authx__foot {
    order: 4;
    margin-inline: clamp(24px, 6vw, 96px);
    padding-inline: 0;
  }
  .authx--register .authx__stick {
    position: static;
    height: auto;
    max-width: 600px;
    margin-inline: auto;
  }
  .authx--register .authx__stick .authx__photo {
    display: none;
  }
}
@media (max-width: 480px) {
  .authx__toplink span:not(.badge) {
    display: none;
  }
  .authx__top {
    min-height: 68px;
  }
  .authx__mobilepic {
    height: 140px;
    border-radius: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .authx__photo img {
    animation: none;
  }
}

/* ---------- The admin sign-in and change-password pages wear the admin panel's colours (emerald) ---------- */
.page-auth--admin {
  --primary: #0f766e;
  --primary-hover: #0d5f59;
  --primary-active: #0a4b46;
  --primary-light: #e4f6f1;
  --primary-soft: #c6ebe1;
  --grad-brand: linear-gradient(135deg, #047857 0%, #0f766e 55%, #0e7490 100%);
  --shadow-brand: 0 12px 22px -10px rgba(13, 148, 136, 0.6);
  --ring: 0 0 0 4px rgba(13, 148, 136, 0.22);
  --navy: #06231f;
  --navy-text: #c7ece1;
  --text-primary: #0f2a26;
  --text-secondary: #3c5852;
  --text-muted: #5a766f;
  --border: #dce9e5;
  --border-strong: #c0d6cf;
  background: #fff;
  color: var(--text-primary);
}
.page-auth--admin .auth__card::before { background: linear-gradient(90deg, #059669, #0d9488 50%, #22d3ee); }
.page-auth--admin .authx__photo { background: linear-gradient(160deg, #0a3a33, #06231f); }

/* ---- the code from the email, asked for at sign-in after the password ---- */
.codeinput { height: 60px; font-size: 1.7rem; font-weight: 700; letter-spacing: 0.45em; text-align: center; padding-left: 0.45em; }
.codeinput::placeholder { letter-spacing: 0.3em; color: #c3c8d6; }
.codeacts { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-top: 18px; font-size: 0.92rem; }
.codeacts form { margin: 0; }
.codeacts a, .codeacts .textbtn { font-weight: 600; }
.textbtn { padding: 0; border: 0; background: none; color: var(--primary, #3d3ae8); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.textbtn:disabled { color: var(--text-muted, #8b93a8); cursor: default; text-decoration: none; }
