:root {
  --bg: #fafaf8;
  --bg-elevated: #ffffff;
  --bg-muted: #f5f5f3;
  --text: #1d1d1f;
  --text-body: #55585c;
  --text-muted: #86868b;
  --border: #e8e8e6;
  --border-strong: rgba(0, 0, 0, 0.1);
  --accent: #1d1d1f;
  --danger: #c0392b;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.03);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px 48px;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.02em;
  animation: auth-in 420ms var(--ease-out) both;
}

.auth-brand img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 36px 32px 32px;
  animation: auth-in 420ms var(--ease-out) both;
}

@keyframes auth-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.auth-card h1 {
  margin: 0 0 8px;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.03em;
  font-weight: 600;
}

.auth-lede {
  margin: 0 0 28px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-body);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.auth-field {
  position: relative;
}

.auth-input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--bg-elevated);
}

.auth-field .auth-input {
  padding-right: 52px;
}

.auth-input:focus {
  outline: none;
  border-color: var(--text);
}

.auth-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 8px;
  cursor: pointer;
}

.auth-toggle:hover {
  color: var(--text);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 15px;
  font-weight: 550;
  letter-spacing: -0.015em;
  cursor: pointer;
  background: var(--text);
  color: #fff;
  transition: opacity 140ms var(--ease), transform 140ms var(--ease-out);
}

.btn:hover:not(:disabled) {
  opacity: 0.88;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.auth-error {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--danger);
}

.auth-success {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-body);
}

.auth-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: #1f8a4c;
  color: #fff;
  box-shadow: 0 8px 24px rgba(31, 138, 76, 0.28);
}

.auth-mark[hidden] {
  display: none;
}

.auth-card.is-authorized {
  text-align: center;
  border-color: rgba(31, 138, 76, 0.28);
  box-shadow: 0 0 0 5px rgba(31, 138, 76, 0.1), var(--shadow-sm);
  padding-top: 40px;
}

.auth-card.is-authorized h1 {
  font-size: 30px;
  letter-spacing: -0.035em;
}

.auth-card.is-authorized .auth-lede {
  margin-bottom: 16px;
}

.auth-card.is-authorized .auth-success {
  display: inline-block;
  margin-top: 4px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(31, 138, 76, 0.12);
  color: #176b3a;
  font-size: 14px;
  font-weight: 650;
}

.auth-links {
  margin: 22px 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
  color: var(--text-body);
}

.auth-links a {
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
}

.auth-links a:hover {
  text-decoration: underline;
}

.auth-muted {
  color: var(--text-muted);
}

.auth-code {
  margin: 0 0 20px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-align: center;
  color: var(--text);
}

@media (prefers-reduced-motion: reduce) {
  .auth-brand,
  .auth-card {
    animation: none;
  }

  .btn:active:not(:disabled) {
    transform: none;
  }
}
