:root {
  --bg-main: #040816;
  --bg-accent: #0a1530;
  --bg-card: rgba(9, 16, 33, 0.78);
  --ink: #eef4ff;
  --muted: #94a6c9;
  --line: rgba(143, 167, 255, 0.18);
  --primary: #7a8cff;
  --primary-dark: #5e6ef3;
  --secondary: #79f0ff;
  --glow-pink: #ff7ad9;
  --shadow: 0 32px 90px rgba(1, 4, 16, 0.58);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: 'IBM Plex Sans Thai', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 18%, rgba(122, 140, 255, 0.2), transparent 24%),
    radial-gradient(circle at 84% 22%, rgba(255, 122, 217, 0.14), transparent 20%),
    radial-gradient(circle at 50% 100%, rgba(121, 240, 255, 0.12), transparent 28%),
    linear-gradient(165deg, #030611 0%, #081024 42%, #050814 100%);
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.9) 0 1px, transparent 1.8px),
    radial-gradient(circle at 78% 26%, rgba(255, 255, 255, 0.8) 0 1px, transparent 1.8px),
    radial-gradient(circle at 42% 70%, rgba(255, 255, 255, 0.7) 0 1px, transparent 1.8px),
    radial-gradient(circle at 65% 58%, rgba(255, 255, 255, 0.78) 0 1px, transparent 1.8px),
    linear-gradient(rgba(122, 140, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(122, 140, 255, 0.04) 1px, transparent 1px);
  background-size: auto, auto, auto, auto, 42px 42px, 42px 42px;
  mask-image: radial-gradient(circle at center, black 42%, transparent 92%);
  pointer-events: none;
  opacity: 0.8;
}

.login-shell {
  min-height: 100dvh;
  height: auto;
  display: grid;
  grid-template-columns: 1fr;
  padding: clamp(12px, 2vw, 24px);
  gap: clamp(12px, 1.8vw, 20px);
  align-items: stretch;
}

.login-shell-single {
  grid-template-columns: 1fr;
}

.brand-panel,
.auth-panel {
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  min-height: 0;
  border: 1px solid rgba(141, 160, 255, 0.16);
}

.brand-panel {
  display: none;
  position: relative;
  background:
    linear-gradient(155deg, rgba(1, 8, 16, 0.8), rgba(3, 12, 24, 0.78)),
    url('../img/lll-smart-bg.jpg') center center / cover no-repeat;
  color: #fff;
  min-height: 0;
}

.brand-panel-static .brand-scene::before,
.brand-panel-static .brand-scene::after,
.brand-panel-static .brand-orb,
.brand-panel-static .brand-ring,
.brand-panel-static .brand-flow {
  animation-duration: 0s;
}

.brand-panel::before,
.brand-panel::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: rgba(122, 140, 255, 0.08);
}

.brand-panel::before {
  width: 440px;
  height: 440px;
  top: -120px;
  right: -120px;
  background: radial-gradient(circle, rgba(121, 240, 255, 0.06), transparent 70%);
}

.brand-panel::after {
  width: 360px;
  height: 360px;
  bottom: -120px;
  left: -120px;
  background: radial-gradient(circle, rgba(255, 214, 102, 0.06), transparent 72%);
}

.brand-panel::marker {
  display: none;
}

.brand-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  padding: clamp(22px, 2.4vw, 32px);
}

.brand-top {
  display: grid;
  gap: 12px;
  width: min(100%, 860px);
  margin: 0 auto 0 0;
}

.brand-scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  perspective: 1200px;
}

.brand-scene::before {
  content: "";
  position: absolute;
  inset: 0;
  height: 100%;
  background:
    radial-gradient(circle at 50% 46%, rgba(121, 240, 255, 0.18), transparent 12%),
    radial-gradient(circle at 50% 46%, rgba(255, 214, 102, 0.14), transparent 24%),
    linear-gradient(rgba(28, 202, 230, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(28, 202, 230, 0.04) 1px, transparent 1px);
  background-size: auto, auto, 44px 44px, 44px 44px;
  animation: gridFloat 12s linear infinite;
  opacity: 0.48;
  mask-image: radial-gradient(circle at 50% 46%, black 36%, transparent 94%);
}

.brand-scene::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 46%, rgba(121, 240, 255, 0.22), transparent 6%),
    radial-gradient(circle at 50% 46%, rgba(255, 214, 102, 0.12), transparent 11%);
  filter: blur(0.2px);
  opacity: 0.34;
}

.brand-orb,
.brand-ring,
.brand-flow {
  position: absolute;
  pointer-events: none;
}

.brand-orb {
  width: 520px;
  height: 520px;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(121, 240, 255, 0.12), rgba(121, 240, 255, 0.04) 36%, transparent 66%);
  filter: blur(14px);
  animation: orbFloat 8s ease-in-out infinite;
  opacity: 0.46;
}

.brand-ring {
  width: 560px;
  height: 560px;
  top: 8%;
  left: 50%;
  border-radius: 50%;
  border: 1px solid rgba(73, 233, 255, 0.1);
  box-shadow: 0 0 32px rgba(121, 240, 255, 0.04), inset 0 0 32px rgba(121, 240, 255, 0.02);
  transform: translateX(-50%) rotateX(74deg) rotateZ(0deg);
  animation: ringSpin 18s linear infinite;
}

.brand-flow {
  inset: 0;
  opacity: 0.38;
  mix-blend-mode: screen;
}

.brand-flow::before,
.brand-flow::after {
  content: "";
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  pointer-events: none;
}

.brand-flow::before {
  background-image:
    radial-gradient(circle at 18% 56%, rgba(121, 240, 255, 0.95) 0 2px, transparent 8px),
    radial-gradient(circle at 34% 48%, rgba(121, 240, 255, 0.9) 0 2px, transparent 8px),
    radial-gradient(circle at 48% 46%, rgba(121, 240, 255, 0.95) 0 2px, transparent 8px),
    radial-gradient(circle at 66% 40%, rgba(121, 240, 255, 0.9) 0 2px, transparent 8px),
    radial-gradient(circle at 82% 32%, rgba(121, 240, 255, 0.9) 0 2px, transparent 8px);
  filter: blur(0.5px);
  animation: flowPulseA 9s linear infinite;
}

.brand-flow::after {
  background-image:
    radial-gradient(circle at 24% 30%, rgba(255, 214, 102, 0.88) 0 2px, transparent 8px),
    radial-gradient(circle at 42% 38%, rgba(255, 214, 102, 0.84) 0 2px, transparent 8px),
    radial-gradient(circle at 58% 54%, rgba(255, 214, 102, 0.84) 0 2px, transparent 8px),
    radial-gradient(circle at 74% 62%, rgba(255, 214, 102, 0.88) 0 2px, transparent 8px);
  filter: blur(0.4px);
  animation: flowPulseB 12s linear infinite;
  opacity: 0.76;
}

.brand-intro {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.brand-intro-title {
  margin: 0;
  font-size: clamp(2rem, 4.6vw, 4rem);
  line-height: 1.02;
  font-weight: 700;
  color: #f1fbff;
  letter-spacing: -0.03em;
  max-width: 16ch;
  text-wrap: balance;
  text-shadow: 0 12px 34px rgba(0, 0, 0, 0.56);
}

.brand-intro-copy {
  margin: 0;
  max-width: 80ch;
  color: rgba(212, 223, 255, 0.84);
  font-size: 1rem;
  line-height: 1.75;
  text-shadow: 0 8px 26px rgba(0, 0, 0, 0.5);
}

.auth-panel {
  background: var(--bg-card);
  min-height: 0;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(122, 140, 255, 0.65) rgba(5, 11, 25, 0.35);
}

.auth-panel::-webkit-scrollbar {
  width: 9px;
}

.auth-panel::-webkit-scrollbar-track {
  background: rgba(5, 11, 25, 0.35);
}

.auth-panel::-webkit-scrollbar-thumb {
  background: rgba(122, 140, 255, 0.65);
  border: 2px solid rgba(5, 11, 25, 0.35);
  border-radius: 999px;
}

.auth-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top right, rgba(39, 211, 255, 0.12), transparent 26%),
    radial-gradient(circle at top left, rgba(255, 122, 217, 0.06), transparent 22%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 26%);
  pointer-events: none;
}

.auth-body {
  height: auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: clamp(18px, 2.2vw, 34px);
  position: relative;
  z-index: 1;
}

.auth-header {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.auth-subtitle {
  margin: 4px 0 0;
  max-width: 42ch;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.65;
}

.logo-wrap {
  width: 128px;
  height: auto;
  display: block;
  line-height: 0;
  margin: 0 auto -8px;
}

.logo-wrap img {
  width: 128px;
  height: auto;
  display: block;
}

.beta-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.7rem;
  border: 1px solid #f59e0b;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 6px;
  font-family: 'IBM Plex Sans Thai', sans-serif;
  font-weight: 700;
  font-size: clamp(1.6rem, 4vw, 2.35rem);
  line-height: 1.04;
  letter-spacing: -0.04em;
  text-align: center;
}

.lead {
  margin: 0 0 14px;
  color: #9db7c7;
  line-height: 1.55;
  font-size: 0.92rem;
}

.form-card {
  width: 100%;
  max-width: 560px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(10, 18, 38, 0.72), rgba(7, 14, 30, 0.62));
  border: 1px solid rgba(141, 160, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 16px 36px rgba(0, 0, 0, 0.24);
}

.field {
  margin-bottom: 12px;
}

.field-grid {
  display: grid;
  gap: 14px;
}

.field label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #e9f7ff;
}

.field small {
  color: #86a8be;
  font-weight: 500;
}

.field-helper {
  margin-top: 8px;
  color: #8eabba;
  font-size: 0.82rem;
  line-height: 1.5;
}

.field-helper-success {
  color: #72dfb1;
}

.consent-list {
  display: grid;
  gap: 10px;
  margin: 4px 0 16px;
}

.consent-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #c7d8e5;
  font-size: 0.84rem;
  line-height: 1.5;
  cursor: pointer;
}

.consent-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex: 0 0 auto;
  accent-color: #6f7dff;
}

.consent-item strong {
  color: #72dfb1;
}

.consent-item small {
  color: #86a8be;
}

.input-wrap {
  position: relative;
  display: grid;
  gap: 8px;
}

.input-wrap i {
  position: absolute;
  top: 26px;
  left: 16px;
  transform: translateY(-50%);
  color: #98abff;
  pointer-events: none;
  z-index: 1;
}

.form-control-modern {
  width: 100%;
  min-height: 52px;
  border: 1px solid rgba(141, 160, 255, 0.18);
  border-radius: 18px;
  padding: 0 16px 0 46px;
  background: rgba(5, 11, 25, 0.82);
  color: #f1fbff;
  font-size: 0.97rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.form-control-modern::placeholder {
  color: #7283aa;
}

.form-control-modern:focus {
  outline: none;
  border-color: rgba(122, 140, 255, 0.65);
  box-shadow: 0 0 0 4px rgba(122, 140, 255, 0.14), 0 0 26px rgba(255, 122, 217, 0.08);
  transform: translateY(-1px);
}

.form-control-modern[disabled] {
  opacity: 0.72;
  cursor: not-allowed;
}

.form-control-modern.is-invalid {
  border-color: rgba(255, 143, 143, 0.45);
  box-shadow: 0 0 0 4px rgba(255, 143, 143, 0.08);
}

.form-control-modern.is-valid {
  border-color: rgba(114, 223, 177, 0.4);
  box-shadow: 0 0 0 4px rgba(114, 223, 177, 0.08);
}

.validation-feedback {
  display: none;
  margin-top: 8px;
  font-size: 0.84rem;
  font-weight: 600;
}

.validation-feedback.invalid-feedback {
  color: #ff8f8f;
}

.validation-feedback.valid-feedback {
  color: #72dfb1;
}

.form-control-modern.is-invalid ~ .validation-feedback.invalid-feedback {
  display: block;
}

.form-control-modern.is-valid ~ .validation-feedback.valid-feedback {
  display: block;
}

.password-toggle {
  position: absolute;
  top: 26px;
  right: 10px;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #aeb9ff;
  cursor: pointer;
}

.password-toggle:hover {
  background: rgba(122, 140, 255, 0.08);
  color: #eef2ff;
}

.row-inline {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 8px 0 14px;
}

.remember-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #9cb8cc;
  font-size: 0.9rem;
  line-height: 1.45;
}

.remember-box input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--primary);
  flex: 0 0 auto;
}

.remember-box strong {
  display: block;
  color: #eafaff;
  font-size: 0.95rem;
}

.link-inline {
  color: #9bb8ff;
  text-decoration: none;
  font-weight: 700;
}

.link-inline:hover {
  color: #eef2ff;
  text-decoration: none;
}

.btn-main,
.btn-alt {
  width: 100%;
  border: 0;
  border-radius: 18px;
  min-height: 52px;
  padding: 12px 18px;
  font-size: 0.96rem;
  font-weight: 800;
  font-family: 'IBM Plex Sans Thai', sans-serif;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-main {
  color: #03111a;
  background: linear-gradient(135deg, #c7d0ff 0%, var(--primary) 52%, var(--glow-pink) 100%);
  box-shadow: 0 18px 34px rgba(94, 110, 243, 0.34);
}

.btn-alt {
  color: #e8fbff;
  background: rgba(8, 16, 33, 0.76);
  border: 1px solid rgba(141, 160, 255, 0.16);
}

.btn-main:hover,
.btn-alt:hover {
  color: inherit;
  text-decoration: none;
  transform: translateY(-1px);
  filter: saturate(1.03);
}

.btn-main:focus,
.btn-alt:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(122, 140, 255, 0.16);
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
  color: #84a5ba;
  font-size: 0.84rem;
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.bottom-links {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.bottom-links-stack {
  margin-top: 18px;
}

.bottom-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  text-decoration: none;
  color: var(--ink);
  background: rgba(8, 16, 33, 0.68);
  border: 1px solid rgba(141, 160, 255, 0.14);
}

.bottom-link:hover {
  text-decoration: none;
  color: #d8fbff;
  border-color: rgba(122, 140, 255, 0.3);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(114, 223, 177, 0.12);
  color: #72dfb1;
  font-size: 0.78rem;
  font-weight: 600;
}

.idcard-verified-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.idcard-verified-actions .status-chip {
  margin: 0;
}

.idcard-verified-actions .link-inline {
  font-size: 0.84rem;
}

.inline-message {
  display: block;
  margin-top: 8px;
  color: #ff8f8f;
  font-size: 0.82rem;
  font-weight: 600;
}

.bottom-link span {
  color: #8eabba;
  font-size: 0.9rem;
}

.note {
  margin-top: 12px;
  color: #7ea0b4;
  font-size: 0.82rem;
  line-height: 1.5;
}

.note-center {
  text-align: center;
}

.alert-panel {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 143, 143, 0.28);
  background: rgba(90, 18, 34, 0.18);
  color: #ffd4d4;
  font-size: 0.92rem;
  line-height: 1.6;
}

.alert-panel strong {
  color: #fff2f2;
}

.alert-panel-error {
  border-color: rgba(255, 143, 143, 0.28);
  background: rgba(90, 18, 34, 0.18);
}

.password-strength {
  height: 5px;
  margin-top: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.strength-weak {
  background: #dc3545;
}

.strength-medium {
  background: #ffc107;
}

.strength-strong {
  background: #28a745;
}

.auth-illustration {
  display: none;
  position: relative;
  margin: 0 0 14px;
  padding: 14px;
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(122, 140, 255, 0.16), transparent 45%),
    linear-gradient(135deg, rgba(14, 20, 46, 0.9), rgba(9, 20, 43, 0.82));
  border: 1px solid rgba(141, 160, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.auth-illustration-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  align-items: end;
  gap: 12px;
}

.auth-illustration-copy strong {
  display: block;
  margin-bottom: 6px;
  font-family: 'IBM Plex Sans Thai', sans-serif;
  font-weight: 700;
  font-size: 1rem;
}

.auth-illustration-copy span {
  display: block;
  color: #91aec0;
  font-size: 0.84rem;
  line-height: 1.5;
}

.auth-illustration img {
  width: 100%;
  max-width: 180px;
  justify-self: end;
  filter: drop-shadow(0 16px 24px rgba(15, 23, 42, 0.12));
}

.invalid-feedback {
  display: none;
  margin-top: 8px;
  color: #ff8f8f;
  font-size: 0.88rem;
  font-weight: 600;
}

.was-validated .form-control-modern:invalid {
  border-color: rgba(255, 143, 143, 0.4);
  box-shadow: 0 0 0 4px rgba(255, 143, 143, 0.08);
}

.was-validated .input-wrap .form-control-modern:invalid ~ .invalid-feedback {
  display: block;
}

@media (min-width: 768px) {
  .login-shell {
    padding: clamp(18px, 2vw, 28px);
  }

  .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-body {
    padding: clamp(24px, 2.4vw, 34px);
  }

  .auth-illustration {
    display: none;
  }

  .row-inline {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

@media (min-width: 1100px) {
  .login-shell {
    grid-template-columns: 1.1fr 0.9fr;
    align-items: stretch;
    padding: clamp(18px, 2vw, 28px);
    height: 100dvh;
  }

  .brand-panel {
    display: block !important;
  }

  .auth-illustration {
    display: block;
  }

  .auth-panel {
    display: flex;
    align-items: center;
  }

  .auth-body {
    width: 100%;
    padding: clamp(24px, 2.5vw, 40px);
  }

  .brand-content {
    align-items: flex-start;
  }
}

@media (max-height: 900px) {
  .auth-illustration {
    display: none;
  }
}

@media (max-height: 820px) {
  .logo-wrap {
    width: 128px;
    height: auto;
    margin-bottom: -10px;
  }

  .logo-wrap img {
    width: 128px;
  }

  .lead {
    margin-bottom: 10px;
  }

  .note {
    display: none;
  }

  .brand-intro-title {
    font-size: clamp(1.7rem, 4vw, 3rem);
  }

  .brand-intro-copy {
    font-size: 0.92rem;
  }
}

@media (max-height: 740px) {
  .brand-intro-copy {
    display: block;
    font-size: 0.88rem;
    line-height: 1.6;
    max-width: 80ch;
  }

  .form-card {
    padding: 14px;
  }

  .brand-top {
    gap: 12px;
  }

  .brand-content {
    justify-content: center;
  }

  .brand-intro-title {
    max-width: 50ch;
    font-size: clamp(1.9rem, 3.2vw, 2.8rem);
    line-height: 1.08;
    letter-spacing: 0.1em;
  }
}

@keyframes gridFloat {
  from {
    transform: rotateX(76deg) translateY(0);
  }

  to {
    transform: rotateX(76deg) translateY(52px);
  }
}

@keyframes orbFloat {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }

  50% {
    transform: translate3d(-16px, 12px, 0) scale(1.06);
  }
}

@keyframes ringSpin {
  from {
    transform: translateX(-50%) rotateX(72deg) rotateZ(0deg);
  }

  to {
    transform: translateX(-50%) rotateX(72deg) rotateZ(360deg);
  }
}

@keyframes flowPulseA {
  0% {
    transform: translateX(-18px) translateY(10px);
    opacity: 0;
  }

  15% {
    opacity: 0.95;
  }

  100% {
    transform: translateX(34px) translateY(-20px);
    opacity: 0;
  }
}

@keyframes flowPulseB {
  0% {
    transform: translateX(20px) translateY(-14px);
    opacity: 0;
  }

  20% {
    opacity: 0.88;
  }

  100% {
    transform: translateX(-28px) translateY(22px);
    opacity: 0;
  }
}
