/* ──────────────────────────────────────────────────────────────────
   PulseLens · auth pages (login, register, forgot/reset password,
   verify-email-sent). Единый дизайн-язык со страницами продукта:
   OKLCH-палитра, Geist + Geist Mono, тёмная тема через data-theme.

   Совместимость с E2E: сохраняем id'ы #email, #password, #name,
   #confirmPassword, #pb1..#pb4, и классы .btn-primary, .input,
   .alert.alert-*.
   ────────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg-0: #fafafa;
    --bg-1: #ffffff;
    --bg-2: #f7f7f8;
    --bg-3: #f0f0f2;

    --border-1: #e8e8ec;
    --border-2: #d4d4d8;

    --fg-0: #0c0c0e;
    --fg-1: #1a1a1d;
    --fg-2: #52525b;
    --fg-3: #71717a;
    --fg-4: #a1a1aa;

    --accent: oklch(0.50 0.21 275);
    --accent-soft: oklch(0.50 0.21 275 / 0.10);
    --accent-bg: oklch(0.50 0.21 275 / 0.06);
    --accent-hover: oklch(0.45 0.21 275);

    --good: oklch(0.55 0.16 152);
    --good-bg: oklch(0.55 0.16 152 / 0.10);
    --warn: oklch(0.70 0.16 68);
    --warn-bg: oklch(0.70 0.16 68 / 0.10);
    --bad: oklch(0.58 0.22 28);
    --bad-bg: oklch(0.58 0.22 28 / 0.08);

    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-xl: 20px;

    --font-sans: 'Geist', -apple-system, system-ui, sans-serif;
    --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;

    --shadow-1: 0 1px 2px rgba(15, 15, 20, 0.04);
    --shadow-2: 0 4px 16px rgba(15, 15, 20, 0.06);
    --shadow-pop: 0 20px 60px rgba(15, 15, 20, 0.12);
}

:root[data-theme="dark"] {
    --bg-0: #0a0a0b;
    --bg-1: #131316;
    --bg-2: #1c1c20;
    --bg-3: #27272a;

    --border-1: #27272a;
    --border-2: #3f3f46;

    --fg-0: #fafaf9;
    --fg-1: #e4e4e7;
    --fg-2: #a1a1aa;
    --fg-3: #71717a;
    --fg-4: #52525b;

    --accent: oklch(0.65 0.21 275);
    --accent-soft: oklch(0.65 0.21 275 / 0.16);
    --accent-bg: oklch(0.65 0.21 275 / 0.10);
    --accent-hover: oklch(0.72 0.20 275);

    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-2: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-pop: 0 20px 60px rgba(0, 0, 0, 0.6);
}

html, body {
    height: 100%;
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    color: var(--fg-1);
    background: var(--bg-0);
}

a { color: inherit; text-decoration: none; }

/* ─── Two-pane layout ─────────────────────────────────────────────── */
.auth-root {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 460px);
    min-height: 100vh;
}

/* ── LEFT: brand panel with живой illustration ───────────────────── */
.auth-brand {
    position: relative;
    background: linear-gradient(135deg, var(--bg-2) 0%, var(--bg-1) 100%);
    padding: 40px 56px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid var(--border-1);
}

:root[data-theme="dark"] .auth-brand {
    background: linear-gradient(135deg, var(--bg-1) 0%, var(--bg-0) 100%);
}

.auth-brand::before {
    content: '';
    position: absolute;
    top: -200px;
    right: -200px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-soft) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.auth-brand > * { position: relative; z-index: 1; }

.auth-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    align-self: flex-start;
}
.auth-logo-mark {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    /* Содержит inline SVG (pentagon) — тот же что в topbar. Без background,
       чтобы pentagon виден целиком, не на квадратном фоне. */
}
.auth-logo-mark svg { width: 28px; height: 28px; display: block; }
.auth-logo-name {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--fg-0);
}
.auth-logo-sub {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--fg-3);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 2px;
}

.auth-brand-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin: 32px 0;
    max-width: 520px;
}

.auth-eyebrow {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--fg-3);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 18px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
}
.auth-eyebrow-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    animation: auth-pulse 2.4s ease-in-out infinite;
}
@keyframes auth-pulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.4); }
}

.auth-h1 {
    font-size: 38px;
    line-height: 1.08;
    letter-spacing: -0.02em;
    font-weight: 600;
    color: var(--fg-0);
    margin-bottom: 16px;
    text-wrap: balance;
}
.auth-h1 em {
    font-style: normal;
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hover) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.auth-h1-sub {
    font-size: 15px;
    line-height: 1.55;
    color: var(--fg-2);
    max-width: 460px;
}

/* ── AI-chat mockup в illustration ────────────────────────────────── */
.auth-mockup {
    margin-top: 32px;
    background: var(--bg-1);
    border: 1px solid var(--border-1);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-2);
    overflow: hidden;
    max-width: 440px;
}
.auth-mockup-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-1);
    background: var(--bg-2);
}
.auth-mockup-particle {
    position: relative;
    width: 16px;
    height: 16px;
}
.auth-mockup-particle-core {
    position: absolute;
    inset: 4px;
    background: var(--accent);
    border-radius: 50%;
    animation: auth-particle-core 2.2s ease-in-out infinite;
}
.auth-mockup-particle::before,
.auth-mockup-particle::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid var(--accent);
    animation: auth-particle-ping 2.6s cubic-bezier(0, 0, 0.2, 1) infinite;
}
.auth-mockup-particle::after { animation-delay: 1.3s; }
@keyframes auth-particle-core {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}
@keyframes auth-particle-ping {
    75%, 100% { transform: scale(2.4); opacity: 0; }
}
.auth-mockup-title {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--fg-3);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.auth-mockup-body { padding: 14px; min-height: 220px; }
.auth-msg { margin-bottom: 12px; max-width: 92%; }
.auth-msg.is-user { margin-left: auto; }
.auth-msg-bubble {
    padding: 10px 12px;
    border-radius: var(--r-md);
    font-size: 13px;
    line-height: 1.45;
    color: var(--fg-1);
}
.auth-msg.is-user .auth-msg-bubble {
    background: var(--accent-bg);
    color: var(--fg-0);
}
.auth-msg.is-ai .auth-msg-bubble {
    background: var(--bg-2);
}
.auth-msg-bubble strong { color: var(--fg-0); font-weight: 600; }
.auth-msg-bubble .signal {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 10px;
    margin-right: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.auth-msg-bubble .signal.warn { background: var(--warn-bg); color: var(--warn); }
.auth-msg-bubble .signal.ok { background: var(--good-bg); color: var(--good); }

.auth-brand-foot {
    display: flex;
    align-items: center;
    gap: 16px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--fg-3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.auth-brand-foot::before {
    content: '';
    width: 24px;
    height: 1px;
    background: var(--border-2);
}

.auth-brand-locale {
    margin-left: auto;
    padding: 4px 10px;
    border: 1px solid var(--border-2);
    border-radius: 6px;
    color: var(--fg-3);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.auth-brand-locale:hover {
    color: var(--fg-1);
    border-color: var(--border-1);
    background: var(--bg-2);
}

/* ── RIGHT: auth form panel ───────────────────────────────────────── */
.auth-panel {
    background: var(--bg-0);
    padding: 48px 56px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.auth-panel-top {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 24px;
    gap: 12px;
}
.auth-theme-toggle {
    background: transparent;
    border: 1px solid var(--border-1);
    color: var(--fg-2);
    border-radius: var(--r-sm);
    padding: 6px 10px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.12s;
}
.auth-theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

.auth-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 360px;
    margin: 0 auto;
    width: 100%;
}

.auth-card-mobile-logo {
    display: none;
    margin-bottom: 24px;
}

.auth-h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--fg-0);
    letter-spacing: -0.01em;
    margin-bottom: 6px;
}
.auth-h2-sub {
    font-size: 13px;
    color: var(--fg-2);
    margin-bottom: 28px;
    line-height: 1.5;
}

/* ── Form ─────────────────────────────────────────────────────────── */
.field { margin-bottom: 14px; }

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.label {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--fg-3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
}
.label-link {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.label-link:hover { text-decoration: underline; }

.input-wrap { position: relative; }
.input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-1);
    border-radius: var(--r-sm);
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--fg-0);
    background: var(--bg-1);
    transition: border-color 0.12s, box-shadow 0.12s;
}
.input:hover { border-color: var(--border-2); }
.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}
.input::placeholder { color: var(--fg-4); }

.input-icon-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 0;
    color: var(--fg-3);
    cursor: pointer;
    padding: 4px;
    display: grid;
    place-items: center;
    border-radius: 4px;
}
.input-icon-btn:hover { color: var(--accent); }

.input-with-toggle { padding-right: 36px; }

/* Password strength */
.pwd-strength {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-top: 6px;
}
.pwd-bar {
    height: 3px;
    border-radius: 2px;
    background: var(--bg-3);
    transition: background 0.18s;
}
.pwd-bar.is-bad { background: var(--bad); }
.pwd-bar.is-warn { background: var(--warn); }
.pwd-bar.is-ok { background: var(--good); }

.pwd-hint {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--fg-3);
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.remember-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--fg-2);
    margin-bottom: 18px;
    cursor: pointer;
}
.remember-row input { accent-color: var(--accent); }

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn-primary {
    width: 100%;
    padding: 11px 16px;
    background: var(--accent);
    color: white;
    border: 0;
    border-radius: var(--r-sm);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.12s, transform 0.12s;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(0.99); }
.btn-primary[disabled] { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 11px 16px;
    background: transparent;
    color: var(--fg-1);
    border: 1px solid var(--border-2);
    border-radius: var(--r-sm);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.12s;
    text-align: center;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 22px 0;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--fg-3);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-1);
}

/* ── Alerts (preserve существующие класс-имена) ───────────────────── */
.alert {
    padding: 10px 12px;
    border-radius: var(--r-sm);
    font-size: 12px;
    line-height: 1.45;
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.alert-ok    { background: var(--good-bg); color: var(--good); border: 1px solid color-mix(in oklch, var(--good) 30%, transparent); }
.alert-warn  { background: var(--warn-bg); color: var(--warn); border: 1px solid color-mix(in oklch, var(--warn) 30%, transparent); }
.alert-error { background: var(--bad-bg); color: var(--bad); border: 1px solid color-mix(in oklch, var(--bad) 30%, transparent); }
.alert a { text-decoration: underline; }

/* ── Foot links ───────────────────────────────────────────────────── */
.auth-foot {
    margin-top: 28px;
    text-align: center;
    font-size: 13px;
    color: var(--fg-2);
}
.auth-foot a { color: var(--accent); }
.auth-foot a:hover { text-decoration: underline; }

.auth-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 32px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--fg-3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.auth-meta a:hover { color: var(--accent); }

/* ── Empty/success states ─────────────────────────────────────────── */
.auth-state {
    text-align: center;
    padding: 32px 0;
}
.auth-state-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid;
    place-items: center;
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .auth-root { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
    .auth-card-mobile-logo { display: flex; }
    .auth-panel { padding: 32px 24px; min-height: 100vh; }
}
