:root {
    --mk-auth-red: #cf0028;
    --mk-auth-green: #19aa1e;
    --mk-auth-text: #000;
    --mk-auth-muted: #808082;
    --mk-auth-border: #cdcdcd;
    --mk-auth-background: #fff;
    --mk-auth-backdrop: rgba(0, 0, 0, 0.52);
}

.mk-auth[hidden] {
    display: none !important;
}

.mk-auth {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    font-family: Rubik, Arial, sans-serif;
    color: var(--mk-auth-text);
}

body.mk-auth-is-open {
    overflow: hidden;
}

.mk-auth__backdrop {
    position: absolute;
    inset: 0;
    background: var(--mk-auth-backdrop);
}

.mk-auth__dialog {
    position: relative;
    z-index: 1;
    width: min(394px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--mk-auth-background);
    border-radius: 5px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.24);
    outline: none;
}

.mk-auth__dialog--wide {
    width: min(640px, calc(100vw - 24px));
}

.mk-auth__top-line {
    position: sticky;
    z-index: 3;
    top: 0;
    width: 100%;
    height: 5px;
    background: var(--mk-auth-red);
}

.mk-auth__close {
    position: absolute;
    z-index: 4;
    top: 14px;
    right: 14px;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
}

.mk-auth__close:hover,
.mk-auth__close:focus-visible {
    background: #f3f3f3;
}

.mk-auth__close span::before,
.mk-auth__close span::after {
    content: "";
    position: absolute;
    top: 13px;
    left: 6px;
    width: 17px;
    height: 1.5px;
    background: var(--mk-auth-muted);
}

.mk-auth__close span::before {
    transform: rotate(45deg);
}

.mk-auth__close span::after {
    transform: rotate(-45deg);
}

.mk-auth__content {
    padding: 39px 50px 48px;
}

.mk-auth__content--registration {
    padding-top: 12px;
    padding-bottom: 40px;
}

.mk-auth__title {
    margin: 0;
    padding-right: 28px;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.2;
}

.mk-auth__accent {
    width: 28px;
    height: 2px;
    margin: 0 0 27px;
    background: var(--mk-auth-red);
    border-radius: 5px;
}

.mk-auth__title + .mk-auth__accent {
    margin-top: 0;
}

.mk-auth__intro {
    margin: 0 0 10px;
    font-size: 12px;
    line-height: 1.35;
}

.mk-auth__message {
    margin: 0 0 16px;
    padding: 10px 12px;
    border-radius: 5px;
    background: lightgreen;
    font-size: 12px;
    line-height: 1.4;

}

.mk-auth__message--error {
    color: var(--mk-auth-red);
    background: #fff1f3;
}

.mk-auth__message--success {
    color: #117a15;
    background: #effbef;
}

.mk-auth__field {
    margin-bottom: 14px;
}

.mk-auth__field-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    /*margin-bottom: 5px;*/
}

.mk-auth__label {
    display: block;
    font-size: 12px;
    line-height: 1.2;
}

.mk-auth__verify-button {
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.mk-auth__password-email {
    display: flex;
    justify-content: center;
    margin: 1rem 0 0;
    color: #646464;
    font-size: 14px;
}

.mk-auth__resend {
    text-align: center;
}

.mk-auth__resend-button {
    font-size: 14px;
}

.mk-auth__verify-button[data-mk-auth-confirm-field="phone"] {
    color: var(--mk-auth-red);
}


.mk-auth__status {
    flex: 0 0 auto;
    font-size: 12px;
    line-height: 1.2;
}

.mk-auth__status--confirmed {
    color: var(--mk-auth-green);
}

.mk-auth__field-error {
    min-height: 12px;
    margin-top: 4px;
    color: var(--mk-auth-red);
    font-size: 12px;
    line-height: 1.2;
}

.mk-auth__input-wrap {
    position: relative;
}

.mk-auth__input {
    box-sizing: border-box;
    width: 100%;
    height: 37px;
    padding: 0 9px;
    border: 1px solid var(--mk-auth-border);
    border-radius: 5px;
    background: #fff;
    color: var(--mk-auth-text);
    font: inherit;
    font-size: 15px;
    line-height: 35px;
    outline: none;
}

.mk-auth__input::placeholder {
    color: var(--mk-auth-muted);
    opacity: 1;
}

.mk-auth__input:focus {
    border-color: var(--mk-auth-red);
    box-shadow: 0 0 0 1px rgba(207, 0, 40, 0.08);
}

.mk-auth__input[readonly] {
    background: #fafafa;
}

.mk-auth__input[aria-invalid="true"] {
    border-color: var(--mk-auth-red);
}

.mk-auth__password-toggle {
    position: absolute;
    top: 0;
    right: 0;
    width: 37px;
    height: 37px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--mk-auth-muted);
    cursor: pointer;
}

.mk-auth__password-toggle::before {
    content: "◉";
    opacity: 0.35;
}

.mk-auth__help {
    margin: -8px 0 17px;
    color: var(--mk-auth-muted);
    font-size: 12px;
    line-height: 1.2;
}

.mk-auth__button {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    min-height: 37px;
    padding: 9px 14px;
    border: 1px solid var(--mk-auth-red);
    border-radius: 5px;
    background: var(--mk-auth-red);
    color: #fff;
    font: inherit;
    font-size: 17px;
    line-height: 1.1;
    text-align: center;
    cursor: pointer;
}

.mk-auth__button:hover,
.mk-auth__button:focus-visible {
    filter: brightness(0.94);
}

.mk-auth__button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.mk-auth__button--secondary {
    background: #fff;
    color: var(--mk-auth-red);
}

.mk-auth__button--plain {
    border-color: var(--mk-auth-red);
    background: #fff;
    color: var(--mk-auth-text);
    font-size: 17px;
}

.mk-auth__actions {
    display: grid;
    gap: 10px;
    grid-auto-rows: 1fr;
}

.mk-auth__actions .mk-auth__button {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.mk-auth__method-note {
    display: block;
    margin-top: 4px;
    color: var(--mk-auth-muted);
    font-size: 12px;
}

.mk-auth__checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: 3px 0 18px;
    font-size: 12px;
    line-height: 1.3;
}

.mk-auth__checkbox {
    width: 14px;
    height: 14px;
    margin: 1px 0 0;
    accent-color: var(--mk-auth-red);
}

.mk-auth__legal-note {
    margin: 9px 0 0 20px;
    color: var(--mk-auth-muted);
    font-size: 11px;
    line-height: 1.3;
}

.mk-auth__agreement {
    margin: 8px 0 0;
    color: var(--mk-auth-muted);
    font-size: 11px;
    line-height: 1.2;
}

.mk-auth__agreement a,
.mk-auth__legacy-link {
    color: inherit;
    font-weight: 500;
    text-decoration: underline;
}

.mk-auth__legacy {
    margin: 18px 0 0;
    text-align: center;
    font-size: 12px;
    line-height: 1.35;
}

.mk-auth__back-button {
    display: inline-flex;
    margin: 0 0 18px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--mk-auth-muted);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.mk-auth__back-button:hover,
.mk-auth__back-button:focus-visible {
    color: var(--mk-auth-red);
}

.mk-auth__code {
    letter-spacing: 0.28em;
    text-align: center;
    font-size: 18px;
}

@media (max-width: 420px) {
    .mk-auth {
        align-items: flex-start;
        padding: 8px;
    }

    .mk-auth__dialog {
        width: calc(100vw - 16px);
        max-height: calc(100dvh - 16px);
    }

    .mk-auth__content,
    .mk-auth__content--registration {
        padding-right: 24px;
        padding-left: 24px;
    }
}

/* Экран подтверждения SMS */
.mk-auth__dialog:has(.mk-auth__content--sms-code) {
    width: min(360px, calc(100vw - 24px));
}

.mk-auth__content--sms-code {
    box-sizing: border-box;
    /*min-height: 411px;*/
    padding: 39px 41px 36px;
}

.mk-auth__content--sms-code .mk-auth__accent {
    margin-bottom: 27px;
}

.mk-auth__sms-description {
    margin: 0 0 25px;
    color: #646464;
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    text-align: center;
}

.mk-auth__sms-description strong {
    color: #000;
    font-weight: 400;
}

.mk-auth__sms-code-label {
    display: block;
    margin: 0 0 5px;
    font-size: 12px;
    line-height: 18px;
}

.mk-auth__otp-wrap {
    position: relative;
    display: flex;
    gap: 10px;
    width: 100%;
    height: 43px;
    cursor: text;
}
.mk-auth__otp-input {
    position: absolute;
    z-index: 2;
    inset: 0;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: transparent;
    caret-color: transparent;
    opacity: 0;
}

.mk-auth__otp-cells {
    display: flex;
    gap: 10px;
    width: 100%;
    pointer-events: none;
}

.mk-auth__otp-cell {
    flex: 0 0 38px;
    box-sizing: border-box;
    width: 38px;
    height: 43px;
    padding: 0;
    border: 1px solid var(--mk-auth-border);
    border-radius: 5px;
    background: #fff;
    color: #000;
    font: inherit;
    font-size: 20px;
    font-weight: 400;
    line-height: 41px;
    text-align: center;
    outline: 0;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

.mk-auth__otp-cell--filled,
.mk-auth__otp-cell--active,
.mk-auth__otp-input:focus + .mk-auth__otp-cells .mk-auth__otp-cell--active {
    border-color: var(--mk-auth-red);
}

.mk-auth__otp-input:focus + .mk-auth__otp-cells .mk-auth__otp-cell--active {
    box-shadow: 0 0 0 1px rgba(207, 0, 40, 0.08);
}

.mk-auth__otp-wrap--invalid .mk-auth__otp-cell {
    border-color: var(--mk-auth-red);
}

.mk-auth__otp-wrap--disabled {
    cursor: default;
}

.mk-auth__otp-wrap--disabled .mk-auth__otp-cell {
    border-color: #d7d7d7;
    background: #f2f2f2;
    color: #8d8d8d;
    box-shadow: none;
}

.mk-auth__sms-code-error {
    min-height: 16px;
    margin-top: 8px;
    margin-bottom: 4px;
    text-align: left;
}

.mk-auth__sms-general:empty {
    display: none;
}

.mk-auth__sms-general .mk-auth__message {
    margin: -14px 0 12px;
    padding: 7px 9px;
    font-size: 12px;
}

.mk-auth__sms-form--busy .mk-auth__otp-cells {
    opacity: 0.65;
}

.mk-auth__resend {
    min-height: 18px;
    margin-top: 0;
    font-size: 12px;
    line-height: 18px;
}

.mk-auth__resend-button,
.mk-auth__link-button {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
    font-size: 12px;
}

.mk-auth__resend-button {
    text-decoration: none;
}

.mk-auth__resend-button span {
    color: var(--mk-auth-red);
}

.mk-auth__resend-button:disabled {
    cursor: default;
    opacity: 1;
    font-size: 13px;
}

.mk-auth__resend-button:not(:disabled):hover,
.mk-auth__resend-button:not(:disabled):focus-visible,
.mk-auth__link-button:hover,
.mk-auth__link-button:focus-visible,
.mk-auth__sms-footer a:hover,
.mk-auth__sms-footer a:focus-visible {
    color: var(--mk-auth-red);
}

.mk-auth__sms-loading {
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #646464;
    font-size: 14px;
    text-align: center;
}

.mk-auth__sms-separator {
    height: 1px;
    margin: 31px 0 20px;
    background: var(--mk-auth-border);
    opacity: 0.8;
}

.mk-auth__sms-change-method {
    text-align: center;
}

.mk-auth__sms-change-method .mk-auth__link-button {
    color: #646464;
    font-size: 12px;
    font-weight: 300;
    line-height: 18px;
}

.mk-auth__sms-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 12px;
    color: #646464;
    font-size: 9px;
    font-weight: 300;
    line-height: 18px;
}

.mk-auth__sms-footer a {
    color: inherit;
    text-decoration: underline;
    font-size: 12px;
}

.mk-auth__visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.mk-auth__password-hints {
    padding-bottom: 10px;
    color: var(--mk-auth-red);
}

.mk-auth__input[name="message"] {
    min-height: 130px;
    resize: vertical;
    font-family: inherit;
}

@media (max-width: 370px) {
    .mk-auth__content--sms-code {
        padding-right: 24px;
        padding-left: 24px;
    }

    .mk-auth__otp-cells {
        justify-content: space-between;
        gap: 6px;
    }

    .mk-auth__otp-cell {
        flex-basis: calc((100% - 30px) / 6);
        width: calc((100% - 30px) / 6);
        min-width: 34px;
    }
}

/* Подсказки DaData для регистрации юрлица / ИП */
.mk-auth__company-suggestions[hidden] {
    display: none !important;
}

.mk-auth__company-suggestions {
    margin: -8px 0 14px;
    overflow: hidden;
    border: 1px solid var(--mk-auth-border);
    border-radius: 5px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.mk-auth__company-suggestion {
    display: block;
    box-sizing: border-box;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-bottom: 1px solid #ececec;
    background: #fff;
    color: var(--mk-auth-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.mk-auth__company-suggestion:last-child {
    border-bottom: 0;
}

.mk-auth__company-suggestion:hover,
.mk-auth__company-suggestion:focus-visible {
    background: #f7f7f7;
    outline: none;
}

.mk-auth__company-suggestion-name {
    display: block;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
}

.mk-auth__company-suggestion-meta {
    display: block;
    margin-top: 3px;
    color: var(--mk-auth-muted);
    font-size: 11px;
    line-height: 1.3;
}

.mk-auth__company-lookup-message {
    padding: 8px 10px;
    color: var(--mk-auth-muted);
    font-size: 11px;
    line-height: 1.35;
}
