*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0; min-height: 100vh; min-height: 100dvh;
    display: flex; align-items: center; justify-content: center;
    padding: 40px 16px; color: var(--text);
    background-color: #10172e;
    background-image:
        radial-gradient(ellipse at 12% 12%, rgba(124, 93, 255, 0.38), transparent 52%),
        radial-gradient(ellipse at 90% 88%, rgba(70, 127, 194, 0.24), transparent 48%),
        linear-gradient(145deg, #151c39, #0b1024 65%);
    background-repeat: no-repeat;
    font-family: var(--font); font-size: 15px; line-height: 1.65;
}
.auth-shell { width: min(480px, 100%); }
.auth-visual { display: none; }
.login-panel {
    width: min(480px, 100%); background: var(--card); border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 32px 100px rgba(3, 7, 20, 0.4), 0 0 0 8px rgba(255, 255, 255, 0.025);
    overflow: hidden;
}
.auth-brand { padding: 32px 36px; background: var(--nav-bg); border-top: 5px solid #7c5dff; }
.auth-brand p { margin: 10px 0 0; color: #bdc7e0; font-size: 12px; }
.auth-home-link {
    display: flex; align-items: center; gap: 8px; width: fit-content; min-height: 44px;
    margin: -12px 0 16px; padding: 8px 12px; border: 1px solid #ffffff26; border-radius: 8px;
    color: #d4caff; font-size: 12px; font-weight: 600;
    transition: background-color 150ms ease, border-color 150ms ease;
}
.auth-home-link:hover { color: #fff; background: #ffffff0d; border-color: #b6a1ff80; }
.auth-home-link:focus-visible, .auth-brand .brand-wordmark:focus-visible { outline: 2px solid #b6a1ff; outline-offset: 4px; }
.auth-content { padding: 36px; }
h1 { margin: 0 0 14px; font-size: 28px; line-height: 1.2; letter-spacing: -0.8px; color: var(--heading); }
p { margin: 0 0 24px; color: #536079; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 600; color: #536079; }
input {
    width: 100%; min-height: 46px; margin: 0 0 18px; padding: 12px 14px;
    border: 1px solid #d8ddea; border-radius: 9px;
    background: var(--card); color: var(--text); font: inherit;
}
input::placeholder { color: #8992a5; }
input:focus { border-color: #8b72ed; outline: none; box-shadow: 0 0 0 3px rgba(101,70,219,0.12); }
button {
    width: 100%; min-height: 48px; padding: 14px 20px; margin-top: 4px;
    border: 1px solid var(--primary); border-radius: 9px;
    background: var(--primary); color: #fff; font: inherit; font-weight: 700; cursor: pointer;
    transition: background-color 150ms ease;
}
button:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.password-field {
    display: grid; grid-template-columns: minmax(0, 1fr) 48px; align-items: center;
    margin-bottom: 18px; border: 1px solid #d8ddea; border-radius: 9px; background: var(--card);
}
.password-field:focus-within { border-color: #8b72ed; box-shadow: 0 0 0 3px rgba(101,70,219,0.12); }
.password-field input { min-width: 0; margin: 0; border: 0; background: transparent; }
.password-field input:focus { box-shadow: none; }
.password-field .password-visibility {
    display: grid; place-items: center; width: 44px; min-height: 44px; padding: 0; margin: 0;
    border: 0; border-radius: 7px; color: #536079; background: transparent;
}
.password-field .password-visibility:hover { color: var(--primary); background: var(--primary-soft); }
.password-visibility svg { width: 21px; height: 21px; }
.password-visibility .eye-slash { display: none; }
.password-visibility[data-visible="true"] .eye-slash { display: block; }
.flash { margin: 0 0 20px; padding: 14px 16px; border: 1px solid #f0cbd2; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-size: 13px; }
.flash.success, .flash[role="status"] { color: var(--success); background: var(--success-soft); border-color: #cde8dc; }
.flash.account-notice { color: #493480; background: #f3efff; border-color: #d9cef5; }
.field-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 7px; }
.field-heading label { margin-bottom: 0; }
.auth-text-link { display: inline-flex; align-items: center; min-height: 32px; padding: 2px 0; font-size: 12px; font-weight: 600; }
.auth-text-link:hover { color: var(--primary-hover); }
.auth-actions { display: grid; gap: 10px; margin-top: 20px; }
.auth-nav-link {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    min-height: 46px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 9px;
    background: var(--bg-alt); color: #536079; font-size: 13px; font-weight: 600; line-height: 1.5;
    transition: background-color 150ms ease, border-color 150ms ease;
}
.auth-nav-link > span[aria-hidden] { color: var(--primary); font-size: 18px; flex-shrink: 0; }
.auth-nav-link:hover { color: var(--primary); background: var(--primary-soft); border-color: var(--primary-border); }
.auth-nav-link.auth-back { justify-content: center; }
.auth-switch { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 16px; margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border); }
.auth-switch p { margin: 0; font-size: 13px; }
.auth-secondary-button {
    display: inline-flex; justify-content: center; align-items: center; min-height: 44px; padding: 10px 20px;
    border: 1px solid var(--primary-border); border-radius: 9px; background: var(--primary-soft);
    color: var(--primary); font-size: 13px; font-weight: 700;
    transition: background-color 150ms ease, border-color 150ms ease;
}
.auth-secondary-button:hover { background: #e9e2ff; border-color: #b5a4ed; }
.auth-primary-link {
    display: flex; justify-content: center; align-items: center; min-height: 48px; padding: 14px 20px;
    border-radius: 9px; background: var(--primary); color: #fff; font-size: 15px; font-weight: 700;
}
.auth-primary-link:hover { background: var(--primary-hover); color: #fff; }
.field-help { margin: -8px 0 20px; padding: 10px 14px; background: var(--primary-soft); border-left: 3px solid #8b72ed; border-radius: 0 6px 6px 0; font-size: 12px; }
.auth-footer { margin: 0; padding: 18px 28px; border-top: 1px solid var(--border); background: var(--bg-alt); color: var(--muted); text-align: center; font-size: 11px; }
.auth-footer-link { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; margin-top: 4px; font-size: 13px; font-weight: 700; }
@media (min-width: 960px) {
    .auth-shell {
        display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 480px);
        width: min(1080px, 100%); border: 1px solid rgba(255, 255, 255, 0.16);
        border-top: 5px solid #7c5dff; border-radius: 20px; overflow: hidden;
        background: var(--card); box-shadow: 0 32px 100px rgba(3, 7, 20, 0.4);
    }
    .auth-visual {
        display: flex; align-items: flex-end; position: relative; min-width: 0;
        padding: clamp(32px, 4vw, 52px);
        background-color: #172039;
        background-image: linear-gradient(180deg, rgba(16, 23, 46, 0.06) 25%, rgba(16, 23, 46, 0.65) 55%, #10172e 100%), var(--auth-image, url('../img/auth-workspace.webp'));
        background-size: cover; background-position: center;
    }
    .auth-visual--register { --auth-image: url('../img/auth-register.webp'); }
    .auth-visual--recovery { --auth-image: url('../img/auth-recovery.webp'); }
    .auth-visual--verification { --auth-image: url('../img/auth-verification.webp'); }
    .auth-visual-copy { position: relative; max-width: 420px; }
    .auth-visual-copy .auth-visual-kicker { margin: 0 0 18px; color: #d4caff; font-size: 10px; font-weight: 700; letter-spacing: 2px; }
    .auth-visual h2 { margin: 0 0 22px; color: #fff; font-size: clamp(36px, 3.6vw, 50px); font-weight: 700; line-height: 1.08; letter-spacing: -1.8px; }
    .auth-visual-copy > p:last-child { margin: 0; color: #d9deee; font-size: 14px; line-height: 1.8; }
    .auth-shell .login-panel { width: 100%; border: 0; border-radius: 0; box-shadow: none; }
    .auth-shell .auth-brand { border-top: 0; }
}
@media (max-width: 480px) {
    body { padding: 24px 12px; }
    .auth-brand { padding: 26px; }
    .auth-content { padding: 28px 24px; }
    h1 { font-size: 26px; }
    input { font-size: 16px; }
}
@media (max-width: 360px) {
    .auth-switch { grid-template-columns: 1fr; gap: 10px; text-align: center; }
}
@media (prefers-reduced-motion: reduce) { button, a { transition: none; } }

.legal-acceptance { display: flex; align-items: flex-start; gap: 10px; margin: 8px 0 14px; font-size: 12px; font-weight: 400; }
.legal-acceptance input[type="checkbox"] { width: 18px; min-width: 18px; height: 18px; min-height: 18px; margin: 3px 0 0; padding: 0; accent-color: var(--primary); }
