.auth-wrap {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 20px 20px 40px;
  transition: width 180ms ease;
}

.auth-flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 28px;
  align-items: start;
}

.auth-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px 30px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.06);
}

.auth-kicker {
  margin: 0 0 10px;
  color: #16a34a;
  font-size: 14px;
  font-weight: 700;
}

.auth-wrap h1 {
  font-size: 34px;
  line-height: 1.08;
  font-weight: 650;
  margin: 0 0 12px;
}

.auth-lede {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
  margin: 0 0 24px;
}

.flow-steps {
  display: grid;
  grid-template-columns: repeat(var(--step-count, 3), 1fr);
  gap: 8px;
  margin: 0 0 26px;
}

.flow-step {
  height: 5px;
  border-radius: 999px;
  background: #ececec;
  overflow: hidden;
}

.flow-step.is-active,
.flow-step.is-complete {
  background: #111;
}

.auth-step {
  display: none;
}

.auth-step.is-active {
  display: block;
  animation: authStepIn 180ms cubic-bezier(0.23, 1, 0.32, 1);
}

@keyframes authStepIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-wrap label {
  display: block;
  margin-bottom: 8px;
  color: #333;
  font-size: 13px;
  font-weight: 650;
}

.auth-wrap input {
  width: 100%;
  min-height: 48px;
  padding: 13px 14px;
  margin: 0 0 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.auth-wrap input:focus {
  border-color: #111;
  box-shadow: 0 0 0 4px rgba(17, 17, 17, 0.08);
}

.auth-wrap button,
.auth-button {
  width: 100%;
  min-height: 48px;
  padding: 13px 16px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 160ms ease, transform 120ms ease, opacity 160ms ease;
}

.auth-wrap button:hover:not(:disabled),
.auth-button:hover {
  background: #333;
}

.auth-wrap button:active:not(:disabled),
.auth-button:active {
  transform: scale(0.98);
}

.auth-wrap button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.auth-wrap .auth-link-button {
  width: auto;
  min-height: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: #111;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

.auth-wrap .auth-link-button:hover {
  text-decoration: underline;
  background: transparent;
}

.auth-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.auth-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid #edf2ee;
  border-radius: 999px;
  background: #f8fbf8;
}

.auth-switch {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.auth-switch a,
.terms-note a {
  color: var(--text);
  font-weight: 650;
  text-decoration: none;
}

.auth-switch a:hover,
.terms-note a:hover {
  text-decoration: underline;
}

.terms-note {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.message {
  display: none;
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.45;
}

.message.error {
  display: block;
  background: #fff1f2;
  color: #b00020;
  border: 1px solid #fecdd3;
}

.message.success {
  display: block;
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.message:empty {
  display: none;
}

.code-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin: 0 0 16px;
}

.code-row input {
  height: 54px;
  padding: 0;
  margin: 0;
  text-align: center;
  font-size: 22px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.step-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 12px;
}

.step-actions .auth-link-button {
  flex: 0 0 auto;
}

.resend-note,
.field-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

.resend-note:empty {
  display: none;
}

body[data-auth-step="code"] .auth-wrap {
  width: min(100%, 560px);
  padding-top: 18px;
}

body[data-auth-step="code"] .auth-flow {
  grid-template-columns: 1fr;
}

body[data-auth-step="code"] .auth-panel {
  padding: 28px 30px;
}

body[data-auth-step="code"] .auth-side {
  display: none;
}

body[data-auth-step="code"] .message.success {
  text-align: center;
}

.worker-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  margin: 0 0 18px;
  padding: 14px;
  border: 1px solid #dceee2;
  border-radius: 8px;
  background: #f7fcf8;
  color: #111;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.worker-preview span {
  color: #16a34a;
  font-weight: 750;
}

.worker-input {
  display: flex;
  align-items: stretch;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.worker-input:focus-within {
  border-color: #111;
  box-shadow: 0 0 0 4px rgba(17, 17, 17, 0.08);
}

.worker-input input {
  min-width: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.worker-input input:focus {
  box-shadow: none;
}

.worker-suffix {
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-left: 1px solid var(--border);
  background: #f7f7f7;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.worker-status {
  min-height: 20px;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.worker-status.error {
  color: #b00020;
}

.worker-status.success {
  color: #15803d;
}

.skip-link {
  display: inline-block;
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}

.skip-link:hover {
  color: #111;
  text-decoration: underline;
}

.success-worker {
  margin: 18px 0 18px;
  padding: 14px;
  border: 1px solid #dceee2;
  border-radius: 8px;
  background: #f7fcf8;
  color: #111;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 15px;
  text-align: center;
  overflow-wrap: anywhere;
}

.auth-side {
  display: grid;
  gap: 12px;
}

.side-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
}

.side-card strong {
  display: block;
  margin-bottom: 6px;
  color: #111;
  font-size: 15px;
}

.side-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.mini-email {
  border: 1px solid #e7e7e7;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.mini-email-header {
  padding: 12px 14px;
  border-bottom: 1px solid #ededed;
  background: #fafafa;
  color: #555;
  font-size: 12px;
  line-height: 1.5;
}

.mini-email-body {
  padding: 14px;
  color: #222;
  font-size: 13px;
  line-height: 1.45;
}

.mini-email-body strong {
  margin: 0 0 8px;
  font-size: 13px;
}

@media (max-width: 820px) {
  .auth-flow {
    grid-template-columns: 1fr;
  }

  .auth-side {
    grid-row: 1;
    grid-template-columns: 1fr;
  }

  .auth-side .side-card:not(:first-child) {
    display: none;
  }
}

@media (max-width: 640px) {
  .auth-wrap {
    padding: 16px 0 34px;
  }

  .auth-panel {
    padding: 22px 18px;
    box-shadow: none;
  }

  .auth-wrap h1 {
    font-size: 30px;
  }

  .auth-lede {
    font-size: 16px;
  }

  .terms-note {
    padding-right: 0;
    text-align: center;
  }

  body.auth-page .language-switcher {
    top: 94px;
    right: 16px;
    bottom: auto;
  }

  .code-row {
    gap: 6px;
  }

  .code-row input {
    height: 50px;
    font-size: 20px;
  }

  .worker-input {
    display: block;
  }

  .worker-suffix {
    min-height: 40px;
    border-top: 1px solid var(--border);
    border-left: 0;
  }
}
