/* meowfee — sign in, create account, codes, and form fields that say what's wrong
   (core/forms.js). Uses the theme tokens; --danger is a red that keeps at least
   4.5:1 contrast on the paper and card colours in light and dark mode. */

:root {
  --danger: #b3263a;
  --danger-tint: color-mix(in srgb, var(--danger) 9%, var(--raised));
  --ok-ink: color-mix(in oklab, var(--good), #000 28%);
  --warn-ink: color-mix(in oklab, var(--warn), #000 52%);
}
[data-mode="dark"] {
  --danger: #ff8f9c;
  --danger-tint: color-mix(in srgb, var(--danger) 14%, var(--raised));
  --ok-ink: color-mix(in oklab, var(--good), #fff 30%);
  --warn-ink: color-mix(in oklab, var(--warn), #fff 35%);
}

/* ── the page ─────────────────────────────────────────────────────────────── */
.auth-flow { padding: 20px 16px calc(28px + env(safe-area-inset-bottom)); }
.auth-flow .logo { margin-bottom: 4px; }
.logo.logo-compact::before, .logo.logo-compact::after { display: none; }
.logo.logo-compact .logo-icon { width: 56px; height: 56px; border-radius: 17px; margin-bottom: 2px; }
.logo.logo-compact span { font-size: clamp(1.7rem, 8vw, 2.1rem); -webkit-text-stroke-width: 2px; }
.auth-title { font-family: var(--display); font-size: 1.35rem; font-weight: 500; text-align: center; margin: 6px 0 2px; color: var(--ink); }
.auth-sub { text-align: center; color: var(--ink-soft); font-size: .92rem; margin: 0 0 4px; overflow-wrap: anywhere; }
.auth-tabs { margin: 14px 0 12px; }
.auth-card {
  background: var(--raised); border: 1px solid var(--rule); border-radius: var(--r);
  padding: 18px 16px; box-shadow: var(--shadow, 0 6px 18px rgb(0 0 0 / .06));
}
.auth-step { margin: 0 0 12px; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--me-strong); }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; margin-top: 16px; }
.auth-links .linkish { font-size: .9rem; margin: 0; }
.auth-foot { margin: 16px 0 4px; }
.auth-flow .or-line { margin: 18px 0 12px; }
@media (min-width: 720px) {
  .auth-card { padding: 22px 22px; }
}

/* ── fields ───────────────────────────────────────────────────────────────── */
.f-form { display: flex; flex-direction: column; gap: 16px; }   /* hidden parts (an empty banner) leave no gap */
.f-form > .f-aside { margin-top: -10px; }
.f-label { display: block; margin: 0 0 6px 2px; font-weight: 700; font-size: .9rem; color: var(--ink); }
.f-opt { font-weight: 400; color: var(--ink-soft); }
.f-help { margin: 6px 2px 0; font-size: .8rem; line-height: 1.45; color: var(--ink-soft); }
.f-help.center { text-align: center; margin-top: 14px; }
.f-aside { text-align: right; }
.f-aside .linkish { font-size: .86rem; margin: 0; }

.f-err { display: flex; gap: 7px; align-items: flex-start; margin: 7px 2px 0; font-size: .86rem; font-weight: 700; line-height: 1.4; color: var(--danger); }
.f-err::before {
  content: "!"; flex: none; width: 17px; height: 17px; margin-top: 1px; border-radius: 50%; display: grid; place-items: center;
  font-size: .72rem; font-weight: 800; line-height: 1; color: var(--raised); background: var(--danger);
}
.f-err[hidden], .f-banner[hidden], .f-caps[hidden] { display: none; }

/* a wrong field: red border, a soft red wash, a red focus ring */
html .f-field input.is-invalid, html .f-pw.is-invalid input {
  border-color: var(--danger); background: var(--danger-tint); box-shadow: 0 0 0 1px var(--danger);
}
html .f-field input.is-invalid:focus, html .f-pw.is-invalid input:focus {
  border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger), 0 0 0 5px color-mix(in srgb, var(--danger) 22%, transparent);
}

/* password: Show/Hide inside the box, Caps Lock warning, the rules */
.f-pw { position: relative; }
html .f-pw input { width: 100%; padding-right: 76px; }
.f-reveal {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%); min-width: 56px; height: 36px; padding: 0 10px;
  border: 0; border-radius: 10px; background: none; color: var(--me-strong); font: inherit; font-size: .85rem; font-weight: 700;
  cursor: pointer; touch-action: manipulation;
}
.f-reveal:hover { background: var(--paper-2); }
.f-reveal:focus-visible, .f-check-row a:focus-visible, .auth-flow .linkish:focus-visible { outline: 2px solid var(--me-strong); outline-offset: 2px; }
.f-caps {
  display: inline-block; margin: 7px 2px 0; padding: 3px 9px; border-radius: 8px; font-size: .8rem; font-weight: 700;
  color: var(--warn-ink); background: color-mix(in srgb, var(--warn) 16%, var(--raised));
}
.f-rules ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.f-rules li { position: relative; padding-left: 22px; }
.f-rules li::before { content: "○"; position: absolute; left: 3px; top: 0; font-weight: 700; }
.f-rules li.no { color: var(--ink); }
.f-rules li.ok { color: var(--ok-ink); }
.f-rules li.ok::before { content: "✓"; }
.f-rules p { margin: 4px 0 0; }

/* a tick box in a soft panel (the whole row is easy to tap) */
.f-check-row {
  display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px; border-radius: var(--r-ctl);
  background: var(--paper-2); border: 1px solid var(--rule);
}
.f-check-row input { flex: none; margin: 1px 0 0; width: 20px; height: 20px; }
.f-check-row label { font-size: .88rem; line-height: 1.45; cursor: pointer; }
.f-check-row a { color: var(--me-strong); font-weight: 700; text-underline-offset: 2px; }
.f-check.has-error .f-check-row { border-color: var(--danger); background: var(--danger-tint); box-shadow: 0 0 0 1px var(--danger); }

/* the 6-digit code: big, centred, fits a 360px phone */
html .f-field .code-input { letter-spacing: .42em; padding-left: calc(14px + .42em); font-size: 1.5rem !important; }

/* the banner at the top of a form: errors that aren't about one field, and good news */
.f-banner {
  display: flex; gap: 9px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; font-size: .9rem; font-weight: 600; line-height: 1.45;
  color: var(--danger); background: var(--danger-tint); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
}
.f-banner::before {
  content: "!"; flex: none; width: 19px; height: 19px; margin-top: 1px; border-radius: 50%; display: grid; place-items: center;
  font-size: .76rem; font-weight: 800; color: var(--raised); background: var(--danger);
}
.f-banner.info { color: var(--ink); background: var(--me-tint); border-color: color-mix(in srgb, var(--me) 45%, transparent); }
.f-banner.info::before { content: "✓"; color: var(--raised); background: var(--me-strong); }

/* a button that's working */
.f-spin {
  display: inline-block; width: 1em; height: 1em; flex: none; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
.btn[aria-busy="true"]:disabled { opacity: .8; cursor: progress; }
@media (prefers-reduced-motion: reduce) { .f-spin { animation-duration: 2s; } }

.linkish.f-resend:disabled { color: var(--ink-soft); text-decoration: none; cursor: default; }
.f-count { font-variant-numeric: tabular-nums; }

/* only for password managers (which account a new password belongs to) */
.f-sr { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0 !important; opacity: 0; pointer-events: none; }

/* sheets (forgot password) use the same fields */
.sheet .f-form { margin-top: 4px; }
.sheet .auth-step { margin-bottom: 6px; }
