/* ═══════════════════════════════════════════════════════════════════════════
   crm_auth.css — sign-in pages of the new CRM design (pages/auth/*): login, two-factor.
   Same tokens as every page (crm_tokens.css + the company palette), CRM component sizes, and the same theme-aware
   "modern" background as the portal sign-in (portal views_new portal_ui.css): drifting palette glows, a fine fading
   grid and a brand-gradient market line — pure CSS, follows light / dark and every company palette.
   ═══════════════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }
html, body { min-height: 100%; }
body.crm-auth {
  margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased;
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; position: relative; isolation: isolate; overflow-x: hidden;
}
body.crm-auth a { color: var(--primary-2); text-decoration: none; font-weight: 600; }
body.crm-auth a:hover { text-decoration: underline; }

/* ── Background ── */
.auth-bg, .auth-bg::before, .auth-bg::after { position: fixed; pointer-events: none; }
.auth-bg { inset: 0; z-index: -1; overflow: hidden; }
.auth-bg::before {
  content: ""; inset: -15%;
  background:
    radial-gradient(38% 34% at 16% 20%, color-mix(in srgb, var(--primary) 32%, transparent), transparent 70%),
    radial-gradient(32% 36% at 86% 16%, color-mix(in srgb, var(--cyan) 22%, transparent), transparent 70%),
    radial-gradient(44% 40% at 68% 92%, color-mix(in srgb, var(--primary-2) 26%, transparent), transparent 70%);
  filter: blur(30px); opacity: .8; animation: auth-aurora 26s ease-in-out infinite alternate;
}
:root[data-theme="dark"] .auth-bg::before { opacity: 1; }
.auth-bg::after {
  content: ""; inset: 0;
  background:
    linear-gradient(color-mix(in srgb, var(--text) 7%, transparent) 1px, transparent 1px) 0 0 / 46px 46px,
    linear-gradient(90deg, color-mix(in srgb, var(--text) 7%, transparent) 1px, transparent 1px) 0 0 / 46px 46px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 25%, transparent 78%);
  mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 25%, transparent 78%);
}
.auth-line, .auth-area { position: fixed; left: 0; right: 0; bottom: 0; height: 44vh; z-index: -1; pointer-events: none;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-size: 100% 100%; mask-size: 100% 100%; }
.auth-line { background: var(--grad); opacity: .55;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 400' preserveAspectRatio='none'%3E%3Cpath d='M0 318 C 90 300 150 330 230 296 S 360 238 440 262 S 560 318 650 270 S 790 168 880 196 S 1010 262 1090 214 S 1230 98 1310 120 S 1410 86 1440 70' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 400' preserveAspectRatio='none'%3E%3Cpath d='M0 318 C 90 300 150 330 230 296 S 360 238 440 262 S 560 318 650 270 S 790 168 880 196 S 1010 262 1090 214 S 1230 98 1310 120 S 1410 86 1440 70' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E"); }
.auth-area { background: linear-gradient(to bottom, color-mix(in srgb, var(--primary) 22%, transparent), transparent 90%);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 400' preserveAspectRatio='none'%3E%3Cpath d='M0 318 C 90 300 150 330 230 296 S 360 238 440 262 S 560 318 650 270 S 790 168 880 196 S 1010 262 1090 214 S 1230 98 1310 120 S 1410 86 1440 70 L 1440 400 L 0 400 Z' fill='%23000'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 400' preserveAspectRatio='none'%3E%3Cpath d='M0 318 C 90 300 150 330 230 296 S 360 238 440 262 S 560 318 650 270 S 790 168 880 196 S 1010 262 1090 214 S 1230 98 1310 120 S 1410 86 1440 70 L 1440 400 L 0 400 Z' fill='%23000'/%3E%3C/svg%3E"); }
:root[data-theme="dark"] .auth-line { opacity: .85; }
:root[data-theme="dark"] .auth-area { background: linear-gradient(to bottom, color-mix(in srgb, var(--primary) 32%, transparent), transparent 90%); }
@keyframes auth-aurora { 0% { transform: none; } 50% { transform: translate3d(2%, -2%, 0) scale(1.05); } 100% { transform: translate3d(-2%, 2%, 0) scale(1.02); } }
@media (prefers-reduced-motion: reduce) { .auth-bg::before { animation: none; } .auth-card { animation: none !important; } }

/* ── Top bar: theme toggle (CRM .icon-btn) ── */
.auth-top { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 24px 0; }

/* ── Card ── */
.auth-main { flex: 1; display: grid; place-items: center; padding: 24px 16px 48px; }
.auth-card {
  width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 28px 26px 24px; animation: auth-rise .4s cubic-bezier(.16, 1, .3, 1) both;
}
@keyframes auth-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.auth-logo { display: grid; place-items: center; min-height: 44px; margin: 0 0 18px; }
.auth-logo img { max-height: 48px; max-width: 220px; object-fit: contain; }
:root[data-theme="dark"] .auth-logo img { filter: brightness(0) invert(1) drop-shadow(0 0 6px rgba(255, 255, 255, .3)); }
.auth-logo .logo-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 18px; }
.auth-card h1 { margin: 0; font-size: 19px; font-weight: 700; text-align: center; }
.auth-card .auth-sub { margin: 4px 0 20px; color: var(--muted); font-size: 13px; text-align: center; }
.auth-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.auth-pass { position: relative; }
.auth-pass .input { padding-inline-end: 64px; }
.auth-pass .auth-show {
  position: absolute; inset-inline-end: 7px; top: 50%; transform: translateY(-50%); height: 28px; padding: 0 9px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: 700 11.5px/1 var(--font); text-transform: uppercase; letter-spacing: .03em; cursor: pointer;
}
.auth-pass .auth-show:hover { color: var(--primary-2); border-color: var(--primary); }
.auth-captcha { display: flex; justify-content: center; }
.auth-captcha:has(#recaptcha_box:empty) { display: none; }
.auth-card .btn-block { width: 100%; min-height: 44px; margin-top: 4px; }
.auth-card .alert { margin: 0 0 14px; }
.auth-foot { text-align: center; color: var(--muted); font-size: 12px; padding: 0 16px 18px; }
@media (max-width: 480px) { .auth-card { padding: 22px 18px 18px; } .auth-top { padding: 12px 12px 0; } }
.auth-row label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.auth-top svg[hidden] { display: none; }
