/* ============================================================
   auth.css — общие стили страниц входа и регистрации
   ============================================================ */

:root {
    --brand: #366ef4;
    --brand-dark: #3158b5;
    --brand-ring: rgba(54, 110, 244, .22);
    --brand-soft: #eef3fe;
    --ink: #0f172a;
    --ink-2: #334155;
    --muted: #64748b;
    --muted-2: #94a3b8;
    --line: #e2e8f0;
    --line-2: #cbd5e1;
    --bg: #ffffff;
    --bg-2: #f8fafc;
    --panel: #0b1220;
    --panel-line: #1c2740;
    --panel-text: #f1f5f9;
    --panel-muted: #94a3b8;
    --danger: #b91c1c;
    --danger-bg: #fef2f2;
    --danger-line: #fecaca;
    --ok: #15803d;
    --ok-bg: #f0fdf4;
    --ok-line: #bbf7d0;
    --warn: #b45309;
    --radius: 8px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: 'Onest', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
svg { display: block; }

/* ---------- Layout ---------- */
.auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
}

/* ---------- Brand panel ---------- */
.brand {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 36px 48px;
    color: var(--panel-text);
    background-color: var(--panel);
    background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1.5px);
    background-size: 22px 22px;
    border-right: 1px solid var(--panel-line);
}
.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    text-decoration: none;
}
.logo svg { width: 28px; height: 28px; flex: none; }
.logo b { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.brand__body { margin: auto 0; padding: 56px 0; max-width: 460px; }
.brand h2 {
    margin: 0;
    font-size: 44px;
    line-height: 1.1;
    font-weight: 600;
    letter-spacing: -.025em;
    max-width: 16ch;
}
.brand p {
    margin: 20px 0 0;
    font-size: 17px;
    line-height: 1.5;
    color: var(--panel-muted);
    max-width: 44ch;
}
.brand__foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 12.5px;
    color: var(--panel-muted);
}
.modules { display: flex; flex-wrap: wrap; gap: 4px 0; margin: 0; padding: 0; list-style: none; }
.modules li { display: inline-flex; align-items: center; }
.modules li + li::before {
    content: "";
    width: 3px; height: 3px;
    margin: 0 10px;
    border-radius: 50%;
    background: var(--panel-line);
}

/* ---------- Form panel ---------- */
.panel { display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
    display: none;
    align-items: center;
    height: 60px;
    padding: 0 24px;
    border-bottom: 1px solid var(--line);
}
.topbar .logo b { color: var(--ink); }
.panel__body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
}
.form { width: 100%; max-width: var(--form-w, 400px); }
.form h1 {
    margin: 0 0 6px;
    font-size: 26px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -.02em;
}
.form .lead { margin: 0 0 28px; color: var(--muted); }

/* ---------- Alerts ---------- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 20px;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.45;
    color: var(--danger);
    background: var(--danger-bg);
    border: 1px solid var(--danger-line);
    border-radius: var(--radius);
}
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert--ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); }
.alert--info { color: #1e40af; background: #eff6ff; border-color: #bfdbfe; }

/* ---------- Fields ---------- */
.field { margin-bottom: 18px; }
.field label {
    display: block;
    margin-bottom: 6px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink-2);
}
.control { position: relative; display: flex; align-items: center; }
.control .lead-icon {
    position: absolute;
    left: 13px;
    width: 18px; height: 18px;
    color: var(--muted-2);
    pointer-events: none;
    transition: color .15s;
}
.control:focus-within .lead-icon { color: var(--brand); }
.control input {
    width: 100%;
    height: 46px;
    padding: 0 12px 0 42px;
    font: inherit;
    font-size: 16px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    outline: none;
    appearance: none;
    transition: border-color .15s, box-shadow .15s;
}
.control input.has-toggle { padding-right: 46px; }
.control input::placeholder { color: #a3adbd; }
.control input:hover { border-color: #9aa6b8; }
.control input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.control input[aria-invalid="true"] { border-color: #ef4444; }
.control input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(239, 68, 68, .18); }
input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px #fff inset;
    -webkit-text-fill-color: var(--ink);
}

.toggle {
    position: absolute;
    right: 6px;
    width: 34px; height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: var(--muted);
    background: none;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
}
.toggle:hover { color: var(--ink); background: var(--bg-2); }
.toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.toggle svg { width: 18px; height: 18px; }
.toggle .ico-off { display: none; }
.toggle[aria-pressed="true"] .ico-on { display: none; }
.toggle[aria-pressed="true"] .ico-off { display: block; }

.hint { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.hint--caps {
    display: none;
    align-items: center;
    gap: 6px;
    color: var(--warn);
}
.hint--caps.is-on { display: flex; }
.hint--caps svg { width: 14px; height: 14px; }
.hint--error { display: none; color: var(--danger); }
.hint--error.is-on { display: block; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 46px;
    margin-top: 8px;
    padding: 0 16px;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    background: var(--brand);
    border: 0;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color .15s, transform .05s;
}
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn[disabled] { background: #86a5f3; cursor: default; transform: none; }
.btn svg { width: 18px; height: 18px; }
.btn .spin { display: none; animation: spin .8s linear infinite; }
.btn.is-loading .arrow { display: none; }
.btn.is-loading .spin { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.alt {
    margin-top: 28px;
    padding-top: 20px;
    font-size: 14px;
    color: var(--muted);
    text-align: center;
    border-top: 1px solid var(--line);
}
.alt a { color: var(--brand); font-weight: 600; text-decoration: none; }
.alt a:hover { text-decoration: underline; }

.panel__foot {
    padding: 20px 24px;
    font-size: 12.5px;
    color: var(--muted);
    text-align: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
    .auth { grid-template-columns: 1fr; }
    .brand { display: none; }
    .topbar { display: flex; }
    .panel__body { align-items: flex-start; padding: 40px 24px; }
}
@media (max-width: 480px) {
    .form h1 { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
