:root {
  color-scheme: light;
  font-family: "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --auth-brand: #002753;
  --auth-brand-hover: #0b3b70;
  --auth-page: #f4f6f9;
  --auth-surface: #fff;
  --auth-surface-soft: #f8fafc;
  --auth-text-strong: #172133;
  --auth-text: #3c485a;
  --auth-muted: #59677b;
  --auth-border: #dfe5ec;
  --auth-focus: #1769aa;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--auth-page);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--auth-text);
  background: var(--auth-page);
  -webkit-font-smoothing: antialiased;
}

button,
input { font: inherit; }

.auth-skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10;
  padding: 10px 14px;
  color: var(--auth-brand);
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 39, 83, .15);
  transform: translateY(-160%);
}

.auth-skip-link:focus { transform: translateY(0); }

.auth-shell {
  display: grid;
  min-height: 100vh;
  padding: clamp(28px, 6vh, 64px) 20px;
  place-items: center;
}

.auth-login {
  display: grid;
  width: min(432px, 100%);
  justify-items: center;
  gap: 28px;
}

.auth-login__logo {
  display: block;
  width: min(330px, 88%);
  height: auto;
  margin-bottom: -36px;
  object-fit: contain;
}

.auth-card {
  width: 100%;
  padding: 34px 34px 30px;
  background: var(--auth-surface);
  border: 1px solid var(--auth-border);
  border-radius: 12px;
  box-shadow: 0 10px 26px rgba(24, 43, 70, .07);
}

.auth-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.auth-guidance {
  margin: 0;
  color: var(--auth-muted);
  font-size: 13px;
  line-height: 1.65;
  word-break: keep-all;
}

.auth-form {
  display: grid;
  margin-top: 28px;
  gap: 18px;
}

.auth-field { display: grid; gap: 8px; }

.auth-field label {
  color: var(--auth-text-strong);
  font-size: 13px;
  font-weight: 700;
}

.auth-field input {
  width: 100%;
  height: 50px;
  padding: 0 14px;
  color: var(--auth-text-strong);
  background: #fff;
  border: 1px solid #8997a9;
  border-radius: 7px;
  outline: none;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

.auth-field input:hover { border-color: #687a91; }

.auth-field input:focus-visible {
  border-color: var(--auth-focus);
  box-shadow: 0 0 0 3px rgba(23, 105, 170, .16);
}

.auth-field input::placeholder {
  color: #8b96a6;
  opacity: 1;
}

.auth-login .auth-field input:disabled {
  color: #66758a;
  background: #eef1f5;
  border-color: #c6cfda;
  cursor: not-allowed;
  opacity: 1;
}

.auth-submit {
  width: 100%;
  min-height: 50px;
  margin-top: 6px;
  color: #fff;
  background: var(--auth-brand);
  border: 1px solid var(--auth-brand);
  border-radius: 7px;
  cursor: pointer;
  font-weight: 600;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.auth-submit:not(:disabled):hover {
  background: var(--auth-brand-hover);
  border-color: var(--auth-brand-hover);
}

.auth-login .auth-submit:disabled {
  color: #eef2f7;
  background: #66788d;
  border-color: #66788d;
  box-shadow: none;
  cursor: wait;
}

.auth-submit:focus-visible,
.auth-signup a:focus-visible,
.auth-back-link:focus-visible,
.signup-login-link a:focus-visible,
.signup-legal-open:focus-visible,
.signup-legal-close:focus-visible,
.signup-consent input:focus-visible {
  outline: 3px solid rgba(23, 105, 170, .28);
  outline-offset: 3px;
}

.auth-status {
  min-height: 20px;
  margin: -4px 0 0;
  color: #4f6076;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
}

.auth-signup {
  display: flex;
  margin-top: 18px;
  padding-top: 20px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  color: var(--auth-muted);
  border-top: 1px solid #e8ecf1;
  font-size: 13px;
  gap: 9px;
}

.auth-signup a,
.auth-back-link {
  color: var(--auth-brand);
  font-weight: 750;
  text-underline-offset: 3px;
}

.auth-signup a { text-decoration: none; }
.auth-signup a:hover { text-decoration: underline; }

.signup-flow {
  display: grid;
  width: min(432px, 100%);
  justify-items: center;
  gap: 28px;
}

.signup-flow__logo {
  display: block;
  width: min(330px, 88%);
  height: auto;
  margin-bottom: -36px;
  object-fit: contain;
}

.signup-card {
  width: 100%;
}

.signup-card [hidden] { display: none !important; }

.signup-card h1 {
  margin: 0;
  color: var(--auth-text-strong);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -.03em;
}

.signup-guidance {
  margin: 12px 0 0;
  color: var(--auth-muted);
  font-size: 13px;
  line-height: 1.65;
  word-break: keep-all;
}

.signup-auth-form {
  display: grid;
  margin-top: 28px;
  gap: 18px;
}

.signup-status,
.signup-state-message,
.signup-legal-status {
  margin: 0;
  color: #66758a;
  font-size: 12.5px;
  line-height: 1.6;
}

.signup-status { min-height: 20px; margin-top: -4px; }

.signup-login-link {
  display: flex;
  margin: 18px 0 0;
  padding-top: 20px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  color: var(--auth-muted);
  border-top: 1px solid #e8ecf1;
  font-size: 13px;
  gap: 9px;
}

.signup-login-link a,
.auth-back-link {
  color: var(--auth-brand);
  font-weight: 750;
  text-underline-offset: 3px;
}

.signup-login-link a { text-decoration: none; }
.signup-login-link a:hover { text-decoration: underline; }
.signup-login-link--state { margin-bottom: 0; }

.signup-identity {
  display: grid;
  margin-top: 24px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.signup-readonly-field { display: grid; gap: 7px; }

.signup-readonly-field label {
  color: var(--auth-text-strong);
  font-size: 13px;
  font-weight: 700;
}

.signup-readonly-field input {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  color: var(--auth-text-strong);
  background: var(--auth-surface-soft);
  border: 1px solid var(--auth-border);
  border-radius: 7px;
  outline: none;
  text-overflow: ellipsis;
}

.signup-application {
  display: grid;
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid #e8ecf1;
  gap: 12px;
}

.signup-consent-row {
  display: flex;
  min-width: 0;
  min-height: 38px;
  padding: 4px 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.signup-consent {
  display: flex;
  min-width: 0;
  align-items: center;
  color: var(--auth-text);
  cursor: pointer;
  font-size: 13px;
  line-height: 1.5;
  gap: 9px;
}

.signup-consent input {
  width: 18px;
  height: 18px;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--auth-brand);
}

.signup-legal-open {
  padding: 5px 0;
  flex: 0 0 auto;
  color: var(--auth-brand);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.signup-apply { margin-top: 8px; }

.signup-card .auth-submit:disabled {
  color: #eef2f7;
  background: #8492a5;
  border-color: #8492a5;
  cursor: not-allowed;
}

.signup-state-message {
  min-height: 20px;
  margin-top: 20px;
  padding: 0;
  color: #526278;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.6;
  text-align: center;
}

.signup-complete { text-align: center; }

.signup-complete__message {
  margin: 18px 0 26px;
  color: var(--auth-text);
  font-size: 13.5px;
  line-height: 1.75;
  word-break: keep-all;
}

.auth-back-link { display: inline-block; font-size: 14px; }

.signup-legal-modal {
  width: min(640px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  color: var(--auth-text);
  background: var(--auth-surface);
  border: 1px solid var(--auth-border);
  border-radius: 12px;
  box-shadow: 0 16px 42px rgba(24, 43, 70, .18);
}

.signup-legal-modal:not([open]) { display: none; }

.signup-legal-modal::backdrop {
  background: rgba(12, 28, 48, .42);
}

.signup-legal-modal__content {
  display: grid;
  max-height: calc(100vh - 34px);
  max-height: calc(100dvh - 34px);
  padding: 28px;
  grid-template-rows: auto minmax(120px, 1fr) auto auto;
  gap: 18px;
}

.signup-legal-modal h2 {
  margin: 0;
  color: var(--auth-text-strong);
  font-size: 20px;
  letter-spacing: -.02em;
  text-align: center;
}

.signup-legal-document {
  max-height: 52vh;
  max-height: 52dvh;
  margin: 0;
  padding: 18px;
  overflow: auto;
  color: var(--auth-text);
  background: var(--auth-surface-soft);
  border: 1px solid var(--auth-border);
  border-radius: 7px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.7;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.signup-legal-status { min-height: 20px; }

.signup-legal-close {
  width: 100%;
  min-height: 46px;
  color: #fff;
  background: var(--auth-brand);
  border: 1px solid var(--auth-brand);
  border-radius: 7px;
  cursor: pointer;
  font-weight: 600;
}

.signup-legal-close:hover {
  background: var(--auth-brand-hover);
  border-color: var(--auth-brand-hover);
}

.auth-copyright {
  margin: 18px 0 0;
  color: #8b96a6;
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.auth-modal-open { overflow: hidden; }

@media (max-width: 760px) {
  .auth-shell { padding: 24px 16px; }
  .auth-shell:not(.auth-shell--signup) {
    min-height: 100vh;
    min-height: 100dvh;
    padding-top: 48px;
    align-items: start;
    justify-items: center;
  }
  .auth-login { gap: 26px; }
  .auth-login__logo {
    width: min(310px, 88%);
    margin-bottom: -34px;
  }
  .auth-shell--signup {
    min-height: 100vh;
    min-height: 100dvh;
    padding-top: 48px;
    align-items: start;
    justify-items: center;
  }
  .signup-flow { gap: 26px; }
  .signup-flow__logo {
    width: min(310px, 88%);
    margin-bottom: -34px;
  }
}

@media (max-width: 420px) {
  .auth-shell { padding: 20px 14px; }
  .auth-shell:not(.auth-shell--signup) { padding-top: 36px; }
  .auth-login { gap: 22px; }
  .auth-login__logo {
    width: min(290px, 86%);
    margin-bottom: -24px;
  }
  .auth-card, .signup-card { border-radius: 10px; }
  .auth-card { padding: 30px 22px 26px; }
  .auth-signup { gap: 6px; }
  .auth-shell--signup { padding-top: 36px; }
  .signup-flow { gap: 22px; }
  .signup-flow__logo {
    width: min(290px, 86%);
    margin-bottom: -24px;
  }
  .signup-card { padding: 30px 22px 26px; }
  .signup-identity { grid-template-columns: 1fr; }
  .signup-consent-row { align-items: flex-start; }
  .signup-consent { align-items: flex-start; }
  .signup-consent input { margin-top: 1px; }
  .signup-legal-modal { width: calc(100% - 28px); }
  .signup-legal-modal__content { padding: 24px 20px; }
  .signup-legal-document { padding: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
