/* Login — compact split panel, fits one viewport */

.login-modal {
  border: 0;
  border-radius: 20px;
  padding: 0;
  width: min(760px, calc(100% - 24px));
  max-height: min(92dvh, 640px);
  height: auto;
  overflow: hidden;
  background: #fff;
  color: #071b34;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.32);
  font-family: "Noto Sans Thai", sans-serif;
}

/* Native <dialog> must stay hidden when closed — never force display:block always */
.login-modal:not([open]) {
  display: none;
}

.login-modal[open] {
  display: block;
}

.login-modal::backdrop {
  background: rgba(3, 15, 36, 0.72);
  backdrop-filter: blur(5px);
}

/* Dialog top-layer + nav backdrop-filter hides the header logo in Chromium */
body:has(#login-modal[open]) .nav-shell,
body:has(#login-modal[open]) .nav-shell.is-scrolled {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: rgba(255, 255, 255, 0.96);
}

body:has(#login-modal[open]) .nav-shell .brand img {
  mix-blend-mode: normal;
}

.login-modal-shell {
  display: grid;
  grid-template-columns: minmax(200px, 0.78fr) minmax(280px, 1.22fr);
  max-height: inherit;
  height: min(620px, 90dvh);
}

.login-modal-brand {
  position: relative;
  display: grid;
  place-items: center;
  place-content: center;
  padding: 28px 22px;
  overflow: hidden;
  background: #fff;
  border-right: 1px solid #e6edf4;
}

.login-modal-brand-inner {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 100%;
  margin: 0 auto;
}

.login-modal-brand a {
  display: grid;
  place-items: center;
  width: 100%;
  text-decoration: none;
  pointer-events: auto;
}

.login-modal-brand img {
  display: block;
  width: min(220px, 78%);
  height: auto;
  margin: 0 auto;
  object-fit: contain;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.login-modal-brand-eng,
.login-modal-brand-th,
.login-modal-brand-copy {
  display: none;
}

.login-modal-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
  overflow: hidden;
}

.login-modal-close {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 40;
  border: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #eef3f8;
  color: #071b34;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  pointer-events: auto;
}

.login-modal-close:hover {
  background: #e2ebf4;
  color: #126cf3;
}

.login-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 28px 28px 22px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.login-modal-kicker {
  display: none;
}

.login-modal-body h2 {
  margin: 0 40px 14px 0;
  font: 750 24px/1.2 "Noto Sans Thai", sans-serif;
  letter-spacing: -0.03em;
  color: #071b34;
}

.login-modal-status {
  display: none;
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #eef7ff;
  color: #0b4ea2;
  font: 650 12px/1.4 "Noto Sans Thai", sans-serif;
}

.login-modal-status.is-visible { display: block; }
.login-modal-status.is-error { background: #fff1f0; color: #a12828; }

.login-modal-form {
  display: grid;
  gap: 10px;
}

.login-modal-form label {
  display: grid;
  gap: 5px;
  font: 650 12px/1.3 "Noto Sans Thai", sans-serif;
  color: #3a516a;
}

.login-modal-form input[type="email"],
.login-modal-form input[type="password"],
.login-modal-form input[type="text"] {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(10, 18, 41, 0.12);
  border-radius: 11px;
  padding: 0 12px;
  background: #f7fafc;
  color: #071b34;
  font: 600 13px/1.3 "Noto Sans Thai", sans-serif;
  outline: 0;
  box-sizing: border-box;
}

.login-modal-form input:focus {
  border-color: #126cf3;
  box-shadow: 0 0 0 3px rgba(18, 108, 243, 0.14);
  background: #fff;
}

.login-modal-password {
  position: relative;
}

.login-modal-password input {
  padding-right: 42px;
}

.login-modal-toggle {
  position: absolute;
  right: 6px;
  bottom: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #64788d;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}

.login-modal-toggle:hover {
  color: #126cf3;
  background: rgba(18, 108, 243, 0.08);
}

.login-modal-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(18, 108, 243, 0.22);
}

.login-modal-toggle[aria-pressed="true"] {
  color: #126cf3;
}

.login-modal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.login-modal-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: 600 12px/1.3 "Noto Sans Thai", sans-serif;
  color: #5a6f86;
  cursor: pointer;
}

.login-modal-check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #0264e5;
  flex: 0 0 auto;
}

.login-modal-check input:focus-visible {
  outline: 2px solid #0264e5;
  outline-offset: 2px;
}

.login-modal-check-note {
  font-weight: 500;
  color: #6d8298;
}

.login-modal-link {
  color: #126cf3;
  font: 700 12px/1.3 "Noto Sans Thai", sans-serif;
  text-decoration: none;
}

.login-modal-link:hover { text-decoration: underline; }

.login-modal-submit {
  width: 100%;
  min-height: 44px;
  margin-top: 2px;
  border: 0;
  border-radius: 999px;
  background: #0023b4;
  color: #fff;
  font: 750 14px/1 "Noto Sans Thai", sans-serif;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.25s ease;
}

.login-modal-submit:hover {
  background: #126cf3;
  transform: translateY(-1px);
}

.login-modal-submit:disabled {
  opacity: 0.7;
  cursor: wait;
  transform: none;
}

.login-modal-register {
  margin: 2px 0 0;
  text-align: center;
  color: #5a6f86;
  font: 500 12px/1.4 "Noto Sans Thai", sans-serif;
}

.login-modal-register a {
  color: #0023b4;
  font-weight: 700;
  text-decoration: none;
}

.login-modal-register a:hover { text-decoration: underline; }

.login-modal-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin: 14px 0 12px;
  color: #8a9bb0;
  font: 600 11px/1 "Noto Sans Thai", sans-serif;
}

.login-modal-divider::before,
.login-modal-divider::after {
  content: "";
  height: 1px;
  background: rgba(10, 18, 41, 0.1);
}

.login-modal-lede {
  margin: 0 0 12px;
  color: #64788d;
  font: 500 12.5px/1.45 "Noto Sans Thai", sans-serif;
}

.login-modal-primary {
  margin: 0;
}

.login-modal-thaid {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid #d5dde7;
  border-radius: 999px;
  background: #fff;
  color: #122b45;
  font: 750 13.5px/1.2 "Noto Sans Thai", sans-serif;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-sizing: border-box;
  text-decoration: none !important;
  box-shadow: 0 1px 2px rgba(18, 43, 69, 0.06);
}

.login-modal-thaid:hover {
  border-color: #1b6bff;
  background: #f5f9ff;
  color: #0a3db5;
}

.login-modal-thaid-icon {
  width: 28px;
  height: 28px;
  flex: none;
  display: block;
  border-radius: 6px;
  object-fit: cover;
}

.login-modal-note {
  display: none;
}

@media (max-width: 700px) {
  .login-modal {
    width: min(400px, calc(100% - 18px));
    max-height: min(90dvh, 560px);
  }

  .login-modal-shell {
    grid-template-columns: 1fr;
    height: auto;
    max-height: min(90dvh, 560px);
  }

  .login-modal-brand {
    min-height: 110px;
    padding: 18px 16px;
    border-right: 0;
    border-bottom: 1px solid #e6edf4;
  }

  .login-modal-brand img {
    width: min(168px, 56%);
  }

  .login-modal-body {
    padding: 20px 18px 18px;
    justify-content: flex-start;
  }

  .login-modal-body h2 {
    font-size: 22px;
    margin-bottom: 12px;
  }
}
