.portal-auth {
  --portal-bg-start: #060b16;
  --portal-bg-end: #071120;
  --portal-panel-shadow: rgba(13, 23, 44, 0.38);
  --portal-border: rgba(209, 220, 235, 0.92);
  --portal-text: #374151;
  --portal-text-strong: #1f2937;
  --portal-muted: #6b7280;
  --portal-input-bg: #dce6f5;
  --portal-input-border: #d4dde9;
  --portal-button-start: #050813;
  --portal-button-mid: #11437b;
  --portal-button-end: #050813;
  position: relative;
  min-height: 100vh;
  padding: 1.5rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(30, 111, 205, 0.85), transparent 34%),
    radial-gradient(circle at 14% 16%, rgba(28, 53, 115, 0.4), transparent 22%),
    radial-gradient(circle at 84% 80%, rgba(15, 34, 71, 0.4), transparent 25%),
    linear-gradient(135deg, var(--portal-bg-start) 0%, #08101d 48%, var(--portal-bg-end) 100%);
}

.portal-auth__glow {
  position: absolute;
  border-radius: 999px;
  filter: blur(90px);
  opacity: 0.35;
  pointer-events: none;
}

.portal-auth__glow--top {
  top: 24px;
  left: 50%;
  width: 360px;
  height: 140px;
  transform: translateX(-50%);
  background: rgba(36, 135, 255, 0.7);
}

.portal-auth__glow--bottom {
  right: 12%;
  bottom: 4%;
  width: 260px;
  height: 140px;
  background: rgba(27, 58, 128, 0.45);
}

.portal-auth__frame {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .75rem;
  background: #fffffff0;
  border-radius: 15px;
  width: 1280px;
  box-shadow: #32325d40 0 50px 100px -20px, #0000004d 0 30px 60px -30px, #0a254059 0 -2px 6px inset;
}

.portal-auth__shell {
  width: 100%;
  min-height: 700px;
  display: grid;
  grid-template-columns: minmax(380px, 1.06fr) minmax(420px, 1fr);
  background: #fff;
  box-shadow:
    0 28px 70px var(--portal-panel-shadow),
    inset 0 0 0 2px rgba(247, 250, 253, 0.9),
    inset 0 2px 28px rgba(116, 135, 163, 0.16);
  overflow: hidden;
}

.portal-auth__brand,
.portal-auth__content {
  padding: 28px;
}

.portal-auth__brand {
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.portal-auth__brand-panel {
  flex: 1;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.portal-auth__brand-inner {
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}


.portal-auth__wordmark {
  width: 100%;
  object-fit: contain;
}

.portal-auth__brand-copy {
  position: relative;
  width: min(420px, 92%);
  padding-top: 20px;
  color: #6d7380;
}

.portal-auth__brand-copy::before,
.portal-auth__brand-copy::after {
  content: "";
  position: absolute;
  top: 0;
  width: 34%;
  height: 1px;
  background: linear-gradient(90deg, rgba(150, 160, 176, 0), rgba(150, 160, 176, 0.7));
}

.portal-auth__brand-copy::after {
  right: 0;
  transform: scaleX(-1);
}

.portal-auth__brand-copy::before {
  left: 0;
}

.portal-auth__brand-copy p {
  margin: 0;
  font-size: clamp(1.02rem, 1vw + 0.8rem, 1.1rem);
  letter-spacing: 0.02em;
}

.portal-auth__brand-copy p+p {
  margin-top: 8px;
}

.portal-auth__content {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 50px;
}

.portal-auth__content-inner {
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.portal-auth__header-action {
  min-height: 28px;
}

.portal-auth__header {
  text-align: center;
}

.portal-auth__header h1 {
  margin: 0;
  color: var(--portal-text);
  font-size: clamp(2rem, 3vw, 1.75rem);
  font-weight: 500;
  letter-spacing: -0.035em;
}

.portal-auth__header p {
  margin: 8px 0 0;
  color: var(--portal-muted);
  font-size: clamp(1rem, 0.94rem + 0.18vw, 1.2rem);
}

.portal-auth__body {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.portal-auth__alert {
  margin: 0;
  border-radius: 16px;
  border: 1px solid rgba(220, 38, 38, 0.16);
}

.portal-auth__alert--info {
  border-color: rgba(59, 130, 246, 0.16);
}

.portal-auth__form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.portal-auth__field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.portal-auth__field label,
.portal-auth__row-label {
  color: var(--portal-text-strong);
  font-size: 1.05rem;
  font-weight: 500;
}

.portal-auth__input-wrap {
  position: relative;
}

.portal-auth__input,
.portal-auth__otp-box {
  border-radius: 5px;
  border: 1px solid var(--portal-input-border);
  background: linear-gradient(180deg, rgba(226, 234, 246, 0.96), rgba(215, 226, 242, 0.94));
  color: #111827;
  min-height: 64px;
  padding: 18px 18px;
  font-size: 1rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.portal-auth__input::placeholder {
  color: #98a6bd;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.portal-auth__input:focus,
.portal-auth__otp-box:focus {
  border-color: #0f4b8e;
  box-shadow:
    0 0 0 4px rgba(15, 75, 142, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.74);
  background: linear-gradient(180deg, rgba(232, 239, 249, 0.98), rgba(219, 230, 245, 0.98));
}

.portal-auth__input.is-invalid,
.portal-auth__otp-box.is-invalid {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.portal-auth__password-toggle {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #667085;
}

.portal-auth__password-toggle:hover {
  background: rgba(15, 75, 142, 0.08);
  color: #0f4b8e;
}

.portal-auth__feedback {
  display: block;
  margin-top: 2px;
  color: #dc2626;
  font-size: 0.88rem;
}

.portal-auth__link-row {
  display: flex;
  justify-content: flex-end;
  margin-top: -2px;
}

.portal-auth__text-link,
.portal-auth__inline-link,
.portal-auth__back-button {
  color: #8a8f98;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  transition: color 0.18s ease;
}

.portal-auth__text-link:hover,
.portal-auth__inline-link:hover,
.portal-auth__back-button:hover {
  color: #0f4b8e;
}

.portal-auth__submit {
  min-height: 64px;
  border: 0;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--portal-button-start) 0%, var(--portal-button-mid) 52%, var(--portal-button-end) 100%);
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow:
    0 18px 24px rgba(5, 12, 24, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.portal-auth__submit:hover,
.portal-auth__submit:focus {
  background: linear-gradient(90deg, #06101f 0%, #16579d 50%, #06101f 100%);
}

.portal-auth__submit:disabled {
  opacity: 0.72;
}

.portal-auth__footer {
  color: var(--portal-text);
  text-align: center;
  font-size: 1.03rem;
}

.portal-auth__otp-intro {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.portal-auth__otp-chip {
  align-self: flex-start;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(17, 66, 121, 0.08);
  color: #114279;
  font-size: 0.94rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.portal-auth__otp-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.portal-auth__otp-box {
  min-height: 72px;
  padding: 0;
  text-align: center;
  font-size: 1.8rem;
  font-weight: 600;
}

.portal-auth__otp-status {
  color: var(--portal-muted);
  font-size: 0.95rem;
  text-align: center;
}

.portal-auth__otp-status--danger {
  color: #dc2626;
}

.portal-auth__resend {
  text-align: center;
  color: var(--portal-muted);
  font-size: 0.95rem;
}

.portal-auth__resend-button {
  border: 0;
  background: transparent;
  color: #114279;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.portal-auth__resend-button:disabled {
  color: #94a3b8;
  text-decoration: none;
}

.portal-auth__back-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 0.98rem;
}

.portal-auth__back-button i {
  font-size: 1.2rem;
}

.portal-auth__success {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 82px;
  height: 82px;
  margin: 0 auto;
  border-radius: 50%;
  background: linear-gradient(180deg, #1ecb68, #0f9f4a);
  color: #fff;
  font-size: 2rem;
  box-shadow: 0 16px 24px rgba(16, 185, 129, 0.22);
}

@media (max-width: 1180px) {
  .portal-auth__shell {
    min-height: unset;
    grid-template-columns: 1fr;
  }

  .portal-auth__brand,
  .portal-auth__content {
    padding: 22px;
  }

  .portal-auth__brand-panel {
    min-height: 320px;
  }

  .portal-auth__wordmark {
    width: min(420px, 88%);
  }
}

@media (max-width: 768px) {
  .portal-auth {
    padding: 22px 14px;
  }

  .portal-auth__shell {
    border-radius: 22px;
  }

  .portal-auth__brand-panel {
    min-height: 260px;
  }

  .portal-auth__brand-copy::before,
  .portal-auth__brand-copy::after {
    width: 24%;
  }

  .portal-auth__content {
    margin: 0;
  }

  .portal-auth__content-inner {
    gap: 22px;
  }

  .portal-auth__otp-grid {
    gap: 10px;
  }

  .portal-auth__otp-box {
    min-height: 64px;
    font-size: 1.55rem;
  }
}

@media (max-width: 520px) {

  .portal-auth__brand,
  .portal-auth__content {
    padding: 16px;
  }

  .portal-auth__content {
    margin: 0;
  }

  .portal-auth__brand-panel {
    min-height: 224px;
  }

  .portal-auth__hero-mark {
    width: min(168px, 50%);
  }

  .portal-auth__header {
    display: none!important;
  }

  .portal-auth__header h1 {
    font-size: 1.9rem;
  }

  .portal-auth__otp-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
/* Fit the source portal inside the PHP document shell. */
.auth-shell:has(> .portal-auth) { display: block; padding: 0; }
.auth-shell > .portal-auth { width: 100%; }
.auth-shell:has(> .portal-auth) > .alert { margin: 0; border-radius: 0; }

/* Keep portal controls isolated from the dashboard form theme. */
.portal-auth--login {font-family:Arial,sans-serif;letter-spacing:normal;}
.portal-auth--login .portal-auth__input::placeholder {color:#c8c8c8!important;}
.portal-auth--login .portal-auth__submit {background:linear-gradient(135deg,#0f172a,#1f3a5f);color:white;}
.portal-auth--login .portal-auth__field label {font-weight:400;letter-spacing:.05em;}
.portal-auth--login .portal-auth__content-inner {padding-bottom:43px;}

.portal-auth--recovery {font-family:Arial,sans-serif;letter-spacing:normal;}
.portal-auth--recovery .portal-auth__field label {font-weight:400;letter-spacing:.05em;}
.portal-auth--recovery .portal-auth__input::placeholder {color:#c8c8c8!important;}
.portal-auth--recovery .portal-auth__submit {background:linear-gradient(135deg,#0f172a,#1f3a5f);color:#fff;}

@media (min-width:992px) { .portal-auth--recovery .portal-auth__frame {transform:translateY(-8px);} }
