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

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

.mk-account {
    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-account-text);
}

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

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

.mk-account__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-account-background);
    border-radius: 5px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.24);
    outline: none;
}

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

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

.mk-account__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-account__close:hover,
.mk-account__close:focus-visible {
    background: #f3f3f3;
}

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

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

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

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

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

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

.mk-account__intro {
    margin: -13px 0 20px;
    color: #646464;
    font-size: 12px;
    line-height: 1.45;
}

.mk-account__identity-line {
    margin: -8px 0 25px;
    color: var(--mk-account-text);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
    overflow-wrap: anywhere;
}

.mk-account__sms-description + .mk-account__identity-line {
    margin-top: -18px;
}

.mk-account__message {
    margin: 0 0 16px;
    padding: 10px 12px;
    border-radius: 5px;
    background: #f5f5f5;
    font-size: 12px;
    line-height: 1.4;
}

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

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

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

.mk-account__label {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    line-height: 1.2;
}

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

.mk-account__password-hints {
    color: var(--mk-account-red);
    font-size: 12px;
    line-height: 1.2;
}

.mk-account__password-hints:not(:empty) {
    margin-top: -6px;
    margin-bottom: 8px;
}
.mk-account__input-wrap {
    position: relative;
}

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

.mk-account__input::placeholder {
    color: var(--mk-account-muted);
    opacity: 1;
}

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

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

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

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

.mk-account__help {
    margin: -7px 0 4px;
    color: var(--mk-account-muted);
    font-size: 11px;
    line-height: 1.3;
}

.mk-account__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-account-red);
    border-radius: 5px;
    background: var(--mk-account-red);
    color: #fff;
    font: inherit;
    font-size: 17px;
    line-height: 1.1;
    text-align: center;
    cursor: pointer;
}

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

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

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

.mk-account__button--plain {
    min-height: 53px;
    background: #fff;
    color: var(--mk-account-text);
    font-size: 16px;
}

.mk-account__actions {
    display: grid;
    gap: 10px;
}

.mk-account__method-note {
    display: block;
    margin-top: 4px;
    color: var(--mk-account-muted);
    font-size: 12px;
    font-weight: 400;
}

/* Главный экран */
.mk-account__menu {
    overflow: hidden;
    border: 1px solid var(--mk-account-border);
    border-radius: 5px;
}

.mk-account__menu-item {
    position: relative;
    display: grid;
    box-sizing: border-box;
    width: 100%;
    min-height: 66px;
    padding: 12px 42px 12px 14px;
    border: 0;
    border-bottom: 1px solid #ececec;
    background: #fff;
    color: var(--mk-account-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.mk-account__menu-item:last-child {
    border-bottom: 0;
}

.mk-account__menu-item:hover,
.mk-account__menu-item:focus-visible {
    background: #f8f8f8;
    outline: none;
}

.mk-account__menu-title {
    align-self: end;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.25;
}

.mk-account__menu-note {
    align-self: start;
    margin-top: 3px;
    color: var(--mk-account-muted);
    font-size: 11px;
    line-height: 1.25;
}

.mk-account__menu-arrow {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    color: var(--mk-account-muted);
    font-size: 27px;
    font-weight: 300;
    line-height: 1;
}

/* SMS */
.mk-account__content--sms-code {
    box-sizing: border-box;
    padding: 39px 41px 36px;
}

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

.mk-account__otp-wrap {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
}

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

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

.mk-account__sms-code-error {
    min-height: 18px;
    margin-top: 8px;
    margin-bottom: 4px;
}

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

.mk-account__resend-button {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.mk-account__resend-button span {
    color: var(--mk-account-red);
}

.mk-account__resend-button:disabled {
    cursor: default;
    opacity: 1;
}

.mk-account__resend-button:not(:disabled):hover,
.mk-account__resend-button:not(:disabled):focus-visible {
    color: var(--mk-account-red);
}

.mk-account__loading {
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #646464;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
}

.mk-account__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;
}

/* Временная кнопка для закрытого тестирования. После запуска отключается
 * параметром модуля, frontend при этом остаётся без изменений. */
.mk-account-launcher {
    position: fixed;
    z-index: 9990;
    right: 18px;
    bottom: 18px;
    padding: 9px 14px;
    border: 1px solid var(--mk-account-red);
    border-radius: 5px;
    background: #fff;
    color: var(--mk-account-red);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.16);
    font-family: Rubik, Arial, sans-serif;
    font-size: 13px;
    line-height: 1.2;
    cursor: pointer;
}

.mk-account-launcher:hover,
.mk-account-launcher:focus-visible {
    background: var(--mk-account-red);
    color: #fff;
}

body.mk-account-is-open .mk-account-launcher {
    visibility: hidden;
}

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

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

    .mk-account__content,
    .mk-account__content--sms-code {
        padding-right: 24px;
        padding-left: 24px;
    }

    .mk-account-launcher {
        right: 10px;
        bottom: 10px;
    }
}

@media (max-width: 370px) {
    .mk-account__otp-wrap {
        gap: 6px;
    }

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

/* Недоступное self-service действие показываем как состояние, а не как
 * кликабельную кнопку. */
.mk-account__menu-item:disabled,
.mk-account__menu-item[aria-disabled="true"] {
    cursor: default;
    opacity: 0.58;
    background: #fff;
}

.mk-account__menu-item:disabled:hover,
.mk-account__menu-item:disabled:focus-visible {
    background: #fff;
}

/* ===== Полноценная страница профиля ===== */
.mk-profile {
    box-sizing: border-box;
    width: 100%;
    max-width: 820px;
    font-family: Rubik, Arial, sans-serif;
    color: var(--mk-account-text);
}

.mk-profile *,
.mk-profile *::before,
.mk-profile *::after {
    box-sizing: border-box;
}

.mk-profile__loading,
.mk-profile__notice {
    padding: 16px 18px;
    border: 1px solid var(--mk-account-border);
    border-radius: 5px;
    background: #fff;
    font-size: 14px;
    line-height: 1.45;
}

.mk-profile__notice {
    margin-bottom: 18px;
}

.mk-profile__notice--error {
    color: var(--mk-account-red);
    background: #fff1f3;
    border-color: #f0c8d0;
}

.mk-profile__notice--success {
    color: #117a15;
    background: #effbef;
    border-color: #cce8cc;
}

.mk-profile__section {
    margin-bottom: 22px;
    padding: 22px 24px;
    border: 1px solid var(--mk-account-border);
    border-radius: 5px;
    background: #fff;
}

.mk-profile__section-title {
    margin: 0 0 20px;
    padding: 0 0 10px;
    border-bottom: 2px solid var(--mk-account-red);
    font-size: 20px;
    font-weight: 600;
    line-height: 1.25;
}

.mk-profile__form {
    max-width: 620px;
}

.mk-profile__field {
    margin-bottom: 16px;
}

.mk-profile__label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
}

.mk-profile__input {
    width: 100%;
    min-height: 39px;
    padding: 8px 10px;
    border: 1px solid var(--mk-account-border);
    border-radius: 5px;
    background: #fff;
    color: var(--mk-account-text);
    font: inherit;
    font-size: 15px;
    outline: none;
}

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

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

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

.mk-profile__save,
.mk-profile__change {
    border: 1px solid var(--mk-account-red);
    border-radius: 5px;
    background: #fff;
    color: var(--mk-account-red);
    font: inherit;
    cursor: pointer;
}

.mk-profile__save {
    min-width: 160px;
    min-height: 39px;
    padding: 8px 18px;
    background: var(--mk-account-red);
    color: #fff;
    font-size: 15px;
}

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

.mk-profile__change {
    min-height: 32px;
    padding: 5px 12px;
    font-size: 13px;
}

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

.mk-profile__form-status {
    min-height: 16px;
    margin: 2px 0 10px;
    font-size: 12px;
}

.mk-profile__form-status--error {
    color: var(--mk-account-red);
}

.mk-profile__form-status--success {
    color: #117a15;
}

.mk-profile__row {
    display: grid;
    grid-template-columns: minmax(120px, 180px) minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    min-height: 54px;
    padding: 10px 0;
    border-bottom: 1px solid #ececec;
}

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

.mk-profile__row-label {
    color: #646464;
    font-size: 13px;
}

.mk-profile__row-value {
    overflow-wrap: anywhere;
    font-size: 15px;
}

.mk-profile__row-note,
.mk-profile__muted {
    margin-top: 3px;
    color: var(--mk-account-muted);
    font-size: 11px;
    line-height: 1.25;
}

.mk-profile__row-note--confirmed {
    color: var(--mk-account-green);
}

.mk-profile__row-note--unconfirmed {
    color: var(--mk-account-red);
}

.mk-profile__row-action {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    text-align: right;
}

.mk-profile__verify {
    border-color: #8a8a8a;
    color: #555;
}

.mk-profile__verification {
    margin: 0 0 8px;
    padding: 12px 14px;
    border: 1px solid #e3e3e3;
    border-radius: 6px;
    background: #fafafa;
}

.mk-profile__verification-title {
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: 600;
}

.mk-profile__verification-message {
    margin-bottom: 10px;
    color: var(--mk-account-muted);
    font-size: 12px;
    line-height: 1.35;
}

.mk-profile__verification-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.mk-profile__verification-code {
    width: 130px;
    min-height: 34px;
    padding: 6px 9px;
    border: 1px solid #cfcfcf;
    border-radius: 5px;
    background: #fff;
    font: inherit;
    letter-spacing: 0.08em;
}

.mk-profile__verification-code:focus {
    border-color: var(--mk-account-red);
    outline: none;
    box-shadow: 0 0 0 2px rgba(172, 17, 35, 0.08);
}

.mk-profile__verification-error {
    margin-top: 7px;
    color: var(--mk-account-red);
    font-size: 12px;
}

.mk-account-profile-link {
    display: inline-block;
}

@media (max-width: 640px) {
    .mk-profile__section {
        padding: 18px 16px;
    }

    .mk-profile__row {
        grid-template-columns: 1fr auto;
        gap: 6px 10px;
    }

    .mk-profile__row-label {
        grid-column: 1 / -1;
    }

    .mk-profile__row-action {
        align-self: center;
    }
}
