/* Вожатский ID — единый сервис авторизации.
   Стиль: Apple HIG + Google Material 3.
   - крупные скругления, спокойные поверхности, выразительная типографика;
   - состояния покоя/наведения/фокуса/ошибки;
   - тач-цели ≥ 44px, контраст WCAG AA, поддержка prefers-reduced-motion. */

body.auth {
    --auth-aside: #0B1220;
    --auth-aside-2: #111C31;
    --auth-radius: 14px;
    --auth-radius-lg: 22px;
    --auth-field-h: 52px;
    --auth-line: #D5DAE1;
    --auth-line-soft: #E7EBF0;
    --auth-focus: rgba(255, 140, 50, .16);

    margin: 0;
    min-height: 100vh;
    background: var(--vz-bg-soft);
    color: var(--vz-text);
    font-family: var(--vz-font);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* --- Каркас: две колонки --- */
.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
    min-height: 100vh;
}

/* --- Левая панель бренда --- */
.auth-aside {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 40px;
    padding: 48px clamp(32px, 5vw, 72px);
    color: #fff;
    background:
        radial-gradient(120% 90% at 100% 0%, rgba(255, 140, 50, .28) 0%, rgba(255, 140, 50, 0) 55%),
        radial-gradient(90% 70% at 0% 100%, rgba(249, 115, 22, .22) 0%, rgba(249, 115, 22, 0) 60%),
        linear-gradient(160deg, var(--auth-aside-2), var(--auth-aside));
}
.auth-aside::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(80% 70% at 30% 20%, #000 0%, transparent 80%);
    -webkit-mask-image: radial-gradient(80% 70% at 30% 20%, #000 0%, transparent 80%);
    pointer-events: none;
}
.auth-aside > * { position: relative; }

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -.01em;
}
.auth-brand:hover { color: #fff; text-decoration: none; }
.auth-brand__mark {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, var(--vz-orange-500), var(--vz-orange-600));
    box-shadow: 0 10px 26px rgba(249, 115, 22, .45);
}
.auth-brand__meta { display: flex; flex-direction: column; line-height: 1.2; }
.auth-brand__meta small { font-size: .72rem; font-weight: 600; color: rgba(255, 255, 255, .6); }

.auth-hero { max-width: 30ch; }
.auth-hero__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 18px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #FFD9BC;
    background: rgba(255, 140, 50, .16);
    border: 1px solid rgba(255, 140, 50, .32);
}
.auth-hero__title {
    margin: 0 0 16px;
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -.02em;
    color: #fff;
}
.auth-hero__title .accent { color: var(--vz-orange-500); }
.auth-hero__lead { margin: 0; color: rgba(255, 255, 255, .74); font-size: 1rem; line-height: 1.65; }

.auth-points { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 14px; }
.auth-points li { display: flex; gap: 12px; align-items: flex-start; color: rgba(255, 255, 255, .86); font-size: .92rem; line-height: 1.5; }
.auth-points .ic {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 140, 50, .2);
    color: var(--vz-orange-500);
    font-size: 13px;
    font-weight: 800;
}

.auth-aside__foot { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; color: rgba(255, 255, 255, .55); font-size: .8rem; font-weight: 600; }
.auth-aside__foot span { display: inline-flex; align-items: center; gap: 8px; }
.auth-aside__dot { width: 7px; height: 7px; border-radius: 999px; background: #34D399; box-shadow: 0 0 0 4px rgba(52, 211, 153, .18); }

/* --- Правая панель с формой --- */
.auth-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 44px clamp(20px, 4vw, 56px);
    background: var(--vz-bg-soft);
}
.auth-panel { width: 100%; max-width: 424px; }

.auth-mobile-brand { display: none; }

.auth-head { margin-bottom: 26px; }
.auth-title {
    margin: 0 0 8px;
    font-size: 1.7rem;
    font-weight: 900;
    letter-spacing: -.02em;
    color: var(--vz-text);
}
.auth-sub { margin: 0; color: var(--vz-muted); font-size: .94rem; line-height: 1.55; }

/* --- Сообщения --- */
.auth-alert {
    display: flex;
    gap: 11px;
    align-items: flex-start;
    padding: 13px 15px;
    margin-bottom: 22px;
    border-radius: var(--auth-radius);
    font-size: .88rem;
    font-weight: 600;
    line-height: 1.5;
    border: 1px solid transparent;
}
.auth-alert__ic { flex-shrink: 0; font-size: 1rem; line-height: 1.4; }
.auth-alert--error { background: var(--vz-danger-soft); color: #9F1239; border-color: rgba(220, 38, 38, .18); }
.auth-alert--success { background: var(--vz-success-soft); color: #14532D; border-color: rgba(22, 163, 74, .2); }
.auth-alert--info { background: var(--vz-primary-soft); color: #9A3412; border-color: rgba(249, 115, 22, .22); }

/* --- Ошибка входа прямо в форме (под полями) --- */
.auth-form-error {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 2px 0 14px;
    padding: 12px 14px;
    border-radius: var(--auth-radius);
    background: var(--vz-danger-soft);
    border: 1px solid rgba(220, 38, 38, .22);
    color: #9F1239;
    font-size: .88rem;
    font-weight: 600;
    line-height: 1.5;
    animation: auth-error-in .28s var(--vz-ease-out);
}
.auth-form-error__ic {
    flex: 0 0 20px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #DC2626; color: #fff;
    font-size: .78rem; font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center;
}
.auth-form.has-error input[aria-invalid="true"] {
    border-color: #DC2626;
    background: #fff5f5;
}
.auth-form.has-error input[aria-invalid="true"]:focus {
    border-color: #DC2626;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, .14);
}
@keyframes auth-error-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- Поля --- */
.auth-form { display: block; }
.field { margin-bottom: 18px; }
.field__label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.field label {
    display: block;
    margin-bottom: 7px;
    font-size: .84rem;
    font-weight: 700;
    color: var(--vz-text-2);
    letter-spacing: -.005em;
}
.field__aside { font-size: .82rem; font-weight: 700; color: var(--vz-primary-deep); white-space: nowrap; }

.field__control { position: relative; }
.field__control input {
    width: 100%;
    height: var(--auth-field-h);
    padding: 0 16px;
    border: 1.5px solid var(--auth-line);
    border-radius: var(--auth-radius);
    background: #fff;
    color: var(--vz-text);
    font: inherit;
    font-size: .96rem;
    font-weight: 500;
    transition: border-color .18s var(--vz-ease), box-shadow .18s var(--vz-ease), background .18s var(--vz-ease);
}
.field__control input::placeholder { color: var(--vz-text-light); font-weight: 500; }
.field__control input:hover { border-color: var(--vz-line-strong); }
.field__control input:focus {
    outline: none;
    border-color: var(--vz-orange-500);
    box-shadow: 0 0 0 4px var(--auth-focus);
}
.field__control input:focus-visible { outline: none; }
.field--with-toggle .field__control input { padding-right: 52px; }

.field__toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--vz-muted);
    cursor: pointer;
    transition: background .15s, color .15s;
}
.field__toggle:hover { background: var(--vz-surface-3); color: var(--vz-text); }
.field__toggle:focus-visible { outline: 2px solid var(--vz-orange-500); outline-offset: 2px; }
.field__toggle svg { width: 20px; height: 20px; }
.field__toggle .i-eye-off { display: none; }
.field__toggle.is-on .i-eye { display: none; }
.field__toggle.is-on .i-eye-off { display: block; }

.field__hint { margin: 7px 0 0; font-size: .78rem; color: var(--vz-text-light); }
.field__opt { color: var(--vz-text-light); font-weight: 500; }
.field__error { margin: 7px 0 0; font-size: .78rem; font-weight: 600; color: #9F1239; }
.field__error.is-ok { color: #14532D; }
.field.is-invalid input { border-color: var(--vz-danger); box-shadow: 0 0 0 4px var(--vz-danger-soft); }

/* Индикатор надёжности пароля */
.strength { margin-top: 10px; }
.strength__track { height: 6px; border-radius: 999px; background: var(--vz-surface-3); overflow: hidden; }
.strength__bar { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--vz-danger); transition: width .3s var(--vz-ease), background .3s var(--vz-ease); }
.strength[data-level="2"] .strength__bar { background: var(--vz-warning); }
.strength[data-level="3"] .strength__bar { background: #EAB308; }
.strength[data-level="4"] .strength__bar { background: var(--vz-success); }
.strength__label { display: block; margin-top: 6px; font-size: .76rem; font-weight: 600; color: var(--vz-muted); }

/* --- Кнопки и подвал формы --- */
.auth-form .btn { width: 100%; margin-top: 6px; }
.auth-form .btn .spinner { width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 999px; display: none; animation: auth-spin .7s linear infinite; }
.auth-form .btn.is-loading .spinner { display: inline-block; }
@keyframes auth-spin { to { transform: rotate(360deg); } }

/* Переключатель способа: Вожатский ID / По телефону */
.auth-methods {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin: 0 0 22px;
    background: var(--vz-surface-3);
    border-radius: 12px;
}
.auth-methods a {
    flex: 1;
    text-align: center;
    padding: 10px 12px;
    border-radius: 9px;
    font-size: .86rem;
    font-weight: 700;
    color: var(--vz-muted);
    transition: background .15s, color .15s;
}
.auth-methods a:hover { color: var(--vz-text); }
.auth-methods a.is-active {
    background: var(--vz-surface);
    color: var(--vz-text);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .08);
}

.auth-alt { margin: 24px 0 0; text-align: center; color: var(--vz-muted); font-size: .9rem; }
.auth-alt a { font-weight: 800; }
.auth-alt--muted { margin-top: 10px; font-size: .8rem; }
.auth-alt--muted a { font-weight: 600; }

/* Разделитель и альтернативные способы входа */
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 26px 0 0; color: var(--vz-muted); font-size: .78rem; }
.auth-divider::before,
.auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--vz-surface-3); }
.auth-social { display: grid; gap: 10px; margin-top: 14px; }
.auth-social .btn { width: 100%; }

.auth-note { margin-top: 18px; padding: 12px 14px; border-radius: var(--auth-radius); background: var(--vz-primary-soft); color: #9A3412; font-size: .8rem; line-height: 1.5; word-break: break-all; }
.auth-note a { color: #9A3412; text-decoration: underline; font-weight: 700; }

.auth-foot { margin: 34px 0 0; color: var(--vz-text-light); font-size: .78rem; text-align: center; }
.auth-foot a { color: var(--vz-muted); font-weight: 700; }
.auth-foot span { padding: 0 8px; opacity: .6; }

/* --- Адаптив --- */
@media (max-width: 960px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
    .auth-main { justify-content: flex-start; padding-top: 34px; }
    .auth-mobile-brand {
        display: inline-flex;
        align-items: center;
        gap: 11px;
        margin-bottom: 26px;
        font-weight: 800;
        color: var(--vz-text);
    }
    .auth-mobile-brand:hover { text-decoration: none; color: var(--vz-text); }
    .auth-mobile-brand .auth-brand__mark { width: 40px; height: 40px; border-radius: 12px; font-size: 20px; }
}

@media (max-width: 420px) {
    .auth-main { padding: 26px 18px 40px; }
    .auth-title { font-size: 1.5rem; }
}
