*{ box-sizing: border-box; }

/* Shared by register / role / forget / verify / reset (not all use .auth-page) */
body{
  margin: 0;
  font-family: var(--wl-font-family, system-ui, -apple-system, "Segoe UI", Arial, sans-serif);
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--wl-text-on-light, #1a2f4a);
  background: var(--wl-palette-bg, #e4edf7);
}

body.auth-page{
  overflow-x: hidden;
  overflow-y: auto;
}

.register-bg{
  position: fixed;
  inset: 0;
  background: var(--wl-palette-bg, #e4edf7);
  z-index: -1;
}

/* Recovery pages: small logo in corner */
.logo.logo--corner{
  position: fixed;
  top: 14px;
  inset-inline-start: 14px;
  z-index: 2;
  text-decoration: none;
  line-height: 0;
}

.logo.logo--corner .brand-logo{
  height: 56px;
  width: auto;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(26, 47, 74, 0.12));
}

/* Login / register / role: centered hero logo above card */
.auth-stack{
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: clamp(20px, 4vh, 36px);
}

.auth-stack--wide{
  max-width: min(560px, 100%);
  min-width: 0;
}

.auth-logo-top{
  display: block;
  text-decoration: none;
  line-height: 0;
  flex-shrink: 0;
}

.auth-hero-logo{
  display: block;
  width: min(560px, 96vw);
  height: auto;
  max-height: min(300px, 42vh);
  object-fit: contain;
  margin-inline: auto;
  filter: drop-shadow(0 10px 28px rgba(26, 47, 74, 0.16));
}

/* Logo inside the white auth card (login / register / forget) */
.auth-card__brand{
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 0 12px;
  text-decoration: none;
  line-height: 0;
}

.auth-card__logo{
  display: block;
  width: auto;
  height: clamp(72px, 18vw, 108px);
  max-width: min(280px, 70%);
  object-fit: contain;
  filter: drop-shadow(0 6px 16px rgba(26, 47, 74, 0.12));
}

/* Layout shell */
.register-wrap,
.auth-shell{
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 5vw, 40px);
  padding-top: clamp(28px, 6vh, 56px);
}

.auth-card{
  width: min(480px, 100%);
  max-width: 100%;
  min-width: 0;
  padding: clamp(24px, 4vw, 32px);
  border-radius: 20px;
  background: #ffffff;
  border: 1px solid rgba(26, 47, 74, 0.08);
  box-shadow:
    0 4px 6px -1px rgba(26, 47, 74, 0.06),
    0 20px 40px -12px rgba(26, 47, 74, 0.12);
}

.auth-card--wide{
  width: min(560px, 100%);
}

/* Role page option cards */
.auth-card--role{
  width: min(560px, 100%);
  padding: clamp(22px, 4vw, 32px) clamp(20px, 4vw, 36px);
}

.auth-card__head{
  margin-bottom: 20px;
  text-align: center;
}

.auth-card__head--tight{
  margin-bottom: 16px;
}

.auth-card__title{
  margin: 0 0 8px;
  font-size: clamp(1.35rem, 3.5vw, 1.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--wl-palette-navy, #1a2f4a);
  line-height: 1.25;
}

.auth-card__sub{
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.45;
  color: rgba(26, 47, 74, 0.62);
}

.register-form{
  width: 100%;
  display: grid;
  gap: 14px;
  justify-items: stretch;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.register-grid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

@media (min-width: 560px){
  .register-grid{
    grid-template-columns: 1fr 1fr;
  }
  .register-grid__full{
    grid-column: 1 / -1;
  }
}

.register-name-row{
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

@media (min-width: 560px){
  .register-name-row{
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.register-name-row > .row{
  min-width: 0;
  max-width: 100%;
}

.register-name-row .row input{
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding-inline: 10px;
}

/* Stacked label above field */
.register-form .row,
.auth-card .row{
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: stretch;
}

.row label{
  color: var(--wl-palette-navy-mid, #243854);
  font-weight: 700;
  font-size: 0.9rem;
  text-align: start;
  white-space: normal;
}

.row input,
.row select{
  height: 48px;
  border-radius: 12px;
  border: 1px solid rgba(26, 47, 74, 0.18);
  background: #f8fafc;
  outline: none;
  padding: 10px 14px;
  font-size: 16px;
  color: var(--wl-text-on-light, #1a2f4a);
  box-shadow: none;
  transition:
    border-color .16s ease-out,
    background-color .16s ease-out,
    box-shadow .16s ease-out;
}

.row select{
  cursor: pointer;
}

.row input:focus,
.row select:focus{
  border-color: var(--wl-palette-logo, #36d7e8);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(54, 215, 232, 0.2);
}

.hint{
  grid-column: 1 / -1;
  margin-top: 2px;
  font-size: 0.8rem;
  color: rgba(26, 47, 74, 0.55);
  line-height: 1.35;
}

/* Live password requirements checklist */
.password-reqs{
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
  width: 100%;
}

.password-reqs[hidden]{
  display: none !important;
}

.password-reqs__item{
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
}

.password-reqs__icon{
  flex: 0 0 auto;
  width: 1.15em;
  font-weight: 900;
  line-height: 1.35;
  text-align: center;
}

.password-reqs__item.is-unmet,
.password-reqs__item.is-unmet .password-reqs__icon,
.password-reqs__item.is-unmet .password-reqs__label{
  color: #dc2626 !important;
}

.password-reqs__item.is-met,
.password-reqs__item.is-met .password-reqs__icon,
.password-reqs__item.is-met .password-reqs__label{
  color: #16a34a !important;
}

/* Legacy page title (forget / verify / reset) */
.title{
  margin: 0 0 12px;
  color: var(--wl-palette-navy, #1a2f4a);
  font-weight: 800;
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  text-align: center;
  letter-spacing: -0.02em;
}

.error{
  margin: 0;
  min-height: 22px;
  width: 100%;
  text-align: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: #b91c1c;
}

.error.is-success{
  color: #047857;
}

.auth-code-input{
  text-align: center;
  letter-spacing: 0.35em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.register-btn{
  width: 100%;
  margin-top: 4px;
  border: 0;
  cursor: pointer;
  padding: 14px 20px;
  border-radius: 12px;
  color: var(--wl-palette-navy, #1a2f4a);
  font-weight: 800;
  font-size: 1rem;
  background: var(--wl-palette-logo, #36d7e8);
  box-shadow: 0 8px 20px rgba(54, 215, 232, 0.35);
  transition: filter .18s ease-out, box-shadow .18s ease-out;
}

.register-btn:hover{
  filter: brightness(1.04);
  box-shadow: 0 10px 26px rgba(54, 215, 232, 0.42);
}

.footer{
  margin: 8px 0 0;
  color: rgba(26, 47, 74, 0.6);
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
  line-height: 1.5;
}

.footer a{
  color: var(--wl-palette-logo-deep, #1fb8d4);
  font-weight: 700;
  text-decoration: none;
}

.footer a:hover{
  text-decoration: underline;
}

/* Role selection — two option cards */
.choose-wrap{
  min-height: 100vh;
  min-height: 100dvh;
}

.choose-actions{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(12px, 3vw, 18px);
  width: 100%;
}

.choose-option{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 88px;
  border: 1px solid rgba(26, 47, 74, 0.12);
  cursor: pointer;
  padding: 18px 14px;
  border-radius: 16px;
  background: #f8fafc;
  box-shadow: none;
  transition:
    transform .14s ease,
    border-color .14s ease,
    background-color .14s ease,
    box-shadow .14s ease;
}

.choose-option:hover{
  transform: translateY(-2px);
  border-color: rgba(54, 215, 232, 0.55);
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(26, 47, 74, 0.1);
}

.choose-option:focus-visible{
  outline: none;
  border-color: var(--wl-palette-logo, #36d7e8);
  box-shadow: 0 0 0 3px rgba(54, 215, 232, 0.28);
}

.choose-option__title{
  font-weight: 900;
  font-size: clamp(1.05rem, 2.8vw, 1.2rem);
  color: var(--wl-palette-navy, #1a2f4a);
  line-height: 1.2;
}

.choose-option__hint{
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  color: rgba(26, 47, 74, 0.58);
  max-width: 18ch;
}

/* Legacy pill buttons (if any remain) */
.choose-btn{
  border: 0;
  cursor: pointer;
  padding: 14px clamp(28px, 7vw, 52px);
  border-radius: 999px;
  font-weight: 900;
  font-size: clamp(1.05rem, 3.2vw, 1.35rem);
  color: var(--wl-palette-navy, #1a2f4a);
  background: var(--wl-palette-logo, #36d7e8);
  box-shadow: 0 14px 28px rgba(26, 47, 74, 0.12);
  transition: transform .12s ease, filter .12s ease, box-shadow .12s ease;
  white-space: nowrap;
}

.choose-btn:hover{
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.choose-btn:focus-visible{
  outline: none;
  box-shadow: 0 0 0 3px rgba(54, 215, 232, 0.45), 0 14px 28px rgba(26, 47, 74, 0.12);
}

.choose-btn.owner{
  opacity: 0.96;
}

.recover-switch{
  width: 100%;
  display: flex;
  justify-content: stretch;
  gap: 8px;
  margin: 0 0 4px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(26, 47, 74, 0.05);
  flex-wrap: nowrap;
}

.recover-tab{
  flex: 1 1 0;
  border: 0;
  background: transparent;
  color: rgba(26, 47, 74, 0.7);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}

.recover-tab.active{
  background: #ffffff;
  color: var(--wl-palette-navy, #1a2f4a);
  box-shadow: 0 2px 8px rgba(26, 47, 74, 0.1);
}

.recover-tab:hover:not(.active){
  color: var(--wl-palette-navy, #1a2f4a);
}

/* ===== Dark mode: register, role, forget / reset / verify ===== */
body.dark-mode.auth-page{
  background: #020617;
  color: #e5edf7;
}

body.dark-mode{
  color: #e5edf7;
}

body.dark-mode .register-bg{
  background:
    radial-gradient(circle at 100% 0%, rgba(34, 211, 238, 0.12), transparent 45%),
    linear-gradient(180deg, #0f172a 0%, #020617 100%);
}

body.dark-mode .logo.logo--corner .brand-logo,
body.dark-mode .auth-hero-logo,
body.dark-mode .auth-card__logo{
  filter: drop-shadow(0 12px 36px rgba(0, 0, 0, 0.45));
}

body.dark-mode .title{
  color: #f8fafc !important;
}

body.dark-mode .auth-card{
  background: linear-gradient(155deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.92));
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 26px 80px rgba(15, 23, 42, 0.85);
}

body.dark-mode .auth-card__title{
  color: #f8fafc;
}

body.dark-mode .auth-card__sub{
  color: #9ca3af;
}

/* Card-on-form for legacy pages without .auth-card wrapper */
body.dark-mode .register-wrap:not(.auth-shell) .register-form,
body.dark-mode .register-wrap:not(.auth-shell) form.register-form{
  padding: 28px 26px;
  border-radius: 24px;
  background: linear-gradient(155deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 26px 80px rgba(15, 23, 42, 0.85);
}

body.dark-mode .auth-shell .auth-card .register-form{
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

body.dark-mode .row label{
  color: #e5edf7 !important;
}

body.dark-mode .row input,
body.dark-mode .row select{
  border: 1px solid rgba(148, 163, 184, 0.35) !important;
  background-color: #020617 !important;
  background-image: none !important;
  color: #f8fafc !important;
  -webkit-text-fill-color: #f8fafc !important;
  caret-color: #f8fafc;
  color-scheme: dark;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.9) !important;
}

body.dark-mode .row input:focus,
body.dark-mode .row select:focus{
  border-color: #06b6d4 !important;
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.55) !important;
}

body.dark-mode .register-form input:-webkit-autofill,
body.dark-mode .register-form input:-webkit-autofill:hover,
body.dark-mode .register-form input:-webkit-autofill:focus,
body.dark-mode .register-form input:-webkit-autofill:active{
  -webkit-box-shadow: 0 0 0 1000px #0f172a inset !important;
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.35) inset !important;
  -webkit-text-fill-color: #f8fafc !important;
  caret-color: #f8fafc;
  color: #f8fafc !important;
  border: 1px solid rgba(148, 163, 184, 0.35) !important;
  transition: background-color 99999s ease-out 0s;
}

body.dark-mode .hint{
  color: #9ca3af !important;
}

body.dark-mode .password-reqs__item.is-unmet,
body.dark-mode .password-reqs__item.is-unmet .password-reqs__icon,
body.dark-mode .password-reqs__item.is-unmet .password-reqs__label{
  color: #f87171 !important;
}

body.dark-mode .password-reqs__item.is-met,
body.dark-mode .password-reqs__item.is-met .password-reqs__icon,
body.dark-mode .password-reqs__item.is-met .password-reqs__label{
  color: #34d399 !important;
}

body.dark-mode .error{
  color: #f97373 !important;
}

body.dark-mode .error.is-success{
  color: #34d399 !important;
}

body.dark-mode .register-btn{
  color: #f9fafb;
  background: linear-gradient(135deg, #22d3ee, #0e7490);
  box-shadow: 0 16px 40px rgba(8, 47, 73, 0.75);
}

body.dark-mode .register-btn:hover{
  filter: brightness(1.05);
}

body.dark-mode .footer,
body.dark-mode .footer span{
  color: #9ca3af !important;
}

body.dark-mode .footer a{
  color: #22d3ee !important;
}

body.dark-mode .choose-option{
  background: #020617;
  border-color: rgba(148, 163, 184, 0.28);
}

body.dark-mode .choose-option:hover{
  background: rgba(15, 23, 42, 0.95);
  border-color: rgba(34, 211, 238, 0.45);
  box-shadow: 0 16px 40px rgba(8, 47, 73, 0.55);
}

body.dark-mode .choose-option__title{
  color: #f8fafc;
}

body.dark-mode .choose-option__hint{
  color: #9ca3af;
}

body.dark-mode .choose-btn{
  color: #053433;
  background: linear-gradient(135deg, #22d3ee, #0ea5a2);
  box-shadow: 0 16px 40px rgba(8, 47, 73, 0.75);
}

body.dark-mode .choose-btn:hover{
  filter: brightness(1.06);
}

body.dark-mode .choose-btn:focus-visible{
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.5), 0 16px 40px rgba(8, 47, 73, 0.75);
}

body.dark-mode .recover-switch{
  background: rgba(2, 6, 23, 0.65);
}

body.dark-mode .recover-tab{
  background: transparent !important;
  border: 0 !important;
  color: #9ca3af !important;
  box-shadow: none !important;
}

body.dark-mode .recover-tab.active{
  background: linear-gradient(135deg, #22d3ee, #0e7490) !important;
  color: #f9fafb !important;
  box-shadow: 0 6px 16px rgba(8, 47, 73, 0.45) !important;
}

@media (max-width: 650px){
  .logo.logo--corner .brand-logo{
    height: 44px;
  }
  .auth-hero-logo{
    width: min(440px, 94vw);
    max-height: min(260px, 38vh);
  }
  .choose-actions{
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .choose-option{
    min-height: 96px;
  }
  .choose-option__hint{
    max-width: none;
  }
  .choose-btn{
    padding: 12px clamp(16px, 5vw, 28px);
    font-size: clamp(0.95rem, 3.8vw, 1.15rem);
  }
  .hint{
    text-align: start;
  }
}
