:root {
  color-scheme: light;
  --paper: #f3f0e8;
  --surface: #fbfaf6;
  --ink: #181a18;
  --muted: #706f68;
  --line: #cfc8bb;
  --accent: #e35b35;
  --green: #23845c;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", "JetBrains Mono", "Roboto Mono", monospace;
}

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

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(rgba(24,26,24,.035) 1px, transparent 1px),
    var(--paper);
  background-size: 100% 36px;
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr);
  min-height: 100vh;
}

.login-intro {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 100vh;
  padding: clamp(28px, 5vw, 72px);
  border-right: 1px solid var(--line);
}
.login-intro > div:last-child { margin: auto 0; padding: clamp(48px, 6vh, 88px) 0; }

.brand-lockup { display: flex; align-items: center; gap: 13px; font: 700 11px/1 var(--mono); letter-spacing: .08em; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 50px; border-radius: 2px 2px 14px 2px; background: var(--ink); color: white; letter-spacing: -.08em; }
.eyebrow { margin: 0 0 12px; color: var(--muted); font: 700 10px/1.2 var(--mono); letter-spacing: .12em; }
h1 { max-width: 660px; margin: 0; font-size: clamp(54px, 6.2vw, 104px); line-height: .94; letter-spacing: -.065em; }
.intro-copy { max-width: 520px; margin: 32px 0 0; color: var(--muted); font-size: 15px; line-height: 1.8; }
.boundary-copy { margin: 0; color: var(--muted); font: 600 10px/1.5 var(--mono); }

.login-card { align-self: center; width: min(480px, calc(100% - 48px)); max-height: calc(100vh - 48px); margin: 24px auto; padding: 28px; overflow-y: auto; border: 1px solid var(--line); background: rgba(251,250,246,.94); box-shadow: 10px 10px 0 rgba(24,26,24,.07); }
.card-heading { display: flex; align-items: center; gap: 13px; margin-bottom: 24px; }
.card-heading h2 { margin: 0; font-size: 24px; letter-spacing: -.04em; }
.card-heading .eyebrow { margin-bottom: 6px; }
.status-pip { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(35,132,92,.12); }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.mode-switch button { min-height: 44px; margin: 0; padding: 0 4px 12px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); justify-content: center; font: 700 15px/1 var(--sans); letter-spacing: .02em; transition: border-color 180ms ease, color 180ms ease; }
.mode-switch button:hover { background: transparent; color: var(--ink); }
.mode-switch button[aria-pressed="true"] { border-bottom-color: var(--accent); color: var(--ink); }
.auth-stage {
  --exit-x: -10px;
  --enter-x: 12px;
  min-width: 0;
}
.auth-stage.motion-reverse { --exit-x: 10px; --enter-x: -12px; }
.auth-stage.is-resizing { transition: height 260ms cubic-bezier(.22, 1, .36, 1); }
.form-exit { animation: form-exit 130ms ease-in forwards; }
.form-enter { animation: form-enter 240ms cubic-bezier(.22, 1, .36, 1); }
.title-exit { animation: title-exit 110ms ease-in forwards; }
.title-enter { animation: title-enter 210ms cubic-bezier(.22, 1, .36, 1); }
@keyframes form-exit {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(var(--exit-x)); }
}
@keyframes form-enter {
  from { opacity: 0; transform: translateX(var(--enter-x)); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes title-exit {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-4px); }
}
@keyframes title-enter {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
form { display: grid; gap: 16px; }
.field { display: grid; gap: 9px; color: var(--muted); font: 650 13px/1.2 var(--sans); letter-spacing: .01em; }
.field small { color: var(--muted); font: 400 12px/1.55 var(--sans); letter-spacing: 0; }
input { width: 100%; min-height: 50px; padding: 0 13px; border: 1px solid var(--line); border-radius: 0; outline: none; background: white; color: var(--ink); font: 500 15px/1 var(--sans); }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(227,91,53,.12); }
button { display: flex; justify-content: space-between; align-items: center; min-height: 50px; margin-top: 4px; padding: 0 16px; border: 1px solid var(--ink); background: var(--ink); color: white; cursor: pointer; font: 700 12px/1 var(--sans); }
button:hover { border-color: var(--accent); background: var(--accent); }
button:disabled { cursor: wait; opacity: .62; }
.primary-button { width: 100%; font-size: 13px; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) 126px; gap: 8px; }
.code-button { min-height: 50px; margin: 0; padding: 0 10px; justify-content: center; background: var(--surface); color: var(--ink); font-size: 13px; }
.password-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check-row { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: start; color: var(--muted); font: 400 13px/1.55 var(--sans); }
.check-row input { width: 16px; min-height: 16px; margin: 1px 0 0; padding: 0; accent-color: var(--ink); }
.check-row a, .form-links a { color: var(--ink); text-decoration-color: var(--line); text-underline-offset: 3px; }
.form-links { display: flex; justify-content: space-between; align-items: center; }
.text-button { min-height: auto; margin: 0; padding: 0; border: 0; background: transparent; color: var(--muted); font: 500 13px/1.4 var(--sans); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.text-button:hover { border: 0; background: transparent; color: var(--accent); }
.form-message { min-height: 19px; margin: -4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.form-message[data-state="error"] { color: #a63f2c; }
.form-message[data-state="success"] { color: var(--green); }
.auth-unavailable { margin: 16px 0 0; color: #a63f2c; font-size: 13px; }
.oauth-section { display: grid; gap: 12px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.oauth-buttons { display: grid; grid-template-columns: 1fr; gap: 10px; }
.oauth-button { min-height: 48px; margin: 0; justify-content: center; gap: 9px; border-color: var(--line); background: white; color: var(--ink); font-size: 13px; }
.oauth-button:hover { border-color: var(--ink); background: var(--surface); }
.oauth-button svg { width: 18px; height: 18px; flex: 0 0 auto; }

@media (max-width: 820px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-intro { min-height: auto; padding: 24px 22px 28px; gap: 62px; border-right: 0; border-bottom: 1px solid var(--line); }
  .login-intro > div:last-child { margin: 0; padding: 0; }
  h1 { font-size: clamp(52px, 16vw, 84px); }
  .intro-copy { margin-top: 22px; }
  .boundary-copy { display: none; }
  .login-card { width: min(480px, calc(100% - 28px)); max-height: none; margin: 28px auto; }
  .password-grid { grid-template-columns: 1fr; }
}

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