/* ==========================================================================
   MyXCapital — sign-in, invitation and lock screen.
   Self-contained (no Velzon): ink page, gold accents, one centered card that
   becomes a full-width sheet on phones. Inputs are 16 px (no iOS zoom), every
   control is at least 44 px tall and the layout respects the safe areas.
   ========================================================================== */
:root {
  --ink: #0b1220;
  --ink-2: #121c33;
  --gold: #e3b341;
  --gold-soft: #f0cf6a;
  --lime: #cffe25;
  --emerald: #10b981;
  --coral: #f06548;
  --text: #e9eef8;
  --muted: #8d97ab;
  --label: #c7d0e0;
  --surface: rgba(17, 26, 46, 0.92);
  --field: #0f1829;
  --border: rgba(255, 255, 255, 0.1);
  --radius: 24px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body.auth-body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px; line-height: 1.5; color: var(--text); background: var(--ink);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%;
}

.auth {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 16px calc(24px + env(safe-area-inset-bottom, 0px));
}
.auth-glow {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 45% at 85% 0%, rgba(227, 179, 65, 0.26) 0%, rgba(227, 179, 65, 0) 60%),
    radial-gradient(50% 40% at 0% 100%, rgba(16, 185, 129, 0.18) 0%, rgba(16, 185, 129, 0) 60%),
    linear-gradient(160deg, #0f1a30 0%, var(--ink) 60%, #070c17 100%);
}
.auth-glow::after {
  content: ""; position: absolute; inset: 0; opacity: 0.3;
  background-image: linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(70% 70% at 60% 30%, #000 0%, transparent 100%);
  mask-image: radial-gradient(70% 70% at 60% 30%, #000 0%, transparent 100%);
}

.auth-card {
  width: 100%; max-width: 420px;
  padding: 28px 24px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.9);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.auth-lockup { display: block; width: fit-content; margin: 0 auto 22px; }
.auth-lang { position: absolute; top: 14px; right: 14px; display: inline-flex; gap: 2px; padding: 2px; border-radius: 10px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.04); z-index: 2; }
.auth-lang button { min-width: 40px; min-height: 32px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: rgba(255, 255, 255, 0.6); font: inherit; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.04em; cursor: pointer; }
.auth-lang button.is-active { background: rgba(227, 179, 65, 0.18); color: var(--gold-soft); }
.auth-lang button:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 1px; }
.auth-lockup img { display: block; height: 40px; width: auto; }

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form[hidden] { display: none; }
.auth-form h1 { margin: 0; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.auth-lead { margin: -6px 0 4px; color: var(--muted); font-size: 0.95rem; }
.auth-form label, .auth-label { display: block; margin-bottom: 6px; font-size: 0.8rem; font-weight: 600; color: var(--label); }
.auth-label-hint { margin-left: 6px; font-weight: 500; color: var(--muted); }
.auth-form input[type="email"], .auth-form input[type="password"], .auth-form input[type="text"], .auth-form input[type="tel"] {
  width: 100%; min-height: 50px; padding: 12px 14px; margin: 0;
  font: inherit; font-size: 16px; color: var(--text);
  background: var(--field); border: 1px solid var(--border); border-radius: 14px; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-form input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(227, 179, 65, 0.25); }
.auth-form input::placeholder { color: rgba(141, 151, 171, 0.7); }
.auth-form input[readonly] { color: var(--muted); }

.auth-pw { position: relative; }
.auth-pw input { padding-right: 54px; }
.auth-eye {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border: 0; border-radius: 12px; background: none; color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.auth-eye svg { width: 22px; height: 22px; }
.auth-eye.is-on { color: var(--gold); }
.auth-eye .eye-off { display: none; }
.auth-eye.is-on .eye-on { display: none; }
.auth-eye.is-on .eye-off { display: block; }
.auth-eye:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }

.auth-row { display: flex; justify-content: flex-end; margin-top: -4px; }
.auth-row a, .auth-hint a, .auth-foot a, .auth-link, .auth-details summary { color: var(--gold-soft); }
.auth-row a, .auth-hint a { display: inline-flex; align-items: center; min-height: 44px; }
.auth-hint { margin: 0; font-size: 0.85rem; color: var(--muted); }

.auth-btn {
  min-height: 52px; border: 0; border-radius: 14px; padding: 0 18px;
  font: inherit; font-size: 1rem; font-weight: 700; color: var(--ink);
  background: linear-gradient(145deg, #f0c75e 0%, var(--gold) 55%, #c9962a 100%);
  box-shadow: 0 14px 30px -14px rgba(227, 179, 65, 0.8); cursor: pointer;
  transition: transform 0.15s var(--ease), filter 0.15s;
}
.auth-btn:hover { filter: brightness(1.04); }
.auth-btn:active { transform: scale(0.985); }
.auth-btn:disabled { opacity: 0.6; cursor: default; transform: none; }
.auth-btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.auth-link { min-height: 44px; border: 0; background: none; font: inherit; font-size: 0.9rem; text-decoration: underline; cursor: pointer; }
.auth-ghost { min-height: 48px; border: 1px solid var(--border); border-radius: 14px; background: rgba(255, 255, 255, 0.04); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.auth-ghost:hover { background: rgba(255, 255, 255, 0.08); }

/* "Continue with Google": Google's neutral button (white, 1px border, the G mark at 18px, 500 weight). */
.auth-google {
  display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 48px; border-radius: 14px; padding: 0 16px;
  border: 1px solid #dadce0; background: #fff; color: #1f1f1f; font: inherit; font-size: 0.95rem; font-weight: 500;
  text-decoration: none; cursor: pointer; transition: background 0.15s, box-shadow 0.15s, transform 0.15s var(--ease);
}
.auth-google:hover { background: #f7f8f8; box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15); }
.auth-google:active { transform: scale(0.985); }
.auth-google:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.auth-google svg { flex: 0 0 auto; }
.auth-google[hidden], .auth-divider[hidden] { display: none; }
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--label); font-size: 0.85rem; text-transform: lowercase; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.auth-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.75rem !important; letter-spacing: 0.4em; text-align: center; min-height: 60px !important; }

.auth-check { display: flex; gap: 12px; align-items: flex-start; min-height: 44px; font-size: 0.9rem; font-weight: 500; color: var(--label); cursor: pointer; }
.auth-check input { flex: 0 0 auto; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--gold); cursor: pointer; }
.auth-check[hidden] { display: none; }

.auth-details summary { display: flex; align-items: center; min-height: 44px; font-size: 0.9rem; list-style: none; cursor: pointer; }
.auth-details summary::-webkit-details-marker { display: none; }
.auth-details summary::before { content: "+"; display: inline-flex; width: 22px; height: 22px; margin-right: 8px; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid var(--border); font-size: 0.9rem; }
.auth-details[open] summary::before { content: "–"; }
.auth-details > :not(summary) { margin-top: 10px; }

.auth-status { margin: 16px 0 0; padding: 12px 14px; border-radius: 14px; font-size: 0.9rem; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border); }
.auth-status[hidden] { display: none; }
.auth-status.is-error { background: rgba(240, 101, 72, 0.14); border-color: rgba(240, 101, 72, 0.4); color: #ffb4a3; }
.auth-status.is-ok { background: rgba(16, 185, 129, 0.14); border-color: rgba(16, 185, 129, 0.4); color: #7ef0c3; }

.auth-foot { margin: 20px 0 0; font-size: 0.82rem; color: rgba(255, 255, 255, 0.5); text-align: center; max-width: 420px; }

.auth-summary { margin: 0 0 18px; }
.auth-summary[hidden] { display: none; }
.auth-kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.auth-kv:last-child { border-bottom: 0; }
.auth-kv span { color: var(--muted); flex-shrink: 0; }
.auth-kv b { font-weight: 600; text-align: right; overflow-wrap: anywhere; }

.auth-user { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 18px; text-align: center; }
.auth-user .av { width: 64px; height: 64px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.3rem; background: linear-gradient(135deg, #1c2a4a, #0b1220); color: var(--gold); border: 1px solid rgba(227, 179, 65, 0.45); margin-bottom: 6px; }
.auth-user b { font-size: 1.1rem; }
.auth-user span { color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }

.auth-rules { margin: -4px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.auth-rules li { font-size: 0.74rem; padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border); color: var(--muted); }

@media (max-width: 480px) {
  .auth { justify-content: flex-start; padding-top: calc(28px + env(safe-area-inset-top, 0px)); }
  .auth-card { padding: 24px 18px; border-radius: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-btn, .auth-form input, .auth-eye { transition: none !important; }
}

/* "Install the app" (capital-install.js): shown only on phones that can still install MyXCapital. */
.auth-install { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 50px; margin: 16px 0 0; border: 1px solid rgba(227, 179, 65, 0.45); border-radius: 14px; background: rgba(227, 179, 65, 0.1); color: var(--gold-soft); font: inherit; font-weight: 600; cursor: pointer; transition: background 140ms var(--ease), transform 120ms var(--ease); }
.auth-install svg { width: 20px; height: 20px; }
.auth-install:hover { background: rgba(227, 179, 65, 0.18); }
.auth-install:active { transform: scale(0.985); }
.auth-install:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.auth-install[hidden] { display: none; }

/* Dismissible notice above the sign-in form (?reason=replaced | mfa) */
.auth-notice { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 18px; padding: 12px 10px 12px 14px; border-radius: 14px; font-size: 0.9rem; line-height: 1.4; color: var(--text); background: rgba(227, 179, 65, 0.12); border: 1px solid rgba(227, 179, 65, 0.4); }
.auth-notice[hidden] { display: none; }
.auth-notice span { flex: 1 1 auto; }
.auth-notice-close { flex: 0 0 auto; width: 32px; height: 32px; margin: -6px -2px -6px 0; border: 0; border-radius: 10px; background: none; color: var(--gold-soft); font: inherit; font-size: 1.3rem; line-height: 1; cursor: pointer; }
.auth-notice-close:hover { background: rgba(255, 255, 255, 0.08); }
.auth-notice-close:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 1px; }

/* Signup page: the honeypot never shows; the Turnstile widget sits above the button. */
.auth-hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.auth-captcha { min-height: 65px; display: flex; justify-content: center; }
.auth-captcha[hidden] { display: none; }
.auth-foot-signup { margin-top: 18px; font-size: 0.95rem; color: var(--label); }
.auth-foot-signup a { font-weight: 700; }
