/* Оформление повторяет форму входа web/frontend:
   палитра, типографика и геометрия из его токенов */
:root {
    --bg-base: #ffffff;
    --bg-primary: #f2f2f2;
    --bg-primary-hover: #e0e0e0;
    --text-primary: #404040;
    --text-secondary: #595959;
    --text-description: #a6a6a6;
    --text-inverse: #ffffff;
    --brand: #ff335f;
    --brand-hover: #f3345c;
    --brand-pressed: #e62e55;
    --text-brand: #ff335f;
    --text-brand-pressed: #cc294c;
    --sber: #21a038;
    --sber-hover: #1a802d;
    --sber-pressed: #156624;
    --red: #ff3b30;
    --red-bg: rgba(255, 59, 48, .1);
    --warn-bg: #fff8e5;
    --warn-border: #e3b341;
    --rounding08: 8px;
    --rounding12: 12px;
    --rounding32: 32px;
    --rounding-full: 1000px;
    color-scheme: light;
}

* { box-sizing: border-box; }

body {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 32px;
    margin: 0;
    font: 16px/1.4 "Inter", "Avenir", "Helvetica", "Arial", sans-serif;
    color: var(--text-primary);
    background: var(--bg-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* auto-отступы центрируют карточку, но не обрезают её верх,
   когда контента больше экрана */
.card {
    width: 100%;
    max-width: 483px;
    padding: 24px 40px 48px;
    margin: auto 0;
    background: var(--bg-base);
}

h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 22px;
    letter-spacing: -.38px;
}

h2 {
    margin: 24px 0 8px;
    font-size: 14px;
    font-weight: 600;
    line-height: 18px;
    color: var(--text-secondary);
}

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

/* Страницы входа: форма по центру, соглашение прижато к низу,
   как в шторке web/frontend */
.auth {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 64px);
}

.auth h1 { text-align: center; }

.auth-note {
    max-width: 360px;
    margin: 8px auto 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 18px;
    color: var(--text-description);
    text-align: center;
}

.auth-form {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 32px;
    justify-content: center;
    width: 100%;
    max-width: 295px;
    margin: 24px auto;
}

/* Колонка выбора способа входа: кнопка Сбера и форма телефона по центру,
   как на экране входа web/frontend */
.auth-options {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 24px;
    justify-content: center;
    width: 100%;
    max-width: 295px;
    margin: 24px auto;
}

.auth-options .auth-form {
    flex: none;
    margin: 0;
}

.sber-login {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Зелёная кнопка Сбера: цвет и логотип те же, что у кнопки входа web/frontend */
button.sber {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    width: 100%;
    color: var(--text-inverse);
    background: var(--sber);
}

button.sber img {
    width: 24px;
    height: 24px;
}

button.sber:hover:not(:disabled) { background: var(--sber-hover); }
button.sber:active:not(:disabled) { background: var(--sber-pressed); }

.auth-form--code {
    max-width: 100%;
    gap: 16px;
}

.auth-form > button { width: 100%; }

.auth-form--code > button {
    max-width: 295px;
    margin: 0 auto;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.field-label {
    font-size: 14px;
    font-weight: 600;
    line-height: 18px;
    letter-spacing: -.1px;
    color: var(--text-description);
    text-align: center;
}

/* Поле без рамки: крупный текст по центру, как TextInput size=l в web/frontend */
.phone-input {
    width: 100%;
    padding: 0;
    font: inherit;
    font-size: 32px;
    font-weight: 700;
    line-height: 32px;
    letter-spacing: -.6px;
    color: var(--text-primary);
    text-align: center;
    caret-color: var(--brand);
    background: transparent;
    border: 0;
    outline: transparent;
}

.phone-input::placeholder { color: var(--text-description); }

.phone-input:focus-visible {
    border-radius: var(--rounding08);
    outline: 2px solid var(--brand);
    outline-offset: 6px;
}

.code-boxes {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

/* Атрибут hidden сам по себе не сработает: авторский display его перебивает */
.code-boxes[hidden] { display: none; }

.code-box {
    width: 48px;
    height: 72px;
    padding: 12px 0;
    font: inherit;
    font-size: 48px;
    font-weight: 700;
    line-height: 46px;
    color: var(--text-primary);
    text-align: center;
    caret-color: var(--brand);
    background: var(--bg-primary);
    border: 0;
    border-radius: var(--rounding12);
    outline: transparent;
}

.code-box:focus-visible { box-shadow: inset 0 0 0 2px var(--brand); }

.code-boxes--error .code-box {
    color: var(--red);
    background: var(--red-bg);
}

/* Длинные коды (7..10 цифр) не помещаются в строку боксов
   стандартного размера */
.code-boxes--dense { gap: 6px; }

.code-boxes--dense .code-box {
    width: 34px;
    height: 56px;
    padding: 10px 0;
    font-size: 26px;
    line-height: 28px;
    border-radius: var(--rounding08);
}

.error-text {
    font-size: 14px;
    font-weight: 600;
    line-height: 18px;
    color: var(--red);
    text-align: center;
}

button {
    height: 56px;
    padding: 0 24px;
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    line-height: 19px;
    color: var(--text-primary);
    cursor: pointer;
    background: var(--bg-primary);
    border: 0;
    border-radius: var(--rounding-full);
}

button.primary {
    color: var(--text-inverse);
    background: var(--brand);
}

button.primary:hover:not(:disabled) { background: var(--brand-hover); }
button.primary:active:not(:disabled) { background: var(--brand-pressed); }

button.ghost {
    height: auto;
    min-height: 70px;
    padding: 16px 0;
    color: var(--text-brand);
    background: transparent;
    border-radius: 0;
}

button.ghost:active:not(:disabled) { color: var(--text-brand-pressed); }

button:disabled {
    cursor: not-allowed;
    opacity: .6;
}

/* У ghost-кнопки недоступность показывается цветом текста,
   а не прозрачностью */
button.ghost:disabled {
    color: var(--text-description);
    opacity: 1;
}

.resend {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    margin-top: 8px;
}

.agreement {
    margin: 24px 0 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 18px;
    color: var(--text-description);
    text-align: center;
}

.agreement a {
    color: var(--text-secondary);
    text-decoration: none;
}

.agreement a:hover,
.agreement a:active {
    background: var(--bg-primary-hover);
    border-radius: 4px;
}

.actions {
    display: flex;
    gap: 8px;
    margin-top: 24px;
}

.actions button { flex: 1; }

.notice {
    padding: 12px 16px;
    margin-top: 20px;
    font-size: 14px;
    line-height: 18px;
    background: var(--warn-bg);
    border: 1px solid var(--warn-border);
    border-radius: var(--rounding12);
}

.details {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 16px;
    margin: 24px 0 0;
    font-size: 14px;
    line-height: 18px;
}

.details dt { color: var(--text-description); }
.details dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

.scopes {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.scopes label { display: flex; gap: 8px; align-items: baseline; }
.scopes input { accent-color: var(--brand); }

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

.auth .footnote { text-align: center; }

/* Размеры элементов на планшетах и ноутбуках — как в web/frontend на --m-viewport */
@media (max-width: 1279px) {
    h1 {
        font-size: 16px;
        line-height: 19px;
        letter-spacing: -.3px;
    }

    .field-label { font-size: 13px; letter-spacing: .02px; }

    .agreement { font-size: 13px; letter-spacing: .02px; }

    button {
        height: 48px;
        font-size: 15px;
        line-height: 18px;
    }

    .code-boxes { gap: 6px; }

    .code-box {
        width: 32px;
        height: 48px;
        padding: 8px 0;
        font-size: 32px;
        line-height: 32px;
        border-radius: var(--rounding08);
    }

    .code-boxes--dense { gap: 4px; }

    .code-boxes--dense .code-box {
        width: 26px;
        height: 42px;
        padding: 6px 0;
        font-size: 20px;
        line-height: 22px;
        border-radius: 6px;
    }
}

@media (max-width: 600px) {
    body { padding: 0; }

    .card {
        max-width: none;
        padding: 16px 20px 24px;
        margin: 0;
        border-radius: var(--rounding32) var(--rounding32) 0 0;
    }

    .auth { min-height: 100vh; }

    .auth-form { margin: 16px auto; }

    .auth-options { margin: 16px auto; }
}
