/* Sign in / sign up screens, the demo email banner, and the app tour. Colours come from css/theme.css. */

/* ---------- The screen ---------- */
.auth-screen {
  position: fixed; inset: 0; z-index: 90; display: flex; justify-content: center;
  background: linear-gradient(180deg, var(--bgTop) 0%, var(--bgMid) 50%, var(--bgBottom) 100%);
  opacity: 0; visibility: hidden; transition: opacity 0.35s ease, visibility 0s linear 0.35s;
}
.auth-screen.open { opacity: 1; visibility: visible; transition: opacity 0.35s ease; }
body.auth-open { overflow: hidden; }
.auth-screen::before, .auth-screen::after {
  content: ''; position: absolute; z-index: 0; border-radius: 50%; filter: blur(90px); opacity: var(--blobOpacity); pointer-events: none;
}
.auth-screen::before { width: 320px; height: 320px; background: var(--purple); top: -110px; right: -120px; }
.auth-screen::after { width: 300px; height: 300px; background: var(--orange); bottom: -120px; left: -110px; }
.auth-panel {
  position: relative; z-index: 1; width: min(460px, 100%); height: 100%; display: flex; flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 14px) 18px calc(env(safe-area-inset-bottom) + 16px);
}
.auth-head { flex: none; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 12px; min-height: 44px; }
.auth-prog { display: flex; flex-direction: column; gap: 7px; align-items: center; }
.auth-prog[hidden] { display: none; }
.auth-prog-bar { width: 100%; height: 6px; border-radius: 99px; background: var(--track); overflow: hidden; }
.auth-prog-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--orange), var(--purple), var(--blue)); transition: width 0.5s var(--ease-out); }
.auth-prog small { font-size: 11.5px; font-weight: 700; color: var(--textMuted); }
.auth-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 18px 2px 2px; }
.au-form { min-height: 100%; display: flex; flex-direction: column; animation: au-in 0.4s var(--ease-out) both; }
@keyframes au-in { from { opacity: 0; transform: translateY(12px); } }
.au-form .setup-hero { margin: auto 0 22px; padding-top: 8px; }
.au-form .setup-text { margin-bottom: 6px; }
.au-form .promise { margin-top: 14px; }
.au-form .lf-field { margin-top: 14px; }
.au-actions { margin-top: auto; padding-top: 20px; }
.au-actions .save-btn { margin-top: 0; }
.au-alt {
  display: block; width: 100%; height: 52px; margin-top: 10px; border-radius: 20px; font-size: 15px; font-weight: 700;
  color: var(--text); background: var(--surface); border: 1px solid var(--surfaceBorder);
}
.au-alt:active { transform: scale(0.98); }
.au-demo { margin-top: 12px; text-align: center; font-size: 11.5px; color: var(--textMuted); }
.au-center { text-align: center; }
.au-row-end { display: flex; justify-content: flex-end; margin-top: 2px; }

/* ---------- Fields ---------- */
.lf-input.bad { box-shadow: 0 0 0 2px var(--danger); }
.au-select {
  -webkit-appearance: none; appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23808099' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 18px;
}
.au-select option { color: #14142b; background: #fff; }
.au-pass { position: relative; display: block; }
.au-pass .lf-input { padding-right: 66px; }
.au-eye { position: absolute; top: 0; right: 4px; height: 48px; padding: 0 12px; font-size: 13px; font-weight: 700; color: var(--purpleText); }
.au-err {
  margin-top: 14px; padding: 11px 13px; border-radius: 14px; font-size: 13.5px; font-weight: 600; line-height: 1.4;
  color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
}
.au-err.info { color: var(--purpleText); background: color-mix(in srgb, var(--purple) 9%, transparent); border-color: color-mix(in srgb, var(--purple) 28%, transparent); }
.au-err[hidden] { display: none; }

/* Password strength */
.au-meter { display: grid; grid-template-columns: repeat(4, 1fr) auto; align-items: center; gap: 5px; margin: 10px 4px 0; min-height: 16px; }
.au-meter span { height: 5px; border-radius: 99px; background: var(--track); transition: background 0.25s ease; }
.au-meter b { min-width: 74px; text-align: right; font-size: 12px; font-weight: 700; color: var(--textMuted); }
.au-meter[data-level="1"] span.on { background: var(--danger); }
.au-meter[data-level="2"] span.on { background: var(--orange); }
.au-meter[data-level="3"] span.on { background: color-mix(in srgb, var(--income) 60%, var(--orange)); }
.au-meter[data-level="4"] span.on { background: var(--income); }
.au-rules { list-style: none; display: grid; gap: 4px; margin: 8px 4px 0; }
.au-rules li { position: relative; padding-left: 20px; font-size: 12.5px; color: var(--textMuted); }
.au-rules li::before { content: ''; position: absolute; left: 3px; top: 5px; width: 8px; height: 8px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--textMuted); }
.au-rules li.ok { color: var(--text); }
.au-rules li.ok::before { background: var(--income); box-shadow: none; }

/* Human check (stands in for Cloudflare Turnstile) */
.au-human { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 10px 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--surfaceBorder); }
.au-human-box { position: relative; flex: none; width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--track); }
.au-human-box .i { width: 18px; height: 18px; color: #fff; opacity: 0; }
.au-spin { position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid var(--textMuted); border-top-color: transparent; animation: rotate 0.8s linear infinite; }
.au-human[data-ok="1"] .au-human-box { background: var(--income); }
.au-human[data-ok="1"] .au-human-box .i { opacity: 1; }
.au-human[data-ok="1"] .au-spin { display: none; }
.au-human-text { display: flex; flex-direction: column; gap: 1px; }
.au-human-text b { font-size: 13.5px; font-weight: 700; }
.au-human-text small { font-size: 11.5px; color: var(--textMuted); }

/* 6-digit code */
.au-code { position: relative; display: block; margin-top: 18px; }
.au-code input {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; opacity: 0.01; border: 0; outline: 0; background: none; color: transparent; caret-color: transparent;
  font-size: 16px; letter-spacing: 30px; text-align: center;
}
.au-cells { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.au-cells i {
  height: 60px; border-radius: 16px; display: grid; place-items: center; font-style: normal; font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums;
  background: var(--surface); border: 1px solid var(--surfaceBorder); transition: box-shadow 0.2s ease;
}
.au-code:focus-within .au-cells i.cur { box-shadow: 0 0 0 3px color-mix(in srgb, var(--purple) 35%, transparent); }
.au-resend { margin-top: 12px; text-align: center; font-size: 13.5px; color: var(--textMuted); }
.au-resend .link-btn { padding: 6px 2px; text-align: left; }

/* Username card */
.au-user { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding: 16px 16px; border-radius: 22px; }
.au-user-name { font-size: 20px; font-weight: 800; letter-spacing: -0.3px; min-width: 0; overflow-wrap: anywhere; }
.au-tag { padding: 4px 9px; border-radius: 99px; font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 0.5px; color: #fff; background: linear-gradient(135deg, var(--purple), var(--blue)); }
.au-tag.small { margin-left: 6px; padding: 2px 7px; font-size: 11.5px; vertical-align: 1px; }
.au-copy { margin-left: auto; width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; color: var(--purpleText); background: var(--track); }
.au-copy .i { width: 19px; height: 19px; }
.au-kept .i { color: var(--income); }
.au-who { margin: 2px 4px 0; font-size: 14px; font-weight: 700; color: var(--purpleText); }

/* PIN step */
.au-dots { justify-content: center; margin: 26px 0 4px; }
.au-pad { margin-top: auto; padding-top: 16px; }
.au-pad button { height: clamp(52px, 8dvh, 64px); }
.au-form .au-err + .au-pad { margin-top: auto; }

/* Face ID step */
.au-big-ic { width: 84px; height: 84px; margin: auto auto 22px; border-radius: 28px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--orange), var(--purple) 60%, var(--blue)); box-shadow: 0 16px 34px -14px var(--purple); }
.au-big-ic .i { width: 44px; height: 44px; stroke-width: 1.6; }
.au-big-ic + .setup-title, .au-big-ic + .setup-title + .setup-text { text-align: center; }

/* Lock screen: the Face ID key sits in the empty corner of the pad */
.lock-pad [data-k="bio"].off { visibility: hidden; }
.lock-pad [data-k="bio"] { color: var(--purpleText); }

/* Toasts sit above the sign-in screen while it's open */
body.auth-open .toast { z-index: 96; bottom: calc(20px + env(safe-area-inset-bottom)); }

/* Real waits (signing in, sending a code) can't be skipped */
.loader.waiting { cursor: default; }
.loader.waiting .loader-hint { display: none; }

/* ---------- Demo email banner ---------- */
.mail-banner {
  position: fixed; z-index: 96; top: calc(env(safe-area-inset-top) + 10px); left: 50%; width: min(436px, calc(100% - 20px));
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 22px; text-align: left;
  color: var(--text); background: var(--sheet); border: 1px solid var(--surfaceBorder); box-shadow: 0 18px 40px -14px var(--shadow), 0 2px 10px -4px var(--shadow);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  transform: translate(-50%, -140%); opacity: 0; transition: transform 0.5s var(--ease-out), opacity 0.3s ease;
}
.mail-banner.in { transform: translate(-50%, 0); opacity: 1; }
.mail-banner[hidden] { display: none; }
.mail-ic { flex: none; width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--purple), var(--blue)); }
.mail-ic .i { width: 21px; height: 21px; }
.mail-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mail-main small { font-size: 11.5px; font-weight: 600; color: var(--textMuted); }
.mail-main b { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- App tour ---------- */
.tour { position: fixed; inset: 0; z-index: 85; }
.tour[hidden] { display: none; }
.tour-spot {
  position: absolute; border-radius: 22px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(10, 8, 30, 0.66), 0 0 0 2px rgba(255, 255, 255, 0.85), 0 0 26px 2px color-mix(in srgb, var(--purple) 60%, transparent);
  transition: top 0.45s var(--ease-out), left 0.45s var(--ease-out), width 0.45s var(--ease-out), height 0.45s var(--ease-out), border-radius 0.45s ease;
}
.tour-card {
  position: absolute; left: 50%; width: min(400px, calc(100% - 28px)); transform: translateX(-50%); padding: 16px 16px 12px; border-radius: 24px;
  color: #14142b; background: #fff; box-shadow: 0 24px 50px -16px rgba(0, 0, 0, 0.5);
  transition: top 0.45s var(--ease-out), opacity 0.25s ease;
}
.tour-card small { font-size: 11.5px; font-weight: 800; letter-spacing: 0.4px; text-transform: uppercase; color: #6b4fe0; }
.tour-card b { display: block; margin-top: 4px; font-size: 18px; font-weight: 800; letter-spacing: -0.3px; }
.tour-card p { margin-top: 6px; font-size: 14.5px; line-height: 1.5; color: #55556f; }
.tour-row { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.tour-row .link-btn { color: #6b6b85; text-align: left; }
.tour-next { height: 44px; padding: 0 22px; border-radius: 15px; font-size: 15px; font-weight: 800; color: #fff; background: linear-gradient(135deg, #ff8a3d, #7c5cff 65%, #1e3a8a); }
.tour-next:active { transform: scale(0.97); }

/* ---------- Continue with Google ---------- */
.au-google { display: flex; justify-content: center; min-height: 44px; margin-bottom: 4px; }
.au-google iframe { margin: 0 auto !important; }
.au-or { display: flex; align-items: center; gap: 12px; margin: 12px 0; font-size: 12.5px; font-weight: 700; color: var(--textMuted); }
.au-or::before, .au-or::after { content: ''; flex: 1; height: 1px; background: var(--surfaceBorder); }
.au-form > .au-google { margin-top: 14px; }
.au-form > .au-google + .au-or { margin-bottom: 0; }

/* ---------- Cloudflare Turnstile (the real "are you human" check) ---------- */
.au-ts { margin-top: 16px; min-height: 65px; font-size: 13px; color: var(--textMuted); }

/* ---------- Signed-in devices ---------- */
.au-devs { display: grid; gap: 8px; margin-top: 8px; }
.au-dev { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--surfaceBorder); }
.au-dev-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.au-dev-main b { font-size: 14.5px; font-weight: 700; }
.au-dev-main em { margin-left: 6px; padding: 2px 8px; border-radius: 99px; font-style: normal; font-size: 11px; font-weight: 800; color: var(--purpleText); background: var(--track); }
.au-dev-main small { font-size: 12.5px; color: var(--textMuted); }
.au-dev-out { flex: none; color: var(--danger); padding: 8px 4px; text-align: right; }
.au-alt.au-danger { color: var(--danger); }
.au-demo a { color: var(--purpleText); font-weight: 700; text-decoration: none; }

/* ---------- Messages from the dashboard ---------- */
.home-banner { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; padding: 14px 16px; border-radius: 20px; font-size: 14px; font-weight: 600; line-height: 1.45; }
.home-banner.tone-info { border-color: color-mix(in srgb, var(--purple) 40%, var(--surfaceBorder)); }
.home-banner.tone-good { border-color: color-mix(in srgb, var(--income) 45%, var(--surfaceBorder)); }
.home-banner.tone-warn { border-color: color-mix(in srgb, var(--orange) 55%, var(--surfaceBorder)); }
.hb-text { flex: 1; min-width: 0; }
.hb-x { flex: none; width: 28px; height: 28px; margin: -4px -6px 0 0; border-radius: 50%; font-size: 20px; line-height: 1; color: var(--textMuted); }
.maint { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 24px; background: linear-gradient(180deg, var(--bgTop), var(--bgMid) 50%, var(--bgBottom)); }
.maint-card { width: min(380px, 100%); text-align: center; }
.maint-card .loader-logo { display: block; margin: 0 auto 22px; }
.maint-card h2 { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }
.maint-card p { margin-top: 8px; font-size: 15px; line-height: 1.5; color: var(--textMuted); }
.maint-card .maint-note { font-size: 13px; }
.maint-card .pill { margin-top: 18px; padding: 12px 18px; font-weight: 700; }

/* ---------- Feedback ---------- */
.fb-kinds { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.fb-kind { padding: 10px 14px; border-radius: 99px; font-size: 14px; font-weight: 700; color: var(--textMuted); background: var(--surface); border: 1px solid var(--surfaceBorder); }
.fb-kind.on { color: #fff; background: linear-gradient(135deg, var(--purple), var(--blue)); border-color: transparent; }
textarea.lf-input.fb-text { height: auto; min-height: 140px; padding: 12px 14px; line-height: 1.5; resize: vertical; }
.fb-shot { margin-top: 14px; }
.fb-shot img { display: block; max-width: 100%; max-height: 240px; border-radius: 14px; border: 1px solid var(--surfaceBorder); }
.fb-shot .link-btn { margin-top: 6px; text-align: left; color: var(--danger); }
.fb-add { margin-top: 0; }
