/* ============================================================
   Knowell — Auth (登录 / 注册) page
   ============================================================ */
body.auth-body { background: var(--navy-900); }

.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }

/* ---------- left brand showcase ---------- */
.auth-brand { position: relative; overflow: hidden; background: var(--navy-900); color: #fff; display: flex; flex-direction: column; padding: 48px 56px; }
.auth-brand .mesh { position: absolute; inset: -20%; background: radial-gradient(46% 50% at 26% 28%, rgba(0,114,255,.45), transparent 60%), radial-gradient(42% 46% at 82% 24%, rgba(0,198,255,.34), transparent 60%), radial-gradient(54% 60% at 70% 92%, rgba(121,40,202,.3), transparent 60%); filter: blur(18px); animation: meshDrift 22s ease-in-out infinite alternate; }
.auth-brand .grid-tex { position: absolute; inset: 0; background-image: linear-gradient(rgba(120,190,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(120,190,255,.06) 1px, transparent 1px); background-size: 50px 50px; mask-image: radial-gradient(120% 100% at 40% 30%, #000 30%, transparent 80%); }
.auth-brand .ecg { position: absolute; left: 0; right: 0; bottom: 16%; height: 160px; opacity: .5; }
.auth-brand .ecg path { fill: none; stroke: url(#authEcg); stroke-width: 2.4; stroke-dasharray: 1600; stroke-dashoffset: 1600; animation: ecgDraw 6s linear infinite; filter: drop-shadow(0 0 6px rgba(0,198,255,.6)); }
.auth-brand .veil { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10,25,47,.3), rgba(10,25,47,.7)); }
.auth-brand > * { position: relative; z-index: 2; }
.auth-brand .top { display: flex; align-items: center; gap: 12px; }
.auth-brand .logo-mark { width: 44px; height: 44px; border-radius: 13px; background: var(--grad); display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0,114,255,.45); }
.auth-brand .logo-mark svg { width: 26px; height: 26px; }
.auth-brand .bt b { font-size: 22px; font-weight: 800; letter-spacing: -.5px; display: block; line-height: 1; }
.auth-brand .bt span { font-family: var(--mono); font-size: 10px; letter-spacing: 1.6px; color: var(--cyan); }
.auth-brand .center { margin-top: auto; margin-bottom: auto; max-width: 440px; }
.auth-brand .badge { display: inline-flex; align-items: center; gap: 9px; font-family: var(--mono); font-size: 12px; letter-spacing: 1px; color: var(--cyan); background: rgba(0,198,255,.1); border: 1px solid rgba(0,198,255,.3); padding: 7px 14px; border-radius: var(--r-pill); margin-bottom: 24px; }
.auth-brand .badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(82,196,26,.25); animation: blink 1.6s infinite; }
.auth-brand h2 { font-size: clamp(30px, 3.4vw, 46px); font-weight: 800; letter-spacing: -1px; line-height: 1.12; }
.auth-brand .slogan { margin-top: 16px; font-size: 18px; color: rgba(255,255,255,.82); line-height: 1.6; }
.auth-brand .points { margin-top: 34px; display: flex; flex-direction: column; gap: 16px; }
.auth-brand .pt { display: flex; align-items: center; gap: 14px; }
.auth-brand .pt .pi { width: 40px; height: 40px; border-radius: 11px; background: rgba(255,255,255,.06); border: 1px solid var(--navy-line); color: var(--cyan); display: grid; place-items: center; flex-shrink: 0; }
.auth-brand .pt .pi svg { width: 20px; height: 20px; }
.auth-brand .pt b { font-size: 15px; font-weight: 600; }
.auth-brand .pt span { font-size: 13px; color: rgba(255,255,255,.6); display: block; }
.auth-brand .foot { font-size: 12.5px; color: rgba(255,255,255,.5); }
.auth-brand .foot a { color: rgba(255,255,255,.75); }
.auth-brand .foot a:hover { color: var(--cyan); }

/* ---------- right form panel ---------- */
.auth-panel { background: #fff; display: flex; flex-direction: column; padding: 40px 56px; overflow-y: auto; }
.auth-panel .panel-top { display: flex; align-items: center; justify-content: space-between; }
.auth-panel .mini-brand { display: none; align-items: center; gap: 10px; }
.auth-panel .mini-brand .logo-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--grad); display: grid; place-items: center; }
.auth-panel .mini-brand .logo-mark svg { width: 20px; height: 20px; }
.auth-panel .mini-brand b { font-size: 18px; font-weight: 800; }
.back-home { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: var(--ink-700); font-weight: 500; padding: 8px 12px; border-radius: 9px; transition: background .2s, color .2s; }
.back-home:hover { background: var(--ink-50); color: var(--blue); }
.back-home svg { width: 16px; height: 16px; }

.auth-card { margin: auto; width: 100%; max-width: 408px; padding: 24px 0; }

/* tabs */
.auth-tabs { display: flex; gap: 4px; background: var(--ink-50); border-radius: 12px; padding: 5px; margin-bottom: 30px; }
.auth-tab { flex: 1; height: 42px; border-radius: 9px; font-size: 15px; font-weight: 600; color: var(--ink-700); transition: all .2s; }
.auth-tab.active { background: #fff; color: var(--blue); box-shadow: 0 2px 8px rgba(10,25,47,.08); }

.auth-h { font-size: 27px; font-weight: 800; letter-spacing: -.5px; }
.auth-sub { margin-top: 8px; color: var(--ink-700); font-size: 15px; }

.view { display: none; }
.view.active { display: block; }

/* method switch (login) */
.method-switch { display: flex; gap: 18px; margin: 26px 0 4px; border-bottom: 1px solid var(--ink-100); }
.method-switch button { padding: 0 2px 12px; font-size: 14.5px; font-weight: 600; color: var(--ink-grey); position: relative; transition: color .2s; }
.method-switch button.active { color: var(--blue); }
.method-switch button.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--grad); border-radius: 2px; }

/* fields */
.fld { margin-top: 20px; }
.fld > label { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink-900); margin-bottom: 8px; }
.ipt-wrap { position: relative; display: flex; align-items: center; }
.ipt-wrap .lead { position: absolute; left: 14px; display: flex; align-items: center; color: var(--ink-grey); pointer-events: none; }
.ipt-wrap .lead svg { width: 18px; height: 18px; }
.ipt { width: 100%; height: 50px; border: 1.5px solid var(--ink-100); border-radius: 11px; padding: 0 16px 0 44px; font-size: 15px; font-family: inherit; color: var(--ink-900); transition: border-color .2s, box-shadow .2s; background: #fff; }
.ipt:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0,114,255,.13); }
.ipt.err { border-color: var(--warn); box-shadow: 0 0 0 4px rgba(255,77,79,.12); }
.ipt.ok { border-color: var(--success); }
.phone-grp { display: flex; gap: 10px; }
.phone-grp .code-sel { position: relative; flex-shrink: 0; }
.phone-grp select { height: 50px; border: 1.5px solid var(--ink-100); border-radius: 11px; padding: 0 32px 0 14px; font-size: 15px; font-family: inherit; color: var(--ink-900); background: #fff; appearance: none; cursor: pointer; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238C8C8C' stroke-width='2'><path d='m4 6 4 4 4-4'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; }
.phone-grp select:focus { outline: none; border-color: var(--blue); }
.phone-grp .ipt-wrap { flex: 1; }
.phone-grp .ipt { padding-left: 16px; }

.code-row { display: flex; gap: 10px; }
.code-row .ipt-wrap { flex: 1; }
.code-row .ipt { padding-left: 16px; letter-spacing: 4px; font-family: var(--mono); }
.get-code { flex-shrink: 0; height: 50px; padding: 0 16px; border-radius: 11px; border: 1.5px solid rgba(0,114,255,.5); color: var(--blue); font-size: 14px; font-weight: 600; white-space: nowrap; transition: all .2s; }
.get-code:hover:not(:disabled) { background: rgba(0,114,255,.06); }
.get-code:disabled { color: var(--ink-grey); border-color: var(--ink-100); cursor: not-allowed; font-family: var(--mono); }

.pwd-toggle { position: absolute; right: 14px; color: var(--ink-grey); display: grid; place-items: center; padding: 4px; }
.pwd-toggle:hover { color: var(--ink-700); }
.pwd-toggle svg { width: 18px; height: 18px; }

/* password strength */
.strength { margin-top: 10px; display: none; }
.strength.show { display: block; }
.strength-bars { display: flex; gap: 6px; }
.strength-bars i { flex: 1; height: 4px; border-radius: 2px; background: var(--ink-100); transition: background .3s; }
.strength.s1 .strength-bars i:nth-child(1) { background: var(--warn); }
.strength.s2 .strength-bars i:nth-child(-n+2) { background: #faad14; }
.strength.s3 .strength-bars i { background: var(--success); }
.strength-txt { margin-top: 6px; font-size: 12px; color: var(--ink-grey); }
.strength.s1 .strength-txt { color: var(--warn); }
.strength.s2 .strength-txt { color: #d48806; }
.strength.s3 .strength-txt { color: var(--success); }

.fld-err { margin-top: 7px; font-size: 12.5px; color: var(--warn); min-height: 1px; }

/* ---------- passwordless email+code additions ---------- */
.auth-emblem { width: 60px; height: 60px; border-radius: 16px; background: var(--grad-soft); color: var(--blue); display: grid; place-items: center; margin-bottom: 22px; }
.auth-emblem svg { width: 30px; height: 30px; }
.auth-h + .auth-sub { line-height: 1.55; }

/* sent confirmation hint */
.sent-hint { display: none; align-items: center; gap: 10px; margin-top: 18px; padding: 12px 14px; border-radius: 11px; background: var(--grad-soft); border: 1px solid rgba(0,114,255,.18); font-size: 13.5px; color: var(--ink-900); }
.sent-hint.show { display: flex; }
.sent-hint svg { width: 17px; height: 17px; color: var(--blue); flex-shrink: 0; }
.sent-hint b { color: var(--blue); word-break: break-all; }
.sent-hint a { margin-left: auto; color: var(--blue); font-weight: 600; white-space: nowrap; }
.sent-hint a:hover { text-decoration: underline; }

/* code field reveal */
.code-fld { display: none; }
.code-fld.show { display: block; animation: codeReveal .4s cubic-bezier(.2,.7,.3,1); }
@keyframes codeReveal { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* submit always visible here (override the .show gating used elsewhere) */
#auth-submit { display: inline-flex; }

.auth-tip { margin-top: 20px; font-size: 12.5px; color: var(--ink-grey); line-height: 1.6; text-align: center; }
.auth-tip a { color: var(--blue); font-weight: 600; }
.auth-tip a:hover { text-decoration: underline; }

/* agreement */
.agree { margin-top: 22px; display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.agree input { position: absolute; opacity: 0; }
.agree .box { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--ink-300); flex-shrink: 0; display: grid; place-items: center; transition: all .2s; margin-top: 1px; }
.agree .box svg { width: 13px; height: 13px; color: #fff; opacity: 0; transition: opacity .15s; }
.agree input:checked + .box { background: var(--grad); border-color: transparent; }
.agree input:checked + .box svg { opacity: 1; }
.agree .txt { font-size: 13px; color: var(--ink-700); line-height: 1.5; }
.agree .txt a { color: var(--blue); font-weight: 600; }
.agree .txt a:hover { text-decoration: underline; }

/* submit */
.auth-submit { width: 100%; height: 52px; border-radius: 12px; background: var(--grad); color: #fff; font-size: 16px; font-weight: 700; margin-top: 24px; box-shadow: 0 8px 22px rgba(0,114,255,.32); transition: transform .2s, box-shadow .2s, opacity .2s; display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.auth-submit:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--sh-glow); }
.auth-submit:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.auth-submit .spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; display: none; }
.auth-submit.loading .spinner { display: block; }
.auth-submit.loading .label { opacity: .8; }
@keyframes spin { to { transform: rotate(360deg); } }

/* extra links */
.auth-links { margin-top: 20px; display: flex; align-items: center; justify-content: space-between; font-size: 14px; }
.auth-links.center { justify-content: center; gap: 6px; }
.auth-links a { color: var(--blue); font-weight: 600; }
.auth-links a:hover { text-decoration: underline; }
.auth-links .muted { color: var(--ink-grey); font-weight: 400; }

/* divider */
.auth-or { margin: 26px 0; display: flex; align-items: center; gap: 14px; color: var(--ink-grey); font-size: 13px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--ink-100); }

/* success overlay */
.auth-success { position: fixed; inset: 0; z-index: 100; background: rgba(10,25,47,.9); backdrop-filter: blur(10px); display: grid; place-items: center; opacity: 0; visibility: hidden; transition: opacity .35s, visibility .35s; }
.auth-success.show { opacity: 1; visibility: visible; }
.auth-success .inner { text-align: center; color: #fff; transform: translateY(16px); transition: transform .4s cubic-bezier(.2,.7,.3,1); }
.auth-success.show .inner { transform: none; }
.auth-success .ring { width: 96px; height: 96px; margin: 0 auto 24px; border-radius: 50%; background: rgba(82,196,26,.16); display: grid; place-items: center; color: var(--success); }
.auth-success .ring svg { width: 50px; height: 50px; }
.auth-success h3 { font-size: 26px; font-weight: 800; }
.auth-success p { margin-top: 10px; color: rgba(255,255,255,.7); font-size: 15px; }
.auth-success .redir { margin-top: 8px; font-family: var(--mono); font-size: 13px; color: var(--cyan); }

/* forgot back link */
.forgot-back { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: var(--ink-700); font-weight: 600; margin-bottom: 6px; }
.forgot-back:hover { color: var(--blue); }
.forgot-back svg { width: 16px; height: 16px; }

@media (max-width: 960px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-panel { padding: 28px 24px; min-height: 100vh; }
  .auth-panel .mini-brand { display: flex; }
}
@media (max-width: 480px) {
  .auth-panel { padding: 22px 18px; }
  .auth-card { padding: 12px 0; }
  .phone-grp select { padding: 0 28px 0 10px; }
}
