/* ==========================================================================
   Hufan — authentication
   ========================================================================== */

.auth-shell { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(460px, 1fr); min-height: 100vh; min-height: 100dvh; }

/* Media side */
.auth-media { position: sticky; top: 0; height: 100vh; height: 100dvh; padding: 14px 0 14px 14px; }
.auth-frame { position: relative; height: 100%; border-radius: 24px; overflow: hidden; background: #1a1a1a; isolation: isolate; }
.auth-slide { position: absolute; inset: 0; opacity: 0; transition: opacity 1200ms var(--ease); }
.auth-slide.is-on { opacity: 1; }
.auth-slide img, .auth-slide video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.auth-slide video { opacity: 0; transition: opacity 600ms var(--ease); background: transparent; }
.auth-slide.is-playing video { opacity: 1; }
.auth-frame::after { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; background: linear-gradient(to bottom, rgba(0,0,0,0.3), rgba(0,0,0,0) 20%, rgba(0,0,0,0) 48%, rgba(0,0,0,0.42) 70%, rgba(0,0,0,0.72)); }
.auth-media-top { position: absolute; z-index: 3; left: 24px; right: 24px; top: 22px; display: flex; justify-content: space-between; align-items: center; }
.auth-media-top .logo { color: #fff; }
.auth-media-top .logo-mark rect { fill: #fff; }
.auth-media-top .logo-mark path { stroke: #111; }
.auth-segs { display: flex; gap: 4px; width: 120px; }
.auth-segs i { flex: 1; height: 2px; border-radius: 2px; background: rgba(255,255,255,0.3); overflow: hidden; position: relative; }
.auth-segs i b { position: absolute; inset: 0; width: 0; background: #fff; }
.auth-segs i.is-done b { width: 100%; }
.auth-segs i.is-on b { animation: seg var(--dur, 6s) linear forwards; }
@keyframes seg { to { width: 100%; } }
.auth-caption { position: absolute; z-index: 3; left: 28px; right: 28px; bottom: 28px; color: #fff; display: grid; gap: 12px; max-width: 520px; }
.auth-caption .k { font-size: 12px; color: rgba(255,255,255,0.7); display: flex; gap: 8px; align-items: center; }
.auth-caption h2 { font-size: 30px; font-weight: 500; letter-spacing: -0.035em; line-height: 1.1; }
.auth-caption p { font-size: 14px; line-height: 1.55; color: rgba(255,255,255,0.8); }
.auth-caption-inner { transition: opacity 500ms var(--ease), transform 600ms var(--ease-out); }
.auth-caption-inner.is-out { opacity: 0; transform: translateY(6px); }

/* Form side */
.auth-main { display: flex; flex-direction: column; padding: 26px 44px 28px; min-height: 100vh; min-height: 100dvh; }
.auth-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; font-size: 13.5px; }
.auth-top .back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); transition: color var(--t) var(--ease); }
.auth-top .back:hover { color: var(--ink); }
.auth-top .back .i { width: 16px; height: 16px; }
.auth-form-wrap { width: min(380px, 100%); margin: auto; padding: 48px 0; display: grid; gap: 28px; }
.auth-head { display: grid; gap: 22px; }
.auth-title { font-size: 34px; letter-spacing: -0.038em; line-height: 1.08; font-weight: 500; }
.auth-sub { font-size: 15px; color: var(--muted); margin-top: -12px; }
.auth-form { display: grid; gap: 16px; }
.auth-form .field { gap: 7px; }
.field-row { display: flex; justify-content: space-between; align-items: baseline; }
.pw-toggle { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; color: var(--faint); transition: color var(--t) var(--ease), background-color var(--t) var(--ease); }
.pw-toggle:hover { color: var(--ink); background: var(--s3); }
.pw-meter { display: flex; gap: 4px; margin-top: 2px; }
.pw-meter i { flex: 1; height: 3px; border-radius: 3px; background: var(--s4); transition: background-color var(--t) var(--ease); }
.pw-meter[data-s="1"] i:nth-child(-n+1), .pw-meter[data-s="2"] i:nth-child(-n+2), .pw-meter[data-s="3"] i:nth-child(-n+3), .pw-meter[data-s="4"] i:nth-child(-n+4) { background: var(--ink); }
.auth-or { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--faint); }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-oauth { display: grid; gap: 8px; }
.auth-oauth .btn { justify-content: center; }
.auth-oauth .btn .i { width: 18px; height: 18px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.auth-foot { text-align: center; font-size: 12px; color: var(--faint); }
.auth-foot a { color: var(--muted); text-decoration: underline; text-decoration-color: var(--line-3); text-underline-offset: 2px; }
.auth-pending { display: flex; gap: 12px; padding: 12px; border-radius: 13px; background: var(--s1); border: 1px solid var(--line); }
.auth-pending .dir { width: 28px; height: 28px; border-radius: 8px; background: var(--ink); color: #fff; display: grid; place-items: center; flex: none; }
.auth-pending .dir .i { width: 15px; height: 15px; }
.auth-pending b { display: block; font-size: 13px; font-weight: 500; }
.auth-pending span { font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.auth-sent { display: grid; gap: 14px; justify-items: start; }
.auth-sent .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--s3); display: grid; place-items: center; }
.swap-in { animation: riseSm 450ms var(--ease-out) both; }

@media (max-width: 1000px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-media { position: relative; height: 38vh; min-height: 260px; padding: 10px 10px 0; }
  .auth-frame { border-radius: 20px; }
  .auth-caption { left: 20px; right: 20px; bottom: 18px; gap: 6px; }
  .auth-caption h2 { font-size: 22px; }
  .auth-caption p { display: none; }
  .auth-main { min-height: 0; padding: 18px 20px 28px; }
  .auth-top .back { display: none; }
  .auth-form-wrap { padding: 28px 0 36px; }
  .auth-title { font-size: 30px; }
}

/* ==========================================================================
   Registration steps (signup.js) — same tokens, inputs, buttons and cards as the site
   ========================================================================== */
.su { width: min(420px, 100%); gap: 24px; }
.su-step { display: grid; gap: 24px; }
.su-head { gap: 0; }
.su .auth-title { font-size: 30px; }
.su .auth-sub { margin-top: 0; line-height: 1.5; }
.su .input-lg { height: 52px; font-size: 16px; }
.su-progress { display: grid; gap: 10px; font-size: 12.5px; color: var(--muted); }
.su-progress b { font-weight: 500; color: var(--ink); }
.su-bars { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.su-bars i { height: 3px; border-radius: 3px; background: var(--s4); overflow: hidden; position: relative; }
.su-bars i.is-done { background: var(--ink); }
.su-bars i.is-on::after { content: ""; position: absolute; inset: 0; width: 55%; border-radius: inherit; background: var(--ink); animation: riseSm 400ms var(--ease-out) both; }
.su-back { display: inline-flex; align-items: center; gap: 6px; justify-self: center; font-size: 13.5px; color: var(--muted); }
.su-back:hover { color: var(--ink); }
.su-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13.5px; }
.su-row .link[disabled] { color: var(--faint); cursor: default; text-decoration: none; }
.su-row .link.is-attn { color: var(--ink); font-weight: 500; }
.input-prefix { display: flex; align-items: stretch; }
.input-prefix > span { display: flex; align-items: center; gap: 8px; padding: 0 14px; border: 1px solid var(--line-2); border-right: 0; border-radius: 11px 0 0 11px; background: var(--s2); font-size: 15px; color: var(--ink-2); white-space: nowrap; }
.input-prefix > span b { font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em; padding: 3px 5px; border-radius: 5px; background: #fff; border: 1px solid var(--line); color: var(--muted); }
.input-prefix .input { border-radius: 0 11px 11px 0; letter-spacing: 0.02em; }
/* 6 code boxes */
.su-code { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.su-code .input { height: 58px; padding: 0; text-align: center; font-size: 24px; font-weight: 500; font-variant-numeric: tabular-nums; }
.su-code-err { margin-top: -8px; text-align: center; }
/* plans */
.su-cycle { width: 100%; display: grid; grid-template-columns: 1fr 1fr; background: var(--s4); }
.su-plans { display: grid; gap: 10px; }
.su-plan { display: flex; align-items: flex-start; gap: 14px; width: 100%; padding: 16px; border: 1px solid var(--line-2); border-radius: 14px; background: #fff; text-align: left; cursor: pointer; transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease), transform var(--t) var(--ease); }
.su-plan:hover { border-color: var(--line-3); }
.su-plan:active { transform: translateY(1px); }
.su-plan.is-on { border-color: var(--ink); box-shadow: inset 0 0 0 0.5px var(--ink), var(--sh-1); }
.su-radio { flex: none; width: 18px; height: 18px; margin-top: 2px; border-radius: 50%; border: 1.5px solid var(--line-3); transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease); }
.su-plan.is-on .su-radio { border-color: var(--ink); box-shadow: inset 0 0 0 4px #fff, inset 0 0 0 9px var(--ink); }
.su-plan-body { display: grid; gap: 4px; min-width: 0; flex: 1; }
.su-plan-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.su-plan-top b { font-size: 15.5px; font-weight: 500; }
.su-price { font-size: 20px; font-weight: 500; letter-spacing: -0.02em; white-space: nowrap; }
.su-price small { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 2px; letter-spacing: 0; }
.su-plan-sub { font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.su-plan-then { font-size: 13px; color: var(--ink-2); }
.su-plan-then b { font-weight: 500; }
.su-trial-note { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--s1); font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.su-trial-note .i { flex: none; margin-top: 2px; color: var(--accent, var(--ink)); }
.su-trial-note b { font-weight: 500; color: var(--ink); }
/* price and renewal terms: must be ticked before paying */
.su-consent { align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; font-size: 12.5px; line-height: 1.5; color: var(--ink-2); }
.su-consent input { flex: none; margin-top: 2px; }
.su-consent b { font-weight: 500; color: var(--ink); }
.su-consent.is-invalid { border-color: #b3261e; box-shadow: 0 0 0 4px rgba(179,38,30,0.08); }
/* checkout */
.su-summary { display: grid; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--s1); }
.su-sum-row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; font-size: 13.5px; }
.su-sum-row span { color: var(--muted); flex: none; }
.su-sum-row b { font-weight: 500; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.su-total { padding-top: 10px; border-top: 1px solid var(--line); }
.su-total b { font-size: 22px; letter-spacing: -0.025em; }
.su-summary .link { justify-self: start; }
.su-evc { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.su-evc-row { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto auto; align-items: center; gap: 8px 12px; padding: 13px 14px; border-top: 1px solid var(--line); }
.su-evc-row:first-child { border-top: 0; }
.su-evc-row .k { font-size: 12px; color: var(--muted); }
.su-evc-row .v { display: grid; gap: 1px; min-width: 0; }
.su-evc-row .v b { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.su-evc-row .v b.mono { font-size: 14px; }
.su-evc-row .v span { font-size: 11.5px; color: var(--muted); }
.su-dial { display: none; }
@media (hover: none) and (pointer: coarse) { .su-dial { display: inline-flex; } .su-evc-row:last-child [data-copy] { display: none; } }
.su-label { font-size: 13px; font-weight: 500; }
.su-safe { display: flex; gap: 8px; font-size: 12px; line-height: 1.5; color: var(--muted); }
.su-safe .i { flex: none; margin-top: 2px; }
/* states: verified, pending, ready */
.su-state { display: grid; gap: 20px; justify-items: stretch; }
.su-state-ic { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--s2); position: relative; }
.su-state-ic .i { width: 24px; height: 24px; }
.su-state-ic.is-ok { background: #eaf6ef; color: #2f9e5b; }
.su-state-ic.is-wait::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--accent); animation: spin 1.4s linear infinite; }
.su-ok { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; font-size: 11.5px; font-weight: 500; color: #2f9e5b; }
/* onboarding questions */
.su-q { display: grid; gap: 22px; }
.su-q-n { font-size: 12.5px; color: var(--muted); }
.su-chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.su-chip { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 13px; background: #fff; font-size: 14px; font-weight: 500; color: var(--ink); text-align: left; cursor: pointer; transition: border-color var(--t) var(--ease), background-color var(--t) var(--ease), box-shadow var(--t) var(--ease), transform var(--t) var(--ease); }
.su-chip:hover { border-color: var(--line-3); }
.su-chip:active { transform: translateY(1px); }
.su-chip.is-on { border-color: var(--ink); background: var(--s1); box-shadow: inset 0 0 0 0.5px var(--ink); }
.su-tick { flex: none; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--line-3); color: transparent; transition: all var(--t) var(--ease); }
.su-chip.is-on .su-tick { background: var(--ink); border-color: var(--ink); color: #fff; }
/* phones: the photo on top only on the first step, big tap targets, nothing wider than the screen */
@media (max-width: 1000px) {
  body.su-compact .auth-media { display: none; }
  body.su-compact .auth-main { padding-top: 14px; }
  body.su-compact .su { margin: 6px auto 0; }
  .su { padding: 18px 0 28px; }
}
@media (max-width: 420px) {
  .su .auth-title { font-size: 26px; }
  .su-code { gap: 6px; }
  .su-code .input { height: 52px; font-size: 22px; }
  .su-evc-row { grid-template-columns: minmax(0, 1fr) auto auto; }
  .su-evc-row .k { grid-column: 1 / -1; }
  .su-chip { min-height: 50px; font-size: 13.5px; }
}
