/* ForestMail auth app layout. Depends on shared tokens.css + base.css.
   App-specific layout only; components come from the shared system. */

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* App chrome */
.auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--fm-s-3);
  padding: var(--fm-s-4) var(--fm-gutter);
  max-width: 920px;
  width: 100%;
  margin: 0 auto;
}
.auth-main {
  flex: 1;
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: var(--fm-s-4) var(--fm-gutter) var(--fm-s-9);
}
.auth-footer {
  padding: var(--fm-s-6) var(--fm-gutter);
  text-align: center;
  color: var(--fm-text-muted);
  font-size: var(--fm-fs-1);
}

/* Centered single-card flows (sign in, recovery, signup, mfa challenge) */
.auth-center {
  min-height: 60vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.auth-card {
  width: 100%;
  max-width: 440px;
}
.auth-card h1 { font-size: var(--fm-fs-6); }
.auth-card .fm-eyebrow { margin-bottom: var(--fm-s-2); }
.auth-sub { color: var(--fm-text-muted); margin-bottom: var(--fm-s-6); }

/* Wide management flows (sessions, passkeys, app passwords) */
.auth-wide { max-width: 760px; margin: 0 auto; }
.auth-narrow { max-width: 440px; }

/* Account sub-navigation */
.auth-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--fm-s-2);
  margin-bottom: var(--fm-s-6);
  border-bottom: 1px solid var(--fm-line);
  padding-bottom: var(--fm-s-3);
}
.auth-tab {
  padding: 7px 12px;
  border-radius: var(--fm-r-2);
  color: var(--fm-text-soft);
  font-size: var(--fm-fs-2);
  font-weight: 550;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
}
.auth-tab:hover { background: var(--fm-surface-2); text-decoration: none; }
.auth-tab[aria-current="page"] {
  background: var(--fm-green-soft);
  color: var(--fm-green);
  border-color: var(--fm-line);
}

/* Forms */
.auth-form .fm-field:last-of-type { margin-bottom: var(--fm-s-5); }
.auth-actions { display: flex; flex-direction: column; gap: var(--fm-s-3); }
.auth-actions .fm-btn { width: 100%; }
.auth-row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--fm-s-3);
  flex-wrap: wrap;
  margin-top: var(--fm-s-4);
}
.auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--fm-s-4);
  margin-top: var(--fm-s-5);
  font-size: var(--fm-fs-2);
}
.auth-linkbtn {
  background: none;
  border: none;
  color: var(--fm-link);
  cursor: pointer;
  padding: 0;
  font: inherit;
  font-size: var(--fm-fs-2);
}
.auth-linkbtn:hover { text-decoration: underline; }
.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--fm-s-3);
  color: var(--fm-text-muted);
  font-size: var(--fm-fs-1);
  margin: var(--fm-s-5) 0;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--fm-line);
}

/* One-time code input */
.auth-code input {
  font-family: var(--fm-mono);
  letter-spacing: .4em;
  font-size: var(--fm-fs-5);
  text-align: center;
}

/* Recovery / app-password secret reveal */
.auth-secret {
  display: flex;
  align-items: center;
  gap: var(--fm-s-3);
  background: var(--fm-surface-2);
  border: 1px dashed var(--fm-line);
  border-radius: var(--fm-r-2);
  padding: var(--fm-s-3) var(--fm-s-4);
  font-family: var(--fm-mono);
  font-size: var(--fm-fs-3);
  word-break: break-all;
}
.auth-secret .fm-grow { user-select: all; }
.auth-codes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--fm-s-2);
  margin: var(--fm-s-4) 0;
}
.auth-codes li {
  list-style: none;
  font-family: var(--fm-mono);
  font-size: var(--fm-fs-3);
  background: var(--fm-surface-2);
  border: 1px solid var(--fm-line);
  border-radius: var(--fm-r-1);
  padding: 8px 12px;
  text-align: center;
  letter-spacing: .08em;
}

/* QR code */
.auth-qr {
  display: flex;
  justify-content: center;
  padding: var(--fm-s-4);
  background: #ffffff;
  border: 1px solid var(--fm-line);
  border-radius: var(--fm-r-2);
  width: fit-content;
  margin: 0 auto var(--fm-s-4);
}
.auth-qr svg { display: block; width: 200px; height: 200px; image-rendering: pixelated; }

/* SSO provider button */
.auth-provider {
  display: flex;
  align-items: center;
  gap: var(--fm-s-3);
  justify-content: center;
}
.auth-provider .auth-provider-mark {
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--fm-r-1);
  background: var(--fm-info-bg); color: var(--fm-info);
  font-weight: 700; font-size: var(--fm-fs-1);
}

/* Lists on wide pages */
.auth-list { display: grid; gap: var(--fm-s-3); }
.auth-item {
  display: flex;
  align-items: center;
  gap: var(--fm-s-4);
  padding: var(--fm-s-4);
  border: 1px solid var(--fm-line);
  border-radius: var(--fm-r-2);
  background: var(--fm-surface);
}
.auth-item .fm-grow { min-width: 0; }
.auth-item h3 { margin: 0 0 2px; font-size: var(--fm-fs-3); }
.auth-item p { margin: 0; font-size: var(--fm-fs-1); color: var(--fm-text-muted); }
.auth-item-meta { display: flex; gap: var(--fm-s-4); flex-wrap: wrap; }

/* Inline status + notices */
.auth-notice {
  display: flex;
  gap: var(--fm-s-3);
  padding: var(--fm-s-3) var(--fm-s-4);
  border-radius: var(--fm-r-2);
  font-size: var(--fm-fs-2);
  margin-bottom: var(--fm-s-4);
}
.auth-notice-info { background: var(--fm-info-bg); color: var(--fm-info); }
.auth-notice-warn { background: var(--fm-warn-bg); color: var(--fm-warn); }
.auth-notice-ok { background: var(--fm-ok-bg); color: var(--fm-ok); }

.auth-strength { height: 4px; border-radius: 2px; background: var(--fm-line); overflow: hidden; margin-top: 4px; }
.auth-strength > span { display: block; height: 100%; width: 0; transition: width var(--fm-dur), background var(--fm-dur); }

.auth-brand-lockup { display: flex; flex-direction: column; gap: var(--fm-s-5); align-items: center; text-align: center; margin-bottom: var(--fm-s-6); }

@media (max-width: 560px) {
  .auth-codes { grid-template-columns: 1fr; }
  .auth-item { flex-wrap: wrap; }
}

/* Social sign-in row */
.auth-social { margin-top: var(--fm-s-4); }
.auth-social-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: var(--fm-s-3); }
.auth-social-btn { justify-content: center; }
.auth-social-btn:disabled { opacity: .55; cursor: not-allowed; }

/* Keep the strength meter and submit action in separate flow rows. */
.auth-form { display: flex; flex-direction: column; gap: var(--fm-s-4); }
.auth-strength { flex-shrink: 0; margin-bottom: var(--fm-s-3); }

/* Signup: Business / Personal email */
.auth-signup { max-width: 460px; }
.auth-signup h1 { margin-bottom: var(--fm-s-4); }
.auth-radios { display: flex; gap: var(--fm-s-6); margin-bottom: var(--fm-s-5); font-size: var(--fm-fs-3); }
.auth-radios label { display: flex; align-items: center; gap: var(--fm-s-2); cursor: pointer; color: var(--fm-text-soft); }
.auth-radios label:has(input:checked) { color: var(--fm-text); }
.auth-radios input { width: 18px; height: 18px; margin: 0; accent-color: var(--fm-green); }
.auth-signup .auth-form { gap: var(--fm-s-3); }
.auth-signup .auth-box { position: relative; margin: 0; gap: 0; }
.auth-box input { height: 48px; padding-right: 12px; }
.auth-box .auth-box-suffix { position: absolute; right: 6px; top: 6px; height: 36px; display: flex; align-items: center;
  padding: 0 10px; border-radius: var(--fm-r-1, 4px); background: var(--fm-surface-2); color: var(--fm-text-muted); }
.auth-box-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--fm-s-3); }
.auth-signup .auth-form .fm-field:last-of-type { margin-bottom: 0; }
.auth-check { display: flex; align-items: center; gap: var(--fm-s-2); margin: var(--fm-s-2) 0; font-size: var(--fm-fs-2); color: var(--fm-text-soft); cursor: pointer; }
.auth-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--fm-green); }
.auth-signup-btn { width: 100%; height: 48px; font-size: var(--fm-fs-3); font-weight: 650; text-transform: uppercase; letter-spacing: .02em; }
.auth-signup .auth-notice { margin-bottom: var(--fm-s-4); }
.auth-idp { display: flex; align-items: center; justify-content: flex-end; gap: var(--fm-s-3); margin-top: var(--fm-s-5);
  font-size: var(--fm-fs-2); color: var(--fm-text-soft); font-weight: 550; }
.auth-idp > span { margin-right: var(--fm-s-2); }
.auth-idp-btn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px;
  font-weight: 800; font-size: 18px; text-decoration: none; color: #fff; }
.auth-idp-btn:hover { text-decoration: none; filter: brightness(1.08); }
.auth-idp-google { background: #fff; color: #4285f4; border: 1px solid var(--fm-line); }
.auth-idp-facebook { background: #1877f2; border-radius: 50%; }
.auth-idp-linkedin { background: #0a66c2; }
.auth-idp-x { background: #000; }
@media (max-width: 420px) { .auth-idp { justify-content: center; flex-wrap: wrap; } }
.auth-code-field input { font-size: 22px; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }
