/* ==========================================================================
   HAPTAGS LLP — CUSTOMER LOGIN & ACCOUNT PAGES
   One-time-code sign-in by email or SMS (login.html) and the unsubscribe page.
   Reuses design-system.css tokens and .btn styles.
   ========================================================================== */

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.auth-header {
  border-bottom: 1px solid var(--border-card);
  background: var(--bg-primary);
}

.auth-header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
}

.auth-brand img {
  height: 32px;
  width: auto;
}

.auth-header-link {
  font-size: 0.88rem;
  color: var(--text-secondary);
  text-decoration: none;
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
}

.auth-header-link:hover {
  color: var(--brand-blue);
}

.auth-main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 56px 16px 80px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card-solid);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
}

.auth-card-wide {
  max-width: 640px;
}

.auth-eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-blue);
  margin-bottom: 10px;
}

.auth-card h1 {
  font-size: clamp(1.6rem, 5vw, 2rem);
  margin-bottom: 10px;
}

.auth-lede {
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 26px;
}

.auth-lede strong {
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

/* Email / Phone switch (shown only when SMS sign-in is set up) */
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 22px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
  background: var(--bg-secondary);
}

.auth-tab {
  padding: 9px 12px;
  border: none;
  border-radius: calc(var(--radius-md) - 4px);
  background: none;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

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

.auth-tab[aria-selected="true"] {
  background: var(--bg-card-solid);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.auth-tab:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
}

.auth-note {
  margin-top: 16px;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--text-muted);
  text-align: center;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.auth-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.auth-input {
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  outline: none;
  transition: all var(--transition-fast);
}

.auth-input:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  background: var(--bg-card-solid);
}

.auth-input[aria-invalid="true"] {
  border-color: var(--brand-rose);
}

.auth-otp-input {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: 0.5em;
  text-align: center;
  /* Offsets the trailing letter-spacing so the digits sit visually centred */
  padding-left: calc(16px + 0.5em);
}

.auth-submit {
  width: 100%;
}

.auth-submit[disabled] {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

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

.auth-link-btn {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--brand-blue);
  cursor: pointer;
}

.auth-link-btn[disabled] {
  color: var(--text-muted);
  cursor: default;
}

.auth-message {
  font-size: 0.88rem;
  line-height: 1.5;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 18px;
}

.auth-message:empty {
  display: none;
}

.auth-message[data-kind="error"] {
  color: var(--brand-rose);
  background: rgba(225, 29, 72, 0.08);
  border: 1px solid rgba(225, 29, 72, 0.25);
}

.auth-message[data-kind="success"] {
  color: var(--brand-emerald);
  background: rgba(5, 150, 105, 0.08);
  border: 1px solid rgba(5, 150, 105, 0.25);
}

.auth-help {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.84rem;
  color: var(--text-muted);
  text-align: center;
}

.auth-help a {
  color: var(--brand-blue);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

[hidden] {
  display: none !important;
}

@media (max-width: 560px) {
  .auth-main {
    padding: 28px 16px 56px;
  }

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

  .auth-header-inner {
    padding: 14px 16px;
  }
}
