* { box-sizing: border-box; }

:root{
    --bg: #E7E8EF;                  /* может остаться, но в body переопределим */
    --card-bg: #ffffff;
    --border: #E5E7EB;
    --text: #111827;
    --muted: #6B7280;

    --primary: #0B4DA2;
    --primary-shadow: rgba(11, 77, 162, 0.25);

    --input-bg: #F9FAFB;
    --focus-border: rgba(13, 95, 196, 0.55);
    --focus-shadow: rgba(13, 95, 196, 0.12);

    --danger-border: #f5c2c7;
    --danger-bg: #FEF0F2;
    --danger-text: #842029;

    --success-border: #A7F3D0;
    --success-bg: #ECFDF3;
    --success-text: #065F46;

    --radius-card: 12px;
    --radius-input: 8px;
    --radius-btn: 10px;

    --shadow-card:
            0 1px 2px rgba(29, 41, 61, 0.04),
            0 8px 24px rgba(0, 0, 0, 0.08);

    --grain-url: url("/partners/yesim.app/static/media/grain.58e7b5dfd54b334d6d66.png");
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;

    font-family: Inter, system-ui, -apple-system, Arial, sans-serif;

    /* Исправленный фон согласно дизайну */
    background-color: #F3F4F6;  /* var(--colors-background-bg-tertiary, #F3F4F6) */
    background-image:
            var(--grain-url),
            linear-gradient(
                    180deg,
                    rgba(0, 145, 250, 0.00) 0%,
                    rgba(0, 145, 250, 0.00) 11.79%,
                    rgba(0, 145, 250, 0.00) 21.38%,
                    rgba(0, 145, 250, 0.01) 29.12%,
                    rgba(0, 145, 250, 0.02) 35.34%,
                    rgba(0, 145, 250, 0.03) 40.37%,
                    rgba(0, 145, 250, 0.04) 44.56%,
                    rgba(0, 145, 250, 0.05) 48.24%,
                    rgba(0, 145, 250, 0.06) 51.76%,
                    rgba(0, 145, 250, 0.07) 55.44%,
                    rgba(0, 145, 250, 0.09) 59.63%,
                    rgba(0, 145, 250, 0.10) 64.66%,
                    rgba(0, 145, 250, 0.11) 70.88%,
                    rgba(0, 145, 250, 0.13) 78.62%,
                    rgba(0, 145, 250, 0.14) 88.21%,
                    rgba(0, 145, 250, 0.15) 100%
            );
    background-repeat: repeat, no-repeat;
    background-size: 50px 50px, cover;
}

.page-pad {
    padding: 24px;
}

.auth-card {
    width: 448px;
    padding: 32px;

    background: var(--card-bg);
    border-radius: var(--radius-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
}

.auth-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 22px 0;
    text-align: left;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
}

.form-group input {
    width: 100%;
    height: 36px;
    padding: 0 12px;

    font-size: 13px;
    color: var(--text);

    border-radius: var(--radius-input);
    border: 1px solid var(--border);
    background: var(--input-bg);

    transition: all 0.18s ease;
}

.form-group input:focus {
    outline: none;
    background: #ffffff;
    border-color: var(--focus-border);
    box-shadow: 0 0 0 3px var(--focus-shadow);
}

.actions-right {
    display: flex;
    justify-content: flex-end;
    margin-top: -6px;
    margin-bottom: 22px;
}

.actions-right a {
    font-size: 12px;
    color: var(--muted);
    text-decoration: none;
}

.actions-right a:hover {
    text-decoration: underline;
}

.btn {
    height: 40px;
    padding: 0 18px;

    border: none;
    border-radius: var(--radius-btn);
    cursor: pointer;

    font-size: 14px;
    font-weight: 500;

    transition: background-color 0.2s ease; /* меняем filter на background-color */
}

.btn--primary {
    background: var(--primary);
    color: #fff;
    /* box-shadow и text-shadow удалены */
}

.btn--primary:hover {
    background: #10375C;  /* цвет из дизайна, без теней */
}

.btn--w-50 { width: 50%; }
.btn--w-35 { width: 35%; }
.btn--w-100 { width: 100%; }

.icon-16 {
    width: 16px;
    /*height: 16px;*/
    display: inline-block;
    flex: 0 0 16px;
}

.alert {
    position: relative;
    padding: 10px 36px 10px 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 12px;
    width: auto;
    left: auto;
    display: flex;
    gap: 8px;
}

.alert--danger {
    border: 1px solid var(--danger-border);
    background: var(--danger-bg);
    color: var(--danger-text);
}

.alert--success {
    border: 1px solid var(--success-border);
    background: var(--success-bg);
    color: var(--success-text);
    font-size: 14px;
}

.error-text {
    color: #dc2626;
    font-size: 13px;
    margin-top: 6px;
    margin-bottom: 0;
}

.text-muted {
    font-size: 14px;
    color: var(--muted);
    line-height: 1.45;
    margin: 0 0 14px 0;
    font-weight: 400;
}

.text-muted p { margin: 0 0 8px 0; }
.text-muted p:last-child { margin-bottom: 0; }

.btn-check-email {
    width: 100%;
    height: 40px;
    padding: 0 14px;

    display: inline-flex;
    align-items: center;
    gap: 8px;

    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success-text);

    font-size: 13px;
    font-weight: 600;

    border-radius: var(--radius-btn);
    cursor: pointer;

    box-shadow: none;
    transition: filter 0.2s ease, background-color 0.2s ease;
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 640px) {
    .auth-card,
    .auth-card--compact {
        width: calc(100% - 32px);
    }
}