:root {
  --auth-cyan: #22d3ee;
  --auth-blue: #3b82f6;
  --auth-violet: #8b5cf6;
}

html {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  isolation: isolate;
  background:
    radial-gradient(circle at 12% 15%, rgba(34, 211, 238, .12), transparent 30%),
    radial-gradient(circle at 86% 78%, rgba(139, 92, 246, .14), transparent 34%),
    #050b14 !important;
}

body::before {
  transform: scale(1.035);
  filter: saturate(1) contrast(1.04) brightness(.86) !important;
  opacity: 1;
  animation: authBackdropDrift 24s ease-in-out infinite alternate;
}

body::after {
  background:
    radial-gradient(circle at 18% 16%, rgba(34, 211, 238, .12), transparent 31%),
    radial-gradient(circle at 82% 78%, rgba(139, 92, 246, .14), transparent 36%),
    linear-gradient(112deg,
      rgba(3, 10, 22, var(--overlay-opacity)) 0%,
      rgba(5, 13, 27, calc(var(--overlay-opacity) * .72)) 48%,
      rgba(10, 8, 25, var(--overlay-opacity)) 100%) !important;
}

.auth-wrapper {
  position: relative;
  isolation: isolate;
}

.auth-wrapper::before {
  content: "";
  position: absolute;
  inset: 4%;
  z-index: -1;
  pointer-events: none;
  border-radius: 42px;
  background-image:
    linear-gradient(rgba(34, 211, 238, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 211, 238, .055) 1px, transparent 1px),
    radial-gradient(circle at 50% 50%, rgba(59, 130, 246, .13), transparent 66%);
  background-size: 38px 38px, 38px 38px, 100% 100%;
  mask-image: linear-gradient(to bottom, transparent, #000 20%, #000 80%, transparent);
  opacity: .75;
}

.auth-card {
  position: relative;
  background: linear-gradient(155deg, rgba(15, 27, 47, .91), rgba(7, 13, 26, .86)) !important;
  border: 1px solid rgba(125, 211, 252, .17) !important;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .55), 0 0 0 1px rgba(139, 92, 246, .06) inset !important;
  backdrop-filter: blur(22px) saturate(130%) !important;
  -webkit-backdrop-filter: blur(22px) saturate(130%) !important;
}

.auth-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 10%;
  right: 10%;
  height: 2px;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, var(--auth-cyan), var(--auth-violet), transparent);
  box-shadow: 0 0 24px rgba(34, 211, 238, .4);
}

.auth-logo {
  filter: drop-shadow(0 12px 30px rgba(34, 211, 238, .18));
}

.auth-card .auth-logo {
  box-sizing: border-box;
  padding: 9px 15px;
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 14px;
  background: #071326 !important;
  box-shadow: 0 10px 28px rgba(2, 8, 23, .28);
}

/* Brand artwork remains stable while the form loads; no blinking or layout shifting. */
.auth-logo,
.auth-scene-brand img {
  animation: none !important;
  transition: none !important;
  backface-visibility: hidden;
  will-change: auto;
}

.form-input:focus,
.phone-input-wrap:focus-within {
  border-color: rgba(34, 211, 238, .58) !important;
  box-shadow: 0 0 0 4px rgba(34, 211, 238, .09) !important;
}

.submit-btn {
  background: linear-gradient(120deg, var(--auth-cyan), var(--auth-blue) 48%, var(--auth-violet)) !important;
  color: #fff !important;
  box-shadow: 0 14px 35px rgba(59, 130, 246, .26) !important;
}

body.light-mode {
  background: #edf5fb !important;
}

body.light-mode::after {
  background:
    radial-gradient(circle at 16% 15%, rgba(6, 182, 212, .15), transparent 34%),
    radial-gradient(circle at 84% 80%, rgba(124, 58, 237, .13), transparent 36%),
    linear-gradient(120deg, rgba(239, 246, 255, .88), rgba(248, 250, 252, .76)) !important;
}

body.light-mode .auth-card {
  background: linear-gradient(155deg, rgba(255, 255, 255, .94), rgba(241, 245, 249, .9)) !important;
  border-color: rgba(14, 116, 144, .18) !important;
}

@keyframes authBackdropDrift {
  from { transform: scale(1.035) translate3d(-.25%, -.2%, 0); }
  to { transform: scale(1.065) translate3d(.35%, .25%, 0); }
}

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
}

@media (max-width: 640px) {
  .auth-wrapper { width: calc(100% - 24px) !important; margin-left: auto !important; margin-right: auto !important; }
  .auth-wrapper::before { inset: 0; opacity: .45; }
  .auth-card { backdrop-filter: blur(16px) !important; -webkit-backdrop-filter: blur(16px) !important; }
}

/* 2026 split-screen authentication: full wallpaper + dedicated form rail. */
html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: clip !important;
}

html {
  height: 100%;
  overflow: hidden !important;
}

body.portal-auth-login,
body.portal-auth-register {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(520px, 640px);
  align-items: stretch !important;
  justify-content: stretch !important;
  min-height: 0 !important;
  height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

body.portal-auth-register {
  grid-template-columns: minmax(0, 1fr) minmax(620px, 760px);
}

body.portal-auth-login::before,
body.portal-auth-register::before {
  inset: 0 640px 0 0 !important;
  transform: none;
  filter: saturate(1.02) contrast(1.02) brightness(.96) !important;
  background-size: cover !important;
  background-position: center !important;
  animation: none !important;
  pointer-events: none;
}

body.portal-auth-register::before {
  right: 760px !important;
}

body.portal-auth-login::after,
body.portal-auth-register::after {
  inset: 0 640px 0 0 !important;
  background: linear-gradient(90deg, rgba(2, 6, 17, .04), transparent 58%, rgba(2, 6, 17, .56)), linear-gradient(0deg, rgba(2, 6, 17, .7), transparent 43%) !important;
  pointer-events: none;
}

body.portal-auth-register::after {
  right: 760px !important;
}

.auth-scene {
  position: relative;
  z-index: 3;
  grid-column: 1;
  min-width: 0;
  min-height: 0;
  height: 100dvh;
  overflow: hidden;
  pointer-events: none;
}

.auth-scene-brand {
  position: absolute;
  top: clamp(24px, 4vh, 44px);
  left: clamp(30px, 5vw, 86px);
  display: flex;
  align-items: center;
  gap: 15px;
  max-width: min(560px, calc(100% - 60px));
  padding: 12px 16px;
  border: 1px solid rgba(125, 211, 252, .24);
  border-radius: 16px;
  background: rgba(2, 8, 20, .58);
  box-shadow: 0 14px 38px rgba(0, 0, 0, .25);
  backdrop-filter: blur(8px);
}

.auth-scene-brand img {
  display: block;
  width: auto;
  max-width: 190px;
  height: 54px;
  object-fit: contain;
  flex: none;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .4));
}

.auth-scene-brand div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.auth-scene-brand strong {
  overflow: hidden;
  color: #fff;
  font-size: 17px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-scene-brand small {
  color: #a5f3fc;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.auth-scene-copy {
  position: absolute;
  left: clamp(30px, 5vw, 86px);
  right: clamp(30px, 5vw, 86px);
  bottom: clamp(30px, 6vh, 78px);
  max-width: 720px;
  color: #f8fafc;
  text-shadow: 0 10px 35px rgba(0, 0, 0, .72);
}

.auth-scene-copy span {
  display: inline-flex;
  padding: 8px 12px;
  border: 1px solid rgba(103, 232, 249, .42);
  border-radius: 999px;
  background: rgba(3, 15, 30, .55);
  color: #67e8f9;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
}

.auth-scene-copy h2 {
  margin: 17px 0 8px;
  font-size: clamp(34px, 4.4vw, 72px);
  line-height: .98;
  letter-spacing: -.045em;
}

.auth-scene-copy p {
  max-width: 610px;
  margin: 0;
  color: #d9e7f5;
  font-size: clamp(14px, 1.2vw, 18px);
  line-height: 1.65;
}

.auth-rail {
  position: relative;
  z-index: 4;
  grid-column: 2;
  min-width: 0;
  min-height: 0;
  height: 100dvh;
  max-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 72px 28px 32px;
  border-left: 1px solid rgba(125, 211, 252, .14);
  background: radial-gradient(circle at 15% 20%, rgba(34, 211, 238, .08), transparent 31%), radial-gradient(circle at 95% 70%, rgba(124, 58, 237, .15), transparent 38%), rgba(3, 7, 19, .96);
  box-shadow: -30px 0 90px rgba(0, 0, 0, .34);
  scrollbar-width: thin;
  scrollbar-color: rgba(96, 165, 250, .55) transparent;
}

.auth-rail::-webkit-scrollbar { width: 8px; }
.auth-rail::-webkit-scrollbar-track { background: transparent; }
.auth-rail::-webkit-scrollbar-thumb { background: rgba(96, 165, 250, .45); border-radius: 999px; }

.portal-auth-login .auth-rail {
  overflow-y: hidden;
  align-items: stretch;
  justify-content: stretch;
  padding: 60px 20px 18px;
}

.portal-auth-register .auth-rail {
  align-items: flex-start;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.auth-rail .top-controls {
  position: absolute;
  top: 18px;
  right: 22px;
}

.auth-rail .auth-wrapper {
  width: 100% !important;
  max-width: 500px !important;
  padding: 0 !important;
}

.portal-auth-register .auth-wrapper {
  max-width: 700px !important;
}

.portal-auth-login .auth-wrapper {
  display: flex;
  width: 100% !important;
  height: 100%;
  max-width: none !important;
}

.auth-rail .auth-card {
  width: 100%;
  padding: 34px !important;
  animation-duration: .42s;
}

.portal-auth-register .auth-card {
  padding: 30px 32px !important;
}

.portal-auth-login .auth-card {
  width: 100%;
  height: 100%;
  min-height: 0;
  justify-content: center;
  padding: clamp(24px, 4vh, 42px) clamp(30px, 4vw, 54px) !important;
  animation: authLoginReveal .32s ease-out both !important;
  transform: none !important;
}

.portal-auth-login .auth-header { margin-bottom: 18px; }
.portal-auth-login .auth-logo { max-height: 86px; margin-bottom: 12px; object-fit: contain; }
.portal-auth-login .form-group { margin-bottom: 14px; }
.portal-auth-login .remember-row { margin-bottom: 16px; }
.portal-auth-login .auth-footer { margin-top: 18px; }
.portal-auth-login .powered-by { margin-top: 16px; }

.auth-rail .auth-wrapper::before {
  inset: -18px;
}

.form-input:-webkit-autofill,
.form-input:-webkit-autofill:hover,
.form-input:-webkit-autofill:focus,
.form-input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text-main) !important;
  caret-color: var(--text-main) !important;
  -webkit-box-shadow: 0 0 0 1000px #0d1728 inset !important;
  box-shadow: 0 0 0 1000px #0d1728 inset !important;
  transition: background-color 9999s ease-out 0s;
}

.recaptcha-lock {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 54px;
  margin: 0 0 15px;
  padding: 10px 12px;
  border: 1px solid rgba(34, 211, 238, .2);
  border-radius: 13px;
  background: linear-gradient(120deg, rgba(34, 211, 238, .07), rgba(124, 58, 237, .07));
}

.recaptcha-lock-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(34, 211, 238, .1);
}

.recaptcha-lock > span:nth-child(2) {
  display: grid;
  flex: 1;
  gap: 2px;
}

.recaptcha-lock strong { font-size: 11px; }
.recaptcha-lock small { color: var(--text-muted); font-size: 9px; font-weight: 700; }
.recaptcha-lock i { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 13px rgba(52, 211, 153, .8); }
.recaptcha-lock.is-checking i { background: #fbbf24; animation: captchaPulse .8s ease-in-out infinite; }
.recaptcha-lock.is-error { border-color: rgba(251, 113, 133, .45); }
.recaptcha-lock.is-error i { background: #fb7185; box-shadow: 0 0 13px rgba(251, 113, 133, .8); }
.recaptcha-widget { margin: -5px 0 15px; overflow-x: auto; }

body.light-mode .auth-rail {
  background: rgba(242, 247, 252, .97);
  border-left-color: rgba(14, 116, 144, .18);
}

body.light-mode .form-input:-webkit-autofill {
  -webkit-text-fill-color: #0f172a !important;
  -webkit-box-shadow: 0 0 0 1000px #eef3f8 inset !important;
  box-shadow: 0 0 0 1000px #eef3f8 inset !important;
}

@keyframes authSceneFocus {
  from { background-position: 50% 50%; }
  to { background-position: 52% 50%; }
}

@keyframes captchaPulse { 50% { opacity: .35; transform: scale(.82); } }
@keyframes authLoginReveal { from { opacity: 0; } to { opacity: 1; } }

@media (min-width: 861px) and (max-height: 760px) {
  .portal-auth-login .auth-rail { padding: 46px 14px 12px; }
  .portal-auth-login .auth-card { padding: 18px 30px !important; }
  .portal-auth-login .auth-header { margin-bottom: 12px; }
  .portal-auth-login .auth-logo { max-height: 58px; margin-bottom: 8px; }
  .portal-auth-login .auth-title { font-size: 22px; margin-bottom: 4px; }
  .portal-auth-login .auth-subtitle { font-size: 13px; }
  .portal-auth-login .form-group { margin-bottom: 10px; }
  .portal-auth-login .form-label,
  .portal-auth-login .password-header { margin-bottom: 5px; }
  .portal-auth-login .form-input { padding: 11px 14px; }
  .portal-auth-login .remember-row { margin-bottom: 11px; }
  .portal-auth-login .recaptcha-lock { min-height: 44px; margin-bottom: 10px; padding: 7px 10px; }
  .portal-auth-login .recaptcha-lock-icon { width: 29px; height: 29px; }
  .portal-auth-login .submit-btn { padding: 12px; }
  .portal-auth-login .auth-footer { margin-top: 12px; }
  .portal-auth-login .powered-by { margin-top: 9px; }
  .auth-rail .top-controls { top: 10px; right: 14px; }
}

@media (max-width: 1120px) {
  body.portal-auth-login { grid-template-columns: minmax(0, 1fr) minmax(480px, 54vw); }
  body.portal-auth-register { grid-template-columns: minmax(0, 1fr) minmax(580px, 67vw); }
  body.portal-auth-login::before,
  body.portal-auth-login::after { right: max(480px, 54vw) !important; }
  body.portal-auth-register::before,
  body.portal-auth-register::after { right: max(580px, 67vw) !important; }
}

@media (max-width: 860px) {
  body.portal-auth-login,
  body.portal-auth-register { display: block !important; height: 100dvh !important; min-height: 0 !important; overflow: hidden !important; }
  body.portal-auth-login::before,
  body.portal-auth-register::before,
  body.portal-auth-login::after,
  body.portal-auth-register::after { inset: 0 !important; }
  .auth-scene { display: none; }
  .auth-rail {
    height: 100dvh;
    min-height: 100dvh;
    max-height: 100dvh;
    overflow-y: auto;
    padding: 76px 18px 30px;
    border-left: 0;
    background: rgba(3, 7, 19, .76);
    backdrop-filter: blur(9px);
  }
  .auth-rail .auth-card { padding: 28px 24px !important; }
  .portal-auth-login .auth-rail { overflow-y: auto; }
}

@media (prefers-reduced-motion: reduce) {
  body.portal-auth-login::before,
  body.portal-auth-register::before,
  .recaptcha-lock.is-checking i { animation: none !important; }
}
