:root {
  --tb-ink: #07080a;
  --tb-ink-raised: #0d0f13;
  --tb-ink-soft: #12151a;
  --tb-line: #242832;
  --tb-line-bright: #393f4b;
  --tb-parchment: #ece4cd;
  --tb-parchment-dim: #aaa48f;
  --tb-parchment-muted: #aaa48f;
  --tb-torch: #e0a64a;
  --tb-torch-bright: #f3c266;
  --tb-ember: #c8552e;
  --tb-danger: #ef9274;
  --tb-success: #b7c79c;
  --tb-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --tb-serif: "Cormorant Garamond", "EB Garamond", Georgia, serif;
}

.auth-page,
.auth-page * {
  box-sizing: border-box;
}

.auth-page {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background:
    radial-gradient(70rem 42rem at 12% 30%, rgba(224, 166, 74, 0.08), transparent 65%),
    radial-gradient(40rem 30rem at 95% 88%, rgba(200, 85, 46, 0.06), transparent 72%),
    var(--tb-ink);
  color: var(--tb-parchment);
  font-family: var(--tb-mono);
  line-height: 1.5;
}

.auth-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(255,255,255,0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.01) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 48%, black, transparent 86%);
}

.auth-page::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(110% 90% at 50% 45%, transparent 35%, rgba(0, 0, 0, 0.76) 100%);
}

.auth-page a {
  color: inherit;
  text-decoration: none;
}

.auth-page a:hover {
  text-decoration: none;
}

.auth-topbar {
  width: min(100%, 1320px);
  margin: 0 auto;
  padding: 24px clamp(20px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--tb-parchment-muted);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.auth-brand,
.auth-return {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.auth-brand {
  color: var(--tb-parchment);
  font-weight: 600;
}

.auth-brand-mark {
  color: var(--tb-torch);
  text-shadow: 0 0 18px rgba(243, 194, 102, 0.55);
}

.auth-return {
  transition: color 160ms ease;
}

.auth-return:hover {
  color: var(--tb-parchment);
}

.auth-main {
  width: min(100%, 1240px);
  margin: auto;
  padding: 24px clamp(20px, 4vw, 56px) 48px;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 520px);
  gap: clamp(56px, 8vw, 120px);
  align-items: center;
}

.auth-story {
  max-width: 610px;
}

.auth-eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  color: var(--tb-parchment-muted);
  font-size: 0.69rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.auth-eyebrow::before {
  content: "";
  width: 32px;
  height: 1px;
  background: var(--tb-torch);
  box-shadow: 0 0 12px rgba(224, 166, 74, 0.45);
}

.auth-story h1 {
  margin: 0;
  max-width: 10ch;
  font-family: var(--tb-serif);
  font-size: clamp(3.5rem, 7.4vw, 7.7rem);
  font-style: italic;
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 0.88;
}

.auth-story h1 em {
  color: var(--tb-torch);
  font-weight: inherit;
  text-shadow: 0 0 34px rgba(224, 166, 74, 0.28);
}

.auth-story-copy {
  max-width: 48ch;
  margin: 30px 0 0;
  color: var(--tb-parchment-dim);
  font-family: var(--tb-serif);
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  font-style: italic;
  line-height: 1.65;
}

.auth-principles {
  margin: 42px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  list-style: none;
}

.auth-principles li {
  padding-top: 15px;
  border-top: 1px solid var(--tb-line);
}

.auth-principles strong,
.auth-principles span {
  display: block;
}

.auth-principles strong {
  color: var(--tb-torch);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.auth-principles span {
  margin-top: 8px;
  color: var(--tb-parchment-muted);
  font-family: var(--tb-serif);
  font-size: 1rem;
  font-style: italic;
}

.auth-card {
  position: relative;
  padding: clamp(26px, 4vw, 42px);
  border: 1px solid var(--tb-line);
  background: linear-gradient(145deg, rgba(18, 21, 26, 0.94), rgba(9, 11, 14, 0.97));
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.45);
}

.auth-card::before,
.auth-card::after {
  content: "";
  position: absolute;
  width: 34px;
  height: 34px;
  pointer-events: none;
}

.auth-card::before {
  top: -1px;
  left: -1px;
  border-top: 1px solid var(--tb-torch);
  border-left: 1px solid var(--tb-torch);
}

.auth-card::after {
  right: -1px;
  bottom: -1px;
  border-right: 1px solid var(--tb-torch);
  border-bottom: 1px solid var(--tb-torch);
}

.auth-card-header {
  margin-bottom: 28px;
}

.auth-card-kicker {
  margin: 0 0 8px;
  color: var(--tb-torch);
  font-size: 0.67rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

.auth-card h2 {
  margin: 0;
  font-family: var(--tb-serif);
  font-size: clamp(2.1rem, 5vw, 3rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
}

.auth-card-intro {
  margin: 12px 0 0;
  color: var(--tb-parchment-muted);
  font-size: 0.78rem;
  line-height: 1.65;
}

.auth-alert {
  margin: 0 0 22px;
  padding: 13px 15px;
  display: flex;
  gap: 11px;
  align-items: flex-start;
  border: 1px solid rgba(239, 146, 116, 0.45);
  background: rgba(112, 38, 26, 0.19);
  color: #f4c4b4;
  font-size: 0.78rem;
  line-height: 1.55;
}

.auth-alert-mark {
  flex: 0 0 auto;
  color: var(--tb-danger);
}

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

.auth-provider {
  position: relative;
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid var(--tb-line-bright);
  background: rgba(255, 255, 255, 0.025);
  color: var(--tb-parchment);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  font-family: var(--tb-mono);
  font-size: 0.77rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.auth-provider svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.auth-provider:hover {
  border-color: var(--tb-torch);
  background: rgba(224, 166, 74, 0.08);
  color: var(--tb-torch-bright);
  transform: translateY(-1px);
}

.auth-provider[aria-busy="true"] {
  pointer-events: none;
  border-color: var(--tb-torch);
  color: var(--tb-torch-bright);
}

.auth-provider[aria-busy="true"]::after {
  content: "";
  width: 13px;
  height: 13px;
  border: 1px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: auth-spin 700ms linear infinite;
}

.auth-provider-disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.auth-provider-disabled:hover {
  border-color: var(--tb-line-bright);
  background: rgba(255, 255, 255, 0.025);
  color: var(--tb-parchment);
  transform: none;
}

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

.auth-divider {
  margin: 28px 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  color: var(--tb-parchment-muted);
  font-size: 0.64rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

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

.auth-form {
  display: grid;
  gap: 18px;
}

.auth-field {
  display: grid;
  gap: 7px;
}

.auth-label {
  color: var(--tb-parchment-dim);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.auth-input {
  width: 100%;
  min-height: 52px;
  padding: 0 15px;
  border: 1px solid var(--tb-line-bright);
  border-radius: 0;
  outline: 0;
  background: rgba(4, 5, 7, 0.72);
  color: var(--tb-parchment);
  font: 0.9rem var(--tb-mono);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.auth-input::placeholder {
  color: var(--tb-parchment-dim);
}

.auth-input:hover {
  border-color: #525866;
}

.auth-input:focus-visible {
  border-color: var(--tb-torch);
  box-shadow: 0 0 0 3px rgba(224, 166, 74, 0.17);
  background: rgba(7, 8, 10, 0.96);
}

.auth-form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.auth-checkbox-label {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--tb-parchment-dim);
  font-size: 0.73rem;
  cursor: pointer;
}

.auth-checkbox {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--tb-torch);
}

.auth-submit {
  min-height: 54px;
  padding: 0 22px;
  border: 1px solid var(--tb-torch);
  background: var(--tb-torch);
  color: var(--tb-ink);
  font-family: var(--tb-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 160ms ease, box-shadow 180ms ease, transform 160ms ease;
}

.auth-submit:hover {
  background: var(--tb-torch-bright);
  box-shadow: 0 0 30px rgba(224, 166, 74, 0.23);
  transform: translateY(-1px);
}

.auth-submit:active {
  transform: translateY(0);
}

.auth-submit:disabled {
  cursor: wait;
  opacity: 0.65;
}

.auth-signup {
  margin: 23px 0 0;
  color: var(--tb-parchment-muted);
  font-size: 0.74rem;
  text-align: center;
}

.auth-text-link {
  min-height: 44px;
  padding: 0 3px;
  display: inline-flex;
  align-items: center;
  color: var(--tb-torch) !important;
  text-underline-offset: 4px;
}

.auth-text-link:hover {
  color: var(--tb-torch-bright) !important;
  text-decoration: underline !important;
}

.auth-page :where(a, button, input):focus-visible {
  outline: 2px solid var(--tb-torch-bright);
  outline-offset: 3px;
}

.auth-input:focus-visible {
  outline: 0;
}

.auth-footer {
  padding: 22px clamp(20px, 4vw, 56px) 28px;
  color: var(--tb-parchment-muted);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
}

@media (max-width: 940px) {
  .auth-shell {
    grid-template-columns: 1fr;
    gap: 38px;
  }

  .auth-story {
    max-width: 720px;
  }

  .auth-story h1 {
    max-width: 12ch;
    font-size: clamp(3.4rem, 12vw, 6.4rem);
  }

  .auth-card {
    width: 100%;
    max-width: 620px;
  }
}

@media (max-width: 620px) {
  .auth-topbar {
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .auth-return-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .auth-main {
    padding-top: 16px;
    padding-bottom: 28px;
  }

  .auth-story h1 {
    font-size: clamp(3.2rem, 18vw, 4.8rem);
  }

  .auth-story-copy {
    margin-top: 20px;
  }

  .auth-principles {
    display: none;
  }

  .auth-card {
    padding: 28px 20px;
  }

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

  .auth-form-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .auth-footer {
    padding-top: 10px;
  }
}

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

@media (forced-colors: active) {
  .auth-card,
  .auth-provider,
  .auth-input,
  .auth-submit,
  .auth-alert {
    border: 1px solid CanvasText;
  }

  .auth-provider-disabled {
    color: GrayText;
  }
}

.account-connections {
  margin: 0 0 24px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border: 1px solid var(--tb-line);
  background: var(--tb-ink-raised);
  color: var(--tb-parchment);
  font-family: var(--tb-mono);
}

.account-connections h2 {
  margin: 0;
  font: 600 1rem var(--tb-mono);
}

.account-connections p {
  margin: 6px 0 0;
  color: var(--tb-parchment-muted);
  font-size: 0.73rem;
}

.account-connections-list {
  min-width: 220px;
  display: grid;
  gap: 8px;
}

.account-connection {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--tb-parchment-dim);
  font-size: 0.75rem;
}

.account-connection a {
  min-height: 36px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--tb-torch);
  color: var(--tb-torch);
}

.account-connection a:focus-visible {
  outline: 2px solid var(--tb-torch-bright);
  outline-offset: 2px;
}

.account-connection-status {
  color: var(--tb-success);
}

.account-connection-disabled {
  color: var(--tb-parchment-muted);
}

@media (max-width: 620px) {
  .account-connections {
    align-items: stretch;
    flex-direction: column;
  }

  .account-connections-list {
    min-width: 0;
  }
}
