/* ============================================================
   AIKraft — Auth (login / register / reset)
   Light, centered card. Relies on tokens.css + styles.css.
   ============================================================ */

.auth-wrap {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center;
  padding: 0 20px 48px;
  position: relative; overflow: hidden;
}
/* calm brand-tinted background */
.auth-wrap::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(1100px 520px at 50% -160px, var(--accent-soft), transparent 70%),
    radial-gradient(680px 420px at 12% 110%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 70%),
    var(--bg);
}

/* top brand */
.auth-top { padding: 40px 0 26px; }
.auth-brand { display: inline-flex; align-items: center; gap: 9px; }
.auth-brand .brand-mark { width: 26px; height: 26px; }
.auth-brand .brand-name { font-size: 19px; font-weight: 600; letter-spacing: -.02em; }
.auth-brand .brand-name .ai { color: var(--accent); }
.auth-brand small { font-family: var(--font-mono); font-size: 10px; color: var(--text-mute); letter-spacing: .04em; }

/* card */
.auth-card {
  width: 100%; max-width: 408px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--r-2xl); padding: 30px 30px 28px;
  box-shadow: var(--shadow-lg);
}
.auth-head { margin-bottom: 22px; }
.auth-head h1 { font-size: 23px; font-weight: 600; letter-spacing: -.02em; margin: 0; }
.auth-head p { font-size: 14px; color: var(--text-2); margin: 7px 0 0; line-height: 1.5; }

/* fields */
.fld { margin-bottom: 16px; }
.fld > label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.fld .ctrl { position: relative; }
.inp {
  width: 100%; height: 42px; padding: 0 13px;
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--r-md);
  font-family: inherit; font-size: 14px; color: var(--text);
  transition: border .15s, box-shadow .15s; outline: none;
}
.inp::placeholder { color: var(--text-mute); }
.inp:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.inp.has-eye { padding-right: 42px; }
.fld.invalid .inp { border-color: var(--red); }
.fld.invalid .inp:focus { box-shadow: 0 0 0 3px var(--red-soft); }
.eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-mute); border-radius: 7px;
}
.eye:hover { color: var(--text-2); background: var(--bg-elev-2); }
.err { display: none; font-size: 12px; color: var(--red); margin-top: 5px; }
.fld.invalid .err { display: block; }

/* password strength */
.pw-meter { display: flex; gap: 5px; margin-top: 8px; }
.pw-meter span { flex: 1; height: 3px; border-radius: 2px; background: var(--border-strong); transition: background .2s; }
.pw-note { font-size: 11.5px; color: var(--text-3); margin-top: 6px; font-family: var(--font-mono); }
.pw-s1 .pw-meter span:nth-child(-n+1) { background: var(--red); }
.pw-s2 .pw-meter span:nth-child(-n+2) { background: var(--amber); }
.pw-s3 .pw-meter span:nth-child(-n+3) { background: var(--amber); }
.pw-s4 .pw-meter span { background: var(--green); }

/* row: remember + forgot */
.fld-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.chk { display: inline-flex; align-items: flex-start; gap: 8px; cursor: pointer; font-size: 13px; color: var(--text-2); line-height: 1.45; }
.chk input { appearance: none; -webkit-appearance: none; width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; border: 1px solid var(--border-strong); border-radius: 5px; background: var(--bg); cursor: pointer; transition: .15s; position: relative; }
.chk input:checked { background: var(--accent); border-color: var(--accent); }
.chk input:checked::after { content: ""; position: absolute; left: 5px; top: 2px; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.chk input:focus-visible { box-shadow: 0 0 0 3px var(--accent-soft); }
.chk a { color: var(--accent); }
.chk a:hover { text-decoration: underline; }
.link-mini { font-size: 13px; color: var(--accent); font-weight: 500; }
.link-mini:hover { text-decoration: underline; }

.fld-consent { margin-bottom: 20px; }
.fld-consent.invalid .chk { color: var(--red); }
.fld-consent .err { margin-top: 6px; }
.fld-consent.invalid .err { display: block; }

/* primary button with spinner */
.auth-btn {
  width: 100%; height: 44px; border: none; border-radius: var(--r-md);
  background: var(--accent); color: #fff; font-family: inherit; font-size: 14.5px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s, opacity .15s;
}
.auth-btn:hover { background: var(--accent-hover); }
.auth-btn:disabled { opacity: .7; cursor: default; }
.auth-btn .spin { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: auth-spin .7s linear infinite; display: none; }
.auth-btn.loading .spin { display: inline-block; }
.auth-btn.loading .lbl { opacity: .85; }
@keyframes auth-spin { to { transform: rotate(360deg); } }

/* form-level error */
.form-error {
  display: none; align-items: center; gap: 9px;
  background: var(--red-soft); border: 1px solid color-mix(in srgb, var(--red) 30%, transparent);
  color: var(--red); font-size: 13px; font-weight: 500;
  padding: 10px 13px; border-radius: var(--r-md); margin-bottom: 18px;
}
.form-error.show { display: flex; }
.form-error svg { flex-shrink: 0; }

/* success */
.form-ok {
  display: none; flex-direction: column; align-items: center; text-align: center; gap: 4px;
  padding: 14px 0 6px;
}
.form-ok.show { display: flex; }
.form-ok .tick { width: 52px; height: 52px; border-radius: 50%; background: var(--green-soft); color: var(--green); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.form-ok h2 { font-size: 18px; font-weight: 600; margin: 0; }
.form-ok p { font-size: 13.5px; color: var(--text-2); margin: 2px 0 0; }

/* divider + social */
.auth-or { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--text-mute); font-size: 12px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.soc-row { display: grid; grid-template-columns: 1fr; gap: 10px; }
.soc-btn {
  height: 42px; border: 1px solid var(--border-strong); border-radius: var(--r-md);
  background: var(--bg); color: var(--text); font-family: inherit; font-size: 13.5px; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  transition: border .15s, background .15s;
}
.soc-btn:hover { border-color: var(--text-mute); background: var(--bg-elev-2); }
.soc-btn .ic { width: 17px; height: 17px; font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; }

/* footer switch line */
.auth-foot { text-align: center; font-size: 13.5px; color: var(--text-2); margin-top: 22px; }
.auth-foot a { color: var(--accent); font-weight: 500; }
.auth-foot a:hover { text-decoration: underline; }

.auth-legal { text-align: center; font-size: 11.5px; color: var(--text-mute); margin-top: 18px; line-height: 1.5; }
.auth-legal a { color: var(--text-3); text-decoration: underline; }

/* back link */
.auth-back { margin-top: 20px; text-align: center; }
.auth-back a { font-size: 13px; color: var(--text-3); display: inline-flex; align-items: center; gap: 6px; }
.auth-back a:hover { color: var(--text-2); }

@media (max-width: 480px) {
  .auth-card { padding: 24px 20px; box-shadow: var(--shadow-md); }
  .soc-row { grid-template-columns: 1fr; }
}
