:root {
  color-scheme: light dark;
  --page: #edf0ec;
  --surface: #f8faf7;
  --surface-strong: #ffffff;
  --text: #15231b;
  --muted: #66736a;
  --line: #d6ded8;
  --line-strong: #aebbb2;
  --accent: #1595a3;
  --accent-hover: #0b6671;
  --accent-soft: #d9f0f1;
  --button-bg: #0b7480;
  --button-hover: #095f68;
  --button-text: #f7faf8;
  --error: #a23a32;
  --error-soft: #f8e9e7;
  --focus: rgba(31, 101, 71, 0.22);
  --shadow: rgba(21, 44, 31, 0.13);
  font-family: "Avenir Next", Avenir, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] { display: none !important; }
textarea { font: inherit; }
.auth-layout.is-register .login-head { margin-bottom: 18px; }
.auth-layout.is-register .register-panel { margin-top: 0; padding-top: 0; border-top: 0; }
.auth-layout.is-register .form-wrap { width: min(100%, 620px); overflow-y: auto; }

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 0;
  min-width: 320px;
  color: var(--text);
  background: var(--page);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.auth-layout {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(360px, 46%) minmax(480px, 54%);
  overflow: hidden;
  background: var(--surface);
}

.visual-panel {
  position: relative;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  color: #f4f7f3;
  background: #173c2a;
}

.visual-panel > img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.visual-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(10, 27, 18, 0.34) 0%, rgba(10, 27, 18, 0.04) 42%, rgba(8, 25, 16, 0.82) 100%),
    linear-gradient(90deg, rgba(10, 27, 18, 0.22), transparent 45%);
}

.brand-lockup {
  position: absolute;
  top: clamp(24px, 4vw, 52px);
  left: clamp(24px, 4vw, 52px);
  display: flex;
  align-items: center;
  gap: 16px;
  color: #f4f8f5;
  font-size: 20px;
  font-weight: 760;
  letter-spacing: 0.06em;
  text-shadow: 0 2px 12px rgba(5, 24, 14, 0.72);
}

.brand-lockup img {
  width: 128px;
  height: 74px;
  display: block;
  object-fit: contain;
  filter:
    drop-shadow(1px 0 0 rgba(245, 249, 246, 0.96))
    drop-shadow(-1px 0 0 rgba(245, 249, 246, 0.96))
    drop-shadow(0 1px 0 rgba(245, 249, 246, 0.96))
    drop-shadow(0 -1px 0 rgba(245, 249, 246, 0.96))
    drop-shadow(0 4px 12px rgba(5, 24, 14, 0.48));
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.56);
  border-radius: 10px;
  background: rgba(18, 48, 33, 0.34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
}

.visual-copy {
  position: absolute;
  left: clamp(24px, 4vw, 52px);
  right: clamp(24px, 5vw, 68px);
  bottom: clamp(34px, 6vw, 74px);
  max-width: 620px;
}

.visual-copy p {
  margin: 0 0 14px;
  color: rgba(244, 247, 243, 0.76);
  font-size: 14px;
  font-weight: 650;
}

.visual-copy h2 {
  max-width: none;
  margin: 0;
  font-size: clamp(30px, 2.8vw, 46px);
  font-weight: 640;
  letter-spacing: -0.045em;
  line-height: 1.16;
  white-space: nowrap;
}

.form-panel {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  padding: clamp(18px, 4.8dvh, 48px) clamp(32px, 5.2vw, 76px) clamp(14px, 3.2dvh, 32px);
  overflow: hidden;
  background:
    radial-gradient(circle at 100% 0%, rgba(90, 131, 104, 0.11), transparent 31%),
    var(--surface);
}

.form-wrap {
  width: min(100%, 470px);
  min-height: 0;
  max-height: 100%;
  align-self: center;
  justify-self: center;
  padding-block: clamp(8px, 2.4dvh, 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.login-head {
  margin-bottom: clamp(22px, 3.4dvh, 34px);
}

h1 {
  margin: 0;
  font-size: clamp(38px, 4vw, 56px);
  font-weight: 680;
  letter-spacing: -0.055em;
  line-height: 1.08;
}

.intro {
  max-width: 34ch;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

form {
  display: grid;
  gap: clamp(15px, 2.2dvh, 20px);
}

/* Registration keeps the same calm, compact rhythm as login while giving
   applicants enough context to complete the review form on one page. */
.auth-switch {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.text-action,
.back-action {
  border: 0;
  color: var(--accent);
  background: transparent;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-action:hover,
.back-action:hover { color: var(--accent-hover); }

.text-action:focus-visible,
.back-action:focus-visible,
.consent-check input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.register-panel {
  margin-top: clamp(24px, 3.8dvh, 38px);
  padding-top: clamp(20px, 3.2dvh, 30px);
  border-top: 1px solid var(--line);
}

.register-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.register-grid .field { min-width: 0; }

.field > span em {
  margin-left: 4px;
  color: var(--accent);
  font-size: 11px;
  font-style: normal;
  font-weight: 650;
}

textarea {
  width: 100%;
  min-height: 102px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text);
  background: var(--surface-strong);
  outline: none;
  line-height: 1.6;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

textarea:hover { border-color: #87998c; }

textarea:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus);
}

.consent-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  cursor: pointer;
}

.consent-check input {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  margin: 1px 0 0;
  accent-color: var(--accent);
}

.register-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.register-actions .submit-button { flex: 1; }

.back-action {
  flex: 0 0 auto;
  padding: 10px 0;
  text-decoration: none;
}

.register-success {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  border: 1px solid rgba(31, 101, 71, 0.2);
  border-radius: 12px;
  padding: 13px 14px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 13px;
  line-height: 1.55;
}

.success-mark {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.register-success strong { display: block; margin-bottom: 2px; }
.register-success p { margin: 0; color: var(--muted); }

.register-panel[hidden] { display: none; }

.field {
  display: grid;
  gap: 9px;
  color: var(--text);
  font-size: 14px;
  font-weight: 680;
}

input {
  width: 100%;
  height: 52px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0 15px;
  color: var(--text);
  background: var(--surface-strong);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.72), inset 0 1px 2px rgba(21, 44, 31, 0.025);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

input:hover {
  border-color: #87998c;
}

input:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus);
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 72px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  min-width: 52px;
  height: 36px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 9px;
  color: var(--accent);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.password-toggle:hover {
  background: var(--accent-soft);
}

.password-toggle:focus-visible,
.submit-button:focus-visible,
.login-footer a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.status-message {
  margin: -2px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(162, 58, 50, 0.18);
  border-radius: 12px;
  color: var(--error);
  background: var(--error-soft);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.55;
}

.status-message[data-tone="success"] {
  border-color: rgba(31, 101, 71, 0.2);
  color: var(--accent);
  background: var(--accent-soft);
}

.submit-button {
  position: relative;
  width: 100%;
  min-height: 54px;
  display: grid;
  place-items: center;
  margin-top: 4px;
  border: 1px solid var(--button-bg);
  border-radius: 12px;
  padding: 14px 18px;
  color: var(--button-text);
  background: var(--button-bg);
  box-shadow: 0 12px 30px var(--shadow);
  font-size: 15px;
  font-weight: 750;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.submit-button:hover:not(:disabled) {
  background: var(--button-hover);
  box-shadow: 0 15px 34px rgba(21, 70, 48, 0.19);
}

.submit-button:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
}

.submit-button:disabled {
  cursor: wait;
  opacity: 0.86;
}

.submit-button.is-loading .button-label {
  padding-right: 22px;
}

.button-progress {
  position: absolute;
  right: calc(50% - 58px);
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.34);
  border-top-color: #ffffff;
  border-radius: 50%;
  opacity: 0;
}

.submit-button.is-loading .button-progress {
  opacity: 1;
  animation: button-spin 700ms linear infinite;
}

.access-note {
  margin: clamp(14px, 2.2dvh, 20px) 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.access-note a {
  color: var(--accent);
  font-weight: 700;
  text-underline-offset: 3px;
}

.login-footer {
  width: min(100%, 470px);
  justify-self: center;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: clamp(10px, 2.2dvh, 22px);
  color: var(--muted);
  font-size: 12px;
}

.login-footer a {
  color: inherit;
  text-underline-offset: 3px;
}

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

@media (max-width: 880px) {
  .auth-layout {
    grid-template-columns: 1fr;
    grid-template-rows: clamp(148px, 27dvh, 230px) minmax(0, 1fr);
  }

  .visual-panel {
    height: 100%;
    min-height: 0;
    max-height: none;
  }

  .visual-panel > img {
    object-position: center 68%;
  }

  .brand-lockup {
    top: 22px;
    left: 22px;
    gap: 12px;
    font-size: 17px;
  }

  .brand-lockup img { width: 106px; height: 62px; }

  .visual-copy {
    left: 22px;
    right: 22px;
    bottom: 24px;
  }

  .visual-copy p {
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
  }

  .visual-copy h2 {
    max-width: 22ch;
    font-size: clamp(24px, 6vw, 34px);
    white-space: normal;
  }

  .form-panel {
    height: 100%;
    min-height: 0;
    padding: clamp(14px, 2.8dvh, 24px) 24px clamp(10px, 2dvh, 18px);
  }

  .form-wrap {
    padding-block: 4px;
  }
}

@media (max-width: 520px) {
  .auth-layout {
    grid-template-rows: clamp(154px, 23dvh, 194px) minmax(0, 1fr);
  }

  .brand-lockup {
    top: 14px;
    left: 18px;
    gap: 9px;
    font-size: 15px;
  }

  .brand-lockup img {
    width: 82px;
    height: 48px;
  }

  .visual-copy {
    left: 18px;
    right: 18px;
    bottom: 14px;
  }

  .visual-copy p {
    display: block;
    margin-bottom: 5px;
    font-size: 11px;
    letter-spacing: 0.04em;
  }

  .visual-copy h2 {
    font-size: 24px;
  }

  .form-panel {
    padding: 12px 20px 10px;
  }

  .form-wrap {
    padding-block: 2px;
  }

  .login-head {
    margin-bottom: 16px;
  }

  h1 {
    font-size: 35px;
  }

  .intro {
    margin-top: 8px;
    font-size: 14px;
    line-height: 1.5;
  }

  form {
    gap: 12px;
  }

  .field {
    gap: 6px;
    font-size: 13px;
  }

  input {
    height: 46px;
  }

  .submit-button {
    min-height: 48px;
    margin-top: 2px;
    padding-block: 11px;
  }

  .access-note {
    margin-top: 11px;
    font-size: 12px;
    line-height: 1.45;
  }

  .auth-switch {
    margin-top: 12px;
    font-size: 12px;
  }

  .register-panel {
    margin-top: 20px;
    padding-top: 18px;
  }

  .register-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .register-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .register-actions .submit-button { flex: none; }
  .back-action { min-height: 38px; }

  .login-footer {
    gap: 12px;
    padding-top: 8px;
    font-size: 11px;
    white-space: nowrap;
  }
}

@media (max-width: 520px) and (min-height: 700px) {
  .form-wrap {
    overflow-y: hidden;
  }

  .auth-layout.is-register .form-wrap {
    overflow-y: auto;
  }
}

@media (max-height: 620px) {
  .login-head {
    margin-bottom: 18px;
  }

  .intro {
    margin-top: 10px;
    line-height: 1.5;
  }

  input {
    height: 48px;
  }

  .submit-button {
    min-height: 48px;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #101713;
    --surface: #151d18;
    --surface-strong: #1d2821;
    --text: #edf3ef;
    --muted: #a3b0a7;
    --line: #2d3b32;
    --line-strong: #526258;
    --accent: #73b78e;
    --accent-hover: #63a77f;
    --accent-soft: #213a2d;
    --button-bg: #2f7654;
    --button-hover: #286547;
    --button-text: #f2f7f4;
    --error: #f09a92;
    --error-soft: #3b2422;
    --focus: rgba(115, 183, 142, 0.25);
    --shadow: rgba(0, 0, 0, 0.28);
  }

  .form-panel {
    background:
      radial-gradient(circle at 100% 0%, rgba(80, 132, 96, 0.12), transparent 31%),
      var(--surface);
  }

  input {
    box-shadow: none;
  }

  textarea {
    box-shadow: none;
  }
}

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

/* Calm, tactile controls for sign-in and registration. */
button {
  touch-action: manipulation;
  transition-duration: 160ms;
  transition-timing-function: cubic-bezier(.2, .7, .2, 1);
}

button:not(:disabled) { cursor: pointer; }

button:disabled {
  cursor: not-allowed;
  opacity: .62;
  box-shadow: none;
  transform: none;
}

.submit-button {
  border-radius: 12px;
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--button-text) 15%, transparent), 0 5px 14px color-mix(in srgb, var(--button-bg) 20%, transparent);
  transition-property: border-color, background-color, color, box-shadow, transform;
}

.submit-button:hover:not(:disabled) {
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--button-text) 15%, transparent), 0 7px 17px color-mix(in srgb, var(--button-bg) 26%, transparent);
  transform: translateY(-1px);
}

.submit-button:active:not(:disabled),
.back-action:active:not(:disabled),
.password-toggle:active:not(:disabled) { transform: translateY(1px) scale(.985); }

.back-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0 15px;
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
  transition-property: border-color, background-color, color, box-shadow, transform;
}

.back-action:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-hover);
  background: var(--accent-soft);
  box-shadow: 0 3px 10px color-mix(in srgb, var(--accent) 10%, transparent);
  transform: translateY(-1px);
}

.text-action {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border-radius: 8px;
  padding: 0 5px;
  text-decoration: none;
  text-underline-offset: 4px;
  transition: color 160ms cubic-bezier(.2, .7, .2, 1), background-color 160ms cubic-bezier(.2, .7, .2, 1);
}

.text-action:hover { background: color-mix(in srgb, var(--accent-soft) 74%, transparent); }

.password-toggle {
  border: 1px solid transparent;
  transition-property: border-color, background-color, color, transform;
}

.password-toggle:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent) 24%, transparent);
  background: var(--accent-soft);
}

@media (max-width: 600px) {
  .submit-button { min-height: 50px; }
  .back-action { min-height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  button { transition-duration: .01ms !important; }
  button:active { transform: none !important; }
}
