* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: var(--brand);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--brand-hi);
}

:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

.auth-layout {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 1.05fr 0.95fr;
}

.auth-panel {
  position: relative;
  display: flex;
  overflow: hidden;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(var(--space-8), 5vw, 72px);
  background: var(--panel);
  color: var(--n-0);
}

.auth-panel__content {
  position: relative;
  z-index: 1;
  max-width: 620px;
}

.auth-panel__eyebrow {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0 0 20vh;
  font-weight: 600;
}

.auth-panel__mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 700;
}

.auth-panel h2 {
  max-width: 560px;
  margin: 0;
  font-size: clamp(32px, 4vw, 56px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.auth-panel__support {
  max-width: 520px;
  margin: var(--space-6) 0 0;
  color: var(--d-muted-fg);
  font-size: 18px;
}

.auth-proof {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin: 10vh 0 0;
}

.auth-proof strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}

.auth-proof span {
  color: var(--d-muted-fg);
  font-size: 13px;
}

.data-motif {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: var(--brand);
  opacity: 0.28;
  pointer-events: none;
}

.auth-main {
  display: grid;
  min-width: 0;
  place-items: center;
  padding: var(--space-8);
}

.auth-wrap {
  width: 100%;
  max-width: 400px;
}

.auth-card {
  padding: var(--space-8);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-card);
}

.auth-card h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

.auth-card__intro {
  margin: var(--space-2) 0 var(--space-6);
  color: var(--muted-fg);
}

.field {
  margin-top: var(--space-4);
}

.field label,
.field__label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: 14px;
  font-weight: 600;
}

.field input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--fg);
  font: inherit;
}

.field--checkbox {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: var(--space-3);
}

.field--checkbox input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--brand);
}

.field--checkbox label {
  margin: 0;
}

.field input[readonly],
.field input:disabled {
  background: var(--muted);
  color: var(--muted-fg);
}

.field--code input {
  font-family: var(--font-mono);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3em;
  text-align: center;
}

.password-control {
  position: relative;
}

.password-control input {
  padding-right: 52px;
}

.password-toggle {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 48px;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
}

.field-error,
.form-errors {
  margin: var(--space-2) 0 0;
  color: var(--status-risk-text);
  font-size: 14px;
}

.form-errors ul,
.field-error ul {
  margin: 0;
  padding-left: 20px;
}

.button {
  display: inline-flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
}

.button--primary {
  background: var(--brand);
  color: var(--on-brand);
}

.button--primary:hover {
  background: var(--brand-hi);
  color: var(--on-brand);
}

.button--secondary {
  border-color: var(--border);
  background: var(--card);
  color: var(--fg);
}

.button--secondary:hover {
  background: var(--muted);
  color: var(--fg);
}

.button + .button,
.form-actions {
  margin-top: var(--space-4);
}

.divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-6) 0;
  color: var(--muted-fg);
  font-size: 13px;
}

.divider::before,
.divider::after {
  height: 1px;
  background: var(--border);
  content: "";
}

.auth-links {
  display: flex;
  justify-content: center;
  margin: var(--space-4) 0 0;
  font-size: 14px;
}

.staff-link {
  /* Rendered as a <button> inside a POST form (see account/login.html), so the
     browser's button chrome has to be reset back to link appearance. */
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 12px;
  text-align: center;
  background: none;
  border: 0;
  font: inherit;
  color: var(--muted-fg);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.staff-link:hover {
  color: var(--fg);
}

.microsoft-mark {
  width: 20px;
  height: 20px;
}

.qr {
  display: block;
  width: min(220px, 100%);
  height: auto;
  margin: var(--space-6) auto;
  padding: var(--space-3);
  background: var(--n-0);
}

.secret {
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  user-select: all;
}

.escape {
  margin-top: var(--space-4);
  text-align: center;
}

@media (max-width: 899px) {
  .auth-layout {
    display: block;
  }

  .auth-panel {
    display: none;
  }

  .auth-main {
    min-height: 100vh;
    padding: var(--space-4);
  }

  .auth-card {
    padding: var(--space-6);
  }
}

@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;
  }
}

.recovery-codes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2) var(--space-4);
  margin: var(--space-4) 0;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--muted);
  font-family: var(--font-mono);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  /* Selectable as a block so the whole set can be copied in one gesture. */
  user-select: all;
  list-style: none;
}

.recovery-codes li {
  letter-spacing: 0.08em;
}

.button--disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.notices {
  margin: 0 0 var(--space-6);
  padding: 0;
  list-style: none;
}

.notice {
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius);
  background: var(--muted);
  font-size: 14px;
}

.notice + .notice {
  margin-top: var(--space-2);
}

.notice--success {
  border-left-color: var(--status-ok-text);
}

.notice--error {
  border-left-color: var(--status-risk-text);
  color: var(--status-risk-text);
}

.notice--warning {
  border-left-color: var(--status-warn-text);
}

.notice--info {
  border-left-color: var(--brand);
}
