:root {
  --login-primary: #267c4b;
  --login-primary-dark: #1f673e;
  --login-text: #284c41;
  --login-muted: #7c8792;
  --login-border: #d6dde1;
  --login-surface: rgba(255, 255, 255, 0.84);
}

* {
  box-sizing: border-box;
}

[x-cloak] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body.portal-login-page {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--login-text);
  background-color: #f5faf6;
  background-image: url("../background/portal-background-01.webp");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
}

.portal-login-background {
  position: fixed;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background: #f5faf6 url("../background/portal-background-01.webp") center / cover no-repeat;
}

.portal-login-background::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0;
  background: linear-gradient(135deg, rgba(247, 251, 248, 0.08), rgba(237, 247, 241, 0.03));
}

.portal-login-background__slide {
  position: absolute;
  z-index: 1;
  inset: -1.5%;
  opacity: 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  transform: scale(1.025);
  transition: opacity 1.25s ease-in-out, transform 3.2s ease-out;
  will-change: opacity, transform;
}

.portal-login-background__slide.is-active {
  opacity: 1;
  transform: scale(1);
}

.portal-login-background__slide--01 {
  background-image: url("../background/portal-background-01.webp");
}

.portal-login-background__slide--02 {
  background-image: url("../background/portal-background-02.webp");
}

.portal-login-background__slide--03 {
  background-image: url("../background/portal-background-03.webp");
}

.portal-login-background__slide--04 {
  background-image: url("../background/portal-background-04.webp");
}

.portal-login-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 42px 20px;
}

.portal-login-card {
  width: min(100%, 480px);
  padding: 28px 36px 24px;
  background: var(--login-surface);
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: 20px;
  box-shadow: 0 18px 46px rgba(34, 83, 61, 0.18);
  backdrop-filter: blur(14px) saturate(112%);
  -webkit-backdrop-filter: blur(14px) saturate(112%);
}

.portal-login-card.is-entering {
  transform-origin: center;
  animation: portal-login-card-enter 650ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.portal-login-card.is-entering .portal-login-logo {
  animation: portal-login-logo-enter 620ms cubic-bezier(0.22, 1, 0.36, 1) 120ms both;
}

.portal-login-card.is-entering .portal-login-title {
  animation: portal-login-item-enter 480ms ease-out 220ms both;
}

.portal-login-card.is-entering .portal-login-subtitle {
  animation: portal-login-item-enter 480ms ease-out 280ms both;
}

.portal-login-card.is-entering .portal-login-alert {
  animation: portal-login-item-enter 480ms ease-out 320ms both;
}

.portal-login-card.is-entering .portal-login-field:nth-of-type(1) {
  animation: portal-login-item-enter 500ms ease-out 340ms both;
}

.portal-login-card.is-entering .portal-login-field:nth-of-type(2) {
  animation: portal-login-item-enter 500ms ease-out 410ms both;
}

.portal-login-card.is-entering .portal-login-options {
  animation: portal-login-item-enter 500ms ease-out 480ms both;
}

.portal-login-card.is-entering .portal-login-submit {
  animation: portal-login-item-enter 500ms ease-out 550ms both;
}

.portal-login-card.is-entering .portal-login-security {
  animation: portal-login-item-enter 500ms ease-out 630ms both;
}

.portal-login-brand {
  margin-bottom: 18px;
  text-align: center;
}

.portal-login-logo {
  display: block;
  width: 270px;
  max-width: 86%;
  height: auto;
  margin: 0 auto;
}

.portal-login-title {
  margin: 14px 0 4px;
  color: #24714a;
  font-size: 1.35rem;
  font-weight: 500 !important;
  line-height: 1.5;
}

.portal-login-subtitle {
  margin: 0;
  color: var(--login-muted);
  font-size: 1rem;
  line-height: 1.7;
}

.portal-login-alert {
  margin: 0 0 18px;
  padding: 11px 14px;
  border: 1px solid #efc4c4;
  border-radius: 9px;
  color: #a33c3c;
  background: #fff4f4;
  font-size: 0.92rem;
  line-height: 1.6;
}

.portal-login-form {
  margin: 0;
}

.portal-login-field {
  margin-bottom: 14px;
}

.portal-login-label {
  display: block;
  margin-bottom: 8px;
  color: var(--login-text);
  font-size: 1rem;
  font-weight: 400 !important;
}

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

.portal-field-icon {
  position: absolute;
  z-index: 1;
  top: 50%;
  right: 17px;
  color: var(--login-primary);
  font-size: 1.55rem;
  transform: translateY(-50%);
  pointer-events: none;
}

.portal-login-control {
  width: 100%;
  height: 52px;
  padding: 0 52px;
  border: 1px solid var(--login-border);
  border-radius: 9px;
  outline: none;
  color: #344b44;
  background: rgba(255, 255, 255, 0.8);
  font-size: 1rem;
  font-weight: 400 !important;
  text-align: right;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.portal-login-control::placeholder {
  color: #9aa3ad;
  opacity: 1;
}

.portal-input-wrap:focus-within .portal-login-control {
  border-color: var(--login-primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(38, 124, 75, 0.1);
}

.portal-password-toggle {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 10px;
  display: inline-grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #818b95;
  background: transparent;
  cursor: pointer;
  transform: translateY(-50%);
  transition: color 160ms ease, background-color 160ms ease;
}

.portal-password-toggle:hover,
.portal-password-toggle:focus-visible {
  color: var(--login-primary);
  background: rgba(38, 124, 75, 0.08);
  outline: none;
}

.portal-password-toggle .bx {
  font-size: 1.45rem;
}

.portal-login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 2px 0 18px;
  color: var(--login-text);
  font-size: 0.95rem;
}

.portal-remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.portal-remember input {
  position: relative;
  width: 36px;
  height: 20px;
  flex: 0 0 36px;
  margin: 0;
  appearance: none;
  border: 1px solid #cbd5d0;
  border-radius: 999px;
  outline: none;
  background: #e7ece9;
  cursor: pointer;
  transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.portal-remember input::before {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(31, 73, 54, 0.24);
  transition: transform 180ms ease;
}

.portal-remember input:checked {
  border-color: var(--login-primary);
  background: var(--login-primary);
}

.portal-remember input:checked::before {
  transform: translateX(-16px);
}

.portal-remember input:focus-visible {
  box-shadow: 0 0 0 3px rgba(38, 124, 75, 0.16);
}

.portal-remember span {
  font-size: 0.88rem;
}

.portal-forgot-password,
.portal-forgot-password:hover {
  color: var(--login-primary);
  text-decoration: none;
}

.portal-forgot-password.is-disabled {
  color: #9aa3ad;
  cursor: not-allowed;
  opacity: 0.75;
  user-select: none;
}

.portal-login-submit {
  width: 100%;
  min-height: 52px;
  padding: 12px 20px;
  border: 0;
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(135deg, #2b8652 0%, #237346 100%);
  box-shadow: 0 8px 16px rgba(35, 115, 70, 0.2);
  font-size: 1.08rem;
  font-weight: 500 !important;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.portal-login-submit:hover {
  background: linear-gradient(135deg, #267d4c 0%, #1f673e 100%);
  box-shadow: 0 10px 20px rgba(35, 115, 70, 0.25);
  transform: translateY(-1px);
}

.portal-login-submit:active {
  transform: translateY(0);
}

.portal-login-submit:focus-visible {
  outline: 3px solid rgba(38, 124, 75, 0.24);
  outline-offset: 3px;
}

.portal-login-submit:disabled {
  cursor: wait;
  opacity: 0.9;
  box-shadow: 0 5px 12px rgba(35, 115, 70, 0.16);
  transform: none;
}

.portal-login-submit-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.portal-login-spinner {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: #fff;
  border-radius: 50%;
  animation: portal-login-spin 700ms linear infinite;
}

.portal-login-form.is-submitting .portal-login-control {
  color: #718079;
  background-color: #f7f9f8;
}

.portal-login-form.is-submitting .portal-password-toggle {
  cursor: wait;
  opacity: 0.55;
}

.portal-login-security {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #edf0ee;
  color: #8b949d;
  font-size: 0.88rem;
  line-height: 1.6;
  text-align: center;
}

.portal-login-security .bx {
  color: #69a985;
  font-size: 1.55rem;
}

@media (max-width: 640px) {
  .portal-login-shell {
    padding: 20px 14px;
  }

  .portal-login-card {
    padding: 28px 22px 24px;
    border-radius: 20px;
  }

  .portal-login-logo {
    width: 220px;
  }

  .portal-login-title {
    margin-top: 12px;
    font-size: 1.25rem;
  }

  .portal-login-subtitle {
    font-size: 0.93rem;
  }

  .portal-login-control,
  .portal-login-submit {
    min-height: 52px;
    height: 52px;
  }

  .portal-login-options {
    gap: 12px;
    font-size: 0.9rem;
  }

  .portal-login-security {
    margin-top: 22px;
    padding-top: 17px;
    font-size: 0.82rem;
  }
}

@media (max-height: 850px) and (min-width: 641px) {
  .portal-login-shell {
    align-items: center;
    padding-block: 24px;
  }

  .portal-login-card {
    padding-block: 26px 22px;
  }

  .portal-login-logo {
    width: 205px;
  }

  .portal-login-brand {
    margin-bottom: 16px;
  }

  .portal-login-title {
    margin-top: 12px;
  }

  .portal-login-field {
    margin-bottom: 14px;
  }

  .portal-login-security {
    margin-top: 20px;
    padding-top: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }

  .portal-login-spinner {
    animation-duration: 1.4s !important;
  }

  .portal-login-card.is-entering,
  .portal-login-card.is-entering .portal-login-logo,
  .portal-login-card.is-entering .portal-login-title,
  .portal-login-card.is-entering .portal-login-subtitle,
  .portal-login-card.is-entering .portal-login-alert,
  .portal-login-card.is-entering .portal-login-field,
  .portal-login-card.is-entering .portal-login-options,
  .portal-login-card.is-entering .portal-login-submit,
  .portal-login-card.is-entering .portal-login-security {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }

  .portal-login-background__slide {
    transform: none !important;
    transition: none !important;
  }
}

@keyframes portal-login-card-enter {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.965);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes portal-login-logo-enter {
  from {
    opacity: 0;
    transform: translateY(-14px) scale(0.94);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes portal-login-item-enter {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes portal-login-spin {
  to {
    transform: rotate(360deg);
  }
}
