:root {
  color-scheme: light;
  --page: #eef3f9;
  --surface: #ffffff;
  --ink: #111827;
  --muted: #667085;
  --subtle: #98a2b3;
  --line: #dbe3ee;
  --blue: #2563eb;
  --blue-dark: #1749b0;
  --blue-soft: #eaf1ff;
  --navy: #101c2e;
  --red: #c43228;
  --red-soft: #fff1ef;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-width: 320px; min-height: 100%; }

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  color: var(--ink);
  background:
    radial-gradient(circle at 9% 12%, rgba(37, 99, 235, .11), transparent 26rem),
    radial-gradient(circle at 92% 88%, rgba(16, 28, 46, .08), transparent 30rem),
    var(--page);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Thai", "Leelawadee UI", Tahoma, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { color: inherit; }

.skip-link {
  position: fixed;
  z-index: 30;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border-radius: 9px;
  color: #fff;
  background: var(--blue);
  transform: translateY(calc(-100% - 24px));
  transition: transform .18s ease;
}
.skip-link:focus { transform: translateY(0); }

.login-shell {
  position: relative;
  isolation: isolate;
  width: min(1020px, 100%);
  min-height: min(620px, calc(100dvh - 56px));
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(420px, 1.08fr);
  overflow: hidden;
  border: 1px solid rgba(16, 28, 46, .1);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 28px 80px rgba(16, 28, 46, .14), 0 3px 12px rgba(16, 28, 46, .05);
  animation: shell-in .42s ease-out both;
}

.login-locale-switcher { position: absolute; z-index: 5; top: 18px; right: 18px; }
.login-locale-switcher select { min-height: 34px; padding: 0 26px 0 9px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: rgba(255, 255, 255, .94); font-size: 12px; font-weight: 650; outline: none; }
.login-locale-switcher select:focus-visible { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }

.login-context {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: clamp(38px, 5vw, 64px);
  display: flex;
  flex-direction: column;
  color: #fff;
  background: var(--navy);
}
.login-context::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: .28;
  background-image:
    linear-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .07) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(140deg, #000 0%, transparent 74%);
}
.login-context::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 340px;
  height: 340px;
  right: -150px;
  bottom: -160px;
  border: 1px solid rgba(122, 164, 255, .3);
  border-radius: 50%;
  box-shadow: 0 0 0 54px rgba(37, 99, 235, .07), 0 0 0 110px rgba(37, 99, 235, .04);
}

.context-edition {
  color: #91a9ce;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .15em;
}

.context-copy { margin: auto 0; }
.context-copy h1 {
  margin: 16px 0 0;
  font-size: clamp(48px, 5.4vw, 72px);
  line-height: 1;
  letter-spacing: -.065em;
}
.context-footer { color: #738198; font-size: 10px; }

.login-panel {
  min-width: 0;
  padding: clamp(42px, 7vw, 88px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--surface);
}
.form-wrap { width: min(100%, 390px); margin: auto; }

#login-form { display: flex; flex-direction: column; gap: 22px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { color: #344054; font-size: 12px; font-weight: 700; }
.field input {
  width: 100%;
  height: 52px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  color: var(--ink);
  background: #fbfcfe;
  font-size: 16px;
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}
.field input:hover { border-color: #bcc8d8; }
.field input:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}
.field input:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  box-shadow: 0 0 0 1000px #fbfcfe inset;
}
.password-field { position: relative; }
.password-field input { padding-right: 70px; }
.password-toggle {
  position: absolute;
  top: 50%;
  right: 7px;
  min-width: 54px;
  min-height: 38px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  color: var(--blue);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transform: translateY(-50%);
}
.password-toggle:hover { background: var(--blue-soft); }

.login-error {
  margin: -2px 0 0;
  padding: 10px 12px;
  border: 1px solid #ffd2cc;
  border-radius: 9px;
  color: var(--red);
  background: var(--red-soft);
  font-size: 12px;
}

.login-submit {
  position: relative;
  height: 52px;
  margin-top: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 9px 20px rgba(37, 99, 235, .22);
  font-weight: 750;
  cursor: pointer;
  transition: background-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.login-submit:hover:not(:disabled) { background: var(--blue-dark); box-shadow: 0 11px 24px rgba(37, 99, 235, .28); }
.login-submit:active:not(:disabled) { transform: translateY(1px); }
.login-submit:disabled { cursor: wait; opacity: .78; }
.submit-spinner {
  width: 16px;
  height: 16px;
  display: none;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .72s linear infinite;
}
.login-submit.is-loading .submit-spinner { display: block; }

:focus-visible { outline: 3px solid rgba(37, 99, 235, .35); outline-offset: 3px; }
@keyframes shell-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  body { place-items: start center; }
  .login-shell { grid-template-columns: 1fr; min-height: calc(100dvh - 56px); }
  .login-context { min-height: 240px; padding: 38px 42px; }
  .context-copy h1 { font-size: clamp(46px, 9vw, 64px); }
  .context-footer { display: none; }
  .login-panel { min-height: 480px; padding: 64px 42px; }
}

@media (max-width: 560px) {
  body { padding: 0; background: var(--surface); }
  .login-shell { min-height: 100dvh; border: 0; border-radius: 0; box-shadow: none; animation: none; }
  .login-context { min-height: 176px; padding: calc(28px + env(safe-area-inset-top)) 24px 28px; }
  .context-copy h1 { margin-top: 12px; font-size: 42px; }
  .login-panel { min-height: calc(100dvh - 176px); padding: 48px 24px calc(32px + env(safe-area-inset-bottom)); }
  .form-wrap { margin-top: 0; }
  .login-locale-switcher { top: calc(10px + env(safe-area-inset-top)); right: 14px; }
  .login-locale-switcher select { min-height: 31px; font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
