/* Shared auth UI (login / sign-up modal + topbar account chip).
   Loaded by index.html and report.html. Relies on the page's :root tokens
   (--brand, --ink, --muted, --line, --bg, --nav-h, --safe-top/bottom). */

/* ---------- ACCOUNT BUTTON (topbar, right) ---------- */
.acct-btn {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; height: 36px; padding: 0 13px; border: 1.5px solid var(--line);
  background: #fff; border-radius: 99px; color: var(--ink);
  font-size: 13px; font-weight: 700; cursor: pointer; letter-spacing: -.1px;
}
.acct-btn:active { background: var(--bg); }
.acct-btn svg { width: 16px; height: 16px; }
/* signed-in: a teal initials disc */
.acct-btn.in { padding: 0; width: 36px; gap: 0; border-color: transparent; }
.acct-btn .avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--brand);
  color: #fff; display: none; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800;
}
.acct-btn.in .avatar { display: flex; }
.acct-btn.in .label, .acct-btn.in svg { display: none; }

/* tiny signed-in popover (email + log out) */
.acct-menu {
  position: fixed; top: calc(var(--nav-h) + var(--safe-top) - 4px); right: 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 14px 40px rgba(13,40,34,.16); padding: 8px; min-width: 220px;
  z-index: 60; display: none;
}
.acct-menu.open { display: block; }
.acct-menu .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); }
.acct-menu .who .nm { font-weight: 800; font-size: 14px; }
.acct-menu .who .em { color: var(--muted); font-size: 12.5px; margin-top: 2px; word-break: break-all; }
.acct-menu button {
  width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  padding: 11px 10px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--ink);
}
.acct-menu button:active { background: var(--bg); }

/* ---------- AUTH MODAL (login / sign-up) ---------- */
.auth-scrim {
  position: fixed; inset: 0; z-index: 100; display: none;
  background: rgba(13,32,29,.5); align-items: flex-end; justify-content: center;
  padding: 0; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
/* Dim + backdrop fade in on their own, so the sheet itself stays crisp (not
   faded) while it slides up — reads like a real bottom sheet, not a popup. */
.auth-scrim.open { display: flex; animation: authScrimIn .34s ease both; }
@keyframes authScrimIn {
  from { background: rgba(13,32,29,0); -webkit-backdrop-filter: blur(0); backdrop-filter: blur(0); }
  to   { background: rgba(13,32,29,.5); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
}
.auth-card {
  width: 100%; max-width: 460px; background: #fff;
  border-radius: 22px 22px 0 0; padding: 22px 22px calc(26px + var(--safe-bottom));
  box-shadow: 0 -10px 50px rgba(13,40,34,.25);
  /* True bottom sheet: rise from fully below the viewport with a soft, settling
     spline (ease-out-expo) — quick lift, gentle deceleration, no bounce/gap. */
  animation: authUp .44s cubic-bezier(.16,1,.3,1) both;
  will-change: transform;
  /* fixed height so the sheet doesn't jump in size between steps */
  min-height: 432px; display: flex; flex-direction: column;
}
@keyframes authUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@media (min-width: 560px) {
  .auth-scrim { align-items: center; padding: 20px; }
  .auth-card { border-radius: 22px; animation: authPop .28s cubic-bezier(.16,1,.3,1) both; }
  @keyframes authPop { from { transform: scale(.94) translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
}
/* Respect users who ask for less motion. */
@media (prefers-reduced-motion: reduce) {
  .auth-scrim.open, .auth-card { animation-duration: .01ms; }
}
.auth-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.auth-head h2 { font-size: 20px; font-weight: 800; letter-spacing: -.4px; margin: 0; line-height: 1.2; white-space: nowrap; }
.auth-x {
  flex: none; width: 34px; height: 34px; border: 0; background: var(--bg); border-radius: 50%;
  cursor: pointer; color: var(--muted); display: grid; place-items: center; margin: -2px -2px 0 0;
}
.auth-x svg { width: 18px; height: 18px; }
.auth-sub { color: var(--muted); font-size: 14.5px; margin: 8px 0 20px; line-height: 1.4; }
.auth-sub:empty { display: none; }
/* Identical title→input spacing on every step so swapping email⇄password feels
   like the field changes in place, not a relayout. */
#stepEmail, #stepPass, #stepGoogleOnly { margin-top: 18px; }
.auth-field { margin-bottom: 12px; }
.auth-field label { display: block; font-size: 13px; font-weight: 700; color: var(--ink); margin: 0 0 7px 2px; }
.auth-field input {
  width: 100%; height: 54px; border: 1.5px solid var(--line); border-radius: 14px;
  padding: 0 15px; font-size: 16px; color: var(--ink); background: #fff; outline: 0;
  transition: border-color .15s ease;
}
.auth-field input:focus { border-color: var(--brand); }
.btn-primary {
  width: 100%; height: 54px; border: 0; border-radius: 14px; background: var(--brand);
  color: #fff; font-size: 16px; font-weight: 800; cursor: pointer; letter-spacing: -.2px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary:active { filter: brightness(.95); }
.btn-primary[disabled] { opacity: .6; cursor: default; }
.btn-primary .spin {
  width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.45); border-top-color: #fff;
  border-radius: 50%; animation: authSpin .7s linear infinite; display: none;
}
.btn-primary.loading .spin { display: block; }
.btn-primary.loading .txt { display: none; }
@keyframes authSpin { to { transform: rotate(360deg); } }
.auth-or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 16px 0; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.btn-social {
  width: 100%; height: 54px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff;
  color: var(--ink); font-size: 15.5px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 11px;
}
.btn-social:active { background: var(--bg); }
.btn-social img { width: 19px; height: 19px; }
.auth-err {
  display: none; background: #fdecec; color: #c0392b; border-radius: 11px;
  padding: 11px 13px; font-size: 13.5px; font-weight: 600; margin-bottom: 12px; line-height: 1.35;
}
.auth-err.show { display: block; }
.auth-back {
  background: none; border: 0; color: var(--muted); font-size: 13.5px; font-weight: 600;
  cursor: pointer; padding: 6px 0; margin-top: 14px; width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
}
.auth-foot { color: var(--muted); font-size: 11.5px; line-height: 1.45; text-align: center; margin-top: auto; padding-top: 18px; }
.auth-foot a { color: var(--muted); text-decoration: underline; }
