.auth-app {
    --auth-font-family: "Inter", "Segoe UI", Arial, sans-serif;
    --auth-bg: #eef7ff;
    --auth-surface: #ffffff;
    --auth-text: #111827;
    --auth-title: #2f343d;
    --auth-text-secondary: #6b7280;
    --auth-text-muted: #9ca3af;
    --auth-primary: #2563eb;
    --auth-primary-hover: #1d4ed8;
    --auth-border: #e5e7eb;
    --auth-input-border: #d1d5db;
    --auth-danger: #dc2626;
    --auth-radius-control: 8px;
    --auth-radius-card: 30px;
    --auth-shadow-elevated: 0 4px 6px rgba(0, 0, 0, .1);
    min-height: 100vh;
    background: var(--auth-bg);
    color: var(--auth-text);
    font-family: var(--auth-font-family);
    font-size: 16px;
    line-height: 24px;
}

body.auth-app {
    margin: 0;
    overflow-x: hidden;
}

.auth-app *,
.auth-app *::before,
.auth-app *::after {
    box-sizing: border-box;
}

.auth-page {
    width: 100%;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 40px 16px;
    overflow-x: hidden;
}

.auth-card {
    width: min(100%, 518px);
    max-width: calc(100vw - 32px);
    min-height: 0;
    padding: 60px;
    border: 0;
    border-radius: var(--auth-radius-card);
    background: var(--auth-surface);
    box-shadow: none;
}

.auth-card--compact {
    width: min(100%, 360px);
}

.auth-title {
    margin: 0 0 8px;
    color: var(--auth-title);
    font-size: 32px;
    font-weight: 600;
    line-height: 40px;
    letter-spacing: 0;
}

.auth-title--small {
    font-size: 24px;
    line-height: 32px;
}

.auth-subtitle {
    max-width: 340px;
    margin: 0;
    color: var(--auth-text-muted);
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
}

.auth-stack {
    display: grid;
    gap: 30px;
}

.auth-form {
    display: grid;
    gap: 14px;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-control);
    background: #f3f7fd;
}

.auth-tab {
    min-width: 0;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: var(--auth-primary);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .15s ease, color .15s ease;
}

.auth-tab:hover {
    color: var(--auth-primary-hover);
    text-decoration: none;
}

.auth-tab.is-active {
    background: var(--auth-primary);
    color: #ffffff;
}

.auth-tab.is-disabled {
    color: var(--auth-text-muted);
    cursor: not-allowed;
    opacity: .65;
    pointer-events: none;
}

.auth-oauth {
    display: grid;
    gap: 10px;
}

.auth-oauth-button,
.auth-button {
    width: 100%;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--auth-radius-control);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.auth-oauth-button {
    border: 1px solid var(--auth-border);
    background: var(--auth-surface);
    color: var(--auth-text-secondary);
}

.auth-oauth-button:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
    color: var(--auth-text);
    text-decoration: none;
}

.auth-yandex-mark {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #ff3d2e;
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}

.auth-divider {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    color: var(--auth-text-muted);
    font-size: 12px;
    line-height: 16px;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    height: 1px;
    background: var(--auth-border);
}

.auth-field {
    display: grid;
    gap: 8px;
}

.auth-label {
    color: #4b5563;
    font-size: 18px;
    font-weight: 500;
    line-height: 24px;
}

.auth-input-wrap {
    position: relative;
}

.auth-input {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-control);
    background: var(--auth-surface);
    color: var(--auth-text);
    font-family: var(--auth-font-family);
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.auth-input::placeholder {
    color: var(--auth-text-muted);
}

.auth-input:focus {
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.auth-input.is-invalid,
.auth-input[aria-invalid="true"] {
    border-color: var(--auth-danger);
}

.auth-password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: #6b7280;
    transform: translateY(-50%);
    cursor: pointer;
}

.auth-password-toggle:hover {
    color: var(--auth-text);
}

.auth-input-wrap .auth-input[type="password"],
.auth-input-wrap .auth-input[type="text"][data-auth-password-input] {
    padding-right: 44px;
}

.auth-checkbox-row {
    display: grid;
    grid-template-columns: 20px 1fr;
    gap: 10px;
    align-items: start;
    color: var(--auth-text-muted);
    font-size: 12px;
    line-height: 16px;
    cursor: pointer;
    user-select: none;
}

.auth-checkbox-row span {
    min-width: 0;
}

.auth-checkbox {
    width: 20px;
    height: 20px;
    margin: 0;
    border: 1px solid var(--auth-border);
    border-radius: 5px;
    appearance: none;
    background: #ffffff;
    accent-color: var(--auth-primary);
    cursor: pointer;
    display: inline-grid;
    place-content: center;
}

.auth-checkbox::before {
    content: "";
    width: 10px;
    height: 7px;
    border: solid #ffffff;
    border-width: 0 0 2px 2px;
    opacity: 0;
    transform: rotate(-45deg) translateY(-1px);
}

.auth-checkbox:checked {
    border-color: var(--auth-primary);
    background: var(--auth-primary);
}

.auth-checkbox:checked::before {
    opacity: 1;
}

.auth-checkbox:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .18);
    outline-offset: 2px;
}

.auth-checkbox-row a,
.auth-link {
    color: var(--auth-primary);
    text-decoration: none;
}

.auth-checkbox-row a:hover,
.auth-link:hover {
    color: var(--auth-primary-hover);
    text-decoration: underline;
}

.auth-button {
    border: 1px solid var(--auth-primary);
    background: var(--auth-primary);
    color: #ffffff;
}

.auth-button:hover {
    border-color: var(--auth-primary-hover);
    background: var(--auth-primary-hover);
    color: #ffffff;
    text-decoration: none;
}

.auth-button:disabled {
    opacity: .65;
    cursor: wait;
}

.auth-button--secondary {
    border-color: var(--auth-border);
    background: transparent;
    color: var(--auth-primary);
}

.auth-button--secondary:hover {
    border-color: rgba(37, 99, 235, .2);
    background: rgba(37, 99, 235, .06);
    color: var(--auth-primary-hover);
}

.auth-footnote {
    margin: 0;
    color: var(--auth-text-muted);
    font-size: 12px;
    line-height: 16px;
    text-align: center;
}

.auth-alert {
    padding: 12px 14px;
    border: 1px solid rgba(220, 38, 38, .18);
    border-radius: var(--auth-radius-control);
    background: rgba(220, 38, 38, .06);
    color: #991b1b;
    font-size: 14px;
    line-height: 20px;
}

.auth-error {
    display: none;
    min-height: 0;
    color: var(--auth-danger);
    font-size: 12px;
    line-height: 16px;
}

.auth-error:not(:empty) {
    display: block;
}

.auth-legal {
    color: var(--auth-text-muted);
    font-size: 12px;
    line-height: 16px;
}

.auth-code-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.auth-code-box {
    height: 36px;
    border: 1px solid var(--auth-border);
    border-radius: 6px;
    background: #ffffff;
}

.auth-meta-list {
    display: grid;
    gap: 10px;
    margin: 0;
}

.auth-meta-row {
    display: grid;
    gap: 2px;
}

.auth-meta-label {
    color: var(--auth-text-muted);
    font-size: 12px;
    line-height: 16px;
}

.auth-meta-value {
    color: var(--auth-text);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    overflow-wrap: anywhere;
}

@media (max-width: 640px) {
    .auth-page {
        align-items: start;
        padding: 24px 12px;
    }

    .auth-card {
        width: 100%;
        max-width: calc(100vw - 24px);
        padding: 32px 22px;
        border-radius: 22px;
    }
}

@media (max-width: 520px) {
    .auth-card {
        max-width: 366px;
    }

    .auth-tabs {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .auth-title {
        font-size: 28px;
        line-height: 36px;
    }

    .auth-label {
        font-size: 16px;
        line-height: 24px;
    }
}
