/* Auth flow — navy-stage email-code sign-in.
   Inherits RedBit type & color tokens via the parent CSS imports. */

/* ===== artboard frame =================================================== */
.auth-frame {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  font-family: var(--font-body);
  color: var(--fg-1);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(80% 60% at 50% 0%, #1A4763 0%, var(--rb-navy) 60%, var(--rb-navy-deep) 100%);
}
.auth-frame::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(237,242,244,0.06) 1px, transparent 0);
  background-size: 14px 14px;
  pointer-events: none;
}

.auth-stage {
  flex: 1 1 auto;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 1;
}

/* ===== shared form primitives =========================================== */
.auth-eyebrow {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.20em;
  color: var(--fg-3);
}
.auth-title {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.06;
  color: var(--rb-navy);
  margin: 0;
}
.auth-sub {
  font-family: var(--font-body);
  color: var(--fg-2);
  margin: 0;
  line-height: 1.45;
}

.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--rb-navy);
  letter-spacing: 0.01em;
}
.auth-field__hint {
  font-size: 11px;
  color: var(--fg-3);
}

.auth-input {
  font: inherit;
  font-size: 14px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--rb-steel-300);
  border-radius: var(--radius-md);
  color: var(--rb-steel-900);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
  box-sizing: border-box;
}
.auth-input:hover { border-color: var(--rb-steel-400); }
.auth-input:focus {
  border-color: var(--rb-navy);
  box-shadow: 0 0 0 3px rgba(0,48,73,0.10);
}
.auth-input::placeholder { color: var(--rb-steel-400); }

.auth-btn {
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  padding: 13px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  letter-spacing: 0.005em;
  transition: background .12s, border-color .12s, color .12s, transform .06s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}
.auth-btn:active { transform: translateY(1px); }
.auth-btn--primary { background: var(--rb-navy); color: #fff; }
.auth-btn--primary:hover { background: var(--rb-navy-deep); }
.auth-btn--primary:disabled { background: var(--rb-steel-300); cursor: not-allowed; }

.auth-btn--ghost {
  background: transparent;
  color: var(--rb-navy);
  border-color: var(--rb-steel-300);
}
.auth-btn--ghost:hover { background: var(--rb-cream); border-color: var(--rb-steel-400); }

.auth-link {
  background: none; border: 0; padding: 0;
  font: inherit; font-size: 13px;
  color: var(--rb-navy);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  cursor: pointer;
}
.auth-link:hover { color: var(--rb-red); text-decoration-color: var(--rb-red); }
.auth-link--muted { color: var(--fg-3); }

.auth-rule {
  display: flex; align-items: center; gap: 12px;
  color: var(--fg-3); font-size: 11px;
  letter-spacing: 0.18em; text-transform: uppercase; font-weight: 700;
}
.auth-rule::before, .auth-rule::after {
  content: ""; flex: 1; height: 1px; background: var(--rule-light);
}

.auth-error {
  font-size: 12px;
  color: var(--rb-red);
  display: flex; align-items: center; gap: 6px;
  margin-top: 4px;
}
.auth-error::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--rb-red);
}

/* ===== code input row =================================================== */
.auth-code-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}
.auth-code-row input {
  font: inherit;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 24px;
  text-align: center;
  text-transform: uppercase;
  height: 56px;
  width: 100%;
  min-width: 0;
  padding: 0;
  box-sizing: border-box;
  border-radius: var(--radius-md);
  border: 1px solid var(--rb-steel-300);
  background: #fff;
  color: var(--rb-navy);
  outline: none;
  transition: border-color .12s, box-shadow .12s, background .12s;
  caret-color: var(--rb-red);
}
.auth-code-row input:hover { border-color: var(--rb-steel-400); }
.auth-code-row input:focus {
  border-color: var(--rb-navy);
  box-shadow: 0 0 0 3px rgba(0,48,73,0.10);
}
.auth-code-row input:not(:placeholder-shown) { background: var(--rb-cream); }

.auth-code-row--big input { height: 68px; font-size: 28px; }
.auth-code-row--ghost input {
  border-radius: 0;
  border: 0;
  border-bottom: 2px solid var(--rb-steel-300);
  background: transparent;
}
.auth-code-row--ghost input:focus {
  border-bottom-color: var(--rb-navy);
  box-shadow: none;
}
.auth-code-row--ghost input:not(:placeholder-shown) {
  background: transparent;
  border-bottom-color: var(--rb-red);
}
.auth-code-row--error input { border-color: var(--rb-red); }
.auth-code-row--error input:focus { box-shadow: 0 0 0 3px rgba(212,33,39,0.12); }

/* Countdown chip */
.auth-countdown {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-2);
  background: var(--rb-steel-100);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  border: 1px solid var(--rule-light);
}
.auth-countdown__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--rb-red);
  animation: auth-pulse 1.4s ease-in-out infinite;
}
.auth-countdown--expired { color: var(--rb-red); }
.auth-countdown--expired .auth-countdown__dot { background: var(--rb-steel-400); animation: none; }

@keyframes auth-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.7); }
}

/* Paste hint */
.auth-paste {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px;
  color: var(--fg-3);
}
.auth-paste kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  background: #fff;
  border: 1px solid var(--rule-light);
  border-radius: 3px;
  padding: 2px 5px;
  color: var(--rb-navy);
  box-shadow: 0 1px 0 rgba(10,10,10,0.05);
}

/* Email pill on the code page */
.auth-email-pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px;
  font-family: var(--font-mono);
  background: var(--rb-cream);
  border: 1px solid var(--rule-light);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  color: var(--rb-navy);
}

/* Success state */
.auth-success-mark {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--rb-navy);
  color: var(--rb-cream);
  margin: 0 auto;
}
.auth-success-mark svg { width: 28px; height: 28px; }

.auth-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: var(--radius-xl);
  padding: 32px 32px 28px;
  box-shadow:
    0 32px 80px -16px rgba(0,0,0,0.55),
    0 0 0 1px rgba(255,255,255,0.06);
  display: flex; flex-direction: column; gap: 20px;
  position: relative;
}
.auth-lockup {
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule-soft);
}
.auth-lockup .auth-logo-mark { width: 24px; height: 24px; }
.auth-lockup .auth-logo-word {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.02em;
  font-size: 15px;
  color: var(--rb-navy);
}
.auth-lockup .auth-logo-word b { color: var(--rb-red); }
.auth-heading { display: flex; flex-direction: column; gap: 6px; }
.auth-heading .auth-title { font-size: 24px; }
.auth-heading .auth-sub { font-size: 13px; }

.auth-below {
  margin-top: 18px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: rgba(237,242,244,0.6);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-align: center;
}
.auth-below .auth-link { color: var(--rb-cream); font-size: 12px; }
.auth-below .auth-link:hover { color: #fff; }

.auth-codetop {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; flex-wrap: wrap;
}

/* ============================================================== */
/* Logo helpers — inline SVG marks                                 */
/* ============================================================== */
.auth-logo-mark { display: block; }

/* ================================================================== */
/* BuiltByRedBit credit                                                */
/* Ported from deliverable/report-viewer/tokens/handbook.css (225-323) */
/* ================================================================== */
.hb-builtby {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin: auto 0 0;
  padding: var(--space-4) var(--space-3) 0;
  border-top: 1px solid var(--rule-light);
  color: var(--fg-3);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  border-radius: var(--radius-sm);
  text-align: center;
  transition: background 80ms ease, color 80ms ease;
}
.hb-builtby:hover { background: var(--rb-cream); color: var(--fg-1); }
.hb-builtby:focus-visible {
  outline: 2px solid var(--rb-red);
  outline-offset: 2px;
}

.hb-builtby-text {
  white-space: pre;
  display: inline-flex;
  align-items: center;
}
.hb-builtby-text.has-caret::after {
  content: "";
  display: inline-block;
  width: 1px;
  height: 11px;
  margin-left: 2px;
  background: currentColor;
  animation: hb-builtby-caret 900ms steps(1) infinite;
}

.hb-builtby-logo {
  height: 24px;
  width: auto;
  display: block;
  opacity: 0;
  animation-fill-mode: forwards;
  animation-duration: 480ms;
  animation-timing-function: ease-out;
  animation-delay: calc(var(--hb-builtby-type-ms, 480ms) + 150ms);
}

.hb-builtby[data-anim="fade"] .hb-builtby-logo {
  animation-name: hb-builtby-fade-in;
}
.hb-builtby[data-anim="wipe"] .hb-builtby-logo {
  animation-name: hb-builtby-wipe-in;
  animation-duration: 600ms;
}
.hb-builtby[data-anim="fill"] .hb-builtby-logo {
  opacity: 1;
  animation: none;
}
.hb-builtby[data-anim="fill"] .hb-builtby-fill-overlay {
  clip-path: inset(0 100% 0 0);
  animation: hb-builtby-fill-in 700ms ease-out forwards;
  animation-delay: calc(var(--hb-builtby-type-ms, 480ms) + 150ms);
}

@keyframes hb-builtby-caret {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
@keyframes hb-builtby-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes hb-builtby-wipe-in {
  from { opacity: 1; clip-path: inset(0 100% 0 0); }
  to   { opacity: 1; clip-path: inset(0 0 0 0); }
}
@keyframes hb-builtby-fill-in {
  from { clip-path: inset(0 100% 0 0); }
  to   { clip-path: inset(0 0 0 0); }
}

@media (prefers-reduced-motion: reduce) {
  .hb-builtby-text.has-caret::after { animation: none; opacity: 0; }
  .hb-builtby-logo { opacity: 1; animation: none; clip-path: none; transform: none; }
  .hb-builtby-fill-overlay { animation: none; clip-path: none; }
}

/* ===== Navy-stage slot overrides ===================================== */
/* The credit sits on the navy auth stage, not a light card surface.    */
/* These overrides flip the colors and position the credit where the    */
/* old "Help & support" link used to live.                              */
.auth-builtby-slot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  z-index: 2;
  display: flex;
  justify-content: center;
}
.auth-builtby-slot .hb-builtby {
  color: rgba(237, 242, 244, 0.75);
  border-top: 0;
  padding: 6px 12px;
  margin: 0;
}
.auth-builtby-slot .hb-builtby:hover {
  background: transparent;
  color: #fff;
}
/* Fill variant base layer (grey on white) needs to read on navy. The   */
/* second <g> (.hb-builtby-fill-overlay) keeps its red paint as-is.     */
.auth-builtby-slot .hb-builtby svg > g:first-of-type path,
.auth-builtby-slot .hb-builtby svg > g:first-of-type polygon {
  fill: rgba(237, 242, 244, 0.55);
}
